Guidance for AI agents (Codex, Claude Code, Hermes, and any Coven familiar)
opening pull requests against this repo. Humans: your canonical guide is
CONTRIBUTING.md — this is the agent-specific layer on top.
Read first:
README.mdfor what this repo is, andCONTRIBUTING.mdfor the full contribution bar (including the "Contributor First 10 Minutes" checkout path).
Coven is a small, boring Rust authority layer with TypeScript integration packages around it. The development loop must keep that boundary clear: core logic stays in Rust; the npm packages are thin integration surface.
Multiple agent sessions (Codex, Claude Code, familiars) frequently run against the same checkout at once, each in its own worktree. Worktrees keep git operations from racing, but they do not stop two sessions from independently building the same issue — which has happened repeatedly, producing duplicate PRs that a session then has to close. Before you touch code:
-
Check what's already taken. Duplication hides behind divergent branch names — one issue once spawned
fix/output-polish,fix/311-output-polish, andfix/output-polish-311— so branch names alone won't tell you. Check both the shared claim registry and open PRs:coven claim status # active claims, shared across every worktree of this repo gh pr list --state open # is there already a PR for this issue?
If the issue is claimed or already has a PR, pick different work or coordinate.
-
Create or enter the task worktree. The automatic fallback identity is worktree-scoped, so enter the worktree before acquiring the claim:
git fetch origin main git worktree add -b <branch> /tmp/coven-<branch-slug> origin/main cd /tmp/coven-<branch-slug>
-
Claim it with a shared, issue-keyed token — not your working branch name, which no other session can predict:
coven claim acquire issue-<N> # e.g. issue-311; a TTL-bounded lock
Claims live in the repo's shared
--git-common-dir/agent-claims/, so every worktree and session sees them. For long tasks, extend the TTL withcoven claim heartbeat issue-<N>. -
Release from the same worktree when your PR merges or you stop:
coven claim release issue-<N>.
This step is cheap and it is the single thing that prevents duplicate-PR churn.
Without an explicit COVEN_AGENT_ID, Coven identifies the owner as
$USER@<worktree-slug>. Set distinct explicit IDs only when multiple agents
must share one worktree.
- Coordinate before editing (see above) — check
coven claim statusandgh pr list, enter a fresh worktree, then acquireissue-<N>from inside it. - Never push to
main. Every change lands via a PR with green CI. Branch from currentorigin/main. - Fresh branch per task. If multiple sessions may touch this repo, use the task worktree created before claim acquisition so operations don't race.
- Keep the diff scoped to one concern; no drive-by refactors in a feature PR.
- Conventional-commit subjects:
feat:,fix:,docs:,chore:,refactor:. - For larger changes, start from an issue and include the readiness packet the PR template asks for.
- After merge: delete the remote branch, remove your local worktree/branch.
CI (.github/workflows/ci.yml) rejects on any of these. Run them first:
cargo fmt --check
cargo clippy --workspace --all-targets -- -D warnings
cargo test --workspace --locked
python scripts/check-secrets.py # secret scan — must be clean
python3 scripts/check-coven-privacy.py --staged # privacy guard on your staged changesIf you touched the npm/TypeScript packages, also:
npm run build
npm test-D warnings has no exceptions. Fix lints; don't #[allow(...)] without a
justifying comment.
- Keep the Rust authority boundary clean. Business/authority logic lives in the Rust crates. Don't push core decisions into the TS packages.
- Supported harness set is Codex, Claude Code, and GitHub Copilot CLI until policy and adapter contracts are stable. Don't add speculative harness adapters.
- Never weaken the secret scan. If
check-secrets.pyflags something, fix the content — don't allowlist your way past it. - Prefer the fast loop (
cargo check, debug builds) over--releaseunless you specifically need optimized output.
When you re-land or build on someone else's work (a fork PR, an issue author's proposal, a co-author), credit the human contributor with a working GitHub-linked trailer so they appear in the contributors graph and on their profile:
Co-authored-by: Full Name <ID+username@users.noreply.github.com>
- Use the numeric-id no-reply form. Get the id with
gh api users/<login> --jq .id. - Never use a machine/
.localemail (e.g.name@Someones-Mac.local) in a co-author trailer — it links to no account and gives zero credit. - When a squash-merge collapses a contributor's PR into an internal branch,
preserve their
Co-authored-by:line in the squash commit message.
- Never commit secrets, tokens, or private emails. Use
*.noreply.github.comfor attribution. - Don't disable CI gates or branch protection to land a change. If it can't go through a green PR, surface the blocker instead of working around it.
CLAUDE.md points here — this file is the source of truth for both.