opencode-goopspec 0.1.4 → 0.1.6

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 (91) hide show
  1. package/README.md +7 -8
  2. package/agents/goop-debugger.md +2 -2
  3. package/agents/goop-designer.md +2 -2
  4. package/agents/goop-executor.md +17 -7
  5. package/agents/goop-explorer.md +2 -2
  6. package/agents/goop-librarian.md +1 -1
  7. package/agents/goop-orchestrator.md +47 -5
  8. package/agents/goop-planner.md +3 -3
  9. package/agents/goop-researcher.md +2 -2
  10. package/agents/goop-tester.md +1 -1
  11. package/agents/goop-verifier.md +2 -2
  12. package/agents/goop-writer.md +1 -1
  13. package/agents/memory-distiller.md +2 -2
  14. package/commands/goop-accept.md +27 -401
  15. package/commands/goop-discuss.md +29 -393
  16. package/commands/goop-execute.md +22 -356
  17. package/commands/goop-map-codebase.md +44 -478
  18. package/commands/goop-plan.md +23 -433
  19. package/commands/goop-quick.md +58 -31
  20. package/commands/goop-setup.md +35 -278
  21. package/commands/goop-specify.md +26 -291
  22. package/commands/goop-status.md +26 -261
  23. package/dist/index.js +34981 -239
  24. package/dist/worker/index.js +35883 -0
  25. package/package.json +5 -2
  26. package/references/accept-process.md +402 -0
  27. package/references/context-injection.md +1 -1
  28. package/references/discovery-interview.md +1 -1
  29. package/references/discuss-process.md +383 -0
  30. package/references/dispatch-patterns.md +46 -21
  31. package/references/enforcement-system.md +1 -1
  32. package/references/execute-process.md +358 -0
  33. package/references/git-workflow.md +349 -0
  34. package/references/handoff-protocol.md +1 -1
  35. package/references/map-codebase-process.md +353 -0
  36. package/references/model-profiles.md +16 -16
  37. package/references/orchestrator-philosophy.md +155 -223
  38. package/references/phase-gates.md +1 -1
  39. package/references/plan-process.md +397 -0
  40. package/references/plugin-architecture.md +1 -1
  41. package/references/quick-process.md +343 -0
  42. package/references/response-format.md +2 -2
  43. package/references/specify-process.md +251 -0
  44. package/references/status-process.md +253 -0
  45. package/references/subagent-protocol.md +2 -2
  46. package/references/team-coordination.md +183 -0
  47. package/references/xml-response-schema.md +5 -5
  48. package/skills/accessibility/skill.md +1 -1
  49. package/skills/accessibility-testing/skill.md +1 -1
  50. package/skills/api-docs/skill.md +1 -1
  51. package/skills/architecture-design/skill.md +1 -1
  52. package/skills/atomic-commits/skill.md +92 -15
  53. package/skills/code-review/skill.md +1 -1
  54. package/skills/codebase-mapping/skill.md +1 -1
  55. package/skills/convention-detection/skill.md +1 -1
  56. package/skills/debugging/skill.md +1 -1
  57. package/skills/deviation-handling/skill.md +1 -1
  58. package/skills/documentation/skill.md +1 -1
  59. package/skills/goop-core/skill.md +48 -11
  60. package/skills/memory-usage/skill.md +1 -1
  61. package/skills/parallel-planning/skill.md +1 -1
  62. package/skills/pattern-extraction/skill.md +1 -1
  63. package/skills/performance-optimization/skill.md +1 -1
  64. package/skills/playwright/skill.md +1 -1
  65. package/skills/playwright-testing/skill.md +1 -1
  66. package/skills/progress-tracking/skill.md +1 -1
  67. package/skills/readme-generation/skill.md +1 -1
  68. package/skills/research/skill.md +1 -1
  69. package/skills/responsive-design/skill.md +1 -1
  70. package/skills/scientific-method/skill.md +1 -1
  71. package/skills/security-audit/skill.md +1 -1
  72. package/skills/task-decomposition/skill.md +1 -1
  73. package/skills/task-delegation/skill.md +60 -34
  74. package/skills/technical-writing/skill.md +1 -1
  75. package/skills/testing/skill.md +1 -1
  76. package/skills/ui-design/skill.md +1 -1
  77. package/skills/ux-patterns/skill.md +1 -1
  78. package/skills/verification/skill.md +1 -1
  79. package/skills/visual-regression/skill.md +1 -1
  80. package/templates/blueprint.md +1 -1
  81. package/templates/chronicle.md +1 -1
  82. package/templates/handoff.md +1 -1
  83. package/templates/milestone.md +1 -1
  84. package/templates/project-knowledge-base.md +93 -0
  85. package/templates/project.md +1 -1
  86. package/templates/requirements.md +1 -1
  87. package/templates/research.md +1 -1
  88. package/templates/retrospective.md +1 -1
  89. package/templates/spec.md +1 -1
  90. package/templates/state.md +1 -1
  91. package/templates/summary.md +1 -1
@@ -384,7 +384,7 @@ See `references/xml-response-schema.md` for the complete specification.
384
384
  **Minimal XML envelope:**
385
385
 
386
386
  ```xml
387
- <goop_report version="0.1.4">
387
+ <goop_report version="0.1.6">
388
388
  <status>COMPLETE</status>
389
389
  <agent>goop-[type]</agent>
390
390
  <summary>Brief summary</summary>
@@ -415,4 +415,4 @@ See `references/xml-response-schema.md` for the complete specification.
415
415
 
416
416
  ---
417
417
 
418
- *Response Format v0.1.4*
418
+ *Response Format v0.1.6*
@@ -0,0 +1,251 @@
1
+ # Specification Lock Process
2
+
3
+ Detailed process for `/goop-specify` - locking the specification contract.
4
+
5
+ ## Phase 1: Gate Check
6
+
7
+ **Execute BEFORE anything else:**
8
+
9
+ ```
10
+ goop_status()
11
+ Read(".goopspec/SPEC.md")
12
+ Read(".goopspec/BLUEPRINT.md")
13
+ ```
14
+
15
+ ### 1.1 Check documents exist
16
+
17
+ ```
18
+ IF .goopspec/SPEC.md does not exist:
19
+ REFUSE with:
20
+
21
+ ## 🔮 GoopSpec · Gate Blocked
22
+
23
+ ✗ No specification found.
24
+
25
+ → Run: `/goop-plan`
26
+
27
+ ---
28
+ ```
29
+
30
+ ### 1.2 Check traceability
31
+
32
+ ```
33
+ IF traceability matrix shows < 100%:
34
+ REFUSE with:
35
+
36
+ ## 🔮 GoopSpec · Traceability Incomplete
37
+
38
+ ✗ Not all must-haves have mapped tasks.
39
+
40
+ → Update BLUEPRINT.md or re-run `/goop-plan`
41
+
42
+ ---
43
+ ```
44
+
45
+ ---
46
+
47
+ ## Phase 2: Present Contract
48
+
49
+ **Display the contract for confirmation:**
50
+
51
+ ```
52
+ ## 🔮 GoopSpec · Contract Gate
53
+
54
+ 📜 Review and confirm the specification
55
+
56
+ ### SPECIFICATION: [Name]
57
+
58
+ #### Must-Haves (The Contract)
59
+
60
+ | ID | Requirement | Covered By |
61
+ |----|-------------|------------|
62
+ | MH1 | [Title] | Wave X, Tasks Y |
63
+ | MH2 | [Title] | Wave X, Tasks Y |
64
+
65
+ #### Out of Scope
66
+
67
+ - [Item 1]
68
+ - [Item 2]
69
+
70
+ #### Execution Plan
71
+
72
+ | Wave | Focus | Tasks |
73
+ |------|-------|-------|
74
+ | 1 | [Name] | [N] |
75
+ | 2 | [Name] | [M] |
76
+
77
+ ✓ Traceability: 100%
78
+
79
+ ---
80
+
81
+ ⚠️ **Action Required:**
82
+ - Type **"confirm"** to lock the specification
83
+ - Type **"amend"** to modify requirements
84
+ - Type **"cancel"** to return to planning
85
+ ```
86
+
87
+ ---
88
+
89
+ ## Phase 3: Handle Response
90
+
91
+ **On "confirm":**
92
+
93
+ 1. Lock the spec using goop_state:
94
+ ```
95
+ goop_state({ action: "lock-spec" })
96
+ ```
97
+
98
+ 2. Update SPEC.md:
99
+ ```markdown
100
+ **Status:** Locked
101
+ **Locked At:** [timestamp]
102
+ ```
103
+
104
+ 3. Save to memory:
105
+ ```
106
+ memory_decision({
107
+ decision: "Spec locked for [feature]",
108
+ reasoning: "User confirmed requirements after review",
109
+ impact: "high"
110
+ })
111
+ ```
112
+
113
+ 4. Generate HANDOFF.md:
114
+ ```markdown
115
+ # Session Handoff
116
+
117
+ **Phase:** specify
118
+
119
+ ## Accomplished
120
+ - Spec locked with [N] must-haves
121
+ - Traceability verified at 100%
122
+
123
+ ## Next Session
124
+ Run: /goop-execute
125
+
126
+ ## Context
127
+ Specification locked. Ready for execution.
128
+ ```
129
+
130
+ 5. Display completion:
131
+ ```
132
+ ## 🔮 GoopSpec · Specification Locked
133
+
134
+ 🔒 The spec is now a binding contract
135
+
136
+ | Status | Value |
137
+ |--------|-------|
138
+ | Locked | ✓ Yes |
139
+ | Must-Haves | [N] |
140
+ | Waves | [M] |
141
+ | Tasks | [P] |
142
+
143
+ Changes now require `/goop-amend` with impact analysis.
144
+
145
+ ### Next Step
146
+
147
+ **Begin execution** — Implement the blueprint
148
+
149
+ → `/goop-execute`
150
+
151
+ ---
152
+
153
+ Start a **new session** for fresh context, then run the command.
154
+ ```
155
+
156
+ **On "amend":**
157
+
158
+ ```
159
+ ## 🔮 GoopSpec · Amendment Mode
160
+
161
+ What would you like to change?
162
+
163
+ 1. Add a must-have
164
+ 2. Remove a must-have
165
+ 3. Modify acceptance criteria
166
+ 4. Change out of scope
167
+ 5. Cancel
168
+
169
+ ---
170
+ ```
171
+
172
+ Use `question` tool to get choice, then process amendment.
173
+
174
+ **On "cancel":**
175
+
176
+ ```
177
+ Specification not locked. Returning to planning.
178
+ Run `/goop-plan` to modify or `/goop-discuss` to restart discovery.
179
+ ```
180
+
181
+ ---
182
+
183
+ ## Amendment Protocol (After Lock)
184
+
185
+ Once locked, changes require formal amendment:
186
+
187
+ 1. **Propose change:** User describes modification
188
+ 2. **Impact analysis:** Orchestrator assesses affected tasks
189
+ 3. **Blueprint update:** Modify BLUEPRINT.md if needed
190
+ 4. **Re-confirm:** User confirms amended spec
191
+ 5. **Log amendment:** Add to SPEC.md amendment history
192
+
193
+ ```markdown
194
+ ## Amendment History
195
+
196
+ | Version | Date | Change | Impact | Approved |
197
+ |---------|------|--------|--------|----------|
198
+ | 1.1 | [date] | Added MH3 | +1 task | User |
199
+ ```
200
+
201
+ ---
202
+
203
+ ## Examples
204
+
205
+ ### Successful Lock
206
+ ```
207
+ User: /goop-specify
208
+
209
+ Orchestrator:
210
+ ## 🔮 GoopSpec · Contract Gate
211
+
212
+ ### SPECIFICATION: Dark Mode Toggle
213
+
214
+ #### Must-Haves
215
+ | ID | Requirement | Covered By |
216
+ |----|-------------|------------|
217
+ | MH1 | Toggle UI | W1.T1 |
218
+ | MH2 | Theme switch | W1.T2, W2.T1 |
219
+ | MH3 | Persist preference | W2.T2 |
220
+
221
+ #### Out of Scope
222
+ - Multiple themes (beyond light/dark)
223
+ - Per-component theming
224
+
225
+ ✓ Traceability: 100%
226
+
227
+ Type "confirm" to lock.
228
+
229
+ User: confirm
230
+
231
+ Orchestrator:
232
+ ## 🔮 GoopSpec · Specification Locked
233
+
234
+ → Next: `/goop-execute`
235
+ ```
236
+
237
+ ### Gate Blocked
238
+ ```
239
+ User: /goop-specify
240
+
241
+ Orchestrator:
242
+ ## 🔮 GoopSpec · Gate Blocked
243
+
244
+ ✗ No specification found.
245
+
246
+ → Run: `/goop-plan`
247
+ ```
248
+
249
+ ---
250
+
251
+ *Specification Lock Process v0.1.6*
@@ -0,0 +1,253 @@
1
+ # Status Display Process
2
+
3
+ Detailed process for `/goop-status` - showing current project state.
4
+
5
+ ## Data Sources
6
+
7
+ | Source | Information |
8
+ |--------|-------------|
9
+ | `goop_state` | Phase, locks, timestamps |
10
+ | `REQUIREMENTS.md` | Interview status |
11
+ | `SPEC.md` | Must-haves, lock status |
12
+ | `BLUEPRINT.md` | Waves, tasks, traceability |
13
+ | `CHRONICLE.md` | Progress, decisions, blockers |
14
+ | `HANDOFF.md` | Last session context |
15
+
16
+ ---
17
+
18
+ ## Status Dashboard Template
19
+
20
+ ```
21
+ ## 🔮 GoopSpec · Status
22
+
23
+ ### Project State
24
+
25
+ | Attribute | Value |
26
+ |-----------|-------|
27
+ | Phase | [current phase] |
28
+ | Interview Complete | [Yes/No] |
29
+ | Spec Locked | [Yes/No] |
30
+ | Wave | [N of M] |
31
+ | Task | [X of Y] |
32
+
33
+ ### Gate Status
34
+
35
+ | Gate | Status | Requirement |
36
+ |------|--------|-------------|
37
+ | Discovery | [PASSED/BLOCKED] | interview_complete |
38
+ | Spec | [PASSED/BLOCKED] | spec_locked |
39
+ | Execution | [PASSED/BLOCKED] | all_tasks_done |
40
+ | Acceptance | [PASSED/BLOCKED] | verification_passed |
41
+
42
+ ### Progress
43
+
44
+ [Progress bar and completion percentage]
45
+
46
+ #### Completed
47
+ - [x] [Item 1]
48
+ - [x] [Item 2]
49
+
50
+ #### In Progress
51
+ - [ ] [Current item] <- **Current**
52
+
53
+ #### Remaining
54
+ - [ ] [Item 3]
55
+ - [ ] [Item 4]
56
+
57
+ ### Active Blockers
58
+
59
+ [None | List of blockers]
60
+
61
+ ### Pending Decisions
62
+
63
+ [None | List of decisions awaiting user input]
64
+
65
+ ### Recent Activity
66
+
67
+ | Time | Action | Agent |
68
+ |------|--------|-------|
69
+ | [time] | [action] | [agent] |
70
+
71
+ ---
72
+
73
+ ### Suggested Next Command
74
+
75
+ Based on current state: `/goop-[command]`
76
+
77
+ [Brief explanation]
78
+
79
+ ---
80
+ ```
81
+
82
+ ---
83
+
84
+ ## Gate Logic
85
+
86
+ ### Discovery Gate
87
+ ```
88
+ IF REQUIREMENTS.md exists AND interview_complete == true:
89
+ PASSED
90
+ ELSE:
91
+ BLOCKED - Run /goop-discuss
92
+ ```
93
+
94
+ ### Spec Gate
95
+ ```
96
+ IF SPEC.md exists AND spec_locked == true:
97
+ PASSED
98
+ ELSE:
99
+ BLOCKED - Run /goop-specify
100
+ ```
101
+
102
+ ### Execution Gate
103
+ ```
104
+ IF CHRONICLE shows all waves complete:
105
+ PASSED
106
+ ELSE:
107
+ BLOCKED - Continue /goop-execute
108
+ ```
109
+
110
+ ### Acceptance Gate
111
+ ```
112
+ IF verification_passed == true AND user_accepted == true:
113
+ PASSED
114
+ ELSE:
115
+ BLOCKED - Run /goop-accept
116
+ ```
117
+
118
+ ---
119
+
120
+ ## Command Suggestions
121
+
122
+ | State | Suggested Command |
123
+ |-------|-------------------|
124
+ | No project | `/goop-discuss` to start discovery |
125
+ | Interview incomplete | `/goop-discuss` to complete interview |
126
+ | Interview complete, no spec | `/goop-plan` to create blueprint |
127
+ | Spec draft, not locked | `/goop-specify` to lock |
128
+ | Spec locked, not executing | `/goop-execute` to start |
129
+ | Executing, tasks remaining | `/goop-execute` to continue |
130
+ | Executing, all done | `/goop-accept` to verify |
131
+ | Verified, not accepted | `/goop-accept` to accept |
132
+ | Accepted | `/goop-complete` to archive |
133
+
134
+ ---
135
+
136
+ ## Verbose Mode
137
+
138
+ With `--verbose`:
139
+
140
+ ```
141
+ ### Full Task History
142
+
143
+ | Wave | Task | Status | Commit | Time |
144
+ |------|------|--------|--------|------|
145
+ | 1 | 1.1 | Complete | abc123 | 10m |
146
+ | 1 | 1.2 | Complete | def456 | 15m |
147
+ | 2 | 2.1 | In Progress | - | - |
148
+
149
+ ### Memory Stats
150
+
151
+ - Total memories: [N]
152
+ - Decisions: [M]
153
+ - Observations: [P]
154
+ - Recent: [list]
155
+
156
+ ### Recent Deviations
157
+
158
+ | Rule | Description | Resolution |
159
+ |------|-------------|------------|
160
+ | [N] | [What happened] | [How resolved] |
161
+
162
+ ### Checkpoint History
163
+
164
+ | ID | Phase | Wave | Created |
165
+ |----|-------|------|---------|
166
+ | [id] | [phase] | [wave] | [time] |
167
+ ```
168
+
169
+ ---
170
+
171
+ ## Examples
172
+
173
+ ### Fresh Project
174
+ ```
175
+ User: /goop-status
176
+
177
+ ## 🔮 GoopSpec · Status
178
+
179
+ ### Project State
180
+
181
+ | Attribute | Value |
182
+ |-----------|-------|
183
+ | Phase | idle |
184
+ | Interview Complete | No |
185
+ | Spec Locked | No |
186
+
187
+ ### Gate Status
188
+
189
+ | Gate | Status |
190
+ |------|--------|
191
+ | Discovery | BLOCKED |
192
+ | Spec | BLOCKED |
193
+ | Execution | BLOCKED |
194
+ | Acceptance | BLOCKED |
195
+
196
+ ### Suggested Next Command
197
+
198
+ `/goop-discuss` - Start discovery interview
199
+
200
+ No project documents found. Begin with discovery.
201
+ ```
202
+
203
+ ### Mid-Execution
204
+ ```
205
+ User: /goop-status
206
+
207
+ ## 🔮 GoopSpec · Status
208
+
209
+ ### Project State
210
+
211
+ | Attribute | Value |
212
+ |-----------|-------|
213
+ | Phase | execute |
214
+ | Interview Complete | Yes |
215
+ | Spec Locked | Yes |
216
+ | Wave | 2 of 3 |
217
+ | Task | 3 of 4 |
218
+
219
+ ### Gate Status
220
+
221
+ | Gate | Status |
222
+ |------|--------|
223
+ | Discovery | PASSED |
224
+ | Spec | PASSED |
225
+ | Execution | In Progress |
226
+ | Acceptance | Pending |
227
+
228
+ ### Progress
229
+
230
+ [################____] 75%
231
+
232
+ #### Completed
233
+ - [x] Wave 1: Foundation (4/4 tasks)
234
+ - [x] Wave 2.1: Define types
235
+ - [x] Wave 2.2: Implement handler
236
+
237
+ #### In Progress
238
+ - [ ] Wave 2.3: Add validation <- **Current**
239
+
240
+ #### Remaining
241
+ - [ ] Wave 2.4: Add tests
242
+ - [ ] Wave 3: Integration (3 tasks)
243
+
244
+ ### Suggested Next Command
245
+
246
+ `/goop-execute` - Continue Wave 2
247
+
248
+ 2 tasks remaining in Wave 2, then Wave 3.
249
+ ```
250
+
251
+ ---
252
+
253
+ *Status Process v0.1.6*
@@ -189,7 +189,7 @@ All subagent responses MUST end with an XML envelope. See `references/xml-respon
189
189
  **Basic structure:**
190
190
 
191
191
  ```xml
192
- <goop_report version="0.1.4">
192
+ <goop_report version="0.1.6">
193
193
  <status>COMPLETE|PARTIAL|BLOCKED|CHECKPOINT</status>
194
194
  <agent>goop-[type]</agent>
195
195
  <task_name>Task description</task_name>
@@ -440,4 +440,4 @@ Every subagent execution:
440
440
 
441
441
  ---
442
442
 
443
- *Subagent Protocol v0.1.4*
443
+ *Subagent Protocol v0.1.6*
@@ -0,0 +1,183 @@
1
+ # Team Coordination Reference
2
+
3
+ This reference documents how GoopSpec agents coordinate when running in parallel. It explains the registry, per-agent file patterns, merge workflow, conflict handling, and recommended practices.
4
+
5
+ ## Overview
6
+
7
+ The team coordination system prevents parallel agents from overwriting shared files by:
8
+
9
+ - Registering active agents and their claimed files in a central registry.
10
+ - Redirecting shared outputs to per-agent files using a stable naming pattern.
11
+ - Allowing the orchestrator to merge per-agent outputs into canonical files.
12
+ - Detecting conflicts early and suggesting safe alternatives.
13
+
14
+ Key artifacts live under `.goopspec/team/`.
15
+
16
+ ## Registry Structure and Operations
17
+
18
+ **Registry location:** `.goopspec/team/registry.json` (with `.goopspec/team/registry.lock` for atomic writes).
19
+
20
+ **Registry schema:**
21
+
22
+ ```json
23
+ {
24
+ "version": 1,
25
+ "agents": {
26
+ "agent-id": {
27
+ "id": "agent-id",
28
+ "type": "goop-executor",
29
+ "task": "Implement registry",
30
+ "claimedFiles": ["src/features/team/registry.ts"],
31
+ "parentId": "parent-agent-id",
32
+ "startedAt": 1700000000000,
33
+ "ttl": 1800000
34
+ }
35
+ }
36
+ }
37
+ ```
38
+
39
+ **Fields:**
40
+
41
+ - `id`: unique agent identifier.
42
+ - `type`: agent type (e.g., `goop-researcher`).
43
+ - `task`: short task description.
44
+ - `claimedFiles`: files this agent intends to write.
45
+ - `parentId`: parent agent identifier if delegated.
46
+ - `startedAt`: registration time (ms epoch).
47
+ - `ttl`: optional time-to-live for cleanup (ms).
48
+
49
+ **Core operations:**
50
+
51
+ - `getRegistry()` reads the registry state.
52
+ - `registerAgent(registration)` registers an agent atomically.
53
+ - `deregisterAgent(agentId)` removes the agent entry.
54
+ - `getActiveAgents()` returns all active agents.
55
+ - `getAgentsByType(type)` filters by agent type.
56
+ - `isFileClaimed(filePath)` checks if any agent has claimed a file.
57
+
58
+ **Atomic behavior:** registry updates use a lock file and atomic write to prevent race conditions.
59
+
60
+ ## Per-Agent File Patterns
61
+
62
+ When multiple agents produce shared artifacts, each writes to its own file using:
63
+
64
+ ```
65
+ {basename}-{shortId}.{ext}
66
+ ```
67
+
68
+ Example: `RESEARCH.md` becomes `RESEARCH-a1b2c3.md` for agent `a1b2c3`.
69
+
70
+ **Short ID rules:**
71
+
72
+ - Derived from the agent ID with non-alphanumeric characters removed.
73
+ - Length is clamped to 6-8 characters (default 7).
74
+ - If a short ID is empty after normalization, the basename remains unchanged.
75
+
76
+ **Helpers:**
77
+
78
+ - `generateAgentFilePath(basePath, agentId, shortIdLength?)`
79
+ - `extractAgentId(agentFilePath)`
80
+ - `findAgentFiles(basePath, pattern?)`
81
+ - `getCanonicalPath(agentFilePath)`
82
+
83
+ ### Per-Agent File Patterns by Agent Type
84
+
85
+ Per-agent naming works for any shared output file. Common base files by agent type:
86
+
87
+ | Agent Type | Typical Base File | Per-Agent Example |
88
+ | --- | --- | --- |
89
+ | `goop-researcher` | `RESEARCH.md` | `RESEARCH-res001.md` |
90
+ | `goop-explorer` | `RESEARCH.md` | `RESEARCH-exp123.md` |
91
+ | `goop-planner` | `BLUEPRINT.md` | `BLUEPRINT-plan42.md` |
92
+ | `goop-verifier` | `CHRONICLE.md` | `CHRONICLE-ver789.md` |
93
+ | `goop-writer` | `RESEARCH.md` or `SPEC.md` | `SPEC-wrt555.md` |
94
+ | `goop-executor` | Shared docs when needed | `CHRONICLE-exe321.md` |
95
+ | `goop-debugger` | `RESEARCH.md` | `RESEARCH-bug007.md` |
96
+
97
+ These examples are illustrative; the pattern applies to any base file (e.g., `SPEC.md`, `BLUEPRINT.md`, `CHRONICLE.md`, `RESEARCH.md`, `HANDOFF.md`).
98
+
99
+ ## Merge Workflow
100
+
101
+ After parallel work, the orchestrator merges per-agent outputs into a canonical file.
102
+
103
+ **Merge steps:**
104
+
105
+ 1. Locate all per-agent files matching the canonical base path.
106
+ 2. Read registry to map short IDs to full agent IDs and tasks.
107
+ 3. Render a header for each section, then concatenate sections with separators.
108
+ 4. Write the merged content to the canonical output path.
109
+ 5. Optionally remove per-agent files after merge.
110
+
111
+ **Header template:**
112
+
113
+ ```
114
+ ## Agent {{agentId}}
115
+
116
+ Task: {{task}}
117
+ ```
118
+
119
+ The merge utility replaces `{{agentId}}` and `{{task}}`, then joins sections using `---` separators.
120
+
121
+ ## Conflict Detection and Resolution
122
+
123
+ Before writing a file, check for conflicts:
124
+
125
+ 1. Call `checkFileConflict(filePath, requestingAgentId)`.
126
+ 2. If `hasConflict` is `true`, read `warningMessage` and `suggestedPath`.
127
+ 3. Write to the suggested per-agent path instead of the claimed file.
128
+ 4. Notify the orchestrator to merge once all agents complete.
129
+
130
+ If the file is claimed by the same agent, the conflict check allows the write.
131
+
132
+ ## Examples
133
+
134
+ ### Generate a Per-Agent File Path
135
+
136
+ ```ts
137
+ import { generateAgentFilePath } from "../src/features/team/file-patterns.js";
138
+
139
+ const agentFile = generateAgentFilePath("RESEARCH.md", "res-001");
140
+ // => "RESEARCH-res001.md"
141
+ ```
142
+
143
+ ### Merge Per-Agent Outputs
144
+
145
+ ```ts
146
+ import { mergeAgentOutputs } from "../src/features/team/merge.js";
147
+
148
+ await mergeAgentOutputs({
149
+ basePath: ".goopspec/RESEARCH.md",
150
+ cleanup: false,
151
+ });
152
+ ```
153
+
154
+ ### Conflict Warning (Example)
155
+
156
+ ```
157
+ WARNING: File Conflict Detected
158
+
159
+ The file you're trying to write is claimed by another agent:
160
+ - Agent: exec-001 (goop-executor)
161
+ - Task: Modify index
162
+
163
+ Suggested action: Write to your per-agent file instead:
164
+ → RESEARCH-exec002.md
165
+ ```
166
+
167
+ ## Best Practices
168
+
169
+ - Register early and claim files you intend to modify.
170
+ - Use per-agent files for shared artifacts (research, plans, summaries).
171
+ - Avoid writing directly to canonical files during parallel work.
172
+ - Keep per-agent outputs focused and well-structured to ease merging.
173
+ - Clean up per-agent files after a successful merge when possible.
174
+ - If you must touch a claimed file, coordinate through the orchestrator.
175
+
176
+ ## Related Files
177
+
178
+ - `src/features/team/types.ts` - Registry types
179
+ - `src/features/team/registry.ts` - Registry operations
180
+ - `src/features/team/file-patterns.ts` - File pattern helpers
181
+ - `src/features/team/merge.ts` - Merge utilities
182
+ - `src/features/team/conflict.ts` - Conflict detection
183
+ - `src/features/team/cleanup.ts` - Cleanup utilities