@gitwhy-cli/whyspec 0.1.17 → 0.1.19

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.
@@ -1,118 +0,0 @@
1
- ---
2
- name: whyspec-execute
3
- description: Implement a planned change using intent and design as context. Use when the user wants to start implementing, continue work, or execute tasks from a WhySpec plan.
4
- ---
5
-
6
- Implement a change — read the plan, work through tasks, commit atomically.
7
-
8
- When all tasks are done, run `/whyspec-capture` to save your reasoning.
9
-
10
- ---
11
-
12
- **Input**: Optionally specify a change name. If omitted, auto-detect or prompt for available changes.
13
-
14
- **Steps**
15
-
16
- 1. **Select the change**
17
-
18
- If a name is provided, use it. Otherwise:
19
- - Auto-select if only one active change exists
20
- - If multiple changes exist, run `whyspec list --json` and use **AskUserQuestion** to let the user select
21
-
22
- Always announce: "Executing change: **<name>**"
23
-
24
- 2. **Load execution context**
25
-
26
- ```bash
27
- whyspec execute --json "<name>"
28
- ```
29
-
30
- Parse the JSON response:
31
- - `change_name`: The change being executed
32
- - `intent`: Content of intent.md
33
- - `design`: Content of design.md
34
- - `tasks`: Content of tasks.md
35
- - `progress`: `{ total, completed, remaining }`
36
- - `pending_tasks`: Array of uncompleted tasks
37
-
38
- 3. **Read plan files for context**
39
-
40
- Read the full content of these files from the change folder:
41
- - `intent.md` — understand WHY this change exists, what constraints apply
42
- - `design.md` — understand HOW to approach it, what decisions are pending
43
- - `tasks.md` — understand WHAT to implement and how to verify
44
-
45
- Keep intent and design in mind throughout implementation. When making a decision during coding, check if it's listed under "Decisions to Make" — you're resolving the Decision Bridge in real-time.
46
-
47
- 4. **Show current progress**
48
-
49
- ```
50
- ## Executing: <name>
51
-
52
- Progress: N/M tasks complete
53
- Remaining:
54
- - [ ] Task description 1
55
- - [ ] Task description 2
56
- ...
57
- ```
58
-
59
- 5. **Implement tasks sequentially**
60
-
61
- For each pending task:
62
-
63
- a. Show: `Working on task N/M: <description>`
64
- b. Implement the code changes
65
- c. Mark task complete in tasks.md: `- [ ]` → `- [x]`
66
- d. Run the task's `verify:` check if one is defined
67
- e. Commit atomically — one commit per task or logical unit
68
- f. Continue to next task
69
-
70
- **Pause if:**
71
- - Task is unclear or ambiguous → use **AskUserQuestion** to clarify before implementing
72
- - Implementation reveals a design issue → suggest updating design.md, ask user how to proceed
73
- - Task contradicts the stated intent → flag the contradiction to the user
74
- - Error or blocker encountered → report what happened and wait for guidance
75
- - You're unsure about a "Decision to Make" from design.md → ask the user to resolve it
76
-
77
- 6. **On completion**
78
-
79
- When all tasks are done:
80
-
81
- ```
82
- ## Implementation Complete
83
-
84
- Change: <name>
85
- Progress: M/M tasks complete
86
-
87
- Completed:
88
- - [x] Task 1: description
89
- - [x] Task 2: description
90
- ...
91
-
92
- Ready to capture reasoning? Run /whyspec-capture
93
- ```
94
-
95
- If paused before completion:
96
-
97
- ```
98
- ## Implementation Paused
99
-
100
- Change: <name>
101
- Progress: N/M tasks complete
102
-
103
- Issue: <what caused the pause>
104
-
105
- Resume with: /whyspec-execute <name>
106
- ```
107
-
108
- **Always end with the capture prompt** — the reasoning is freshest right after implementation.
109
-
110
- **Guardrails**
111
-
112
- - **Read intent.md before coding** — every implementation decision should align with the stated intent and constraints.
113
- - **Never skip tasks** — work through all tasks in order. If a task seems unnecessary, ask the user to remove it rather than silently skipping.
114
- - **Commit atomically** — one commit per task or logical unit. Don't batch all changes into one commit.
115
- - **Pause on unclear tasks** — don't guess at ambiguous requirements. Ask for clarification.
116
- - **Pause on design issues** — if reality doesn't match the plan, stop and suggest design.md updates before continuing.
117
- - **Mark checkboxes immediately** — update tasks.md after each task completion, not at the end.
118
- - **Always prompt capture** — end every execution session (complete or paused) with the `/whyspec-capture` suggestion.
@@ -1,170 +0,0 @@
1
- ---
2
- name: whyspec-plan
3
- description: Plan a change by declaring intent, design, and tasks before coding. Use when the user wants to plan what to build, capture decisions that need to be made, or set up the Decision Bridge before implementation.
4
- ---
5
-
6
- Plan a change — create intent.md, design.md, and tasks.md with the Decision Bridge.
7
-
8
- When ready to implement, run `/whyspec-execute`
9
-
10
- ---
11
-
12
- **Input**: A change name (kebab-case) or description of what to build.
13
-
14
- **Steps**
15
-
16
- 1. **Ask forcing questions before anything else**
17
-
18
- Do NOT create any files yet. Use the **AskUserQuestion tool** to ask these questions — they shape the entire plan:
19
-
20
- First ask:
21
- > "What problem does this solve? Who feels this pain today?"
22
-
23
- Then, building on their answer:
24
- > "What constraints exist? (technical limits, timeline, dependencies, things that can't change)"
25
-
26
- Finally:
27
- > "How will you know it works? What does success look like?"
28
-
29
- If the user provides a rich description upfront that already answers these, you may condense to one clarifying question. But never skip entirely.
30
-
31
- 2. **Create the change folder**
32
-
33
- Derive a kebab-case name from the user's input (e.g., "add user authentication" → `add-user-auth`).
34
-
35
- ```bash
36
- whyspec plan --json "<name>"
37
- ```
38
-
39
- Parse the JSON response:
40
- - `path`: The change directory (e.g., `.gitwhy/changes/add-auth/`)
41
- - `templates`: Template content for intent.md, design.md, tasks.md
42
- - `context`: Project context from config.yaml (constraints for you — do NOT copy into files)
43
- - `rules`: Project-specific rules (constraints for you — do NOT copy into files)
44
-
45
- If a change with that name already exists, use **AskUserQuestion** to ask: continue the existing change, or create a new one with a different name?
46
-
47
- 3. **Create intent.md**
48
-
49
- Write to `<path>/intent.md`. Populate using the user's answers to the forcing questions:
50
-
51
- ```markdown
52
- ## Why This Change Exists
53
-
54
- [Problem statement — from forcing question 1. Be specific about who feels the pain.]
55
-
56
- ## What It Enables
57
-
58
- [Capabilities this unlocks. What becomes possible that wasn't before?]
59
-
60
- ## Decisions to Make
61
-
62
- - [ ] [Decision 1: option A vs option B?]
63
- - [ ] [Decision 2: approach X vs approach Y?]
64
- - [ ] [Decision 3: ...]
65
-
66
- These checkboxes form the "before" side of the Decision Bridge.
67
- They will be resolved during /whyspec-capture after implementation.
68
-
69
- ## Constraints
70
-
71
- [From forcing question 2 — technical limits, non-negotiables, dependencies]
72
-
73
- ## Success Looks Like
74
-
75
- [From forcing question 3 — observable outcomes, acceptance criteria]
76
-
77
- ## Assumptions
78
-
79
- [What we're assuming is true but haven't verified]
80
- ```
81
-
82
- **IMPORTANT**: The "Decisions to Make" checkboxes are the Decision Bridge. Every design choice that isn't settled yet MUST be listed here. These get resolved in the context file after implementation.
83
-
84
- 4. **Create design.md**
85
-
86
- Write to `<path>/design.md`:
87
-
88
- ```markdown
89
- ## Approach
90
-
91
- [Chosen technical direction — 2-3 sentences on the high-level strategy]
92
-
93
- ## Trade-off Matrix
94
-
95
- | Option | [Criterion 1] | [Criterion 2] | [Criterion 3] |
96
- |--------|---------------|---------------|---------------|
97
- | Option A | ... | ... | ... |
98
- | Option B | ... | ... | ... |
99
-
100
- ## Architecture
101
-
102
- [ASCII diagram showing the design — components, data flow, boundaries]
103
-
104
- ## Questions to Resolve
105
-
106
- - [ ] [Open question needing an answer before or during coding]
107
- - [ ] [Another open question]
108
-
109
- ## Risks & Unknowns
110
-
111
- - [What could go wrong]
112
- - [What we don't know yet]
113
-
114
- ## Dependencies
115
-
116
- - [External libraries, APIs, services, other teams' work]
117
- ```
118
-
119
- 5. **Create tasks.md**
120
-
121
- Write to `<path>/tasks.md`. **Define verification FIRST** — goal-backward planning means you know what success looks like before listing tasks:
122
-
123
- ```markdown
124
- ## Verification
125
-
126
- What proves this change works — defined BEFORE tasks:
127
-
128
- - [ ] [Verification criterion 1 — e.g., "all auth tests pass"]
129
- - [ ] [Verification criterion 2 — e.g., "login flow works end-to-end"]
130
-
131
- ## Tasks
132
-
133
- - [ ] Task 1: [description]
134
- verify: [how to verify this specific task]
135
- - [ ] Task 2: [description]
136
- verify: [verification step]
137
- - [ ] Task 3: [description]
138
- verify: [verification step]
139
- ```
140
-
141
- Each task should be small enough for one atomic commit. Include a `verify:` line where meaningful.
142
-
143
- 6. **Show summary**
144
-
145
- Display:
146
-
147
- ```
148
- ## Plan Created: <name>
149
-
150
- <path>/
151
- intent.md — WHY: problem, constraints, success criteria
152
- design.md — HOW: approach, trade-offs, decisions to make
153
- tasks.md — WHAT: verification criteria + implementation checklist
154
-
155
- Decisions to make: N pending
156
- Questions to resolve: N open
157
- Tasks: N defined
158
-
159
- Ready to implement? Run /whyspec-execute
160
- ```
161
-
162
- **Guardrails**
163
-
164
- - **Ask forcing questions FIRST** — never create files before asking. The questions shape the plan quality.
165
- - **Don't implement code** — this skill creates plan files only. Implementation happens in `/whyspec-execute`.
166
- - **Don't skip "Decisions to Make"** — every unsettled design choice must be a checkbox. These are the Decision Bridge. If the user hasn't mentioned trade-offs, ask: "What decisions haven't been made yet?"
167
- - **Use CLI-as-oracle** — always call `whyspec plan --json` to create the folder. Don't create paths or generate IDs manually.
168
- - **Apply `context` and `rules` as constraints** — they guide your writing but must NOT appear in the output files.
169
- - **Verification before tasks** — in tasks.md, define what "done" looks like before listing the work to do.
170
- - **Don't over-design** — if the user describes a small fix, create proportionally small plan files. Not every change needs a full trade-off matrix.
@@ -1,69 +0,0 @@
1
- ---
2
- name: whyspec-search
3
- description: Search past reasoning, decisions, and contexts across all changes. Use when looking for why something was built a certain way, finding past decisions, or discovering institutional knowledge.
4
- ---
5
-
6
- Search reasoning — find past decisions, contexts, and intent across all changes.
7
-
8
- ---
9
-
10
- **Input**: A search query string. Optionally include `--domain <domain>` to filter by domain.
11
-
12
- **Steps**
13
-
14
- 1. **Run the search**
15
-
16
- ```bash
17
- whyspec search --json "<query>"
18
- ```
19
-
20
- If a domain filter is specified:
21
- ```bash
22
- whyspec search --json "<query>" --domain "<domain>"
23
- ```
24
-
25
- Parse the JSON response — an array of scored results, each containing:
26
- - `id`: Context ID (e.g., `ctx_a1b2c3d4`) or file identifier
27
- - `title`: Context or intent title
28
- - `change_name`: Name of the change
29
- - `domain`: Auto-detected or specified domain
30
- - `score`: Relevance score (title=100, reasoning=30, files=20, general=10)
31
- - `matched_sections`: Which sections matched (title, reasoning, files, etc.)
32
- - `path`: File path for retrieval
33
- - `snippet`: Most relevant text excerpt
34
-
35
- 2. **Display results with scores and snippets**
36
-
37
- ```
38
- ## Search: "<query>"
39
-
40
- Found N results:
41
-
42
- 1. [score: 130] **JWT Authentication Setup** (add-auth)
43
- Domain: authentication | Matched: title, reasoning
44
- > "Chose RS256 over HS256 — allows key rotation without redeploying"
45
-
46
- 2. [score: 30] **Database Migration Plan** (migrate-db)
47
- Domain: database | Matched: reasoning
48
- > "Considered token storage in DB but rejected — latency concerns"
49
-
50
- 3. [score: 20] **API Rate Limiting** (add-rate-limits)
51
- Domain: api | Matched: files
52
- > "src/auth/middleware.ts — modified"
53
- ```
54
-
55
- For each result, show the most relevant decision or reasoning snippet — not just the title.
56
-
57
- 3. **Offer follow-up actions**
58
-
59
- After displaying results:
60
- - "View full story: `/whyspec-show <change-name>`"
61
- - "Narrow by domain: `/whyspec-search \"<query>\" --domain <domain>`"
62
-
63
- **Guardrails**
64
-
65
- - **Always show scores** — include the relevance score so the user understands why results are ranked.
66
- - **Always show snippets** — the reasoning excerpt is more useful than titles alone. Show the most relevant decision or trade-off text.
67
- - **Handle empty results clearly** — if nothing matches, say "No results found for '<query>'" and suggest broader search terms or different keywords.
68
- - **Don't fabricate results** — only display what the CLI returns. Never synthesize or guess at matches.
69
- - **Search includes plan files** — the CLI searches intent.md and design.md too, not just context files. This finds planned decisions that haven't been captured yet.
@@ -1,90 +0,0 @@
1
- ---
2
- name: whyspec-show
3
- description: Display the full story of a change — intent, design, tasks, and reasoning — with the Decision Bridge delta showing how decisions evolved from plan to implementation.
4
- ---
5
-
6
- Show the full story — from intent through design, tasks, and reasoning — with the Decision Bridge delta.
7
-
8
- ---
9
-
10
- **Input**: A change name. If omitted, prompt for available changes.
11
-
12
- **Steps**
13
-
14
- 1. **Get the full story from CLI**
15
-
16
- ```bash
17
- whyspec show --json "<name>"
18
- ```
19
-
20
- Parse the JSON response:
21
- - `intent`: Content of intent.md
22
- - `design`: Content of design.md
23
- - `tasks`: Content of tasks.md with completion status
24
- - `context`: Content of ctx_<id>.md (if captured)
25
- - `decision_bridge_delta`: Computed delta of planned vs actual decisions
26
- - `surprises`: Decisions not in the original plan
27
-
28
- If no change name provided:
29
- - Run `whyspec list --json` to get available changes
30
- - Use **AskUserQuestion** to let the user select
31
-
32
- 2. **Display the full story as a narrative arc**
33
-
34
- ```
35
- # <Change Name>
36
-
37
- ## Intent (WHY)
38
-
39
- [From intent.md — problem statement, what it enables, constraints, success criteria]
40
-
41
- ## Design (HOW)
42
-
43
- [From design.md — approach, architecture, trade-offs considered]
44
-
45
- ## Tasks (WHAT)
46
-
47
- [From tasks.md — task list with completion status]
48
- Progress: N/M tasks complete
49
-
50
- ## Reasoning (AFTER)
51
-
52
- [From ctx_<id>.md — story of what happened, decisions made, trade-offs accepted]
53
- ```
54
-
55
- If context hasn't been captured yet, show:
56
- ```
57
- ## Reasoning (AFTER)
58
-
59
- Not yet captured. Run /whyspec-capture to complete the story.
60
- ```
61
-
62
- 3. **Highlight the Decision Bridge Delta**
63
-
64
- When both plan files and context exist, display the evolution:
65
-
66
- ```
67
- ## Decision Bridge
68
-
69
- | Decision | Planned (Before) | Actual (After) | Status |
70
- |----------|-------------------|----------------|--------|
71
- | Token storage | cookie vs localStorage? | httpOnly cookie — XSS protection | Resolved |
72
- | Hashing algorithm | bcrypt vs argon2? | bcrypt — better library support | Resolved |
73
- | Session strategy | JWT vs server-side? | JWT — no session store needed | Resolved |
74
- | [Unresolved item] | X vs Y? | — | Pending |
75
-
76
- ### Surprises (not in original plan)
77
-
78
- - Added 2FA — security review required it
79
- - Added rate limiting on login — discovered during load testing
80
- ```
81
-
82
- The delta is the most valuable output of `/whyspec-show` — it reveals how thinking evolved from plan to reality.
83
-
84
- **Guardrails**
85
-
86
- - **Show all available phases** — always display intent, design, tasks, and context (if present). Don't skip sections even if they're short.
87
- - **Always show the Decision Bridge delta** — when both plan and context exist, the delta table is mandatory. It's the core differentiator.
88
- - **Handle missing files gracefully** — if some files don't exist, show what's available and note what's missing. Suggest the appropriate command to fill gaps.
89
- - **Read-only** — this skill displays information. It never modifies files.
90
- - **Show completion status** — for tasks, always show N/M complete. For the Decision Bridge, show how many decisions were resolved vs pending.