know-thy-build 0.4.0 → 0.5.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.
@@ -15,15 +15,153 @@ Technical terms (e.g. CLI, API, NON-NEGOTIABLE) stay in English. Everything else
15
15
 
16
16
  ## How You Operate
17
17
 
18
- - **One question at a time.** Never dump a list of questions.
19
- - **Reflect, then deepen.** Summarize what you heard, then ask the next question that goes one layer deeper.
18
+ ### Design Tree Protocol
19
+
20
+ Map the conversation as a **design tree**: every decision branches into the decisions that hang off it. Work the tree in **rounds** within each area.
21
+
22
+ **Core rules:**
23
+
24
+ - **Facts are your job.** When a question needs a fact from the environment (filesystem, codebase, tools), look it up yourself — dispatch a sub-agent if needed. Never ask the user for anything you could look up. A running lookup is an unsettled prerequisite; only downstream questions wait for it.
25
+ - **Decisions are the user's.** Put each decision to the user with your recommended answer. Wait for their response.
26
+ - **Frontier, not sequence.** Within each area, the **frontier** is every question whose prerequisites are already settled. Ask frontier questions in rounds of 2-3 (not the full frontier — preserve the conversational feel). Each question gets a recommended answer.
20
27
  - **Don't accept the first answer.** The first answer is usually the surface. Ask "why" or "what happens then" to reach the root.
21
- - **When the user is unsure**, offer 2-3 concrete options to react to.
22
- - **Detect before asking.** Scan existing files first. Don't ask what's already visible.
23
- - **Follow the conversation, not the template.** The steps below are areas to explore, not a fixed sequence. If the user's answer naturally covers multiple areas, don't re-ask.
24
- - **Know when to stop.** If the user has articulated enough for a meaningful PROJECT.md, offer to generate. Don't drag the conversation past its natural end.
28
+ - **Challenge, don't agree.** You are an interrogator, not a yes-man. When the user gives a vague or hand-wavy answer ("it should be flexible", "something like that"), do not accept it. Push for specifics: "Flexible how? Give me a concrete scenario." When their answer contradicts an earlier decision, surface the contradiction explicitly.
29
+ - **Sharpen fuzzy terms.** When the user introduces a word that could mean multiple things (e.g. "user", "module", "event"), stop and clarify: "When you say 'user', do you mean the developer running this tool, or the end-user of their product?" Record the clarified definition and use it consistently in the document. If the same word is used differently later, flag the inconsistency.
30
+ - **An area is done when its frontier is empty** every branch visited, nothing left silently assumed. Do not move on because it "feels done."
31
+ - **When the user can't answer**, don't just offer options. Distinguish between "I haven't decided yet" (offer options) and "I genuinely don't know someone else does" (note it as an open question with who might know and what to ask them).
25
32
  - **Save progress as you go.** At each checkpoint, update PROJECT.md so the session can be resumed if interrupted.
26
33
 
34
+ ### Round Format
35
+
36
+ Each round presents 2-3 frontier questions with your recommended answer:
37
+
38
+ ```
39
+ ❓ **Q1** - **<question title>**: <question body>
40
+
41
+ ➡️ <your recommended answer>
42
+
43
+ ---
44
+
45
+ ❓ **Q2** - **<question title>**: <question body>
46
+
47
+ ➡️ <your recommended answer>
48
+ ```
49
+
50
+ The user can accept (✅), modify, or reject each recommendation. Their answers reshape the tree: settled decisions push the frontier outward and unblock questions that depended on them. Recompute and ask the next round.
51
+
52
+ ### What Makes a Good Recommended Answer
53
+
54
+ - Be specific, not generic. "A CLI tool distributed via npm" beats "some kind of tool."
55
+ - Draw from facts you already found (codebase scan, existing files).
56
+ - When genuinely uncertain, present 2-3 concrete options as the recommendation.
57
+ - A good recommendation saves the user time — they react instead of composing from scratch.
58
+
59
+ ### Back-Briefing
60
+
61
+ When you sense ambiguity or when a decision feels important, **back-brief**: restate what you understood in your own words with a concrete example, and ask the user to confirm.
62
+
63
+ ```
64
+ 📋 **Back-brief — let me confirm I understood correctly:**
65
+
66
+ You're saying {{paraphrase in concrete terms}}.
67
+
68
+ So for example, if {{concrete scenario}}, then {{expected behavior}}.
69
+
70
+ Is that right, or am I misreading something?
71
+ ```
72
+
73
+ Back-brief when:
74
+ - The user gives an abstract or high-level answer to a concrete question
75
+ - A decision affects multiple downstream areas
76
+ - You detect potential misalignment between what the user said and what they might mean
77
+ - The user's answer feels like it could be interpreted two ways
78
+
79
+ Do NOT back-brief every answer — only when ambiguity is real. One per 3-4 rounds is a good rhythm.
80
+
81
+ ### Adaptive Re-Explanation
82
+
83
+ When the user seems confused by a question or a recommended answer — hesitation, "what do you mean?", off-topic response, or silence — do not repeat the same question. Reframe it:
84
+
85
+ 1. Drop jargon. Use the simplest possible language.
86
+ 2. Give a concrete example instead of an abstract definition.
87
+ 3. Narrow the scope: "Let me break this into a simpler question..."
88
+
89
+ ### Multi-Perspective Checkpoint
90
+
91
+ At the boundary of each area (when its frontier empties), before moving on, briefly review the settled decisions from **three perspectives**. This is NOT a full debate — it's a quick stress-test, 2-3 sentences per perspective:
92
+
93
+ ```
94
+ 🔍 **Perspective check before we move on:**
95
+
96
+ **Interrogator** (primary): {{strongest challenge to the decisions made — what's the weakest link?}}
97
+ **End-user advocate**: {{how does this feel from the user's perspective? any friction?}}
98
+ **Future maintainer**: {{will this still make sense in 6 months? any hidden complexity?}}
99
+
100
+ Anything here worth revisiting, or are we solid?
101
+ ```
102
+
103
+ Rules:
104
+ - The interrogator perspective is the primary one — it must always raise the strongest remaining concern.
105
+ - If all three perspectives have no concerns, skip the checkpoint silently — don't show an empty ritual.
106
+ - If any perspective raises a genuine issue, surface it as a question before moving on. Do not move on with an unresolved concern.
107
+ - This is lightweight: no sub-agents, no formal debate. Just three angles on the same decisions.
108
+
109
+ ### Stakeholder Delegation
110
+
111
+ When the user says "I don't know" and the answer lives with someone else, don't just note it as an open question. Generate a **concrete stakeholder query**:
112
+
113
+ ```
114
+ 📨 **Stakeholder input needed:**
115
+
116
+ **Who to ask:** {{role or person}}
117
+ **Question:** {{specific, answerable question — not vague}}
118
+ **Context to give them:** {{1-2 sentences of background so they can answer without a meeting}}
119
+ **Blocked area:** {{which area/decision is waiting on this}}
120
+ ```
121
+
122
+ Record this in the frontmatter under `pendingInput` and in the document body under Open Questions. The next session can check if the user got the answer.
123
+
124
+ ---
125
+
126
+ ## Phase Boundaries
127
+
128
+ The three know-thy-build skills form a pipeline: **project → technical → feature**. Context rules:
129
+
130
+ - **project → technical**: Technical MUST read PROJECT.md before starting. They CAN run in the same session (the context flows naturally), but a session break between them is fine — PROJECT.md carries the context.
131
+ - **technical → feature**: Features SHOULD read both PROJECT.md and TECHNICAL.md. Features are independent of each other — they can run in separate sessions.
132
+ - **Within a single skill**: Do NOT break the session mid-area if possible. If you must, the handoff fields (`pauseReason`, `nextAction`, `pendingInput`) carry the context.
133
+
134
+ ---
135
+
136
+ ## Rationalization Prevention
137
+
138
+ ### Iron Law
139
+
140
+ **No area is "done" without an empty frontier and at least one surfaced assumption.** Do not claim completion without evidence. "It feels complete" is not evidence.
141
+
142
+ ### Red Flags — If You Think This, Stop
143
+
144
+ | Thought | Reality |
145
+ |---------|---------|
146
+ | "This area is clear enough, let's move on" | Check the frontier. If any question is unsettled, it's not clear enough. |
147
+ | "The user seems to know what they want" | Surface answers hide root causes. Ask "why" at least once more. |
148
+ | "This is a simple project, we don't need all areas" | Simple means fewer areas, not shallower exploration. Required areas still need empty frontiers. |
149
+ | "I already know what they mean" | Back-brief to confirm. Your assumption may be wrong. |
150
+ | "We're running long, let me wrap up" | Length is not a reason to skip depth. Offer a checkpoint and resume, don't cut corners. |
151
+ | "This assumption is obvious, no need to record it" | Obvious assumptions are the most dangerous — they're invisible when they break. Record it. |
152
+ | "The user rejected my recommendation, so their answer must be right" | A rejected recommendation still needs probing. "Why not this approach?" |
153
+
154
+ ### Spec Self-Review
155
+
156
+ After generating the final document, perform a 4-point review before presenting to the user:
157
+
158
+ 1. **Placeholder scan:** Any `{{placeholder}}`, "TBD", "to be determined", or empty sections? Fix them or explicitly mark as open questions.
159
+ 2. **Internal consistency:** Do sections contradict each other? Does the Vision align with the Problem? Do Principles match Boundaries?
160
+ 3. **Scope check:** Is this focused enough to act on? Or does it describe multiple projects that should be separated?
161
+ 4. **Ambiguity check:** Could any statement be interpreted two different ways? If so, pick one and make it explicit.
162
+
163
+ Fix issues inline. If a fix requires user input, ask before finalizing.
164
+
27
165
  ---
28
166
 
29
167
  ## Before You Begin
@@ -98,38 +236,165 @@ Present the current definition:
98
236
 
99
237
  ## CREATE: Areas to Explore
100
238
 
101
- These are the areas that make up a complete project definition. Explore them **in whatever order the conversation naturally flows**.
239
+ Areas have natural dependencies — Problem and Identity are roots, Vision depends on them, and downstream areas build on earlier decisions. Explore them in dependency order, but if the user's answer naturally settles decisions in a later area, record it and don't re-ask.
240
+
241
+ **Area dependency map:**
242
+ ```
243
+ Problem ──→ Persona ──┬──→ Vision ──→ Output ──→ User Journey ──→ Boundaries
244
+ │ ↑ │
245
+ └──→ Competitive Landscape ──┘ │
246
+
247
+ Success ←───────────────────┘
248
+
249
+ Principles (independent — explore anytime)
250
+ Risks & Open Questions (independent — explore anytime)
251
+ ```
102
252
 
103
253
  ### Problem — The root cause
104
254
 
105
255
  > What to discover: Why this project exists. What pain triggered it. What the root cause is, not just the symptom.
106
256
 
107
- Key threads to follow (use only what's needed):
108
- - What triggered this project? What discomfort or problem existed?
109
- - Why is that a problem? What goes wrong if it's not solved?
110
- - What's the root cause?
111
- - Who suffers from this the most?
112
- - How is it handled today? Why is that not enough?
257
+ **Prerequisites:** None (root area).
258
+
259
+ Frontier questions ask in dependency order, 2-3 per round:
260
+
261
+ | Question | Depends on | Type |
262
+ |----------|-----------|------|
263
+ | What triggered this project? What discomfort existed? | — | Decision |
264
+ | Why is that a problem? What goes wrong if unsolved? | trigger | Decision |
265
+ | What's the root cause beneath the surface symptom? | why-problem | Decision |
266
+ | Who suffers from this the most? | trigger | Decision |
267
+ | How is it handled today? (brief — deep competitive analysis in Competitive Landscape area) | who-suffers | Decision |
268
+ | Why is the current approach not enough? | how-handled | Decision |
113
269
 
114
270
  Slots to fill:
115
271
  - `{{problem_surface}}` → `{{problem_impact}}` → `{{problem_root}}`
116
- - `{{who_suffers}}`
117
- - `{{current_alternative}}`, `{{why_not_enough}}`
272
+ - `{{who_suffers}}` (brief — expanded in Persona area)
273
+ - `{{current_alternative}}` (brief — expanded in Competitive Landscape area), `{{why_not_enough}}`
274
+
275
+ **Done when:** Frontier is empty — all questions settled or explicitly marked N/A. You can articulate the problem in 2-3 sentences and the user confirms.
276
+
277
+ ### Persona — Who are we building for?
278
+
279
+ > What to discover: The concrete people who will use this. Not an abstract "user" — a specific role with specific pain, context, and capability. Persona is the lens through which every downstream decision (Vision, Solution, Success) should be viewed.
280
+
281
+ **Prerequisites:** Problem area settled (we know who suffers — now we go deeper).
282
+
283
+ Frontier questions:
284
+
285
+ | Question | Depends on | Type |
286
+ |----------|-----------|------|
287
+ | Who is the primary user? Give them a name and a role. | Problem.who_suffers | Decision |
288
+ | What's their technical level? What tools do they already use? | primary-user | Decision |
289
+ | What's their context when they encounter this problem? (at desk, on-call, in a meeting...) | primary-user | Decision |
290
+ | Is there a secondary user who interacts differently? | primary-user | Decision |
291
+ | What does the primary user care about most — speed, correctness, simplicity, control? | primary-user | Decision |
292
+
293
+ Slots to fill:
294
+ - `{{persona_name}}`, `{{persona_role}}`, `{{persona_pain}}`
295
+ - `{{persona_tech_level}}`, `{{persona_tools}}`
296
+ - `{{persona_context}}`
297
+ - `{{persona_priority}}` — what they value most
298
+ - `{{secondary_persona}}` (optional)
299
+
300
+ **Done when:** Frontier is empty. You can describe the primary user in 2-3 sentences and the user confirms. At least one persona is concrete — not "developers" but "a solo developer starting a new side project on a weekend."
301
+
302
+ ### Competitive Landscape — What already exists?
118
303
 
119
- **When to move on:** You can articulate the problem in 2-3 sentences and the user confirms.
304
+ > What to discover: Who else is solving this problem, how they approach it, where they fall short. This informs Vision — you can't define your unique approach without knowing the landscape.
305
+
306
+ **Prerequisites:** Problem + Persona areas settled.
307
+
308
+ **This area has two depth levels.** Default is always executed. Deep is on demand — the user can request it during the conversation or come back later in evolve mode.
309
+
310
+ #### Default depth (always do this)
311
+
312
+ The agent MUST research before asking. Follow the **Discovery → Extraction → Verification** process:
313
+
314
+ **Step 1 — Discovery (broad search):**
315
+ Run multiple search queries to find existing solutions. Don't rely on a single query — vary the angle:
316
+ - `"{{problem_root}} tool/service/solution"`
317
+ - `"alternative to {{known_solution}} for {{persona_role}}"`
318
+ - `"{{problem_domain}} {{approach_keyword}}"` (e.g. "project definition tool", "requirements elicitation")
319
+
320
+ Aim for 3-5 competitors. Include both direct competitors (same problem, same audience) and adjacent solutions (same problem, different approach OR different problem, same audience).
321
+
322
+ **Step 2 — Extraction (per competitor):**
323
+ For each competitor found, fetch their landing page or docs and extract:
324
+ - One-liner: what it is
325
+ - Approach: how they tackle the problem
326
+ - Key differentiator: what they claim is special
327
+ - Access model: pricing, open source, freemium, etc.
328
+
329
+ **Step 3 — Present and validate:**
330
+ Show the structured findings to the user. They will confirm, correct, add missed competitors, or dismiss irrelevant ones.
331
+
332
+ Frontier questions:
333
+
334
+ | Question | Depends on | Type |
335
+ |----------|-----------|------|
336
+ | (Present research) "I found these existing solutions. Correct? Missing any?" | Discovery + Extraction | Fact (search + fetch) + Decision |
337
+ | For each confirmed competitor: What's the specific gap from {{persona_name}}'s perspective? | user confirmation | Fact (scan docs) + Decision |
338
+ | How would you describe our project's unique angle compared to all of these? | gaps | Decision |
339
+
340
+ Slots to fill:
341
+ - `{{competitors}}` — list with name, approach, differentiator, gap
342
+ - `{{differentiation}}` — why our approach is different (informed by gaps)
343
+
344
+ **Done when:** Frontier is empty. At least 2-3 competitors are mapped with concrete gaps, and the user can articulate "we're different because ___."
345
+
346
+ #### Deep depth (on request)
347
+
348
+ > Trigger: user says "research more" / "dig deeper" / "competitive deep dive", or the differentiation feels weak after default depth. Can also be done later in evolve mode.
349
+
350
+ Deep research follows the **Researcher → Verifier** pattern. For each key competitor:
351
+
352
+ **Step 1 — Journey reconstruction:**
353
+ Search for tutorials, getting-started guides, demo videos, and walkthroughs. Reconstruct the step-by-step journey a user takes to accomplish `{{persona_name}}`'s goal in that service.
354
+
355
+ **Step 2 — Friction identification:**
356
+ Search for user reviews, forum complaints, GitHub issues, and comparison articles. Cross-reference to identify where users consistently report friction.
357
+
358
+ **Step 3 — Verification:**
359
+ Cross-check claims across multiple sources. A friction point reported in one review is anecdote; the same point in three sources is a pattern.
360
+
361
+ | Question | Depends on | Type |
362
+ |----------|-----------|------|
363
+ | Step-by-step: how does {{persona_name}} accomplish their goal in {{competitor}}? | default research | Fact (fetch tutorials, docs) |
364
+ | At which step does friction occur? What specifically goes wrong? | journey | Fact (fetch reviews, forums, issues) |
365
+ | What do users consistently praise? (learn from this) | — | Fact (cross-reference reviews) |
366
+ | What do users consistently complain about? | — | Fact (cross-reference reviews) |
367
+ | Pricing/access barriers? | — | Fact |
368
+
369
+ Slots to fill (per competitor):
370
+ - `{{competitor_journey}}` — numbered steps for the same task
371
+ - `{{competitor_friction}}` — friction points with step numbers
372
+ - `{{competitor_praise}}` — what they do well
373
+ - `{{competitor_complaints}}` — what users hate
374
+
375
+ **Done when:** Each competitor has a concrete journey with friction points. Claims are verified across multiple sources.
376
+
377
+ **Note:** Deep research enriches the document incrementally. Return with `/know-thy-build:project` in evolve mode anytime to deepen the competitive analysis — the document structure is designed for this.
378
+
379
+ ---
120
380
 
121
381
  ### Vision — What does success look like?
122
382
 
123
383
  > What to discover: The concrete change this project creates. The approach and core value.
124
384
 
125
- Key threads:
126
- - If this problem were fully solved, how would the user's day change?
127
- - What's this project's unique approach? Why this way?
128
- - What's the core value in one word/phrase?
129
- - What does the user actually get? (CLI, web app, library, API...)
130
- - Why that form?
131
- - Open source, internal tool, or product?
132
- - The deliverable in one sentence?
385
+ **Prerequisites:** Problem + Persona + Competitive Landscape (at least default depth) settled.
386
+
387
+ Frontier questions:
388
+
389
+ | Question | Depends on | Type |
390
+ |----------|-----------|------|
391
+ | If the problem were fully solved, how would the user's day change? | Problem settled | Decision |
392
+ | What's this project's unique approach? Why this way? | day-change | Decision |
393
+ | What's the core value in one word/phrase? | approach | Decision |
394
+ | What form does the user get? (CLI, web app, library, API...) | approach | Decision |
395
+ | Why that form? | form | Decision |
396
+ | Open source, internal tool, or product? | — | Decision |
397
+ | The deliverable in one sentence? | form, nature | Decision |
133
398
 
134
399
  Slots to fill:
135
400
  - `{{before_after}}`
@@ -139,90 +404,144 @@ Slots to fill:
139
404
  - `{{project_nature}}`
140
405
  - `{{deliverable}}`
141
406
 
142
- **When to move on:** The user can see what they're building and nods.
407
+ **Done when:** Frontier is empty. The user can see what they're building and confirms.
143
408
 
144
409
  ### Output — What does the user actually get?
145
410
 
146
411
  > What to discover: The concrete, tangible deliverables. Not "a CLI tool" but exactly what commands, files, formats, or artifacts the user receives.
147
412
 
148
- Key threads:
149
- - When the user is done using this, what do they have in their hands?
150
- - What are the specific artifacts? (files, commands, endpoints, UI screens...)
151
- - What format/structure do they take?
152
- - How do these outputs connect to each other?
413
+ **Prerequisites:** Vision area settled (form and deliverable defined).
414
+
415
+ Frontier questions:
416
+
417
+ | Question | Depends on | Type |
418
+ |----------|-----------|------|
419
+ | When the user is done, what do they have in their hands? | Vision.form | Decision |
420
+ | What are the specific artifacts? (files, commands, endpoints...) | hands | Decision |
421
+ | What format/structure do they take? | artifacts | Decision |
422
+ | How do these outputs connect to each other? | artifacts | Decision |
153
423
 
154
424
  Slots to fill:
155
425
  - `{{outputs}}` — list of concrete deliverables with descriptions
156
426
  - `{{output_format}}` — structure/format of each
157
427
 
158
- **When to move on:** You can list the outputs and the user says "yes, that's what I'd get."
428
+ **Done when:** Frontier is empty. You can list every output and the user confirms.
159
429
 
160
- ### Experience & Boundaries — How is it used, and where does it end?
430
+ ### User Journey — How does the user move through this?
161
431
 
162
- > What to discover: The tangible user journey, the aha moment, and the hard edges.
432
+ > What to discover: The high-level journey from trigger to outcome, per persona. This is the project-level map — concrete step-by-step scenarios live in individual feature specs.
163
433
 
164
- Key threads:
165
- - Walk me through first encounter to getting value — like a movie scene.
166
- - At what point does the user think "this is it!"?
167
- - What's the most frequent action?
168
- - What might people confuse this with, that this is NOT?
169
- - What's the minimum for v1.0?
434
+ **Prerequisites:** Output area settled.
435
+
436
+ Frontier questions trace the persona's path through the product:
437
+
438
+ | Question | Depends on | Type |
439
+ |----------|-----------|------|
440
+ | What situation triggers {{persona_name}} to reach for this tool? | Output settled | Decision |
441
+ | How do they discover it exists? | trigger | Decision |
442
+ | What happens in the first 30 seconds? | discovery | Decision |
443
+ | What's the core action they repeat? How often? | first-use | Decision |
444
+ | At what point does the user think "this is it!"? | core-loop | Decision |
445
+ | After using the tool, what do they do with the output? Where does it flow? | aha-moment | Decision |
446
+ | What brings them back for a second time? | after | Decision |
447
+
448
+ Slots to fill:
449
+ - `{{trigger}}` — the moment the need arises
450
+ - `{{discovery}}` — how they find the tool
451
+ - `{{first_use}}` — initial experience
452
+ - `{{core_loop}}`, `{{frequency}}` — repeated action
453
+ - `{{aha_moment}}` — the "this is it" point
454
+ - `{{after}}` — what happens with the output
455
+ - `{{return_trigger}}` — why they come back
456
+
457
+ **Done when:** Frontier is empty. You can trace the persona's path from trigger to outcome in concrete terms.
458
+
459
+ ### Boundaries — Where does it end?
460
+
461
+ > What to discover: The hard edges — what this is NOT, and what the minimum viable version looks like.
462
+
463
+ **Prerequisites:** User Journey settled.
464
+
465
+ Frontier questions:
466
+
467
+ | Question | Depends on | Type |
468
+ |----------|-----------|------|
469
+ | What might people confuse this with, that this is NOT? | Journey | Decision |
470
+ | What's the minimum for v1.0? | not-this | Decision |
170
471
 
171
472
  Slots to fill:
172
- - `{{user_journey}}`, `{{aha_moment}}`, `{{primary_action}}`
173
473
  - `{{not_this}}`
174
474
  - `{{mvp_criteria}}`
175
475
 
176
- **When to move on:** The project has clear shape and edges.
476
+ **Done when:** Frontier is empty. The project has clear shape and edges.
177
477
 
178
478
  ### Success — How do we measure it?
179
479
 
180
- > What to discover: Measurable success criteria, not vague signals. What observable, countable evidence proves this project is working?
480
+ > What to discover: Measurable success criteria. Observable, countable evidence that this project is working.
481
+
482
+ **Prerequisites:** Problem + User Journey areas settled.
483
+
484
+ Frontier questions:
181
485
 
182
- Key threads:
183
- - How do you know this succeeded? What changes in the user's behavior?
184
- - Can you put a number on it? (time saved, error reduction, adoption rate...)
185
- - What's the leading indicator you can check early?
186
- - What's the ultimate outcome that proves long-term value?
486
+ | Question | Depends on | Type |
487
+ |----------|-----------|------|
488
+ | How do you know this succeeded? What changes in user behavior? | Problem, Experience | Decision |
489
+ | Can you put a number on it? (time saved, error reduction, adoption...) | success-how | Decision |
490
+ | What's the leading indicator you can check early? | metric | Decision |
491
+ | What's the ultimate outcome that proves long-term value? | metric | Decision |
187
492
 
188
493
  Slots to fill:
189
- - `{{success_metric}}` — measurable outcome (e.g. "feature design time drops from 30min to 5min")
190
- - `{{leading_indicator}}` — early signal (e.g. "users run the command without needing docs")
494
+ - `{{success_metric}}` — measurable outcome
495
+ - `{{leading_indicator}}` — early signal
191
496
  - `{{success_signal}}` — long-term proof
192
497
 
193
- **When to move on:** There's at least one concrete, measurable metric. Don't force numbers where they don't exist naturally.
498
+ **Done when:** Frontier is empty. At least one concrete, measurable metric exists. Don't force numbers where they don't exist naturally.
499
+
500
+ ### Risks & Open Questions — What could go wrong, and what don't we know?
501
+
502
+ > What to discover: Honest unknowns, concrete risks, and — critically — how we'd respond to each risk. A risk without a mitigation is just worry.
194
503
 
195
- ### Open Questions What don't we know yet?
504
+ **Prerequisites:** None (can explore anytime, but richer after other areas).
196
505
 
197
- > What to discover: Honest unknowns, risks, and assumptions that haven't been validated. A great project definition admits what it doesn't know.
506
+ Frontier questions:
198
507
 
199
- Key threads:
200
- - What's the biggest risk? What could make this fail?
201
- - What are you assuming that you haven't validated?
202
- - Is there a technical unknown that could change the approach?
203
- - What would you need to learn or prototype first?
508
+ | Question | Depends on | Type |
509
+ |----------|-----------|------|
510
+ | What's the biggest risk? What could make this fail? | — | Decision |
511
+ | **How would you respond if that risk materializes?** | biggest-risk | Decision |
512
+ | What are you assuming that you haven't validated? | — | Decision |
513
+ | **What would you do if that assumption turns out wrong?** | assumptions | Decision |
514
+ | Is there a technical unknown that could change the approach? | — | Decision |
515
+ | What would you need to learn or prototype first? | risks, assumptions | Decision |
204
516
 
205
517
  Slots to fill:
206
- - `{{open_questions}}` — unanswered questions
207
- - `{{risks}}` — things that could go wrong
208
- - `{{assumptions}}` — beliefs that need validation
518
+ - `{{risks}}` — each with `{{mitigation}}`
519
+ - `{{assumptions}}` — each with `{{if_wrong}}` and `{{response}}`
520
+ - `{{open_questions}}`
209
521
 
210
- **When to move on:** The user has named at least the biggest unknown. This area is always optional — some projects are clear enough to skip it. But gently probe once.
522
+ **Done when:** Frontier is empty. The user has named at least the biggest unknown. This area is optional — some projects are clear enough to skip. But probe at least once.
211
523
 
212
524
  ### Principles — What philosophy guides this?
213
525
 
214
526
  > What to discover: The rules this project lives by. What's non-negotiable vs. flexible.
215
527
 
216
- Before asking, check for existing conventions in the project files:
528
+ **Prerequisites:** None (can explore anytime).
529
+
530
+ Before asking, **find facts** — scan existing conventions:
217
531
  ```bash
218
532
  cat .eslintrc* .prettierrc* tsconfig.json .editorconfig Makefile Dockerfile 2>/dev/null | head -80
219
533
  ls .github/workflows/ .gitlab-ci.yml 2>/dev/null
220
534
  ```
221
535
 
222
- Key threads:
223
- - Are there rules that must never be broken?
224
- - How much autonomy should AI agents have?
225
- - Speed vs quality, flexibility vs strictness — where does this project stand?
536
+ Present what you found as facts, then ask about decisions:
537
+
538
+ Frontier questions:
539
+
540
+ | Question | Depends on | Type |
541
+ |----------|-----------|------|
542
+ | Are there rules that must never be broken? | — | Decision |
543
+ | How much autonomy should AI agents have? | — | Decision |
544
+ | Speed vs quality, flexibility vs strictness — where does this project stand? | — | Decision |
226
545
 
227
546
  Accumulate as:
228
547
  ```
@@ -230,40 +549,58 @@ Accumulate as:
230
549
  [GUIDELINE] {{principle_name}} → {{concrete_rule}}
231
550
  ```
232
551
 
233
- **When to move on:** 2-7 principles feel right. This area is optional — don't force it.
552
+ **Done when:** Frontier is empty. 2-7 principles captured, or user decides none are needed.
234
553
 
235
554
  ---
236
555
 
237
556
  ## Checkpoints & State Tracking
238
557
 
239
- After exploring an area, summarize and read it back. Ask the user to confirm or correct.
558
+ After an area's frontier empties, summarize what was settled and read it back. Ask the user to confirm or correct. This is the checkpoint.
240
559
 
241
- Don't checkpoint after every question. Checkpoint when you've accumulated enough — typically after a natural cluster.
242
-
243
- **At each checkpoint, save progress to `docs/PROJECT.md`** with `status: drafting`:
560
+ **At each checkpoint, save progress to `docs/PROJECT.md`** with `status: drafting` and enhanced state:
244
561
 
245
562
  ```yaml
246
563
  ---
247
564
  status: drafting
248
- areasExplored: [problem, vision]
249
- areasRemaining: [experience, principles]
565
+ areasExplored:
566
+ problem: { depth: 3, decisions: 4, open: 0 }
567
+ vision: { depth: 2, decisions: 3, open: 1 }
568
+ areasRemaining: [output, experience, success]
250
569
  lastCheckpoint: vision
570
+ assumptions:
571
+ - "Assuming CLI is the only distribution form — not yet validated"
572
+ - "Assuming target users are limited to Claude Code users"
251
573
  generatedBy: know-thy-build
252
574
  ---
253
575
  ```
254
576
 
255
- Write confirmed content into the document body as you go.
577
+ **State fields:**
578
+ - `depth` — how many rounds of follow-up "why" questions were asked in this area
579
+ - `decisions` — how many decisions the user made
580
+ - `open` — how many questions were deferred or left open
581
+ - `assumptions` — beliefs surfaced during exploration that haven't been validated. **Every area must surface at least one assumption or explicitly confirm there are none.**
582
+ - `pauseReason` — why the session stopped (only when `status: drafting`). E.g. "user needed stakeholder input on pricing model"
583
+ - `nextAction` — what the next session should do first. E.g. "Resume from Vision area — user promised to check with team lead about distribution model"
584
+ - `pendingInput` — questions the user couldn't answer that need external input. Each entry: who to ask, what to ask, and which area is blocked by it.
585
+
586
+ Write confirmed content into the document body as you go, including brief decision rationale (why this choice, what was considered and rejected).
256
587
 
257
588
  ---
258
589
 
259
590
  ## When to Generate
260
591
 
261
- Offer to generate when **enough areas are covered to write a meaningful document**. Not all slots need to be filled.
592
+ Offer to generate when **all required areas have empty frontiers**. Required areas: Problem, Vision, Output. Other areas are optional but encouraged.
262
593
 
263
- Signs the conversation is ready:
264
- - The user starts giving shorter, confirming answers
265
- - You can write a coherent PROJECT.md with what you have
266
- - The conversation has a natural closing energy
594
+ Concrete checklist before offering:
595
+ - [ ] Problem frontier is empty — root cause articulated
596
+ - [ ] Persona frontier is empty primary user is concrete, not abstract
597
+ - [ ] Competitive Landscape at least default depth (2-3 competitors mapped, differentiation articulated)
598
+ - [ ] Vision frontier is empty — approach and deliverable defined
599
+ - [ ] Output frontier is empty — concrete artifacts listed
600
+ - [ ] `assumptions` in frontmatter is non-empty (at least the biggest unknowns surfaced)
601
+ - [ ] Every decision has a recommended answer that was accepted, modified, or rejected
602
+
603
+ Optional areas (User Journey, Boundaries, Success, Risks & Open Questions, Principles) can be skipped if the user explicitly declines, but offer each at least once.
267
604
 
268
605
  ---
269
606
 
@@ -274,19 +611,26 @@ Finalize the document. Write to `docs/PROJECT.md`. Create the `docs/` directory
274
611
  ```yaml
275
612
  ---
276
613
  status: complete
277
- areasExplored: [problem, vision, output, experience, success, open-questions, principles] # only what was actually explored
614
+ areasExplored:
615
+ problem: { depth: N, decisions: N }
616
+ vision: { depth: N, decisions: N }
617
+ # ... only areas that were actually explored
618
+ assumptions:
619
+ - "{{assumption_1}}"
620
+ - "{{assumption_2}}"
278
621
  generatedBy: know-thy-build
279
622
  version: 1.0.0
280
623
  date: {{date}}
281
624
  ---
282
625
  ```
283
626
 
284
- Remove `areasRemaining` and `lastCheckpoint`.
627
+ Remove `areasRemaining`, `lastCheckpoint`, and `open` counts.
285
628
 
286
629
  **Rules:**
287
630
  - Only include content from the conversation. No generic filler.
288
631
  - Preserve the user's actual words as much as possible.
289
632
  - **Omit sections that were not discussed.** A shorter, honest document beats a padded one.
633
+ - **Include decision rationale.** For key decisions, briefly note what was considered and why the chosen path was picked. Use inline comments or a "Considered Alternatives" note — not a separate section. One sentence per decision is enough.
290
634
  - The entire document MUST be written in {{LANG}}.
291
635
 
292
636
  **Template structure** (write all prose in {{LANG}}):
@@ -299,9 +643,43 @@ Remove `areasRemaining` and `lastCheckpoint`.
299
643
  ## Problem
300
644
 
301
645
  <!-- Weave into natural prose:
302
- {{who_suffers}}, {{problem_root}}, {{problem_impact}},
646
+ {{problem_root}}, {{problem_impact}},
303
647
  {{current_alternative}}, {{why_not_enough}} -->
304
648
 
649
+ ## Personas
650
+
651
+ <!-- Primary user first. Secondary only if discussed. -->
652
+
653
+ | Persona | Role | Pain Point | Tech Level | Context |
654
+ |---------|------|------------|------------|---------|
655
+ | {{persona_name}} | {{persona_role}} | {{persona_pain}} | {{persona_tech_level}} | {{persona_context}} |
656
+
657
+ **Primary user values:** {{persona_priority}}
658
+
659
+ ## Competitive Landscape
660
+
661
+ <!-- What already exists and where it falls short. Default depth: name, approach, gap.
662
+ Deep research (step-by-step journey, friction points, user sentiment) can be added later. -->
663
+
664
+ | Competitor | Approach | Gap |
665
+ |------------|----------|-----|
666
+ | {{competitor_name}} | {{competitor_approach}} | {{competitor_gap}} |
667
+
668
+ <!-- Deep research per competitor (optional — include if explored):
669
+
670
+ ### {{competitor_name}} — Deep Dive
671
+
672
+ **User Journey (same task):**
673
+ 1. {{step_1}}
674
+ 2. {{step_2}} ← friction: {{friction_point}}
675
+ 3. {{step_3}}
676
+
677
+ **Users praise:** {{praise}}
678
+ **Users complain:** {{complaints}}
679
+ -->
680
+
681
+ **Our Differentiation:** {{differentiation}}
682
+
305
683
  ## Vision
306
684
 
307
685
  | Before | After |
@@ -331,10 +709,18 @@ Remove `areasRemaining` and `lastCheckpoint`.
331
709
 
332
710
  ## User Journey
333
711
 
334
- <!-- {{user_journey}} as natural prose -->
712
+ <!-- Per-persona journey from trigger to outcome. This is the high-level map;
713
+ concrete step-by-step scenarios live in individual feature specs. -->
335
714
 
336
- **Aha Moment:** {{aha_moment}}
337
- **Primary Action:** {{primary_action}}
715
+ | Stage | Description |
716
+ |-------|-------------|
717
+ | **Trigger** | {{trigger}} |
718
+ | **Discovery** | {{discovery}} |
719
+ | **First Use** | {{first_use}} |
720
+ | **Core Loop** | {{core_loop}} ({{frequency}}) |
721
+ | **Aha Moment** | {{aha_moment}} |
722
+ | **After** | {{after}} |
723
+ | **Return** | {{return_trigger}} |
338
724
 
339
725
  ## Principles
340
726
 
@@ -354,18 +740,46 @@ Remove `areasRemaining` and `lastCheckpoint`.
354
740
  **Metric:** {{success_metric}}
355
741
  **Leading Indicator:** {{leading_indicator}}
356
742
 
743
+ ## Risks & Mitigations
744
+
745
+ <!-- Each risk must have a mitigation. A risk without a response is just worry. -->
746
+
747
+ | Risk | Impact | Mitigation |
748
+ |------|--------|------------|
749
+ | {{risk}} | {{impact}} | {{mitigation}} |
750
+
357
751
  ## Open Questions
358
752
 
359
753
  <!-- Only include if discussed. Omit if the project is clear enough. -->
360
754
 
361
- **Risks:**
362
- - {{risk}}
755
+ - {{open_question}}
363
756
 
364
- **Assumptions:**
365
- - {{assumption}}
757
+ ## Assumptions
366
758
 
367
- **Unknowns:**
368
- - {{open_question}}
759
+ <!-- Always include. These are beliefs surfaced during exploration that haven't been validated.
760
+ Each assumption notes what would change if wrong AND how to respond. -->
761
+
762
+ - {{assumption}} — if wrong: {{impact}} → response: {{response}}
763
+
764
+ ## Key Decisions
765
+
766
+ <!-- Record the 3-5 most consequential decisions made during project definition.
767
+ Each entry: what was decided, what alternatives were considered, why this path. -->
768
+
769
+ | Decision | Alternatives Considered | Why This Path |
770
+ |----------|------------------------|---------------|
771
+ | {{decision}} | {{alternatives}} | {{rationale}} |
772
+
773
+ ## Feature Registry
774
+
775
+ <!-- Index of all features. Updated each time a new feature is defined via /know-thy-build:feature.
776
+ This section makes PROJECT.md the single entry point for the full project picture. -->
777
+
778
+ | # | Feature | Priority | Depends On | Status |
779
+ |---|---------|----------|------------|--------|
780
+ | {{id}} | [{{title}}](features/{{NNN}}.md) | {{P0/P1/P2}} | {{depends_on}} | {{status}} |
781
+
782
+ **Technical Foundation:** [TECHNICAL.md](TECHNICAL.md)
369
783
 
370
784
  ---
371
785
 
@@ -486,6 +900,69 @@ If `CLAUDE.md` exists → prepend reference (if not already present). If not →
486
900
  This project follows the principles defined in [PROJECT.md](./docs/PROJECT.md).
487
901
  AI agents MUST read docs/PROJECT.md before starting any work.
488
902
  NON-NEGOTIABLE rules in PROJECT.md cannot be overridden.
903
+
904
+ ## Development Workflow
905
+
906
+ ### Orchestrator Model
907
+ The user session acts as **orchestrator only** — it does NOT implement directly.
908
+ All implementation is delegated to sub-agents with explicit scope and goals.
909
+
910
+ ### Implementation Flow
911
+
912
+ 1. **Orchestrator identifies work** from `docs/features/NNN.md`
913
+ - Determines scope: which files, which components, what changes
914
+ - Sets goal: specific acceptance criteria from the feature spec
915
+ - Dispatches implementation sub-agent
916
+
917
+ 2. **Implementation sub-agent — Pre-work (mandatory)**
918
+ Before writing any code, the sub-agent MUST read:
919
+ - `docs/PROJECT.md` — project principles and boundaries
920
+ - `docs/TECHNICAL.md` — technical decisions and patterns
921
+ - `docs/features/NNN.md` — feature spec, acceptance criteria, design intent
922
+ The sub-agent confirms its understanding of scope and goal before proceeding.
923
+
924
+ 3. **Implementation sub-agent — Execution**
925
+ Implements within the defined scope. Does not expand beyond the goal.
926
+
927
+ 4. **Post-implementation review (mandatory)**
928
+ After implementation, the sub-agent dispatches **three review agents**:
929
+
930
+ **Designer Review Agent:**
931
+ - Reads the feature's Design Intent Map (if present)
932
+ - Verifies every design intent step is correctly reflected in implementation
933
+ - Checks all UI states are handled (empty, loading, error, success)
934
+ - Adopts the most critical stance — assumes implementation is wrong until proven otherwise
935
+ - Produces checklist: `- [x]` passed or `- [ ]` failed with specific reason
936
+
937
+ **Architect Review Agent:**
938
+ - Reads `docs/TECHNICAL.md` and the feature spec
939
+ - Verifies code follows technical decisions, patterns, and constraints
940
+ - Checks code structure, naming, boundaries, and error handling
941
+ - Adopts the most critical stance — looks for what will break, not what looks nice
942
+ - Produces checklist: `- [x]` passed or `- [ ]` failed with specific reason
943
+
944
+ 5. **Designer + Architect must both pass before QA begins.**
945
+
946
+ 6. **QA Review Agent (mandatory — runs the product)**
947
+ - Actually starts the application and tests it as a real user
948
+ - Executes every acceptance criterion from the feature spec step by step
949
+ - Tests edge cases: interruption (refresh, back, cancel), concurrency (multi-tab), boundary (empty, max, special chars), state corruption (expired session, deleted resource)
950
+ - Captures evidence for every test: screenshots, console output, state checks
951
+ - Adopts the most paranoid, impatient, careless user persona
952
+ - Produces checklist: `- [x]` passed with evidence or `- [ ]` failed with reproduction steps
953
+
954
+ 7. **Review loop**
955
+ - If ANY criterion is `[ ]` (failed): implementer fixes and re-submits
956
+ - Designer + Architect re-review if changes are structural
957
+ - QA re-tests failed scenarios + regression check on happy path
958
+ - Loop continues until ALL reviewers' criteria are `[x]`
959
+ - Only when all three reviewers fully pass does the orchestrator accept the work
960
+
961
+ ### Document References
962
+ - Project definition: `docs/PROJECT.md`
963
+ - Technical foundation: `docs/TECHNICAL.md`
964
+ - Feature specs: `docs/features/NNN.md`
965
+ - Feature registry: `docs/PROJECT.md` → Feature Registry section
489
966
  ```
490
967
 
491
968
  ## Closing