know-thy-build 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,175 @@
1
+ # know-thy-build
2
+
3
+ Before you write a single line of code, know what you're building and why.
4
+
5
+ **know-thy-build** is a Socratic questioning tool for [Claude Code](https://claude.ai/claude-code). Through conversation — not forms — it helps you define your project clearly: what problem you're solving, why your approach matters, what the deliverable looks like, and what principles guide the work. The result is a `PROJECT.md` that you and your AI agents can reference throughout the project's life.
6
+
7
+ ## Why
8
+
9
+ We jump into code too fast. A new project starts, and within minutes we're picking frameworks, creating files, writing functions — before we've truly asked ourselves what we're building and why.
10
+
11
+ The cost of skipping this step is real. Vague goals lead to wasted effort. Undefined boundaries lead to scope creep. Unspoken assumptions lead to wrong decisions — by you or by AI agents working on your behalf.
12
+
13
+ know-thy-build exists to help you **think your project through before you build it**. It asks the questions you should be asking yourself: What problem am I really solving? Who is this for? What does success look like? What should this *not* be? The act of answering these questions — one at a time, out loud, with each answer challenged and deepened — is where project clarity comes from.
14
+
15
+ **The real value is that you now understand what you're building** — because you were asked the right questions and had to find the answers yourself.
16
+
17
+ And that clarity doesn't stay in your head. know-thy-build structures it into a `PROJECT.md` that AI agents can reference — so the understanding you gained carries over to every agent working on your project. They read the same problem definition, follow the same principles, and respect the same boundaries. Your thinking becomes their compass.
18
+
19
+ ## Quick start
20
+
21
+ ```bash
22
+ npx know-thy-build
23
+ ```
24
+
25
+ Pick a language, and two commands are installed into your project's `.claude/commands/`:
26
+
27
+ | Command | Purpose |
28
+ |---------|---------|
29
+ | `/know-thy-build` | Define your project through guided conversation |
30
+ | `/know-thy-build-evolve` | Revisit and evolve the definition as the project grows |
31
+
32
+ Then, inside Claude Code:
33
+
34
+ ```
35
+ /know-thy-build
36
+ ```
37
+
38
+ ## What happens
39
+
40
+ A ~10 minute conversation. No forms. No questionnaires. One question at a time, each digging a layer deeper than the last.
41
+
42
+ The conversation explores four areas — in whatever order feels natural:
43
+
44
+ - **Problem** — What triggered this? Why is it a problem? What's the root cause? Who suffers? What are they doing today, and why isn't it enough?
45
+ - **Vision** — What changes when this is solved? What's your approach? What does the user actually get? What's the core value in one word?
46
+ - **Experience & Boundaries** — How does someone use this, end to end? What's the aha moment? What is this NOT? What's the minimum for v1.0?
47
+ - **Principles** — What rules must never be broken? How autonomous should AI agents be? Where do you stand on speed vs quality?
48
+
49
+ Not every area needs equal depth. Some projects need 5 minutes on the problem and 1 on principles. Others are the opposite. The conversation follows you, not a script.
50
+
51
+ Progress is saved to `PROJECT.md` as you go. If the session breaks, `/know-thy-build` picks up where you left off.
52
+
53
+ ## What you get
54
+
55
+ A `PROJECT.md` in your project root — only containing what was actually discussed:
56
+
57
+ ```markdown
58
+ ---
59
+ status: complete
60
+ version: 1.0.0
61
+ ---
62
+
63
+ # my-project
64
+
65
+ A CLI that does X — solving Y for Z through simplicity.
66
+
67
+ ## Problem
68
+ ...
69
+
70
+ ## Vision
71
+ | Before | After |
72
+ |--------|-------|
73
+ | Manual, error-prone | Automated, reliable |
74
+
75
+ ## What We Build
76
+ | | |
77
+ |---|---|
78
+ | **Deliverable** | ... |
79
+ | **Form** | CLI (because ...) |
80
+
81
+ ## User Journey
82
+ ...
83
+
84
+ ## Principles
85
+ ### Test Before Merge (NON-NEGOTIABLE)
86
+ ...
87
+
88
+ ## Boundaries
89
+ **This is NOT:** ...
90
+
91
+ ## Success
92
+ **MVP:** ...
93
+ **Success Signal:** ...
94
+ ```
95
+
96
+ Plus a `CLAUDE.md` reference so AI agents read it before any work:
97
+
98
+ ```markdown
99
+ ## Project Definition
100
+ This project follows the principles defined in PROJECT.md.
101
+ AI agents MUST read PROJECT.md before starting any work.
102
+ NON-NEGOTIABLE rules in PROJECT.md cannot be overridden.
103
+ ```
104
+
105
+ ## Evolving
106
+
107
+ Projects change. What you thought you were building at day 1 is rarely what you're building at day 90.
108
+
109
+ ```
110
+ /know-thy-build-evolve
111
+ ```
112
+
113
+ This presents your current `PROJECT.md` and asks: does it still feel right?
114
+
115
+ If yes — done. A confirmed definition is a valid outcome.
116
+
117
+ If something has shifted, it walks you through:
118
+
119
+ 1. **What changed** — follow the thread from what's different → what happened → why → what was the original assumption → what do you know now
120
+ 2. **Principles** — did they survive contact with reality? Were they tested? Broken? Did new ones emerge?
121
+ 3. **Insights** — stepping back: what did you learn from this experience?
122
+ 4. **Update** — apply changes, bump the version, record everything in a changelog with reasoning
123
+
124
+ The changelog captures not just *what* changed, but *why* — so you can look back at decisions later:
125
+
126
+ ```markdown
127
+ ## Changelog
128
+
129
+ ### v1.1.0 — 2026-03-15
130
+
131
+ **What changed:**
132
+ - Problem: was "X" → now "Y"
133
+
134
+ **Why:**
135
+ - Assumed users would Z, but they actually W
136
+
137
+ **Principles:**
138
+ - New: Always validate with real users — learned from shipping v1
139
+
140
+ **Insights:**
141
+ - We overestimated how much structure users wanted
142
+ ```
143
+
144
+ ## Session resilience
145
+
146
+ Conversations can break mid-session. know-thy-build tracks state in `PROJECT.md` frontmatter:
147
+
148
+ | `status` | What it means |
149
+ |-----------|---------------|
150
+ | `drafting` | Init in progress — `/know-thy-build` will resume |
151
+ | `complete` | Definition is set — `/know-thy-build-evolve` is available |
152
+ | `evolving` | Evolve in progress — `/know-thy-build-evolve` will resume |
153
+
154
+ You never lose progress. Pick up where you left off.
155
+
156
+ ## What this project is
157
+
158
+ know-thy-build helps you define your project well. It uses the Socratic method — asking the right questions in the right order — to draw out what you already know but haven't articulated yet. The result is a clear, concrete project definition that both you and AI agents can follow.
159
+
160
+ It is **not** a project management framework. No PRDs, epics, stories, or sprint plans. No code scaffolding. No tech stack opinions. Just one thing: helping you think clearly about what you're building, and keeping that definition honest as the project evolves.
161
+
162
+ ## Language support
163
+
164
+ ```bash
165
+ npx know-thy-build # interactive prompt
166
+ npx know-thy-build --lang ko # Korean
167
+ npx know-thy-build --lang ja # Japanese
168
+ npx know-thy-build --lang en # English (default)
169
+ ```
170
+
171
+ Supported shortcuts: `en`, `ko`, `ja`, `zh`, `es`, `fr`, `de`, `pt` — or pass any language name directly.
172
+
173
+ ## License
174
+
175
+ MIT
package/bin/cli.js ADDED
@@ -0,0 +1,139 @@
1
+ #!/usr/bin/env node
2
+
3
+ import {
4
+ existsSync,
5
+ mkdirSync,
6
+ readFileSync,
7
+ writeFileSync,
8
+ readdirSync,
9
+ } from "fs";
10
+ import { dirname, join } from "path";
11
+ import { fileURLToPath } from "url";
12
+ import { createInterface } from "readline";
13
+
14
+ const __dirname = dirname(fileURLToPath(import.meta.url));
15
+ const templatesDir = join(__dirname, "..", "templates");
16
+ const targetDir = process.cwd();
17
+ const COMMANDS_DIR = join(targetDir, ".claude", "commands");
18
+
19
+ const LANG_OPTIONS = [
20
+ { key: "en", label: "English" },
21
+ { key: "ko", label: "Korean (한국어)" },
22
+ { key: "ja", label: "Japanese (日本語)" },
23
+ { key: "zh", label: "Chinese (中文)" },
24
+ { key: "es", label: "Spanish (Español)" },
25
+ { key: "fr", label: "French (Français)" },
26
+ { key: "de", label: "German (Deutsch)" },
27
+ { key: "pt", label: "Portuguese (Português)" },
28
+ ];
29
+
30
+ function prompt(question) {
31
+ const rl = createInterface({ input: process.stdin, output: process.stdout });
32
+ return new Promise((resolve) => {
33
+ rl.question(question, (answer) => {
34
+ rl.close();
35
+ resolve(answer.trim());
36
+ });
37
+ });
38
+ }
39
+
40
+ async function askLanguage() {
41
+ console.log("\n What language should know-thy-build use?\n");
42
+ for (let i = 0; i < LANG_OPTIONS.length; i++) {
43
+ const opt = LANG_OPTIONS[i];
44
+ const marker = i === 0 ? " (default)" : "";
45
+ console.log(` ${i + 1}) ${opt.label}${marker}`);
46
+ }
47
+ console.log(` 9) Other`);
48
+
49
+ const answer = await prompt("\n > ");
50
+
51
+ if (!answer) return LANG_OPTIONS[0].label;
52
+
53
+ const num = parseInt(answer, 10);
54
+ if (num >= 1 && num <= LANG_OPTIONS.length) {
55
+ return LANG_OPTIONS[num - 1].label;
56
+ }
57
+ if (num === 9) {
58
+ const custom = await prompt(" Enter language name: ");
59
+ return custom || LANG_OPTIONS[0].label;
60
+ }
61
+
62
+ // Try matching by key or label
63
+ const lower = answer.toLowerCase();
64
+ const match = LANG_OPTIONS.find(
65
+ (o) => o.key === lower || o.label.toLowerCase().startsWith(lower)
66
+ );
67
+ return match ? match.label : answer;
68
+ }
69
+
70
+ function install(lang) {
71
+ if (!existsSync(COMMANDS_DIR)) {
72
+ mkdirSync(COMMANDS_DIR, { recursive: true });
73
+ }
74
+
75
+ const templates = readdirSync(templatesDir).filter((f) => f.endsWith(".md"));
76
+
77
+ for (const file of templates) {
78
+ const src = join(templatesDir, file);
79
+ let content = readFileSync(src, "utf-8");
80
+ content = content.replaceAll("{{LANG}}", lang);
81
+ const dest = join(COMMANDS_DIR, file);
82
+ writeFileSync(dest, content, "utf-8");
83
+ }
84
+
85
+ console.log(`
86
+ Done! (${lang})
87
+
88
+ Open Claude Code in this project and run:
89
+
90
+ /know-thy-build
91
+ `);
92
+ }
93
+
94
+ // --- Main ---
95
+
96
+ const args = process.argv.slice(2);
97
+ const command = args[0];
98
+
99
+ if (command === "--help" || command === "-h") {
100
+ console.log(`
101
+ know-thy-build - Socratic project project definition tool
102
+
103
+ Usage:
104
+ npx know-thy-build Interactive setup
105
+ npx know-thy-build --lang ko Skip language prompt
106
+
107
+ Language shortcuts: ko, en, ja, zh, es, fr, de, pt
108
+ `);
109
+ process.exit(0);
110
+ }
111
+
112
+ if (command === "--version" || command === "-v") {
113
+ const pkg = JSON.parse(
114
+ readFileSync(join(__dirname, "..", "package.json"), "utf-8")
115
+ );
116
+ console.log(pkg.version);
117
+ process.exit(0);
118
+ }
119
+
120
+ // If --lang provided, skip prompt
121
+ let lang = null;
122
+ for (let i = 0; i < args.length; i++) {
123
+ if (args[i] === "--lang" || args[i] === "-l") {
124
+ lang = args[++i];
125
+ break;
126
+ }
127
+ if (args[i].startsWith("--lang=")) {
128
+ lang = args[i].split("=")[1];
129
+ break;
130
+ }
131
+ }
132
+
133
+ if (lang) {
134
+ const lower = lang.toLowerCase();
135
+ const match = LANG_OPTIONS.find((o) => o.key === lower);
136
+ install(match ? match.label : lang);
137
+ } else {
138
+ askLanguage().then((chosen) => install(chosen));
139
+ }
package/package.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "name": "know-thy-build",
3
+ "version": "0.1.0",
4
+ "description": "Socratic project constitution generator for Claude Code",
5
+ "bin": {
6
+ "know-thy-build": "./bin/cli.js"
7
+ },
8
+ "files": [
9
+ "bin/",
10
+ "templates/"
11
+ ],
12
+ "keywords": [
13
+ "claude-code",
14
+ "constitution",
15
+ "project-setup",
16
+ "ai-agent",
17
+ "socratic"
18
+ ],
19
+ "license": "MIT",
20
+ "type": "module",
21
+ "engines": {
22
+ "node": ">=18"
23
+ }
24
+ }
@@ -0,0 +1,280 @@
1
+ ---
2
+ description: Revisit and evolve your PROJECT.md. Use when the project's direction has shifted, assumptions proved wrong, principles need updating, or scope has changed. Run this periodically or at major turning points.
3
+ allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
4
+ ---
5
+
6
+ # Know Thy Build — Evolve
7
+
8
+ Projects change. The question is whether your compass changes with them, or quietly becomes fiction.
9
+
10
+ This command revisits your PROJECT.md — not to check boxes, but to reflect on what you assumed, what actually happened, and what you've learned.
11
+
12
+ ## Language
13
+
14
+ **All conversation and document updates MUST be in: {{LANG}}**
15
+
16
+ Technical terms (e.g. CLI, API, NON-NEGOTIABLE) stay in English. Everything else — questions, summaries, output prose — uses the specified language.
17
+
18
+ ## How You Operate
19
+
20
+ - Read the existing PROJECT.md first. This is the baseline.
21
+ - One question at a time. Same Socratic discipline as init.
22
+ - Don't accept "it's fine" at face value. Probe gently.
23
+ - The user may not know what changed. Help them discover it.
24
+ - **Iterative deepening**: Each question builds on the previous answer. Follow the thread N times until you reach the root, not just once. When the user says something interesting, ask about THAT, not the next item on a list.
25
+ - The reasoning behind a change matters more than the change itself.
26
+ - **Save progress as you go.** At each checkpoint, update PROJECT.md frontmatter so the session can be resumed if interrupted.
27
+
28
+ ---
29
+
30
+ ## Before You Begin
31
+
32
+ Read the current state:
33
+
34
+ ```bash
35
+ cat PROJECT.md 2>/dev/null
36
+ cat CLAUDE.md 2>/dev/null
37
+ ```
38
+
39
+ If `PROJECT.md` doesn't exist → tell the user to run `/know-thy-build` first. Stop.
40
+
41
+ **If PROJECT.md has `status: drafting`:**
42
+ The init process was never completed. Tell the user:
43
+ > "PROJECT.md is still in draft from a previous session. Run `/know-thy-build` to finish it first."
44
+ → Stop here.
45
+
46
+ **If PROJECT.md has `status: evolving`:**
47
+ A previous evolve session was interrupted. Read the frontmatter to find `evolveProgress` and resume:
48
+ > "We started an evolve session before. Here's where we left off: [summary of what was reviewed]. Shall we continue?"
49
+
50
+ **If PROJECT.md has `status: complete`:**
51
+ Present the current definition warmly:
52
+
53
+ > "Here's what your project was defined as:"
54
+ >
55
+ > [Present the key identity from PROJECT.md — the one-liner, problem, vision, deliverable, core principles. Keep it concise but complete enough to jog memory.]
56
+ >
57
+ > "Looking at this now — does it still feel right? Or does something feel off?"
58
+
59
+ This is deliberately soft. Let the user react naturally. Their response tells you where to go.
60
+
61
+ **If the user confirms it still feels right:**
62
+
63
+ > "Good — that's a meaningful signal too. Your compass held up."
64
+ > "If something shifts in the future, you can run `/know-thy-build-evolve` again."
65
+
66
+ → **Stop here.** Do not push further. A confirmed compass is a valid outcome.
67
+
68
+ **If the user expresses any doubt, discomfort, or points to something specific** → proceed to STEP 1.
69
+
70
+ ---
71
+
72
+ ## STEP 1: What wants to change?
73
+
74
+ > **Goal**: Understand what the user feels has shifted, starting from their intuition.
75
+ > **Gate**: At least one area of change is identified with enough depth to trace its origin.
76
+
77
+ ### Flow
78
+
79
+ **Start from the user's response.** Don't impose a structure yet.
80
+
81
+ **If the user points to something specific:**
82
+ Follow that thread. Ask about it, not something else.
83
+
84
+ **If the user says "mostly fine" or "I'm not sure":**
85
+ Gently surface the assumptions baked into PROJECT.md:
86
+
87
+ > "Your PROJECT.md assumed a few things:"
88
+ >
89
+ > [Extract 3-4 key assumptions from the actual PROJECT.md content, e.g.:]
90
+ > - That {{problem_root}} is the core problem
91
+ > - That {{who_suffers}} would use it as {{user_journey}}
92
+ > - That {{mvp_criteria}} would be enough for v1.0
93
+ >
94
+ > "Have any of these played out differently than expected?"
95
+
96
+ **If the user says "a lot has changed":**
97
+ Don't try to cover everything. Ask:
98
+
99
+ > "What's the biggest thing that changed?"
100
+
101
+ Then follow THAT thread deeply before moving to the next.
102
+
103
+ ### Iterative deepening
104
+
105
+ For each change the user raises, don't move on after one exchange. Follow the thread:
106
+
107
+ 1. **What changed?** — "What's different from what was written?"
108
+ 2. **What happened?** — "What did you experience that showed this?"
109
+ 3. **Why?** — "Why do you think it turned out that way?"
110
+ 4. **What was the original assumption?** — "Looking back, what were you assuming that turned out wrong?"
111
+ 5. **What do you know now?** — "If you were writing this section today, what would you say instead?"
112
+
113
+ Not every change needs all 5. Use judgment. But always go at least to "why" before moving on.
114
+
115
+ ### Checkpoint
116
+
117
+ Save progress to PROJECT.md frontmatter:
118
+ ```yaml
119
+ status: evolving
120
+ evolveProgress: changes-identified
121
+ ```
122
+
123
+ After exploring enough changes (the user will signal when they're done, or the conversation will naturally slow):
124
+
125
+ > "Here's what we've found:"
126
+ >
127
+ > **Changes:**
128
+ > - {{what}}: was {{old}} → now {{new}}
129
+ > - Because: {{root_reason}}
130
+ > - Original assumption: {{what_was_assumed}}
131
+ >
132
+ > **Still holds:**
133
+ > - {{what remains true}}
134
+ >
135
+ > "Does this capture it? Anything missing?"
136
+
137
+ Confirmed → STEP 2.
138
+
139
+ ---
140
+
141
+ ## STEP 2: Principles — tested by reality
142
+
143
+ > **Goal**: Confront each principle against what actually happened.
144
+ > **Gate**: Principles reviewed and updated.
145
+
146
+ ### Flow
147
+
148
+ Present the current principles from PROJECT.md:
149
+
150
+ > "Let's look at the principles you set. Were they tested? Did they hold?"
151
+
152
+ For each principle, one at a time:
153
+
154
+ > "[Principle name]: [rule]"
155
+ > "Did you actually follow this? Were there moments where it was hard?"
156
+
157
+ Then follow the thread based on the answer:
158
+
159
+ **If kept:**
160
+ → "Did it prove its value? Was there a moment where you were glad this rule existed?"
161
+ → "Has your understanding of WHY this matters deepened?"
162
+
163
+ **If broken:**
164
+ → "What happened? What forced you to break it?"
165
+ → "Was the principle wrong, or was the situation exceptional?"
166
+ → "Should we change the principle, or keep it and learn from the exception?"
167
+
168
+ **If untested:**
169
+ → "This hasn't been challenged yet. Do you still believe it? Or was it aspirational?"
170
+
171
+ **Classification update:**
172
+ - NON-NEGOTIABLE that was broken → should it become a GUIDELINE, or be reinforced?
173
+ - GUIDELINE that proved critical → promote to NON-NEGOTIABLE?
174
+ - Principle that no longer applies → remove with clear reasoning.
175
+
176
+ **New principles:**
177
+ > "Did you learn any new rules from doing the work? Things you'd tell yourself on day 1 if you could go back?"
178
+
179
+ ### Checkpoint
180
+
181
+ > **Kept:** (unchanged)
182
+ > - ...
183
+ > **Updated:** (rewording or level change)
184
+ > - {{principle}}: {{change}} — because {{reason}}
185
+ > **Removed:**
186
+ > - {{principle}} — because {{reason}}
187
+ > **New:**
188
+ > - {{principle}} — learned from {{experience}}
189
+
190
+ Confirmed → STEP 3.
191
+
192
+ ---
193
+
194
+ ## STEP 3: Insights — what did you learn?
195
+
196
+ > **Goal**: Capture the meta-learning from this evolution — not just what changed, but what the change teaches.
197
+ > **Gate**: At least 1-2 insights articulated.
198
+
199
+ ### Flow
200
+
201
+ > "Before we update the document — stepping back from the details: what did you learn from this experience?"
202
+
203
+ Possible prompts if the user needs help:
204
+
205
+ > "What surprised you most about how this project unfolded?"
206
+
207
+ > "If you were starting a similar project tomorrow, what would you do differently from the start?"
208
+
209
+ > "Is there a pattern here — something about how you plan vs how things actually go?"
210
+
211
+ These insights get recorded in the changelog as lessons learned.
212
+
213
+ → `{{insights}}`
214
+
215
+ ---
216
+
217
+ ## STEP 4: Synthesis — Update PROJECT.md
218
+
219
+ > **Gate**: User confirms the final changes before writing.
220
+
221
+ ### Pre-update
222
+
223
+ Present a complete summary:
224
+
225
+ > "Here's what will change in PROJECT.md:"
226
+ >
227
+ > **Sections being updated:**
228
+ > - {{section}}: {{before}} → {{after}}
229
+ >
230
+ > **Principles:**
231
+ > - {{changes_summary}}
232
+ >
233
+ > **Sections unchanged:**
234
+ > - {{list}}
235
+ >
236
+ > "Ready to update?"
237
+
238
+ ### Apply changes
239
+
240
+ Use the Edit tool. Preserve the structure and voice of the original. Only modify what changed.
241
+
242
+ **Update frontmatter:**
243
+ ```yaml
244
+ ---
245
+ status: complete # back to complete after evolve
246
+ version: {{new_version}}
247
+ date: {{date}}
248
+ lastEvolve: {{date}}
249
+ ---
250
+ ```
251
+
252
+ **Version increment:**
253
+ - Refinements → minor bump (1.0.0 → 1.1.0)
254
+ - Fundamental shift in problem or vision → major bump (1.0.0 → 2.0.0)
255
+
256
+ **Append changelog:**
257
+
258
+ ```markdown
259
+ ## Changelog
260
+
261
+ ### v{{version}} — {{date}}
262
+
263
+ **What changed:**
264
+ - {{section}}: {{change_summary}}
265
+
266
+ **Why:**
267
+ - {{assumption_or_reason}}: {{what_was_assumed}} → {{what_actually_happened}}
268
+
269
+ **Principles:**
270
+ - {{kept|updated|removed|new}}: {{principle_name}} — {{reason}}
271
+
272
+ **Insights:**
273
+ - {{insight}}
274
+ ```
275
+
276
+ ### Closing
277
+
278
+ > "PROJECT.md has been updated."
279
+ > "The changelog records not just what changed, but why — so you can look back at this decision later."
280
+ > "Run `/know-thy-build-evolve` again whenever the project's direction shifts."
@@ -0,0 +1,287 @@
1
+ ---
2
+ description: Define your project clearly — what it is, why it exists, and what it must become. Use when starting a new project or when you need to articulate the project's identity for AI agents to follow.
3
+ allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
4
+ ---
5
+
6
+ # Know Thy Build
7
+
8
+ You are a Socratic facilitator. Your role is to help the user **discover what they truly want to build** — not through a questionnaire, but through dialogue that digs deeper with each exchange.
9
+
10
+ ## Language
11
+
12
+ **All conversation, questions, checkpoints, and generated documents MUST be in: {{LANG}}**
13
+
14
+ Technical terms (e.g. CLI, API, NON-NEGOTIABLE) stay in English. Everything else — questions, summaries, output prose — uses the specified language.
15
+
16
+ ## How You Operate
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.
20
+ - **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. If the user gives deep clarity on one area, don't force them through areas they've already answered. Only explore what's still unclear.
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.
25
+
26
+ ---
27
+
28
+ ## Before You Begin
29
+
30
+ Silently scan the project for existing context:
31
+
32
+ ```bash
33
+ ls -la 2>/dev/null | head -20
34
+ cat package.json pyproject.toml Cargo.toml go.mod README.md 2>/dev/null | head -80
35
+ cat CLAUDE.md PROJECT.md 2>/dev/null
36
+ ```
37
+
38
+ **If PROJECT.md exists with `status: complete`:**
39
+ > "This project already has a compass defined. Would you like to revisit it? If so, `/know-thy-build-evolve` is designed for that."
40
+ → Stop here unless the user explicitly wants to start fresh.
41
+
42
+ **If PROJECT.md exists with `status: drafting`:**
43
+ This is a resumed session. Read the frontmatter to restore state:
44
+ - `areasExplored` → what's already been discussed, don't re-ask
45
+ - `areasRemaining` → what's still open
46
+ - `lastCheckpoint` → where to pick up
47
+
48
+ Present what was gathered so far (from the document body) and ask:
49
+ > "We left off after exploring [lastCheckpoint]. Here's what we have so far: [brief summary]. Shall we continue from here?"
50
+
51
+ **If the project has other context** (package.json, README, etc.) → acknowledge what you see and use it as a starting point. Don't re-ask things the files already answer.
52
+
53
+ **If no PROJECT.md** → note the blank canvas and begin.
54
+
55
+ ---
56
+
57
+ ## Areas to Explore
58
+
59
+ These are the areas that make up a complete project definition. Explore them **in whatever order the conversation naturally flows**. Some users will lead with the problem. Others will start with what they want to build. Follow them.
60
+
61
+ ### Problem — The root cause
62
+
63
+ > What to discover: Why this project exists. What pain triggered it. What the root cause is, not just the symptom.
64
+
65
+ Key threads to follow (use only what's needed):
66
+ - What triggered this project? What discomfort or problem existed?
67
+ - Why is that a problem? What goes wrong if it's not solved?
68
+ - What's the root cause?
69
+ - Who suffers from this the most?
70
+ - How is it handled today? Why is that not enough?
71
+
72
+ Slots to fill:
73
+ - `{{problem_surface}}` → `{{problem_impact}}` → `{{problem_root}}`
74
+ - `{{who_suffers}}`
75
+ - `{{current_alternative}}`, `{{why_not_enough}}`
76
+
77
+ **When to move on:** You can articulate the problem in 2-3 sentences and the user confirms.
78
+
79
+ ### Vision — What does success look like?
80
+
81
+ > What to discover: The concrete change this project creates. The approach and core value.
82
+
83
+ Key threads:
84
+ - If this problem were fully solved, how would the user's day change?
85
+ - What's this project's unique approach? Why this way?
86
+ - What's the core value in one word/phrase?
87
+ - What does the user actually get? (CLI, web app, library, API...)
88
+ - Why that form?
89
+ - Open source, internal tool, or product?
90
+ - The deliverable in one sentence?
91
+
92
+ Slots to fill:
93
+ - `{{before_after}}`
94
+ - `{{unique_approach}}`, `{{why_this_way}}`
95
+ - `{{core_value}}`
96
+ - `{{output_form}}`, `{{why_this_form}}`
97
+ - `{{project_nature}}`
98
+ - `{{deliverable}}`
99
+
100
+ **When to move on:** The user can see what they're building and nods.
101
+
102
+ ### Experience & Boundaries — How is it used, and where does it end?
103
+
104
+ > What to discover: The tangible user journey, the aha moment, and the hard edges.
105
+
106
+ Key threads:
107
+ - Walk me through first encounter to getting value — like a movie scene.
108
+ - At what point does the user think "this is it!"?
109
+ - What's the most frequent action?
110
+ - What might people confuse this with, that this is NOT?
111
+ - What's the minimum for v1.0?
112
+ - How do you know this succeeded? What's the observable signal?
113
+
114
+ Slots to fill:
115
+ - `{{user_journey}}`, `{{aha_moment}}`, `{{primary_action}}`
116
+ - `{{not_this}}`
117
+ - `{{mvp_criteria}}`, `{{success_signal}}`
118
+
119
+ **When to move on:** The project has clear shape and edges.
120
+
121
+ ### Principles — What philosophy guides this?
122
+
123
+ > What to discover: The rules this project lives by. What's non-negotiable vs. flexible.
124
+
125
+ Before asking, check for existing conventions in the project files:
126
+ ```bash
127
+ cat .eslintrc* .prettierrc* tsconfig.json .editorconfig Makefile Dockerfile 2>/dev/null | head -80
128
+ ls .github/workflows/ .gitlab-ci.yml 2>/dev/null
129
+ ```
130
+
131
+ Key threads:
132
+ - Are there rules that must never be broken?
133
+ - How much autonomy should AI agents have?
134
+ - Speed vs quality, flexibility vs strictness — where does this project stand?
135
+
136
+ Accumulate as:
137
+ ```
138
+ [NON-NEGOTIABLE] {{principle_name}} → {{concrete_rule}}
139
+ [GUIDELINE] {{principle_name}} → {{concrete_rule}}
140
+ ```
141
+
142
+ **When to move on:** 2-7 principles feel right to the user. This area is optional — some projects don't need explicit principles at init time. Don't force it.
143
+
144
+ ---
145
+
146
+ ## Checkpoints & State Tracking
147
+
148
+ After exploring an area (or multiple areas that came up together), summarize what you've gathered and read it back. Ask the user to confirm or correct.
149
+
150
+ Don't checkpoint after every single question. Checkpoint when you've accumulated enough to be worth reviewing — typically after a natural cluster of questions.
151
+
152
+ **At each checkpoint, save progress to PROJECT.md** with `status: drafting`:
153
+
154
+ ```yaml
155
+ ---
156
+ status: drafting
157
+ areasExplored: [problem, vision]
158
+ areasRemaining: [experience, principles]
159
+ lastCheckpoint: vision
160
+ generatedBy: know-thy-build
161
+ ---
162
+ ```
163
+
164
+ Write the confirmed content into the document body as you go (using the template structure). This way:
165
+ - If the session breaks, the next `/know-thy-build` picks up from `lastCheckpoint`
166
+ - The user can see the document taking shape incrementally
167
+ - `areasRemaining` shrinks as the conversation progresses
168
+
169
+ Update the frontmatter every time you checkpoint. The document is the single source of truth for conversation state.
170
+
171
+ ---
172
+
173
+ ## When to Generate
174
+
175
+ Offer to generate PROJECT.md when **enough areas are covered to write a meaningful document**. Not all slots need to be filled. A PROJECT.md with a clear Problem + Vision + Deliverable is more valuable than one that forces answers to every slot.
176
+
177
+ Signs the conversation is ready:
178
+ - The user starts giving shorter, confirming answers
179
+ - The user says something like "I think that covers it"
180
+ - You can write a coherent PROJECT.md with what you have
181
+ - The conversation has a natural closing energy
182
+
183
+ When ready, present a final summary of everything gathered, then ask to proceed.
184
+
185
+ ---
186
+
187
+ ## Generate PROJECT.md
188
+
189
+ If you've been saving drafts incrementally, the document already exists. Finalize it now.
190
+ If not, write to `PROJECT.md` in the project root.
191
+
192
+ **On finalization, update frontmatter:**
193
+ ```yaml
194
+ ---
195
+ status: complete
196
+ areasExplored: [problem, vision, experience, principles] # only what was actually explored
197
+ generatedBy: know-thy-build
198
+ version: 1.0.0
199
+ date: {{date}}
200
+ ---
201
+ ```
202
+
203
+ Remove `areasRemaining` and `lastCheckpoint` — they're only for drafting state.
204
+
205
+ **Rules:**
206
+ - Only include content from the conversation. No generic filler.
207
+ - Preserve the user's actual words as much as possible.
208
+ - **Omit sections that were not discussed.** A shorter, honest document beats a padded one.
209
+ - The entire document MUST be written in {{LANG}}.
210
+
211
+ **Template structure** (write all prose in {{LANG}}, use the user's own words):
212
+
213
+ ```markdown
214
+ # {{project_name}}
215
+
216
+ <!-- One-liner: what it is + who it's for + core value. Write in {{LANG}}. -->
217
+
218
+ ## Problem
219
+
220
+ <!-- Weave into natural prose in {{LANG}}:
221
+ {{who_suffers}}, {{problem_root}}, {{problem_impact}},
222
+ {{current_alternative}}, {{why_not_enough}} -->
223
+
224
+ ## Vision
225
+
226
+ | Before | After |
227
+ |--------|-------|
228
+ | {{before}} | {{after}} |
229
+
230
+ **Approach:** {{unique_approach}}
231
+ **Why:** {{why_this_way}}
232
+
233
+ ## What We Build
234
+
235
+ | | |
236
+ |---|---|
237
+ | **Deliverable** | {{deliverable}} |
238
+ | **Form** | {{output_form}} ({{why_this_form}}) |
239
+ | **Nature** | {{project_nature}} |
240
+
241
+ ## User Journey
242
+
243
+ <!-- {{user_journey}} as natural prose in {{LANG}} -->
244
+
245
+ **Aha Moment:** {{aha_moment}}
246
+ **Primary Action:** {{primary_action}}
247
+
248
+ ## Principles
249
+
250
+ ### {{principle_name}} (NON-NEGOTIABLE)
251
+ {{concrete_rule}}
252
+
253
+ ### {{principle_name}}
254
+ {{concrete_rule}}
255
+
256
+ ## Boundaries
257
+
258
+ **This is NOT:** {{not_this}}
259
+
260
+ ## Success
261
+
262
+ **MVP:** {{mvp_criteria}}
263
+ **Success Signal:** {{success_signal}}
264
+
265
+ ---
266
+
267
+ *Generated by know-thy-build v1.0.0 | {{date}}*
268
+ ```
269
+
270
+ ## Update CLAUDE.md
271
+
272
+ If `CLAUDE.md` exists → prepend reference. If not → create minimal one.
273
+
274
+ **Reference to add:**
275
+ ```markdown
276
+ ## Project Compass
277
+ This project follows the principles defined in [PROJECT.md](./PROJECT.md).
278
+ AI agents MUST read PROJECT.md before starting any work.
279
+ NON-NEGOTIABLE rules in PROJECT.md cannot be overridden.
280
+ ```
281
+
282
+ ## Closing
283
+
284
+ Tell the user:
285
+ - PROJECT.md has been generated.
286
+ - This document is the compass for all agents working on this project.
287
+ - Run `/know-thy-build-evolve` when the project's direction shifts.