Skip to content

Commit 3a670b1

Browse files
committed
docs(agents): rule — fan out fleet in shared checkout, no 12x target/ residue
The ~7 GB workspace target/ multiplies if each fleet agent compiles in its own worktree (12 agents → ~84 GB). Codify: spawn the Sonnet fleet in the shared checkout (no per-agent worktrees), edit-only; the Opus orchestrator compiles/lints/tests once in the single target/. Opus runs cargo freely. https://claude.ai/code/session_017GFLBnDy23AWBqvkbHHC41
1 parent f97ac33 commit 3a670b1

2 files changed

Lines changed: 34 additions & 0 deletions

File tree

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Agent Cargo Hygiene — one target dir, no 12× build residue
2+
3+
## The problem
4+
5+
When the orchestrator fans out a fleet of subagents (the Sonnet build/fix
6+
agents), each agent that runs a full `cargo build`/`check`/`test` in its **own**
7+
isolated working copy materialises its own `target/`. This workspace's
8+
`target/` is ~7 GB. Twelve agents in twelve worktrees = ~84 GB of duplicated
9+
build residue and twelve cold compiles competing for the same cores.
10+
11+
## The rule
12+
13+
- **Opus (orchestrator + Opus agents): run cargo freely.** No restriction.
14+
- **Sonnet fleet agents: do NOT each run a full compile.** They edit code and
15+
reason; they must not spawn isolated worktrees or trigger their own cold
16+
`cargo build`/`check`/`test` that each grow a separate 7 GB `target/`.
17+
- "tests yes, compile no": a targeted `cargo test`/`clippy` against the
18+
**shared** workspace `target/` is fine; a bare compile-only
19+
(`cargo check`/`build`) is wasted residue — clippy already compiles.
20+
- **Verification is centralised.** The orchestrator (Opus) runs
21+
`cargo fmt` + `cargo clippy` + `cargo test` **once**, in the single shared
22+
`target/`, after the fleet's edits land. One build, not twelve.
23+
24+
## How the orchestrator fans out work
25+
26+
- Spawn the fleet **without** `isolation: "worktree"` so all agents share the
27+
one repo checkout and one `target/`.
28+
- Tell each agent explicitly: *edit only; do not run `cargo build`/`check`; do
29+
not create a worktree; the orchestrator compiles and lints centrally.*
30+
- After edits, the orchestrator runs the gates (`cargo fmt -p <crate>`,
31+
`cargo clippy -p <crate>`, `cargo test -p <crate>`) — keeping the tree
32+
`cargo clippy -- -D warnings`-clean (see `CLAUDE.md` Hard Rules) and
33+
`cargo fmt`-clean on the pinned toolchain, with no residue blowup.

CLAUDE.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ This project uses specialized agents in `.claude/agents/`. Follow these rules:
2121
- Feature prioritization, gap analysis, phase planning → `l3-strategist`
2222
4. When encountering `unsafe` code, **always** delegate to sentinel-qa for audit
2323
5. Write decisions to the blackboard, not just to chat
24+
6. **Cargo build residue** — fan out the Sonnet fleet in the *shared* checkout (no per-agent worktrees), edit-only; the Opus orchestrator compiles/lints/tests **once** in the single 7 GB `target/`. Opus may run cargo freely. See `.claude/rules/agent-cargo-hygiene.md`.
2425

2526
## Hard Rules
2627
- OpenBLAS and MKL are **mutually exclusive** feature gates. Never both.

0 commit comments

Comments
 (0)