multi-agent-coordination

multi-agent-coordination is a cursor rule for Claude Code, Cursor from andr-ca/agentharness. It costs 43 tokens per session (2,212 once invoked), scanned C, original, MIT.

A set of rules for coordinating two or more coding agents working in the same repository. It describes feature lock files, stale-lock checks, separate worktrees, and fallback checks when the lock tool is missing.

In plain words
What is it for?
Use it before starting feature work when multiple agent sessions may share a repository.
Why use it?
It reduces the risk of agents changing the same work at once or overwriting each other's progress.

Cursor rule for Claude CodeCursor

Written for Claude Code and Cursor: PreToolUse hook event, but also installed under .cursor/. Also seen: mentions CLAUDE.md; mentions Claude Code.

Good fit Use it before starting feature work when multiple agent sessions may share a repository.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/andr-ca/agentharness/multi-agent-coordination
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/andr-ca/agentharness

Made for: Claude Code, Cursor.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for multi-agent-coordination

README.md
[![agentmods](https://agentmods.dev/badge/rules/andr-ca/agentharness/multi-agent-coordination/github.svg)](https://agentmods.dev/rules/andr-ca/agentharness/multi-agent-coordination)
Your own site
<a href="https://agentmods.dev/rules/andr-ca/agentharness/multi-agent-coordination"><img src="https://agentmods.dev/badge/rules/andr-ca/agentharness/multi-agent-coordination/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for multi-agent-coordination

Your own site · 80×15
<a href="https://agentmods.dev/rules/andr-ca/agentharness/multi-agent-coordination"><img src="https://agentmods.dev/badge/rules/andr-ca/agentharness/multi-agent-coordination.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 43 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 2,212 The whole file, excluding the scripts and references it only reads on demand.
Security scan C 1 finding. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00043 $0.02212
Opus 5.5 $0.00017 $0.00885
Sonnet 5.5 $0.00009 $0.00442
Haiku 4.5 $0.00004 $0.00221

Measured 1mo ago against content hash d3b677433db8, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade C, and why

multi-agent-coordination scanned grade C with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 1mo ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Recursive force deletehighDestructive command

rm -rf with a variable or a broad path is one typo away from removing the wrong tree.

- **Remove with git:** `git worktree remove <dir>` (not `rm -rf`).
.cursor/rules/multi-agent-coordination.mdc · 207 lines

How it starts

The opening of the file, as written. The whole thing — 207 lines — stays where its author put it; the contents beside it link to each section on GitHub.

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.

This fallback covers coordination with other agents only — it does not weaken the branching skill's worktree-isolation rule. Whether or not tools/agent-lock.sh exists, starting new feature/fix work on a dirty tree or an unrelated branch still requires a worktree first; a missing lock script is not license to git checkout -b on top of in-progress changes, yours or anyone else's.

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_LOCK_PID=<stable-session-pid> tools/agent-lock.sh acquire "add-user-auth" "feat/user-auth"
# ACQUIRED: locked 'add-user-auth' (agent_id=3f2a1c8d-..., owner_pid=12345)
# 3f2a1c8d-...
export AGENTHARNESS_AGENT_ID=3f2a1c8d-...   # the id from the last line

Check owner_pid in that output. It is the process whose liveness and ancestry the lock is anchored to. If it isn't the session process you meant, acquire still succeeds — and the mistake surfaces much later, as a push blocked by your own lock. acquire prints a NOTE when the recorded pid isn't an ancestor of the acquiring process, which is the usual signature of a wrong AGENT_LOCK_PID.

Read the full file on GitHub · 207 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 1mo ago First seen · 207 lines · 43 tokens per session scan C d3b677433db8

Subscribe to this mod's changes

multi-agent-coordination is a cursor rule published in the GitHub repository andr-ca/agentharness (1 stars, last pushed 5d ago), licensed MIT. It adds 43 tokens to every session and 2,212 once invoked, about $0.0002 per session on Opus 5.5. A static security scan graded it C with 1 finding (recursive force delete). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-09-03.