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