@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,358 @@
1
+ ---
2
+ name: spectre-guide
3
+ description: Use when rendering the Next Steps footer after any spectre command, suggesting next actions, or when users need guidance on which SPECTRE command to run.
4
+ ---
5
+
6
+ # SPECTRE Guide
7
+
8
+ The single reference for how to use SPECTRE — for both humans and agents.
9
+
10
+ ## When to Load
11
+
12
+ - After completing any spectre command (to render Next Steps footer)
13
+ - When suggesting next actions to the user
14
+ - When users ask "what command should I run?" or "how does SPECTRE work?"
15
+ - When onboarding a new user to SPECTRE
16
+
17
+ ---
18
+
19
+ ## Core Philosophy
20
+
21
+ SPECTRE exists because **ambiguity is death** for AI coding agents. When scope, UX, and plans are vague, you rely on the LLM to fill in the blanks — and that's how you end up with spaghetti code, conflicts, and AI slop.
22
+
23
+ SPECTRE uses **structured workflows that generate canonical docs** — scope documents, UX specs, technical plans, task breakdowns — so you and your agent are aligned on exactly what's being built before a single line of code is written.
24
+
25
+ The better the inputs, the better the outputs. SPECTRE makes it easy to provide great inputs.
26
+
27
+ ### Principles
28
+
29
+ - **Great Inputs → Great Outputs** — specificity up front forces clarity
30
+ - **Ambiguity is Death** — never let the LLM guess what you meant
31
+ - **One Workflow, Every Feature, Any Size** — same process for a button or a backend rewrite
32
+ - **Obvious > Clever** — boring solutions that work beat clever ones that break
33
+
34
+ ### Rapid Waterfall
35
+
36
+ SPECTRE is essentially rapid waterfall: specificity up front → working code → iterate.
37
+
38
+ AI agents are 10x better at working around *working* existing code. That's why they're great at refactors — they have an established baseline. SPECTRE gets you to working code faster, then you iterate.
39
+
40
+ ---
41
+
42
+ ## Getting Started
43
+
44
+ ### Installation
45
+
46
+ ```bash
47
+ # In Claude Code
48
+ /plugin marketplace add Codename-Inc/spectre
49
+ /plugin install spectre@codename
50
+ ```
51
+
52
+ ### Your First Feature
53
+
54
+ ```plaintext
55
+ /spectre:scope
56
+ ```
57
+
58
+ That's it. Start with scope, follow the prompts, and SPECTRE will guide you through the rest. Every command ends with "Next Steps" suggestions — you never have to remember what to run next.
59
+
60
+ ### Session Memory
61
+
62
+ SPECTRE accumulates context across sessions:
63
+
64
+ 1. Turn off auto-compact in Claude Code `/config`
65
+ 2. Run `/spectre:handoff` before session ends or when context window is getting full
66
+ 3. Run `/clear` — next session auto-loads your progress
67
+ 4. `/spectre:forget` when switching gears to start fresh
68
+
69
+ ---
70
+
71
+ ## The SPECTRE Workflow
72
+
73
+ **S**cope → **P**lan → **E**xecute → **C**lean → **T**est → **R**ebase → **E**valuate
74
+
75
+ | Phase | Command | What It Does |
76
+ |-------|---------|--------------|
77
+ | **S**cope | `/spectre:scope` | Define requirements, constraints, what's IN and OUT |
78
+ | **P**lan | `/spectre:plan` | Research codebase, create implementation plan + tasks |
79
+ | **E**xecute | `/spectre:execute` | Parallel subagent development in waves |
80
+ | **C**lean | `/spectre:clean` | Remove dead code, fix duplication, lint |
81
+ | **T**est | `/spectre:test` | Risk-aware test coverage (not brute-force 100%) |
82
+ | **R**ebase | `/spectre:rebase` | Safe merge preparation with conflict handling |
83
+ | **E**valuate | `/spectre:evaluate` | Architecture review + knowledge capture |
84
+
85
+ You can use any command standalone — they don't require running in order.
86
+
87
+ ---
88
+
89
+ ## Typical Daily Usage
90
+
91
+ This is how the creator of SPECTRE uses it daily:
92
+
93
+ ### Building a Feature (the main loop)
94
+
95
+ 1. **`/spectre:scope`** — Get crisp on what's in/out. Non-negotiable unless it's a one-liner.
96
+ - If UX is unclear: run `/spectre:ux_spec` first for user flows and components
97
+
98
+ 2. **`/spectre:plan`** — Build a well-researched technical design or task set
99
+ - Once you have scope/plan/tasks, run `/spectre:handoff` for a fresh context window
100
+
101
+ 3. **`/spectre:execute`** — Parallel subagents work through the tasks
102
+ - Execute also calls code review and validation automatically
103
+ - When done, run `/spectre:handoff` again for clean context
104
+
105
+ 4. **Manual testing + fixes** — Test the feature yourself
106
+ - Use Claude Code's built-in `/plan` mode for small fixes
107
+ - Use `/spectre:fix` for structured debugging of tough bugs
108
+ - New scope needed? Run another `/spectre:scope` cycle
109
+ - Use `/spectre:handoff` liberally to keep context clean
110
+
111
+ 5. **`/spectre:sweep`** — Commit accumulated changes with lint + test
112
+ - Groups changes logically with descriptive conventional commits
113
+
114
+ 6. **`/spectre:clean`** then **`/spectre:test`** — Deep cleanup and risk-aware testing
115
+
116
+ 7. **`/spectre:rebase`** — Rebase onto parent branch, prepare for merge
117
+
118
+ 8. **`/spectre:evaluate`** — Architecture review + capture knowledge for future sessions
119
+
120
+ 9. **Merge/PR** — Address PR comments, get it checked in
121
+
122
+ ### Quick Tasks (skip the ceremony)
123
+
124
+ For small/medium changes (1-5 tasks):
125
+ ```plaintext
126
+ /spectre:quick_dev
127
+ ```
128
+ Lightweight scope + plan that gets you to execution fast.
129
+
130
+ ### Autonomous Ship (zero gates)
131
+
132
+ For low-complexity features/fixes where you trust the agent:
133
+ ```plaintext
134
+ /spectre:ship
135
+ ```
136
+ Brain dump context, walk away, review the PR. Zero confirmation gates — scope, TDD, sweep, rebase, and PR creation happen autonomously.
137
+
138
+ ---
139
+
140
+ ## Command Reference
141
+
142
+ ### Phase: Scope — Discovery & Requirements
143
+
144
+ | Command | When to Use |
145
+ |---------|-------------|
146
+ | `/spectre:scope` | Starting any new feature — interactive scoping with IN/OUT boundaries |
147
+ | `/spectre:kickoff` | High-ambiguity projects — includes web research for best practices |
148
+ | `/spectre:research` | Need deep codebase understanding before planning |
149
+ | `/spectre:ux_spec` | UI-heavy features that need screen layouts, user flows, component states |
150
+
151
+ ### Phase: Plan — Research & Task Breakdown
152
+
153
+ | Command | When to Use |
154
+ |---------|-------------|
155
+ | `/spectre:plan` | Unified entry — researches, assesses complexity, routes to right workflow |
156
+ | `/spectre:create_plan` | Complex work needing architectural design before tasking |
157
+ | `/spectre:create_tasks` | Requirements/plan ready to become concrete tasks |
158
+ | `/spectre:plan_review` | Sanity check a plan/task list for over-engineering |
159
+
160
+ ### Phase: Execute — Development & Verification
161
+
162
+ | Command | When to Use |
163
+ |---------|-------------|
164
+ | `/spectre:execute` | Tasks exist, ready for coordinated multi-agent parallel execution |
165
+ | `/spectre:code_review` | Implementation complete, ready for in-depth review |
166
+ | `/spectre:validate` | Verify implementation against original scope requirement-by-requirement |
167
+ | `/spectre:create_test_guide` | Generate manual QA checklist based on features and risks |
168
+
169
+ ### Phase: Clean — Codebase Hygiene
170
+
171
+ | Command | When to Use |
172
+ |---------|-------------|
173
+ | `/spectre:clean` | Deep cleanup — dead code, duplication, artifacts |
174
+ | `/spectre:sweep` | Light pass — lint, test, descriptive commits for accumulated changes |
175
+
176
+ ### Phase: Test — Risk-Aware Coverage
177
+
178
+ | Command | When to Use |
179
+ |---------|-------------|
180
+ | `/spectre:test` | After changes — analyzes risk tiers (P0-P3), writes behavioral tests |
181
+
182
+ ### Phase: Rebase — Merge Preparation
183
+
184
+ | Command | When to Use |
185
+ |---------|-------------|
186
+ | `/spectre:rebase` | Rebase working branch onto target with conflict handling |
187
+
188
+ ### Phase: Evaluate — Review & Learn
189
+
190
+ | Command | When to Use |
191
+ |---------|-------------|
192
+ | `/spectre:evaluate` | Full evaluate — architecture review (background) + knowledge capture |
193
+ | `/spectre:learn` | Just capture knowledge from this session |
194
+ | `/spectre:architecture_review` | Just run the architecture review |
195
+ | `/spectre:recall {query}` | Find and load existing knowledge |
196
+
197
+ ### Session & Utilities
198
+
199
+ | Command | When to Use |
200
+ |---------|-------------|
201
+ | `/spectre:handoff` | Save session state — end of session, context full, switching gears |
202
+ | `/spectre:forget` | Clear memory, archive logs, start fresh |
203
+ | `/spectre:fix` | Structured debugging for tough bugs |
204
+ | `/spectre:quick_dev` | Lightweight scope + plan for small/medium tasks |
205
+ | `/spectre:ship` | Autonomous end-to-end: brain dump → scope → TDD → commit → rebase → PR |
206
+
207
+ ---
208
+
209
+ ## Quick Decision Tree
210
+
211
+ **Starting a feature?**
212
+ -> `/spectre:scope` (always start here unless it's trivial)
213
+
214
+ **Feature has complex UI?**
215
+ -> `/spectre:ux_spec` after scope, before plan
216
+
217
+ **High ambiguity / new project?**
218
+ -> `/spectre:kickoff` (includes web research)
219
+
220
+ **Need to understand code first?**
221
+ -> `/spectre:research`
222
+
223
+ **Have scope, need plan?**
224
+ -> `/spectre:plan` (auto-routes based on complexity)
225
+
226
+ **Have tasks, ready to build?**
227
+ -> `/spectre:execute`
228
+
229
+ **Code complete, need review?**
230
+ -> `/spectre:code_review` then `/spectre:validate`
231
+
232
+ **Accumulated uncommitted changes?**
233
+ -> `/spectre:sweep` (light) or `/spectre:clean` (deep)
234
+
235
+ **Need test coverage?**
236
+ -> `/spectre:test`
237
+
238
+ **Ready to merge?**
239
+ -> `/spectre:rebase`
240
+
241
+ **Feature done?**
242
+ -> `/spectre:evaluate` (review + learn)
243
+
244
+ **Ending session?**
245
+ -> `/spectre:handoff`
246
+
247
+ **Switching contexts?**
248
+ -> `/spectre:forget`
249
+
250
+ **Bug to fix?**
251
+ -> `/spectre:fix`
252
+
253
+ **Small task, skip ceremony?**
254
+ -> `/spectre:quick_dev`
255
+
256
+ **Low-complexity task, full autonomy?**
257
+ -> `/spectre:ship` (brain dump → PR, zero gates)
258
+
259
+ ---
260
+
261
+ ## Subagents
262
+
263
+ SPECTRE dispatches these automatically — you don't need to call them directly. But `@spectre:web-research` is useful for ad-hoc web research (like mini deep-research).
264
+
265
+ | Agent | Purpose | Model |
266
+ |-------|---------|-------|
267
+ | `@spectre:dev` | Implementation with MVP focus | sonnet |
268
+ | `@spectre:analyst` | Understand how code works | haiku |
269
+ | `@spectre:finder` | Find where code lives | haiku |
270
+ | `@spectre:patterns` | Find reusable patterns | sonnet |
271
+ | `@spectre:web-research` | Web research | sonnet |
272
+ | `@spectre:tester` | Test automation | sonnet |
273
+ | `@spectre:reviewer` | Independent code review | opus |
274
+ | `@spectre:sync` | Session memory consolidation | haiku |
275
+
276
+ ---
277
+
278
+ ## Canonical Docs
279
+
280
+ SPECTRE generates these documents in `docs/tasks/{branch_name}/`:
281
+
282
+ | Document | Generated By | Purpose |
283
+ |----------|-------------|---------|
284
+ | `concepts/scope.md` | `/spectre:scope` | What's IN and OUT |
285
+ | `specs/ux.md` | `/spectre:ux_spec` | User flows, components, interactions |
286
+ | `specs/plan.md` | `/spectre:create_plan` | Technical design and phasing |
287
+ | `specs/tasks.md` | `/spectre:create_tasks` | Concrete tasks with acceptance criteria |
288
+ | `reviews/code_review.md` | `/spectre:code_review` | Severity-based code review findings |
289
+ | `validation/validation_gaps.md` | `/spectre:validate` | Gaps between scope and implementation |
290
+ | `testing/*_test_guide.md` | `/spectre:create_test_guide` | Manual QA checklists |
291
+ | `session_logs/*_handoff.json` | `/spectre:handoff` | Session state snapshots |
292
+
293
+ Keep these checked into git — they're the context in context engineering.
294
+
295
+ ---
296
+
297
+ ## For Agents: Footer Rendering
298
+
299
+ **Always render a 60-column ASCII box footer at the end of command output.**
300
+
301
+ ### Template
302
+
303
+ ```
304
+ ╔══════════════════════════════════════════════════════════╗
305
+ ║ NEXT STEPS ║
306
+ ╠══════════════════════════════════════════════════════════╣
307
+ ║ Phase: {phase} | {status} | {blockers} ║
308
+ ╟──────────────────────────────────────────────────────────╢
309
+ ║ Next — {concise recommendation; 1–2 lines max} ║
310
+ ║ ║
311
+ ║ Options: ║
312
+ ║ - {/spectre:command or action} — {why} ║
313
+ ║ - {/spectre:command or action} — {why} ║
314
+ ║ - {/spectre:command or action} — {why} ║
315
+ ║ … up to 5 total; max 2 manual actions ║
316
+ ║ ║
317
+ ║ Reply — {only if textual reply expected} ║
318
+ ╚══════════════════════════════════════════════════════════╝
319
+ ```
320
+
321
+ ### Status Values
322
+
323
+ - `Active` — work in progress, no blockers
324
+ - `Pending Input` — awaiting user decision/confirmation
325
+ - `Blocked` — external dependency or unresolved issue
326
+ - `On Hold` — paused, waiting for external factor
327
+ - `Complete` — phase finished successfully
328
+
329
+ ### Footer Rules
330
+
331
+ 1. **Width**: Always 60 columns
332
+ 2. **Options**: Max 5 total, max 2 manual (non-slash) actions
333
+ 3. **Slash commands**: Use full `/spectre:` prefix
334
+ 4. **Manual actions**: No slash prefix (e.g., "Run manual tests")
335
+ 5. **Divider**: Include `╟──────╢` between status and next rows
336
+ 6. **Stage Awareness**: Only suggest commands that match current stage
337
+
338
+ ## For Agents: Slash Command Rules
339
+
340
+ **CRITICAL:**
341
+
342
+ 1. **All SPECTRE commands use `/spectre:` prefix** (e.g., `/spectre:scope`, `/spectre:execute`)
343
+ 2. **Manual actions are NOT slash commands** (e.g., "Run tests", "Review PR feedback")
344
+ 3. **Never invent slash commands** — only suggest commands listed in this guide
345
+
346
+ **Correct:**
347
+ ```
348
+ /spectre:scope — Interactive feature scoping
349
+ /spectre:execute — Parallel agent execution
350
+ Run manual tests — Execute test guide checklist
351
+ ```
352
+
353
+ **Incorrect:**
354
+ ```
355
+ /scope — Missing spectre: prefix
356
+ /run tests — Not a slash command
357
+ /commit — Does not exist
358
+ ```