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.
Files changed (153) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +331 -294
  3. package/bin/create-ai-context.js +1507 -775
  4. package/lib/adapters/aider.js +131 -131
  5. package/lib/adapters/antigravity.js +205 -205
  6. package/lib/adapters/claude.js +397 -397
  7. package/lib/adapters/cline.js +125 -125
  8. package/lib/adapters/continue.js +138 -138
  9. package/lib/adapters/copilot.js +131 -131
  10. package/lib/adapters/index.js +78 -78
  11. package/lib/adapters/windsurf.js +138 -138
  12. package/lib/ai-context-generator.js +234 -234
  13. package/lib/ai-orchestrator.js +432 -432
  14. package/lib/call-tracer.js +444 -444
  15. package/lib/content-preservation.js +243 -243
  16. package/lib/cross-tool-sync/file-watcher.js +274 -274
  17. package/lib/cross-tool-sync/index.js +41 -40
  18. package/lib/cross-tool-sync/sync-manager.js +540 -512
  19. package/lib/cross-tool-sync/sync-service.js +297 -297
  20. package/lib/detector.js +726 -726
  21. package/lib/doc-discovery.js +741 -741
  22. package/lib/drift-checker.js +920 -920
  23. package/lib/environment-detector.js +239 -239
  24. package/lib/index.js +399 -399
  25. package/lib/install-hooks.js +82 -82
  26. package/lib/installer.js +419 -419
  27. package/lib/migrate.js +328 -328
  28. package/lib/placeholder.js +632 -632
  29. package/lib/prompts.js +341 -341
  30. package/lib/smart-merge.js +540 -540
  31. package/lib/spinner.js +60 -60
  32. package/lib/static-analyzer.js +729 -729
  33. package/lib/template-coordination.js +148 -148
  34. package/lib/template-populator.js +843 -843
  35. package/lib/template-renderer.js +392 -392
  36. package/lib/utils/fs-wrapper.js +79 -79
  37. package/lib/utils/path-utils.js +60 -60
  38. package/lib/validate.js +155 -155
  39. package/package.json +1 -1
  40. package/templates/AI_CONTEXT.md.template +245 -245
  41. package/templates/base/README.md +260 -257
  42. package/templates/base/RPI_WORKFLOW_PLAN.md +325 -320
  43. package/templates/base/agents/api-developer.md +76 -76
  44. package/templates/base/agents/context-engineer.md +525 -525
  45. package/templates/base/agents/core-architect.md +76 -76
  46. package/templates/base/agents/database-ops.md +76 -76
  47. package/templates/base/agents/deployment-ops.md +76 -76
  48. package/templates/base/agents/integration-hub.md +76 -76
  49. package/templates/base/analytics/README.md +114 -114
  50. package/templates/base/automation/config.json +58 -58
  51. package/templates/base/automation/generators/code-mapper.js +308 -308
  52. package/templates/base/automation/generators/index-builder.js +321 -321
  53. package/templates/base/automation/hooks/post-commit.sh +83 -83
  54. package/templates/base/automation/hooks/pre-commit.sh +103 -103
  55. package/templates/base/ci-templates/README.md +108 -108
  56. package/templates/base/ci-templates/github-actions/context-check.yml +144 -144
  57. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -105
  58. package/templates/base/commands/analytics.md +238 -238
  59. package/templates/base/commands/auto-sync.md +172 -172
  60. package/templates/base/commands/collab.md +194 -194
  61. package/templates/base/commands/context-optimize.md +226 -0
  62. package/templates/base/commands/help.md +485 -450
  63. package/templates/base/commands/rpi-implement.md +164 -115
  64. package/templates/base/commands/rpi-plan.md +147 -93
  65. package/templates/base/commands/rpi-research.md +145 -88
  66. package/templates/base/commands/session-resume.md +144 -144
  67. package/templates/base/commands/session-save.md +112 -112
  68. package/templates/base/commands/validate-all.md +77 -77
  69. package/templates/base/commands/verify-docs-current.md +86 -86
  70. package/templates/base/config/base.json +57 -57
  71. package/templates/base/config/environments/development.json +13 -13
  72. package/templates/base/config/environments/production.json +17 -17
  73. package/templates/base/config/environments/staging.json +13 -13
  74. package/templates/base/config/local.json.example +21 -21
  75. package/templates/base/context/.meta/generated-at.json +18 -18
  76. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -156
  77. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -94
  78. package/templates/base/context/FILE_OWNERSHIP.md +57 -57
  79. package/templates/base/context/INTEGRATION_POINTS.md +92 -92
  80. package/templates/base/context/KNOWN_GOTCHAS.md +195 -195
  81. package/templates/base/context/TESTING_MAP.md +95 -95
  82. package/templates/base/context/WORKFLOW_INDEX.md +129 -129
  83. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -294
  84. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -255
  85. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -44
  86. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -38
  87. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -39
  88. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -39
  89. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -38
  90. package/templates/base/knowledge/README.md +98 -98
  91. package/templates/base/knowledge/sessions/README.md +88 -88
  92. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -150
  93. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -144
  94. package/templates/base/knowledge/shared/decisions/README.md +49 -49
  95. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -123
  96. package/templates/base/knowledge/shared/patterns/README.md +62 -62
  97. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -120
  98. package/templates/base/plans/PLAN_TEMPLATE.md +316 -250
  99. package/templates/base/research/RESEARCH_TEMPLATE.md +245 -153
  100. package/templates/base/schemas/agent.schema.json +141 -141
  101. package/templates/base/schemas/anchors.schema.json +54 -54
  102. package/templates/base/schemas/automation.schema.json +93 -93
  103. package/templates/base/schemas/command.schema.json +134 -134
  104. package/templates/base/schemas/hashes.schema.json +40 -40
  105. package/templates/base/schemas/manifest.schema.json +117 -117
  106. package/templates/base/schemas/plan.schema.json +136 -136
  107. package/templates/base/schemas/research.schema.json +115 -115
  108. package/templates/base/schemas/roles.schema.json +34 -34
  109. package/templates/base/schemas/session.schema.json +77 -77
  110. package/templates/base/schemas/settings.schema.json +244 -244
  111. package/templates/base/schemas/staleness.schema.json +53 -53
  112. package/templates/base/schemas/team-config.schema.json +42 -42
  113. package/templates/base/schemas/workflow.schema.json +126 -126
  114. package/templates/base/session/checkpoints/.gitkeep +2 -2
  115. package/templates/base/session/current/state.json +20 -20
  116. package/templates/base/session/history/.gitkeep +2 -2
  117. package/templates/base/settings.json +3 -3
  118. package/templates/base/standards/COMPATIBILITY.md +219 -219
  119. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -280
  120. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -211
  121. package/templates/base/standards/README.md +66 -66
  122. package/templates/base/sync/anchors.json +6 -6
  123. package/templates/base/sync/hashes.json +6 -6
  124. package/templates/base/sync/staleness.json +10 -10
  125. package/templates/base/team/README.md +168 -168
  126. package/templates/base/team/config.json +79 -79
  127. package/templates/base/team/roles.json +145 -145
  128. package/templates/base/tools/bin/claude-context.js +151 -151
  129. package/templates/base/tools/lib/anchor-resolver.js +276 -276
  130. package/templates/base/tools/lib/config-loader.js +363 -363
  131. package/templates/base/tools/lib/detector.js +350 -350
  132. package/templates/base/tools/lib/diagnose.js +206 -206
  133. package/templates/base/tools/lib/drift-detector.js +373 -373
  134. package/templates/base/tools/lib/errors.js +199 -199
  135. package/templates/base/tools/lib/index.js +36 -36
  136. package/templates/base/tools/lib/init.js +192 -192
  137. package/templates/base/tools/lib/logger.js +230 -230
  138. package/templates/base/tools/lib/placeholder.js +201 -201
  139. package/templates/base/tools/lib/session-manager.js +354 -354
  140. package/templates/base/tools/lib/validate.js +521 -521
  141. package/templates/base/tools/package.json +49 -49
  142. package/templates/handlebars/aider-config.hbs +146 -80
  143. package/templates/handlebars/antigravity.hbs +377 -377
  144. package/templates/handlebars/claude.hbs +183 -183
  145. package/templates/handlebars/cline.hbs +62 -62
  146. package/templates/handlebars/continue-config.hbs +116 -116
  147. package/templates/handlebars/copilot.hbs +130 -130
  148. package/templates/handlebars/partials/gotcha-list.hbs +11 -11
  149. package/templates/handlebars/partials/header.hbs +3 -3
  150. package/templates/handlebars/partials/workflow-summary.hbs +16 -16
  151. package/templates/handlebars/windsurf-rules.hbs +69 -69
  152. package/templates/hooks/post-commit.hbs +28 -29
  153. package/templates/hooks/pre-commit.hbs +46 -46
@@ -1,115 +1,164 @@
1
- ---
2
- name: rpi-implement
3
- version: "1.0.0"
4
- description: "RPI Implement Phase: Execute plan with atomic changes and continuous testing"
5
- category: "rpi-orchestration"
6
- rpi_phase: "implement"
7
- context_budget_estimate: "60K tokens"
8
- typical_context_usage: "30%"
9
- prerequisites:
10
- - "Plan document exists in .ai-context/plans/active/"
11
- - "Plan has been approved by human"
12
- - "Git branch is clean"
13
- - "All tests currently passing"
14
- outputs:
15
- - "Implemented feature/fix"
16
- - "Updated documentation with new line numbers"
17
- - "Commits with descriptive messages"
18
- - "Archived plan in .ai-context/plans/completed/"
19
- next_commands: ["/verify-docs-current", "/validate-all"]
20
- related_agents: ["core-architect", "database-ops", "api-developer", "deployment-ops"]
21
- examples:
22
- - command: "/rpi-implement user-authentication"
23
- description: "Execute the approved authentication plan"
24
- - command: "/rpi-implement payment-bug-fix"
25
- description: "Implement the approved bug fix"
26
- exit_criteria:
27
- - "All plan steps completed"
28
- - "All tests passing"
29
- - "Documentation updated"
30
- - "Changes committed"
31
- - "Plan archived to completed/"
32
- ---
33
-
34
- # RPI Implement Phase
35
-
36
- **Purpose:** Execute implementation plan atomically
37
-
38
- **Syntax:** `/rpi-implement [feature-name]`
39
-
40
- **Prerequisites:** Plan must be approved in `.ai-context/plans/active/`
41
-
42
- ---
43
-
44
- ## Golden Rule
45
-
46
- ```
47
- ONE CHANGE → ONE TEST → ONE COMMIT
48
- ```
49
-
50
- ---
51
-
52
- ## Execution Steps
53
-
54
- ### Step 1: Load Plan
55
- Read `.ai-context/plans/active/[feature]_plan.md`
56
-
57
- ### Step 2: Verify Preconditions
58
- - [ ] Plan is approved
59
- - [ ] Branch is clean
60
- - [ ] Tests pass before changes
61
-
62
- ### Step 3: Execute Each Step
63
- For each step in plan:
64
- 1. Make the single, atomic change
65
- 2. Run step-specific test
66
- 3. If pass: commit with descriptive message
67
- 4. If fail: stop, investigate, do not proceed
68
-
69
- ### Step 4: Context Reset (Every 3 Steps)
70
- 1. Update progress in plan
71
- 2. Re-read plan document
72
- 3. Verify scope alignment
73
- 4. Compact if >35% context usage
74
-
75
- ### Step 5: Run Full Test Suite
76
- After all steps complete
77
-
78
- ### Step 6: Update Documentation (MANDATORY)
79
- 1. Check CODE_TO_WORKFLOW_MAP.md
80
- 2. Update affected workflow files
81
- 3. Update line numbers
82
- 4. Run /verify-docs-current
83
-
84
- ### Step 7: Final Commit
85
- Documentation updates
86
-
87
- ### Step 8: Archive Plan
88
- Move to `.ai-context/plans/completed/`
89
-
90
- ---
91
-
92
- ## Error Recovery
93
-
94
- | Error Type | Action |
95
- |------------|--------|
96
- | Syntax Error | Fix immediately |
97
- | Test Failure | Stop, investigate |
98
- | 3+ Failures | Compact, start new session |
99
-
100
- ---
101
-
102
- ## Context Budget
103
-
104
- - Plan: 15k tokens
105
- - Active code: 30k tokens
106
- - Test results: 15k tokens
107
- - Total: 60k tokens (30%)
108
-
109
- ---
110
-
111
- ## Output
112
-
113
- - Completed feature/fix
114
- - Updated documentation
115
- - Plan archived to completed/
1
+ ---
2
+ name: rpi-implement
3
+ version: "2.0.0"
4
+ description: "RPI Implement Phase: Execute chunk-based todolists with atomic changes and continuous testing"
5
+ category: "rpi-orchestration"
6
+ rpi_phase: "implement"
7
+ context_budget_estimate: "60K tokens"
8
+ typical_context_usage: "30%"
9
+ chunk_input: true
10
+ loop_based: true
11
+ inter_phase_aware: true
12
+ prerequisites:
13
+ - "Plan document exists in .ai-context/plans/active/"
14
+ - "Plan has been approved by human"
15
+ - "Plan contains chunk manifest with chunk-todolists"
16
+ - "Git branch is clean"
17
+ - "All tests currently passing"
18
+ outputs:
19
+ - "Implemented feature/fix (chunk by chunk)"
20
+ - "Updated documentation with new line numbers"
21
+ - "Commits with descriptive messages per todo"
22
+ - "All plan chunks marked as IMPLEMENTED"
23
+ - "All research chunks marked as IMPLEMENTED"
24
+ - "Archived plan in .ai-context/plans/completed/"
25
+ - "Archived research in .ai-context/research/completed/"
26
+ next_commands: ["/verify-docs-current", "/validate-all"]
27
+ related_agents: ["core-architect", "database-ops", "api-developer", "deployment-ops"]
28
+ examples:
29
+ - command: "/rpi-implement user-authentication"
30
+ description: "Execute approved authentication plan chunk by chunk"
31
+ - command: "/rpi-implement payment-bug-fix"
32
+ description: "Implement approved bug fix processing each chunk's todolist"
33
+ exit_criteria:
34
+ - "All chunk-todolists completed"
35
+ - "All plan chunks marked as IMPLEMENTED"
36
+ - "All research chunks marked as IMPLEMENTED"
37
+ - "All tests passing"
38
+ - "Documentation updated per chunk"
39
+ - "Changes committed per todo"
40
+ - "Plan archived to completed/"
41
+ - "Research archived to completed/"
42
+ ---
43
+
44
+ # RPI Implement Phase (Enhanced with Chunk-Based Execution)
45
+
46
+ **Purpose:** Execute implementation plan chunk by chunk, processing each chunk's todolist atomically
47
+
48
+ **Syntax:** `/rpi-implement [feature-name]`
49
+
50
+ **Prerequisites:** Plan must be approved in `.ai-context/plans/active/` with chunk manifest
51
+
52
+ ---
53
+
54
+ ## Key Innovation: Inter-Phase Awareness
55
+
56
+ RPI-Implement **KNOWS**:
57
+ - RPI-Plan structured chunks for atomic implementation
58
+ - Each CHUNK-Pn contains a complete, ordered todolist
59
+ - Chunk dependencies dictate execution order
60
+ - Marking chunks complete updates both plan AND research documents
61
+ - Context reset is needed after every 3 chunks or 35% utilization
62
+
63
+ ---
64
+
65
+ ## Golden Rules
66
+
67
+ ```
68
+ ONE CHUNK → COMPLETE TODOLIST → MARK DONE → NEXT CHUNK
69
+ ONE TODO ONE CHANGE ONE TEST → ONE COMMIT
70
+ ```
71
+
72
+ ---
73
+
74
+ ## Chunk-Based Implementation Loop
75
+
76
+ ```
77
+ ┌─────────────────────────────────────────────────────────┐
78
+ RPI-IMPLEMENT CHUNK PROCESSING LOOP │
79
+ ├─────────────────────────────────────────────────────────┤
80
+ FOR each CHUNK-Pn in dependency_order: │
81
+ │ 1. Load CHUNK-Pn todolist │
82
+ │ 2. FOR each TODO in CHUNK-Pn: │
83
+ │ a. Make atomic change │
84
+ │ b. Run specified test │
85
+ │ c. If PASS: commit, mark TODO ✅ │
86
+ │ d. If FAIL: STOP, investigate, fix │
87
+ │ 3. Mark CHUNK-Pn as IMPLEMENTED │
88
+ │ 4. Update research CHUNK-Rn to IMPLEMENTED │
89
+ │ 5. Context reset if needed │
90
+ │ 6. Proceed to next chunk │
91
+ │ END LOOP │
92
+ └─────────────────────────────────────────────────────────┘
93
+ ```
94
+
95
+ ---
96
+
97
+ ## Execution Steps
98
+
99
+ ### Step 1: Load Plan
100
+ Read `.ai-context/plans/active/[feature]_plan.md` with chunk manifest
101
+
102
+ ### Step 2: Verify Preconditions
103
+ - [ ] Plan is approved
104
+ - [ ] Branch is clean
105
+ - [ ] Tests pass before changes
106
+ - [ ] Chunk manifest is present
107
+
108
+ ### Step 3: Execute Each Chunk (in dependency order)
109
+
110
+ For each CHUNK-Pn:
111
+ 1. Execute each todo atomically (one change → one test → one commit)
112
+ 2. Mark CHUNK-Pn as IMPLEMENTED when all todos complete
113
+ 3. Update CHUNK-Rn status in research to IMPLEMENTED
114
+
115
+ ### Step 4: Context Reset (Every 3 Chunks or 35% Utilization)
116
+ 1. Update progress in plan
117
+ 2. Re-read plan document
118
+ 3. Verify scope alignment
119
+ 4. Compact if >35% context usage
120
+
121
+ ### Step 5: Run Full Test Suite
122
+ After all chunks complete
123
+
124
+ ### Step 6: Update Documentation (MANDATORY)
125
+ 1. Check CODE_TO_WORKFLOW_MAP.md
126
+ 2. Update affected workflow files
127
+ 3. Update line numbers
128
+ 4. Run /verify-docs-current
129
+
130
+ ### Step 7: Final Commit
131
+ Documentation updates
132
+
133
+ ### Step 8: Archive Documents
134
+ - Move plan to `.ai-context/plans/completed/`
135
+ - Move research to `.ai-context/research/completed/`
136
+
137
+ ---
138
+
139
+ ## Error Recovery
140
+
141
+ | Error Type | Action |
142
+ |------------|--------|
143
+ | Syntax Error | Fix immediately in same todo |
144
+ | Test Failure | Stop, investigate, fix before proceeding |
145
+ | 3+ Failures in chunk | Mark chunk BLOCKED, try next independent chunk |
146
+ | 3+ Chunks blocked | STOP. Compact context. Start new session. |
147
+
148
+ ---
149
+
150
+ ## Context Budget
151
+
152
+ - Plan: 15k tokens
153
+ - Active code (per chunk): ~10k tokens
154
+ - Test results (per chunk): ~5k tokens
155
+ - Max active (3 chunks): ~45k tokens (22.5%)
156
+
157
+ ---
158
+
159
+ ## Output
160
+
161
+ - Completed feature/fix (implemented chunk by chunk)
162
+ - All chunks marked IMPLEMENTED (plan + research)
163
+ - Updated documentation per chunk
164
+ - Documents archived to completed/
@@ -1,93 +1,147 @@
1
- ---
2
- name: rpi-plan
3
- version: "1.0.0"
4
- description: "RPI Plan Phase: Create implementation blueprint with file:line precision"
5
- category: "rpi-orchestration"
6
- rpi_phase: "plan"
7
- context_budget_estimate: "35K tokens"
8
- typical_context_usage: "17%"
9
- prerequisites:
10
- - "Research document exists in .ai-context/research/active/"
11
- - "/rpi-research phase completed"
12
- outputs:
13
- - "Plan document in .ai-context/plans/active/[name]_plan.md"
14
- - "Modification table with file:line references"
15
- - "Step-by-step implementation guide"
16
- - "Test strategy"
17
- - "Rollback plan"
18
- next_commands: ["/rpi-implement"]
19
- related_agents: ["core-architect", "database-ops", "api-developer"]
20
- examples:
21
- - command: "/rpi-plan user-authentication"
22
- description: "Create implementation plan for auth feature"
23
- - command: "/rpi-plan payment-bug-fix"
24
- description: "Plan the fix for payment issue"
25
- exit_criteria:
26
- - "Plan document created in .ai-context/plans/active/"
27
- - "All file modifications listed with line numbers"
28
- - "Step-by-step implementation defined"
29
- - "Test strategy documented"
30
- - "Human approval obtained"
31
- ---
32
-
33
- # RPI Plan Phase
34
-
35
- **Purpose:** Create detailed implementation blueprint
36
-
37
- **Syntax:** `/rpi-plan [feature-name]`
38
-
39
- **Prerequisites:** Research document must exist in `.ai-context/research/active/`
40
-
41
- ---
42
-
43
- ## Execution Steps
44
-
45
- ### Step 1: Load Research Document
46
- Read `.ai-context/research/active/[feature]_research.md`
47
-
48
- ### Step 2: Define Scope
49
- - In scope (explicit list)
50
- - Out of scope (what we're NOT touching)
51
-
52
- ### Step 3: List File Modifications
53
- | File | Lines | Change | Risk |
54
- |------|-------|--------|------|
55
- Each modification with exact line numbers
56
-
57
- ### Step 4: Create Step-by-Step Plan
58
- For each step:
59
- - Current code
60
- - Proposed change
61
- - Test to run after
62
-
63
- ### Step 5: Define Test Strategy
64
- - Unit tests required
65
- - Integration tests required
66
- - E2E tests if applicable
67
-
68
- ### Step 6: Document Rollback Plan
69
- - How to revert
70
- - Safe commit to return to
71
-
72
- ### Step 7: Request Human Approval
73
- Plan requires human review before implementation
74
-
75
- ---
76
-
77
- ## Output
78
-
79
- Plan document in `.ai-context/plans/active/[feature]_plan.md`
80
-
81
- ---
82
-
83
- ## Context Budget
84
-
85
- - Research doc: 20k tokens
86
- - Plan creation: 15k tokens
87
- - Total: 35k tokens (17%)
88
-
89
- ---
90
-
91
- ## Next Step
92
-
93
- After human approval: `/rpi-implement [feature-name]`
1
+ ---
2
+ name: rpi-plan
3
+ version: "2.0.0"
4
+ description: "RPI Plan Phase: Create chunk-based implementation blueprint with todolists for rpi-implement consumption"
5
+ category: "rpi-orchestration"
6
+ rpi_phase: "plan"
7
+ context_budget_estimate: "35K tokens"
8
+ typical_context_usage: "17%"
9
+ chunk_input: true
10
+ chunk_output: true
11
+ inter_phase_aware: true
12
+ prerequisites:
13
+ - "Research document exists in .ai-context/research/active/"
14
+ - "/rpi-research phase completed with chunk manifest"
15
+ outputs:
16
+ - "Plan document in .ai-context/plans/active/[name]_plan.md"
17
+ - "Chunk-based todolists (CHUNK-Pn per CHUNK-Rn)"
18
+ - "Modification table with file:line references per chunk"
19
+ - "Step-by-step implementation guide per chunk"
20
+ - "Test strategy per chunk"
21
+ - "Rollback plan per chunk"
22
+ - "Inter-phase contract for rpi-implement"
23
+ next_commands: ["/rpi-implement"]
24
+ related_agents: ["core-architect", "database-ops", "api-developer"]
25
+ examples:
26
+ - command: "/rpi-plan user-authentication"
27
+ description: "Create chunk-based implementation plan for auth feature"
28
+ - command: "/rpi-plan payment-bug-fix"
29
+ description: "Plan the fix with chunk-todolists for payment issue"
30
+ exit_criteria:
31
+ - "Plan document created in .ai-context/plans/active/"
32
+ - "Chunk manifest created with CHUNK-Pn per CHUNK-Rn"
33
+ - "All research chunks marked as PLANNED"
34
+ - "All file modifications listed with line numbers per chunk"
35
+ - "Chunk-todolists defined with atomic actions"
36
+ - "Test strategy documented per chunk"
37
+ - "Human approval obtained"
38
+ - "Inter-phase contract documented for rpi-implement"
39
+ ---
40
+
41
+ # RPI Plan Phase (Enhanced with Chunk-Based Todolists)
42
+
43
+ **Purpose:** Create detailed implementation blueprint using chunk-based todolists that RPI-Implement will process
44
+
45
+ **Syntax:** `/rpi-plan [feature-name]`
46
+
47
+ **Prerequisites:** Research document must exist in `.ai-context/research/active/` with chunk manifest
48
+
49
+ ---
50
+
51
+ ## Key Innovation: Inter-Phase Awareness
52
+
53
+ RPI-Plan **KNOWS**:
54
+ - RPI-Research structured chunks specifically for sequential processing
55
+ - RPI-Implement will read each CHUNK-Pn as an atomic implementation unit
56
+ - Each CHUNK-Pn todolist must be independently executable
57
+ - Chunk dependencies must be explicit for proper execution ordering
58
+
59
+ ---
60
+
61
+ ## Chunk Processing Loop
62
+
63
+ ```
64
+ ┌─────────────────────────────────────────────────────────┐
65
+ │ RPI-PLAN CHUNK PROCESSING LOOP │
66
+ ├─────────────────────────────────────────────────────────┤
67
+ │ FOR each research_chunk (CHUNK-R1 to CHUNK-RN): │
68
+ │ 1. Read research_chunk content │
69
+ │ 2. Create corresponding CHUNK-Pn todolist: │
70
+ - Define atomic action items │
71
+ │ - Specify file:line for each action │
72
+ │ - Assign test for each action │
73
+ │ - Document chunk-specific rollback │
74
+ │ 3. Mark research_chunk status as PLANNED │
75
+ │ 4. Define CHUNK-Pn dependencies │
76
+ │ 5. Proceed to next research chunk │
77
+ END LOOP │
78
+ └─────────────────────────────────────────────────────────┘
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Execution Steps
84
+
85
+ ### Step 1: Load Research Document
86
+ Read `.ai-context/research/active/[feature]_research.md` and extract chunk manifest
87
+
88
+ ### Step 2: Process Each Research Chunk
89
+
90
+ For each CHUNK-Rn:
91
+ 1. Analyze chunk content (files, deps, call chains)
92
+ 2. Create CHUNK-Pn todolist with atomic actions
93
+ 3. Mark CHUNK-Rn status as PLANNED
94
+ 4. Document chunk dependencies
95
+
96
+ ### Step 3: Define Scope
97
+ - In scope (explicit list per chunk)
98
+ - Out of scope (what we're NOT touching)
99
+
100
+ ### Step 4: Create Chunk Dependency Graph
101
+ ```
102
+ CHUNK-P1 ───→ CHUNK-P2 ───→ CHUNK-P3
103
+ ```
104
+
105
+ ### Step 5: Plan Testing Strategy (Per Chunk)
106
+ - Tests to run after each todo
107
+ - Tests to run after chunk completion
108
+
109
+ ### Step 6: Document Rollback Plan (Per Chunk)
110
+ - Per-chunk rollback commands
111
+ - Safe commits per chunk
112
+
113
+ ### Step 7: Finalize Inter-Phase Contract
114
+ ```
115
+ EXPECTED_CONSUMER: rpi-implement
116
+ CHUNK_PROCESSING_ORDER: dependency-ordered
117
+ MARK_AS_IMPLEMENTED_WHEN: all chunk todos complete
118
+ UPDATE_RESEARCH_STATUS: true
119
+ ```
120
+
121
+ ### Step 8: Request Human Approval
122
+ Plan requires human review before implementation
123
+
124
+ ---
125
+
126
+ ## Output
127
+
128
+ Plan document in `.ai-context/plans/active/[feature]_plan.md` with:
129
+ - Chunk manifest
130
+ - Per-chunk todolists
131
+ - Inter-phase contract for RPI-Implement
132
+
133
+ ---
134
+
135
+ ## Context Budget
136
+
137
+ - Research doc: 20k tokens
138
+ - Plan creation: 15k tokens
139
+ - Total: 35k tokens (17%)
140
+
141
+ ---
142
+
143
+ ## Next Step
144
+
145
+ After human approval: `/rpi-implement [feature-name]`
146
+
147
+ RPI-Implement will process chunks in dependency order, executing todos atomically