know-thy-build 0.3.1 → 0.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.
package/README.md CHANGED
@@ -24,9 +24,9 @@ Pick a language, and three commands are installed into your `.claude/commands/`:
24
24
 
25
25
  | Command | Purpose | Output |
26
26
  |---------|---------|--------|
27
- | `/know-thy-build:project` | Define what you're building and why | `PROJECT.md` |
28
- | `/know-thy-build:technical` | Define how you'll build it | `TECHNICAL.md` |
29
- | `/know-thy-build:feature` | Design a specific feature | `features/NNN.md` |
27
+ | `/know-thy-build:project` | Define what you're building and why | `docs/PROJECT.md` |
28
+ | `/know-thy-build:technical` | Define how you'll build it | `docs/TECHNICAL.md` |
29
+ | `/know-thy-build:feature` | Design a specific feature | `docs/features/NNN.md` |
30
30
 
31
31
  ## The flow
32
32
 
@@ -54,7 +54,7 @@ A conversation that explores:
54
54
 
55
55
  Not every area needs equal depth. The conversation follows you, not a script.
56
56
 
57
- Result: `PROJECT.md` — the project's identity and compass.
57
+ Result: `docs/PROJECT.md` — the project's identity and compass.
58
58
 
59
59
  ### 2. Technical — How
60
60
 
@@ -74,7 +74,7 @@ Explores:
74
74
 
75
75
  Depth matches project scale. A CLI tool might only need Stack + Interfaces.
76
76
 
77
- Result: `TECHNICAL.md` — the technical foundation.
77
+ Result: `docs/TECHNICAL.md` — the technical foundation.
78
78
 
79
79
  ### 3. Feature — Specific work
80
80
 
@@ -93,16 +93,20 @@ Each feature spec covers:
93
93
 
94
94
  Features are quick — 3-8 exchanges. Create new ones or edit existing ones by number.
95
95
 
96
- Result: `features/001.md`, `features/002.md`, ...
96
+ Result: `docs/features/001.md`, `docs/features/002.md`, ...
97
97
 
98
98
  ## Evolution
99
99
 
100
100
  All documents support evolution. Run the same command again on a completed document:
101
101
 
102
- - `/know-thy-build:project` on a complete `PROJECT.md` → evolve mode
103
- - `/know-thy-build:technical` on a complete `TECHNICAL.md` → evolve mode
102
+ - `/know-thy-build:project` on a complete `docs/PROJECT.md` → evolve mode
103
+ - `/know-thy-build:technical` on a complete `docs/TECHNICAL.md` → evolve mode
104
104
  - `/know-thy-build:feature` → edit existing features by number
105
105
 
106
+ ### Migration from v0.3.x
107
+
108
+ If you have existing `PROJECT.md`, `TECHNICAL.md`, or `features/` at your project root, they will be automatically moved to `docs/` the next time you run any `/know-thy-build:*` command. References in `CLAUDE.md` are updated automatically.
109
+
106
110
  Changes are tracked with reasoning in a changelog — not just *what* changed, but *why*.
107
111
 
108
112
  ## Session resilience
@@ -136,6 +140,45 @@ Supported shortcuts: `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, `pt` — or pass
136
140
 
137
141
  All conversation and generated documents use the chosen language. Technical terms stay in English.
138
142
 
143
+ ## Foundations
144
+
145
+ know-thy-build draws on established techniques from philosophy, software engineering, and AI research.
146
+
147
+ ### Core method: Socratic Prompting
148
+
149
+ The tool applies the [Socratic method](https://en.wikipedia.org/wiki/Socratic_method) — questioning to surface latent knowledge rather than providing answers directly. In Plato's *Meno*, Socrates demonstrates that learning is **recollection** (anamnesis): the right questions draw out what the learner already knows. know-thy-build operates on the same premise — you already know what you want to build, you just haven't articulated it yet.
150
+
151
+ - Chang, ["Prompting Large Language Models With the Socratic Method"](https://arxiv.org/abs/2303.08769) (2023) — adapts Socratic strategies into LLM prompting templates
152
+ - Princeton NLP, ["The Socratic Method for Self-Discovery in Large Language Models"](https://princeton-nlp.github.io/SocraticAI/) — explicitly connects Socratic dialogue to self-discovery in LLMs
153
+ - [SocraticLM](https://proceedings.neurips.cc/paper_files/paper/2024/hash/9bae399d1f34b8650351c1bd3692aeae-Abstract-Conference.html) (NeurIPS 2024 Spotlight) — Socratic teaching paradigm outperforming GPT-4 by >12%
154
+
155
+ ### Dialectical reasoning
156
+
157
+ Each exchange follows a thesis-antithesis-synthesis cycle: the user states what they want (thesis), the tool challenges it (antithesis), and a refined understanding emerges (synthesis). This is [Hegelian dialectic](https://en.wikipedia.org/wiki/Dialectic#Hegelian_dialectic) applied to project definition.
158
+
159
+ - ["Self-reflecting LLMs: A Hegelian Dialectical Approach"](https://arxiv.org/abs/2501.14917) (2025)
160
+
161
+ ### Requirements elicitation
162
+
163
+ In software engineering, [requirements elicitation](https://en.wikipedia.org/wiki/Requirements_elicitation) is the process of discovering what stakeholders actually need — a discipline that recognizes requirements are *discovered*, not merely captured.
164
+
165
+ - Zave & Jackson, "Four Dark Corners of Requirements Engineering" (1997, ACM TOSEM)
166
+ - ["AI-based Multiagent Approach for Requirements Elicitation and Analysis"](https://arxiv.org/abs/2409.00038) (2024)
167
+
168
+ ### Design Thinking (Define phase)
169
+
170
+ know-thy-build's output maps to the **Define** phase of [Design Thinking](https://web.stanford.edu/~mshanks/MichaelShanks/files/509554.pdf) (Stanford d.school) — synthesizing fuzzy intuitions into a structured problem statement that guides everything that follows.
171
+
172
+ ### The Rubber Duck, upgraded
173
+
174
+ [Rubber duck debugging](https://en.wikipedia.org/wiki/Rubber_duck_debugging) works because articulating forces clarity. know-thy-build is a rubber duck that talks back — one that not only forces articulation but actively probes weak spots and challenges surface-level answers.
175
+
176
+ ### Multi-Agent Debate
177
+
178
+ Even within a single facilitator, know-thy-build adopts multiple perspectives — questioning like a PM, challenging like an architect, probing edge cases like QA. The principle that opposing viewpoints produce better outcomes is well-established.
179
+
180
+ - Liang et al., ["Encouraging Divergent Thinking in Large Language Models through Multi-Agent Debate"](https://arxiv.org/abs/2305.19118) (EMNLP 2024)
181
+
139
182
  ## License
140
183
 
141
184
  MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "know-thy-build",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Socratic project definition tool for Claude Code",
5
5
  "bin": {
6
6
  "know-thy-build": "./bin/cli.js"
@@ -27,21 +27,45 @@ Technical terms (e.g. CLI, API, MVP) stay in English. Everything else uses the s
27
27
 
28
28
  ## Before You Begin
29
29
 
30
+ ### 0. Migration check
31
+
32
+ Check if documents exist at the project root (legacy location):
33
+
34
+ ```bash
35
+ ls PROJECT.md TECHNICAL.md 2>/dev/null
36
+ ls features/*.md 2>/dev/null
37
+ ```
38
+
39
+ **If any are found at the root**, these are from a previous version. Migrate them to `docs/`:
40
+
41
+ 1. Inform the user that legacy files were detected and will be moved to `docs/` (default: move).
42
+ 2. Execute:
43
+ ```bash
44
+ mkdir -p docs
45
+ [ -f PROJECT.md ] && mv PROJECT.md docs/PROJECT.md
46
+ [ -f TECHNICAL.md ] && mv TECHNICAL.md docs/TECHNICAL.md
47
+ [ -d features ] && mv features docs/features
48
+ ```
49
+ 3. If `CLAUDE.md` exists, update any path references from `PROJECT.md` to `docs/PROJECT.md`, and `TECHNICAL.md` to `docs/TECHNICAL.md`, `features/` to `docs/features/`.
50
+ 4. Inform the user what was moved.
51
+
52
+ If no legacy files are found, skip silently.
53
+
30
54
  ### 1. Read project context
31
55
 
32
56
  ```bash
33
- cat PROJECT.md 2>/dev/null
34
- cat TECHNICAL.md 2>/dev/null
57
+ cat docs/PROJECT.md 2>/dev/null
58
+ cat docs/TECHNICAL.md 2>/dev/null
35
59
  ```
36
60
 
37
- If PROJECT.md doesn't exist, suggest running `/know-thy-build:project` first. A feature spec without project context is rootless.
61
+ If `docs/PROJECT.md` doesn't exist, suggest running `/know-thy-build:project` first. A feature spec without project context is rootless.
38
62
 
39
- If TECHNICAL.md exists, use it as technical context — reference the stack, architecture, and constraints when exploring the feature's approach. If it doesn't exist, that's fine — technical context is helpful but not required.
63
+ If `docs/TECHNICAL.md` exists, use it as technical context — reference the stack, architecture, and constraints when exploring the feature's approach. If it doesn't exist, that's fine — technical context is helpful but not required.
40
64
 
41
65
  ### 2. Scan existing features
42
66
 
43
67
  ```bash
44
- ls features/*.md 2>/dev/null | sort -V
68
+ ls docs/features/*.md 2>/dev/null | sort -V
45
69
  ```
46
70
 
47
71
  ### 3. Route based on state
@@ -61,27 +85,35 @@ ls features/*.md 2>/dev/null | sort -V
61
85
 
62
86
  ### Determine next number
63
87
 
64
- Find the highest existing number and increment by 1. Zero-pad to 3 digits. If `features/` doesn't exist, start at `001`.
88
+ Find the highest existing number and increment by 1. Zero-pad to 3 digits. If `docs/features/` doesn't exist, start at `001`.
65
89
 
66
90
  ### Areas to Explore
67
91
 
68
92
  These are NOT a rigid sequence. Follow the conversation. Most features only need 2-3 of these to be clear.
69
93
 
70
- #### What — What are we building?
94
+ #### Problem — What's broken or missing?
71
95
 
72
- > Discover: The concrete thing to implement.
96
+ > Discover: The specific pain this feature addresses. This is not the project-level problem (that's in PROJECT.md) — this is the concrete gap or friction that triggered "we need this feature."
73
97
 
74
- - What does this feature do, in one sentence?
75
- - What does the user see/experience when it's working?
76
- - Is there an existing pattern in the codebase this builds on?
98
+ - What's not working right now? What's the user struggling with?
99
+ - What happens today without this feature? (workaround, manual step, error, confusion...)
100
+ - Who hits this problem and how often?
101
+
102
+ #### Value — Why is this worth building?
103
+
104
+ > Discover: The value this feature delivers and how it connects to the bigger picture.
77
105
 
78
- #### Why Why does this matter?
106
+ - What changes for the user when this exists?
107
+ - How does this connect to the project's vision or principles in PROJECT.md?
108
+ - What happens if we don't build it? Is there a cost of inaction?
79
109
 
80
- > Discover: The motivation. Link to PROJECT.md if relevant.
110
+ #### Solution How does this solve it?
81
111
 
82
- - What problem does this solve or what value does it add?
83
- - What happens if we don't build it?
84
- - Does this connect to a principle or vision in PROJECT.md?
112
+ > Discover: The concrete thing to implement. Not implementation details, but the user-facing shape of the solution.
113
+
114
+ - What does this feature do, in one sentence?
115
+ - What does the user see/experience when it's working?
116
+ - Is there an existing pattern in the codebase this builds on?
85
117
 
86
118
  #### Scope — Where are the edges?
87
119
 
@@ -118,9 +150,9 @@ Don't drag the conversation. Features should be quick.
118
150
 
119
151
  ### Generate Feature Spec
120
152
 
121
- Create the `features/` directory if it doesn't exist.
153
+ Create the `docs/features/` directory if it doesn't exist.
122
154
 
123
- Write to `features/{{NNN}}.md`:
155
+ Write to `docs/features/{{NNN}}.md`:
124
156
 
125
157
  **Frontmatter:**
126
158
  ```yaml
@@ -148,13 +180,17 @@ During conversation, use `status: drafting`. On finalization, set to `complete`.
148
180
 
149
181
  <!-- One-liner: what this feature does -->
150
182
 
151
- ## What
183
+ ## Problem
184
+
185
+ <!-- What's broken or missing today. The specific pain this feature addresses. -->
186
+
187
+ ## Value
152
188
 
153
- <!-- Concrete description of what gets built -->
189
+ <!-- What changes when this exists. Link to PROJECT.md vision/principles if relevant. -->
154
190
 
155
- ## Why
191
+ ## Solution
156
192
 
157
- <!-- Motivation. Reference PROJECT.md if relevant -->
193
+ <!-- Concrete description of what gets built and how the user experiences it -->
158
194
 
159
195
  ## Scope
160
196
 
@@ -188,7 +224,7 @@ When the user chooses to edit an existing feature by number:
188
224
  ### 1. Read the feature
189
225
 
190
226
  ```bash
191
- cat features/{{NNN}}.md 2>/dev/null
227
+ cat docs/features/{{NNN}}.md 2>/dev/null
192
228
  ```
193
229
 
194
230
  ### 2. Present the current state
@@ -244,7 +280,7 @@ Write whatever content has been confirmed so far. The next `/know-thy-build:feat
244
280
  ## Closing
245
281
 
246
282
  **After CREATE:**
247
- - Feature spec has been saved to `features/{{NNN}}.md`
283
+ - Feature spec has been saved to `docs/features/{{NNN}}.md`
248
284
  - They can start implementing whenever ready
249
285
  - Run `/know-thy-build:feature` again for the next feature
250
286
 
@@ -28,17 +28,41 @@ Technical terms (e.g. CLI, API, NON-NEGOTIABLE) stay in English. Everything else
28
28
 
29
29
  ## Before You Begin
30
30
 
31
- Silently scan the project for existing context:
31
+ ### 0. Migration check
32
+
33
+ Check if documents exist at the project root (legacy location):
34
+
35
+ ```bash
36
+ ls PROJECT.md TECHNICAL.md 2>/dev/null
37
+ ls features/*.md 2>/dev/null
38
+ ```
39
+
40
+ **If any are found at the root**, these are from a previous version. Migrate them to `docs/`:
41
+
42
+ 1. Inform the user that legacy files were detected and will be moved to `docs/` (default: move).
43
+ 2. Execute:
44
+ ```bash
45
+ mkdir -p docs
46
+ [ -f PROJECT.md ] && mv PROJECT.md docs/PROJECT.md
47
+ [ -f TECHNICAL.md ] && mv TECHNICAL.md docs/TECHNICAL.md
48
+ [ -d features ] && mv features docs/features
49
+ ```
50
+ 3. If `CLAUDE.md` exists, update any path references from `PROJECT.md` to `docs/PROJECT.md`, and `TECHNICAL.md` to `docs/TECHNICAL.md`, `features/` to `docs/features/`.
51
+ 4. Inform the user what was moved.
52
+
53
+ If no legacy files are found, skip silently.
54
+
55
+ ### 1. Scan project context
32
56
 
33
57
  ```bash
34
58
  ls -la 2>/dev/null | head -20
35
59
  cat package.json pyproject.toml Cargo.toml go.mod README.md 2>/dev/null | head -80
36
- cat CLAUDE.md PROJECT.md 2>/dev/null
60
+ cat CLAUDE.md docs/PROJECT.md 2>/dev/null
37
61
  ```
38
62
 
39
- Route based on PROJECT.md state:
63
+ Route based on `docs/PROJECT.md` state:
40
64
 
41
- ### No PROJECT.md → CREATE mode
65
+ ### No docs/PROJECT.md → CREATE mode
42
66
 
43
67
  Note the blank canvas and begin exploring areas.
44
68
 
@@ -55,7 +79,7 @@ Present what was gathered so far and ask:
55
79
  ### `status: evolving` → RESUME EVOLVE mode
56
80
 
57
81
  Read `evolveProgress` from frontmatter and resume:
58
- > "We started evolving PROJECT.md before. Here's where we left off: [summary]. Shall we continue?"
82
+ > "We started evolving docs/PROJECT.md before. Here's where we left off: [summary]. Shall we continue?"
59
83
 
60
84
  ### `status: complete` → EVOLVE mode
61
85
 
@@ -216,7 +240,7 @@ After exploring an area, summarize and read it back. Ask the user to confirm or
216
240
 
217
241
  Don't checkpoint after every question. Checkpoint when you've accumulated enough — typically after a natural cluster.
218
242
 
219
- **At each checkpoint, save progress to PROJECT.md** with `status: drafting`:
243
+ **At each checkpoint, save progress to `docs/PROJECT.md`** with `status: drafting`:
220
244
 
221
245
  ```yaml
222
246
  ---
@@ -243,9 +267,9 @@ Signs the conversation is ready:
243
267
 
244
268
  ---
245
269
 
246
- ## Generate PROJECT.md
270
+ ## Generate docs/PROJECT.md
247
271
 
248
- Finalize the document. Update frontmatter:
272
+ Finalize the document. Write to `docs/PROJECT.md`. Create the `docs/` directory if it doesn't exist. Update frontmatter:
249
273
 
250
274
  ```yaml
251
275
  ---
@@ -459,19 +483,19 @@ If `CLAUDE.md` exists → prepend reference (if not already present). If not →
459
483
  **Reference to add:**
460
484
  ```markdown
461
485
  ## Project Compass
462
- This project follows the principles defined in [PROJECT.md](./PROJECT.md).
463
- AI agents MUST read PROJECT.md before starting any work.
486
+ This project follows the principles defined in [PROJECT.md](./docs/PROJECT.md).
487
+ AI agents MUST read docs/PROJECT.md before starting any work.
464
488
  NON-NEGOTIABLE rules in PROJECT.md cannot be overridden.
465
489
  ```
466
490
 
467
491
  ## Closing
468
492
 
469
493
  **After CREATE:**
470
- - PROJECT.md has been generated.
494
+ - `docs/PROJECT.md` has been generated.
471
495
  - This document is the compass for all agents working on this project.
472
496
  - Run `/know-thy-build:project` again when the project's direction shifts.
473
497
 
474
498
  **After EVOLVE:**
475
- - PROJECT.md has been updated.
499
+ - `docs/PROJECT.md` has been updated.
476
500
  - The changelog records not just what changed, but why.
477
501
  - Run `/know-thy-build:project` again whenever the direction shifts.
@@ -29,15 +29,39 @@ Technical terms (e.g. REST, PostgreSQL, Docker, CI/CD) stay in English. Everythi
29
29
 
30
30
  ## Before You Begin
31
31
 
32
+ ### 0. Migration check
33
+
34
+ Check if documents exist at the project root (legacy location):
35
+
36
+ ```bash
37
+ ls PROJECT.md TECHNICAL.md 2>/dev/null
38
+ ls features/*.md 2>/dev/null
39
+ ```
40
+
41
+ **If any are found at the root**, these are from a previous version. Migrate them to `docs/`:
42
+
43
+ 1. Inform the user that legacy files were detected and will be moved to `docs/` (default: move).
44
+ 2. Execute:
45
+ ```bash
46
+ mkdir -p docs
47
+ [ -f PROJECT.md ] && mv PROJECT.md docs/PROJECT.md
48
+ [ -f TECHNICAL.md ] && mv TECHNICAL.md docs/TECHNICAL.md
49
+ [ -d features ] && mv features docs/features
50
+ ```
51
+ 3. If `CLAUDE.md` exists, update any path references from `PROJECT.md` to `docs/PROJECT.md`, and `TECHNICAL.md` to `docs/TECHNICAL.md`, `features/` to `docs/features/`.
52
+ 4. Inform the user what was moved.
53
+
54
+ If no legacy files are found, skip silently.
55
+
32
56
  ### 1. Read project context
33
57
 
34
58
  ```bash
35
- cat PROJECT.md 2>/dev/null
36
- cat TECHNICAL.md 2>/dev/null
59
+ cat docs/PROJECT.md 2>/dev/null
60
+ cat docs/TECHNICAL.md 2>/dev/null
37
61
  ```
38
62
 
39
- **If PROJECT.md doesn't exist or has `status: drafting`:**
40
- > "PROJECT.md needs to be complete first — the technical design should follow the project definition. Run `/know-thy-build:project` first."
63
+ **If `docs/PROJECT.md` doesn't exist or has `status: drafting`:**
64
+ > "docs/PROJECT.md needs to be complete first — the technical design should follow the project definition. Run `/know-thy-build:project` first."
41
65
  → Stop here.
42
66
 
43
67
  ### 2. Scan existing technical context
@@ -50,14 +74,14 @@ ls .github/workflows/ .gitlab-ci.yml 2>/dev/null
50
74
  cat CLAUDE.md 2>/dev/null
51
75
  ```
52
76
 
53
- ### 3. Route based on TECHNICAL.md state
77
+ ### 3. Route based on `docs/TECHNICAL.md` state
54
78
 
55
- **No TECHNICAL.md → CREATE mode**
56
- Present what you found from PROJECT.md and codebase:
79
+ **No `docs/TECHNICAL.md` → CREATE mode**
80
+ Present what you found from `docs/PROJECT.md` and codebase:
57
81
  > "PROJECT.md defines [one-liner summary]. I can see [tech context from files]. Let's define the technical foundation."
58
82
 
59
83
  **`status: drafting` → RESUME mode**
60
- Read frontmatter, present progress, offer to continue.
84
+ Read `docs/TECHNICAL.md` frontmatter, present progress, offer to continue.
61
85
 
62
86
  **`status: complete` → EVOLVE mode**
63
87
  Present current technical definition:
@@ -168,7 +192,7 @@ Slots to fill:
168
192
 
169
193
  Same pattern as project — checkpoint after natural clusters, not every question.
170
194
 
171
- **Save progress to TECHNICAL.md** with `status: drafting`:
195
+ **Save progress to `docs/TECHNICAL.md`** with `status: drafting`:
172
196
 
173
197
  ```yaml
174
198
  ---
@@ -194,9 +218,9 @@ Not every area needs to be explored. A CLI tool might only need Stack + Interfac
194
218
 
195
219
  ---
196
220
 
197
- ## Generate TECHNICAL.md
221
+ ## Generate docs/TECHNICAL.md
198
222
 
199
- Write to `TECHNICAL.md` in the project root.
223
+ Write to `docs/TECHNICAL.md`. Create the `docs/` directory if it doesn't exist.
200
224
 
201
225
  **Frontmatter:**
202
226
  ```yaml
@@ -316,11 +340,11 @@ lastEvolve: {{date}}
316
340
  ## Closing
317
341
 
318
342
  **After CREATE:**
319
- - TECHNICAL.md has been generated.
343
+ - `docs/TECHNICAL.md` has been generated.
320
344
  - This defines the technical foundation for all implementation work.
321
345
  - Feature specs (`/know-thy-build:feature`) will reference this automatically.
322
346
  - Run `/know-thy-build:technical` again when technical direction shifts.
323
347
 
324
348
  **After EVOLVE:**
325
- - TECHNICAL.md has been updated with changelog.
349
+ - `docs/TECHNICAL.md` has been updated with changelog.
326
350
  - Review if existing features need adjustment based on technical changes.