Edit gate
Block an agent from editing a file another agent claimed
Turn claims into a hard stop: a Claude Code PreToolUse hook, a git pre-commit hook or CI can refuse edits to files another active task owns.
The problem
Claims tell agents what's taken, but an agent in a hurry can still write over a file it was warned about.
What people try
- Stronger wording in CLAUDE.md
- Instructions are advice. Under pressure the agent still makes the edit.
- Read-only file permissions
- Blunt, manual, and nothing undoes them when the other agent finishes.
With Concord
01
Install the hook
concord setup --claude-hooks adds an opt-in PreToolUse hook on Edit, Write and MultiEdit to .claude/settings.json.
02
Name your task
Set CONCORD_TASK to the agent's own task id. Without it the hook only warns, so an agent is never blocked from its own files.
03
Gate elsewhere too
concord check <files> exits non-zero on a same-file collision, so a git pre-commit hook or CI step can use the same rule.
Result
A claimed file stays claimed even when an agent ignores the warning.
Common questions
- Why does the gate only check exact files?
- Blocking on a shared directory or module would fire constantly. Those broader overlaps are still reported at claim time, where a warning is enough.
- Does this work for Codex or Cursor?
- The PreToolUse hook is Claude Code specific. Any harness or CI job can call concord check, which exits non-zero when another active task has claimed the files.
Further reading
Give your agents shared work-state.
npm install -g @concord-ai/concord-mcp