@gitwhy-cli/whyspec 0.1.17 → 0.1.18
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/dist/adapters/claude-code.d.ts +5 -10
- package/dist/adapters/claude-code.d.ts.map +1 -1
- package/dist/adapters/claude-code.js +55 -115
- package/dist/adapters/claude-code.js.map +1 -1
- package/dist/adapters/codex.d.ts.map +1 -1
- package/dist/adapters/codex.js +12 -9
- package/dist/adapters/codex.js.map +1 -1
- package/dist/adapters/types.d.ts +3 -1
- package/dist/adapters/types.d.ts.map +1 -1
- package/dist/adapters/types.js +15 -13
- package/dist/adapters/types.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +22 -28
- package/dist/commands/init.js.map +1 -1
- package/package.json +1 -1
- package/skills/whyspec-capture/SKILL.md +110 -23
- package/skills/whyspec-debug/SKILL.md +193 -309
- package/skills/whyspec-execute/SKILL.md +123 -31
- package/skills/whyspec-plan/SKILL.md +213 -52
- package/skills/whyspec-search/SKILL.md +88 -20
- package/skills/whyspec-show/SKILL.md +76 -26
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: whyspec-search
|
|
3
|
-
description:
|
|
3
|
+
description: Use when looking for why something was built a certain way or finding past decisions.
|
|
4
|
+
argument-hint: "<query> [--domain <domain>]"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
Search reasoning — find past decisions, contexts, and intent across all changes.
|
|
@@ -9,7 +10,16 @@ Search reasoning — find past decisions, contexts, and intent across all change
|
|
|
9
10
|
|
|
10
11
|
**Input**: A search query string. Optionally include `--domain <domain>` to filter by domain.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## When to Search
|
|
14
|
+
|
|
15
|
+
Search is not just a lookup tool — it's the **team knowledge check** before new work:
|
|
16
|
+
|
|
17
|
+
- **Before planning**: "Has anyone reasoned about auth in this codebase before?"
|
|
18
|
+
- **During debugging**: "Have we seen this error pattern before? What was the root cause?"
|
|
19
|
+
- **Before refactoring**: "Why was this built this way? Was it a deliberate decision or tech debt?"
|
|
20
|
+
- **During code review**: "Does this approach contradict past decisions?"
|
|
21
|
+
|
|
22
|
+
## Steps
|
|
13
23
|
|
|
14
24
|
1. **Run the search**
|
|
15
25
|
|
|
@@ -17,7 +27,7 @@ Search reasoning — find past decisions, contexts, and intent across all change
|
|
|
17
27
|
whyspec search --json "<query>"
|
|
18
28
|
```
|
|
19
29
|
|
|
20
|
-
If
|
|
30
|
+
If ARGUMENTS includes `--domain`:
|
|
21
31
|
```bash
|
|
22
32
|
whyspec search --json "<query>" --domain "<domain>"
|
|
23
33
|
```
|
|
@@ -32,38 +42,96 @@ Search reasoning — find past decisions, contexts, and intent across all change
|
|
|
32
42
|
- `path`: File path for retrieval
|
|
33
43
|
- `snippet`: Most relevant text excerpt
|
|
34
44
|
|
|
35
|
-
2. **Display results with scores
|
|
45
|
+
2. **Display results with scores AND reasoning snippets**
|
|
36
46
|
|
|
37
|
-
|
|
38
|
-
|
|
47
|
+
<examples>
|
|
48
|
+
<good>
|
|
49
|
+
## Search: "authentication"
|
|
39
50
|
|
|
40
|
-
Found
|
|
51
|
+
Found 3 results:
|
|
41
52
|
|
|
42
|
-
1. [score: 130] **JWT
|
|
53
|
+
1. [score: 130] **JWT Auth with RS256** (add-auth)
|
|
43
54
|
Domain: authentication | Matched: title, reasoning
|
|
44
|
-
> "Chose RS256 over HS256 — allows key rotation without redeploying
|
|
55
|
+
> "Chose RS256 over HS256 — allows key rotation without redeploying.
|
|
56
|
+
> Session stored in httpOnly cookie, not localStorage (XSS protection).
|
|
57
|
+
> Token expiry: 15min access, 7d refresh — balances security vs UX."
|
|
58
|
+
|
|
59
|
+
This decision affects your current work if you're touching auth tokens
|
|
60
|
+
or session management.
|
|
45
61
|
|
|
46
62
|
2. [score: 30] **Database Migration Plan** (migrate-db)
|
|
47
63
|
Domain: database | Matched: reasoning
|
|
48
|
-
> "Considered token storage in DB but rejected — latency
|
|
64
|
+
> "Considered token storage in DB but rejected — added 3ms latency per
|
|
65
|
+
> request. Chose Redis for session cache instead (src/lib/redis.ts)."
|
|
49
66
|
|
|
50
67
|
3. [score: 20] **API Rate Limiting** (add-rate-limits)
|
|
51
68
|
Domain: api | Matched: files
|
|
52
|
-
> "src/auth
|
|
53
|
-
|
|
69
|
+
> "src/middleware/auth.ts — modified to extract JWT sub claim for
|
|
70
|
+
> per-user rate limiting after authentication."
|
|
71
|
+
|
|
72
|
+
View full story: `/whyspec:show add-auth`
|
|
73
|
+
Narrow by domain: `/whyspec:search "authentication" --domain auth`
|
|
74
|
+
Why good: Shows the actual reasoning from past decisions. A developer
|
|
75
|
+
searching for "authentication" immediately sees WHY RS256 was chosen,
|
|
76
|
+
WHY httpOnly cookies, and WHERE token decisions connect to rate limiting.
|
|
77
|
+
The annotation "This decision affects..." connects past to present.
|
|
78
|
+
</good>
|
|
79
|
+
|
|
80
|
+
<bad>
|
|
81
|
+
## Search: "authentication"
|
|
82
|
+
|
|
83
|
+
Found 3 results:
|
|
84
|
+
|
|
85
|
+
1. **add-auth** — JWT Authentication Setup
|
|
86
|
+
2. **migrate-db** — Database Migration Plan
|
|
87
|
+
3. **add-rate-limits** — API Rate Limiting
|
|
88
|
+
|
|
89
|
+
Why bad: Just titles with no reasoning snippets. The developer has to
|
|
90
|
+
open each one to find the relevant decision. Defeats the purpose of search.
|
|
91
|
+
</bad>
|
|
92
|
+
|
|
93
|
+
<good>
|
|
94
|
+
## Search: "why is the session timeout 15 minutes"
|
|
95
|
+
|
|
96
|
+
No results found for "why is the session timeout 15 minutes".
|
|
97
|
+
|
|
98
|
+
Suggestions:
|
|
99
|
+
- Try broader terms: "session", "timeout", "token expiry"
|
|
100
|
+
- Search by domain: `/whyspec:search "session" --domain auth`
|
|
101
|
+
- Check if this decision was captured: maybe it predates WhySpec adoption
|
|
102
|
+
Why good: Empty results get helpful guidance, not a dead end.
|
|
103
|
+
</good>
|
|
104
|
+
|
|
105
|
+
<bad>
|
|
106
|
+
## Search: "why is the session timeout 15 minutes"
|
|
107
|
+
|
|
108
|
+
No results found.
|
|
109
|
+
Why bad: Dead end. No help. User is stuck.
|
|
110
|
+
</bad>
|
|
111
|
+
</examples>
|
|
112
|
+
|
|
113
|
+
3. **Connect results to the current context**
|
|
114
|
+
|
|
115
|
+
If the search was triggered during planning or debugging, connect the findings:
|
|
116
|
+
- During `/whyspec:plan`: "Past decision in add-auth chose RS256 — your new feature should be compatible with this."
|
|
117
|
+
- During `/whyspec:debug`: "Similar bug was investigated in debug-token-expiry — root cause was clock skew between services."
|
|
118
|
+
- Standalone: Offer follow-up actions: `/whyspec:show <name>` or narrower search.
|
|
54
119
|
|
|
55
|
-
|
|
120
|
+
## Tools
|
|
56
121
|
|
|
57
|
-
|
|
122
|
+
| Tool | When to use | When NOT to use |
|
|
123
|
+
|------|------------|-----------------|
|
|
124
|
+
| **Bash** | Run `whyspec search --json "<query>"` — the primary search mechanism | Don't search manually with grep |
|
|
125
|
+
| **Read** | Follow up on results — read full context files when the snippet isn't enough | Don't read every result; focus on high-scoring ones |
|
|
126
|
+
| **Grep** | Supplement: search code for implementations referenced in search results | Don't use grep as a replacement for whyspec search |
|
|
58
127
|
|
|
59
|
-
|
|
60
|
-
- "View full story: `/whyspec-show <change-name>`"
|
|
61
|
-
- "Narrow by domain: `/whyspec-search \"<query>\" --domain <domain>`"
|
|
128
|
+
No AskUserQuestion — this is a display-only skill. Show results and offer follow-up commands.
|
|
62
129
|
|
|
63
|
-
|
|
130
|
+
## Guardrails
|
|
64
131
|
|
|
65
|
-
- **Always show scores** — include the relevance score so the user understands
|
|
132
|
+
- **Always show scores** — include the relevance score so the user understands ranking.
|
|
66
133
|
- **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
|
|
134
|
+
- **Handle empty results helpfully** — suggest broader terms, different keywords, or domain filters. Never just say "No results."
|
|
68
135
|
- **Don't fabricate results** — only display what the CLI returns. Never synthesize or guess at matches.
|
|
136
|
+
- **Connect past to present** — when results are clearly relevant to ongoing work, say so explicitly.
|
|
69
137
|
- **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,6 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: whyspec-show
|
|
3
|
-
description:
|
|
3
|
+
description: Use when reviewing the full story of a change — intent, design, tasks, and Decision Bridge delta.
|
|
4
|
+
argument-hint: "[change-name]"
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
Show the full story — from intent through design, tasks, and reasoning — with the Decision Bridge delta.
|
|
@@ -9,7 +10,18 @@ Show the full story — from intent through design, tasks, and reasoning — wit
|
|
|
9
10
|
|
|
10
11
|
**Input**: A change name. If omitted, prompt for available changes.
|
|
11
12
|
|
|
12
|
-
|
|
13
|
+
## What Makes a Good Story
|
|
14
|
+
|
|
15
|
+
The show command doesn't just dump files — it tells the **narrative arc** of a change:
|
|
16
|
+
1. **Intent** — Why did we start this? What pain existed?
|
|
17
|
+
2. **Design** — How did we plan to solve it? What trade-offs did we consider?
|
|
18
|
+
3. **Tasks** — What concrete work was done? How much is complete?
|
|
19
|
+
4. **Reasoning** — What actually happened? What surprised us?
|
|
20
|
+
5. **Decision Bridge** — How did our thinking evolve from plan to reality?
|
|
21
|
+
|
|
22
|
+
The Decision Bridge delta is the most valuable output — it reveals the gap between what we THOUGHT we'd do and what we ACTUALLY did.
|
|
23
|
+
|
|
24
|
+
## Steps
|
|
13
25
|
|
|
14
26
|
1. **Get the full story from CLI**
|
|
15
27
|
|
|
@@ -27,7 +39,7 @@ Show the full story — from intent through design, tasks, and reasoning — wit
|
|
|
27
39
|
|
|
28
40
|
If no change name provided:
|
|
29
41
|
- Run `whyspec list --json` to get available changes
|
|
30
|
-
-
|
|
42
|
+
- Let the user select
|
|
31
43
|
|
|
32
44
|
2. **Display the full story as a narrative arc**
|
|
33
45
|
|
|
@@ -35,56 +47,94 @@ Show the full story — from intent through design, tasks, and reasoning — wit
|
|
|
35
47
|
# <Change Name>
|
|
36
48
|
|
|
37
49
|
## Intent (WHY)
|
|
38
|
-
|
|
39
50
|
[From intent.md — problem statement, what it enables, constraints, success criteria]
|
|
40
51
|
|
|
41
52
|
## Design (HOW)
|
|
42
|
-
|
|
43
53
|
[From design.md — approach, architecture, trade-offs considered]
|
|
44
54
|
|
|
45
55
|
## Tasks (WHAT)
|
|
46
|
-
|
|
47
56
|
[From tasks.md — task list with completion status]
|
|
48
57
|
Progress: N/M tasks complete
|
|
49
58
|
|
|
50
59
|
## Reasoning (AFTER)
|
|
51
|
-
|
|
52
60
|
[From ctx_<id>.md — story of what happened, decisions made, trade-offs accepted]
|
|
53
61
|
```
|
|
54
62
|
|
|
55
|
-
If context hasn't been captured yet
|
|
63
|
+
If context hasn't been captured yet:
|
|
56
64
|
```
|
|
57
65
|
## Reasoning (AFTER)
|
|
58
|
-
|
|
59
|
-
Not yet captured. Run /whyspec-capture to complete the story.
|
|
66
|
+
Not yet captured. Run /whyspec:capture to complete the story.
|
|
60
67
|
```
|
|
61
68
|
|
|
62
69
|
3. **Highlight the Decision Bridge Delta**
|
|
63
70
|
|
|
64
71
|
When both plan files and context exist, display the evolution:
|
|
65
72
|
|
|
66
|
-
|
|
73
|
+
<examples>
|
|
74
|
+
<good>
|
|
67
75
|
## Decision Bridge
|
|
68
76
|
|
|
69
|
-
| Decision | Planned (Before) | Actual (After) |
|
|
70
|
-
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
| [Unresolved item] | X vs Y? | — | Pending |
|
|
77
|
+
| Decision | Planned (Before) | Actual (After) | Delta |
|
|
78
|
+
|----------|-------------------|----------------|-------|
|
|
79
|
+
| Rate limit storage | Redis vs in-memory? | Redis — 3 instances need shared state | As planned |
|
|
80
|
+
| Limit granularity | per-IP vs per-token? | Both — IP for anon, token for auth'd | Expanded scope |
|
|
81
|
+
| 429 response | standard vs custom? | Standard + Retry-After header | As planned |
|
|
75
82
|
|
|
76
83
|
### Surprises (not in original plan)
|
|
84
|
+
- **Added X-Request-ID middleware** — needed for debugging 429 responses.
|
|
85
|
+
Impact: New dependency on uuid package, new middleware in chain.
|
|
86
|
+
- **Changed Redis key schema to sorted sets** — sliding window algorithm
|
|
87
|
+
requires sorted sets, not simple strings. Affects memory profile.
|
|
88
|
+
|
|
89
|
+
### Delta Summary
|
|
90
|
+
- 3 planned decisions: 2 as planned, 1 expanded scope
|
|
91
|
+
- 2 surprises: both additive (no plan contradictions)
|
|
92
|
+
- Design alignment: HIGH — implementation closely followed the plan
|
|
93
|
+
Why good: Every decision shows BEFORE (question) and AFTER (answer + rationale).
|
|
94
|
+
Surprises are documented with impact. Delta summary gives the big picture.
|
|
95
|
+
The "Expanded scope" and "As planned" labels make evolution visible at a glance.
|
|
96
|
+
</good>
|
|
97
|
+
|
|
98
|
+
<bad>
|
|
99
|
+
## Decision Bridge
|
|
77
100
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
101
|
+
| Decision | Status |
|
|
102
|
+
|----------|--------|
|
|
103
|
+
| Storage | Done |
|
|
104
|
+
| Limit scope | Done |
|
|
105
|
+
| 429 response | Done |
|
|
106
|
+
Why bad: No before/after comparison. "Done" tells you nothing about what
|
|
107
|
+
was decided or why. The entire point of the Decision Bridge is showing
|
|
108
|
+
how thinking evolved.
|
|
109
|
+
</bad>
|
|
110
|
+
</examples>
|
|
111
|
+
|
|
112
|
+
4. **Handle partial stories gracefully**
|
|
113
|
+
|
|
114
|
+
Not every change has all files. Show what exists and guide the user:
|
|
115
|
+
|
|
116
|
+
| Missing | What to show | Suggestion |
|
|
117
|
+
|---------|-------------|------------|
|
|
118
|
+
| No design.md | Intent + Tasks only | "Design not captured. Was this a quick fix?" |
|
|
119
|
+
| No tasks.md | Intent + Design only | "No tasks defined. Run `/whyspec:execute` to start." |
|
|
120
|
+
| No context | Intent + Design + Tasks | "Reasoning not captured yet. Run `/whyspec:capture`." |
|
|
121
|
+
| No intent (shouldn't happen) | Whatever exists | "Intent missing — this change may not have been planned with WhySpec." |
|
|
122
|
+
| Tasks partially done | Show progress bar | "Progress: ███░░ 3/5 tasks — resume with `/whyspec:execute <name>`" |
|
|
123
|
+
|
|
124
|
+
## Tools
|
|
125
|
+
|
|
126
|
+
| Tool | When to use | When NOT to use |
|
|
127
|
+
|------|------------|-----------------|
|
|
128
|
+
| **Bash** | Run `whyspec show --json "<name>"` and `whyspec list --json` | Don't modify anything — this is read-only |
|
|
129
|
+
| **Read** | Read raw files if CLI output is insufficient or truncated | Don't read files the CLI already provided |
|
|
81
130
|
|
|
82
|
-
|
|
131
|
+
No AskUserQuestion — this is a read-only display skill. If change name is missing, use `whyspec list --json` and let the user select.
|
|
83
132
|
|
|
84
|
-
|
|
133
|
+
## Guardrails
|
|
85
134
|
|
|
86
|
-
- **Show all available phases** — always display intent, design, tasks, and context (if present). Don't skip sections
|
|
87
|
-
- **Always show the Decision Bridge delta** — when both plan and context exist, the delta table is mandatory.
|
|
88
|
-
- **Handle missing files gracefully** —
|
|
135
|
+
- **Show all available phases** — always display intent, design, tasks, and context (if present). Don't skip sections.
|
|
136
|
+
- **Always show the Decision Bridge delta** — when both plan and context exist, the delta table is mandatory.
|
|
137
|
+
- **Handle missing files gracefully** — show what's available, note what's missing, suggest the command to fill gaps.
|
|
89
138
|
- **Read-only** — this skill displays information. It never modifies files.
|
|
90
|
-
- **Show completion status** — for tasks,
|
|
139
|
+
- **Show completion status** — for tasks, show N/M complete. For the Decision Bridge, show resolved vs pending counts.
|
|
140
|
+
- **Tell the story, don't dump data** — organize output as a narrative arc, not a raw file concatenation.
|