@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.
- package/README.md +3 -4
- 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 +2 -1
- 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/{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/{commands/scope.md → skills/scope/SKILL.md} +9 -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/{commands/ux_spec.md → skills/ux_spec/SKILL.md} +9 -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/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 +128 -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_spec/SKILL.md +100 -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/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,70 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "fix"
|
|
3
|
+
description: "Investigate bugs & implement fixes - primary agent"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# fix
|
|
8
|
+
|
|
9
|
+
## Input Handling
|
|
10
|
+
|
|
11
|
+
Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value.
|
|
12
|
+
|
|
13
|
+
# fix: Analyze bug and recommend fix
|
|
14
|
+
|
|
15
|
+
## Description
|
|
16
|
+
|
|
17
|
+
- **What** — Hypothesize root causes, investigate in parallel, recommend fix with logging
|
|
18
|
+
- **Outcome** — Root cause identified, solution recommendation with `[🪳 TEMP]` debug logging
|
|
19
|
+
|
|
20
|
+
## Variables
|
|
21
|
+
|
|
22
|
+
### Dynamic Variables
|
|
23
|
+
|
|
24
|
+
- `bug_report`: Error details, repro steps, context — (via ARGUMENTS: $ARGUMENTS)
|
|
25
|
+
|
|
26
|
+
### Static Variables
|
|
27
|
+
|
|
28
|
+
- `debug_prefix`: \[🪳 TEMP {TOPIC}\]
|
|
29
|
+
|
|
30
|
+
## ARGUMENTS Input
|
|
31
|
+
|
|
32
|
+
<ARGUMENTS> $ARGUMENTS </ARGUMENTS>
|
|
33
|
+
|
|
34
|
+
## Step (1/5) - Gather Bug Context
|
|
35
|
+
|
|
36
|
+
- **Action** — CheckInput: Verify bug report provided
|
|
37
|
+
- **If**: ARGUMENTS empty
|
|
38
|
+
- **Then**: Ask user for error message, repro steps, and relevant context
|
|
39
|
+
- **Else**: Use ARGUMENTS as bug report; request missing details if needed
|
|
40
|
+
- **Wait** — Bug report with error details and repro steps
|
|
41
|
+
|
|
42
|
+
## Step (2/5) - Generate Hypotheses
|
|
43
|
+
|
|
44
|
+
- **Action** — Brainstorm: Reflect on 5-7 possible sources of the problem
|
|
45
|
+
- **Action** — Prioritize: Distill to 1-2 most likely root causes
|
|
46
|
+
- Consider: the primary data flow for this component/module, recent changes, error patterns, stack traces, affected code paths
|
|
47
|
+
|
|
48
|
+
## Step (3/5) - Investigate in Parallel
|
|
49
|
+
|
|
50
|
+
- **Action** — DispatchAgents: Spawn parallel `@analyst` subagents to investigate top hypotheses
|
|
51
|
+
- Each agent gets one hypothesis to trace through codebase
|
|
52
|
+
- Agents search for: relevant code, recent commits, similar patterns, edge cases
|
|
53
|
+
|
|
54
|
+
## Step (4/5) - Summarize Findings
|
|
55
|
+
|
|
56
|
+
- **Action** — Synthesize: Summarize findings and solution recommendation
|
|
57
|
+
- Include: root cause, affected files, proposed fix approach
|
|
58
|
+
- **Rule**: Solution must include `{debug_prefix}` logging to verify fix and gather data if fix fails
|
|
59
|
+
- **Action** — HoldForApproval: Present analysis; do NOT write code yet
|
|
60
|
+
- **Wait** — User approval before implementing fix
|
|
61
|
+
|
|
62
|
+
## Step (5/5) - Execute
|
|
63
|
+
|
|
64
|
+
- **Action** — Load TDD Skill: Load @spectre-tdd SKILL to use TDD
|
|
65
|
+
- **Action** — Execute Fix: Add Logs and Implement Fix using TDD
|
|
66
|
+
- **Action** — When finished, summarize what you delivered, including providing specific steps for the user to validate.
|
|
67
|
+
|
|
68
|
+
## Next Steps
|
|
69
|
+
|
|
70
|
+
Use the spectre-guide Skills and render the Next Steps Footer per the skill guidance
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "forget"
|
|
3
|
+
description: "Clear session memory - archive all session files so next session starts fresh"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# forget
|
|
8
|
+
|
|
9
|
+
## Input Handling
|
|
10
|
+
|
|
11
|
+
Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# forget: Clear Session Memory
|
|
15
|
+
|
|
16
|
+
## Description
|
|
17
|
+
- **What** — Archive all session files (handoffs, todos, history) so the SessionStart hook doesn't auto-resume
|
|
18
|
+
- **Outcome** — All session files moved to archive, user informed to start fresh session
|
|
19
|
+
|
|
20
|
+
## Step (1/2) - Archive Session Logs
|
|
21
|
+
|
|
22
|
+
- **Action** — ArchiveLogs: Move session logs to archive directory
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)
|
|
26
|
+
session_dir="docs/tasks/${branch}/session_logs"
|
|
27
|
+
archive_dir="${session_dir}/archive"
|
|
28
|
+
|
|
29
|
+
# Check if session logs exist
|
|
30
|
+
if [ ! -d "$session_dir" ] || [ -z "$(ls -A ${session_dir}/*.json 2>/dev/null)" ]; then
|
|
31
|
+
echo "NO_SESSIONS"
|
|
32
|
+
exit 0
|
|
33
|
+
fi
|
|
34
|
+
|
|
35
|
+
# Create archive and move all session files
|
|
36
|
+
mkdir -p "$archive_dir"
|
|
37
|
+
mv ${session_dir}/*_handoff.json "$archive_dir/" 2>/dev/null || true
|
|
38
|
+
mv ${session_dir}/*_todos.json "$archive_dir/" 2>/dev/null || true
|
|
39
|
+
mv ${session_dir}/todos_history.json "$archive_dir/" 2>/dev/null || true
|
|
40
|
+
|
|
41
|
+
# Count archived
|
|
42
|
+
archived_count=$(ls -1 ${archive_dir}/*_handoff.json 2>/dev/null | wc -l | xargs)
|
|
43
|
+
echo "ARCHIVED:${archived_count}"
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## Step (2/2) - Confirm to User
|
|
47
|
+
|
|
48
|
+
- **Action** — ConfirmCleared: Based on bash output, inform user
|
|
49
|
+
|
|
50
|
+
**If** output is `NO_SESSIONS`:
|
|
51
|
+
> No session logs found for this branch. Memory is already clear.
|
|
52
|
+
|
|
53
|
+
**Else** (output is `ARCHIVED:N`):
|
|
54
|
+
> ✓ Session memory cleared
|
|
55
|
+
>
|
|
56
|
+
> Archived {N} handoff file(s) to `docs/tasks/{branch}/session_logs/archive/`
|
|
57
|
+
>
|
|
58
|
+
> **Next**: Start a new session with `/clear` or close this terminal. Your next session will start fresh without auto-loaded context.
|
|
59
|
+
|
|
60
|
+
## Success Criteria
|
|
61
|
+
|
|
62
|
+
- [ ] Session logs directory checked for existence
|
|
63
|
+
- [ ] All `*_handoff.json` files moved to `archive/` subdirectory
|
|
64
|
+
- [ ] All `*_todos.json` files moved to `archive/` subdirectory
|
|
65
|
+
- [ ] `todos_history.json` moved to `archive/` subdirectory
|
|
66
|
+
- [ ] User informed of result (no sessions found OR count archived)
|
|
67
|
+
- [ ] Clear instructions provided for starting fresh session
|
|
@@ -0,0 +1,359 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "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
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# SPECTRE Guide
|
|
8
|
+
|
|
9
|
+
The single reference for how to use SPECTRE — for both humans and agents.
|
|
10
|
+
|
|
11
|
+
## When to Load
|
|
12
|
+
|
|
13
|
+
- After completing any spectre command (to render Next Steps footer)
|
|
14
|
+
- When suggesting next actions to the user
|
|
15
|
+
- When users ask "what command should I run?" or "how does SPECTRE work?"
|
|
16
|
+
- When onboarding a new user to SPECTRE
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Core Philosophy
|
|
21
|
+
|
|
22
|
+
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.
|
|
23
|
+
|
|
24
|
+
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.
|
|
25
|
+
|
|
26
|
+
The better the inputs, the better the outputs. SPECTRE makes it easy to provide great inputs.
|
|
27
|
+
|
|
28
|
+
### Principles
|
|
29
|
+
|
|
30
|
+
- **Great Inputs → Great Outputs** — specificity up front forces clarity
|
|
31
|
+
- **Ambiguity is Death** — never let the LLM guess what you meant
|
|
32
|
+
- **One Workflow, Every Feature, Any Size** — same process for a button or a backend rewrite
|
|
33
|
+
- **Obvious > Clever** — boring solutions that work beat clever ones that break
|
|
34
|
+
|
|
35
|
+
### Rapid Waterfall
|
|
36
|
+
|
|
37
|
+
SPECTRE is essentially rapid waterfall: specificity up front → working code → iterate.
|
|
38
|
+
|
|
39
|
+
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.
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Getting Started
|
|
44
|
+
|
|
45
|
+
### Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
# In Claude Code
|
|
49
|
+
/plugin marketplace add Codename-Inc/spectre
|
|
50
|
+
/plugin install spectre@codename
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Your First Feature
|
|
54
|
+
|
|
55
|
+
```plaintext
|
|
56
|
+
scope
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
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.
|
|
60
|
+
|
|
61
|
+
### Session Memory
|
|
62
|
+
|
|
63
|
+
SPECTRE accumulates context across sessions:
|
|
64
|
+
|
|
65
|
+
1. Turn off auto-compact in Claude Code `/config`
|
|
66
|
+
2. Run `handoff` before session ends or when context window is getting full
|
|
67
|
+
3. Run `/clear` — next session auto-loads your progress
|
|
68
|
+
4. `forget` when switching gears to start fresh
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## The SPECTRE Workflow
|
|
73
|
+
|
|
74
|
+
**S**cope → **P**lan → **E**xecute → **C**lean → **T**est → **R**ebase → **E**valuate
|
|
75
|
+
|
|
76
|
+
| Phase | Command | What It Does |
|
|
77
|
+
|-------|---------|--------------|
|
|
78
|
+
| **S**cope | `scope` | Define requirements, constraints, what's IN and OUT |
|
|
79
|
+
| **P**lan | `plan` | Research codebase, create implementation plan + tasks |
|
|
80
|
+
| **E**xecute | `execute` | Parallel subagent development in waves |
|
|
81
|
+
| **C**lean | `clean` | Remove dead code, fix duplication, lint |
|
|
82
|
+
| **T**est | `test` | Risk-aware test coverage (not brute-force 100%) |
|
|
83
|
+
| **R**ebase | `rebase` | Safe merge preparation with conflict handling |
|
|
84
|
+
| **E**valuate | `evaluate` | Architecture review + knowledge capture |
|
|
85
|
+
|
|
86
|
+
You can use any command standalone — they don't require running in order.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Typical Daily Usage
|
|
91
|
+
|
|
92
|
+
This is how the creator of SPECTRE uses it daily:
|
|
93
|
+
|
|
94
|
+
### Building a Feature (the main loop)
|
|
95
|
+
|
|
96
|
+
1. **`scope`** — Get crisp on what's in/out. Non-negotiable unless it's a one-liner.
|
|
97
|
+
- If UX is unclear: run `ux_spec` first for user flows and components
|
|
98
|
+
|
|
99
|
+
2. **`plan`** — Build a well-researched technical design or task set
|
|
100
|
+
- Once you have scope/plan/tasks, run `handoff` for a fresh context window
|
|
101
|
+
|
|
102
|
+
3. **`execute`** — Parallel subagents work through the tasks
|
|
103
|
+
- Execute also calls code review and validation automatically
|
|
104
|
+
- When done, run `handoff` again for clean context
|
|
105
|
+
|
|
106
|
+
4. **Manual testing + fixes** — Test the feature yourself
|
|
107
|
+
- Use Claude Code's built-in `/plan` mode for small fixes
|
|
108
|
+
- Use `fix` for structured debugging of tough bugs
|
|
109
|
+
- New scope needed? Run another `scope` cycle
|
|
110
|
+
- Use `handoff` liberally to keep context clean
|
|
111
|
+
|
|
112
|
+
5. **`sweep`** — Commit accumulated changes with lint + test
|
|
113
|
+
- Groups changes logically with descriptive conventional commits
|
|
114
|
+
|
|
115
|
+
6. **`clean`** then **`test`** — Deep cleanup and risk-aware testing
|
|
116
|
+
|
|
117
|
+
7. **`rebase`** — Rebase onto parent branch, prepare for merge
|
|
118
|
+
|
|
119
|
+
8. **`evaluate`** — Architecture review + capture knowledge for future sessions
|
|
120
|
+
|
|
121
|
+
9. **Merge/PR** — Address PR comments, get it checked in
|
|
122
|
+
|
|
123
|
+
### Quick Tasks (skip the ceremony)
|
|
124
|
+
|
|
125
|
+
For small/medium changes (1-5 tasks):
|
|
126
|
+
```plaintext
|
|
127
|
+
quick_dev
|
|
128
|
+
```
|
|
129
|
+
Lightweight scope + plan that gets you to execution fast.
|
|
130
|
+
|
|
131
|
+
### Autonomous Ship (zero gates)
|
|
132
|
+
|
|
133
|
+
For low-complexity features/fixes where you trust the agent:
|
|
134
|
+
```plaintext
|
|
135
|
+
ship
|
|
136
|
+
```
|
|
137
|
+
Brain dump context, walk away, review the PR. Zero confirmation gates — scope, TDD, sweep, rebase, and PR creation happen autonomously.
|
|
138
|
+
|
|
139
|
+
---
|
|
140
|
+
|
|
141
|
+
## Command Reference
|
|
142
|
+
|
|
143
|
+
### Phase: Scope — Discovery & Requirements
|
|
144
|
+
|
|
145
|
+
| Command | When to Use |
|
|
146
|
+
|---------|-------------|
|
|
147
|
+
| `scope` | Starting any new feature — interactive scoping with IN/OUT boundaries |
|
|
148
|
+
| `kickoff` | High-ambiguity projects — includes web research for best practices |
|
|
149
|
+
| `research` | Need deep codebase understanding before planning |
|
|
150
|
+
| `ux_spec` | UI-heavy features that need screen layouts, user flows, component states |
|
|
151
|
+
|
|
152
|
+
### Phase: Plan — Research & Task Breakdown
|
|
153
|
+
|
|
154
|
+
| Command | When to Use |
|
|
155
|
+
|---------|-------------|
|
|
156
|
+
| `plan` | Unified entry — researches, assesses complexity, routes to right workflow |
|
|
157
|
+
| `create_plan` | Complex work needing architectural design before tasking |
|
|
158
|
+
| `create_tasks` | Requirements/plan ready to become concrete tasks |
|
|
159
|
+
| `plan_review` | Sanity check a plan/task list for over-engineering |
|
|
160
|
+
|
|
161
|
+
### Phase: Execute — Development & Verification
|
|
162
|
+
|
|
163
|
+
| Command | When to Use |
|
|
164
|
+
|---------|-------------|
|
|
165
|
+
| `execute` | Tasks exist, ready for coordinated multi-agent parallel execution |
|
|
166
|
+
| `code_review` | Implementation complete, ready for in-depth review |
|
|
167
|
+
| `validate` | Verify implementation against original scope requirement-by-requirement |
|
|
168
|
+
| `create_test_guide` | Generate manual QA checklist based on features and risks |
|
|
169
|
+
|
|
170
|
+
### Phase: Clean — Codebase Hygiene
|
|
171
|
+
|
|
172
|
+
| Command | When to Use |
|
|
173
|
+
|---------|-------------|
|
|
174
|
+
| `clean` | Deep cleanup — dead code, duplication, artifacts |
|
|
175
|
+
| `sweep` | Light pass — lint, test, descriptive commits for accumulated changes |
|
|
176
|
+
|
|
177
|
+
### Phase: Test — Risk-Aware Coverage
|
|
178
|
+
|
|
179
|
+
| Command | When to Use |
|
|
180
|
+
|---------|-------------|
|
|
181
|
+
| `test` | After changes — analyzes risk tiers (P0-P3), writes behavioral tests |
|
|
182
|
+
|
|
183
|
+
### Phase: Rebase — Merge Preparation
|
|
184
|
+
|
|
185
|
+
| Command | When to Use |
|
|
186
|
+
|---------|-------------|
|
|
187
|
+
| `rebase` | Rebase working branch onto target with conflict handling |
|
|
188
|
+
|
|
189
|
+
### Phase: Evaluate — Review & Learn
|
|
190
|
+
|
|
191
|
+
| Command | When to Use |
|
|
192
|
+
|---------|-------------|
|
|
193
|
+
| `evaluate` | Full evaluate — architecture review (background) + knowledge capture |
|
|
194
|
+
| `learn` | Just capture knowledge from this session |
|
|
195
|
+
| `architecture_review` | Just run the architecture review |
|
|
196
|
+
| `recall {query}` | Find and load existing knowledge |
|
|
197
|
+
|
|
198
|
+
### Session & Utilities
|
|
199
|
+
|
|
200
|
+
| Command | When to Use |
|
|
201
|
+
|---------|-------------|
|
|
202
|
+
| `handoff` | Save session state — end of session, context full, switching gears |
|
|
203
|
+
| `forget` | Clear memory, archive logs, start fresh |
|
|
204
|
+
| `fix` | Structured debugging for tough bugs |
|
|
205
|
+
| `quick_dev` | Lightweight scope + plan for small/medium tasks |
|
|
206
|
+
| `ship` | Autonomous end-to-end: brain dump → scope → TDD → commit → rebase → PR |
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Quick Decision Tree
|
|
211
|
+
|
|
212
|
+
**Starting a feature?**
|
|
213
|
+
-> `scope` (always start here unless it's trivial)
|
|
214
|
+
|
|
215
|
+
**Feature has complex UI?**
|
|
216
|
+
-> `ux_spec` after scope, before plan
|
|
217
|
+
|
|
218
|
+
**High ambiguity / new project?**
|
|
219
|
+
-> `kickoff` (includes web research)
|
|
220
|
+
|
|
221
|
+
**Need to understand code first?**
|
|
222
|
+
-> `research`
|
|
223
|
+
|
|
224
|
+
**Have scope, need plan?**
|
|
225
|
+
-> `plan` (auto-routes based on complexity)
|
|
226
|
+
|
|
227
|
+
**Have tasks, ready to build?**
|
|
228
|
+
-> `execute`
|
|
229
|
+
|
|
230
|
+
**Code complete, need review?**
|
|
231
|
+
-> `code_review` then `validate`
|
|
232
|
+
|
|
233
|
+
**Accumulated uncommitted changes?**
|
|
234
|
+
-> `sweep` (light) or `clean` (deep)
|
|
235
|
+
|
|
236
|
+
**Need test coverage?**
|
|
237
|
+
-> `test`
|
|
238
|
+
|
|
239
|
+
**Ready to merge?**
|
|
240
|
+
-> `rebase`
|
|
241
|
+
|
|
242
|
+
**Feature done?**
|
|
243
|
+
-> `evaluate` (review + learn)
|
|
244
|
+
|
|
245
|
+
**Ending session?**
|
|
246
|
+
-> `handoff`
|
|
247
|
+
|
|
248
|
+
**Switching contexts?**
|
|
249
|
+
-> `forget`
|
|
250
|
+
|
|
251
|
+
**Bug to fix?**
|
|
252
|
+
-> `fix`
|
|
253
|
+
|
|
254
|
+
**Small task, skip ceremony?**
|
|
255
|
+
-> `quick_dev`
|
|
256
|
+
|
|
257
|
+
**Low-complexity task, full autonomy?**
|
|
258
|
+
-> `ship` (brain dump → PR, zero gates)
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Subagents
|
|
263
|
+
|
|
264
|
+
SPECTRE dispatches these automatically — you don't need to call them directly. But `@web-research` is useful for ad-hoc web research (like mini deep-research).
|
|
265
|
+
|
|
266
|
+
| Agent | Purpose | Model |
|
|
267
|
+
|-------|---------|-------|
|
|
268
|
+
| `@dev` | Implementation with MVP focus | sonnet |
|
|
269
|
+
| `@analyst` | Understand how code works | haiku |
|
|
270
|
+
| `@finder` | Find where code lives | haiku |
|
|
271
|
+
| `@patterns` | Find reusable patterns | sonnet |
|
|
272
|
+
| `@web-research` | Web research | sonnet |
|
|
273
|
+
| `@tester` | Test automation | sonnet |
|
|
274
|
+
| `@reviewer` | Independent code review | opus |
|
|
275
|
+
| `@sync` | Session memory consolidation | haiku |
|
|
276
|
+
|
|
277
|
+
---
|
|
278
|
+
|
|
279
|
+
## Canonical Docs
|
|
280
|
+
|
|
281
|
+
SPECTRE generates these documents in `docs/tasks/{branch_name}/`:
|
|
282
|
+
|
|
283
|
+
| Document | Generated By | Purpose |
|
|
284
|
+
|----------|-------------|---------|
|
|
285
|
+
| `concepts/scope.md` | `scope` | What's IN and OUT |
|
|
286
|
+
| `specs/ux.md` | `ux_spec` | User flows, components, interactions |
|
|
287
|
+
| `specs/plan.md` | `create_plan` | Technical design and phasing |
|
|
288
|
+
| `specs/tasks.md` | `create_tasks` | Concrete tasks with acceptance criteria |
|
|
289
|
+
| `reviews/code_review.md` | `code_review` | Severity-based code review findings |
|
|
290
|
+
| `validation/validation_gaps.md` | `validate` | Gaps between scope and implementation |
|
|
291
|
+
| `testing/*_test_guide.md` | `create_test_guide` | Manual QA checklists |
|
|
292
|
+
| `session_logs/*_handoff.json` | `handoff` | Session state snapshots |
|
|
293
|
+
|
|
294
|
+
Keep these checked into git — they're the context in context engineering.
|
|
295
|
+
|
|
296
|
+
---
|
|
297
|
+
|
|
298
|
+
## For Agents: Footer Rendering
|
|
299
|
+
|
|
300
|
+
**Always render a 60-column ASCII box footer at the end of command output.**
|
|
301
|
+
|
|
302
|
+
### Template
|
|
303
|
+
|
|
304
|
+
```
|
|
305
|
+
╔══════════════════════════════════════════════════════════╗
|
|
306
|
+
║ NEXT STEPS ║
|
|
307
|
+
╠══════════════════════════════════════════════════════════╣
|
|
308
|
+
║ Phase: {phase} | {status} | {blockers} ║
|
|
309
|
+
╟──────────────────────────────────────────────────────────╢
|
|
310
|
+
║ Next — {concise recommendation; 1–2 lines max} ║
|
|
311
|
+
║ ║
|
|
312
|
+
║ Options: ║
|
|
313
|
+
║ - {command or action} — {why} ║
|
|
314
|
+
║ - {command or action} — {why} ║
|
|
315
|
+
║ - {command or action} — {why} ║
|
|
316
|
+
║ … up to 5 total; max 2 manual actions ║
|
|
317
|
+
║ ║
|
|
318
|
+
║ Reply — {only if textual reply expected} ║
|
|
319
|
+
╚══════════════════════════════════════════════════════════╝
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Status Values
|
|
323
|
+
|
|
324
|
+
- `Active` — work in progress, no blockers
|
|
325
|
+
- `Pending Input` — awaiting user decision/confirmation
|
|
326
|
+
- `Blocked` — external dependency or unresolved issue
|
|
327
|
+
- `On Hold` — paused, waiting for external factor
|
|
328
|
+
- `Complete` — phase finished successfully
|
|
329
|
+
|
|
330
|
+
### Footer Rules
|
|
331
|
+
|
|
332
|
+
1. **Width**: Always 60 columns
|
|
333
|
+
2. **Options**: Max 5 total, max 2 manual (non-slash) actions
|
|
334
|
+
3. **Slash commands**: Use full `/spectre:` prefix
|
|
335
|
+
4. **Manual actions**: No slash prefix (e.g., "Run manual tests")
|
|
336
|
+
5. **Divider**: Include `╟──────╢` between status and next rows
|
|
337
|
+
6. **Stage Awareness**: Only suggest commands that match current stage
|
|
338
|
+
|
|
339
|
+
## For Agents: Slash Command Rules
|
|
340
|
+
|
|
341
|
+
**CRITICAL:**
|
|
342
|
+
|
|
343
|
+
1. **All SPECTRE commands use `/spectre:` prefix** (e.g., `scope`, `execute`)
|
|
344
|
+
2. **Manual actions are NOT slash commands** (e.g., "Run tests", "Review PR feedback")
|
|
345
|
+
3. **Never invent slash commands** — only suggest commands listed in this guide
|
|
346
|
+
|
|
347
|
+
**Correct:**
|
|
348
|
+
```
|
|
349
|
+
scope — Interactive feature scoping
|
|
350
|
+
execute — Parallel agent execution
|
|
351
|
+
Run manual tests — Execute test guide checklist
|
|
352
|
+
```
|
|
353
|
+
|
|
354
|
+
**Incorrect:**
|
|
355
|
+
```
|
|
356
|
+
/scope — Missing spectre: prefix
|
|
357
|
+
/run tests — Not a slash command
|
|
358
|
+
/commit — Does not exist
|
|
359
|
+
```
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: "handoff"
|
|
3
|
+
description: "Save state snapshot to session_logs for session resume"
|
|
4
|
+
user-invocable: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# handoff
|
|
8
|
+
|
|
9
|
+
## Input Handling
|
|
10
|
+
|
|
11
|
+
Treat the current command arguments as this workflow's input. When invoked from a slash command, use the forwarded `$ARGUMENTS` value.
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# handoff: Fast Session State Snapshot
|
|
15
|
+
|
|
16
|
+
Generate progress update, gather context, output structured JSON for session resume. Output: `{timestamp}_handoff.json` in session_logs.
|
|
17
|
+
|
|
18
|
+
**Performance Target**: 2-3 tool calls depending on session history
|
|
19
|
+
|
|
20
|
+
**CRITICAL**: Do not narrate or explain what you're doing. No "Session count is 0, so..." or "Let me gather context...". Just execute the steps silently and output ONLY the final confirmation message. Every token matters at end of session.
|
|
21
|
+
|
|
22
|
+
## ARGUMENTS
|
|
23
|
+
|
|
24
|
+
<ARGUMENTS>
|
|
25
|
+
$ARGUMENTS
|
|
26
|
+
</ARGUMENTS>
|
|
27
|
+
|
|
28
|
+
## Step 1: Gather Context (Single Bash Call)
|
|
29
|
+
|
|
30
|
+
- **Action** — GatherContext: Run ONE bash command:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)
|
|
34
|
+
mkdir -p "docs/tasks/${branch}/session_logs"
|
|
35
|
+
|
|
36
|
+
# Count existing session logs for conditional flow
|
|
37
|
+
session_count=$(ls docs/tasks/${branch}/session_logs/*_handoff.json 2>/dev/null | wc -l | xargs)
|
|
38
|
+
|
|
39
|
+
beads_available=false
|
|
40
|
+
beads_tasks='[]'
|
|
41
|
+
beads_count=0
|
|
42
|
+
|
|
43
|
+
if command -v bd &>/dev/null && bd doctor &>/dev/null; then
|
|
44
|
+
beads_available=true
|
|
45
|
+
open=$(bd list --label "$branch" --status open --json 2>/dev/null || echo '[]')
|
|
46
|
+
in_prog=$(bd list --label "$branch" --status in_progress --json 2>/dev/null || echo '[]')
|
|
47
|
+
blocked=$(bd list --label "$branch" --status blocked --json 2>/dev/null || echo '[]')
|
|
48
|
+
beads_tasks=$(echo "$open $in_prog $blocked" | jq -s 'add // []')
|
|
49
|
+
beads_count=$(echo "$beads_tasks" | jq 'length' 2>/dev/null || echo 0)
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
cat << EOF
|
|
53
|
+
{
|
|
54
|
+
"branch": "$branch",
|
|
55
|
+
"commit": "$(git rev-parse --short HEAD 2>/dev/null || echo unknown)",
|
|
56
|
+
"wip_count": $(git status --porcelain 2>/dev/null | wc -l | xargs),
|
|
57
|
+
"ts": "$(date +%Y-%m-%d-%H%M%S)",
|
|
58
|
+
"session_count": $session_count,
|
|
59
|
+
"beads_available": $beads_available,
|
|
60
|
+
"beads_count": $beads_count,
|
|
61
|
+
"beads": $beads_tasks
|
|
62
|
+
}
|
|
63
|
+
EOF
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
**Output**: JSON with branch, commit, wip_count, ts, session_count, beads_available, beads_count, beads[]
|
|
67
|
+
|
|
68
|
+
## Step 2: Compose Handoff Data
|
|
69
|
+
|
|
70
|
+
- **Action** — ComposeProgressUpdate: From session memory, compose using "WE" voice:
|
|
71
|
+
|
|
72
|
+
| Field | Required | Description |
|
|
73
|
+
|-------|----------|-------------|
|
|
74
|
+
| summary | ✓ | Slack-style paragraph a human would read |
|
|
75
|
+
| goal | ✓ | What we're building + success criteria |
|
|
76
|
+
| accomplished | ✓ | What we completed (2-5 bullets) |
|
|
77
|
+
| now | ✓ | **What you were actively working on when session ended** (critical!) |
|
|
78
|
+
| next_steps | ✓ | Upcoming work (2-4 bullets) |
|
|
79
|
+
| confidence | ✓ | high / medium / low |
|
|
80
|
+
| constraints | | Known constraints or assumptions |
|
|
81
|
+
| decisions | | Key decisions made (0-3 bullets) |
|
|
82
|
+
| blockers | | Things blocking progress |
|
|
83
|
+
| open_questions | | Questions needing answers |
|
|
84
|
+
| risks | | Identified risks |
|
|
85
|
+
|
|
86
|
+
**Tone**: "We finished the auth refactor and got tests passing. Hit a snag with OAuth callback - next we'll tackle session management."
|
|
87
|
+
|
|
88
|
+
- **Action** — BuildWorkingSet: Capture active context:
|
|
89
|
+
- `key_files`: Files actively edited
|
|
90
|
+
- `active_ids`: Beads task IDs in progress
|
|
91
|
+
- `recent_commands`: Recent terminal commands (test, build, etc.)
|
|
92
|
+
|
|
93
|
+
- **Action** — BuildBeadsTree (if available): From beads array, build hierarchy (epic → tasks → subtasks). Include task IDs for resume.
|
|
94
|
+
|
|
95
|
+
## Step 3: Conditional Write
|
|
96
|
+
|
|
97
|
+
Check `session_count` from Step 1:
|
|
98
|
+
|
|
99
|
+
### If session_count = 0 (First Session)
|
|
100
|
+
|
|
101
|
+
**Do not narrate. Just write the file and output the confirmation.**
|
|
102
|
+
|
|
103
|
+
Write directly to `docs/tasks/{branch}/session_logs/{ts}_handoff.json`
|
|
104
|
+
|
|
105
|
+
**JSON Schema**:
|
|
106
|
+
```json
|
|
107
|
+
{
|
|
108
|
+
"version": "1.1",
|
|
109
|
+
"timestamp": "{ts}",
|
|
110
|
+
"branch_name": "{branch}",
|
|
111
|
+
"task_name": "{ARGUMENTS or branch}",
|
|
112
|
+
"session_number": 1,
|
|
113
|
+
"progress_update": {
|
|
114
|
+
"summary": "string",
|
|
115
|
+
"goal": "string",
|
|
116
|
+
"accomplished": ["string"],
|
|
117
|
+
"now": "string (critical for resume)",
|
|
118
|
+
"next_steps": ["string"],
|
|
119
|
+
"confidence": "high|medium|low",
|
|
120
|
+
"constraints": ["string"],
|
|
121
|
+
"decisions": ["string"],
|
|
122
|
+
"blockers": ["string"],
|
|
123
|
+
"open_questions": ["string"],
|
|
124
|
+
"risks": ["string"]
|
|
125
|
+
},
|
|
126
|
+
"working_set": {
|
|
127
|
+
"key_files": ["path"],
|
|
128
|
+
"active_ids": ["bd-xxxxx"],
|
|
129
|
+
"recent_commands": ["command"]
|
|
130
|
+
},
|
|
131
|
+
"beads": { // OMIT ENTIRE SECTION if beads_available=false OR beads_count=0
|
|
132
|
+
"available": true,
|
|
133
|
+
"workspace_label": "{branch}",
|
|
134
|
+
"task_count": "number",
|
|
135
|
+
"epic_id": "bd-xxxxx|null",
|
|
136
|
+
"epic_title": "string|null",
|
|
137
|
+
"tasks": [{"id", "title", "status", "type", "parent", "children", "labels"}]
|
|
138
|
+
},
|
|
139
|
+
"context": {
|
|
140
|
+
"wip_state": "uncommitted|clean",
|
|
141
|
+
"last_commit": "abc1234"
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
Then respond: "✓ Handoff saved: {path}. First session recorded. Next session auto-resumes from this context."
|
|
147
|
+
|
|
148
|
+
### If session_count >= 1 (Continuation)
|
|
149
|
+
|
|
150
|
+
**Do not narrate. Just spawn the subagent and output the confirmation when done.**
|
|
151
|
+
|
|
152
|
+
Spawn `@sesh:sync` subagent with the composed data:
|
|
153
|
+
|
|
154
|
+
```
|
|
155
|
+
<current_session>
|
|
156
|
+
{full JSON object you composed above}
|
|
157
|
+
</current_session>
|
|
158
|
+
|
|
159
|
+
<session_logs_path>
|
|
160
|
+
docs/tasks/{branch}/session_logs
|
|
161
|
+
</session_logs_path>
|
|
162
|
+
```
|
|
163
|
+
|
|
164
|
+
The sync agent will:
|
|
165
|
+
1. Read up to 3 previous handoff.json files
|
|
166
|
+
2. Synthesize current context with historical arc
|
|
167
|
+
3. Write the final `{ts}_handoff.json` with enriched continuity
|
|
168
|
+
4. Return the file path
|
|
169
|
+
|
|
170
|
+
Then respond: "✓ Handoff saved: {path}. Session {n} recorded with continuity from {x} previous sessions. Next session auto-resumes from this context."
|