opencode-goopspec 0.1.2 → 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 (60) hide show
  1. package/README.md +255 -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 +392 -280
  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 +434 -160
  15. package/commands/goop-amend.md +35 -151
  16. package/commands/goop-complete.md +39 -183
  17. package/commands/goop-debug.md +33 -298
  18. package/commands/goop-discuss.md +381 -85
  19. package/commands/goop-execute.md +391 -108
  20. package/commands/goop-help.md +11 -0
  21. package/commands/goop-map-codebase.md +16 -3
  22. package/commands/goop-memory.md +11 -0
  23. package/commands/goop-milestone.md +29 -192
  24. package/commands/goop-pause.md +31 -40
  25. package/commands/goop-plan.md +458 -46
  26. package/commands/goop-quick.md +38 -142
  27. package/commands/goop-recall.md +11 -0
  28. package/commands/goop-remember.md +12 -0
  29. package/commands/goop-research.md +52 -73
  30. package/commands/goop-resume.md +28 -37
  31. package/commands/goop-setup.md +225 -124
  32. package/commands/goop-specify.md +321 -121
  33. package/commands/goop-status.md +256 -110
  34. package/dist/index.js +6289 -2820
  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/interactive-questioning.md +122 -0
  41. package/references/model-profiles.md +1 -1
  42. package/references/phase-gates.md +360 -0
  43. package/references/plugin-architecture.md +212 -0
  44. package/references/response-format.md +41 -9
  45. package/references/subagent-protocol.md +83 -33
  46. package/references/ui-interaction-patterns.md +133 -0
  47. package/references/visual-style.md +199 -0
  48. package/references/workflow-accept.md +60 -273
  49. package/references/workflow-execute.md +63 -274
  50. package/references/workflow-plan.md +86 -133
  51. package/references/workflow-research.md +78 -186
  52. package/references/workflow-specify.md +64 -221
  53. package/references/xml-response-schema.md +236 -0
  54. package/templates/blueprint.md +88 -41
  55. package/templates/chronicle.md +130 -16
  56. package/templates/handoff.md +140 -0
  57. package/templates/project.md +114 -0
  58. package/templates/requirements.md +121 -0
  59. package/templates/spec.md +85 -20
  60. package/templates/state.md +103 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencode-goopspec",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "A spec-driven development plugin for OpenCode with user-guided planning, wave execution, and verification",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -0,0 +1,307 @@
1
+ # Context Injection
2
+
3
+ Context Injection ensures all subagents have access to project-level knowledge without the orchestrator manually including it in every delegation prompt.
4
+
5
+ ## Core Principle
6
+
7
+ ```
8
+ +================================================================+
9
+ | SUBAGENTS NEED CONTEXT TO MAKE GOOD DECISIONS. |
10
+ | Project knowledge flows automatically to every agent. |
11
+ | No agent should hallucinate stack choices or conventions. |
12
+ +================================================================+
13
+ ```
14
+
15
+ ## The Knowledge Base
16
+
17
+ ### PROJECT_KNOWLEDGE_BASE.md
18
+
19
+ A living document maintained in `.goopspec/PROJECT_KNOWLEDGE_BASE.md` containing:
20
+
21
+ ```markdown
22
+ # Project Knowledge Base
23
+
24
+ **Last Updated:** [timestamp]
25
+ **Updated By:** [agent/user]
26
+
27
+ ---
28
+
29
+ ## Project Identity
30
+
31
+ **Name:** [Project name]
32
+ **Type:** [Web app / CLI / Library / API / etc.]
33
+ **Stage:** [New / Active / Maintenance]
34
+
35
+ ---
36
+
37
+ ## Stack (Non-Negotiable)
38
+
39
+ ### Runtime & Language
40
+ - **Runtime:** [Node.js / Bun / Deno / Browser]
41
+ - **Language:** [TypeScript / JavaScript]
42
+ - **Version:** [Specific versions]
43
+
44
+ ### Frameworks & Libraries
45
+ - **Framework:** [Express / Next.js / React / None]
46
+ - **ORM:** [Prisma / Drizzle / None]
47
+ - **Testing:** [Vitest / Jest / Bun test]
48
+ - **Key Libraries:** [List with versions]
49
+
50
+ ### Infrastructure
51
+ - **Database:** [PostgreSQL / SQLite / None]
52
+ - **Cache:** [Redis / None]
53
+ - **Deployment:** [Vercel / AWS / Docker]
54
+
55
+ ---
56
+
57
+ ## Conventions
58
+
59
+ ### File Naming
60
+ - **Files:** [kebab-case / camelCase]
61
+ - **Components:** [PascalCase]
62
+ - **Tests:** [*.test.ts / *.spec.ts]
63
+
64
+ ### Code Style
65
+ - **Functions:** [Arrow / Named]
66
+ - **Exports:** [Named / Default]
67
+ - **Types:** [Interfaces / Types]
68
+
69
+ ### Commits
70
+ - **Format:** [type(scope): description]
71
+ - **Types:** [feat, fix, refactor, test, docs, chore]
72
+
73
+ ---
74
+
75
+ ## Architecture Decisions
76
+
77
+ ### [Decision Category]
78
+ - **Decision:** [What was decided]
79
+ - **Rationale:** [Why]
80
+ - **Date:** [When]
81
+
82
+ ---
83
+
84
+ ## Patterns in Use
85
+
86
+ ### [Pattern Name]
87
+ - **Where:** [Files/areas]
88
+ - **How:** [Brief description]
89
+ - **Example:** `path/to/example.ts`
90
+
91
+ ---
92
+
93
+ ## Known Gotchas
94
+
95
+ - [Gotcha 1]: [What to watch out for]
96
+ - [Gotcha 2]: [What to watch out for]
97
+
98
+ ---
99
+
100
+ ## Integration Points
101
+
102
+ - **Auth:** [Where auth is handled]
103
+ - **API:** [API patterns/locations]
104
+ - **Database:** [How data is accessed]
105
+
106
+ ---
107
+
108
+ *Updated automatically by memory-distiller agent.*
109
+ *Manual updates welcome for accuracy.*
110
+ ```
111
+
112
+ ## Injection Points
113
+
114
+ ### When Subagents Load Context
115
+
116
+ Every subagent's `<first_steps>` section includes:
117
+
118
+ ```markdown
119
+ **Step N: Load Project Knowledge**
120
+ ```
121
+ Read(".goopspec/PROJECT_KNOWLEDGE_BASE.md") # If exists
122
+ ```
123
+
124
+ This happens AFTER loading state but BEFORE starting work.
125
+ ```
126
+
127
+ ### Orchestrator Delegation
128
+
129
+ When orchestrator delegates via `task()`:
130
+
131
+ ```typescript
132
+ task({
133
+ subagent_type: "goop-executor",
134
+ description: "Implement feature X",
135
+ prompt: `
136
+ ## PROJECT CONTEXT
137
+ [Auto-injected from PROJECT_KNOWLEDGE_BASE.md]
138
+ - Stack: Bun, TypeScript, Express
139
+ - Conventions: kebab-case files, named exports
140
+ - Testing: bun test
141
+
142
+ ## TASK
143
+ [Specific task details]
144
+ ...
145
+ `
146
+ })
147
+ ```
148
+
149
+ ## Automatic Updates
150
+
151
+ ### memory-distiller Responsibility
152
+
153
+ The memory-distiller agent updates PROJECT_KNOWLEDGE_BASE.md:
154
+
155
+ 1. **After major decisions**: New architectural choices
156
+ 2. **After pattern discovery**: New patterns found in codebase
157
+ 3. **After gotcha discovery**: Issues to remember
158
+ 4. **At session end**: Consolidate session learnings
159
+
160
+ ### Update Protocol
161
+
162
+ ```markdown
163
+ 1. Read current PROJECT_KNOWLEDGE_BASE.md
164
+ 2. Merge new knowledge:
165
+ - Add new decisions
166
+ - Update patterns
167
+ - Add gotchas
168
+ 3. Remove outdated information
169
+ 4. Write updated file
170
+ 5. Log update to CHRONICLE.md
171
+ ```
172
+
173
+ ## What to Include
174
+
175
+ ### Always Include
176
+ - Stack choices (runtime, framework, libraries)
177
+ - Naming conventions
178
+ - Commit format
179
+ - Major architectural decisions
180
+ - Known gotchas
181
+
182
+ ### Include When Relevant
183
+ - Integration patterns
184
+ - Error handling conventions
185
+ - Testing patterns
186
+ - Deployment configuration
187
+
188
+ ### Never Include
189
+ - Sensitive data (API keys, passwords)
190
+ - Temporary workarounds
191
+ - Personal preferences
192
+ - Speculation
193
+
194
+ ## What Subagents Should Do
195
+
196
+ ### With Injected Context
197
+
198
+ 1. **Follow stack choices**: Don't suggest alternative libraries
199
+ 2. **Match conventions**: Use the same naming, export style
200
+ 3. **Reference patterns**: Follow established patterns
201
+ 4. **Avoid gotchas**: Don't repeat known mistakes
202
+
203
+ ### When Context is Missing
204
+
205
+ 1. **Explore codebase**: Look for existing patterns
206
+ 2. **Ask orchestrator**: If critical decision needed
207
+ 3. **Document discovery**: Add to PROJECT_KNOWLEDGE_BASE via memory
208
+
209
+ ## Example: Context-Aware Executor
210
+
211
+ ### Without Context Injection (Bad)
212
+ ```
213
+ Task: Add user validation
214
+
215
+ Executor thinks: "I'll use Zod for validation..."
216
+ Reality: Project uses Yup everywhere
217
+ Result: Inconsistent validation libraries
218
+ ```
219
+
220
+ ### With Context Injection (Good)
221
+ ```
222
+ Task: Add user validation
223
+
224
+ PROJECT_KNOWLEDGE_BASE says:
225
+ - Validation: Yup (see src/validation/schemas.ts)
226
+
227
+ Executor thinks: "Project uses Yup, I'll follow the pattern in schemas.ts"
228
+ Result: Consistent validation approach
229
+ ```
230
+
231
+ ## Integration with Memory
232
+
233
+ ### memory_search Enhancement
234
+
235
+ Before starting work, agents should:
236
+
237
+ ```typescript
238
+ // 1. Check PROJECT_KNOWLEDGE_BASE.md
239
+ Read(".goopspec/PROJECT_KNOWLEDGE_BASE.md")
240
+
241
+ // 2. Search memory for task-specific context
242
+ memory_search({
243
+ query: "[task] patterns conventions",
244
+ concepts: ["patterns", "conventions", "decisions"]
245
+ })
246
+ ```
247
+
248
+ ### memory_save for Future Context
249
+
250
+ When discovering patterns:
251
+
252
+ ```typescript
253
+ memory_save({
254
+ type: "observation",
255
+ title: "Pattern: [pattern name]",
256
+ content: "Found [pattern] used in [files]. Should be added to PROJECT_KNOWLEDGE_BASE.",
257
+ concepts: ["pattern", "convention", "knowledge-base"],
258
+ importance: 0.7
259
+ })
260
+ ```
261
+
262
+ ## Bootstrap Process
263
+
264
+ ### For New Projects
265
+
266
+ When starting a new GoopSpec project:
267
+
268
+ 1. **goop-explorer** maps codebase
269
+ 2. **Orchestrator** creates initial PROJECT_KNOWLEDGE_BASE.md from:
270
+ - package.json analysis
271
+ - Existing config files
272
+ - Code pattern detection
273
+ 3. **User** reviews and corrects
274
+ 4. **memory-distiller** maintains going forward
275
+
276
+ ### For Existing GoopSpec Projects
277
+
278
+ 1. Load existing PROJECT_KNOWLEDGE_BASE.md
279
+ 2. memory-distiller updates with session discoveries
280
+ 3. Accumulates institutional knowledge over time
281
+
282
+ ## Anti-Patterns
283
+
284
+ ### Bad: Ignoring Context
285
+ ```
286
+ PROJECT_KNOWLEDGE_BASE says: Use named exports
287
+ Agent does: export default function...
288
+ ```
289
+ **Fix**: Always read and follow PROJECT_KNOWLEDGE_BASE.
290
+
291
+ ### Bad: Outdated Context
292
+ ```
293
+ PROJECT_KNOWLEDGE_BASE says: Using Express
294
+ Reality: Migrated to Fastify 3 months ago
295
+ ```
296
+ **Fix**: memory-distiller should detect and update.
297
+
298
+ ### Bad: Over-Injection
299
+ ```
300
+ Delegating to agent with 5000 tokens of context
301
+ ```
302
+ **Fix**: Inject only relevant sections for the task.
303
+
304
+ ---
305
+
306
+ *Context Injection Protocol v0.1.4*
307
+ *"Shared knowledge, consistent decisions."*
@@ -0,0 +1,278 @@
1
+ # Discovery Interview
2
+
3
+ The Discovery Interview is a mandatory gate before planning. It ensures requirements are "nailed down" before any work begins.
4
+
5
+ ## Core Principle
6
+
7
+ ```
8
+ +================================================================+
9
+ | NO PLANNING WITHOUT DISCOVERY. |
10
+ | The interview ensures we build the RIGHT thing. |
11
+ | Skipping discovery leads to scope creep and rework. |
12
+ +================================================================+
13
+ ```
14
+
15
+ ## When to Run
16
+
17
+ - **Required before**: `/goop-plan`
18
+ - **Triggered by**: `/goop-discuss`
19
+ - **Output**: `.goopspec/REQUIREMENTS.md`
20
+ - **State update**: `interview_complete: true` in state.json
21
+
22
+ ## The Six Questions
23
+
24
+ Every discovery interview MUST answer these questions:
25
+
26
+ ### 1. Vision (The What)
27
+ ```
28
+ What are you trying to build?
29
+ - What problem does this solve?
30
+ - Who is this for?
31
+ - What does success look like?
32
+ ```
33
+
34
+ **Good answer**: "A JWT-based authentication system that allows users to securely log in, maintains sessions, and protects API routes. Success = users can sign up, log in, and access protected resources."
35
+
36
+ **Bad answer**: "Auth stuff"
37
+
38
+ ### 2. Must-Haves (The Contract)
39
+ ```
40
+ What are the non-negotiable requirements?
41
+ - What MUST be delivered for this to be complete?
42
+ - What are the acceptance criteria?
43
+ ```
44
+
45
+ **Good answer**:
46
+ - User registration with email/password
47
+ - Login returns JWT token
48
+ - Protected routes reject invalid tokens
49
+ - Tokens expire after 24 hours
50
+ - Password reset via email
51
+
52
+ **Bad answer**: "It should work"
53
+
54
+ ### 3. Constraints (The Boundaries)
55
+ ```
56
+ What are the technical and practical constraints?
57
+ - What stack/frameworks are we using?
58
+ - What are the performance requirements?
59
+ - What's the timeline?
60
+ - What existing code must we integrate with?
61
+ ```
62
+
63
+ **Good answer**: "Must use existing Express.js backend, PostgreSQL for storage, jose library for JWT (already in package.json), must not break existing session middleware."
64
+
65
+ **Bad answer**: "None"
66
+
67
+ ### 4. Out of Scope (The Guardrails)
68
+ ```
69
+ What are we explicitly NOT building?
70
+ - What features are deferred to later?
71
+ - What approaches are we avoiding?
72
+ ```
73
+
74
+ **Good answer**:
75
+ - OAuth/social login (future phase)
76
+ - Multi-factor authentication (future phase)
77
+ - Rate limiting (handled by API gateway)
78
+ - User profile management (separate feature)
79
+
80
+ **Bad answer**: "Everything else I guess"
81
+
82
+ ### 5. Assumptions (The Baseline)
83
+ ```
84
+ What are we assuming to be true?
85
+ - What existing functionality are we relying on?
86
+ - What decisions have already been made?
87
+ ```
88
+
89
+ **Good answer**:
90
+ - Database is already set up with users table
91
+ - Email service is available via existing utility
92
+ - Frontend will handle token storage (not our concern)
93
+ - HTTPS is handled at infrastructure level
94
+
95
+ **Bad answer**: "Standard stuff"
96
+
97
+ ### 6. Risks (The Unknowns)
98
+ ```
99
+ What could go wrong?
100
+ - What are we uncertain about?
101
+ - What might change?
102
+ - What dependencies could block us?
103
+ ```
104
+
105
+ **Good answer**:
106
+ - Risk: Password hashing library may have breaking changes
107
+ - Mitigation: Pin exact version, test migration path
108
+ - Risk: Token refresh logic may conflict with existing session
109
+ - Mitigation: Research existing session code first
110
+ - Risk: Email service rate limits may affect password reset
111
+ - Mitigation: Add retry logic with backoff
112
+
113
+ **Bad answer**: "None, it'll be fine"
114
+
115
+ ## Interview Flow
116
+
117
+ ### Step 1: Open-Ended Discovery
118
+ Ask broad questions to understand intent:
119
+ - "What are you trying to accomplish?"
120
+ - "Why is this needed now?"
121
+ - "Who will use this?"
122
+
123
+ ### Step 2: Structured Questions
124
+ Work through the six questions, prompting for specifics:
125
+ - "What happens if [edge case]?"
126
+ - "How should [error scenario] be handled?"
127
+ - "What's the expected behavior when [boundary condition]?"
128
+
129
+ ### Step 3: Summarize and Confirm
130
+ Present back:
131
+ - Vision statement
132
+ - Must-haves list
133
+ - Constraints list
134
+ - Out of scope list
135
+ - Assumptions list
136
+ - Risks with mitigations
137
+
138
+ ### Step 4: Lock Discovery
139
+ - Generate REQUIREMENTS.md
140
+ - Update state.json with `interview_complete: true`
141
+ - Inform user: "Discovery complete. Run `/goop-plan` to create blueprint."
142
+
143
+ ## REQUIREMENTS.md Template
144
+
145
+ ```markdown
146
+ # REQUIREMENTS: [Feature Name]
147
+
148
+ **Generated:** [date]
149
+ **Status:** Locked
150
+
151
+ ---
152
+
153
+ ## Vision
154
+
155
+ [Vision statement - what and why]
156
+
157
+ ---
158
+
159
+ ## Must-Haves
160
+
161
+ These are non-negotiable. The feature is incomplete without ALL of these:
162
+
163
+ - [ ] [Requirement 1]
164
+ - [ ] [Requirement 2]
165
+ - [ ] [Requirement 3]
166
+
167
+ ---
168
+
169
+ ## Constraints
170
+
171
+ ### Technical
172
+ - [Constraint 1]
173
+ - [Constraint 2]
174
+
175
+ ### Practical
176
+ - [Timeline, budget, resources]
177
+
178
+ ---
179
+
180
+ ## Out of Scope
181
+
182
+ Explicitly excluded from this work:
183
+
184
+ - [Item 1] - [reason/future phase]
185
+ - [Item 2] - [reason/future phase]
186
+
187
+ ---
188
+
189
+ ## Assumptions
190
+
191
+ We are assuming:
192
+
193
+ - [Assumption 1]
194
+ - [Assumption 2]
195
+
196
+ ---
197
+
198
+ ## Risks & Mitigations
199
+
200
+ | Risk | Impact | Likelihood | Mitigation |
201
+ |------|--------|------------|------------|
202
+ | [Risk 1] | [H/M/L] | [H/M/L] | [Plan] |
203
+ | [Risk 2] | [H/M/L] | [H/M/L] | [Plan] |
204
+
205
+ ---
206
+
207
+ *Discovery interview completed. Ready for /goop-plan.*
208
+ ```
209
+
210
+ ## Enforcement
211
+
212
+ ### Pre-Plan Gate
213
+ When `/goop-plan` is invoked:
214
+
215
+ ```
216
+ 1. Check state.json for interview_complete
217
+ 2. If false or missing:
218
+ - REFUSE to proceed
219
+ - Display: "Discovery interview required. Run /goop-discuss first."
220
+ 3. If true:
221
+ - Load REQUIREMENTS.md
222
+ - Proceed with planning
223
+ ```
224
+
225
+ ### Validation Rules
226
+ Interview is NOT complete if:
227
+ - Vision is vague (< 2 sentences)
228
+ - Must-haves is empty
229
+ - Out of scope is empty (everything has scope limits)
230
+ - No risks identified (there are always risks)
231
+
232
+ ### Skip Conditions
233
+ Discovery MAY be skipped only for:
234
+ - `/goop-quick` small tasks (single file, < 30 min work)
235
+ - Bug fixes with clear reproduction steps
236
+ - Documentation-only changes
237
+
238
+ ## Anti-Patterns
239
+
240
+ ### Bad: Rushing Through
241
+ ```
242
+ Q: What are you building?
243
+ A: "Just some auth stuff"
244
+ <- NOT ENOUGH
245
+ ```
246
+
247
+ ### Bad: No Scope Limits
248
+ ```
249
+ Q: What's out of scope?
250
+ A: "Nothing, we'll figure it out"
251
+ <- SCOPE CREEP INCOMING
252
+ ```
253
+
254
+ ### Bad: No Risks
255
+ ```
256
+ Q: What could go wrong?
257
+ A: "Nothing, it's straightforward"
258
+ <- FAMOUS LAST WORDS
259
+ ```
260
+
261
+ ### Good: Specific and Bounded
262
+ ```
263
+ Q: What are you building?
264
+ A: "JWT auth with login/logout, 24h token expiry, refresh tokens,
265
+ protected route middleware. Uses existing users table."
266
+
267
+ Q: What's out of scope?
268
+ A: "OAuth (phase 2), MFA (phase 3), rate limiting (infra handles it)"
269
+
270
+ Q: Risks?
271
+ A: "Token refresh may conflict with existing session - need to check
272
+ session.ts first. Also email service has rate limits."
273
+ ```
274
+
275
+ ---
276
+
277
+ *Discovery Interview Protocol v0.1.4*
278
+ *"Nail the spec before you write the code."*