diff --git a/.claude/rules/team-patterns.md b/.claude/rules/team-patterns.md index 44a35c0ba..0b1915638 100644 --- a/.claude/rules/team-patterns.md +++ b/.claude/rules/team-patterns.md @@ -31,3 +31,23 @@ When leading a team (workshop, batch, or any multi-agent session): - If an agent has not sent a message in ~20 minutes, ping them for a status update. - **Bottleneck detection:** if other agents are idle and waiting on one agent's output, that agent's silence is a red flag — check on them immediately, do not wait for the next natural message. - When checking on a stuck agent, offer to reassign the task or pull in another agent to help. + +## Agent verification — don't duplicate the push gate + +The pre-push hook (`.config/hooks/pre-push`) is the source of truth for Rust +verification and **runs on every push the lead makes** when `server/` changed: +`cargo fmt --check`, `cargo clippy --all-targets -- -D warnings`, and `cargo test` +(plus `cargo deny`, ruff, JSON validation, systems.db stamp). There is no CI (no +`.gitea`/`.github`/`.forgejo` workflows) — the push gate is the only automatic +verification, so it is deliberately comprehensive. + +Therefore, when spawning implementation agents, do **not** tell them to run +`cargo fmt`, `cargo clippy`, or `cargo test` pre-emptively — the push gate enforces +all three, so it is pure duplication. Worse, an agent running a *weaker* check (e.g. +plain `cargo clippy` without `-D warnings`) reports a false "clean". Let agents write +code; the gate is authoritative. + +On a gate failure at push: fmt auto-fixes (`cargo fmt`); clippy is a quick lead patch; +a `cargo test` failure is a real regression — fix it, or SendMessage the still-alive +agent to fix it in-context. Net: agents verify nothing the gate already covers, and the +lead lets the gate catch fallout on push. diff --git a/.config/hooks/pre-push b/.config/hooks/pre-push index 0d717c7d7..a11c3870a 100755 --- a/.config/hooks/pre-push +++ b/.config/hooks/pre-push @@ -97,8 +97,19 @@ elif command -v cargo >/dev/null 2>&1 && [ -d "$REPO_ROOT/server" ]; then else echo "pre-push: clippy — OK" fi + + # cargo test — the ONLY automatic correctness gate: nothing else (no CI + # workflows exist) runs the suite, so without this a Rust regression + # reaches main unverified. Gated on server/ changes; shares the target/ + # guard with clippy so a cold worktree isn't forced into a full build. + echo "pre-push: checking Rust (cargo test)..." + if ! (cd "$REPO_ROOT/server" && cargo test --quiet 2>&1); then + ERRORS=$((ERRORS + 1)) + else + echo "pre-push: cargo test — OK" + fi else - echo "pre-push: skipping clippy (no target/ — run 'cargo build' once to enable)" + echo "pre-push: skipping clippy + test (no target/ — run 'cargo build' once to enable)" fi # --- Rust dependency audit (cargo deny) — requires deny.toml config ---