@codename_inc/spectre 3.7.0 → 4.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.
Files changed (102) hide show
  1. package/README.md +3 -4
  2. package/package.json +3 -2
  3. package/plugins/spectre/.claude-plugin/plugin.json +1 -1
  4. package/plugins/spectre/bin/spectre-register +5 -0
  5. package/plugins/spectre/hooks/hooks.json +3 -14
  6. package/plugins/spectre/hooks/scripts/bootstrap.mjs +98 -0
  7. package/plugins/spectre/hooks/scripts/handoff-resume.mjs +404 -0
  8. package/plugins/spectre/hooks/scripts/lib.mjs +82 -0
  9. package/plugins/spectre/hooks/scripts/load-knowledge.mjs +189 -0
  10. package/plugins/spectre/hooks/scripts/register_learning.mjs +264 -0
  11. package/plugins/spectre/hooks/scripts/{test_bootstrap.cjs → test_bootstrap.mjs} +12 -7
  12. package/plugins/spectre/hooks/scripts/{test_handoff-resume.cjs → test_handoff-resume.mjs} +13 -11
  13. package/plugins/spectre/hooks/scripts/{test_load-knowledge.cjs → test_load-knowledge.mjs} +103 -22
  14. package/plugins/spectre/hooks/scripts/test_register-learning.mjs +335 -0
  15. package/plugins/spectre/skills/apply/SKILL.md +87 -0
  16. package/plugins/spectre/{commands/architecture_review.md → skills/architecture_review/SKILL.md} +9 -0
  17. package/plugins/spectre/{commands/clean.md → skills/clean/SKILL.md} +9 -0
  18. package/plugins/spectre/{commands/code_review.md → skills/code_review/SKILL.md} +9 -0
  19. package/plugins/spectre/{commands/create_plan.md → skills/create_plan/SKILL.md} +9 -0
  20. package/plugins/spectre/{commands/create_tasks.md → skills/create_tasks/SKILL.md} +9 -0
  21. package/plugins/spectre/{commands/create_test_guide.md → skills/create_test_guide/SKILL.md} +9 -0
  22. package/plugins/spectre/{commands/evaluate.md → skills/evaluate/SKILL.md} +11 -2
  23. package/plugins/spectre/{commands/execute.md → skills/execute/SKILL.md} +12 -3
  24. package/plugins/spectre/{commands/fix.md → skills/fix/SKILL.md} +9 -0
  25. package/plugins/spectre/{commands/forget.md → skills/forget/SKILL.md} +9 -0
  26. package/plugins/spectre/skills/{spectre-guide → guide}/SKILL.md +2 -1
  27. package/plugins/spectre/{commands/handoff.md → skills/handoff/SKILL.md} +9 -0
  28. package/plugins/spectre/{commands/kickoff.md → skills/kickoff/SKILL.md} +9 -0
  29. package/plugins/spectre/skills/{spectre-learn → learn}/SKILL.md +19 -59
  30. package/plugins/spectre/skills/learn/references/recall-template.md +34 -0
  31. package/plugins/spectre/{commands/plan.md → skills/plan/SKILL.md} +66 -25
  32. package/plugins/spectre/{commands/plan_review.md → skills/plan_review/SKILL.md} +9 -0
  33. package/plugins/spectre/{commands/quick_dev.md → skills/quick_dev/SKILL.md} +9 -0
  34. package/plugins/spectre/{commands/rebase.md → skills/rebase/SKILL.md} +9 -0
  35. package/plugins/spectre/skills/recall/SKILL.md +17 -0
  36. package/plugins/spectre/{commands/research.md → skills/research/SKILL.md} +9 -0
  37. package/plugins/spectre/{commands/scope.md → skills/scope/SKILL.md} +9 -0
  38. package/plugins/spectre/{commands/ship.md → skills/ship/SKILL.md} +9 -0
  39. package/plugins/spectre/{commands/sweep.md → skills/sweep/SKILL.md} +9 -0
  40. package/plugins/spectre/skills/tdd/SKILL.md +111 -0
  41. package/plugins/spectre/{commands/test.md → skills/test/SKILL.md} +9 -0
  42. package/plugins/spectre/{commands/ux_spec.md → skills/ux_spec/SKILL.md} +9 -0
  43. package/plugins/spectre/{commands/validate.md → skills/validate/SKILL.md} +9 -0
  44. package/plugins/spectre-codex/agents/analyst.toml +117 -0
  45. package/plugins/spectre-codex/agents/dev.toml +65 -0
  46. package/plugins/spectre-codex/agents/finder.toml +101 -0
  47. package/plugins/spectre-codex/agents/patterns.toml +203 -0
  48. package/plugins/spectre-codex/agents/reviewer.toml +123 -0
  49. package/plugins/spectre-codex/agents/sync.toml +146 -0
  50. package/plugins/spectre-codex/agents/tester.toml +205 -0
  51. package/plugins/spectre-codex/agents/web-research.toml +104 -0
  52. package/plugins/spectre-codex/hooks/hooks.json +23 -0
  53. package/plugins/{spectre/hooks/scripts/bootstrap.cjs → spectre-codex/hooks/scripts/bootstrap.mjs} +15 -16
  54. package/plugins/{spectre/hooks/scripts/handoff-resume.cjs → spectre-codex/hooks/scripts/handoff-resume.mjs} +21 -27
  55. package/plugins/{spectre/hooks/scripts/lib.cjs → spectre-codex/hooks/scripts/lib.mjs} +3 -4
  56. package/plugins/spectre-codex/hooks/scripts/load-knowledge.mjs +189 -0
  57. package/plugins/spectre-codex/hooks/scripts/register_learning.mjs +264 -0
  58. package/plugins/spectre-codex/skills/apply/SKILL.md +87 -0
  59. package/plugins/spectre-codex/skills/architecture_review/SKILL.md +129 -0
  60. package/plugins/spectre-codex/skills/clean/SKILL.md +322 -0
  61. package/plugins/spectre-codex/skills/code_review/SKILL.md +417 -0
  62. package/plugins/spectre-codex/skills/create_plan/SKILL.md +126 -0
  63. package/plugins/spectre-codex/skills/create_tasks/SKILL.md +383 -0
  64. package/plugins/spectre-codex/skills/create_test_guide/SKILL.md +129 -0
  65. package/plugins/spectre-codex/skills/evaluate/SKILL.md +59 -0
  66. package/plugins/spectre-codex/skills/execute/SKILL.md +96 -0
  67. package/plugins/spectre-codex/skills/fix/SKILL.md +70 -0
  68. package/plugins/spectre-codex/skills/forget/SKILL.md +67 -0
  69. package/plugins/spectre-codex/skills/guide/SKILL.md +359 -0
  70. package/plugins/spectre-codex/skills/handoff/SKILL.md +170 -0
  71. package/plugins/spectre-codex/skills/kickoff/SKILL.md +124 -0
  72. package/plugins/spectre-codex/skills/learn/SKILL.md +595 -0
  73. package/plugins/{spectre/skills/spectre-learn → spectre-codex/skills/learn}/references/recall-template.md +4 -1
  74. package/plugins/spectre-codex/skills/plan/SKILL.md +211 -0
  75. package/plugins/spectre-codex/skills/plan_review/SKILL.md +42 -0
  76. package/plugins/spectre-codex/skills/quick_dev/SKILL.md +110 -0
  77. package/plugins/spectre-codex/skills/rebase/SKILL.md +82 -0
  78. package/plugins/spectre-codex/skills/recall/SKILL.md +17 -0
  79. package/plugins/spectre-codex/skills/research/SKILL.md +168 -0
  80. package/plugins/spectre-codex/skills/scope/SKILL.md +128 -0
  81. package/plugins/spectre-codex/skills/ship/SKILL.md +181 -0
  82. package/plugins/spectre-codex/skills/sweep/SKILL.md +91 -0
  83. package/plugins/{spectre/skills/spectre-tdd → spectre-codex/skills/tdd}/SKILL.md +1 -1
  84. package/plugins/spectre-codex/skills/test/SKILL.md +389 -0
  85. package/plugins/spectre-codex/skills/ux_spec/SKILL.md +100 -0
  86. package/plugins/spectre-codex/skills/validate/SKILL.md +352 -0
  87. package/src/config.test.js +6 -5
  88. package/src/install.test.js +100 -11
  89. package/src/lib/config.js +107 -54
  90. package/src/lib/constants.js +17 -23
  91. package/src/lib/doctor.js +19 -22
  92. package/src/lib/install.js +98 -313
  93. package/src/lib/knowledge.js +7 -37
  94. package/src/lib/paths.js +0 -12
  95. package/src/pack.test.js +87 -0
  96. package/plugins/spectre/commands/learn.md +0 -15
  97. package/plugins/spectre/commands/recall.md +0 -5
  98. package/plugins/spectre/hooks/scripts/load-knowledge.cjs +0 -120
  99. package/plugins/spectre/hooks/scripts/precompact-warning.cjs +0 -19
  100. package/plugins/spectre/hooks/scripts/register_learning.cjs +0 -144
  101. package/plugins/spectre/hooks/scripts/test_register-learning.cjs +0 -146
  102. package/plugins/spectre/skills/spectre-apply/SKILL.md +0 -189
@@ -1,189 +0,0 @@
1
- ---
2
- name: spectre-apply
3
- description: Use when starting implementation, debugging, or feature work on a project with captured knowledge.
4
- user-invocable: false
5
- ---
6
-
7
- # Apply Knowledge
8
-
9
- ## Why This Exists
10
-
11
- SPECTRE captures knowledge — patterns, gotchas, decisions, and feature context — across sessions. This knowledge:
12
-
13
- - **Prevents repeated mistakes** — gotchas you've already debugged
14
- - **Maintains consistency** — decisions and patterns the team has established
15
- - **Provides instant context** — feature designs, key files, common tasks
16
- - **Makes searching efficient** — know WHERE to look before searching
17
-
18
- Without this, you'd waste time rediscovering what's already known or make decisions that contradict established patterns.
19
-
20
- ## The Rule
21
-
22
- <CRITICAL>
23
- If ANY entry's triggers or description match your current task, you MUST load the skill FIRST using the Skill tool.
24
-
25
- **Trigger matches are sufficient.** If a trigger word appears in the user's request, load the skill—you don't need the description to also match. Don't reframe the user's request to avoid triggers.
26
-
27
- The registry tells you exactly where relevant knowledge is. Loading it first makes you faster and more accurate.
28
-
29
- DO NOT search the codebase or dispatch agents BEFORE loading relevant knowledge—even if you think you already have enough context. Partial context from Read results or error messages is not a substitute for the complete picture in the skill.
30
-
31
- **When a command explicitly tells you to load a skill, you MUST call the Skill tool to load it.** Do not improvise the workflow based on what you think the skill does. The skill defines a specific workflow with precise steps, output formats, file locations, and integrations. Your improvised version will be wrong — you will miss output paths, registration steps, format requirements, or downstream integrations that only the skill knows about.
32
-
33
- **You are also responsible for keeping knowledge current.** After completing significant work — implementing features, fixing bugs, discovering gotchas, making architectural decisions, or changing patterns — you MUST proactively check whether any loaded skills need updating, and whether new skills should be captured.
34
-
35
- Do NOT wait for the user to say "/learn" or "update the skill." If you changed how something works, the skill that describes it is now stale. Fix it.
36
- </CRITICAL>
37
-
38
- ## Path Convention
39
-
40
- `{{project_root}}` refers to **the current working directory** (`$PWD`). NEVER traverse up to a parent git root or main worktree. If in a git worktree, `{{project_root}}` is the worktree — not the main repository.
41
-
42
- ## Registry Location
43
-
44
- The registry is stored at `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
45
-
46
- **Format**: `{skill-name}|{category}|{triggers}|{description}`
47
-
48
- Each entry corresponds to a skill that can be loaded via `Skill({skill-name})`
49
-
50
- **Categories:** feature, gotchas, patterns, decisions, procedures, integration, performance, testing, ux, strategy
51
-
52
- ## Workflow
53
-
54
- 1. **Read the registry** at `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
55
- 2. **Scan entries** — if ANY trigger word OR the description matches your task, that's a match
56
- 3. **For each match**, load the skill:
57
- ```
58
- Skill({skill-name})
59
- ```
60
- 4. **Apply the knowledge** — use it to guide your approach, know where to look
61
- 5. **Then proceed** — now you can search/implement with context
62
- 6. **No matches?** Proceed normally
63
-
64
- ## Keeping Knowledge Current
65
-
66
- Loading skills is half the job. The other half is **leaving them better than you found them**.
67
-
68
- ### When to Update (Proactively — Don't Wait to Be Asked)
69
-
70
- After completing work, ask yourself:
71
-
72
- 1. **Did I load a skill that's now outdated?** → Update it immediately
73
- 2. **Did I discover something capture-worthy?** (gotcha, pattern, decision) → Capture it directly via `Skill(spectre-learn)`
74
- 3. **Did I change key files, flows, or architecture?** → Update the relevant feature skill
75
- 4. **Did I make a decision with non-obvious rationale?** → Capture it before the session ends
76
-
77
- ### How to Update
78
-
79
- - **Existing skill needs changes**: Read the skill file, Edit it directly, keep the same format
80
- - **New knowledge worth capturing**: Use `Skill(spectre-learn)` to capture it directly — don't ask, just do it
81
- - **Registry entry needs new triggers**: Edit `{{project_root}}/.claude/skills/spectre-recall/references/registry.toon`
82
-
83
- ### The Standard
84
-
85
- When you finish a task that touched areas covered by loaded skills, **the skills should reflect the current state before you move on**. Stale knowledge is worse than no knowledge — it actively misleads future sessions.
86
-
87
- ## Red Flags
88
-
89
- | Thought | Reality |
90
- |---------|---------|
91
- | "Let me search the codebase first" | Knowledge tells you WHERE to search. Load the skill first. |
92
- | "I'll dispatch an agent to find this" | The skill name is in the registry. Just use `Skill({name})`. |
93
- | "I need more context first" | The knowledge IS the context. |
94
- | "This seems simple" | Simple tasks benefit from captured patterns too. |
95
- | "I already have context from a Read/system message" | Partial context is dangerous. The skill has the full picture—including related changes you don't know about yet. |
96
- | "The error/issue is narrow and specific" | Narrow symptoms often stem from broader changes (like namespace renames) that the skill documents. |
97
- | "I can figure this out faster by just searching" | You're trading 1 skill load for multiple speculative searches. The skill tells you exactly where to look. |
98
- | "This is really about X, not Y" | Don't reframe the user's words. If they said "release," match against "release"—not your interpretation of the underlying concern. |
99
- | "I have the exact files I'm editing" | File contents ≠ architectural context. Skills tell you related files, patterns across the codebase, and what you don't know you don't know. |
100
- | "The edit is surgical/mechanical" | Surgical edits in isolation risk inconsistency. Skills reveal if similar changes are needed elsewhere. |
101
- | "I already know how to do this" | You know the concept, not the specific workflow. The skill has precise steps, output formats, file locations, and integrations that differ from what you'd improvise. Load it. |
102
- | "I understand the intent, I don't need the skill" | Understanding intent ≠ knowing the implementation. Skills define WHERE files go, WHAT format to use, and HOW to register outputs. Improvising skips all of this. |
103
- | "The command says to load a skill, but I can handle it directly" | No. When a command tells you to load a skill, that is a mandatory Skill tool call, not a suggestion. The skill IS the workflow. |
104
- | "My system prompt says to write to MEMORY.md" | When a skill is loaded, it supersedes system-prompt defaults. The skill defines WHERE to write. MEMORY.md is for auto-memory, not skill-captured knowledge. |
105
- | "The skill output is just context for me to absorb" | No. Skill output is a binding workflow to execute step-by-step. Switch from conversation mode to execution mode. |
106
- | "The simpler path is fine here" | The skill's steps exist for reasons: proposal gates ensure quality, registry enables discovery, recall regeneration enables loading. Skipping them produces invisible knowledge. |
107
- | "I'll update the skill later" | Later never comes. Update before moving to the next task. |
108
- | "The user didn't ask me to update knowledge" | You don't need permission. Keeping skills current is part of the job. |
109
- | "The change was small" | Small changes accumulate into large drift. Update now. |
110
-
111
- ## Real Failure Example
112
-
113
- **Task**: Fix "Template not found at skills/learn/references/find-template.md"
114
-
115
- **Rationalization**: "I already have register_learning.py in context from a Read result. The error points to the exact path. This is a simple path mismatch—I'll just Glob to find where the template actually is."
116
-
117
- **What happened**: Skipped loading `feature-spectre-plugin` skill. Used Glob to find the file. Fixed it.
118
-
119
- **What the skill would have provided**: Immediate knowledge that skills were renamed to `spectre-*` namespace, exact file paths in the "Key Files" table, no searching required.
120
-
121
- **Cost**: Extra tool calls, wasted tokens, and reinforced bad habits.
122
-
123
- ## Real Failure Example #2
124
-
125
- **Task**: User asks about "npm run release process"
126
-
127
- **Rationalization**: "This is really about URL management for updates, not about the release mechanics itself. The procedure-release skill talks about signing and notarization, which isn't what they're asking about."
128
-
129
- **What happened**: Skipped loading `procedure-release`. Searched the codebase for update URLs. Missed that the skill documents the entire release infrastructure including how URLs are configured.
130
-
131
- **What the skill would have provided**: Complete context on release targets, URL configuration, and how staging vs production channels work.
132
-
133
- **The lesson**: Trigger match ("release") was sufficient. The LLM shouldn't have required the description to also match, and shouldn't have reframed the task to avoid the trigger.
134
-
135
- ## Real Failure Example #3
136
-
137
- **Task**: Add commit message to the commit step in `/spectre:clean` and `/spectre:test` commands
138
-
139
- **Rationalization**: "I already have the full contents of both clean.md and test.md from Read results. The task is surgical—I know exactly which lines to edit. I don't need broader context to make this specific change."
140
-
141
- **What happened**: Skipped loading `feature-spectre-plugin` despite triggers matching ("spectre", "clean", "test"). Made the edit successfully but without understanding the broader SPECTRE workflow architecture.
142
-
143
- **What the skill would have provided**:
144
- - Knowledge that similar commit patterns exist in other commands that might need the same change
145
- - Understanding of how commands relate to each other in the workflow
146
- - Commit message conventions used across SPECTRE
147
- - Awareness of the artifact system and how commits are structured
148
-
149
- **The lesson**: Having file contents is not the same as having architectural context. The skill tells you what you don't know you don't know—related files, patterns across commands, conventions. A "surgical" edit without skill context risks being inconsistent with the broader system.
150
-
151
- ## Real Failure Example #4
152
-
153
- **Task**: `/spectre:learn how the cxo plugin/system works e2e`
154
-
155
- **Rationalization**: "I see the topic ('how the cxo plugin works'). I have memory files and a codebase to analyze. I know what 'learning' means — analyze and capture knowledge. I can do this directly without loading the skill."
156
-
157
- **What happened**: Skipped calling `Skill(spectre:spectre-learn)` despite the command explicitly saying "Load the spectre-learn skill and follow its instructions." Instead, the agent launched its own analyst subagent, wrote knowledge to the wrong location (auto memory instead of project skills), used the wrong format, and missed the registry integration entirely.
158
-
159
- **What the skill would have provided**: The exact capture workflow — categorize the knowledge, propose it to the user, write the skill file to `.claude/skills/{category}-{slug}/SKILL.md`, register it in the registry, and regenerate the recall skill. None of this was improvised correctly.
160
-
161
- **The lesson**: "I understand the intent" is the most dangerous rationalization because it feels true. You DO understand what "learn" means conceptually. But the skill defines a 5-step workflow with specific file paths, a registry format, a recall skill regeneration step, and user confirmation gates. Understanding the concept gave the agent zero of this. When a command says "load skill X," that is not a hint — it is a mandatory `Skill()` tool call.
162
-
163
- ## Real Failure Example #5
164
-
165
- **Task**: `/spectre:learn how the cxo plugin/system works e2e` (repeat failure, different root cause)
166
-
167
- **Rationalization**: Three compounding factors led to failure even after calling the Skill tool:
168
- 1. "Auto memory instructions say write to MEMORY.md — that's my system prompt, it's always-on."
169
- 2. "The skill output is context for me to absorb, not a set of steps to execute."
170
- 3. "MEMORY.md is one file, known format, no proposal step. The skill workflow has 13 steps with approval gates. Simpler path wins."
171
-
172
- **What happened**: Called `Skill(spectre-learn)`, received the full workflow, then ignored it. Wrote to `MEMORY.md` instead of `.claude/skills/{category}-{slug}/SKILL.md`. Skipped the proposal gate, registry registration, and recall skill regeneration. The knowledge was saved but unfindable — it won't appear in registry scans, won't auto-load via triggers, and lives outside the skill system entirely.
173
-
174
- **Why it happened**:
175
- - **Competing instructions**: The system prompt's auto-memory instructions (`Write to MEMORY.md`) felt like the "default" behavior. The dynamically-loaded skill felt like a suggestion. The system prompt won.
176
- - **No mode switch**: The skill output was treated as informational context rather than a binding directive. There was no mental shift from "conversation mode" to "skill execution mode."
177
- - **Path of least resistance**: MEMORY.md = 1 file, known format, no gates. Skill workflow = 13 steps with proposal/approval. The simpler path was chosen unconsciously.
178
-
179
- **The lesson**: When `/spectre:learn` is invoked, the learn skill is the **exclusive handler** for knowledge capture. It supersedes auto-memory, MEMORY.md, and all other storage mechanisms. The skill is not informational context — it is a binding workflow. Every step exists for a reason: the proposal gate ensures quality, the registry enables discovery, the recall regeneration enables loading. Writing to MEMORY.md instead produces knowledge that is invisible to the skill system.
180
-
181
- ## Example
182
-
183
- User: "How does /spectre work?"
184
-
185
- Registry entry: `feature-spectre-plugin|feature|spectre, /spectre, knowledge|Use when modifying spectre plugin or debugging hooks`
186
-
187
- Action: `Skill(feature-spectre-plugin)`
188
-
189
- Then: Use the key files and patterns from that knowledge to guide your work.