@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.
Files changed (106) hide show
  1. package/README.md +6 -7
  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 +6 -5
  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/skills/prototype/SKILL.md +314 -0
  34. package/plugins/spectre/{commands/quick_dev.md → skills/quick_dev/SKILL.md} +9 -0
  35. package/plugins/spectre/{commands/rebase.md → skills/rebase/SKILL.md} +9 -0
  36. package/plugins/spectre/skills/recall/SKILL.md +17 -0
  37. package/plugins/spectre/{commands/research.md → skills/research/SKILL.md} +9 -0
  38. package/plugins/spectre/skills/scope/SKILL.md +174 -0
  39. package/plugins/spectre/{commands/ship.md → skills/ship/SKILL.md} +9 -0
  40. package/plugins/spectre/{commands/sweep.md → skills/sweep/SKILL.md} +9 -0
  41. package/plugins/spectre/skills/tdd/SKILL.md +111 -0
  42. package/plugins/spectre/{commands/test.md → skills/test/SKILL.md} +9 -0
  43. package/plugins/spectre/skills/ux/SKILL.md +121 -0
  44. package/plugins/spectre/{commands/validate.md → skills/validate/SKILL.md} +9 -0
  45. package/plugins/spectre-codex/agents/analyst.toml +117 -0
  46. package/plugins/spectre-codex/agents/dev.toml +65 -0
  47. package/plugins/spectre-codex/agents/finder.toml +101 -0
  48. package/plugins/spectre-codex/agents/patterns.toml +203 -0
  49. package/plugins/spectre-codex/agents/reviewer.toml +123 -0
  50. package/plugins/spectre-codex/agents/sync.toml +146 -0
  51. package/plugins/spectre-codex/agents/tester.toml +205 -0
  52. package/plugins/spectre-codex/agents/web-research.toml +104 -0
  53. package/plugins/spectre-codex/hooks/hooks.json +23 -0
  54. package/plugins/{spectre/hooks/scripts/bootstrap.cjs → spectre-codex/hooks/scripts/bootstrap.mjs} +15 -16
  55. package/plugins/{spectre/hooks/scripts/handoff-resume.cjs → spectre-codex/hooks/scripts/handoff-resume.mjs} +21 -27
  56. package/plugins/{spectre/hooks/scripts/lib.cjs → spectre-codex/hooks/scripts/lib.mjs} +3 -4
  57. package/plugins/spectre-codex/hooks/scripts/load-knowledge.mjs +189 -0
  58. package/plugins/spectre-codex/hooks/scripts/register_learning.mjs +264 -0
  59. package/plugins/spectre-codex/skills/apply/SKILL.md +87 -0
  60. package/plugins/spectre-codex/skills/architecture_review/SKILL.md +129 -0
  61. package/plugins/spectre-codex/skills/clean/SKILL.md +322 -0
  62. package/plugins/spectre-codex/skills/code_review/SKILL.md +417 -0
  63. package/plugins/spectre-codex/skills/create_plan/SKILL.md +126 -0
  64. package/plugins/spectre-codex/skills/create_tasks/SKILL.md +383 -0
  65. package/plugins/spectre-codex/skills/create_test_guide/SKILL.md +129 -0
  66. package/plugins/spectre-codex/skills/evaluate/SKILL.md +59 -0
  67. package/plugins/spectre-codex/skills/execute/SKILL.md +96 -0
  68. package/plugins/spectre-codex/skills/fix/SKILL.md +70 -0
  69. package/plugins/spectre-codex/skills/forget/SKILL.md +67 -0
  70. package/plugins/spectre-codex/skills/guide/SKILL.md +359 -0
  71. package/plugins/spectre-codex/skills/handoff/SKILL.md +170 -0
  72. package/plugins/spectre-codex/skills/kickoff/SKILL.md +124 -0
  73. package/plugins/spectre-codex/skills/learn/SKILL.md +595 -0
  74. package/plugins/{spectre/skills/spectre-learn → spectre-codex/skills/learn}/references/recall-template.md +4 -1
  75. package/plugins/spectre-codex/skills/plan/SKILL.md +211 -0
  76. package/plugins/spectre-codex/skills/plan_review/SKILL.md +42 -0
  77. package/plugins/spectre-codex/skills/prototype/SKILL.md +314 -0
  78. package/plugins/spectre-codex/skills/quick_dev/SKILL.md +110 -0
  79. package/plugins/spectre-codex/skills/rebase/SKILL.md +82 -0
  80. package/plugins/spectre-codex/skills/recall/SKILL.md +17 -0
  81. package/plugins/spectre-codex/skills/research/SKILL.md +168 -0
  82. package/plugins/spectre-codex/skills/scope/SKILL.md +174 -0
  83. package/plugins/spectre-codex/skills/ship/SKILL.md +181 -0
  84. package/plugins/spectre-codex/skills/sweep/SKILL.md +91 -0
  85. package/plugins/{spectre/skills/spectre-tdd → spectre-codex/skills/tdd}/SKILL.md +1 -1
  86. package/plugins/spectre-codex/skills/test/SKILL.md +389 -0
  87. package/plugins/spectre-codex/skills/ux/SKILL.md +121 -0
  88. package/plugins/spectre-codex/skills/validate/SKILL.md +352 -0
  89. package/src/config.test.js +6 -5
  90. package/src/install.test.js +100 -11
  91. package/src/lib/config.js +107 -54
  92. package/src/lib/constants.js +17 -23
  93. package/src/lib/doctor.js +19 -22
  94. package/src/lib/install.js +98 -313
  95. package/src/lib/knowledge.js +7 -37
  96. package/src/lib/paths.js +0 -12
  97. package/src/pack.test.js +87 -0
  98. package/plugins/spectre/commands/learn.md +0 -15
  99. package/plugins/spectre/commands/recall.md +0 -5
  100. package/plugins/spectre/commands/scope.md +0 -119
  101. package/plugins/spectre/commands/ux_spec.md +0 -91
  102. package/plugins/spectre/hooks/scripts/load-knowledge.cjs +0 -120
  103. package/plugins/spectre/hooks/scripts/precompact-warning.cjs +0 -19
  104. package/plugins/spectre/hooks/scripts/register_learning.cjs +0 -144
  105. package/plugins/spectre/hooks/scripts/test_register-learning.cjs +0 -146
  106. package/plugins/spectre/skills/spectre-apply/SKILL.md +0 -189
@@ -0,0 +1,110 @@
1
+ ---
2
+ name: "quick_dev"
3
+ description: "👻 | Quickly scope, research, & plan s/m tasks - primary agent"
4
+ user-invocable: true
5
+ ---
6
+
7
+ # quick_dev
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
+ # quick_dev: Scope → Research → Plan for Small/Medium Tasks
15
+
16
+ ## Description
17
+ - **What** — Lightweight workflow for bug fixes and small features: confirm scope, research via parallel agents, create implementation plan
18
+ - **Outcome** — Validated scope, research synthesis, `quick_task_plan.md` with parent/sub-task structure
19
+
20
+ ## ARGUMENTS Input
21
+
22
+ <ARGUMENTS>
23
+ $ARGUMENTS
24
+ </ARGUMENTS>
25
+
26
+ ## Step 1 - Gather Context
27
+
28
+ - **Action** — ImmediateReply: Respond before running tools
29
+ - **If** ARGUMENTS has task context → proceed to Step 2
30
+ - **Else** → ask: "What are you trying to build or fix? Share any docs or context."
31
+ - **CRITICAL**: No tool calls here. No technical questions — research answers those.
32
+ - **Wait** — Only if ARGUMENTS empty
33
+
34
+ - **Action** — ReadFiles: Read any files mentioned by user completely (no limit/offset)
35
+
36
+ ## Step 2 - Confirm Scope (Functional Only)
37
+
38
+ **Scope is about WHAT we're building, not HOW.** Technical approach comes from research.
39
+
40
+ **DO NOT ask about**: implementation approach or technical decisions — research answers those.
41
+
42
+ - **Action** — PresentScope:
43
+ > **📋 Scope Confirmation**
44
+ >
45
+ > **Objective**: {functional outcome}
46
+ >
47
+ > **✅ In Scope**: {what the feature does — behaviors, not implementation}
48
+ >
49
+ > **❌ Out of Scope**: {what we're NOT building}
50
+ >
51
+ > **UX Assumptions**: {how you imagine the user flow working}
52
+ >
53
+ > **Constraints**: {user-provided only}
54
+ >
55
+ > Any items to move between IN/OUT? Clarify UX flow? Reply with changes or 'Confirmed'.
56
+
57
+ - **Wait** — User confirms or provides changes (apply and proceed)
58
+
59
+ ## Step 3 - Research
60
+
61
+ - **Action** — SpawnAgents: Launch parallel research agents
62
+ - `@finder` — find WHERE files/components live
63
+ - `@analyst` — understand HOW code works
64
+ - `@patterns` — find similar implementations
65
+ - `@web-research` — external docs (only if user asks)
66
+ - **Wait** for ALL agents to complete
67
+
68
+ - **Action** — Synthesize: Compile findings with file paths, patterns, architectural decisions
69
+
70
+ ## Step 4 - Clarify Ambiguities
71
+
72
+ - **Action** — AskClarifyingQuestions: Use AskUserQuestion tool for 2-4 questions
73
+ - **Only ask** what research revealed needs user decision: UX preferences, behavioral trade-offs
74
+ - For multi-option questions: include Pros/Cons/Trade-offs
75
+ - **Never ask** scope questions (settled in Step 2) or technical questions answerable by code
76
+
77
+ ## Step 5 - Create Plan
78
+
79
+ - **Action** — DetermineOutputDir:
80
+ - `OUT_DIR=docs/tasks/{branch_name}` (or user-specified)
81
+ - `mkdir -p "${OUT_DIR}/specs"`
82
+
83
+ - **Action** — GeneratePlan: Create `{OUT_DIR}/specs/quick_task_plan.md` (use scoped name if exists)
84
+
85
+ **Plan Structure**:
86
+ 1. Agreed Scope (Objective, In/Out of Scope, Constraints)
87
+ 2. Research Summary (key codebase findings)
88
+ 3. Approach Summary (strategy, integration points)
89
+ 4. Implementation Tasks (see format below)
90
+ 5. Success Criteria
91
+
92
+ **Task Format**: `## Phase` → `### [1.1] Parent Task` → `- [ ] **1.1.1** Sub-task` → `- [ ] Criterion`
93
+
94
+ **Sub-task guidance**:
95
+ - Start with action verb, use technical terms, name files/components
96
+ - Include: patterns, integration points, constraints
97
+ - Exclude: code snippets, line-by-line steps
98
+ - 2-3 acceptance criteria per sub-task
99
+
100
+ **Bounds**: ~3 phases, ~8 parent tasks max. If exceeds → suggest `create_tasks`
101
+
102
+ - **Action** — ValidateCoverage: Verify all in-scope items have tasks; no out-of-scope tasks added
103
+
104
+ ## Step 6 - Document & Handoff
105
+
106
+ - **Action** — PresentSummary:
107
+ > **Task Plan Created**: `{path}`
108
+ > ✅ Scope | ✅ Research | ✅ Plan
109
+
110
+ - **Action** — RenderFooter: Use `Skill(spectre-guide)` skill for Next Steps
@@ -0,0 +1,82 @@
1
+ ---
2
+ name: "rebase"
3
+ description: "👻 | Safe guided rebase w/conflict handling - primary agent"
4
+ user-invocable: true
5
+ ---
6
+
7
+ # rebase
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
+ # rebase: Safe Git Rebase with Automatic Conflict Resolution
15
+
16
+ ## Description
17
+ - **What** — Guide rebase with safety refs, automatic conflict resolution, test verification
18
+ - **Outcome** — Successfully rebased branch with resolved conflicts, passing tests, smoketest guide
19
+
20
+ ## ARGUMENTS Input
21
+
22
+ Optional target branch to rebase onto.
23
+
24
+ <ARGUMENTS>
25
+ $ARGUMENTS
26
+ </ARGUMENTS>
27
+
28
+ ## Instructions
29
+ - Auto-commit uncommitted changes (no confirmation)
30
+ - Auto-resolve conflicts favoring target branch conventions (no prompts)
31
+ - Track every resolution decision for summary
32
+ - Actually run tests, don't just suggest
33
+
34
+ ## Step 1 - Confirm Target Branch
35
+
36
+ - **Action** — CheckArguments:
37
+ - **If** ARGUMENTS has branch → proceed
38
+ - **Else** → ask: "What branch to rebase onto? (e.g., `origin/main`)"
39
+ - **Wait** — If needed
40
+
41
+ ## Step 2 - Prepare
42
+
43
+ - **Action** — EnsureCleanTree:
44
+ - **If** uncommitted changes → `git commit -am "chore: snapshot before rebase"`
45
+ - **Action** — FetchLatest: `git fetch origin`
46
+ - **Action** — CreateSafetyRef: `git branch backup/rebase-$(date +%Y%m%d-%H%M%S)`
47
+ - **Action** — AssessComplexity: Light (≤5 commits), Moderate (5-20), Large (>20)
48
+
49
+ ## Step 3 - Execute Rebase
50
+
51
+ - **Action** — StartRebase: `git rebase {target_branch}`
52
+ - **If** no conflicts → skip to Step 4
53
+
54
+ - **Action** — ResolveAllConflicts: For each conflict:
55
+ 1. Read conflict markers
56
+ 2. Resolve (favor target branch patterns)
57
+ 3. Track: `{file}: {decision} — {rationale}`
58
+ 4. `git add {file}`
59
+ 5. `git rebase --continue`
60
+ - Repeat until complete
61
+
62
+ ## Step 4 - Verify
63
+
64
+ - **Action** — RunLint: Fix violations
65
+ - **Action** — RunTestSuite: Detect command (npm test, pytest, cargo test, go test), run full suite
66
+ - **Action** — ValidateRebase: Confirm commit count, no unexpected changes
67
+
68
+ ## Step 5 - Summary
69
+
70
+ - **Action** — GenerateSummary:
71
+ > **Rebase Summary**
72
+ > - Branch: {current} → {target}
73
+ > - Commits: {count} | Conflicts: {count} | Tests: {PASS/FAIL}
74
+ >
75
+ > **Decisions**: | File | Decision | Rationale |
76
+ >
77
+ > **Smoketest Guide** (based on files touched):
78
+ > - {Feature Area}: [ ] {behavior to verify}
79
+ >
80
+ > **Safety**: Backup `{branch}` | Restore: `git reset --hard {backup}`
81
+
82
+ - **Action** — RenderFooter: Use `Skill(spectre-guide)` skill for Next Steps
@@ -0,0 +1,17 @@
1
+ ---
2
+ name: "recall"
3
+ description: "👻 | Search Project Knowledge"
4
+ user-invocable: true
5
+ ---
6
+
7
+ # recall
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
+ # /recall - Search Project Knowledge
14
+
15
+ Load the `spectre-recall` skill and follow its instructions.
16
+
17
+ **Search query**: $ARGUMENTS
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: "research"
3
+ description: "👻 | Research codebase with parallel agents - primary agent"
4
+ user-invocable: true
5
+ ---
6
+
7
+ # research
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
+ # research_codebase: Parallel Evidence-Based Codebase Analysis
15
+
16
+ ## Description
17
+ - Description — Conduct comprehensive codebase research by spawning parallel specialized sub-agents and synthesizing their findings into structured documentation. Prioritizes direct readings of live code with specific file paths and line numbers. Supports follow-up questions with document updates.
18
+ - Desired Outcome — Complete research document with YAML frontmatter, concrete evidence (file paths/line numbers), architectural insights, GitHub permalinks (when applicable), saved to `TASK_DIR/research/{topic}_{date}.md`, ready for task formalization or planning.
19
+
20
+ ## ARGUMENTS Input
21
+
22
+ Optional user input to seed this workflow.
23
+
24
+ <ARGUMENTS>
25
+ $ARGUMENTS
26
+ </ARGUMENTS>
27
+
28
+ ## Step (1/8) - Immediate Reply & Gather Context
29
+
30
+ - **Action** — ImmediateReply: Respond immediately before running any commands or tools.
31
+ - Check for ARGUMENTS and extract research topic
32
+ - **If** ARGUMENTS exists → acknowledge topic; extract research question
33
+ - **Else** → prompt user: "I'm ready to research the codebase. Please provide your research question or area of interest, and I'll analyze it thoroughly by exploring relevant components and connections."
34
+ - **CRITICAL**: Do NOT run any tool calls in this step
35
+ - **Wait** — User provides research query (if needed)
36
+
37
+ ## Step (2/8) - Read Mentioned Files
38
+
39
+ - **Action** — ReadMentionedFiles: Read any directly mentioned files FULLY before decomposition.
40
+ - **If** user mentions specific files (tickets, docs, JSON) → read them FULLY using Read tool WITHOUT limit/offset
41
+ - **CRITICAL**: Read these files in main context before spawning sub-agents
42
+ - Ensures full context before decomposing research
43
+
44
+ ## Step (3/8) - Decompose & Plan Research
45
+
46
+ - **Action** — AnalyzeQuestion: Break down research query into composable areas.
47
+ - Ultrathink about underlying patterns, connections, architectural implications user seeking
48
+ - Identify specific components, patterns, concepts to investigate
49
+ - Consider relevant directories, files, architectural patterns
50
+ - Create research plan using TodoWrite to track all subtasks
51
+ - **Action** — SpawnSpecializedAgents: Launch parallel sub-agents for comprehensive research.
52
+ - **Codebase Research**:
53
+ - **finder**: Find WHERE files and components live
54
+ - **analyst**: Understand HOW specific code works
55
+ - **patterns**: Find examples of similar implementations
56
+ - **Web Research** (when task requires 3rd party frameworks/platforms/services/libraries/SDKs):
57
+ - **web-research**: External documentation and resources
58
+ - **IMPORTANT**: Instruct to return LINKS with findings; include links in final report
59
+ - **3rd Party Libraries** (only if user explicitly asks):
60
+ - Use Context 7 MCP tool to search external documentation
61
+ - **Linear Tickets** (if relevant):
62
+ - **linear-ticket-reader**: Get full details of specific ticket
63
+ - **linear-searcher**: Find related tickets or historical context
64
+ - **Agent Strategy**: Start with locator → use analyzer on promising findings → run multiple agents in parallel for different searches; each agent knows its job (tell what you're looking for, not how to search)
65
+
66
+ ## Step (4/8) - Synthesize Findings
67
+
68
+ - **Action** — WaitForAgents: Wait for ALL sub-agent tasks to complete before proceeding.
69
+ - **Action** — CompileResults: Synthesize all sub-agent results into coherent findings.
70
+ - Prioritize live codebase findings as primary source of truth
71
+ - Connect findings across different components
72
+ - Include specific file paths and line numbers for reference
73
+ - Highlight patterns, connections, architectural decisions
74
+ - Answer user's specific questions with concrete evidence
75
+ - **Action** — GatherMetadata: Collect document metadata for YAML frontmatter.
76
+ - Current date/time with timezone (ISO format)
77
+ - Current commit hash (`git rev-parse HEAD`)
78
+ - Current branch name (`git rev-parse --abbrev-ref HEAD`)
79
+ - Repository name
80
+
81
+ ## Step (5/8) - Generate Research Document
82
+
83
+ - **Output Location** — DetermineOutputDir: Decide where to save artifacts for this workflow.
84
+ - `branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)`
85
+ - **If** user specifies `target_dir/path` → `OUT_DIR={that value}`
86
+ - **Else** → `OUT_DIR=docs/tasks/{branch_name}`
87
+ - `mkdir -p "OUT_DIR/research"`
88
+ - **Action** — CreateDocument: Structure research document with YAML frontmatter and comprehensive findings.
89
+ - **Frontmatter** (YAML at top):
90
+ - date: [ISO format with timezone]
91
+ - git_commit: [commit hash]
92
+ - branch: [branch name]
93
+ - repository: [repo name]
94
+ - topic: "[User's Question/Topic]"
95
+ - tags: [research, codebase, relevant-component-names]
96
+ - status: complete
97
+ - last_updated: [YYYY-MM-DD]
98
+ - last_updated_by: [Researcher name]
99
+ - **Document Sections** (in order):
100
+ 1. Title: `# Research: [User's Question/Topic]`
101
+ 2. Metadata header (Date, Git Commit, Branch, Repository)
102
+ 3. Research Question (original user query)
103
+ 4. Summary (high-level findings answering question)
104
+ 5. Detailed Findings (by Component/Area with file:line references)
105
+ 6. Code References (path/to/file:line with descriptions)
106
+ 7. Architecture Insights (patterns, conventions, design decisions)
107
+ 8. Related Research (links to other research docs in `docs/` (look for /research directories))
108
+ 9. Open Questions (areas needing further investigation)
109
+
110
+ ## Step (6/8) - Add Permalinks & Save
111
+
112
+ - **Action** — AddGitHubPermalinks: Generate GitHub permalinks if applicable.
113
+ - Check if on main branch or commit pushed: `git branch --show-current` and `git status`
114
+ - **If** on main/master OR pushed → generate permalinks:
115
+ - Get repo info: `gh repo view --json owner,name`
116
+ - Create: `https://github.com/{owner}/{repo}/blob/{commit}/{file}#L{line}`
117
+ - Replace local file references with permalinks in document
118
+ - **Else** → keep local file references
119
+ - **Action** — SaveDocument: Save research document to standardized location under `{OUT_DIR}/research/`.
120
+ - Filename: `{research_topic}_{MMDDYY}.md`
121
+ - Path: `{OUT_DIR}/research/{filename}`
122
+ - **Action** — PresentFindings: Present concise summary to user.
123
+ - Concise summary of key findings
124
+ - Include key file references for easy navigation
125
+ - Ask if they have follow-up questions or need clarification
126
+
127
+ ## Step (7/8) - Handle Follow-ups & Handoff
128
+
129
+ - **Action** — HandleFollowUps: If user has follow-up questions, update same document.
130
+ - **If** follow-up questions asked:
131
+ - Update frontmatter: `last_updated`, `last_updated_by`, add `last_updated_note: "Added follow-up research for [brief description]"`
132
+ - Add new section: `## Follow-up Research [timestamp]`
133
+ - Spawn new sub-agents as needed for additional investigation
134
+ - Continue updating document
135
+ - **Else** → proceed to handoff
136
+ - **Action** — RenderFooter: Render Next Steps footer using `Skill(spectre-guide)` skill (contains format template and spectre command options)
137
+
138
+ ## Next Steps
139
+
140
+ See `Skill(spectre-guide)` skill for footer format and command options.
141
+
142
+ ## Success Criteria
143
+
144
+ - [ ] Immediate reply sent; research topic requested (Step 1 - no tool calls)
145
+ - [ ] User research query received
146
+ - [ ] Output directory determined inline (`OUT_DIR`) using branch name or user-specified path
147
+ - [ ] Directly mentioned files read FULLY in main context before decomposition
148
+ - [ ] Research question decomposed into composable areas with ultra-thinking about patterns/connections
149
+ - [ ] Research plan created using TodoWrite to track subtasks
150
+ - [ ] Specialized sub-agents spawned in parallel (finder, analyst, patterns, web-research as needed, linear agents if relevant)
151
+ - [ ] Agent strategy followed (locator → analyzer → parallel execution)
152
+ - [ ] Web research agents instructed to return LINKS (if used)
153
+ - [ ] ALL sub-agents completed before synthesis
154
+ - [ ] Findings compiled with live codebase prioritized as source of truth
155
+ - [ ] Results include specific file paths and line numbers
156
+ - [ ] Cross-component connections and patterns highlighted
157
+ - [ ] Concrete evidence provided for user's questions
158
+ - [ ] Metadata gathered for frontmatter (date/time ISO, commit hash, branch, repo name)
159
+ - [ ] Research document created with YAML frontmatter at top
160
+ - [ ] Frontmatter fields consistent (snake_case for multi-word: git_commit, last_updated)
161
+ - [ ] Document includes all 9 required sections in order
162
+ - [ ] GitHub permalinks generated if on main/master or pushed commit
163
+ - [ ] Local file references replaced with permalinks (when applicable)
164
+ - [ ] Document saved to `{OUT_DIR}/research/{topic}_{MMDDYY}.md`
165
+ - [ ] Concise findings summary presented to user with key file references
166
+ - [ ] Follow-up questions handled with document updates (frontmatter updated, new section added)
167
+
168
+ - [ ] Next steps guide read and relevant options sourced for footer
@@ -0,0 +1,174 @@
1
+ ---
2
+ name: "scope"
3
+ description: "👻 | Interactively scope a feature or improvement, generating a complete Scope document with IN, OUT, and ANTI-SCOPE boundaries -- primary agent"
4
+ user-invocable: true
5
+ ---
6
+
7
+ # scope
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
+ # scope: Interactive Feature Scoping
14
+
15
+ Collaborative workflow for structuring unstructured thoughts into clear scope boundaries through a grounded hypothesis and targeted clarifications. Focuses on user value and scope boundaries before technical considerations. Output: scope document with clear boundaries (IN / OUT / ANTI-SCOPE), user value, load-bearing assumptions, and key decisions saved to `{OUT_DIR}/concepts/scope.md`.
16
+
17
+ ## ARGUMENTS
18
+
19
+ <ARGUMENTS> $ARGUMENTS </ARGUMENTS>
20
+
21
+ ## Step 1: Immediate Reply & Context Pickup
22
+
23
+ - **Action** — ImmediateReply: Respond before any tools.
24
+ - **If** `FROM_KICKOFF=true` → acknowledge kickoff context, read `KICKOFF_DOC`, extract (Core Problem, User Value, Decisions Made, Remaining Ambiguities, Key Code Refs), **SKIP to Step 4**
25
+ - **Else If** ARGUMENTS empty → probe for context enthusiastically and **WAIT** for user
26
+ - **Else** → proceed with the steps below
27
+ - **CRITICAL**: No tool calls in this step except reading the kickoff doc when `FROM_KICKOFF=true`.
28
+
29
+ - **Action** — DetectExistingArtifacts: Before proposing a hypothesis, check for prior context that may already answer questions.
30
+ - `branch_name=$(git rev-parse --abbrev-ref HEAD 2>/dev/null || echo unknown)`
31
+ - Look for: `docs/tasks/{branch_name}/concepts/scope.md`, `docs/tasks/{branch_name}/task_context.md`
32
+ - **If** prior `scope.md` exists → read fully; treat this invocation as a re-scope. Surface what was already settled and ask only about what's new or changed.
33
+ - **If** captured project knowledge is available (via `apply`-style memory or session logs) → surface decisions/patterns/gotchas relevant to this area before asking the user.
34
+
35
+ ## Step 2: Ground the Hypothesis (Fast)
36
+
37
+ **SKIP IF FROM_KICKOFF=true** — kickoff already grounded.
38
+
39
+ - **Action** — FastGround: Run ONE fast lookup to ground the hypothesis in repo reality. Pick the most informative single call:
40
+ - **`@finder` for one targeted query** — when you need to know what files/components exist for this area
41
+ - **One `grep` or `glob`** — when you need to verify a specific assumption ("does X already exist?")
42
+
43
+ **Constraints**:
44
+ - **One call only.** This is grounding, not research. Tech research is `plan`'s job.
45
+ - **Fast.** If the call would take more than a few seconds, skip it and ask the user instead.
46
+ - If you need more than one signal, that's a sign this should be a `kickoff` rather than a `scope`.
47
+
48
+ ## Step 3: Interactive Scope Exploration
49
+
50
+ **SKIP IF FROM_KICKOFF=true**
51
+
52
+ - **Action** — ExploreScope: Collaborative dialogue focused on boundaries, user experience, and anti-scope.
53
+
54
+ **CRITICAL**: Focus on WHAT, not HOW. Defer all technical/implementation questions to `plan`. Only ask technical questions if the scope itself is inherently technical (e.g., "migrate database from X to Y").
55
+
56
+ **PATTERN**: Lead with a grounded hypothesis (informed by Step 2's lookup) AND ask 5–8 questions across multiple dimensions. Mark each question as **(blocking)** or *(optional)* so the user can skim and skip.
57
+
58
+ **FIRST RESPONSE FORMAT**:
59
+
60
+ > Here's my read on this, grounded in {one-line of what Step 2 surfaced}:
61
+ >
62
+ > **Hypothesis**: [problem statement, who it affects, proposed IN / OUT / ANTI-SCOPE]
63
+ >
64
+ > **Questions**:
65
+ > 1. **(blocking)** [User problem question]
66
+ > 2. **(blocking)** [Boundary edge question]
67
+ > 3. **(blocking)** [Anti-scope question]
68
+ > 4. *(optional)* [UX flow question]
69
+ > 5. *(optional)* [Alternative approach question]
70
+ > 6. *(optional)* [Edge case question]
71
+ > 7. *(optional)* [Success criteria question]
72
+ >
73
+ > Answer the blocking ones; skip optional if obvious.
74
+
75
+ **Question types** (mix from these; lean on blocking for boundaries and anti-scope):
76
+
77
+ - **User & Problem**: Who feels this most? What triggers the need? What's the cost of not solving it?
78
+ - **UX & Feel**: Should this feel fast or thorough? Guided or flexible? What's the ideal flow?
79
+ - **Boundaries (IN/OUT)**: What about [adjacent thing]—IN or OUT? What's essential for v1?
80
+ - **Anti-Scope**: What problem are we *intentionally not solving* here? (Different from OUT — anti-scope clarifies the philosophical edge of the feature, not just deferred work.)
81
+ - **Alternatives**: I could see this as [A] or [B]. Which direction?
82
+ - **Edge cases**: What happens when [unusual situation]?
83
+ - **Success**: What makes you say "this shipped well"?
84
+
85
+ **DO NOT ask about**: implementation approach, technical trade-offs, architecture, or integration details — those belong in `plan`.
86
+
87
+ - **Action** — IterateBoundaries: After user responds, refine boundaries and ask targeted follow-ups on gaps.
88
+
89
+ > **Current Scope**:
90
+ > ✅ **IN**: [list]
91
+ > ❌ **OUT**: [list]
92
+ > 🚫 **ANTI-SCOPE**: [problems we're intentionally not solving]
93
+ > ⚠️ **Unsure**: [edge cases]
94
+ >
95
+ > Any items to move? Add exclusions? Clarify edges? Reply 'looks good' to continue.
96
+
97
+ - **Wait** — User confirms scope boundaries are accurate.
98
+
99
+ ## Step 4: Targeted Clarifications
100
+
101
+ - **Action** — DetermineOutputDir:
102
+ - **If** FROM_KICKOFF → use same dir as kickoff doc
103
+ - **Else** → `OUT_DIR = user_specified || docs/tasks/{branch_name}`
104
+ - `mkdir -p "$OUT_DIR/concepts" "$OUT_DIR/clarifications"`
105
+
106
+ - **Action** — DetectClarificationMethod: Check if `AskUserQuestion` tool is available.
107
+ - **If available** → use inline clarification flow (Path A)
108
+ - **If not available** → use file-based clarification flow (Path B)
109
+
110
+ ### Path A: Inline Clarifications (AskUserQuestion available)
111
+
112
+ - **Action** — AskInline: Generate 3–6 questions based ONLY on remaining scope ambiguities from Step 3 (or kickoff's "Remaining Ambiguities").
113
+ - Ask the most critical first (up to 4 at a time, the tool limit).
114
+ - For trade-off decisions, present options with concise pros/cons.
115
+ - If more than 4 questions, ask in batches — most important first.
116
+
117
+ **CRITICAL**: Only ask about unresolved scope ambiguities. Technical questions belong in `plan`, not here.
118
+
119
+ ### Path B: File-Based Clarifications (no AskUserQuestion)
120
+
121
+ - **Action** — GenerateTargetedQuestions: Create 3–6 questions in `{OUT_DIR}/clarifications/scope_clarifications_{YYYY-MM-DD_HHMMSS}.md`:
122
+ - Header: concept name, confirmed boundaries so far
123
+ - Each question with a `<response></response>` block
124
+
125
+ - **Action** — PromptUser: "Saved clarifications to `{path}`. Answer in `<response>` blocks. Reply 'Read it' when ready."
126
+
127
+ - **Wait** — User replies.
128
+
129
+ - **Action** — ReadClarifications: Read the file; use responses (proceed with intelligent assumptions if blocks are empty).
130
+
131
+ ## Step 5: Create Scope Document
132
+
133
+ - **Action** — CreateScopeDoc: Generate `{OUT_DIR}/concepts/scope.md` (use scoped filename if one exists).
134
+
135
+ **Priority**: User value and boundaries BEFORE technical details.
136
+
137
+ **Sections**:
138
+
139
+ 1. **The Problem** — pain, impact, current state
140
+ 2. **Target Users** — primary, secondary, needs
141
+ 3. **Success Criteria** — outcomes; prefer measurable assertions over prose
142
+ 4. **User Experience** — journeys, principles, trade-offs
143
+ 5. **Scope Boundaries** — IN / OUT / ANTI-SCOPE / Maybe / Future
144
+ 6. **Load-Bearing Assumptions** — assumptions that, if wrong, invalidate this scope. Each assumption gets a short *"if this is false, …"* consequence so future-you can recognize when to come back.
145
+ 7. **Constraints** — platform, perf, a11y, scale (user-provided only)
146
+ 8. **Decisions** — from clarifications + rationale
147
+ 9. **Risks** — UX, scope creep, open questions
148
+ 10. **Next Steps** — `plan` or `create_tasks`, complexity S/M/L
149
+
150
+ **Note on ANTI-SCOPE vs OUT**:
151
+ - **OUT** = we're not building it (yet, or for this release).
152
+ - **ANTI-SCOPE** = we're intentionally not solving this *problem* — it clarifies the philosophical edge of what this feature is for.
153
+
154
+ ## Step 6: Final Review & Next Steps
155
+
156
+ - **Action** — PresentDocForReview: Show final boundaries and next steps together.
157
+
158
+ > **Scope Complete**: `{OUT_DIR}/concepts/scope.md`
159
+ >
160
+ > **Final Boundaries**:
161
+ > ✅ **IN**: [from doc]
162
+ > ❌ **OUT**: [from doc]
163
+ > 🚫 **ANTI-SCOPE**: [from doc]
164
+ > ⚠️ **Maybe/Future**: [from doc]
165
+ >
166
+ > **Load-Bearing Assumptions** (top 1–3 — if any prove false, return to scope): [from doc]
167
+ >
168
+ > Docs saved: `{OUT_DIR}/concepts/scope.md`, clarifications under `{OUT_DIR}/clarifications/`
169
+ >
170
+ > Reply with edits — otherwise pick a next step:
171
+
172
+ - **Action** — RenderFooter: Render Next Steps using `Skill(spectre-guide)` skill.
173
+
174
+ > **NOTE**: Do NOT wait for explicit approval. Present next steps inline with the review. The user can reply with scope edits OR jump straight into a next step command. If they reply with edits, apply them to the scope doc and re-present.