Multi agent coordination
Skill andr-ca/agentharness/.claude/skills/multi-agent-coordination
Portable engineering policies for coding agents — git, testing, logging, and language conventions written once and referenced everywhere
npx -y skills add andr-ca/agentharness --skill multi-agent-coordinationAssembled from the repository path, not quoted from the project. Check it against their README if it does not work.
2 things to look at
- 26 days oldThe repository was created 26 days ago. New is not bad, but a brand new repository carrying a familiar-sounding name is the shape a typosquat arrives in, and there has been no time for anyone else to find a problem with it.
- 1 stars1 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.
What its author says it does
Copied from the file, not written here
Use when two or more agent sessions may work on the same repository concurrently — covers the per-feature lock-file protocol, stale-lock detection, worktree isolation rules, and what to do when a feature is already locked.
SKILL.md
4.6 KB, ~1.1k tokens by cl100k_base, as published. Nobody here has run it
Multi-Agent Coordination
Use this skill when you start work on a feature and another agent session might be working on the same repository, or when you detect that a lock exists for the feature you want to work on.
tools/agent-lock.sh is agentharness's own dogfooding tool — it is
not currently installed into consumer projects by harness-link.sh.
If this skill file is symlinked/copied into a consumer repo (the
normal case for every install mode) and tools/agent-lock.sh doesn't
exist there, every command below will fail with "No such file or
directory". Check [ -x tools/agent-lock.sh ] before
relying on this skill's commands; if it's missing, this protocol
doesn't apply to this repo yet — fall back to plain git branch
discipline (check git branch -a / git log for other in-progress
work before starting) rather than assuming the lock file exists.
Deeper reference: patterns/multi-agent-coordination/COORDINATION.md
(full protocol, lock format, stale detection, worktree rules).
Before starting work: check for a lock
tools/agent-lock.sh check "add-user-auth"
- FREE — no lock exists. Proceed normally.
- LOCKED — another agent is working on this feature.
Acquiring a lock
AGENT_ID=$(tools/agent-lock.sh acquire "add-user-auth" "feat/user-auth")
AGENT_ID is a UUID printed on the last line. Keep it — you need it to release.
With a worktree:
git worktree add -b feat/user-auth .worktrees/user-auth main
AGENT_ID=$(tools/agent-lock.sh acquire "add-user-auth" "feat/user-auth" ".worktrees/user-auth")
When a lock exists — what to do
LOCKED: 'add-user-auth' is being worked on.
agent_id : 3f2a1c8d-...
branch : feat/user-auth
worktree : .worktrees/user-auth
since : 2026-07-14T10:00:00Z
Option A — Wait: If the agent will finish soon, wait and retry.
Option B — New branch + worktree:
# Get a suggested branch name
NEW_BRANCH=$(tools/agent-lock.sh suggest-branch "add-user-auth")
# Create an isolated worktree
git worktree add -b "$NEW_BRANCH" ".worktrees/$(echo $NEW_BRANCH | tr '/' '-')" main
# Acquire a lock for your sub-task
AGENT_ID=$(tools/agent-lock.sh acquire "add-user-auth-review" "$NEW_BRANCH")
Releasing a lock
Always release when done — don't leave locks for the next agent to clean up:
tools/agent-lock.sh release "add-user-auth" "$AGENT_ID"
Stale lock cleanup
Locks are auto-cleaned on acquire and check. To manually clean all:
tools/agent-lock.sh clean
A lock is stale when its pid is no longer a running process, or when
that pid is alive but belongs to a different process than the one that
acquired the lock (detected via a recorded process-start time — see
COORDINATION.md's "Stale lock detection").
Worktree isolation rules
- One branch per worktree. Never check out the same branch in two worktrees at once.
- Keep them in
.worktrees/<branch-name>/— gitignored. - Remove with git:
git worktree remove <dir>(notrm -rf).
Lock files should be gitignored
.agentharness-locks/ should be in .gitignore — lock files are
operational state, not committed history. The harness adds this entry
automatically when you run agentharness init.
Enforcement — locks are checked at push time
This section describes agentharness's own repo, where tools/agent-lock.sh
genuinely exists. In a consumer project, per the caveat near the top of this
file, none of the below is real unless you've installed the tool yourself —
check [ -x tools/agent-lock.sh ] before trusting any of it.
Where the tool is present, this protocol is no longer purely advisory:
- Acquire a lock before your first commit on any branch (CLAUDE.md
mandate) and
export AGENTHARNESS_AGENT_ID=<the printed id>. - The
pre-pushhook runstools/agent-lock.sh check-branch <branch>for every branch you push: a live lock held by a different session blocks the push. Your own locks pass (agent-id or ancestor-pid match). - A repo-wide GitHub ruleset rejects force pushes on all branches — if your push is rejected as non-fast-forward, fetch and rebase; never force.
Full details: patterns/multi-agent-coordination/COORDINATION.md
("Enforcement").
Gives 0 of the 12 instructions most agent orchestration skills give in ~1.1k tokens
Counted across 742 of the 995 authors here whose files we hold, read 2026-08-07
- reference existing artifacts by path or URLin 53 of 742, across 25 files
- run the full test suite after integrating changesin 51 of 742, across 19 files
- dispatch one agent per independent problem domainin 50 of 742, across 17 files
- verify fixes do not conflictin 45 of 742, across 13 files
- include a suggested skills section in the documentin 45 of 742, across 17 files
- redact sensitive informationin 41 of 742, across 11 files
- save to the temporary directory of the operating systemin 39 of 742, across 10 files
- tailor the document to user-provided focus argumentsin 39 of 742, across 9 files
- spot check agent changes for systematic errorsin 34 of 742, across 7 files
- write a handoff document summarising the current conversationin 31 of 742, across 6 files
- Assign each agent a specific scopein 23 of 742, across 8 files
- provide specific scope and clear goalin 23 of 742, across 5 files
Said here and by no other author read
- check for a feature lock before starting work
- acquire a lock before committing on any branch
- store the printed agent identifier for lock release
- wait for an existing lock to clear or create a sub-task worktree
- request a suggested branch name for sub-task work
- release the lock when work is done
Grouped from the skills themselves: near-identical wordings counted once, and counted by distinct author, so one author publishing three of these counts once. Length counted with cl100k_base; the agent that loads this file may tokenize it differently.