@codename_inc/spectre 3.7.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.
Files changed (64) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +411 -0
  3. package/bin/spectre.js +8 -0
  4. package/package.json +23 -0
  5. package/plugins/spectre/.claude-plugin/plugin.json +5 -0
  6. package/plugins/spectre/agents/analyst.md +122 -0
  7. package/plugins/spectre/agents/dev.md +70 -0
  8. package/plugins/spectre/agents/finder.md +105 -0
  9. package/plugins/spectre/agents/patterns.md +207 -0
  10. package/plugins/spectre/agents/reviewer.md +128 -0
  11. package/plugins/spectre/agents/sync.md +151 -0
  12. package/plugins/spectre/agents/tester.md +209 -0
  13. package/plugins/spectre/agents/web-research.md +109 -0
  14. package/plugins/spectre/commands/architecture_review.md +120 -0
  15. package/plugins/spectre/commands/clean.md +313 -0
  16. package/plugins/spectre/commands/code_review.md +408 -0
  17. package/plugins/spectre/commands/create_plan.md +117 -0
  18. package/plugins/spectre/commands/create_tasks.md +374 -0
  19. package/plugins/spectre/commands/create_test_guide.md +120 -0
  20. package/plugins/spectre/commands/evaluate.md +50 -0
  21. package/plugins/spectre/commands/execute.md +87 -0
  22. package/plugins/spectre/commands/fix.md +61 -0
  23. package/plugins/spectre/commands/forget.md +58 -0
  24. package/plugins/spectre/commands/handoff.md +161 -0
  25. package/plugins/spectre/commands/kickoff.md +115 -0
  26. package/plugins/spectre/commands/learn.md +15 -0
  27. package/plugins/spectre/commands/plan.md +170 -0
  28. package/plugins/spectre/commands/plan_review.md +33 -0
  29. package/plugins/spectre/commands/quick_dev.md +101 -0
  30. package/plugins/spectre/commands/rebase.md +73 -0
  31. package/plugins/spectre/commands/recall.md +5 -0
  32. package/plugins/spectre/commands/research.md +159 -0
  33. package/plugins/spectre/commands/scope.md +119 -0
  34. package/plugins/spectre/commands/ship.md +172 -0
  35. package/plugins/spectre/commands/sweep.md +82 -0
  36. package/plugins/spectre/commands/test.md +380 -0
  37. package/plugins/spectre/commands/ux_spec.md +91 -0
  38. package/plugins/spectre/commands/validate.md +343 -0
  39. package/plugins/spectre/hooks/hooks.json +34 -0
  40. package/plugins/spectre/hooks/scripts/bootstrap.cjs +99 -0
  41. package/plugins/spectre/hooks/scripts/handoff-resume.cjs +410 -0
  42. package/plugins/spectre/hooks/scripts/lib.cjs +83 -0
  43. package/plugins/spectre/hooks/scripts/load-knowledge.cjs +120 -0
  44. package/plugins/spectre/hooks/scripts/precompact-warning.cjs +19 -0
  45. package/plugins/spectre/hooks/scripts/register_learning.cjs +144 -0
  46. package/plugins/spectre/hooks/scripts/test_bootstrap.cjs +84 -0
  47. package/plugins/spectre/hooks/scripts/test_handoff-resume.cjs +858 -0
  48. package/plugins/spectre/hooks/scripts/test_load-knowledge.cjs +285 -0
  49. package/plugins/spectre/hooks/scripts/test_register-learning.cjs +146 -0
  50. package/plugins/spectre/skills/spectre-apply/SKILL.md +189 -0
  51. package/plugins/spectre/skills/spectre-guide/SKILL.md +358 -0
  52. package/plugins/spectre/skills/spectre-learn/SKILL.md +635 -0
  53. package/plugins/spectre/skills/spectre-learn/references/recall-template.md +31 -0
  54. package/plugins/spectre/skills/spectre-tdd/SKILL.md +111 -0
  55. package/src/config.test.js +134 -0
  56. package/src/install.test.js +273 -0
  57. package/src/lib/config.js +516 -0
  58. package/src/lib/constants.js +60 -0
  59. package/src/lib/doctor.js +168 -0
  60. package/src/lib/install.js +482 -0
  61. package/src/lib/knowledge.js +217 -0
  62. package/src/lib/paths.js +98 -0
  63. package/src/lib/project.js +473 -0
  64. package/src/main.js +150 -0
@@ -0,0 +1,635 @@
1
+ ---
2
+ name: spectre-learn
3
+ description: Use when user invokes /learn or wants to save patterns, decisions, gotchas, procedures, or feature knowledge from a conversation for later re-use. Look for user requests like "please remember" or "what did we learn from this?".
4
+ ---
5
+
6
+ # Learning Agent
7
+
8
+ You capture durable project knowledge into Skills that Claude Code loads on-demand.
9
+
10
+ <CRITICAL>
11
+ ## Exclusive Knowledge Handler
12
+
13
+ When this skill is invoked (via `/learn`, `/spectre:learn`, or `Skill(spectre-learn)`), it is the **exclusive handler** for knowledge capture. It supersedes ALL other memory systems.
14
+
15
+ **Do NOT**:
16
+ - Write to `MEMORY.md` or any auto-memory directory
17
+ - Use any other memory/note system to store the knowledge
18
+ - Shortcut to a simpler storage mechanism
19
+
20
+ **Do**:
21
+ - Follow this skill's workflow exactly (Steps 1–14)
22
+ - Write skill files to `{{project_root}}/.claude/skills/{category}-{slug}/SKILL.md`
23
+ - Register in `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
24
+ - Regenerate the recall skill
25
+
26
+ This is not informational context — it is a **binding set of instructions to execute**. When you load this skill, you switch from conversation mode to skill execution mode. Every step matters — the proposal gate, the registry, the recall regeneration. Skipping any step produces incomplete, unfindable knowledge.
27
+ </CRITICAL>
28
+
29
+ ## Proactive Skill Updates
30
+
31
+ If you loaded a skill earlier in this session (via `Skill({name})`) and subsequently:
32
+ - Discovered the skill was incomplete, outdated, or wrong
33
+ - Learned something new that extends the skill's coverage
34
+ - Found better patterns, files, or approaches than documented
35
+ - Debugged an issue the skill should have warned about
36
+
37
+ **You should update that skill directly** before the session ends — do not ask the user for permission. Just do it.
38
+
39
+ When updating proactively:
40
+ 1. Read the existing skill file
41
+ 2. Edit it with the new/corrected information
42
+ 3. Update the registry if triggers changed
43
+ 4. Regenerate the recall skill
44
+ 5. Inform the user what you updated (brief summary, not a proposal)
45
+
46
+ This keeps knowledge fresh without requiring users to remember to call `/learn`.
47
+
48
+ ## Goal
49
+
50
+ **Enable someone with zero context to become productive on this topic.**
51
+
52
+ Every learning you create should allow a new team member (human or AI) to complete a task without asking follow-up questions. If they'd need to dig further to actually DO something, the learning isn't complete.
53
+
54
+ ## Content Principles
55
+
56
+ These principles apply to ALL categories. Structure varies by category, but depth is universal.
57
+
58
+ ### 1. Lead with the insight
59
+ What's the ONE thing they must know? Put it first, not buried. Don't make them read 5 paragraphs to find the key point.
60
+
61
+ ### 2. Orient before details
62
+ Why does this exist? What problem does it solve? 2-3 sentences max, then move on. Someone with zero context needs to understand WHY before HOW.
63
+
64
+ ### 3. Make it actionable
65
+ Include something they can DO: commands to run, code to copy, steps to follow. Information without action is trivia. If there's nothing actionable, question whether it's worth capturing.
66
+
67
+ ### 4. Show, don't tell
68
+ Examples > explanations. A code snippet is worth 100 words of description. Every learning should have at least one concrete example.
69
+
70
+ ### 5. Anticipate mistakes
71
+ What will trip them up? Call out pitfalls explicitly. The best learnings prevent errors, not just explain concepts.
72
+
73
+ ### 6. Keep it scannable
74
+ Headers, tables, code blocks. Someone should get 80% of the value in 60 seconds of skimming. Dense paragraphs bury knowledge.
75
+
76
+ ## Quality Test
77
+
78
+ Before proposing ANY learning, ask yourself:
79
+
80
+ - **"Could someone complete a task using only this?"** - If they'd need to search elsewhere, add more.
81
+ - **"Does this tell them HOW, not just WHAT?"** - Facts without application aren't useful.
82
+ - **"Would I have saved hours if I'd had this when I started?"** - If the answer is "maybe 10 minutes", it might not be worth capturing.
83
+
84
+ If any answer is no, add more depth or reconsider capturing it.
85
+
86
+ ## Path Convention
87
+
88
+ `{{project_root}}` refers to **the current working directory** (`process.cwd()` / `$PWD`).
89
+
90
+ <CRITICAL>
91
+ **NEVER traverse up** to find a parent git root, main worktree, or repository root. If the user is working in a git worktree, `{{project_root}}` is the worktree directory — NOT the main repository. Skills must be saved where the user is working, not where the git repo was originally cloned.
92
+
93
+ Resolution order:
94
+ 1. `CLAUDE_PROJECT_DIR` environment variable (if set)
95
+ 2. Current working directory (`$PWD`)
96
+
97
+ Do NOT use `git rev-parse --show-toplevel` or any git command to resolve this path.
98
+ </CRITICAL>
99
+
100
+ ## Storage Structure
101
+
102
+ Each learning becomes its own skill at the project level:
103
+
104
+ ```
105
+ {{project_root}}/.claude/skills/
106
+ ├── spectre-recall/
107
+ │ ├── SKILL.md # Recall skill (discovery + embedded registry)
108
+ │ └── references/
109
+ │ └── registry.toon # Registry source of truth
110
+ ├── {category}-{slug}/ # Learning = Skill
111
+ │ └── SKILL.md
112
+ ├── {category}-{slug}/ # Learning = Skill
113
+ │ └── SKILL.md
114
+ └── ...
115
+ ```
116
+
117
+ ## Registry
118
+
119
+ The registry is stored at `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
120
+
121
+ Before proposing a learning, read the registry to check for existing learnings:
122
+
123
+ ```
124
+ {{project_root}}/.claude/skills/spectre-recall/references/registry.toon
125
+ ```
126
+
127
+ Format: `{skill-name}|{category}|{triggers}|{description}` (one learning per line)
128
+
129
+ Example: `feature-spectre-plugin|feature|spectre, /learn, /recall|Use when modifying spectre plugin or debugging hooks`
130
+
131
+ ## Workflow
132
+
133
+ ### 1. Parse Input
134
+
135
+ **With arguments**: Use the explicit topic/content as the knowledge to capture.
136
+ **Without arguments**: Analyze recent conversation (last 10-20 messages) to identify what's worth preserving.
137
+
138
+ ### 2. Check Context
139
+
140
+ Determine if you have sufficient context to create a quality learning.
141
+
142
+ **Ask yourself**: Can I answer the category's required questions (from Section 6) using:
143
+ - The current conversation context?
144
+ - My existing knowledge of this codebase from this session?
145
+
146
+ | Situation | Action |
147
+ |-----------|--------|
148
+ | Topic was discussed in detail in recent messages | Proceed to Step 4 (Apply Capture Criteria) |
149
+ | You already understand the topic from this session | Proceed to Step 4 (Apply Capture Criteria) |
150
+ | Topic is unfamiliar / not discussed / you'd be guessing | **Trigger Investigation Mode** (Step 2b) |
151
+
152
+ <CRITICAL>
153
+ Do NOT fabricate knowledge. If you haven't seen how something works in this session, you don't know how it works. Investigation Mode exists precisely for this situation.
154
+ </CRITICAL>
155
+
156
+ ### 2b. Investigation Mode
157
+
158
+ When you lack context, investigate the codebase using subagents before creating a learning.
159
+
160
+ #### Step 1: Determine Category
161
+
162
+ Classify the topic into a likely category. If ambiguous, ask the user:
163
+ ```
164
+ I'll investigate "{topic}" in the codebase. Which type of learning?
165
+ - feature (how it works end-to-end)
166
+ - gotchas (debugging knowledge)
167
+ - patterns (repeatable solutions)
168
+ - decisions (architectural choices)
169
+ - procedures (multi-step processes)
170
+ - integration (external systems)
171
+ ```
172
+
173
+ #### Step 2: File Discovery
174
+
175
+ Dispatch an `Explore` agent to map relevant files:
176
+
177
+ ```
178
+ Task(subagent_type="Explore", prompt="""
179
+ Find all files related to "{topic}" in this codebase:
180
+ - Entry points (routes, CLI commands, exports, event handlers)
181
+ - Core logic (main implementation files)
182
+ - Tests (unit tests, integration tests)
183
+ - Config (configuration, environment, constants)
184
+ - Docs (READMEs, comments, existing documentation)
185
+
186
+ Return a file map with:
187
+ - File path
188
+ - Brief description of what the file does
189
+ - Relevance to {topic} (high/medium/low)
190
+
191
+ Focus on HIGH and MEDIUM relevance files.
192
+ """)
193
+ ```
194
+
195
+ #### Step 3: Parallel Investigation
196
+
197
+ Based on the category, dispatch 2-3 `general-purpose` agents in parallel. Each agent gets:
198
+ - The file map from Step 2
199
+ - 1-2 specific questions to answer
200
+ - Instructions to cite specific files and line numbers
201
+
202
+ **For feature investigations:**
203
+ ```
204
+ Agent 1: "What is {topic} and what problem does it solve? How do users interact with it?
205
+ Cite entry points and user-facing code."
206
+
207
+ Agent 2: "What is the technical architecture? How do components connect?
208
+ Cite core implementation files."
209
+
210
+ Agent 3: "What are common tasks someone would need to do? What files would they modify?
211
+ Cite specific functions/files for each task."
212
+ ```
213
+
214
+ **For gotcha investigations:**
215
+ ```
216
+ Agent 1: "What are the symptoms when {topic} goes wrong? What errors appear?
217
+ Cite error handling code and logs."
218
+
219
+ Agent 2: "What is the root cause? What non-obvious behavior exists?
220
+ Cite the specific code that causes confusion."
221
+
222
+ Agent 3: "What is the solution? How do you fix or work around it?
223
+ Cite the correct approach with code examples."
224
+ ```
225
+
226
+ **For other categories:** Generate investigation questions from the category's required sections.
227
+
228
+ #### Step 4: Synthesize Findings
229
+
230
+ After subagents return:
231
+
232
+ 1. **Cross-reference** - Connect insights across agents. Look for:
233
+ - Files mentioned by multiple agents (likely important)
234
+ - Flows that span multiple components
235
+ - Patterns that repeat
236
+
237
+ 2. **Resolve conflicts** - If agents contradict each other:
238
+ - Read the disputed code directly to verify
239
+ - Note uncertainty in the learning if unresolved
240
+
241
+ 3. **Identify gaps** - What required sections couldn't be answered?
242
+ - If critical gaps exist, dispatch additional investigation
243
+ - If minor gaps, note them as "needs investigation" in the learning
244
+
245
+ 4. **Structure findings** - Map synthesized knowledge to the category template from Section 6
246
+
247
+ After synthesis, proceed to Step 7 (Generate Skill Name).
248
+
249
+ ---
250
+
251
+ ### 4. Apply Capture Criteria
252
+
253
+ Must meet **at least 2 of 4**:
254
+
255
+ | Criterion | Question |
256
+ | ---------- | -------------------------------- |
257
+ | Frequency | Will this come up again? |
258
+ | Pain | Did it cost real debugging time? |
259
+ | Surprise | Was it non-obvious? |
260
+ | Durability | Still true in 6 months? |
261
+
262
+ **Capture**: Patterns, decisions with rationale, debugging insights, conventions, tribal knowledge.
263
+ **Skip**: One-off solutions, generic knowledge, temporary workarounds, simple preferences (-> CLAUDE.md).
264
+
265
+ ### 5. Categorize
266
+
267
+ **ONLY use these categories.** Do not invent new ones.
268
+
269
+ | Category | Categorize as this when the knowledge is about... |
270
+ | ----------- | -------------------------------------------------------- |
271
+ | feature | How a feature works end-to-end: design, flows, key files |
272
+ | gotchas | Hard-won debugging knowledge, non-obvious pitfalls |
273
+ | patterns | Repeatable solutions used across the codebase |
274
+ | decisions | Architectural choices + rationale |
275
+ | procedures | Multi-step processes (deploy, release, etc.) |
276
+ | integration | Third-party APIs, vendor quirks, external systems |
277
+ | performance | Optimization learnings, benchmarks, scaling decisions |
278
+ | testing | Test strategies, coverage decisions, QA patterns |
279
+ | ux | Design patterns, user research insights, interactions |
280
+ | strategy | Roadmap decisions, prioritization rationale |
281
+
282
+ **Category selection guide:**
283
+ - "How does X feature work?" → `feature`
284
+ - "Why did we choose X over Y?" → `decisions`
285
+ - "X keeps breaking in weird ways" → `gotchas`
286
+ - "How do we deploy/release/migrate X?" → `procedures`
287
+ - "How do we talk to X API?" → `integration`
288
+
289
+ ### 6. Category-Specific Structure
290
+
291
+ Each category has expected sections. These are minimums - add more depth as needed to meet the Content Principles.
292
+
293
+ #### Feature Learnings
294
+
295
+ Feature learnings are comprehensive "dossiers" that enable someone to work on a feature without prior context.
296
+
297
+ **Required sections:**
298
+ - **What is {Feature}?** - 2-3 sentences explaining what it is and why it exists
299
+ - **Why Use It? / Use Cases** - Problem/solution pairs or concrete scenarios (at least 3)
300
+ - **User Flows** - How users interact with it (at least 2 flows)
301
+ - **Technical Design** - Architecture, key patterns, how it works
302
+ - **Key Files** - Files that matter with their purposes (at least 3)
303
+ - **Common Tasks** - Things someone will need to do, with how-to (at least 2)
304
+
305
+ #### Gotcha Learnings
306
+
307
+ Gotchas capture hard-won debugging knowledge.
308
+
309
+ **Required sections:**
310
+ - **Symptom** - What you observe when you hit this
311
+ - **Root Cause** - Why it happens (the non-obvious part)
312
+ - **Solution** - How to fix it, with code/commands
313
+ - **Prevention** - How to avoid hitting it again (if applicable)
314
+
315
+ #### Pattern Learnings
316
+
317
+ Patterns document repeatable solutions.
318
+
319
+ **Required sections:**
320
+ - **Problem** - What situation calls for this pattern
321
+ - **Solution** - The pattern itself, with code example
322
+ - **When to Use** - Specific scenarios where this applies
323
+ - **Trade-offs** - What you give up by using this pattern
324
+
325
+ #### Decision Learnings
326
+
327
+ Decisions preserve architectural choices and rationale.
328
+
329
+ **Required sections:**
330
+ - **Context** - What situation prompted this decision
331
+ - **Options Considered** - What alternatives existed
332
+ - **Decision** - What we chose
333
+ - **Rationale** - Why we chose it (the important part)
334
+ - **Consequences** - What this decision enables/prevents
335
+
336
+ #### Procedure Learnings
337
+
338
+ Procedures document multi-step processes.
339
+
340
+ **Required sections:**
341
+ - **When to Use** - What triggers this procedure
342
+ - **Prerequisites** - What you need before starting
343
+ - **Steps** - Numbered steps with commands/code
344
+ - **Verification** - How to confirm it worked
345
+
346
+ #### Integration Learnings
347
+
348
+ Integrations document external system connections.
349
+
350
+ **Required sections:**
351
+ - **What it is** - The external system and why we use it
352
+ - **How we connect** - Auth, endpoints, SDK usage
353
+ - **Key Operations** - Common tasks with code examples
354
+ - **Gotchas** - Vendor-specific quirks and workarounds
355
+
356
+ #### Other Categories (performance, testing, ux, strategy)
357
+
358
+ Follow the Content Principles. Include:
359
+ - Context (why this matters)
360
+ - The knowledge itself (specific, actionable)
361
+ - Examples (code, commands, or concrete scenarios)
362
+ - Pitfalls (what to watch out for)
363
+
364
+ ### 7. Generate Skill Name
365
+
366
+ The skill name follows the pattern `{category}-{slug}`:
367
+
368
+ **Naming rules (CRITICAL for discoverability):**
369
+
370
+ ```
371
+ VALID: feature-auth-flows, gotchas-hook-timeout, patterns-retry-logic
372
+ INVALID: auth-flows (no category), feature/auth-flows (no slashes), feature_auth_flows (no underscores)
373
+ ```
374
+
375
+ Rules:
376
+ - **{category}-{slug}** format: category prefix, then descriptive slug
377
+ - **lowercase-kebab-case ONLY**: letters, numbers, hyphens
378
+ - **NO special characters**: no colons, slashes, underscores, or parentheses
379
+ - **Descriptive slug**: `session-restore`, `handling-timeouts`
380
+ - **3-5 words max in slug**: enough to be specific, short enough to scan
381
+
382
+ ### 8. Match, Update, or Create
383
+
384
+ Read the registry to find candidates, then **read the actual skill file** to compare content.
385
+
386
+ **Registry scan** - look for:
387
+ - Same category prefix
388
+ - Overlapping trigger keywords
389
+ - Related topic
390
+
391
+ **If candidate found**, read `{{project_root}}/.claude/skills/{skill-name}/SKILL.md` and check:
392
+
393
+ 1. **UPDATE** - New knowledge contradicts, extends, or supersedes an existing learning
394
+ - Same topic but new/better information
395
+ - Original learning was incomplete or wrong
396
+ - Circumstances changed (dependency updated, API changed, etc.)
397
+
398
+ 2. **APPEND** - New learning belongs in same skill but is distinct
399
+ - Related topic, different specific insight
400
+ - Same category, different trigger keywords
401
+
402
+ 3. **CREATE** - No semantic match in registry
403
+ - New topic area
404
+ - Different category
405
+
406
+ **Decision priority**: UPDATE > APPEND > CREATE (prefer consolidation over proliferation)
407
+
408
+ ### 9. Verify Learning
409
+
410
+ Before proposing, verify the learning is accurate. This is especially important for Investigation Mode learnings.
411
+
412
+ **Verification checklist:**
413
+
414
+ 1. **Spot-check key claims** (2-3 minimum)
415
+ - Pick specific claims from your draft ("File X handles Y")
416
+ - Read the actual file to confirm
417
+ - If wrong, correct the learning
418
+
419
+ 2. **Verify file purposes**
420
+ - For each file in "Key Files", quick-read to confirm description
421
+ - Remove files that don't match their described purpose
422
+
423
+ 3. **Trace one flow** (for feature learnings)
424
+ - Pick a user flow from the learning
425
+ - Trace through actual code to confirm accuracy
426
+ - Note any discrepancies
427
+
428
+ **If verification fails:**
429
+ - Correct the learning before proposing
430
+ - If uncertainty remains, flag it explicitly:
431
+ ```
432
+ > **Note**: The {specific area} couldn't be fully verified.
433
+ > This may need confirmation.
434
+ ```
435
+
436
+ **Confidence calibration based on verification:**
437
+
438
+ | Verification Result | Confidence |
439
+ |---------------------|------------|
440
+ | All claims verified, flows traced | high |
441
+ | Most verified, minor gaps | medium |
442
+ | Significant uncertainty, partial verification | low |
443
+
444
+ For Investigation Mode learnings, default to `medium` unless verification is thorough.
445
+
446
+ ### 10. Propose
447
+
448
+ Stop and wait for user response. Format depends on action type:
449
+
450
+ **For UPDATE** (revising existing learning):
451
+ ```
452
+ I'd update the skill: `{skill-name}`
453
+
454
+ **Current**: {1-2 sentence summary of existing}
455
+ **Proposed**: {1-2 sentence summary of revision}
456
+ **Reason**: {contradicts|extends|supersedes} - {why}
457
+
458
+ {Updated content preview - FULL content, not summary}
459
+
460
+ Update this? [Y/n/edit]
461
+ ```
462
+
463
+ **For APPEND** (adding to existing skill):
464
+ ```
465
+ I'd append to the skill: `{skill-name}`
466
+
467
+ **{Title}**
468
+
469
+ {Full content following category structure}
470
+
471
+ Trigger: {keywords}
472
+ Confidence: {low|medium|high}
473
+
474
+ Save this? [Y/n/edit]
475
+ ```
476
+
477
+ **For CREATE** (new skill):
478
+ ```
479
+ I'd create a new skill: `{skill-name}`
480
+
481
+ **{Title}**
482
+
483
+ {Full content following category structure}
484
+
485
+ Trigger: {keywords}
486
+ Confidence: {low|medium|high}
487
+
488
+ Create this? [Y/n/edit]
489
+ ```
490
+
491
+ **Confidence** (determined in Step 9 - Verify Learning):
492
+ - low = observed once, or Investigation Mode with partial verification
493
+ - medium = repeated/taught, or Investigation Mode with solid verification
494
+ - high = battle-tested, or fully verified with traced flows
495
+
496
+ <CRITICAL>
497
+ Always show FULL proposed content, not summaries. The user needs to see exactly what will be saved to approve it. Sparse proposals lead to sparse learnings.
498
+ </CRITICAL>
499
+
500
+ ### 11. Handle Response
501
+
502
+ - `y`/`yes` -> write as proposed
503
+ - `n`/`no` -> cancel
504
+ - `edit` or custom text -> modify first
505
+ - Different skill name -> use that instead
506
+
507
+ ### 12. Write Learning
508
+
509
+ **Location**: `{{project_root}}/.claude/skills/{skill-name}/SKILL.md`
510
+
511
+ **Skill Template**:
512
+
513
+ ```markdown
514
+ ---
515
+ name: {skill-name}
516
+ description: Use when {triggering conditions - MUST start with "Use when"}
517
+ user-invocable: false
518
+ ---
519
+
520
+ # {Title}
521
+
522
+ **Trigger**: {keywords}
523
+ **Confidence**: {level}
524
+ **Created**: {YYYY-MM-DD}
525
+ **Updated**: {YYYY-MM-DD}
526
+ **Version**: 1
527
+
528
+ {Content - follows category-specific structure from Section 6}
529
+ ```
530
+
531
+ **UPDATE** - Revise existing skill:
532
+
533
+ 1. Preserve `**Created**` date
534
+ 2. Set `**Updated**` to today
535
+ 3. Increment `**Version**` by 1
536
+ 4. Update confidence if warranted (e.g., low → medium after verification)
537
+
538
+ **APPEND** - For skills with multiple sections, add new section:
539
+
540
+ ```markdown
541
+ ---
542
+
543
+ ## {New Section Title}
544
+
545
+ **Trigger**: {keywords}
546
+ **Confidence**: {level}
547
+ **Created**: {YYYY-MM-DD}
548
+ **Updated**: {YYYY-MM-DD}
549
+ **Version**: 1
550
+
551
+ {Explanation}
552
+ ```
553
+
554
+ ### 13. Register the Learning
555
+
556
+ After writing the skill file, register it in the project registry and regenerate the recall skill. This is two file operations — no external scripts needed.
557
+
558
+ <CRITICAL>
559
+ **Registry description format:**
560
+
561
+ The description is used to MATCH knowledge to tasks. It must describe WHEN to use the knowledge, not what it contains.
562
+
563
+ - MUST start with "Use when..."
564
+ - Describes triggering CONDITIONS
565
+ - Focuses on tasks/scenarios that need this knowledge
566
+
567
+ **Good**: `"Use when modifying spectre plugin, debugging hooks, or adding knowledge categories"`
568
+ **Good**: `"Use when auth fails silently or tokens expire unexpectedly"`
569
+ **Bad**: `"spectre plugin architecture"` (describes content, not when to use)
570
+ **Bad**: `"Authentication system overview"` (too vague, no triggering conditions)
571
+ </CRITICAL>
572
+
573
+ #### 13a. Update the Registry
574
+
575
+ **Path**: `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
576
+
577
+ Create the directory and file if they don't exist. The registry format is one entry per line:
578
+
579
+ ```
580
+ # SPECTRE Knowledge Registry
581
+ # Format: skill-name|category|triggers|description
582
+
583
+ {skill-name}|{category}|{triggers}|{description}
584
+ ```
585
+
586
+ - If the skill-name already exists on a line, **replace** that line with the updated entry
587
+ - If it's new, **append** the entry
588
+ - Preserve existing entries and comments
589
+
590
+ #### 13b. Regenerate the Recall Skill
591
+
592
+ **Path**: `{{project_root}}/.claude/skills/spectre-recall/SKILL.md`
593
+
594
+ Read the full registry content from `registry.toon`, then write the recall skill with this exact structure:
595
+
596
+ ```markdown
597
+ ---
598
+ name: spectre-recall
599
+ description: Use when user wants to search for existing knowledge, recall a specific learning, or discover what knowledge is available.
600
+ ---
601
+
602
+ # Recall Knowledge
603
+
604
+ Search and load relevant knowledge from the project's spectre learnings into your context.
605
+
606
+ ## Registry
607
+
608
+ {full registry content here}
609
+
610
+ ## How to Use
611
+
612
+ 1. **Scan registry above** — match triggers/description against your current task
613
+ 2. **Load matching skills**: `Skill({skill-name})`
614
+ 3. **Apply knowledge** — use it to guide your approach
615
+
616
+ ## Search Commands
617
+
618
+ - `/recall {query}` — search registry for matches
619
+ - `/recall` — show all available knowledge by category
620
+
621
+ ## Workflow
622
+
623
+ **Single match** → Load automatically via `Skill({skill-name})`
624
+
625
+ **Multiple matches** → List options, ask user which to load
626
+
627
+ **No matches** → Suggest `/learn` to capture new knowledge
628
+ ```
629
+
630
+ ### 14. Confirm
631
+
632
+ ```
633
+ Saved .claude/skills/{skill-name}/SKILL.md
634
+ Registered in .claude/skills/spectre-recall/references/registry.toon
635
+ ```
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: spectre-recall
3
+ description: Use when user wants to search for existing knowledge, recall a specific learning, or discover what knowledge is available.
4
+ ---
5
+
6
+ # Recall Knowledge
7
+
8
+ Search and load relevant knowledge from the project's spectre learnings into your context.
9
+
10
+ ## Registry
11
+
12
+ {{REGISTRY}}
13
+
14
+ ## How to Use
15
+
16
+ 1. **Scan registry above** — match triggers/description against your current task
17
+ 2. **Load matching skills**: `Skill({skill-name})`
18
+ 3. **Apply knowledge** — use it to guide your approach
19
+
20
+ ## Search Commands
21
+
22
+ - `/recall {query}` — search registry for matches
23
+ - `/recall` — show all available knowledge by category
24
+
25
+ ## Workflow
26
+
27
+ **Single match** → Load automatically via `Skill({skill-name})`
28
+
29
+ **Multiple matches** → List options, ask user which to load
30
+
31
+ **No matches** → Suggest `/learn` to capture new knowledge