opencode-goopspec 0.1.3 → 0.1.4

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 (53) hide show
  1. package/README.md +253 -331
  2. package/agents/goop-debugger.md +175 -172
  3. package/agents/goop-designer.md +232 -160
  4. package/agents/goop-executor.md +197 -127
  5. package/agents/goop-explorer.md +148 -150
  6. package/agents/goop-librarian.md +218 -164
  7. package/agents/goop-orchestrator.md +364 -338
  8. package/agents/goop-planner.md +331 -153
  9. package/agents/goop-researcher.md +198 -126
  10. package/agents/goop-tester.md +277 -202
  11. package/agents/goop-verifier.md +191 -201
  12. package/agents/goop-writer.md +241 -133
  13. package/agents/memory-distiller.md +228 -136
  14. package/commands/goop-accept.md +430 -36
  15. package/commands/goop-amend.md +13 -0
  16. package/commands/goop-complete.md +13 -0
  17. package/commands/goop-debug.md +13 -0
  18. package/commands/goop-discuss.md +419 -7
  19. package/commands/goop-execute.md +386 -37
  20. package/commands/goop-help.md +11 -0
  21. package/commands/goop-map-codebase.md +13 -0
  22. package/commands/goop-memory.md +11 -0
  23. package/commands/goop-milestone.md +13 -0
  24. package/commands/goop-pause.md +12 -0
  25. package/commands/goop-plan.md +320 -266
  26. package/commands/goop-quick.md +12 -0
  27. package/commands/goop-recall.md +11 -0
  28. package/commands/goop-remember.md +12 -0
  29. package/commands/goop-research.md +13 -0
  30. package/commands/goop-resume.md +12 -0
  31. package/commands/goop-setup.md +18 -8
  32. package/commands/goop-specify.md +315 -39
  33. package/commands/goop-status.md +276 -28
  34. package/dist/index.js +328 -15
  35. package/package.json +1 -1
  36. package/references/context-injection.md +307 -0
  37. package/references/discovery-interview.md +278 -0
  38. package/references/enforcement-system.md +213 -0
  39. package/references/handoff-protocol.md +290 -0
  40. package/references/model-profiles.md +1 -1
  41. package/references/phase-gates.md +360 -0
  42. package/references/plugin-architecture.md +212 -0
  43. package/references/response-format.md +41 -9
  44. package/references/subagent-protocol.md +83 -33
  45. package/references/visual-style.md +199 -0
  46. package/references/xml-response-schema.md +236 -0
  47. package/templates/blueprint.md +88 -41
  48. package/templates/chronicle.md +130 -16
  49. package/templates/handoff.md +140 -0
  50. package/templates/project.md +114 -0
  51. package/templates/requirements.md +121 -0
  52. package/templates/spec.md +85 -20
  53. package/templates/state.md +103 -0
@@ -0,0 +1,213 @@
1
+ # Orchestration Enforcement System
2
+
3
+ GoopSpec enforces workflow rules through a layered enforcement system. This document describes how enforcement works and how to configure it.
4
+
5
+ ## Overview
6
+
7
+ The enforcement system transforms GoopSpec from a "suggestions-based" system into an **enforced workflow** where:
8
+ - Commands trigger actual state transitions
9
+ - Documents are scaffolded automatically
10
+ - Phase gates block progression until requirements are met
11
+ - The orchestrator is forced to delegate code work
12
+
13
+ ## Components
14
+
15
+ ### 1. Phase Context Builder
16
+
17
+ **Location:** `src/features/enforcement/phase-context.ts`
18
+
19
+ Generates phase-specific enforcement rules for injection into system prompts.
20
+
21
+ **Key Functions:**
22
+ - `buildPhaseEnforcement(phase, state)` - Generates MUST DO / MUST NOT DO lists
23
+ - `buildStateContext(state)` - Generates current state information
24
+ - `buildEnforcementContext(state)` - Combines both for system prompt injection
25
+ - `isOperationAllowed(phase, operation)` - Checks if operation is valid in phase
26
+
27
+ ### 2. Document Scaffolder
28
+
29
+ **Location:** `src/features/enforcement/scaffolder.ts`
30
+
31
+ Automatically creates phase directory structure with templated documents.
32
+
33
+ **Key Functions:**
34
+ - `scaffoldPhaseDocuments(ctx, phaseName, phase)` - Creates `.goopspec/phases/[name]/` with documents
35
+ - `checkPhaseDocuments(ctx, phaseName, phase)` - Validates required documents exist
36
+ - `getPhaseDir(ctx, phaseName)` - Returns phase directory path
37
+
38
+ **Document Types:**
39
+ | Type | File | Required In |
40
+ |------|------|-------------|
41
+ | spec | SPEC.md | plan, research, specify, execute, accept |
42
+ | blueprint | BLUEPRINT.md | specify, execute, accept |
43
+ | chronicle | CHRONICLE.md | plan, research, specify, execute, accept |
44
+ | research | RESEARCH.md | research, specify |
45
+
46
+ ### 3. Validators
47
+
48
+ **Location:** `src/features/enforcement/validators.ts`
49
+
50
+ Validates operations against current workflow phase.
51
+
52
+ **Key Functions:**
53
+ - `validateWriteOperation(phase, filePath)` - Checks if file write is allowed
54
+ - `validatePhaseTransition(ctx, from, to)` - Validates transition preconditions
55
+ - `isImplementationFile(filePath)` - Detects code vs config files
56
+
57
+ **Protected Directories:**
58
+ - `src/`, `lib/`, `app/`, `apps/`
59
+ - `packages/`, `server/`, `client/`
60
+
61
+ ## Hooks
62
+
63
+ ### System Transform Hook
64
+
65
+ **Location:** `src/hooks/system-transform.ts`
66
+
67
+ Injects enforcement context into every system prompt:
68
+ - Current phase and state information
69
+ - Phase-specific MUST DO / MUST NOT DO rules
70
+ - Delegation reminders in execute phase
71
+ - Memory context for continuity
72
+
73
+ ### Command Processor Hook
74
+
75
+ **Location:** `src/hooks/command-processor.ts`
76
+
77
+ Processes `/goop-*` slash commands:
78
+ - Triggers state transitions (e.g., `/goop-plan` → plan phase)
79
+ - Scaffolds phase documents automatically
80
+ - Logs command processing to ADL
81
+
82
+ **Command Mappings:**
83
+ | Command | Target Phase |
84
+ |---------|--------------|
85
+ | /goop-plan | plan |
86
+ | /goop-discuss | plan |
87
+ | /goop-research | research |
88
+ | /goop-specify | specify |
89
+ | /goop-execute | execute |
90
+ | /goop-accept | accept |
91
+ | /goop-complete | idle |
92
+
93
+ ### Orchestrator Enforcement Hook
94
+
95
+ **Location:** `src/hooks/orchestrator-enforcement.ts`
96
+
97
+ Enforces delegation rules for the orchestrator agent:
98
+
99
+ **Code Blocking:**
100
+ - Blocks `edit`/`write` on code files for orchestrator
101
+ - Allows planning files (`.goopspec/`, `.md`, `.json`)
102
+ - Injects delegation guidance when blocked
103
+
104
+ **Delegation Enforcement:**
105
+ - Detects `goop_delegate` calls
106
+ - Injects `task()` invocation reminders
107
+ - Tracks pending delegations per session
108
+
109
+ ## Phase Rules
110
+
111
+ ### Plan Phase
112
+ **MUST DO:**
113
+ - Ask clarifying questions
114
+ - Create SPEC.md with must-haves, nice-to-haves, out-of-scope
115
+ - Get user confirmation before proceeding
116
+
117
+ **MUST NOT DO:**
118
+ - Write ANY implementation code
119
+ - Use write/edit tools on src/ files
120
+ - Skip requirement gathering
121
+
122
+ ### Research Phase
123
+ **MUST DO:**
124
+ - Read SPEC.md to understand requirements
125
+ - Create RESEARCH.md with findings
126
+ - Document trade-offs and recommendations
127
+
128
+ **MUST NOT DO:**
129
+ - Write implementation code
130
+ - Modify source files
131
+
132
+ ### Specify Phase
133
+ **MUST DO:**
134
+ - Create BLUEPRINT.md with wave-based plan
135
+ - Map all must-haves to specific tasks
136
+ - Get user confirmation to lock specification
137
+
138
+ **MUST NOT DO:**
139
+ - Write implementation code
140
+ - Proceed without locked specification
141
+
142
+ ### Execute Phase
143
+ **MUST DO:**
144
+ - DELEGATE all code work using `task()` tool
145
+ - Track progress in CHRONICLE.md
146
+ - Follow wave order
147
+ - Save checkpoints at wave boundaries
148
+
149
+ **MUST NOT DO:**
150
+ - Write code directly
151
+ - Use 'delegate' tool (use 'task' instead)
152
+ - Skip verification steps
153
+
154
+ ### Accept Phase
155
+ **MUST DO:**
156
+ - Verify ALL must-haves from SPEC.md
157
+ - Run all tests
158
+ - Get explicit user acceptance
159
+
160
+ **MUST NOT DO:**
161
+ - Mark complete without verification
162
+ - Skip user confirmation
163
+
164
+ ## Configuration
165
+
166
+ Enforcement is enabled by default. No configuration currently required.
167
+
168
+ Future configuration options (planned):
169
+ ```json
170
+ {
171
+ "enforcement": {
172
+ "level": "strict", // assist | warn | strict
173
+ "codeBlocking": true,
174
+ "delegationEnforcement": true
175
+ }
176
+ }
177
+ ```
178
+
179
+ ## Troubleshooting
180
+
181
+ ### "Cannot write to file" errors
182
+ The orchestrator is blocked from writing code files. Delegate to goop-executor:
183
+ ```
184
+ task({
185
+ subagent_type: "goop-executor",
186
+ description: "Implement feature X",
187
+ prompt: "..."
188
+ })
189
+ ```
190
+
191
+ ### Phase transition rejected
192
+ Ensure required documents exist before transitioning:
193
+ - `execute` requires SPEC.md
194
+ - `accept` requires SPEC.md, BLUEPRINT.md, CHRONICLE.md
195
+
196
+ ### Commands not triggering state changes
197
+ Verify the command is processed by checking ADL.md for logged entries.
198
+
199
+ ### Enforcement context not appearing
200
+ Ensure memory injection is enabled in config:
201
+ ```json
202
+ {
203
+ "memory": {
204
+ "injection": {
205
+ "enabled": true
206
+ }
207
+ }
208
+ }
209
+ ```
210
+
211
+ ---
212
+
213
+ *GoopSpec v0.1.0 - Enforcement System Documentation*
@@ -0,0 +1,290 @@
1
+ # Handoff Protocol
2
+
3
+ The Handoff Protocol ensures clean context transitions between sessions. Following the GSD pattern, each phase ends with full documentation enabling a fresh agent to continue with a clean 200k context window.
4
+
5
+ ## Core Principle
6
+
7
+ ```
8
+ +================================================================+
9
+ | CONTEXT IS PRECIOUS. FRESH CONTEXT = QUALITY WORK. |
10
+ | At natural boundaries, generate HANDOFF.md and suggest |
11
+ | starting a new session for clean context. |
12
+ +================================================================+
13
+ ```
14
+
15
+ ## When to Generate Handoff
16
+
17
+ ### Mandatory Handoff Points
18
+ 1. **Phase completion** - After plan, specify, execute, accept
19
+ 2. **Wave completion** - After each wave in execution
20
+ 3. **Checkpoint reached** - User decision needed
21
+ 4. **Context getting full** - Long session with many files read
22
+
23
+ ### Optional Handoff Points
24
+ 1. **Natural pause** - User stepping away
25
+ 2. **Complex task boundary** - Before major implementation
26
+ 3. **Research complete** - Before acting on findings
27
+
28
+ ## HANDOFF.md Structure
29
+
30
+ ```markdown
31
+ # Session Handoff
32
+
33
+ **Generated:** [timestamp]
34
+ **Phase:** [current phase]
35
+ **Session:** [session_id if available]
36
+
37
+ ---
38
+
39
+ ## Accomplished This Session
40
+
41
+ ### Completed
42
+ - [x] [Task/milestone 1]
43
+ - [x] [Task/milestone 2]
44
+ - [x] [Task/milestone 3]
45
+
46
+ ### Key Outcomes
47
+ - [Significant outcome 1]
48
+ - [Significant outcome 2]
49
+
50
+ ### Decisions Made
51
+ - **[Decision 1]**: [Choice made] - [Rationale]
52
+ - **[Decision 2]**: [Choice made] - [Rationale]
53
+
54
+ ---
55
+
56
+ ## Current State
57
+
58
+ ### Workflow Position
59
+ - **Phase:** [plan|specify|execute|accept]
60
+ - **Spec Locked:** [yes|no]
61
+ - **Wave:** [N of M] (if executing)
62
+ - **Task:** [X of Y] (if executing)
63
+
64
+ ### Files Modified
65
+ - `path/to/file1.ts` - [what changed]
66
+ - `path/to/file2.ts` - [what changed]
67
+
68
+ ### Commits Made
69
+ - `abc1234` - type(scope): message
70
+ - `def5678` - type(scope): message
71
+
72
+ ---
73
+
74
+ ## Next Session Instructions
75
+
76
+ ### Command to Run
77
+ ```
78
+ /goop-[command]
79
+ ```
80
+
81
+ ### Files to Read First
82
+ 1. `.goopspec/SPEC.md` - Requirements contract
83
+ 2. `.goopspec/BLUEPRINT.md` - Execution plan
84
+ 3. `.goopspec/CHRONICLE.md` - Progress log
85
+ 4. [Additional relevant files]
86
+
87
+ ### Context Summary
88
+ [2-4 sentences of essential context the next session needs to know.
89
+ Focus on decisions made, patterns established, and gotchas discovered.]
90
+
91
+ ### Immediate Next Task
92
+ **Task:** [Exact task description]
93
+ **Files:** `path/to/files`
94
+ **Action:** [What needs to be done]
95
+ **Verify:** [How to verify completion]
96
+
97
+ ---
98
+
99
+ ## Warnings & Blockers
100
+
101
+ ### Active Blockers
102
+ [None | List of blockers with context]
103
+
104
+ ### Gotchas Discovered
105
+ - [Pattern or issue to be aware of]
106
+ - [Dependency or integration concern]
107
+
108
+ ### Pending Decisions
109
+ [None | Decisions that need user input]
110
+
111
+ ---
112
+
113
+ *Start a new session for fresh context.*
114
+ *Run the command above to continue.*
115
+ ```
116
+
117
+ ## Handoff Generation Rules
118
+
119
+ ### What to Include
120
+ - All tasks completed this session
121
+ - Key decisions with rationale
122
+ - Exact workflow position
123
+ - Files modified with descriptions
124
+ - Critical context for continuation
125
+ - Explicit next steps
126
+
127
+ ### What NOT to Include
128
+ - Full file contents (just paths)
129
+ - Detailed implementation code
130
+ - Speculation about future work
131
+ - Information already in SPEC/BLUEPRINT/CHRONICLE
132
+
133
+ ### Context Summary Guidelines
134
+ The context summary should be:
135
+ - **Concise**: 2-4 sentences max
136
+ - **Actionable**: Focus on what matters for next task
137
+ - **Specific**: Mention actual file names, patterns, decisions
138
+ - **Fresh**: Don't repeat what's in planning files
139
+
140
+ **Good example**:
141
+ > "Auth service implemented in src/auth/ using jose for JWT. Decided to use 24h expiry with refresh tokens stored in httpOnly cookies. Note: existing session.ts has a conflict with our middleware - need to refactor the order in next session."
142
+
143
+ **Bad example**:
144
+ > "Made good progress on auth. Some things were implemented. There might be some issues to look at."
145
+
146
+ ## Integration with Other Files
147
+
148
+ ### CHRONICLE.md Update
149
+ Before generating HANDOFF.md:
150
+ ```markdown
151
+ ## Session [date]
152
+
153
+ ### Completed
154
+ - Task 2.1: [description] (commit: abc123)
155
+ - Task 2.2: [description] (commit: def456)
156
+
157
+ ### State
158
+ - Wave 2: 2/4 tasks complete
159
+ - Next: Task 2.3
160
+
161
+ ### Handoff Generated
162
+ See: .goopspec/HANDOFF.md
163
+ ```
164
+
165
+ ### STATE.md Update
166
+ Human-readable state mirror:
167
+ ```markdown
168
+ # Current State
169
+
170
+ **Phase:** execute
171
+ **Wave:** 2 of 3
172
+ **Task:** 3 of 4
173
+ **Last Updated:** [timestamp]
174
+
175
+ ## Quick Resume
176
+ Run `/goop-execute` to continue Wave 2.
177
+ ```
178
+
179
+ ### Memory Persistence
180
+ Before handoff:
181
+ ```typescript
182
+ memory_save({
183
+ type: "observation",
184
+ title: "Session handoff: [feature]",
185
+ content: "[key context for future sessions]",
186
+ concepts: ["handoff", "feature-name", "phase"],
187
+ importance: 0.7
188
+ })
189
+ ```
190
+
191
+ ## Agent Responsibilities
192
+
193
+ ### Orchestrator
194
+ - Detect handoff points
195
+ - Generate HANDOFF.md
196
+ - Update CHRONICLE.md
197
+ - Suggest new session to user
198
+
199
+ ### Subagents
200
+ - Return `suggest_new_session: true` in XML when:
201
+ - Complex task completed
202
+ - Significant context accumulated
203
+ - Natural pause point reached
204
+ - Include handoff-ready summary in response
205
+
206
+ ## User Communication
207
+
208
+ ### At Handoff Point
209
+ ```markdown
210
+ ## Session Checkpoint
211
+
212
+ I've completed [summary of work] and saved the state.
213
+
214
+ **Current position:** Phase [X], Wave [N], Task [M]
215
+
216
+ ### To Continue
217
+ 1. Start a **new session** for fresh context
218
+ 2. Run: `/goop-execute`
219
+
220
+ The new session will have:
221
+ - Full 200k context window
222
+ - All state from HANDOFF.md
223
+ - Clear next steps
224
+
225
+ ### Files Saved
226
+ - `.goopspec/HANDOFF.md` - Session handoff
227
+ - `.goopspec/CHRONICLE.md` - Progress log
228
+ - `.goopspec/STATE.md` - Current state
229
+
230
+ Ready to continue in new session!
231
+ ```
232
+
233
+ ### Quick Resume (Same Session)
234
+ If user wants to continue without new session:
235
+ ```markdown
236
+ Continuing in current session.
237
+
238
+ **Note:** Context is at [X]% - quality may degrade with complex tasks.
239
+ Consider starting fresh if encountering issues.
240
+
241
+ Proceeding with Task [N]...
242
+ ```
243
+
244
+ ## Anti-Patterns
245
+
246
+ ### Bad: No Context in Handoff
247
+ ```markdown
248
+ ## Next Session
249
+ Run /goop-execute
250
+ ```
251
+ **Problem**: Next session has no context about what happened.
252
+
253
+ ### Bad: Too Much Detail
254
+ ```markdown
255
+ ## Context Summary
256
+ [500 lines of implementation details]
257
+ ```
258
+ **Problem**: Defeats the purpose of clean handoff.
259
+
260
+ ### Bad: Missing Next Steps
261
+ ```markdown
262
+ ## Completed
263
+ - Task 1
264
+ - Task 2
265
+ ```
266
+ **Problem**: Next session doesn't know what to do.
267
+
268
+ ### Good: Clean and Actionable
269
+ ```markdown
270
+ ## Next Session Instructions
271
+
272
+ ### Command to Run
273
+ /goop-execute
274
+
275
+ ### Context Summary
276
+ Completed auth service with JWT. Using jose library, 24h expiry.
277
+ Middleware in src/auth/middleware.ts protects routes.
278
+ Next: Add refresh token logic to extend sessions.
279
+
280
+ ### Immediate Next Task
281
+ **Task:** W2.T3 - Implement refresh tokens
282
+ **Files:** src/auth/refresh.ts, src/auth/service.ts
283
+ **Action:** Add refresh endpoint and token rotation
284
+ **Verify:** bun test src/auth/
285
+ ```
286
+
287
+ ---
288
+
289
+ *Handoff Protocol v0.1.4*
290
+ *"Fresh context, quality work."*
@@ -14,7 +14,7 @@ Model profiles control which model each GoopSpec agent uses. This enables optima
14
14
  | goop-orchestrator | anthropic/claude-opus-4-5 | Complex orchestration, task delegation, context management |
15
15
  | goop-planner | anthropic/claude-opus-4-5 | Best for complex architecture decisions, goal decomposition, reasoning-heavy planning |
16
16
  | goop-researcher | openai/gpt-5.2 | Best for research, technology evaluation, knowledge synthesis |
17
- | goop-tester | opencode/kimi-k2.5-free | Cost-effective for test writing, quality assurance, coverage thinking |
17
+ | goop-tester | kimi-for-coding/k2p5 | Cost-effective for test writing, quality assurance, coverage thinking |
18
18
  | goop-verifier | openai/gpt-5.2-codex | Best for code verification, security analysis, catching subtle bugs |
19
19
  | goop-writer | google/antigravity-gemini-3-pro-high | Documentation, structured writing, comprehensive coverage |
20
20
  | memory-distiller | anthropic/claude-haiku-3-5 | Fast, lightweight distillation of events into structured memories |