# Huskies project-local agent guidance ## Session Start & Resume Protocol ### PLAN.md — required for every coder session At the very start of each coder session, before doing any code exploration, check for `PLAN.md` in the worktree root: **If `PLAN.md` exists (resuming after a watchdog respawn):** 1. Read `PLAN.md` first — it is your primary orientation document. 2. Only after reading it, call `git_log` / `git_diff` to see commits made since the plan was last updated. 3. Reconcile any divergence between the plan and the current git state, then update the plan. **If `PLAN.md` is absent (first session on this story):** 1. Write `PLAN.md` before any grep, file read, or exploration tool call. 2. Populate it with what you know from the story ACs alone; add specifics as you discover them. ### What PLAN.md must contain `PLAN.md` is a living document. Update it after each completed AC or natural unit of work — not only at the start. Required sections: ```markdown # Plan: Story ## ACs → implementation locations - AC 1: : - AC 2: : — … … ## Decisions - : — rejected alternative: … ## Current state ## What's left - [ ] … ``` ### Non-conforming outputs A PLAN.md that contains only generic steps like "read the code", "write the code", "run the tests", or leaves file paths as `` or unspecified is **non-conforming**. Every AC entry must name a real file path and describe the actual change. Every decision entry must name both the chosen approach and at least one rejected alternative with a reason. A stub plan is worse than no plan — rewrite it with specifics. ## Documentation Docs live in `website/docs/*.html` (static HTML), **not** Markdown files. When a story asks you to document something, edit the relevant `.html` file in `website/docs/`. ## Configuration files - Agent config: `.huskies/agents.toml` (preferred) or `[[agent]]` blocks in `.huskies/project.toml` - Project settings: `.huskies/project.toml` - Bot credentials: `.huskies/bot.toml` (gitignored — never commit) ## Frontend build The frontend is embedded into the Rust binary via `rust-embed`. Run `npm run build` in `frontend/` before testing frontend changes, or the embedded assets will be stale. ## Quality gates (all enforced by `script/test`) 1. `npm run build` (frontend) 2. `cargo fmt --all --check` 3. `cargo clippy -- -D warnings` 4. `cargo test` 5. `npm test` (frontend Vitest) Clippy is zero-tolerance: no warnings allowed. Fix every warning before committing. ## File size Target a maximum of 800 lines per source file as a soft guide. If a file grows beyond 800 lines, decompose it by concern into smaller modules. Split at natural seams: group related types, functions, or handlers together and move each cohesive group to its own file. This keeps files readable and diffs focused. ## Runtime validation The `validate_agents` function in `server/src/config.rs` rejects unknown runtimes. Supported values: `"claude-code"` and `"gemini"`. Adding a new runtime requires updating that function.