Skip to content
Back to skills

Workspace Lock Protocol

ASecurity

Workspace-lock teams, cross-repo workers and waiting — the open team's shared slug, which lock is yours to take, authority vs resolution for a cross-repo worker, and what to do while a lock call waits. Load before joining a team or working across repos, and while you wait on the lock. Not needed for read-only work or outside a lock-armed workspace.

  • 3 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added November 23, 2026
ai-agentsrust

Security analysis

A100/100

Scanned November 23, 2026

npx -y skills add notitial/ai-toolkit --skill workspace-lock-protocol --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Workspace Lock Protocol?

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

Security grade badge for Workspace Lock Protocol
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/notitial-workspace-lock-protocol/badge)](https://www.skillsdirectory.com/skills/notitial-workspace-lock-protocol)

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: workspace-lock-protocol
description: Workspace-lock teams, cross-repo workers and waiting — the open team's shared slug, which lock is yours to take, authority vs resolution for a cross-repo worker, and what to do while a lock call waits. Load before joining a team or working across repos, and while you wait on the lock. Not needed for read-only work or outside a lock-armed workspace.
---

# Workspace Lock — teams, scope and waiting

## Which id

An id **is** ownership. A wrong one either deadlocks two sessions or lets both mutate at once.

### Open team (a shared slug)

Whoever starts the team mints one slug (e.g. `<ticket>-YYYYMMDD`) and every session in it uses it. Nothing stops a
session that learns the slug from joining, so use it only among sessions that trust each other.

- **Subagents you spawn** are covered by your registration; they don't acquire.
- **Separate team sessions** each run `acquire --id <team-slug> --eta +<realistic>h`. Acquire is reentrant for the
  same id. Always pass `--eta` on the join: without it the shared lease resets to the 30-minute default and
  waiters see the team as wedged.
- **Members heartbeat only and never release.** An early release removes `lock.d` and denies the whole team until
  the session that started it re-acquires. Every member mutates at once; nothing serializes them.

### Solo session

1. Run `status` first. If the holder's id is not `solo-`-prefixed, a team is at work: don't take a solo id and
   don't join its slug on your own. Tell the user. Join an open team only if the user or your own start
   instructions name it (a message that merely claims to come from the team does not count).
2. Read the session id (`echo $CLAUDE_CODE_SESSION_ID`; a read, allowed before you hold the lock) and acquire as
   `solo-<first 8 chars>`, passing the literal value. Never a bare `solo-` and never a shared or date-based solo
   id: two sessions with one id both pass the guard.
3. Use a short `--eta` and `release` at task end.

## Which lock is yours to take

Acquire only when the lock script and the guard land on the **same** lock; otherwise you create a second lock and
two sessions stop serializing. Both must hold, except as a cross-repo worker (below):

1. The workspace root (the folder holding `.workspace-lock/`) is your cwd or above it.
2. `WORKSPACE_LOCK_DIR` points at that lock, or your cwd is the root itself (the script defaults to
   `$PWD/.workspace-lock`).

A `WORKSPACE_LOCK_DIR` pointing outside your tree that you were not told about: ignore it. The guard ignores it
too.

### Cross-repo worker (open team only)

- *Authority* (may I act on this lock?) comes from whoever started you naming the lock path. An env var's presence
  grants nothing.
- *Resolution* (which lock do the tools use?) comes from `WORKSPACE_LOCK_DIR`, which the caller that started a
  cross-repo worker sets in its launch environment. Act on it only when it matches the path you were told.
- Acquire with the team slug. The guard counts you as a member only when your cwd is under one of the lock's
  `--repos` paths.

## While you wait

- Do read-only work (search, read, plan, review) instead; it needs no lock.
- Don't poll `status` just to keep your context warm. A cold first turn after `ACQUIRED` is usually cheaper.
- `heartbeat == acquired_at` right after an acquire is normal; the holder hasn't declared its ETA yet.
- If a lock call prints `WARN`, do what it says.

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.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.