discipline-md 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +80 -0
  3. package/bin/discipline.js +587 -0
  4. package/package.json +40 -0
  5. package/templates/.claude/settings.json +58 -0
  6. package/templates/AGENTS.md +463 -0
  7. package/templates/AGENT_TRACKER.md +138 -0
  8. package/templates/API_REFERENCE.md +131 -0
  9. package/templates/ARCHITECTURE.md +89 -0
  10. package/templates/ASSETS.md +90 -0
  11. package/templates/AUTONOMOUS_QUEUE.md +119 -0
  12. package/templates/BUILD_PLAN.md +89 -0
  13. package/templates/CHANGELOG.md +90 -0
  14. package/templates/CLAUDE.md +89 -0
  15. package/templates/CREDITS.md +109 -0
  16. package/templates/DATA_MODEL.md +88 -0
  17. package/templates/DECISIONS.md +120 -0
  18. package/templates/DEPLOYMENT.md +342 -0
  19. package/templates/HANDOFF.md +289 -0
  20. package/templates/IMPROVEMENT_LOOP.md +103 -0
  21. package/templates/INVESTIGATION.md +154 -0
  22. package/templates/LICENSE +68 -0
  23. package/templates/NOTICE +55 -0
  24. package/templates/OPEN_DECISIONS.md +61 -0
  25. package/templates/PLAYBOOK_FEEDBACK.md +87 -0
  26. package/templates/PROJECT_CONTEXT.md +91 -0
  27. package/templates/README.md +60 -0
  28. package/templates/ROADMAP.md +96 -0
  29. package/templates/SECURITY_AUDIT.md +235 -0
  30. package/templates/SETUP.md +162 -0
  31. package/templates/SPEC.md +105 -0
  32. package/templates/SPEC_WORKFLOW.md +173 -0
  33. package/templates/TODO.md +118 -0
  34. package/templates/USAGE.md +153 -0
  35. package/templates/VERIFICATION_GATE.md +68 -0
  36. package/templates/agents/CROSS_REPO_SYNC.md +124 -0
  37. package/templates/agents/DEBUGGER.md +112 -0
  38. package/templates/agents/PLANNER.md +111 -0
  39. package/templates/agents/README.md +64 -0
  40. package/templates/agents/RECON.md +99 -0
  41. package/templates/agents/SECURITY_REVIEWER.md +123 -0
  42. package/templates/agents/SPEC_ARCHITECT.md +133 -0
  43. package/templates/agents/STAKEHOLDER.md +197 -0
  44. package/templates/agents/_TEMPLATE.md +116 -0
  45. package/templates/agents/optional/ARCHITECT.md +109 -0
  46. package/templates/agents/optional/BACKEND_IMPACT.md +108 -0
  47. package/templates/agents/optional/DOC_AUDIT.md +108 -0
  48. package/templates/agents/optional/FRONTEND_IMPACT.md +109 -0
  49. package/templates/agents/optional/QUEUE_CURATOR.md +114 -0
  50. package/templates/agents/optional/TEST_STRATEGIST.md +107 -0
@@ -0,0 +1,60 @@
1
+ # Project Name
2
+
3
+ <!-- Root README entrypoint. Keep this concise and point to docs/ for full context. -->
4
+ <!-- If copied into docs/README.md instead, include the detailed folder structure and commands below. -->
5
+ <!-- Do not put task lists, status updates, or volatile notes here. -->
6
+
7
+ ## Quick Start
8
+
9
+ ```bash
10
+ # install dependencies
11
+
12
+ # run locally
13
+
14
+ # run tests
15
+ ```
16
+
17
+ ## Folder Structure
18
+
19
+ ```text
20
+ project-root/
21
+ ├── docs/
22
+ ├── src/
23
+ └── ...
24
+ ```
25
+
26
+ ## Important Docs
27
+
28
+ - `docs/README.md` - detailed project orientation, setup, and folder structure
29
+ - `docs/HANDOFF.md` - reading order, update rules, workflow (read first)
30
+ - `docs/TODO.md` - current active work and test checklist
31
+ - `docs/AGENTS.md` - AI agent playbook (host model, named subagent roles, autonomy tags, human-collab gate)
32
+ - `docs/AUTONOMOUS_QUEUE.md` - pre-approved tasks for unsupervised AI runs (optional)
33
+ - `docs/PROJECT_CONTEXT.md` - product and domain context
34
+ - `docs/ARCHITECTURE.md` - runtime structure and key flows
35
+ - `docs/DATA_MODEL.md` - persistence and schemas
36
+ - `docs/API_REFERENCE.md` - endpoints and integrations
37
+ - `docs/ASSETS.md` - media asset paths
38
+ - `docs/DEPLOYMENT.md` - hosting and launch checklist
39
+ - `docs/CHANGELOG.md` - completed changes
40
+ - `docs/ROADMAP.md` - long-term planning
41
+ - `docs/DECISIONS.md` - durable decision records
42
+ - `docs/CREDITS.md` - third-party libraries, vendored code, assets, fonts, attributions
43
+ - `LICENSE` (repo root) - project license
44
+ - `NOTICE` (repo root) - third-party attribution summary (if applicable)
45
+
46
+ ## AI Workflow
47
+
48
+ The full agent playbook lives at `docs/AGENTS.md`: host model and escalation rules, cross-ecosystem tier framework (Frontier / Workhorse / Recon), coordinator-heavy host posture, named subagent roles with input/output contracts (recon, doc-audit, backend-impact, frontend-impact, test-strategist, cross-repo-sync, planner, architect, security-reviewer, debugger), autonomy tags, and the human-collaboration gate. Read it before spawning subagents or picking up tagged work.
49
+
50
+ Subagents do not own commits, merges, or doc-completion-gate sign-off — the host reconciles results.
51
+
52
+ ## Current Status
53
+
54
+ Summarize development state, launch state, or known limitations.
55
+
56
+ ## Tests
57
+
58
+ ```bash
59
+ # unit test command
60
+ ```
@@ -0,0 +1,96 @@
1
+ # Roadmap
2
+
3
+ Use this file for longer-term planning. Keep immediate active tasks in `TODO.md`; keep strategic plans, future milestones, and larger feature ideas here.
4
+
5
+ ## Vision
6
+
7
+ Describe the long-term direction of the project.
8
+
9
+ ## Milestone status markers
10
+
11
+ Append a status marker to each milestone heading so the planning surface is skim-able at a glance:
12
+
13
+ - `(✅ YYYY-MM-DD)` — completed; the date is the ship date. Cross-link the matching `docs/CHANGELOG.md` entry under the milestone (the CHANGELOG is the chronological feature log; the link keeps the two surfaces consistent without duplicating content).
14
+ - `(🟡 in progress)` — actively being worked on right now.
15
+ - `(⏸️ paused)` — work started, intentionally on hold (blocker, dependency, capacity).
16
+ - `(⏭️ deferred)` — pushed out of the current planning horizon; revisit later.
17
+ - *(no marker)* — proposed / not yet started. The default state.
18
+
19
+ Avoid stacking markers (a milestone is paused or deferred, not both). When a milestone completes, set the date marker, link the CHANGELOG entry, and either keep the heading in place under `## Milestones` or move the whole block down under `## Completed` once the section gets crowded — project's call.
20
+
21
+ ## Milestones
22
+
23
+ ### Milestone Name
24
+
25
+ Goal:
26
+
27
+ Target timing:
28
+
29
+ Planned work:
30
+
31
+ - [ ] Item.
32
+ - [x] Completed item (use `[x]` inline or strike-through; the milestone marker above tracks the rollup).
33
+
34
+ ### Milestone Name (✅ 2026-04-30)
35
+
36
+ Shipped. See [CHANGELOG entry](./CHANGELOG.md#2026-04-30-branch-or-pr-or-hash) for details.
37
+
38
+ Goal:
39
+
40
+ Planned work:
41
+
42
+ - [x] Item that shipped.
43
+ - [x] Item that shipped.
44
+
45
+ ### Milestone Name (🟡 in progress)
46
+
47
+ Goal:
48
+
49
+ Target timing:
50
+
51
+ Planned work:
52
+
53
+ - [x] Item that shipped.
54
+ - [ ] Item still open.
55
+
56
+ ### Milestone Name (⏸️ paused)
57
+
58
+ Reason for pause:
59
+
60
+ Goal:
61
+
62
+ Planned work:
63
+
64
+ - [ ] Item.
65
+
66
+ ### Milestone Name (⏭️ deferred)
67
+
68
+ Reason for deferral:
69
+
70
+ Goal (preserved for the future revisit):
71
+
72
+ Planned work:
73
+
74
+ - [ ] Item.
75
+
76
+ ## Future Features
77
+
78
+ - Feature idea.
79
+
80
+ ## Technical Improvements
81
+
82
+ - Improvement idea.
83
+
84
+ ## Deferred Ideas
85
+
86
+ - Idea intentionally postponed.
87
+
88
+ ## Parking Lot
89
+
90
+ - Loose idea or question that is not ready for active work.
91
+
92
+ ## Completed
93
+
94
+ Use the `(✅ YYYY-MM-DD)` marker inline on milestone headings as they ship, or move whole milestone blocks here once the section above gets crowded. Cross-link each completed milestone to its `docs/CHANGELOG.md` entry — the CHANGELOG is the chronological feature log; this section is the planning surface kept current. Do not duplicate the CHANGELOG body here.
95
+
96
+ - ✅ 2026-04-30 — Example completed roadmap item. See [CHANGELOG entry](./CHANGELOG.md#2026-04-30-branch-or-pr-or-hash).
@@ -0,0 +1,235 @@
1
+ <!--
2
+ TEMPLATE: SECURITY_AUDIT.md (Tier A5 — pre-launch / periodic security audit)
3
+
4
+ WHEN TO USE:
5
+ - Before first public deploy of any project.
6
+ - On a periodic cadence after launch (quarterly, or after a major architectural change).
7
+ - After a known incident, as a "what else have we missed" pass.
8
+
9
+ HOW TO USE:
10
+ 1. Copy this file into the project's `docs/` directory.
11
+ 2. Rename to the dated convention: SECURITY_AUDIT_YYYY-MM-DD.md
12
+ (one file per audit; never overwrite a prior audit's record).
13
+ 3. Replace every <placeholder> with project-specific content.
14
+ 4. Keep prior audits in the repo as a record. Append a "Resolved YYYY-MM-DD"
15
+ note inline when a finding closes (preserves the original text).
16
+ 5. Severity bands (Critical / High / Medium / Low / Informational) are
17
+ calibrated against the PRODUCT'S risk profile, not against generic CVSS.
18
+ A Medium for a banking app may be a Low for a no-PII trivia game.
19
+
20
+ RELATED:
21
+ - Pairs with the Security Auditor agent role contract.
22
+ - Findings often spawn entries in OPEN_DECISIONS.md or TODO.md.
23
+ -->
24
+
25
+ # Security Audit — <project-name>
26
+
27
+ **Date:** <YYYY-MM-DD>
28
+ **Auditor:** <auditor-name-or-role-and-tier>
29
+ **Scope:** <one-line scope statement, e.g. "Source-only review of `<repo-path>` at the state on disk on this date.">
30
+ **Engagement:** <pre-launch | periodic | post-incident | other — and the surrounding context, e.g. "Pre-launch audit before <hosting-platform> deploy.">
31
+
32
+ ## 1. Scope
33
+
34
+ ### Audited
35
+
36
+ - <list every file tree, manifest, migration, config, and doc surface that was actually read>
37
+ - <name third-party tools run, e.g. `npm audit`, `pnpm audit`, `bandit`, `gitleaks`, etc.>
38
+ - <name source-tree paths, not just "the repo">
39
+
40
+ ### Excluded (per <Founder | Operator | brief>)
41
+
42
+ - <platform vendors trusted by the engagement, e.g. "Cloudflare itself", "Supabase as a platform">
43
+ - <upstream services we are downstream consumers of>
44
+ - <sibling projects with separate engagements>
45
+ - <any deployed surface — note if there is no live deploy yet>
46
+ - <active probing or penetration testing — typically out of scope for source-only review>
47
+
48
+ ### Assumptions
49
+
50
+ - <what the operator is responsible for and is presumed to handle correctly, e.g. secret-rotation cadence, MFA on cloud accounts>
51
+ - <what the build pipeline is presumed to do, e.g. ".env.local is gitignored and never committed">
52
+ - <what env vars are operator-controlled vs. user-controllable>
53
+ - <any limitation of the audit environment itself, e.g. "no `.git` history readable">
54
+
55
+ ## 2. Threat Model
56
+
57
+ ### Trust boundaries
58
+
59
+ ```
60
+ ┌──────────────────────────────────────────┐
61
+ │ Trusted: <build-host> │
62
+ │ - <what it reads> │
63
+ │ - <what it writes> │
64
+ └──────────────┬───────────────────────────┘
65
+ │ <transport, e.g. git push>
66
+
67
+ ┌──────────────────────────────────────────┐
68
+ │ Trusted: <build-pipeline> │
69
+ │ - <what env / secrets it sees> │
70
+ │ - <what artifact it produces> │
71
+ └──────────────┬───────────────────────────┘
72
+ │ deploy
73
+
74
+ ┌──────────────────────┐ ┌────────────────────────────┐
75
+ │ Untrusted: <visitor> │ ◄─────► │ <runtime-host> │
76
+ │ <browser | client> │ HTTPS │ <surface description> │
77
+ └──────────┬───────────┘ └──────────────┬─────────────┘
78
+ │ │
79
+ │ <client-shipped credential> │ <server-only credential>
80
+ ▼ ▼
81
+ ┌──────────────────────┐ ┌────────────────────────────┐
82
+ │ <data-store> │ ◄─────► │ <third-party-service> │
83
+ │ <table list / KV> │ │ <vendor> │
84
+ └──────────────────────┘ └────────────────────────────┘
85
+ ```
86
+
87
+ > Replace boxes / arrows with the actual project shape. The point of the diagram
88
+ > is to make the trust boundaries explicit so every finding can be located on
89
+ > one of them. Keep it small enough to read at a glance.
90
+
91
+ ### Data assets
92
+
93
+ - **<asset-1>.** <one paragraph: what it is, where it lives, what it would mean if leaked / mutated / deleted, value tier (High / Medium / Low).>
94
+ - **<asset-2>.** <…>
95
+ - **<…>.**
96
+
97
+ > List the SPECIFIC data the project handles. "PII" is too generic — name the
98
+ > tables, columns, files, KV keys. If "no sensitive data" is the answer, state
99
+ > it explicitly so the calibration is documented.
100
+
101
+ ### Attacker shapes
102
+
103
+ | Shape | Capability | Goal | Realistic? |
104
+ |---|---|---|---|
105
+ | **Script kiddie / curiosity** | Browser dev tools, `curl`, no infra | Poke at endpoints, look at JS | <yes/no + one line> |
106
+ | **Opportunistic spammer / botter** | A few thousand requests/sec from rotating IPs | <stat-skew | quota-exhaust | spam | other> | <yes/no + one line> |
107
+ | **Targeted attacker** | Skilled adversary with patience | Exfiltrate data, gain RCE, pivot to <cloud-account> | <yes/no + one line> |
108
+ | **Insider / operator misconfig** | <Founder | operator | role> | <paste-mistake | accidental commit | other> | <yes/no + one line> |
109
+ | **<custom-shape>** | <…> | <…> | <yes/no + one line> |
110
+
111
+ > Calibrate "Realistic?" against the actual product. A targeted attacker is
112
+ > implausible against a free trivia game and very plausible against a payments
113
+ > system. Without this calibration the findings get the wrong severity.
114
+
115
+ ### In-scope attack surface
116
+
117
+ 1. <endpoint or surface 1, with file:line if possible>
118
+ 2. <endpoint or surface 2>
119
+ 3. <client-side bundle contents>
120
+ 4. <build-pipeline / dependency posture>
121
+ 5. <…>
122
+
123
+ ## 3. Findings
124
+
125
+ Severity tiers per the role contract, calibrated against the product's actual
126
+ risk profile. Each finding carries: severity, where, exploit story,
127
+ why-it-matters-for-this-product, recommended fix, effort.
128
+
129
+ ### CRITICAL
130
+
131
+ #### C-1. <one-line finding title>
132
+
133
+ - **Severity:** Critical
134
+ - **Where:** <file:line, migration name, or "absent file" with the doc that says it should exist>
135
+ - **Exploit story:** <concrete attacker walkthrough — actual command / payload / steps; what they achieve>
136
+ - **Why it matters for THIS product:** <link to the product's value prop or trust contract; explain why this is Critical here even if it would be lower elsewhere>
137
+ - **Recommended fix:**
138
+ 1. <step 1>
139
+ 2. <step 2>
140
+ 3. <…>
141
+ - **Effort:** <XS | S | M | L | XL>
142
+
143
+ ### HIGH
144
+
145
+ #### H-1. <…>
146
+
147
+ - **Severity:** High
148
+ - **Where:** <…>
149
+ - **Exploit story:** <…>
150
+ - **Why it matters for THIS product:** <…>
151
+ - **Recommended fix:** <…>
152
+ - **Effort:** <…>
153
+
154
+ ### MEDIUM
155
+
156
+ #### M-1. <…>
157
+
158
+ (same shape as above)
159
+
160
+ ### LOW
161
+
162
+ #### L-1. <…>
163
+
164
+ (same shape as above)
165
+
166
+ ### INFORMATIONAL
167
+
168
+ #### I-1. <…>
169
+
170
+ - **Where:** <…>
171
+ - **Note:** <one paragraph — not a finding, but a flag for completeness or a future-pass item>
172
+
173
+ ## 4. Accept-Risk Candidates
174
+
175
+ These are real findings the <Founder | Operator> may reasonably accept-risk
176
+ given the product's stage, scope, and audience. Each carries the rationale for
177
+ why an accept-risk decision is defensible AND triggers that should reopen it.
178
+
179
+ - **AR-1. <finding-id> (<short-title>) accepted <permanently | for the launch window | until <milestone>>.** <one-paragraph rationale>
180
+ - **Triggers to revisit:** <concrete observable signals — traffic spike, scope expansion, feature add, etc.>
181
+
182
+ - **AR-2. <finding-id> accepted <…>.** <…>
183
+ - **Triggers to revisit:** <…>
184
+
185
+ > Accept-Risk is a deliberate decision, not a forgotten finding. State the
186
+ > accept-risk reasoning explicitly so a future reader (or auditor) can tell
187
+ > "this was considered" from "this was missed."
188
+
189
+ ## 5. Hardening Recommendations Beyond Findings
190
+
191
+ Defense-in-depth and product-quality items not tied to any specific finding above.
192
+
193
+ - **H-1. <recommendation>.** <one paragraph — what + why + effort estimate>
194
+ - **H-2. <…>**
195
+ - **H-…**
196
+
197
+ ## 6. Dependencies
198
+
199
+ ### Root manifest (`<package.json | pyproject.toml | Cargo.toml | …>`)
200
+
201
+ `<npm audit | pnpm audit | pip-audit | cargo audit>` summary, run <YYYY-MM-DD>:
202
+
203
+ ```
204
+ total: <N>
205
+ critical: <n>
206
+ high: <n>
207
+ moderate: <n>
208
+ low: <n>
209
+ info: <n>
210
+
211
+ <one line per finding: package, version range, severity, advisory id, one-line description>
212
+ ```
213
+
214
+ <Plain-language paragraph: which findings reach production runtime vs. dev-only;
215
+ what the realistic exploit window is for each; the recommended fix path
216
+ (`pnpm up …`, `npm audit fix`, semver-major upgrade, etc.).>
217
+
218
+ ### Production-runtime dependencies
219
+
220
+ <list the production-runtime deps and their audit status — clean or which
221
+ findings apply. Make explicit what does NOT reach production (dev-tool chains
222
+ that show up in audit but never ship).>
223
+
224
+ ## 7. Out-of-Scope Notes
225
+
226
+ These were noticed during the walk but are outside the agreed scope. Documenting
227
+ so they are not lost.
228
+
229
+ - **OoS-1.** <one paragraph: what was noticed, why it's out of scope, what the operator should do about it later>
230
+ - **OoS-2.** <…>
231
+ - **OoS-…**
232
+
233
+ ---
234
+
235
+ **End of report.**
@@ -0,0 +1,162 @@
1
+ <!--
2
+ TEMPLATE: SETUP.md (one-time first-run discussion checklist)
3
+
4
+ WHEN TO USE:
5
+ - At first-run when the framework is being initialized in a new repo. The
6
+ agent walks through these questions with the user; the answers are
7
+ recorded into `docs/HANDOFF.md` ("Project-Specific Landing Zone") or
8
+ `docs/AGENTS.md` ("Local Overrides"). Each question below names where
9
+ its answer goes.
10
+ - This file is a *discussion* surface, not a runtime doc. Once the
11
+ answers have landed in HANDOFF/AGENTS, delete `docs/SETUP.md` from the
12
+ project. The framework's own copy stays in `templates/` as the
13
+ canonical seed.
14
+
15
+ HOW TO USE:
16
+ 1. Copy this file into the new project's `docs/` folder alongside the
17
+ rest of the templates.
18
+ 2. The agent prompts the user through each section in order. Defaults are
19
+ suggestions, not decisions — the user states their preference and the
20
+ agent records it in the named destination doc.
21
+ 3. Once every section's answer has landed in HANDOFF / AGENTS / etc.,
22
+ delete this file from the project. Do not keep stale answers here.
23
+
24
+ WHY THIS ISN'T A TEMPLATE DEFAULT:
25
+ These questions encode per-project preferences (autonomy posture,
26
+ approval-signal literals, deploy gating thresholds, stakeholder identity,
27
+ sibling-repo wiring). Baking any one project's answers into the framework
28
+ would mis-seed the next. The discussion is the point — the *answers* are
29
+ project-local and live in the project's own docs.
30
+ -->
31
+
32
+ # Project Setup — First-Run Discussion Checklist
33
+
34
+ Walk through this once when initializing the framework in a new repo. Each section is a question (with options and a default) plus a "Recorded in:" pointer naming the doc that owns the answer afterward. Delete this file once every answer has landed.
35
+
36
+ ## 1. Autonomy level
37
+
38
+ What posture does the autonomous host run with on this project?
39
+
40
+ - **High** — autonomous merges on `[autonomy: safe]` items, opens DRAFT PRs for `[autonomy: review]` items, blocks on `[autonomy: needs-human-collab]`. Best for solo / trusted-author projects with a strong test suite.
41
+ - **Medium** — every merge gets a PR review, regardless of autonomy tag. Autonomous host implements but never auto-merges. Best for shared repos or anywhere a second pair of eyes is cheap insurance.
42
+ - **Low** — human approves each step. Autonomous mode is effectively disabled; supervised sessions only. Best when the project is in early shape-finding or when the codebase changes faster than the test suite covers it.
43
+
44
+ Cross-reference: see "Autonomy Markers" in `docs/AGENTS.md` for the per-task tags. The level chosen here governs the *default posture*; per-task tags still apply.
45
+
46
+ **Recorded in:** `docs/AGENTS.md` "Local Overrides" (state which level applies and why).
47
+
48
+ ## 2. Approval signal literals
49
+
50
+ Which exact phrases gate work on this project?
51
+
52
+ Default: at least one funding/scope signal so material drift requires a re-pitch. Common choices:
53
+
54
+ - `<PROJECT>_APPROVED` — funding/scope signal for the pitch in `docs/PROJECT_CONTEXT.md`. Gate for any work that would expand scope beyond the funded shape.
55
+ - `RELEASE_APPROVED` — gate for cutting a public release / version bump.
56
+ - `DEPLOY_APPROVED` — gate for promoting a build to a public-facing surface (see also: Pre-Deploy Gate in `docs/DEPLOYMENT.md`).
57
+ - `ACTIVE_PROBE_APPROVED` — gate for security-reviewer active probing of a deployed surface (see `docs/agents/SECURITY_REVIEWER.md`).
58
+
59
+ Pick literals that are unambiguous (the agent matches on exact strings). Project may add additional signals (e.g. `MIGRATION_APPROVED` for risky schema work).
60
+
61
+ **Recorded in:** `docs/HANDOFF.md` "Approval Signals" section.
62
+
63
+ ## 3. Default model tier
64
+
65
+ Which tier drives routine implementation work on this project?
66
+
67
+ - **Workhorse (Sonnet 4.6 / equivalent)** — typical default for most projects. Cost-efficient over long sessions, sufficient for most feature work, refactors, and doc updates.
68
+ - **Frontier (Opus 4.7 / equivalent)** — preferred default for ARG-style projects, security-heavy domains, novel-research builds, or anywhere Workhorse-tier slips have historically been expensive to recover from.
69
+
70
+ Subagent tiers (Recon for lookup, Frontier for `planner` / `architect` / `security-reviewer` / `debugger`) follow the standard playbook regardless of host default.
71
+
72
+ **Recorded in:** `docs/AGENTS.md` "Local Overrides" (only if differing from the framework default of Workhorse).
73
+
74
+ ## 4. Test gating
75
+
76
+ Which test pass(es) gate which milestones on this project?
77
+
78
+ - **Commit gate** — what must pass before each commit? (Default: unit tests + typecheck.)
79
+ - **Merge gate** — what must pass before merging into the default branch? (Default: full test suite + lint + typecheck.)
80
+ - **Deploy gate** — what must pass before promoting to a public surface? (Default: full test suite + smoke test against the build artifact + Pre-Deploy Gate; see §5.)
81
+
82
+ Skip a tier if the project doesn't have it (e.g. single-author repos may collapse commit and merge into one).
83
+
84
+ **Recorded in:** `docs/HANDOFF.md` "Project-Specific Landing Zone" or `docs/DEPLOYMENT.md` (deploy gate specifically).
85
+
86
+ ## 5. Deploy gating
87
+
88
+ Who has deploy authority on this project, and what must hold before a deploy?
89
+
90
+ - **Deploy authority** — which human(s) can authorize a public-facing deploy? Name them. The autonomous host never deploys without an explicit signal from this person.
91
+ - **Required signals** — typically `DEPLOY_APPROVED` plus any project-specific gate (e.g. `MIGRATION_APPROVED` if the deploy includes a schema change).
92
+ - **Security-audit recency** — default: a current `docs/SECURITY_AUDIT_<DATE>.md` must exist, **either ≤90 days old OR covering all changes since the last audit, whichever is stricter**. See `docs/DEPLOYMENT.md` "Pre-Deploy Gate" for the hard-requirement spec.
93
+
94
+ **Recorded in:** `docs/DEPLOYMENT.md` (Pre-Deploy Gate is already templated; project fills in authority and signals).
95
+
96
+ ## 6. Content-safety rules
97
+
98
+ Project-specific hard rules that the agent must never violate. Examples by domain:
99
+
100
+ - ARG / fiction project: no living-person gotchas, no medical claims, no tragedy material.
101
+ - Trivia / quiz project: real options must link to a real source; fakes must be invented; no defamatory content.
102
+ - Compliance-bearing project: PII handling rules, HIPAA / GDPR boundaries, data-retention limits.
103
+ - Internal tooling: secrets-in-logs prohibition, customer-data redaction rules.
104
+
105
+ Default: at minimum, no secrets in commits, no PII in docs, no real user data in fixtures.
106
+
107
+ **Recorded in:** `docs/agents/<ROLE>.md` "Content-Safety Rules" section per affected role, plus a one-line rule in `CLAUDE.md` "Hard Rules" if it's universally load-bearing.
108
+
109
+ ## 7. Stakeholder identity
110
+
111
+ Who's the lead stakeholder on this project, and which entity owns revenue / contracts / legal?
112
+
113
+ - **Lead stakeholder** — name (or role title) of the person who funds scope, accept-risks security findings, and signs off on `[needs-human-collab]` items.
114
+ - **Revenue / contract entity** — the legal entity that owns commercial output. Affects copyright lines, license decisions, NOTICE wording.
115
+
116
+ If the project has a `docs/agents/STAKEHOLDER.md` role file, this is where its identity lives.
117
+
118
+ **Recorded in:** `docs/agents/STAKEHOLDER.md` (or equivalent role contract) and `LICENSE` / `NOTICE` copyright lines.
119
+
120
+ ## 8. Sibling repos
121
+
122
+ Which other repos must stay in sync with this one via the cross-link invariant?
123
+
124
+ List repo paths plus the kind of sync expected (palette swap, shared template promotion, doc back-link, etc.). The `cross-repo-sync` subagent uses this list when making coordinated edits.
125
+
126
+ **Recorded in:** `docs/HANDOFF.md` "Related Repos" section.
127
+
128
+ ## 9. Mirror / backup setup
129
+
130
+ Does this project fan out pushes to multiple hosts? Where do backups live?
131
+
132
+ - **Multi-host fan-out** — e.g. GitHub + GitLab + a NAS bare repo, configured via `origin` pushurls. See the framework's own `REMOTES.md` for the pattern.
133
+ - **Backup cadence** — full repo mirror frequency, snapshot location, retention.
134
+ - **Recovery procedure** — what does "restore from backup" look like in practice? Document it before you need it.
135
+
136
+ **Recorded in:** `docs/HANDOFF.md` "Remotes & Backup" section.
137
+
138
+ ## 10. Worktree convention
139
+
140
+ How does this project organize worktrees for parallel/edit-capable subagent work?
141
+
142
+ - **Default** — `.claude/worktrees/<task-name>/` adjacent to the repo, gitignored. Edit-capable subagents in autonomous runs use these so parallel work cannot conflict.
143
+ - **Custom location** — some projects keep worktrees under `<sibling-path>/worktrees/` to avoid cluttering the main repo. State the path.
144
+ - **No worktrees** — small / single-author / supervised-only projects may skip the worktree convention entirely. State that explicitly so the host doesn't try to use one.
145
+
146
+ **Recorded in:** `docs/HANDOFF.md` "Project-Specific Landing Zone" or `docs/AGENTS.md` "Local Overrides".
147
+
148
+ ## 11. Permissions posture
149
+
150
+ How permissive should Claude Code's auto-approval be on this project?
151
+
152
+ - **Default (recommended starting point):** project-level `.claude/settings.json` is empty; the project inherits whatever the operator has at user-level (`~/.claude/settings.json`). Pick this if the operator's posture is appropriate for the project's threat model.
153
+ - **Tighter (project overrides user):** add an `ask`/`deny` block at project scope to force prompts on commands the user-level config would auto-approve. Use this when a project handles secrets, regulated data, or shared CI.
154
+ - **Looser:** generally not recommended — projects shouldn't expand trust beyond user defaults. If absolutely necessary, document why in `docs/DECISIONS.md`.
155
+
156
+ The `templates/.claude/settings.json` template ships with the empty default plus an opt-in permissive preset under `_alternatives` for reference. Do NOT paste the preset blindly.
157
+
158
+ **Recorded in:** `docs/AGENTS.md` Local Overrides section.
159
+
160
+ ---
161
+
162
+ Once every section above has a recorded answer, **delete `docs/SETUP.md` from this project**. The framework's `templates/SETUP.md` stays in place as the seed for the next project.
@@ -0,0 +1,105 @@
1
+ # Functional Spec: <product name>
2
+
3
+ <!--
4
+ Stage A output of the Spec & Design phase (see SPEC_WORKFLOW.md).
5
+ ENTIRELY PLAIN ENGLISH. No tech choices, no stack, no libraries — those
6
+ belong in BUILD_PLAN.md (Stage B). A non-engineer must be able to read
7
+ this and recognize their product.
8
+
9
+ Every requirement is tagged [AUTO] (a machine can check it) or [HUMAN]
10
+ (needs human judgment). Every requirement is testable — if you can't say
11
+ how it would be verified, rewrite it or tag it [HUMAN].
12
+
13
+ This file is LOCKED by the verbatim token SPEC_APPROVED. Stage B does not
14
+ begin until it lands.
15
+ -->
16
+
17
+ **Status:** Draft — awaiting `SPEC_APPROVED`
18
+ **Interaction tier:** Thorough <!-- Express | Guided | Thorough | Exhaustive — set at first prompt -->
19
+ **Last updated:** <YYYY-MM-DD>
20
+
21
+ ## Goal
22
+
23
+ <One or two sentences. What "done" looks like for this product, in plain English.>
24
+
25
+ ## Context / Inputs
26
+
27
+ <What already exists, what's provided, the relevant constraints. For a funded
28
+ pitch, link it: `docs/pitches/<status>/<PRODUCT>.md`.>
29
+
30
+ ## Screens / Pages
31
+
32
+ <One subsection per screen. A reader should be able to picture the product
33
+ from this section alone.>
34
+
35
+ ### <Screen name>
36
+
37
+ - **Purpose:** <what this screen is for, who reaches it and how>
38
+ - **Controls:** <every button / input / menu / tool on it, and what each one does>
39
+ - **States:** <empty / loading / error / populated / max — what the user sees in each>
40
+
41
+ ## Requirements
42
+
43
+ <!--
44
+ Numbered. Each tagged [AUTO] or [HUMAN]. Each phrased as an observable,
45
+ checkable condition: "<thing> MUST <condition>".
46
+ -->
47
+
48
+ - **R1** `[AUTO]` <thing> MUST <observable, checkable condition>.
49
+ - **R2** `[AUTO]` <thing> MUST <observable, checkable condition>.
50
+ - **R3** `[HUMAN]` <thing that needs judgment, e.g. "the onboarding copy reads warmly">.
51
+
52
+ ## User Flows
53
+
54
+ <The paths through the product. For each: the steps, the state transitions,
55
+ and what success looks like at the end.>
56
+
57
+ 1. **<Flow name>:** <step → step → step → success condition>
58
+
59
+ ## Boundaries & Edge Cases
60
+
61
+ <Explicit behavior at the limits and on bad input — this is where most spec
62
+ failures hide.>
63
+
64
+ - **Empty / zero / none:** <behavior>
65
+ - **Maximum / overflow:** <behavior>
66
+ - **Malformed / invalid input:** <behavior>
67
+ - **Conflict resolution:** <when requirement X and Y disagree, X wins because …>
68
+
69
+ ## Out of Scope
70
+
71
+ <What this deliberately does NOT do. The highest-leverage section — it is what
72
+ stops scope creep at build time. Be specific; "for now" items go here too.>
73
+
74
+ - <explicitly excluded capability>
75
+
76
+ ## Assumptions
77
+
78
+ <Everything the spec takes for granted. An executor resolves unstated
79
+ assumptions in the most generic direction — so state them and have the human
80
+ confirm or correct each one.>
81
+
82
+ - <assumption the human should confirm>
83
+
84
+ ## Acceptance Tests
85
+
86
+ <For each [AUTO] requirement, the concrete check that proves it. These become
87
+ the verifier suite generated in Stage B. Reference the requirement number.>
88
+
89
+ - **R1** → <the check: unit test / schema validation / round-trip / headless smoke / shell check that passes iff R1 holds>
90
+ - **R2** → <the check>
91
+
92
+ ## Human Checklist
93
+
94
+ <For each [HUMAN] requirement, the specific thing the reviewer confirms after
95
+ the build. This plus anything the runner flags is the entire post-build review
96
+ surface.>
97
+
98
+ - [ ] **R3** — <the specific thing to confirm>
99
+
100
+ ## Open Questions
101
+
102
+ <Anything the red-team pass surfaced that needs a human decision before
103
+ SPEC_APPROVED. Resolve these; do not paper over them with a default.>
104
+
105
+ - <open question awaiting a human call>