Skip to content
Back to skills

Os Clean Locks

ASecurity

Safely removes all agent lock files from the context/.locks/ directory to resolve deadlocks caused by crashed agents leaving stale locks behind. Use when the user says "/os-clean-locks", "clear all locks", "reset agent locks", or when an agent is deadlocked and cannot acquire a lock because a previous agent crashed and left a stale lock behind in context/.locks/. Verifies lock existence, discovers and removes stale lock directories, updates OS state via kernel.py, and emits event bus notifica...

  • 7 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 2, 2026
ai-agentspythonbash

Security analysis

A93/100
  • highPerforms destructive filesystem operations

Pro scans all 8 files and shows the line behind each finding

Scanned October 3, 2026

npx -y skills add richfrem/agent-plugins-skills --skill os-clean-locks --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Os Clean Locks?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Os Clean Locks
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/richfrem-os-clean-locks/badge)](https://www.skillsdirectory.com/skills/richfrem-os-clean-locks)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: os-clean-locks
plugin: agent-agentic-os
description: >
  Safely removes all agent lock files from the context/.locks/ directory to resolve
  deadlocks caused by crashed agents leaving stale locks behind. Use when the user says
  "/os-clean-locks", "clear all locks", "reset agent locks", or when an agent is deadlocked
  and cannot acquire a lock because a previous agent crashed and left a stale lock behind
  in context/.locks/. Verifies lock existence, discovers and removes stale lock directories,
  updates OS state via kernel.py, and emits event bus notifications. Requires Python 3.8+
  standard library only.
allowed-tools: Bash, Read, Write
---

# OS Clean Locks (`os-clean-locks`)

Safely remove agent lock directories from `context/.locks/` to resolve deadlocks caused by crashed agents leaving stale locks behind.

## Contents

- [Critical Constraints](#critical-constraints)
- [Quick start](#quick-start)
- [Workflow](#workflow)
- [Verification](#verification)
- [References](#references)

## Critical Constraints

1. **Target Only Lock Directories**: Never delete files outside `context/.locks/`.
2. **Atomic Recovery**: Verify lock directory existence before executing removal.
3. **State Synchronization**: Update OS state and emit result event via `kernel.py` when available.

## Quick start

Check for active or stale locks in the lock directory:

```bash
ls -la context/.locks/
```

## Workflow

1. **Emit Intent**: If `kernel.py` exists, notify the Event Bus:
   ```bash
   python3 scripts/kernel.py emit_event --agent os-clean-locks --type intent --action clear_locks
   ```
2. **Discover Locks**: Inspect `context/.locks/` for directory entries ending in `.lock`.
3. **Safely Remove**: Delete each stale `.lock` directory:
   ```bash
   rm -rf context/.locks/*.lock
   ```
4. **Update OS State & Notify**:
   ```bash
   python3 scripts/kernel.py state_update locks_cleared true
   python3 scripts/kernel.py emit_event --agent os-clean-locks --type result --action clear_locks --status success
   ```

## Verification

Confirm `context/.locks/` contains no stale lock directories:

```bash
ls -la context/.locks/
```

## References

- [acceptance-criteria.md](references/acceptance-criteria.md) — Acceptance criteria for lock clearance operations.
- [fallback-tree.md](references/fallback-tree.md) — Remediation pathways if locks cannot be removed.

Files in this skill

  • SKILL.md3.1 KB
  • acceptance-criteria.md305 B
  • evals/evals.json790 B
  • evals/results.tsv172 B
  • kernel.py28 B
  • references/acceptance-criteria.md42 B
  • requirements.txt22 B
  • scripts/kernel.py26 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…