docs(agents): an Agent efficiency section — one-round gate runs

Repeated full-repo gate executions in agent sessions traced to one
habit: piping a long command through a filter, losing the failure
detail, and re-running the whole gate to recover it — paying both the
gate again and an extra agent round-trip. The rule lands the full
output in a temp file, prints the summary, and auto-expands capped
failure context on non-zero exit in the SAME invocation.

Fits the existing 1802-word ceiling after condensing (1800).
This commit is contained in:
kingwl
2026-07-10 09:30:05 +08:00
parent c5cb7da364
commit 4e09fdeafb
+6
View File
@@ -78,6 +78,12 @@ pnpm exec vitest run --config vitest.e2e.config.ts packages/ui/stdio-agent/tests
`test:coverage`, not `test`, is the gating run ([why](docs/testing.md)); a sign-off counts only for commands actually run.
## Agent efficiency
Habits that cut agent round-trips, each earned by measured session waste.
- **One-round gate runs**: any command beyond a few seconds lands its FULL output in a temp file, prints a short summary, and on non-zero exit auto-expands capped failure context (`grep -B3 -A15 -E 'FAIL|ERROR' "$out" | head -60`) in the SAME invocation — never re-run a gate to recover detail a filter discarded.
## Secrets / .env
Real-API tests and demos read `DEEPSEEK_API_KEY` (and optional `DEEPSEEK_BASE_URL`) from the environment or a gitignored root `.env` loaded via `process.loadEnvFile()`. cordis.yml references env vars with the `!!js` tag (never `!js`). Never commit credentials. CI has no secrets, so e2e suites self-skip without a key — a CI accommodation, not a cost signal; the with-key policy is in [docs/testing.md](docs/testing.md).