opencode-codeops 1.4.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 (102) hide show
  1. package/CHANGELOG.md +179 -0
  2. package/LICENSE +21 -0
  3. package/README.md +171 -0
  4. package/_shared/auto-design.md +129 -0
  5. package/_shared/layout-convention.md +198 -0
  6. package/_shared/quality-profile.md +134 -0
  7. package/_shared/recommendation-hardening.md +166 -0
  8. package/_shared/scope-expansion-control.md +176 -0
  9. package/_shared/spec-first-ordering.md +79 -0
  10. package/_shared/zero-ambiguity-gate.md +311 -0
  11. package/agent-templates/codebase-scout.md +17 -0
  12. package/agent-templates/concurrency-auditor.md +5 -0
  13. package/agent-templates/design-challenger.md +26 -0
  14. package/agent-templates/financial-integrity-auditor.md +5 -0
  15. package/agent-templates/perf-auditor.md +23 -0
  16. package/agent-templates/phase-reviewer.md +54 -0
  17. package/agent-templates/plan-task-executor-opus.md +46 -0
  18. package/agent-templates/plan-task-executor.md +43 -0
  19. package/agent-templates/preflight-auditor.md +45 -0
  20. package/agent-templates/security-auditor.md +42 -0
  21. package/agent-templates/semantics-reviewer.md +5 -0
  22. package/agent-templates/spec-test-author.md +29 -0
  23. package/agents/concurrency-auditor.md +15 -0
  24. package/agents/correctness-reviewer.md +66 -0
  25. package/agents/demanding-executor.md +58 -0
  26. package/agents/design-challenger.md +38 -0
  27. package/agents/executor.md +55 -0
  28. package/agents/explorer.md +29 -0
  29. package/agents/financial-integrity-auditor.md +15 -0
  30. package/agents/performance-auditor.md +35 -0
  31. package/agents/preflight-auditor.md +57 -0
  32. package/agents/security-auditor.md +54 -0
  33. package/agents/semantics-reviewer.md +15 -0
  34. package/agents/spec-test-author.md +41 -0
  35. package/bin/codeops-worktree +244 -0
  36. package/bin/index.mjs +106 -0
  37. package/bin/install-agents.mjs +453 -0
  38. package/bin/install-skills.mjs +466 -0
  39. package/bin/lib/opencode-install.mjs +185 -0
  40. package/install.sh +55 -0
  41. package/package.json +73 -0
  42. package/plugin/index.ts +181 -0
  43. package/references/domains/compiler-and-language.md +28 -0
  44. package/references/domains/data-and-migration.md +22 -0
  45. package/references/domains/distributed-and-concurrent.md +26 -0
  46. package/references/domains/financial-system.md +28 -0
  47. package/references/domains/selection.md +19 -0
  48. package/references/domains/web-application.md +23 -0
  49. package/schemas/codeops-config.schema.json +56 -0
  50. package/scripts/check-version.mjs +163 -0
  51. package/scripts/codeops-migrate.sh +355 -0
  52. package/scripts/codeops-roadmap-compact.sh +232 -0
  53. package/scripts/codeops-roadmap-sync.sh +275 -0
  54. package/scripts/codeops_outcomes.py +155 -0
  55. package/scripts/codeops_plan.py +239 -0
  56. package/scripts/codeops_plan_migrate.py +318 -0
  57. package/scripts/codeops_worktree_snapshot.py +99 -0
  58. package/scripts/install_agents.py +288 -0
  59. package/scripts/release.mjs +533 -0
  60. package/skills/analyze-project/SKILL.md +28 -0
  61. package/skills/clean-comments/SKILL.md +22 -0
  62. package/skills/exec-plan/SKILL.md +267 -0
  63. package/skills/exec-plan/commit-modes.md +113 -0
  64. package/skills/exec-plan/execution-protocol.md +471 -0
  65. package/skills/git-commit/SKILL.md +35 -0
  66. package/skills/github-issues/SKILL.md +38 -0
  67. package/skills/grill-me/SKILL.md +342 -0
  68. package/skills/make-plan/SKILL.md +282 -0
  69. package/skills/make-plan/quality-checklist.md +96 -0
  70. package/skills/make-plan/templates.md +535 -0
  71. package/skills/make-plan/zero-ambiguity-gate.md +19 -0
  72. package/skills/make-requirements/SKILL.md +268 -0
  73. package/skills/make-requirements/discovery-phases.md +255 -0
  74. package/skills/make-requirements/review-and-add.md +73 -0
  75. package/skills/make-requirements/templates.md +296 -0
  76. package/skills/make-requirements/zero-ambiguity-gate.md +18 -0
  77. package/skills/outcome-review/SKILL.md +34 -0
  78. package/skills/preflight/SKILL.md +310 -0
  79. package/skills/preflight/dimensions.md +181 -0
  80. package/skills/preflight/report-format.md +300 -0
  81. package/skills/retro-requirements/SKILL.md +218 -0
  82. package/skills/retro-requirements/confidence-classification.md +45 -0
  83. package/skills/retro-requirements/phases.md +609 -0
  84. package/skills/retro-requirements/triage-gate.md +135 -0
  85. package/skills/roadmap/SKILL.md +381 -0
  86. package/skills/roadmap/stage-hooks.md +80 -0
  87. package/skills/roadmap/template.md +200 -0
  88. package/skills/setup-codeops/SKILL.md +94 -0
  89. package/skills/setup-codeops/migration.md +106 -0
  90. package/skills/setup-codeops/scaffold.md +99 -0
  91. package/skills/setup-routing/SKILL.md +102 -0
  92. package/skills/setup-routing/routing.md +44 -0
  93. package/skills/techdocs/SKILL.md +199 -0
  94. package/skills/techdocs/authoring-and-update.md +178 -0
  95. package/skills/techdocs/templates.md +655 -0
  96. package/skills/techdocs/vitepress-setup.md +143 -0
  97. package/skills/upgrade-plan/SKILL.md +75 -0
  98. package/skills/upgrade-plan/content-quality-gate.md +35 -0
  99. package/skills/upgrade-plan/upgrade-checklists.md +107 -0
  100. package/standards/coding-standards-full.md +124 -0
  101. package/standards/coding-standards.md +64 -0
  102. package/standards/output-style.md +17 -0
@@ -0,0 +1,268 @@
1
+ ---
2
+ name: make-requirements
3
+ description: >-
4
+ Gather and document requirements, turn an idea into formal requirement
5
+ documents (RDs). Use for "make-requirements" (full discovery: brain dump or
6
+ bare idea into a structured requirements/ set), "add_requirement" (add one new
7
+ RD to an existing set), and "review_requirements" (health check / gap analysis
8
+ on an existing set). Trigger when the user wants to capture, expand, structure,
9
+ or audit what a system must do before building it — e.g. "help me spec out my
10
+ app", "document requirements", "what features am I missing", "add a feature to
11
+ the requirements", "review my requirements for gaps". Acts as a proactive
12
+ domain consultant: absorbs the seed idea, expands it with comparable-system
13
+ features, challenges it with edge cases, then decomposes it into numbered RDs
14
+ behind a hard Zero-Ambiguity Gate.
15
+ ---
16
+
17
+ # Requirements Gathering & Documentation
18
+
19
+ > **CodeOps Artifact Schema**: 1
20
+
21
+ ## Auto-design option
22
+
23
+ If `$ARGUMENTS` contains exactly one exact standalone `--auto-design` token before the first `--` sentinel, remove it before resolving targets, paths, or modes; zero occurrences means normal mode, more than one is invalid, and tokens at or after the sentinel are target content; announce `Auto-design active — eligible technical decisions are
24
+ delegated and recorded`; then read and apply
25
+ [../../_shared/auto-design.md](../../_shared/auto-design.md). Resolve eligible technical
26
+ requirements decisions under that policy and propagate its downward-only context to explicitly
27
+ invoked supported children; an unsupported child fails closed. This mode does not grant action permission or scope expansion. **Normal mode:** without the exact token, every material choice
28
+ still requires an explicit user decision; historical delegated records must not infer delegated authority.
29
+
30
+ Transform a rough project idea into a structured, complete set of formal
31
+ **requirement documents (RDs)**. This skill is upstream of, and independent
32
+ from, the make-plan skill — neither requires the other.
33
+
34
+ ## Requirements authority contract
35
+
36
+ Requirement documents own agreed behavior and acceptance criteria. Use stable `RD-*` identifiers;
37
+ ambiguities and decisions use stable `AR-*` identifiers. Link each resolved ambiguity to every
38
+ requirement or specification it affects. Before declaring requirements complete, directly confirm
39
+ that every material ambiguity is resolved, every requirement is approved, and every referenced
40
+ artifact exists. Do not create a workflow-state file. When a plan is later created, its
41
+ `00-index.md` declares the RD or RDs it implements; RD delivery is derived from that plan rather
42
+ than stored as a second mutable status.
43
+
44
+ ## Core Principle: Proactive Domain Consultant
45
+
46
+ Before discovery, read [../../references/domains/selection.md](../../references/domains/selection.md), select every applicable system lens, and read those lens files completely. Record selected lenses and evidence in the requirements index. Re-evaluate selection when discovery reveals another domain; a financial web service, for example, requires financial, web, distributed/concurrent, and data/migration lenses.
47
+
48
+ You are NOT a passive interviewer. You are a **domain-aware consultant** that:
49
+
50
+ 1. **Absorbs** — takes whatever the user provides (brain dump, bullets, vague idea) as seed material
51
+ 2. **Expands** — draws on knowledge of comparable systems to suggest features the user hasn't considered
52
+ 3. **Challenges** — asks "what happens when..." to expose edge cases and hidden requirements
53
+ 4. **Structures** — decomposes the expanded scope into formal, numbered RDs
54
+ 5. **Validates** — cross-references all documents for gaps, inconsistencies, and missing concerns
55
+
56
+ The user's input is NEVER the final requirements. The value of this skill is in
57
+ **making incomplete ideas complete**. Expansion produces choices for the user; it does not make
58
+ every comparable-system feature, edge case, or support mechanism part of the product. Nothing new
59
+ enters scope without the user's explicit choice.
60
+
61
+ > **Grounded Options & Recommendations (coding standards → Working style) apply here.** Before presenting options/findings/recommendations: filter out non-viable ones (no strawmen; ≥2 only when ≥2 are genuinely viable, else present the single viable path and name what was rejected), second-guess each, verify any code-modifying option against the actual current code (cite `file:line`), and lead with a recommendation backed by grounded reasoning. Match ceremony to stakes. In normal mode, the user decides; active auto-design resolves eligible technical decisions and escalates reserved ones. **Recommendation hardening:** apply `_shared/recommendation-hardening.md` — for **high-stakes** Phase 2B gate decisions (complex/sensitive-tagged) spawn one independent challenger and reconcile *before* presenting; for all consequential decisions run the in-context layers and close with the `Confidence:` / `Hardening:` disclosure.
62
+
63
+ ---
64
+
65
+ ## Resolve paths first (layout-aware)
66
+
67
+ Determine the layout via **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)** before writing anything:
68
+
69
+ - **Flat layout** (no `codeops/.codeops.yml`): RDs live in `requirements/RD-NN-*.md` with a single
70
+ repo-wide RD sequence — exactly as flat layout always has.
71
+ - **Nested layout** (marker present): RDs live in `codeops/features/<f>/requirements/RD-NN-*.md`.
72
+ **Ask/confirm the target feature** before drafting (create the feature folder **lazily** if new
73
+ — never guess the feature). **RD ids reset per feature** (`billing/RD-01` and `auth/RD-01` are
74
+ both valid and independent), and any cross-feature reference is **feature-qualified**
75
+ (`billing/RD-01`). Everywhere below that says `requirements/` means the feature's requirements dir.
76
+
77
+ ## Route first: is this a feature or a task?
78
+
79
+ Requirements (RDs) are for **features** — new cohesive capabilities. Ad-hoc work (a bugfix,
80
+ chore, or small change) is **not** a feature: it is a lightweight **task**, tracked with a
81
+ roadmap row (trivial) or a single mini-plan (non-trivial) — **no RD, no discovery, no
82
+ Zero-Ambiguity Gate**. The lane exists in **both layouts** (flat gained it in 3.2.0). If the
83
+ user's request is really a small fix, route them to the task lane (a roadmap row + `make-plan`
84
+ for a non-trivial mini-plan) instead of drafting an RD. If it is genuinely unclear, ask — never
85
+ default to the heavy pipeline silently. The task model and routing rule live in
86
+ **[../../_shared/layout-convention.md](../../_shared/layout-convention.md)**.
87
+
88
+ ## Step 0: Detect the Mode
89
+
90
+ Read the user's phrasing and arguments, then branch:
91
+
92
+ | Signal | Mode | Go to |
93
+ |--------|------|-------|
94
+ | "make-requirements", "spec out", "document requirements", a brain dump, a bare idea, or nothing but the trigger | **Full Discovery** | Phases 1–4 below |
95
+ | "add_requirement", "add a feature/RD", "I also need …" AND a `requirements/` set already exists | **Add One RD** | the `review-and-add.md` reference |
96
+ | "review_requirements", "check my requirements", "what's missing/inconsistent" AND a `requirements/` set exists | **Health Check** | the `review-and-add.md` reference |
97
+ | "make-requirements --continue" or "resume requirements" | **Resume** | Step 0a |
98
+
99
+ If a mode is ambiguous (e.g. a `requirements/` folder exists but the user gave a
100
+ fresh brain dump), ask the user which they want. Do not guess.
101
+
102
+ ### Step 0a: Resume an interrupted session
103
+
104
+ If resuming: read `requirements/_draft/discovery-notes.md`, summarize where you
105
+ left off (confirmed scope, selected features, open questions, stakeholder map,
106
+ which phase/step is next), then continue from the next step.
107
+
108
+ ### Add / Review modes
109
+
110
+ For **add_requirement** and **review_requirements**, read **`review-and-add.md`**
111
+ and follow the protocol there. Both reuse the gate and templates described below.
112
+
113
+ ---
114
+
115
+ ## Full Discovery Overview
116
+
117
+ A multi-turn conversation, never a one-shot. The flow:
118
+
119
+ ```
120
+ discovery interview → comparable analysis → user journeys → edge cases →
121
+ scope confirmation → glossary → decomposition → dependency graph →
122
+ 🚨 ZERO-AMBIGUITY GATE → RD authoring → validation → final output
123
+ ```
124
+
125
+ | Phase | What happens | Reference file |
126
+ |-------|--------------|----------------|
127
+ | **1. Discovery & Domain Analysis** | Vision interview, stakeholder mapping, comparable-systems analysis, user journeys, edge cases, scope confirmation | **`discovery-phases.md`** |
128
+ | **2. Structuring** | Glossary, decompose into RDs, dependency graph, MVP-vs-full phasing, integration map | **`discovery-phases.md`** |
129
+ | **2B. Zero-Ambiguity Gate** | Hard, non-negotiable gate — compile the Ambiguity Register, resolve every item with the user | **`zero-ambiguity-gate.md`** |
130
+ | **3. Authoring** | Write README + the minimum coherent RD set from templates; acceptance-criteria specificity; place non-functional criteria with their owner | **`templates.md`** |
131
+ | **4. Validation** | Cross-reference check, "Did You Consider…" checklist, final verification, roadmap sync, summary | this file (below) + `templates.md` |
132
+
133
+ ### Trigger modes for input (Phase 1 entry)
134
+
135
+ - **Brain dump** (most common): user gives a rough description with the trigger. Take it as seed material, recognize it's incomplete, enter full discovery.
136
+ - **Bare trigger**: nothing but the trigger. Open with the broadest question: *"What do you want to build? Give me as much or as little as you have — a rough idea, some bullet points, a domain, or even just a problem you want to solve."*
137
+ - **Existing notes / reference**: user points at files (e.g. "I have notes in docs/project-ideas.md"). Read them, extract the seeds, enter discovery with richer starting material.
138
+
139
+ ---
140
+
141
+ ## The Zero-Ambiguity Rule (active from question one)
142
+
143
+ This rule applies to **every decision with semantic weight** — feature specs,
144
+ behavioral definitions, scope boundaries, edge-case handling, technical choices,
145
+ data models, naming, document organization. Behavior/scope/data/security
146
+ decisions ALWAYS gate; cosmetic choices with zero semantic impact are exempt
147
+ (per the shared gate's semantic-impact exemptions), and low-stakes cosmetic items
148
+ may be batched. If you must choose between two or more semantically distinct
149
+ options. **In normal mode, the user decides.** With active auto-design, resolve only eligible
150
+ technical decisions under the shared policy; reserved decisions still require the user.
151
+
152
+ Every question MUST yield a concrete, specific, unambiguous answer. Do NOT accept
153
+ vague responses, fill gaps with your own assumptions, infer intent, or proceed
154
+ with "reasonable defaults" the user didn't explicitly choose outside the active auto-design
155
+ policy. If an answer is unclear, ask again with sharper options. If the user says "I'm not sure,"
156
+ lay out the options with trade-offs and guide them. **In normal mode, the decision must be
157
+ theirs.** With active auto-design, resolve and record eligible technical decisions under the
158
+ shared policy; reserved decisions remain the user's.
159
+
160
+ Throughout discovery, compile the **Ambiguity Register**. It is formally enforced
161
+ at Phase 2B before any RD is written — see **`zero-ambiguity-gate.md`**. The
162
+ register is saved permanently at **`requirements/00-ambiguity-register.md`** and
163
+ every decision in every RD back-references its AR # entry.
164
+
165
+ The shared **Complexity Escalation Gate** in that file is active from the first question. During
166
+ discovery, an optional candidate remains non-executable until the user selects `Want`: annotate
167
+ possible material layers, dependencies, harnesses, frameworks, or infrastructure, and batch those
168
+ cost notes without stopping for approval. Once the user selects `Want` or otherwise confirms the
169
+ candidate in scope, stop and present the visible approval packet after an independent challenge
170
+ before it enters the requirements. Record any approved larger option as
171
+ `Technical (complexity escalation)`. Auto-design may choose the smallest viable option but cannot
172
+ approve the escalation.
173
+
174
+ When opt-in outcome metrics are enabled, record only the enumerated requirements result and
175
+ aggregate round/decision counts. Never store questions, decisions, names, paths, or content.
176
+
177
+ ---
178
+
179
+ ## Phase 4: Validation & Finalization
180
+
181
+ After all RDs are written:
182
+
183
+ ### 4.1 Cross-Reference Validation
184
+
185
+ Check for:
186
+ - **Missing references** — RD-05 mentions "equipment booking" but RD-07 doesn't list the relationship
187
+ - **Orphaned features** — a feature is described but no RD owns it
188
+ - **Circular dependencies** — RD-03 → RD-05 → RD-03
189
+ - **Scope leaks** — a "Won't Have" in one RD contradicts a "Must Have" in another
190
+
191
+ ### 4.2 "Did You Consider…" Checklist
192
+
193
+ Run through the commonly-forgotten-requirements checklist (audit logging, data
194
+ export, API versioning, rate limiting, empty states, accessibility, backup/DR,
195
+ i18n, GDPR/retention, soft vs hard delete, timezones, onboarding, and the
196
+ security items below). The full numbered table is in **`templates.md`**.
197
+
198
+ > **🚨 The security items are NON-NEGOTIABLE** and must be addressed in every
199
+ > project: server-side input validation & sanitization; injection prevention
200
+ > (SQL, XSS, command, path traversal); auth & authorization model; rate limiting
201
+ > on auth/public endpoints; secrets management; encryption at rest and in
202
+ > transit; infrastructure hardening; security testing. See your project's
203
+ > security coding standards (AGENTS.md) for the full standard.
204
+
205
+ ### 4.2B Zero-Ambiguity Final Verification 🚨
206
+
207
+ - [ ] `00-ambiguity-register.md` exists and is saved to disk
208
+ - [ ] Every entry has Status = `✅ Resolved` with an explicit user decision or a complete auto-design delegated record,
209
+ or a complete, explicitly user-approved `⏸ Deferred` record
210
+ - [ ] Every deferred decision is absent from executable requirements; deferred extra machinery is
211
+ absent from all RDs
212
+ - [ ] All RD decisions carry AR # back-references (only exceptions: universally obvious facts + zero-semantic-impact formatting)
213
+ - [ ] No RD contains AI-assumed defaults, inferred behaviors, or guessed specs
214
+ - [ ] The surface-during-authoring rule was followed (new ambiguities found while writing went through the register)
215
+ - [ ] In normal mode, the user reviewed and confirmed the complete register; in auto-design mode,
216
+ the register proves every delegated entry eligible and every reserved entry user-confirmed
217
+ - [ ] Every material support surface is absent or has explicit user approval in a
218
+ `Technical (complexity escalation)` entry
219
+
220
+ ### 4.3 Techdocs Update
221
+
222
+ - **If `docs/index.md` exists with `techdocs: true` frontmatter:** perform an incremental update — extract design decisions from the RDs, create ADRs for every technology/architecture choice affecting behavior, performance, or maintainability, and update architecture sections (see the techdocs skill).
223
+ - **If techdocs do NOT exist:** ask the user whether to create technical architecture documentation; if yes, run the techdocs skill using the fresh requirements as input.
224
+
225
+ ### 4.4 Roadmap Sync (RD Drafted)
226
+
227
+ After each RD is authored (and again at the end of the set):
228
+ - **If `plans/00-roadmap.md` exists:** add or sync a row for each newly drafted RD at stage `RD Drafted` (✏️); update its `Stage`, `Status`, `Last Updated`, and the header `Progress` counter, following the update-first mandate.
229
+ - **If it does NOT exist:** ask the user whether to create a roadmap. Never auto-create it silently.
230
+
231
+ See the roadmap skill for the full Roadmap Keeper protocol and stage-transition map.
232
+
233
+ ### 4.5 Final Output Summary
234
+
235
+ Present the complete set: location (`requirements/`), every document created with
236
+ a ✅, and a summary (total RDs, Must/Should/Out-of-scope counts, MVP vs full
237
+ product phases). Next step: *"To start implementing, pick an RD and run the
238
+ make-plan skill. Suggested order: RD-01 → RD-02 → …"*
239
+
240
+ ---
241
+
242
+ ## Session Management (long conversations)
243
+
244
+ Requirements gathering is long and multi-turn. RD documents and the Ambiguity
245
+ Register are **written to disk as they are completed** — never held only in
246
+ conversation memory, so they survive an interrupted session.
247
+
248
+ **Save progress and resume natively:**
249
+ - If the session is getting long or the user wants to pause, save all progress to `requirements/_draft/discovery-notes.md` (confirmed scope, selected features, open questions, stakeholder map, and which phase/step to resume from). Save any completed RDs to `requirements/` and any in-progress RD to `requirements/_draft/`.
250
+ - The user resumes later by saying "make-requirements --continue" (or "resume requirements"). On resume, read the draft notes and any existing RDs, summarize the state, and continue from the next step.
251
+
252
+ ---
253
+
254
+ ## Adapting to Project Type
255
+
256
+ Tailor discovery questions and comparable-systems analysis to the project type
257
+ (SaaS, internal tool, API/backend, library/SDK, CLI, mobile, e-commerce, CMS,
258
+ healthcare, education, fintech, …). The full mapping of project type →
259
+ comparable systems → key discovery focus is in **`discovery-phases.md`**.
260
+
261
+ ## Related Skills
262
+
263
+ - the make-plan skill — how RDs feed into implementation plans (downstream)
264
+ - the grill-me skill — deep disambiguation before requirements gathering (grill-me → make-requirements)
265
+ - the techdocs skill — technical architecture documentation from design decisions
266
+ - the upgrade-plan skill — upgrading outdated requirements (upgrade_requirements)
267
+ - the roadmap skill — sync each newly drafted RD to stage `RD Drafted`
268
+ - Read the project's AGENTS.md (or detected project conventions) for project-specific constraints
@@ -0,0 +1,255 @@
1
+ # Phase 1 (Discovery) & Phase 2 (Structuring)
2
+
3
+ > Read this during **Full Discovery** mode. Phase 1 is a multi-turn interview;
4
+ > Phase 2 turns the confirmed scope into a numbered RD structure. The
5
+ > Zero-Ambiguity Rule is active from the very first question — see
6
+ > `zero-ambiguity-gate.md`.
7
+
8
+ ---
9
+
10
+ ## Phase 1: Discovery & Domain Analysis
11
+
12
+ A **multi-turn conversation**. Ask questions in batches, wait for answers,
13
+ iterate. Never try to produce all requirements in one shot.
14
+
15
+ ### 1.1 Project Vision Interview
16
+
17
+ Start broad:
18
+
19
+ - **What is this project?** What problem does it solve? Who is it for?
20
+ - **What technology decisions are already made?** (language, framework, database, hosting)
21
+ - **What's the scale?** (number of users, data volume, deployment model)
22
+ - **Is there an existing system** this replaces or improves upon?
23
+ - **What's the timeline / urgency?** (affects MVP scoping)
24
+
25
+ ### 1.2 Stakeholder Mapping
26
+
27
+ Before features, identify ALL user types and stakeholders. For each role, explore:
28
+ what they need from the system; their daily workflow; what frustrates them about
29
+ current solutions; what permissions they should and should not have.
30
+
31
+ ```markdown
32
+ ## Identified Stakeholders
33
+
34
+ | # | Role | Description | Key Needs |
35
+ |---|------|-------------|-----------|
36
+ | 1 | [Role Name] | [Who they are] | [What they need] |
37
+ | 2 | [Role Name] | [Who they are] | [What they need] |
38
+
39
+ Does this list look complete? Are there other user types I'm missing?
40
+ ```
41
+
42
+ ### 1.3 Comparable Systems Analysis (The Secret Weapon)
43
+
44
+ **The most important sub-phase.** You MUST:
45
+
46
+ 1. **Identify comparable systems** in the domain — name them explicitly so the user can research them.
47
+ 2. **Extract relevant features** from those systems.
48
+ 3. **Present them as a selection table** — user marks each Want / Maybe / Skip.
49
+
50
+ ```markdown
51
+ ## Features From Similar Systems
52
+
53
+ Based on your description, this project has similarities to [System A], [System B],
54
+ and [System C]. Here are features from those systems that might be relevant:
55
+
56
+ ### Category: [Category Name]
57
+
58
+ | # | Feature | Description | Your Thoughts? |
59
+ |---|---------|-------------|----------------|
60
+ | X1 | **[Feature Name]** | [What it does and why it's valuable] | ☐ Want / ☐ Maybe / ☐ Skip |
61
+ | X2 | **[Feature Name]** | [What it does and why it's valuable] | ☐ Want / ☐ Maybe / ☐ Skip |
62
+ ```
63
+
64
+ **Rules:**
65
+ - Always name the comparable systems.
66
+ - Group features by domain area, not by source system.
67
+ - **Include features the user did NOT mention** — that's the whole point.
68
+ - Present only the most relevant gaps first: normally 2–5 features in each relevant category.
69
+ Expand a category when the user asks or the domain evidence shows a material omission. Do not
70
+ fill a quota.
71
+ - Include the rationale for why each feature might be relevant.
72
+ - Treat every extracted feature as optional until the user chooses `Want`; comparable systems are
73
+ evidence for discovery, not authority to enlarge this product.
74
+ - If an optional candidate may require material support machinery, add a short possible-cost note
75
+ to its description and batch it with related candidates. Do not run the full Complexity
76
+ Escalation Gate while it is still `Maybe` or unselected. Run the gate only after the user chooses
77
+ `Want` or otherwise confirms the candidate in scope, and before it becomes executable.
78
+
79
+ ### 1.4 User Journey Walkthroughs
80
+
81
+ For each key user type (from 1.2), walk through their complete journey as a narrative:
82
+
83
+ ```
84
+ "A [Role] wants to [goal]. They start by [action]. The system shows [what].
85
+ They then [action]. At this point, they need to [requirement]. But wait —
86
+ what if [edge case]? This may need [candidate requirement]. Should it be in scope?"
87
+ ```
88
+
89
+ This surfaces requirements that fall between the cracks of isolated feature
90
+ discussions. Present discovered requirements to the user for confirmation.
91
+
92
+ ### 1.5 "What Happens When..." Scenarios
93
+
94
+ Proactively explore failure modes and edge cases:
95
+
96
+ ```markdown
97
+ ## Edge Case Scenarios
98
+
99
+ | # | Scenario | Question | Impact if Not Handled |
100
+ |---|----------|----------|----------------------|
101
+ | 1 | [What if X fails?] | [Specific question] | [Consequence] |
102
+ | 2 | [What if user does Y?] | [Specific question] | [Consequence] |
103
+ ```
104
+
105
+ Common scenarios to explore:
106
+ - What happens when a key entity is deleted but has references?
107
+ - What happens when a user's role or access changes mid-workflow?
108
+ - What happens when the system is unavailable during a critical process?
109
+ - What happens when data volumes exceed initial expectations?
110
+ - What happens when users try to abuse or game the system?
111
+ - What happens when requirements conflict between user types?
112
+
113
+ ### 1.6 Scope Confirmation
114
+
115
+ After all discovery, present a summary for confirmation:
116
+
117
+ ```markdown
118
+ ## Scope Confirmation
119
+
120
+ **Project:** [Name]
121
+ **Type:** [SaaS / Internal Tool / Library / etc.]
122
+ **Tech Stack:** [Confirmed technologies]
123
+
124
+ **What's IN scope (confirmed):**
125
+ - [Feature/capability 1]
126
+
127
+ **What's MAYBE in scope (needs decision):**
128
+ - [Feature] — [open question]
129
+
130
+ **What's OUT of scope (explicitly excluded):**
131
+ - [Feature/capability] — [reason]
132
+
133
+ **Key Decisions Made:**
134
+ | Decision | Chosen | Rationale |
135
+ |----------|--------|-----------|
136
+ | [Decision] | [Choice] | [Why] |
137
+
138
+ **Open Questions (to resolve during RD authoring):**
139
+ 1. [Question]
140
+
141
+ Please confirm or adjust before I create the requirement documents.
142
+ ```
143
+
144
+ ---
145
+
146
+ ## Phase 2: Structuring
147
+
148
+ ### 2.1 Domain Glossary
149
+
150
+ Establish shared vocabulary before writing any RD:
151
+
152
+ ```markdown
153
+ ## Domain Glossary
154
+
155
+ | Term | Definition | Notes |
156
+ |------|-----------|-------|
157
+ | [Term] | [Precise definition as used in this project] | [Disambiguation if needed] |
158
+ ```
159
+
160
+ Define every domain-specific term that could be ambiguous; note where your
161
+ project's definition differs from common usage. The glossary goes into
162
+ `requirements/README.md` and is referenced by all RDs.
163
+
164
+ ### 2.2 Decomposition into Requirement Documents
165
+
166
+ Break the confirmed scope into numbered RDs.
167
+
168
+ **Decomposition heuristics:**
169
+ - Start with the smallest set of independently useful, testable RDs that covers confirmed scope.
170
+ - Fold project setup, toolchain, and ordinary tests into the first owning RD unless they are an
171
+ independently deliverable workstream.
172
+ - Give a data layer, cross-cutting concern, integration, UI area, or domain module its own RD only
173
+ when its behavior and acceptance criteria form a coherent contract. Otherwise keep it with the
174
+ feature that owns it.
175
+ - Put cross-cutting non-functional requirements in a dedicated RD only when several features share
176
+ one measurable contract. Keep local performance, security, accessibility, availability, and
177
+ operations criteria in their owning RDs.
178
+ - Order the resulting RDs by real dependency. Do not create scaffolding, deployment, monitoring,
179
+ or other support work only to match a standard document sequence.
180
+
181
+ **Sizing guidance:**
182
+ RD count follows the confirmed behavior and coherent document boundaries. It is not a target. If
183
+ one RD can state the behavior clearly and remain reviewable, do not split it to satisfy a template.
184
+
185
+ ### 2.3 Dependency Graph
186
+
187
+ Map dependencies between RDs as a table and a text tree:
188
+
189
+ ```markdown
190
+ ## Dependency Graph
191
+
192
+ | # | Document | Depends On |
193
+ |---|----------|------------|
194
+ | RD-01 | [Name] | — |
195
+ | RD-02 | [Name] | RD-01 |
196
+ | RD-03 | [Name] | RD-01, RD-02 |
197
+
198
+ ## Visual
199
+
200
+ RD-01 (Foundation)
201
+ │
202
+ ├── RD-02 (Data Layer)
203
+ │ ├── RD-03 (Core Module A)
204
+ │ └── RD-04 (Core Module B)
205
+ └── RD-05 (Cross-cutting)
206
+ ```
207
+
208
+ ### 2.4 MVP vs. Full Vision Phasing
209
+
210
+ For each feature group, explicitly separate MVP from full product:
211
+
212
+ ```markdown
213
+ ## Implementation Phases
214
+
215
+ | Phase | RD Documents | Description | Priority |
216
+ |-------|-------------|-------------|----------|
217
+ | **A: MVP** | RD-01 → RD-04 | Core functionality, minimum viable product | Must Have |
218
+ | **B: Enhanced** | RD-05 → RD-08 | Important features, post-MVP | Should Have |
219
+ | **C: Full Product** | RD-09 → RD-12 | Nice-to-have, future iterations | Could Have |
220
+ ```
221
+
222
+ ### 2.5 Integration Map
223
+
224
+ If external integrations exist:
225
+
226
+ ```markdown
227
+ ## External Integrations
228
+
229
+ | Integration | Protocol | Direction | RD Document |
230
+ |------------|----------|-----------|-------------|
231
+ | [System] | [REST/OIDC/SMTP/etc.] | [Inbound/Outbound/Both] | RD-XX |
232
+ ```
233
+
234
+ After Phase 2 is complete, proceed to the **Zero-Ambiguity Gate**
235
+ (`zero-ambiguity-gate.md`) before authoring any RD.
236
+
237
+ ---
238
+
239
+ ## Adapting to Project Type
240
+
241
+ Tailor discovery questions and comparable-systems analysis to the project type:
242
+
243
+ | Project Type | Comparable Systems to Explore | Key Discovery Focus |
244
+ |---|---|---|
245
+ | **SaaS / Web App** | Competing SaaS products, similar industry tools | Multi-tenancy, billing, user management, onboarding |
246
+ | **Internal Tool** | Enterprise tools (Jira, Confluence, etc.) | Workflow automation, integrations, permissions |
247
+ | **API / Backend** | Public APIs in the space, developer platforms | Versioning, rate limiting, auth, documentation |
248
+ | **Library / SDK** | Similar open-source libraries | API design, backward compatibility, bundle size |
249
+ | **CLI Tool** | Similar CLI tools (kubectl, gh, etc.) | Command structure, output formats, configuration |
250
+ | **Mobile App** | Competing mobile apps | Offline support, push notifications, device features |
251
+ | **E-commerce** | Shopify, WooCommerce, Stripe | Catalog, cart, checkout, inventory, payments |
252
+ | **CMS / Content** | WordPress, Strapi, Contentful | Content modeling, publishing workflow, media management |
253
+ | **Healthcare** | Epic, Cerner, HIPAA-compliant tools | Compliance, audit trails, consent management |
254
+ | **Education** | Canvas, Moodle, SONA | Enrollment, grading, scheduling, accessibility |
255
+ | **FinTech** | Stripe, Plaid, banking APIs | Regulatory compliance, transaction safety, reconciliation |
@@ -0,0 +1,73 @@
1
+ # add_requirement & review_requirements Protocols
2
+
3
+ > Read this when the user is in **Add One RD** or **Health Check** mode (see
4
+ > Step 0 in SKILL.md). Both operate on an existing `requirements/` set and reuse
5
+ > the gate (`zero-ambiguity-gate.md`) and templates (`templates.md`).
6
+
7
+ ---
8
+
9
+ ## add_requirement Protocol
10
+
11
+ Triggered by "add_requirement", "add a feature/RD", "I also need …" when a
12
+ `requirements/` set already exists.
13
+
14
+ 1. Read `requirements/README.md` to understand the current set.
15
+ 2. Ask the user: *"What new capability or feature do you want to add?"*
16
+ 3. Run a **condensed discovery** for just this feature — comparable-systems analysis and edge-case scenarios (see `discovery-phases.md` §1.3 and §1.5).
17
+ 4. **🚨 Run the Zero-Ambiguity Gate for this new RD.** Compile an Ambiguity Register scoped to
18
+ just this feature and resolve every item. In normal mode, resolve material items with the user.
19
+ With active auto-design, resolve eligible technical items under the shared policy and escalate
20
+ reserved items. **Append** new AR entries to the existing
21
+ `requirements/00-ambiguity-register.md` (create it if it doesn't exist). All gate rules apply:
22
+ no silent deferrals, unauthorized delegation, or guesswork. See `zero-ambiguity-gate.md`.
23
+ 5. Determine where in the dependency graph the new RD fits.
24
+ 6. Assign the next available RD number.
25
+ 7. Write the new RD following the universal template, with AR # traceability (see `templates.md` §3.3).
26
+ 8. Update `requirements/README.md`:
27
+ - Add it to the document index.
28
+ - Update the dependency graph.
29
+ - Update implementation phases if affected.
30
+ 9. Run cross-reference validation against the existing RDs (see SKILL.md Phase 4.1).
31
+ 10. Sync the roadmap if one exists (SKILL.md Phase 4.4).
32
+
33
+ ---
34
+
35
+ ## review_requirements Protocol
36
+
37
+ Triggered by "review_requirements", "check my requirements", "what's
38
+ missing/inconsistent" when a `requirements/` set exists. Produces a diagnostic
39
+ report — it does NOT modify the RDs unless the user then asks.
40
+
41
+ 1. Read all documents in `requirements/`.
42
+ 2. Run these checks:
43
+ - **Completeness** — every "Must Have" has acceptance criteria (and they meet the specificity rules in `templates.md` §3.4B).
44
+ - **Consistency** — no contradictions between RDs.
45
+ - **Coverage** — run the "Did You Consider…" checklist (`templates.md`).
46
+ - **Dependencies** — no circular dependencies; all references valid.
47
+ - **Scope creep** — "Should Have" items that should be "Won't Have".
48
+ - **Orphans** — features mentioned but not owned by any RD.
49
+ - **Traceability** — decisions in RDs back-reference AR # entries; the register exists and is fully resolved.
50
+ 3. Produce a diagnostic report:
51
+
52
+ ```markdown
53
+ ## Requirements Health Check: [Project Name]
54
+
55
+ **Documents Analyzed:** X RDs
56
+ **Date:** [Date]
57
+
58
+ ### ✅ Passing
59
+ - [Check that passed]
60
+
61
+ ### ⚠️ Warnings
62
+ - [Minor issue — recommendation]
63
+
64
+ ### ❌ Issues Found
65
+ - [Serious gap or inconsistency — action required]
66
+
67
+ ### Suggestions
68
+ - [Improvement opportunity]
69
+ ```
70
+
71
+ After presenting the report, offer to fix the issues found — e.g. via
72
+ add_requirement for missing coverage, or by revising specific RDs (each revision
73
+ that introduces a new decision must go through the Zero-Ambiguity Gate).