Give each coding agent its own part of the repo.
Each agent gets its own lane. You get one short list of what needs you. Plain files in your repo. No server, no account.
$ npm i -D @zerwone/staked $ npx @zerwone/staked init --agents claude-code=src/**,codex=web/**
npm: @zerwone/staked · needs Node.js 20+ and a Git repo · release notes
staked is a free, open-source command-line tool for running several AI coding agents (Claude Code, Codex, Cursor, Gemini CLI) on one Git repository. You assign each agent the paths it owns in one file. staked writes each agent's instruction file, checks staged files before every commit, and keeps one short list of decisions waiting for you.
How it works
agents/roles.yml ← you write this once: who owns which paths │ ├─ staked gen ─► CLAUDE.md, AGENTS.md, GEMINI.md, .cursor/rules │ each agent reads its lane, its tasks and the rules │ ├─ agent commits ─► pre-commit hook (staked check) │ ├─ files in its own lane → commit goes through │ └─ a file in another lane → refused, names the owner │ └─ agent needs a decision ─► staked ask … --default … │ (keeps working on the default) you ◄── staked questions open ◄┘
- Lanes.
agents/roles.ymlsays which paths each agent owns, for example Claude Code getssrc/**, Codex getsweb/**. - Instructions. staked writes the files each agent already reads, with its lane, its open tasks and the team rules. About 2.6 KB per agent.
- A check on every commit. A git hook looks at the staged files and refuses a commit that touches another agent's lane, before it exists.
- One list for you. When an agent needs your call, it files a question with a safe default and keeps going.

An agent tries to commit a file outside its lane:
staked check: refused for codex
- src/api/orders.ts: outside codex's lane (lane of claude-code)
An agent needs a decision from you. It asks, picks a safe default, and keeps working. From your phone:
$ npx @zerwone/staked questions open Q-001 · blocks 1: T-012 · codex · 0m · exp 11-09 Same page or separate tab for order history? → default: same page
Answer it, or let the default stand.
The hook is a workflow check, not a sandbox: an agent can still edit any file, and git commit --no-verify skips it.
Use it
1. Install in your project (npm):
$ npm i -D @zerwone/staked
2. Set up lanes from the repo root. Give one agent several paths with +, as in claude-code=src/**+test/**:
$ npx @zerwone/staked init --owner you --agents claude-code=src/**,codex=web/**
3. Commit the setup as yourself, before any agent commits:
$ git add agents CLAUDE.md AGENTS.md .gitattributes .gitignore $ git commit -m "add staked"
4. Give each agent its own worktree and identity. Worktrees keep agents from overwriting each other while they work; the identity tells staked whose lane applies.
$ git worktree add ../myapp-codex $ cd ../myapp-codex $ git config user.name codex
5. Start the agents as usual in their worktrees. Each reads its instruction file and knows its lane and the rules. Tell an agent its task; it claims it before starting, and commits are refused until it has: npx @zerwone/staked claim T-001 --as codex
6. Check in, from anywhere:
$ npx @zerwone/staked questions open # what needs you $ npx @zerwone/staked answer Q-001 --use-default # or --text ".." $ npx @zerwone/staked board # who is doing what
7. Change it later: edit agents/roles.yml and run npx @zerwone/staked gen, or move a lane with npx @zerwone/staked handover codex claude-code.
Always run it as npx @zerwone/staked. A bare npx staked could run someone else's package with the same short name.
Troubleshooting
- Refused for files the agent didn't touch, right after
init: commit the setup files as yourself first (step 3). has no DOING task: claim before start: the agent claims its task first:npx @zerwone/staked claim T-001 --as codex.- The hook names the wrong agent: identity comes from
--as, thenSTAKED_AGENT, thengit config user.namein that worktree. - Anything else:
npx @zerwone/staked doctorlists what's wrong and where, or open an issue.
Why it exists
staked comes from a real project: 4 agents (Claude Code, Codex, Cursor), 24 days, about 1,600 commits, coordinated with hand-written markdown. It worked, but the files didn't scale.
| By hand | With staked | |
|---|---|---|
| Coordination files each agent was pointed at | ~300 KB | 2.6 KB generated per agent (measured) |
| Finding what needs you | 256 KB of board and questions | one short list |
| Commits that touched two agents' lanes at once | 29, none flagged | the hook refuses this kind of commit (tested on sample commits, not yet replayed on the original 29) |
Works with any agent that reads files in the repo: Claude Code, Codex, Cursor, Gemini CLI. Windows, macOS, Linux.
FAQ
How do I run multiple coding agents on the same repo without conflicts?
Two layers. Git worktrees give each agent its own working copy, so they don't overwrite each other's files while they work. staked decides who may change which paths and checks it before each commit, so work stays in its lane when it comes back together. Use both.
What's the difference between staked and git worktrees?
Worktrees separate where agents work. staked separates what they may change, writes their instructions, and collects their questions. Worktrees alone don't stop two agents from editing the same module on different branches.
How is it different from CODEOWNERS?
CODEOWNERS requests reviewers on a pull request after the change exists. staked checks each agent's commit locally, before it exists, and also gives each agent its own instructions and a place to ask you questions.
Does it work with Claude Code, Codex, Cursor and Gemini CLI?
Yes. It generates CLAUDE.md, AGENTS.md, .cursor/rules/staked.mdc and GEMINI.md, the files those agents already read. Any agent that reads files in the repo can follow it.
Can it stop an agent from editing a file?
No. It refuses the commit, not the edit. It is a workflow check, not a sandbox, and git commit --no-verify skips it.
Does staked call an AI model or need a server?
No. It is plain files in your repo, a CLI and a Git hook. No account, no network calls.