Present the design in one pass, organized into sections (architecture, components, data flow, error handling, testing) — the human comments on any section; re-present only revised sections.
Identified a significant architectural decision? Offer an ADR in docs/adr/. Only when all three hold: hard to reverse, surprising without context, a real trade-off. Format: title + 1–3 sentences of context/decision/why. ADRs are permanent institutional memory — they stay out of archive/rotation forever. (Guard note: docs/adr/ is outside the writable docs/plans/; write it only after the user approves and unlocks.)
Write the design doc — docs/plans/YYYY-MM-DD-<topic>-design.md, descriptive (not a task list). Open with ## Requirements — one testable behavior each; pwk-writing-plans derives acceptance criteria and tests from these. Then: problem, approaches considered, architecture, components, data flow, error handling, testing.
Touches a production-risk area (DB schema/migrations, auth, external APIs, concurrency/batch, uploads/large data flows, Redis/caching/queues)? Add a brief ## Production-risk areas — pwk-writing-plans carries it into the plan and pwk-code-review audits it per requirement.
End with ## Feature acceptance — one or more end-to-end Given/When/Then scenarios proving the requirements compose into the feature. This is the feature's definition-of-done; the human approves it as what "the feature works" means. pwk-writing-plans derives a feature-level test from it; pwk-executing-tasks runs it at the integration gate. Treat "I can write this scenario" as the green light to finish designing — if you can't, keep designing because the requirements don't yet compose into a coherent feature.
## Feature acceptance
- Given <starting state>, When <trigger>, Then <end-to-end outcome the feature promises>.
Example (rate limiting): "Given a new API consumer with no prior usage, When they exceed 100 requests/minute for 3 consecutive minutes, Then they're throttled, a rate_limited event is emitted, and further requests return 429."
Splitting large issues: propose multiple design docs (one <topic> per sub-issue) and get human approval first — see Granularity. Each runs its own pipeline.