multi-agent-locks

Lock coordination skill for concurrent agents. Mandatory on primary `main` checkout; optional on worktrees/non-`main` branches unless stricter repo policy applies.

Safety Notice

This listing is imported from skills.sh public index metadata. Review upstream SKILL.md and repository scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "multi-agent-locks" with this command: npx skills add wilbertliu/agent-skills/wilbertliu-agent-skills-multi-agent-locks

Multi Agent Locks

Follow this protocol exactly.

Requirement policy

Decide requirement status before first edit.

Conditionmulti-agent-locks required
Branch is main and not a linked worktreeyes
Branch is not mainoptional
Linked worktree (/.git/worktrees/ path)optional
Detached HEAD (empty branch output)optional

Detection commands:

  • Branch: git -C <repo> branch --show-current
  • Git dir: git -C <repo> rev-parse --absolute-git-dir
  • Linked worktree: git dir path contains /.git/worktrees/

If repo policy is stricter than this table, follow repo policy.

Required workflow

  1. Map candidate files before the first edit.
  2. Acquire locks for mapped files.
  3. Continue only with acquired files.
  4. Skip locked files and keep making progress on unlocked files.
  5. Heartbeat while edits are in progress.
  6. Release all held locks on normal completion and on EXIT/INT/TERM.

Lock defaults

  • Lock mode: hard
  • Conflict behavior: skip locked files
  • Scope: file-level only
  • Lease TTL: 180 seconds
  • Heartbeat cadence: 30 seconds
  • Owner format: <agent-name>:<pid>:<session-id>
  • Force unlock: unsupported

Bundled CLI

Use scripts/multi_agent_locks.mjs. Default to npm execution from the skill directory (skills/multi-agent-locks):

  • npm run locks -- <command> [options]

The SQLite database path is hardcoded to:

  • assets/multi_agent_locks.db (relative to this skill directory)

Commands

  • acquire --owner <owner> [--task-id <id>] [--repo-root <path>] [--ttl 180] <file...>
  • heartbeat --owner <owner> [--ttl 180] <file...>
  • release --owner <owner> <file...>
  • status [file...]

Pass --json when command output needs to be parsed by automation.

Minimal shell pattern

OWNER="codex:$$:${SESSION_ID}"

cleanup() {
  npm run locks -- release --owner "$OWNER" -- "${LOCKED_FILES[@]}"
}
trap cleanup EXIT INT TERM

# Acquire, then continue only with returned acquired files.
npm run locks -- acquire --owner "$OWNER" --json -- path/a.ts path/b.ts

Behavioral requirements

  • Use normalized absolute realpaths as lock keys.
  • Treat expired leases as reclaimable during acquire.
  • Keep lock ownership strict: only the owner may heartbeat or release its locks.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

Automation

vercel-composition-patterns

React composition patterns that scale. Use when refactoring components with boolean prop proliferation, building flexible component libraries, or designing reusable APIs. Triggers on tasks involving compound components, render props, context providers, or component architecture. Includes React 19 API changes.

Repository Source
23K85.7K
vercel
Automation

vercel-react-native-skills

React Native and Expo best practices for building performant mobile apps. Use when building React Native components, optimizing list performance, implementing animations, or working with native modules. Triggers on tasks involving React Native, Expo, mobile performance, or native platform APIs.

Repository Source
23K60.1K
vercel
Automation

supabase-postgres-best-practices

Postgres performance optimization and best practices from Supabase. Use this skill when writing, reviewing, or optimizing Postgres queries, schema designs, or database configurations.

Repository Source
1.6K35K
supabase