create-universal-ai-context 2.5.0 → 2.6.0-final
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -21
- package/README.md +331 -294
- package/bin/create-ai-context.js +1507 -775
- package/lib/adapters/aider.js +131 -131
- package/lib/adapters/antigravity.js +205 -205
- package/lib/adapters/claude.js +397 -397
- package/lib/adapters/cline.js +125 -125
- package/lib/adapters/continue.js +138 -138
- package/lib/adapters/copilot.js +131 -131
- package/lib/adapters/index.js +78 -78
- package/lib/adapters/windsurf.js +138 -138
- package/lib/ai-context-generator.js +234 -234
- package/lib/ai-orchestrator.js +432 -432
- package/lib/call-tracer.js +444 -444
- package/lib/content-preservation.js +243 -243
- package/lib/cross-tool-sync/file-watcher.js +274 -274
- package/lib/cross-tool-sync/index.js +41 -40
- package/lib/cross-tool-sync/sync-manager.js +540 -512
- package/lib/cross-tool-sync/sync-service.js +297 -297
- package/lib/detector.js +726 -726
- package/lib/doc-discovery.js +741 -741
- package/lib/drift-checker.js +920 -920
- package/lib/environment-detector.js +239 -239
- package/lib/index.js +399 -399
- package/lib/install-hooks.js +82 -82
- package/lib/installer.js +419 -419
- package/lib/migrate.js +328 -328
- package/lib/placeholder.js +632 -632
- package/lib/prompts.js +341 -341
- package/lib/smart-merge.js +540 -540
- package/lib/spinner.js +60 -60
- package/lib/static-analyzer.js +729 -729
- package/lib/template-coordination.js +148 -148
- package/lib/template-populator.js +843 -843
- package/lib/template-renderer.js +392 -392
- package/lib/utils/fs-wrapper.js +79 -79
- package/lib/utils/path-utils.js +60 -60
- package/lib/validate.js +155 -155
- package/package.json +1 -1
- package/templates/AI_CONTEXT.md.template +245 -245
- package/templates/base/README.md +260 -257
- package/templates/base/RPI_WORKFLOW_PLAN.md +325 -320
- package/templates/base/agents/api-developer.md +76 -76
- package/templates/base/agents/context-engineer.md +525 -525
- package/templates/base/agents/core-architect.md +76 -76
- package/templates/base/agents/database-ops.md +76 -76
- package/templates/base/agents/deployment-ops.md +76 -76
- package/templates/base/agents/integration-hub.md +76 -76
- package/templates/base/analytics/README.md +114 -114
- package/templates/base/automation/config.json +58 -58
- package/templates/base/automation/generators/code-mapper.js +308 -308
- package/templates/base/automation/generators/index-builder.js +321 -321
- package/templates/base/automation/hooks/post-commit.sh +83 -83
- package/templates/base/automation/hooks/pre-commit.sh +103 -103
- package/templates/base/ci-templates/README.md +108 -108
- package/templates/base/ci-templates/github-actions/context-check.yml +144 -144
- package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -105
- package/templates/base/commands/analytics.md +238 -238
- package/templates/base/commands/auto-sync.md +172 -172
- package/templates/base/commands/collab.md +194 -194
- package/templates/base/commands/context-optimize.md +226 -0
- package/templates/base/commands/help.md +485 -450
- package/templates/base/commands/rpi-implement.md +164 -115
- package/templates/base/commands/rpi-plan.md +147 -93
- package/templates/base/commands/rpi-research.md +145 -88
- package/templates/base/commands/session-resume.md +144 -144
- package/templates/base/commands/session-save.md +112 -112
- package/templates/base/commands/validate-all.md +77 -77
- package/templates/base/commands/verify-docs-current.md +86 -86
- package/templates/base/config/base.json +57 -57
- package/templates/base/config/environments/development.json +13 -13
- package/templates/base/config/environments/production.json +17 -17
- package/templates/base/config/environments/staging.json +13 -13
- package/templates/base/config/local.json.example +21 -21
- package/templates/base/context/.meta/generated-at.json +18 -18
- package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -156
- package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -94
- package/templates/base/context/FILE_OWNERSHIP.md +57 -57
- package/templates/base/context/INTEGRATION_POINTS.md +92 -92
- package/templates/base/context/KNOWN_GOTCHAS.md +195 -195
- package/templates/base/context/TESTING_MAP.md +95 -95
- package/templates/base/context/WORKFLOW_INDEX.md +129 -129
- package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -294
- package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -255
- package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -44
- package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -38
- package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -39
- package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -39
- package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -38
- package/templates/base/knowledge/README.md +98 -98
- package/templates/base/knowledge/sessions/README.md +88 -88
- package/templates/base/knowledge/sessions/TEMPLATE.md +150 -150
- package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -144
- package/templates/base/knowledge/shared/decisions/README.md +49 -49
- package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -123
- package/templates/base/knowledge/shared/patterns/README.md +62 -62
- package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -120
- package/templates/base/plans/PLAN_TEMPLATE.md +316 -250
- package/templates/base/research/RESEARCH_TEMPLATE.md +245 -153
- package/templates/base/schemas/agent.schema.json +141 -141
- package/templates/base/schemas/anchors.schema.json +54 -54
- package/templates/base/schemas/automation.schema.json +93 -93
- package/templates/base/schemas/command.schema.json +134 -134
- package/templates/base/schemas/hashes.schema.json +40 -40
- package/templates/base/schemas/manifest.schema.json +117 -117
- package/templates/base/schemas/plan.schema.json +136 -136
- package/templates/base/schemas/research.schema.json +115 -115
- package/templates/base/schemas/roles.schema.json +34 -34
- package/templates/base/schemas/session.schema.json +77 -77
- package/templates/base/schemas/settings.schema.json +244 -244
- package/templates/base/schemas/staleness.schema.json +53 -53
- package/templates/base/schemas/team-config.schema.json +42 -42
- package/templates/base/schemas/workflow.schema.json +126 -126
- package/templates/base/session/checkpoints/.gitkeep +2 -2
- package/templates/base/session/current/state.json +20 -20
- package/templates/base/session/history/.gitkeep +2 -2
- package/templates/base/settings.json +3 -3
- package/templates/base/standards/COMPATIBILITY.md +219 -219
- package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -280
- package/templates/base/standards/QUALITY_CHECKLIST.md +211 -211
- package/templates/base/standards/README.md +66 -66
- package/templates/base/sync/anchors.json +6 -6
- package/templates/base/sync/hashes.json +6 -6
- package/templates/base/sync/staleness.json +10 -10
- package/templates/base/team/README.md +168 -168
- package/templates/base/team/config.json +79 -79
- package/templates/base/team/roles.json +145 -145
- package/templates/base/tools/bin/claude-context.js +151 -151
- package/templates/base/tools/lib/anchor-resolver.js +276 -276
- package/templates/base/tools/lib/config-loader.js +363 -363
- package/templates/base/tools/lib/detector.js +350 -350
- package/templates/base/tools/lib/diagnose.js +206 -206
- package/templates/base/tools/lib/drift-detector.js +373 -373
- package/templates/base/tools/lib/errors.js +199 -199
- package/templates/base/tools/lib/index.js +36 -36
- package/templates/base/tools/lib/init.js +192 -192
- package/templates/base/tools/lib/logger.js +230 -230
- package/templates/base/tools/lib/placeholder.js +201 -201
- package/templates/base/tools/lib/session-manager.js +354 -354
- package/templates/base/tools/lib/validate.js +521 -521
- package/templates/base/tools/package.json +49 -49
- package/templates/handlebars/aider-config.hbs +146 -80
- package/templates/handlebars/antigravity.hbs +377 -377
- package/templates/handlebars/claude.hbs +183 -183
- package/templates/handlebars/cline.hbs +62 -62
- package/templates/handlebars/continue-config.hbs +116 -116
- package/templates/handlebars/copilot.hbs +130 -130
- package/templates/handlebars/partials/gotcha-list.hbs +11 -11
- package/templates/handlebars/partials/header.hbs +3 -3
- package/templates/handlebars/partials/workflow-summary.hbs +16 -16
- package/templates/handlebars/windsurf-rules.hbs +69 -69
- package/templates/hooks/post-commit.hbs +28 -29
- package/templates/hooks/pre-commit.hbs +46 -46
|
@@ -1,320 +1,325 @@
|
|
|
1
|
-
# RPI (Research, Plan, Implement) Workflow
|
|
2
|
-
|
|
3
|
-
**Created:** {{DATE}}
|
|
4
|
-
**Platform:** Claude Code
|
|
5
|
-
**Context Budget:** 200k tokens max, target <40%
|
|
6
|
-
**Output Budget:** 30k tokens max per response
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Executive Summary
|
|
11
|
-
|
|
12
|
-
The RPI workflow prevents the "slop" and "dumb zone" problems in AI-assisted development. By separating research, planning, and implementation into distinct phases, we achieve:
|
|
13
|
-
|
|
14
|
-
- **90% fewer cascading errors**
|
|
15
|
-
- **3× faster feature implementation**
|
|
16
|
-
- **5× faster issue resolution**
|
|
17
|
-
- **Self-documenting changes**
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
###
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
###
|
|
39
|
-
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
-
|
|
72
|
-
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
- [ ]
|
|
77
|
-
- [ ]
|
|
78
|
-
- [ ]
|
|
79
|
-
- [ ]
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
- [ ]
|
|
117
|
-
- [ ]
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
**
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
**
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
---
|
|
227
|
-
|
|
228
|
-
##
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
---
|
|
292
|
-
|
|
293
|
-
##
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
-
|
|
297
|
-
-
|
|
298
|
-
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
1
|
+
# RPI (Research, Plan, Implement) Workflow
|
|
2
|
+
|
|
3
|
+
**Created:** {{DATE}}
|
|
4
|
+
**Platform:** Claude Code
|
|
5
|
+
**Context Budget:** 200k tokens max, target <40%
|
|
6
|
+
**Output Budget:** 30k tokens max per response
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
The RPI workflow prevents the "slop" and "dumb zone" problems in AI-assisted development. By separating research, planning, and implementation into distinct phases, we achieve:
|
|
13
|
+
|
|
14
|
+
- **90% fewer cascading errors**
|
|
15
|
+
- **3× faster feature implementation**
|
|
16
|
+
- **5× faster issue resolution**
|
|
17
|
+
- **Self-documenting changes**
|
|
18
|
+
|
|
19
|
+
**Key Innovation: Parallel Agents with Chunked Todolists**
|
|
20
|
+
|
|
21
|
+
Each RPI phase inherently utilizes parallel agents and produces chunk-based outputs designed for consumption by the next phase. This creates a self-aware pipeline where:
|
|
22
|
+
- RPI-Research outputs chunks knowing RPI-Plan will consume them
|
|
23
|
+
- RPI-Plan creates chunk-todolists knowing RPI-Implement will process them
|
|
24
|
+
- Each phase loops through chunks, marking completion as it progresses
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Phase 1: RESEARCH
|
|
29
|
+
|
|
30
|
+
### Purpose
|
|
31
|
+
Understand the system, locate relevant components, prevent context pollution
|
|
32
|
+
|
|
33
|
+
### Artifacts
|
|
34
|
+
- Research document in `.ai-context/research/active/[feature]_research.md`
|
|
35
|
+
- **Chunked Research Sections** (3-7 chunks based on complexity)
|
|
36
|
+
- 150-word summary for parent context
|
|
37
|
+
|
|
38
|
+
### Process
|
|
39
|
+
1. Load WORKFLOW_INDEX.md first (saves 100k+ tokens)
|
|
40
|
+
2. **Spawn 3-5 parallel Explore agents** (one per research domain)
|
|
41
|
+
3. Each agent produces a **Research Chunk** with:
|
|
42
|
+
- Chunk ID (e.g., `CHUNK-R1`, `CHUNK-R2`)
|
|
43
|
+
- Explored files with line numbers
|
|
44
|
+
- Call chains traced
|
|
45
|
+
- Dependencies found
|
|
46
|
+
- Chunk status: `COMPLETE` | `IN_PROGRESS` | `BLOCKED`
|
|
47
|
+
4. Aggregate chunks into unified research document
|
|
48
|
+
5. Format output specifically for RPI-Plan consumption
|
|
49
|
+
|
|
50
|
+
### Parallel Agent Strategy
|
|
51
|
+
```
|
|
52
|
+
┌─────────────────────────────────────────────────────────┐
|
|
53
|
+
│ RPI-RESEARCH PARALLEL EXECUTION │
|
|
54
|
+
├─────────────────────────────────────────────────────────┤
|
|
55
|
+
│ Agent 1: API/Route Entry Points → CHUNK-R1 │
|
|
56
|
+
│ Agent 2: Business Logic & Models → CHUNK-R2 │
|
|
57
|
+
│ Agent 3: Database/Storage Layer → CHUNK-R3 │
|
|
58
|
+
│ Agent 4: External Integrations → CHUNK-R4 │
|
|
59
|
+
│ Agent 5: Test Coverage Analysis → CHUNK-R5 │
|
|
60
|
+
└─────────────────────────────────────────────────────────┘
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### Inter-Phase Awareness
|
|
64
|
+
**RPI-Research KNOWS that RPI-Plan will:**
|
|
65
|
+
- Read each chunk sequentially
|
|
66
|
+
- Generate a planning todolist per chunk
|
|
67
|
+
- Mark chunks as `PLANNED` when processed
|
|
68
|
+
- Require: chunk IDs, file:line refs, dependency list
|
|
69
|
+
|
|
70
|
+
### Context Budget
|
|
71
|
+
- Starting: Up to 50k tokens for exploration
|
|
72
|
+
- Ending: 20k tokens (research doc only)
|
|
73
|
+
- Compaction: After each phase
|
|
74
|
+
|
|
75
|
+
### Exit Criteria
|
|
76
|
+
- [ ] Research document created with chunked structure
|
|
77
|
+
- [ ] 3-20 relevant files identified per chunk
|
|
78
|
+
- [ ] Call chains traced with line numbers
|
|
79
|
+
- [ ] Dependencies mapped per chunk
|
|
80
|
+
- [ ] 150-word summary generated
|
|
81
|
+
- [ ] **Chunk manifest created for RPI-Plan**
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Phase 2: PLAN
|
|
86
|
+
|
|
87
|
+
### Purpose
|
|
88
|
+
Design implementation with file:line precision, get human alignment
|
|
89
|
+
|
|
90
|
+
### Artifacts
|
|
91
|
+
- Plan document in `.ai-context/plans/active/[feature]_plan.md`
|
|
92
|
+
- **Chunk-Based Todolists** (one per research chunk)
|
|
93
|
+
- Step-by-step implementation roadmap
|
|
94
|
+
|
|
95
|
+
### Process
|
|
96
|
+
1. Load research document with chunks
|
|
97
|
+
2. **For each Research Chunk (CHUNK-Rn):**
|
|
98
|
+
a. Create corresponding Plan Chunk (CHUNK-Pn)
|
|
99
|
+
b. Generate specific todolist for that chunk
|
|
100
|
+
c. Mark research chunk as `PLANNED`
|
|
101
|
+
d. Record dependencies between plan chunks
|
|
102
|
+
3. Reference workflow gotchas
|
|
103
|
+
4. Create modification list with exact line numbers
|
|
104
|
+
5. Plan testing strategy per chunk
|
|
105
|
+
6. Define rollback plan
|
|
106
|
+
7. **Loop until all research chunks are processed**
|
|
107
|
+
|
|
108
|
+
### Chunk-Based Todolist Generation
|
|
109
|
+
```
|
|
110
|
+
┌─────────────────────────────────────────────────────────┐
|
|
111
|
+
│ RPI-PLAN CHUNK PROCESSING LOOP │
|
|
112
|
+
├─────────────────────────────────────────────────────────┤
|
|
113
|
+
│ FOR each CHUNK-Rn in research_chunks: │
|
|
114
|
+
│ 1. Read CHUNK-Rn content │
|
|
115
|
+
│ 2. Create CHUNK-Pn todolist: │
|
|
116
|
+
│ - [ ] Analyze files from CHUNK-Rn │
|
|
117
|
+
│ - [ ] Define modifications with line numbers │
|
|
118
|
+
│ - [ ] Specify tests for this chunk │
|
|
119
|
+
│ - [ ] Document rollback for this chunk │
|
|
120
|
+
│ 3. Mark CHUNK-Rn as PLANNED │
|
|
121
|
+
│ 4. Link CHUNK-Pn dependencies │
|
|
122
|
+
│ 5. Proceed to next CHUNK-R(n+1) │
|
|
123
|
+
│ END LOOP │
|
|
124
|
+
│ Generate unified plan document │
|
|
125
|
+
└─────────────────────────────────────────────────────────┘
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Inter-Phase Awareness
|
|
129
|
+
**RPI-Plan KNOWS that:**
|
|
130
|
+
- RPI-Research structured chunks for sequential processing
|
|
131
|
+
- RPI-Implement will read each CHUNK-Pn as an atomic unit
|
|
132
|
+
- Each CHUNK-Pn must be independently implementable
|
|
133
|
+
- Chunk dependencies must be explicit for proper ordering
|
|
134
|
+
|
|
135
|
+
### Context Budget
|
|
136
|
+
- Research doc: 20k tokens
|
|
137
|
+
- Plan creation: 15k tokens
|
|
138
|
+
- Total: 35k tokens (17.5%)
|
|
139
|
+
|
|
140
|
+
### Exit Criteria
|
|
141
|
+
- [ ] Plan document created with file:line references
|
|
142
|
+
- [ ] **All research chunks marked as PLANNED**
|
|
143
|
+
- [ ] **Chunk-todolists created for each chunk**
|
|
144
|
+
- [ ] All modifications listed with risk level
|
|
145
|
+
- [ ] Test strategy defined per chunk
|
|
146
|
+
- [ ] Rollback plan documented
|
|
147
|
+
- [ ] Human review completed
|
|
148
|
+
- [ ] **Chunk manifest created for RPI-Implement**
|
|
149
|
+
|
|
150
|
+
---
|
|
151
|
+
|
|
152
|
+
## Phase 3: IMPLEMENT
|
|
153
|
+
|
|
154
|
+
### Purpose
|
|
155
|
+
Execute atomically with continuous testing
|
|
156
|
+
|
|
157
|
+
### Golden Rule
|
|
158
|
+
```
|
|
159
|
+
ONE CHUNK → COMPLETE TODOLIST → MARK DONE → NEXT CHUNK
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
### Process
|
|
163
|
+
1. Load plan document with chunk-todolists
|
|
164
|
+
2. **For each Plan Chunk (CHUNK-Pn):**
|
|
165
|
+
a. Load chunk-specific todolist
|
|
166
|
+
b. Execute each todo item atomically:
|
|
167
|
+
- Make single change
|
|
168
|
+
- Run chunk-specific test
|
|
169
|
+
- Commit if pass, stop if fail
|
|
170
|
+
c. Update documentation for this chunk
|
|
171
|
+
d. Mark CHUNK-Pn as `IMPLEMENTED`
|
|
172
|
+
e. Mark corresponding CHUNK-Rn in research as `IMPLEMENTED`
|
|
173
|
+
f. Proceed to next CHUNK-P(n+1)
|
|
174
|
+
3. **Loop until all plan chunks are processed**
|
|
175
|
+
4. Run full test suite after all chunks complete
|
|
176
|
+
|
|
177
|
+
### Chunk-Based Implementation Loop
|
|
178
|
+
```
|
|
179
|
+
┌─────────────────────────────────────────────────────────┐
|
|
180
|
+
│ RPI-IMPLEMENT CHUNK PROCESSING LOOP │
|
|
181
|
+
├─────────────────────────────────────────────────────────┤
|
|
182
|
+
│ FOR each CHUNK-Pn in plan_chunks: │
|
|
183
|
+
│ 1. Load CHUNK-Pn todolist │
|
|
184
|
+
│ 2. FOR each TODO item in CHUNK-Pn: │
|
|
185
|
+
│ a. Make atomic change │
|
|
186
|
+
│ b. Run specified test │
|
|
187
|
+
│ c. If PASS: commit, mark TODO complete │
|
|
188
|
+
│ d. If FAIL: stop, investigate, fix │
|
|
189
|
+
│ 3. Update chunk documentation │
|
|
190
|
+
│ 4. Mark CHUNK-Pn as IMPLEMENTED │
|
|
191
|
+
│ 5. Update research CHUNK-Rn status to COMPLETE │
|
|
192
|
+
│ 6. Context reset if >35% utilization │
|
|
193
|
+
│ 7. Proceed to CHUNK-P(n+1) │
|
|
194
|
+
│ END LOOP │
|
|
195
|
+
│ Run full test suite │
|
|
196
|
+
│ Archive plan and research documents │
|
|
197
|
+
└─────────────────────────────────────────────────────────┘
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
### Inter-Phase Awareness
|
|
201
|
+
**RPI-Implement KNOWS that:**
|
|
202
|
+
- RPI-Plan structured chunks for atomic implementation
|
|
203
|
+
- Each CHUNK-Pn contains a complete, ordered todolist
|
|
204
|
+
- Chunk dependencies dictate execution order
|
|
205
|
+
- Marking chunks updates both plan and research documents
|
|
206
|
+
|
|
207
|
+
### Context Budget
|
|
208
|
+
- Plan: 15k tokens
|
|
209
|
+
- Active code: 30k tokens
|
|
210
|
+
- Test results: 15k tokens
|
|
211
|
+
- Total: 60k tokens (30%)
|
|
212
|
+
|
|
213
|
+
### Context Reset (Every 3 Chunks or 35% Utilization)
|
|
214
|
+
1. Update progress checklist
|
|
215
|
+
2. Re-read plan document
|
|
216
|
+
3. Verify scope alignment
|
|
217
|
+
4. Compact if >35% utilization
|
|
218
|
+
|
|
219
|
+
### Exit Criteria
|
|
220
|
+
- [ ] **All plan chunks marked as IMPLEMENTED**
|
|
221
|
+
- [ ] **All research chunks marked as COMPLETE**
|
|
222
|
+
- [ ] All tests passing
|
|
223
|
+
- [ ] Documentation updated per chunk
|
|
224
|
+
- [ ] Changes committed
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Inter-Phase Communication Protocol
|
|
229
|
+
|
|
230
|
+
The key innovation of the enhanced RPI workflow is **inter-phase awareness**. Each phase produces output specifically formatted for the next phase's consumption.
|
|
231
|
+
|
|
232
|
+
### Research → Plan Communication
|
|
233
|
+
```
|
|
234
|
+
CHUNK_MANIFEST:
|
|
235
|
+
├── CHUNK-R1: (status, files, dependencies, ready_for_planning)
|
|
236
|
+
├── CHUNK-R2: (status, files, dependencies, ready_for_planning)
|
|
237
|
+
└── CHUNK-Rn: ...
|
|
238
|
+
|
|
239
|
+
INTER_PHASE_CONTRACT:
|
|
240
|
+
├── expected_consumer: "rpi-plan"
|
|
241
|
+
├── chunk_processing_order: "sequential"
|
|
242
|
+
├── mark_as_planned_when: "chunk_todolist_created"
|
|
243
|
+
└── required_output: "CHUNK-Pn per CHUNK-Rn"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
### Plan → Implement Communication
|
|
247
|
+
```
|
|
248
|
+
CHUNK_MANIFEST:
|
|
249
|
+
├── CHUNK-P1: (todolist, tests, rollback, dependencies)
|
|
250
|
+
├── CHUNK-P2: (todolist, tests, rollback, dependencies)
|
|
251
|
+
└── CHUNK-Pn: ...
|
|
252
|
+
|
|
253
|
+
INTER_PHASE_CONTRACT:
|
|
254
|
+
├── expected_consumer: "rpi-implement"
|
|
255
|
+
├── chunk_processing_order: "dependency-ordered"
|
|
256
|
+
├── mark_as_implemented_when: "all_todos_complete"
|
|
257
|
+
└── update_research_status: true
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
---
|
|
261
|
+
|
|
262
|
+
## Error Recovery Protocol
|
|
263
|
+
|
|
264
|
+
| Error Type | Response |
|
|
265
|
+
|------------|----------|
|
|
266
|
+
| Syntax Error | STOP. Fix immediately in same session. |
|
|
267
|
+
| Import Error | Check file paths, verify imports. |
|
|
268
|
+
| Runtime Error | Create research subtask before fixing. |
|
|
269
|
+
| Test Failure | Do NOT add more code. Investigate first. |
|
|
270
|
+
| 3+ Failures | STOP. Compact context. Start new session. |
|
|
271
|
+
| **Chunk Failure** | Mark chunk as BLOCKED, proceed to independent chunks, revisit later. |
|
|
272
|
+
|
|
273
|
+
---
|
|
274
|
+
|
|
275
|
+
## Context Management
|
|
276
|
+
|
|
277
|
+
### Compaction Triggers
|
|
278
|
+
- After 5+ file reads without tool use
|
|
279
|
+
- Error loop (3+ failed attempts)
|
|
280
|
+
- Session > 1 hour
|
|
281
|
+
- Context > 35% utilization
|
|
282
|
+
- **After every 3 chunks processed**
|
|
283
|
+
|
|
284
|
+
### Compaction Actions
|
|
285
|
+
1. Save progress to SESSION_HANDOFF.md
|
|
286
|
+
2. Archive tool results
|
|
287
|
+
3. Keep only essential context
|
|
288
|
+
4. Continue or start fresh session
|
|
289
|
+
5. **Preserve chunk manifest with current status**
|
|
290
|
+
|
|
291
|
+
---
|
|
292
|
+
|
|
293
|
+
## Key Principles
|
|
294
|
+
|
|
295
|
+
1. **<40% Context Rule:** Performance degrades beyond 40% context utilization
|
|
296
|
+
2. **Parallel Sub-Agents:** Use 3-5 parallel Explore agents for context isolation
|
|
297
|
+
3. **Chunk-Based Processing:** All phases produce and consume chunk-structured data
|
|
298
|
+
4. **Inter-Phase Awareness:** Each phase knows how the next phase reads its output
|
|
299
|
+
5. **Atomic Changes:** Small, testable, reversible modifications per todo item
|
|
300
|
+
6. **Loop-Based Completion:** Process chunks in loops, marking progress explicitly
|
|
301
|
+
7. **Bidirectional Status Updates:** Implement updates plan AND research status
|
|
302
|
+
|
|
303
|
+
---
|
|
304
|
+
|
|
305
|
+
## Quick Reference: Chunk Status Flow
|
|
306
|
+
|
|
307
|
+
```
|
|
308
|
+
RESEARCH CHUNKS PLAN CHUNKS
|
|
309
|
+
┌─────────────────┐ ┌─────────────────┐
|
|
310
|
+
│ CHUNK-R1 │ │ CHUNK-P1 │
|
|
311
|
+
│ Status: FOUND │────────────│ Status: READY │
|
|
312
|
+
│ → COMPLETE │ │ → IMPLEMENTING │
|
|
313
|
+
│ → PLANNED │←───────────│ → IMPLEMENTED │
|
|
314
|
+
│ → IMPLEMENTED │←───────────│ → COMPLETE │
|
|
315
|
+
└─────────────────┘ └─────────────────┘
|
|
316
|
+
```
|
|
317
|
+
|
|
318
|
+
**Status Transitions:**
|
|
319
|
+
- Research: `FOUND` → `COMPLETE` → `PLANNED` → `IMPLEMENTED`
|
|
320
|
+
- Plan: `DRAFT` → `READY` → `IMPLEMENTING` → `IMPLEMENTED` → `COMPLETE`
|
|
321
|
+
|
|
322
|
+
---
|
|
323
|
+
|
|
324
|
+
**Version:** 2.0 (Enhanced with Parallel Agents & Chunked Todolists)
|
|
325
|
+
**Status:** TEMPLATE
|