k0ntext 3.0.0

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 (239) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +623 -0
  3. package/bin/k0ntext.js +12 -0
  4. package/dist/agents/cleanup-agent.d.ts +39 -0
  5. package/dist/agents/cleanup-agent.d.ts.map +1 -0
  6. package/dist/agents/cleanup-agent.js +56 -0
  7. package/dist/agents/cleanup-agent.js.map +1 -0
  8. package/dist/agents/performance-agent.d.ts +37 -0
  9. package/dist/agents/performance-agent.d.ts.map +1 -0
  10. package/dist/agents/performance-agent.js +91 -0
  11. package/dist/agents/performance-agent.js.map +1 -0
  12. package/dist/analyzer/index.d.ts +5 -0
  13. package/dist/analyzer/index.d.ts.map +1 -0
  14. package/dist/analyzer/index.js +5 -0
  15. package/dist/analyzer/index.js.map +1 -0
  16. package/dist/analyzer/intelligent-analyzer.d.ts +111 -0
  17. package/dist/analyzer/intelligent-analyzer.d.ts.map +1 -0
  18. package/dist/analyzer/intelligent-analyzer.js +537 -0
  19. package/dist/analyzer/intelligent-analyzer.js.map +1 -0
  20. package/dist/cli/commands/cleanup.d.ts +3 -0
  21. package/dist/cli/commands/cleanup.d.ts.map +1 -0
  22. package/dist/cli/commands/cleanup.js +24 -0
  23. package/dist/cli/commands/cleanup.js.map +1 -0
  24. package/dist/cli/commands/export.d.ts +9 -0
  25. package/dist/cli/commands/export.d.ts.map +1 -0
  26. package/dist/cli/commands/export.js +72 -0
  27. package/dist/cli/commands/export.js.map +1 -0
  28. package/dist/cli/commands/import.d.ts +9 -0
  29. package/dist/cli/commands/import.d.ts.map +1 -0
  30. package/dist/cli/commands/import.js +62 -0
  31. package/dist/cli/commands/import.js.map +1 -0
  32. package/dist/cli/commands/performance.d.ts +9 -0
  33. package/dist/cli/commands/performance.d.ts.map +1 -0
  34. package/dist/cli/commands/performance.js +36 -0
  35. package/dist/cli/commands/performance.js.map +1 -0
  36. package/dist/cli/commands/validate.d.ts +9 -0
  37. package/dist/cli/commands/validate.d.ts.map +1 -0
  38. package/dist/cli/commands/validate.js +82 -0
  39. package/dist/cli/commands/validate.js.map +1 -0
  40. package/dist/cli/commands/watch.d.ts +9 -0
  41. package/dist/cli/commands/watch.d.ts.map +1 -0
  42. package/dist/cli/commands/watch.js +72 -0
  43. package/dist/cli/commands/watch.js.map +1 -0
  44. package/dist/cli/generate.d.ts +3 -0
  45. package/dist/cli/generate.d.ts.map +1 -0
  46. package/dist/cli/generate.js +194 -0
  47. package/dist/cli/generate.js.map +1 -0
  48. package/dist/cli/index.d.ts +9 -0
  49. package/dist/cli/index.d.ts.map +1 -0
  50. package/dist/cli/index.js +448 -0
  51. package/dist/cli/index.js.map +1 -0
  52. package/dist/cli/sync.d.ts +26 -0
  53. package/dist/cli/sync.d.ts.map +1 -0
  54. package/dist/cli/sync.js +163 -0
  55. package/dist/cli/sync.js.map +1 -0
  56. package/dist/config/cleanup-config.d.ts +26 -0
  57. package/dist/config/cleanup-config.d.ts.map +1 -0
  58. package/dist/config/cleanup-config.js +21 -0
  59. package/dist/config/cleanup-config.js.map +1 -0
  60. package/dist/db/client.d.ts +284 -0
  61. package/dist/db/client.d.ts.map +1 -0
  62. package/dist/db/client.js +688 -0
  63. package/dist/db/client.js.map +1 -0
  64. package/dist/db/index.d.ts +6 -0
  65. package/dist/db/index.d.ts.map +1 -0
  66. package/dist/db/index.js +6 -0
  67. package/dist/db/index.js.map +1 -0
  68. package/dist/db/schema.d.ts +41 -0
  69. package/dist/db/schema.d.ts.map +1 -0
  70. package/dist/db/schema.js +226 -0
  71. package/dist/db/schema.js.map +1 -0
  72. package/dist/embeddings/index.d.ts +5 -0
  73. package/dist/embeddings/index.d.ts.map +1 -0
  74. package/dist/embeddings/index.js +5 -0
  75. package/dist/embeddings/index.js.map +1 -0
  76. package/dist/embeddings/openrouter.d.ts +133 -0
  77. package/dist/embeddings/openrouter.d.ts.map +1 -0
  78. package/dist/embeddings/openrouter.js +455 -0
  79. package/dist/embeddings/openrouter.js.map +1 -0
  80. package/dist/index.d.ts +14 -0
  81. package/dist/index.d.ts.map +1 -0
  82. package/dist/index.js +18 -0
  83. package/dist/index.js.map +1 -0
  84. package/dist/mcp.d.ts +29 -0
  85. package/dist/mcp.d.ts.map +1 -0
  86. package/dist/mcp.js +257 -0
  87. package/dist/mcp.js.map +1 -0
  88. package/docs/ARCHIVE/MIGRATE_TO_NEW_REPO.md +222 -0
  89. package/docs/ARCHIVE/MIGRATE_TO_UNIFIED.md +220 -0
  90. package/docs/CLEANUP.md +76 -0
  91. package/docs/MCP_QUICKSTART.md +219 -0
  92. package/docs/QUICKSTART.md +119 -0
  93. package/docs/TROUBLESHOOTING.md +611 -0
  94. package/package.json +100 -0
  95. package/skills/context-optimize/SKILL.md +86 -0
  96. package/skills/implement/SKILL.md +150 -0
  97. package/skills/plan/SKILL.md +143 -0
  98. package/skills/research/SKILL.md +103 -0
  99. package/skills/validate/SKILL.md +62 -0
  100. package/skills/verify-docs/SKILL.md +77 -0
  101. package/src/agents/cleanup-agent.ts +96 -0
  102. package/src/agents/performance-agent.ts +117 -0
  103. package/src/analyzer/index.ts +10 -0
  104. package/src/analyzer/intelligent-analyzer.ts +640 -0
  105. package/src/cli/commands/cleanup.ts +26 -0
  106. package/src/cli/commands/export.ts +82 -0
  107. package/src/cli/commands/import.ts +73 -0
  108. package/src/cli/commands/performance.ts +40 -0
  109. package/src/cli/commands/validate.ts +98 -0
  110. package/src/cli/commands/watch.ts +83 -0
  111. package/src/cli/generate.ts +219 -0
  112. package/src/cli/index.ts +510 -0
  113. package/src/cli/sync.ts +194 -0
  114. package/src/config/cleanup-config.ts +42 -0
  115. package/src/db/client.ts +949 -0
  116. package/src/db/index.ts +19 -0
  117. package/src/db/schema.ts +241 -0
  118. package/src/embeddings/index.ts +11 -0
  119. package/src/embeddings/openrouter.ts +592 -0
  120. package/src/index.ts +57 -0
  121. package/src/mcp.ts +354 -0
  122. package/templates/AI_CONTEXT.md.template +245 -0
  123. package/templates/base/README.md +260 -0
  124. package/templates/base/RPI_WORKFLOW_PLAN.md +325 -0
  125. package/templates/base/agents/api-developer.md +76 -0
  126. package/templates/base/agents/context-engineer.md +525 -0
  127. package/templates/base/agents/core-architect.md +76 -0
  128. package/templates/base/agents/database-ops.md +76 -0
  129. package/templates/base/agents/deployment-ops.md +76 -0
  130. package/templates/base/agents/integration-hub.md +76 -0
  131. package/templates/base/analytics/README.md +114 -0
  132. package/templates/base/automation/config.json +58 -0
  133. package/templates/base/automation/generators/code-mapper.js +308 -0
  134. package/templates/base/automation/generators/index-builder.js +321 -0
  135. package/templates/base/automation/hooks/post-commit.sh +83 -0
  136. package/templates/base/automation/hooks/pre-commit.sh +103 -0
  137. package/templates/base/ci-templates/README.md +108 -0
  138. package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
  139. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
  140. package/templates/base/commands/analytics.md +238 -0
  141. package/templates/base/commands/auto-sync.md +172 -0
  142. package/templates/base/commands/collab.md +194 -0
  143. package/templates/base/commands/context-optimize.md +226 -0
  144. package/templates/base/commands/help.md +485 -0
  145. package/templates/base/commands/rpi-implement.md +164 -0
  146. package/templates/base/commands/rpi-plan.md +147 -0
  147. package/templates/base/commands/rpi-research.md +145 -0
  148. package/templates/base/commands/session-resume.md +144 -0
  149. package/templates/base/commands/session-save.md +112 -0
  150. package/templates/base/commands/validate-all.md +77 -0
  151. package/templates/base/commands/verify-docs-current.md +86 -0
  152. package/templates/base/config/base.json +57 -0
  153. package/templates/base/config/environments/development.json +13 -0
  154. package/templates/base/config/environments/production.json +17 -0
  155. package/templates/base/config/environments/staging.json +13 -0
  156. package/templates/base/config/local.json.example +21 -0
  157. package/templates/base/context/.meta/generated-at.json +18 -0
  158. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
  159. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
  160. package/templates/base/context/FILE_OWNERSHIP.md +57 -0
  161. package/templates/base/context/INTEGRATION_POINTS.md +92 -0
  162. package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
  163. package/templates/base/context/TESTING_MAP.md +95 -0
  164. package/templates/base/context/WORKFLOW_INDEX.md +129 -0
  165. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
  166. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
  167. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
  168. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
  169. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
  170. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
  171. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
  172. package/templates/base/knowledge/README.md +98 -0
  173. package/templates/base/knowledge/sessions/README.md +88 -0
  174. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
  175. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
  176. package/templates/base/knowledge/shared/decisions/README.md +49 -0
  177. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
  178. package/templates/base/knowledge/shared/patterns/README.md +62 -0
  179. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
  180. package/templates/base/plans/PLAN_TEMPLATE.md +316 -0
  181. package/templates/base/plans/active/.gitkeep +0 -0
  182. package/templates/base/plans/completed/.gitkeep +0 -0
  183. package/templates/base/research/RESEARCH_TEMPLATE.md +245 -0
  184. package/templates/base/research/active/.gitkeep +0 -0
  185. package/templates/base/research/completed/.gitkeep +0 -0
  186. package/templates/base/schemas/agent.schema.json +141 -0
  187. package/templates/base/schemas/anchors.schema.json +54 -0
  188. package/templates/base/schemas/automation.schema.json +93 -0
  189. package/templates/base/schemas/command.schema.json +134 -0
  190. package/templates/base/schemas/hashes.schema.json +40 -0
  191. package/templates/base/schemas/manifest.schema.json +117 -0
  192. package/templates/base/schemas/plan.schema.json +136 -0
  193. package/templates/base/schemas/research.schema.json +115 -0
  194. package/templates/base/schemas/roles.schema.json +34 -0
  195. package/templates/base/schemas/session.schema.json +77 -0
  196. package/templates/base/schemas/settings.schema.json +244 -0
  197. package/templates/base/schemas/staleness.schema.json +53 -0
  198. package/templates/base/schemas/team-config.schema.json +42 -0
  199. package/templates/base/schemas/workflow.schema.json +126 -0
  200. package/templates/base/session/checkpoints/.gitkeep +2 -0
  201. package/templates/base/session/current/state.json +20 -0
  202. package/templates/base/session/history/.gitkeep +2 -0
  203. package/templates/base/settings.json +3 -0
  204. package/templates/base/standards/COMPATIBILITY.md +219 -0
  205. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
  206. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
  207. package/templates/base/standards/README.md +66 -0
  208. package/templates/base/sync/anchors.json +6 -0
  209. package/templates/base/sync/hashes.json +6 -0
  210. package/templates/base/sync/staleness.json +10 -0
  211. package/templates/base/team/README.md +168 -0
  212. package/templates/base/team/config.json +79 -0
  213. package/templates/base/team/roles.json +145 -0
  214. package/templates/base/tools/bin/claude-context.js +151 -0
  215. package/templates/base/tools/lib/anchor-resolver.js +276 -0
  216. package/templates/base/tools/lib/config-loader.js +363 -0
  217. package/templates/base/tools/lib/detector.js +350 -0
  218. package/templates/base/tools/lib/diagnose.js +206 -0
  219. package/templates/base/tools/lib/drift-detector.js +373 -0
  220. package/templates/base/tools/lib/errors.js +199 -0
  221. package/templates/base/tools/lib/index.js +36 -0
  222. package/templates/base/tools/lib/init.js +192 -0
  223. package/templates/base/tools/lib/logger.js +230 -0
  224. package/templates/base/tools/lib/placeholder.js +201 -0
  225. package/templates/base/tools/lib/session-manager.js +354 -0
  226. package/templates/base/tools/lib/validate.js +521 -0
  227. package/templates/base/tools/package.json +49 -0
  228. package/templates/handlebars/aider-config.hbs +146 -0
  229. package/templates/handlebars/antigravity.hbs +377 -0
  230. package/templates/handlebars/claude.hbs +183 -0
  231. package/templates/handlebars/cline.hbs +62 -0
  232. package/templates/handlebars/continue-config.hbs +116 -0
  233. package/templates/handlebars/copilot.hbs +130 -0
  234. package/templates/handlebars/partials/gotcha-list.hbs +11 -0
  235. package/templates/handlebars/partials/header.hbs +3 -0
  236. package/templates/handlebars/partials/workflow-summary.hbs +16 -0
  237. package/templates/handlebars/windsurf-rules.hbs +69 -0
  238. package/templates/hooks/post-commit.hbs +28 -0
  239. package/templates/hooks/pre-commit.hbs +46 -0
@@ -0,0 +1,316 @@
1
+ # Implementation Plan: [Feature/Fix Name]
2
+
3
+ **Date:** YYYY-MM-DD
4
+ **Based on:** `.ai-context/research/active/[feature]_research.md`
5
+ **Status:** DRAFT | APPROVED | IMPLEMENTING | COMPLETE
6
+ **Estimated Changes:** X files, ~XXX lines
7
+ **Context Budget:** Target <40% of 200k tokens
8
+ **Total Chunks:** N (from research)
9
+ **Chunk Dependencies:** [See Chunk Dependency Graph]
10
+
11
+ ---
12
+
13
+ ## Research Summary
14
+
15
+ [Paste 150-word summary from research document]
16
+
17
+ ---
18
+
19
+ ## Chunk Manifest
20
+
21
+ > **INTER-PHASE CONTRACT:** This manifest is designed for RPI-Implement consumption.
22
+ > RPI-Implement will process each chunk's todolist, marking chunks complete as it progresses.
23
+
24
+ | Chunk ID | From Research | Status | Todos | Dependencies | Ready |
25
+ |----------|---------------|--------|-------|--------------|-------|
26
+ | CHUNK-P1 | CHUNK-R1 | READY | 4 | None | ✅ |
27
+ | CHUNK-P2 | CHUNK-R2 | READY | 5 | CHUNK-P1 | ⏳ |
28
+ | CHUNK-P3 | CHUNK-R3 | READY | 3 | CHUNK-P2 | ⏳ |
29
+ | CHUNK-P4 | CHUNK-R4 | READY | 2 | None | ✅ |
30
+ | CHUNK-P5 | CHUNK-R5 | READY | 6 | CHUNK-P1, P2 | ⏳ |
31
+
32
+ ### Chunk Dependency Graph
33
+
34
+ ```
35
+ CHUNK-P1 (API) ─────┬───→ CHUNK-P2 (Logic) ───→ CHUNK-P3 (DB)
36
+ │ │
37
+ CHUNK-P4 (External) │ │
38
+ │ ↓
39
+ └───→ CHUNK-P5 (Tests) ←───┘
40
+ (depends on P1 and P2)
41
+ ```
42
+
43
+ **Execution Order:** P1 → P4 (parallel) → P2 → P3 → P5
44
+
45
+ ---
46
+
47
+ ## Scope Definition
48
+
49
+ ### In Scope
50
+ - [ ] [Specific deliverable 1]
51
+ - [ ] [Specific deliverable 2]
52
+ - [ ] [Specific deliverable 3]
53
+
54
+ ### Out of Scope
55
+ - [What we are NOT touching]
56
+ - [Related but deferred work]
57
+ - [Future enhancements]
58
+
59
+ ---
60
+
61
+ ## CHUNK-P1: API/Routes (from CHUNK-R1)
62
+
63
+ **Status:** DRAFT | READY | IMPLEMENTING | IMPLEMENTED | COMPLETE
64
+ **Research Chunk:** CHUNK-R1
65
+ **Dependencies:** None
66
+ **Update Research Status When Complete:** Mark CHUNK-R1 as IMPLEMENTED
67
+
68
+ ### Todolist
69
+
70
+ | # | Action | File | Lines | Risk | Test | Status |
71
+ |---|--------|------|-------|------|------|--------|
72
+ | 1 | [Action description] | `path/file.ext` | XXX-YYY | LOW | `test_name` | ⏳ |
73
+ | 2 | [Action description] | `path/file.ext` | XXX-YYY | MED | `test_name` | ⏳ |
74
+ | 3 | [Action description] | `path/file.ext` | XXX-YYY | LOW | `test_name` | ⏳ |
75
+ | 4 | [Action description] | `path/file.ext` | XXX-YYY | LOW | `test_name` | ⏳ |
76
+
77
+ ### Todo 1: [Action Name]
78
+
79
+ **File:** `path/to/file.ext`
80
+ **Lines:** XXX-YYY
81
+ **Risk:** LOW/MEDIUM/HIGH
82
+
83
+ **Current Code:**
84
+ ```
85
+ [Existing code that will be changed]
86
+ ```
87
+
88
+ **Proposed Change:**
89
+ ```
90
+ [New code after modification]
91
+ ```
92
+
93
+ **Test After:**
94
+ ```bash
95
+ [Test command to run]
96
+ ```
97
+
98
+ ### Chunk Completion Criteria
99
+ - [ ] All todos in CHUNK-P1 complete
100
+ - [ ] All tests passing
101
+ - [ ] Update CHUNK-R1 status to IMPLEMENTED
102
+ - [ ] Proceed to dependent chunks (CHUNK-P2, CHUNK-P5)
103
+
104
+ ---
105
+
106
+ ## CHUNK-P2: Business Logic (from CHUNK-R2)
107
+
108
+ **Status:** DRAFT | READY | IMPLEMENTING | IMPLEMENTED | COMPLETE
109
+ **Research Chunk:** CHUNK-R2
110
+ **Dependencies:** CHUNK-P1
111
+ **Update Research Status When Complete:** Mark CHUNK-R2 as IMPLEMENTED
112
+
113
+ ### Todolist
114
+
115
+ | # | Action | File | Lines | Risk | Test | Status |
116
+ |---|--------|------|-------|------|------|--------|
117
+ | 1 | [Action description] | `path/file.ext` | XXX-YYY | LOW | `test_name` | ⏳ |
118
+ | 2 | [Action description] | `path/file.ext` | XXX-YYY | HIGH | `test_name` | ⏳ |
119
+
120
+ ### Chunk Completion Criteria
121
+ - [ ] All todos in CHUNK-P2 complete
122
+ - [ ] All tests passing
123
+ - [ ] Update CHUNK-R2 status to IMPLEMENTED
124
+
125
+ ---
126
+
127
+ ## Inter-Phase Contract (RPI-Implement Consumption)
128
+
129
+ ```
130
+ EXPECTED_CONSUMER: rpi-implement
131
+ CHUNK_PROCESSING_ORDER: dependency-ordered (see Chunk Dependency Graph)
132
+ MARK_AS_IMPLEMENTED_WHEN: all chunk todos complete
133
+ UPDATE_RESEARCH_STATUS: true (mark CHUNK-Rn as IMPLEMENTED)
134
+ CONTEXT_RESET_TRIGGER: every 3 chunks or 35% utilization
135
+ ```
136
+
137
+ **What RPI-Implement Should Do:**
138
+ 1. Load chunk manifest and dependency graph
139
+ 2. Process chunks in dependency order
140
+ 3. For each chunk:
141
+ a. Execute todos atomically (one change → one test → one commit)
142
+ b. Mark todos complete as they pass
143
+ c. When all todos done, mark chunk IMPLEMENTED
144
+ d. Update corresponding research chunk status
145
+ e. Proceed to next ready chunk
146
+ 4. Loop until all chunks IMPLEMENTED
147
+ 5. Run full test suite
148
+ 6. Archive documents
149
+
150
+ ---
151
+
152
+ ## Workflow Impact Analysis
153
+
154
+ ### Affected Workflows
155
+ Check `.ai-context/context/CODE_TO_WORKFLOW_MAP.md`:
156
+
157
+ | Workflow | Impact | Update Required |
158
+ |----------|--------|-----------------|
159
+ | `workflow_name.md` | [How affected] | Yes/No |
160
+
161
+ ### Backward Compatibility
162
+ - [ ] No breaking changes to public APIs
163
+ - [ ] Database migrations are reversible
164
+ - [ ] Configuration changes are backward compatible
165
+
166
+ ---
167
+
168
+ ## Testing Strategy
169
+
170
+ ### Unit Tests (Per Chunk)
171
+ | Chunk | Test | Purpose | Command |
172
+ |-------|------|---------|---------|
173
+ | P1 | `test_file::test_name` | [What it verifies] | `pytest path -k name` |
174
+ | P2 | `test_file::test_name` | [What it verifies] | `pytest path -k name` |
175
+
176
+ ### Integration Tests
177
+ | Test | Purpose | Command |
178
+ |------|---------|---------|
179
+ | `test_file::test_name` | [What it verifies] | `pytest path -k name` |
180
+
181
+ ---
182
+
183
+ ## Verification Checklist
184
+
185
+ ### Before Starting
186
+ - [ ] Research document reviewed
187
+ - [ ] Plan approved by human
188
+ - [ ] Current branch is clean (`git status`)
189
+ - [ ] Tests passing before changes
190
+ - [ ] **Chunk manifest understood**
191
+
192
+ ### After Each Chunk
193
+ - [ ] All chunk todos complete
194
+ - [ ] Chunk tests passing
195
+ - [ ] Commit created with descriptive message
196
+ - [ ] Research chunk status updated
197
+ - [ ] **Context reset if needed**
198
+
199
+ ### After All Chunks
200
+ - [ ] All chunks marked IMPLEMENTED
201
+ - [ ] All research chunks marked IMPLEMENTED
202
+ - [ ] Full test suite passes
203
+ - [ ] Documentation updated
204
+ - [ ] No linting errors
205
+
206
+ ---
207
+
208
+ ## Documentation Updates Required
209
+
210
+ **MANDATORY:** Update after code changes
211
+
212
+ ### Workflow Files
213
+ - [ ] `.ai-context/context/workflows/[name].md` - Update line numbers
214
+ - [ ] Update function signatures if changed
215
+
216
+ ### Index Files
217
+ - [ ] `.ai-context/context/CODE_TO_WORKFLOW_MAP.md` - Add new files if created
218
+
219
+ ### Agent Files
220
+ - [ ] `.ai-context/agents/[name].md` - Update if capabilities changed
221
+
222
+ ### AI_CONTEXT.md
223
+ - [ ] Update if architecture changed
224
+ - [ ] Update if new commands added
225
+
226
+ ### Validation
227
+ ```bash
228
+ /verify-docs-current [modified_file]
229
+ ```
230
+
231
+ ---
232
+
233
+ ## Rollback Plan
234
+
235
+ ### Per-Chunk Rollback
236
+ | Chunk | Rollback Command | Safe Commit |
237
+ |-------|------------------|-------------|
238
+ | P1 | `git revert [hash]` | `[hash]` |
239
+ | P2 | `git revert [hash]` | `[hash]` |
240
+
241
+ ### Full Rollback
242
+ ```bash
243
+ git revert HEAD~N # Revert last N commits
244
+ ```
245
+
246
+ ---
247
+
248
+ ## Context Budget Estimate
249
+
250
+ | Phase | Tokens | Percentage |
251
+ |-------|--------|------------|
252
+ | Plan Loading | ~15k | 7.5% |
253
+ | Active Code (per chunk) | ~10k | 5% |
254
+ | Test Results (per chunk) | ~5k | 2.5% |
255
+ | **Per Chunk Total** | **~15k** | **7.5%** |
256
+ | **Max Active (3 chunks)** | **~45k** | **22.5%** |
257
+
258
+ ---
259
+
260
+ ## Human Review Required
261
+
262
+ **Before approval, human should verify:**
263
+
264
+ 1. **Scope Check:** Are we solving the right problem?
265
+ 2. **Chunk Structure:** Are chunks properly ordered?
266
+ 3. **Dependencies:** Are chunk dependencies correct?
267
+ 4. **Impact Analysis:** What else might break?
268
+ 5. **Testing Strategy:** Is coverage adequate per chunk?
269
+ 6. **Rollback Path:** Can we undo each chunk safely?
270
+
271
+ **Human Notes:**
272
+ ```
273
+ [Space for human reviewer notes]
274
+ ```
275
+
276
+ **Approved:** [ ] Yes / [ ] No / [ ] With modifications
277
+ **Approved by:** [Name]
278
+ **Date:** YYYY-MM-DD
279
+
280
+ ---
281
+
282
+ ## Execution Log
283
+
284
+ ### Chunk Progress
285
+
286
+ | Chunk | Status | Todos Done | Commit | Research Updated |
287
+ |-------|--------|------------|--------|------------------|
288
+ | P1 | ⏳ Pending | 0/4 | - | - |
289
+ | P2 | ⏳ Pending | 0/5 | - | - |
290
+ | P3 | ⏳ Pending | 0/3 | - | - |
291
+ | P4 | ⏳ Pending | 0/2 | - | - |
292
+ | P5 | ⏳ Pending | 0/6 | - | - |
293
+
294
+ ### Issues Encountered
295
+
296
+ | Chunk | Issue | Resolution |
297
+ |-------|-------|------------|
298
+ | - | - | - |
299
+
300
+ ---
301
+
302
+ ## Next Steps After Completion
303
+
304
+ 1. ✅ All chunks IMPLEMENTED
305
+ 2. ✅ All research chunks IMPLEMENTED
306
+ 3. ⏳ Run full test suite
307
+ 4. ⏳ Update documentation
308
+ 5. ⏳ Run `/verify-docs-current`
309
+ 6. ⏳ Move plan to `.ai-context/plans/completed/`
310
+ 7. ⏳ Move research to `.ai-context/research/completed/`
311
+ 8. ⏳ Create PR/merge to main
312
+
313
+ ---
314
+
315
+ **Plan Version:** 2.0 (Chunk-Based with Inter-Phase Awareness)
316
+ **Last Updated:** YYYY-MM-DD
File without changes
File without changes
@@ -0,0 +1,245 @@
1
+ # Research: [Feature/Bug Name]
2
+
3
+ **Date:** YYYY-MM-DD
4
+ **Researcher:** Claude Code
5
+ **Status:** IN_PROGRESS | COMPLETE | BLOCKED
6
+ **Context Budget Used:** X% of 200k
7
+ **Total Chunks:** N
8
+ **Parallel Agents Used:** N (3 minimum, up to 5 for complex features)
9
+
10
+ ---
11
+
12
+ ## Objective
13
+
14
+ [Clear statement of what we're trying to understand - 1-2 sentences]
15
+
16
+ ---
17
+
18
+ ## Chunk Manifest
19
+
20
+ > **INTER-PHASE CONTRACT:** This manifest is designed for RPI-Plan consumption.
21
+ > RPI-Plan will process each chunk sequentially, creating a CHUNK-Pn todolist per CHUNK-Rn.
22
+
23
+ | Chunk ID | Domain | Status | Files | Ready for Planning |
24
+ |----------|--------|--------|-------|-------------------|
25
+ | CHUNK-R1 | API/Routes | COMPLETE | 3 | ✅ |
26
+ | CHUNK-R2 | Business Logic | COMPLETE | 4 | ✅ |
27
+ | CHUNK-R3 | Database/Storage | COMPLETE | 2 | ✅ |
28
+ | CHUNK-R4 | External Integrations | COMPLETE | 1 | ✅ |
29
+ | CHUNK-R5 | Test Coverage | COMPLETE | 3 | ✅ |
30
+
31
+ ---
32
+
33
+ ## CHUNK-R1: API/Routes
34
+
35
+ **Status:** FOUND | COMPLETE | PLANNED | IMPLEMENTED
36
+ **Parallel Agent:** Agent 1
37
+ **Ready for Planning:** Yes/No
38
+
39
+ ### Files Explored
40
+
41
+ | File | Lines | Key Findings |
42
+ |------|-------|--------------|
43
+ | `path/to/route.ext` | XXX-YYY | [Entry point for feature] |
44
+ | `path/to/handler.ext` | XXX-YYY | [Request handling logic] |
45
+
46
+ ### Code Flow Analysis
47
+
48
+ ```
49
+ entry_function() [file.ext:XXX]
50
+ ├─ validate_request() [file.ext:YYY]
51
+ └─ route_to_handler() [file.ext:ZZZ]
52
+ ```
53
+
54
+ ### Dependencies (This Chunk)
55
+ - **External:** [API Name]
56
+ - **Internal:** [service.ext]
57
+
58
+ ---
59
+
60
+ ## CHUNK-R2: Business Logic
61
+
62
+ **Status:** FOUND | COMPLETE | PLANNED | IMPLEMENTED
63
+ **Parallel Agent:** Agent 2
64
+ **Ready for Planning:** Yes/No
65
+
66
+ ### Files Explored
67
+
68
+ | File | Lines | Key Findings |
69
+ |------|-------|--------------|
70
+ | `path/to/service.ext` | XXX-YYY | [Core business logic] |
71
+ | `path/to/model.ext` | XXX-YYY | [Data models] |
72
+
73
+ ### Code Flow Analysis
74
+
75
+ ```
76
+ process_request() [service.ext:XXX]
77
+ ├─ validate_data() [service.ext:YYY]
78
+ ├─ apply_rules() [rules.ext:ZZZ]
79
+ └─ persist_result() [model.ext:AAA]
80
+ ```
81
+
82
+ ### Dependencies (This Chunk)
83
+ - **External:** [None]
84
+ - **Internal:** [crud.ext, utils.ext]
85
+
86
+ ---
87
+
88
+ ## CHUNK-R3: Database/Storage
89
+
90
+ **Status:** FOUND | COMPLETE | PLANNED | IMPLEMENTED
91
+ **Parallel Agent:** Agent 3
92
+ **Ready for Planning:** Yes/No
93
+
94
+ ### Files Explored
95
+
96
+ | File | Lines | Key Findings |
97
+ |------|-------|--------------|
98
+ | `path/to/crud.ext` | XXX-YYY | [Database operations] |
99
+ | `path/to/schema.ext` | XXX-YYY | [Schema definitions] |
100
+
101
+ ### Database Schema Involved
102
+
103
+ | Table | Operations | Purpose |
104
+ |-------|------------|---------|
105
+ | `table_name` | READ/WRITE/UPDATE | [What data] |
106
+
107
+ ### Dependencies (This Chunk)
108
+ - **External:** [Database driver]
109
+ - **Internal:** [config.ext]
110
+
111
+ ---
112
+
113
+ ## CHUNK-R4: External Integrations
114
+
115
+ **Status:** FOUND | COMPLETE | PLANNED | IMPLEMENTED
116
+ **Parallel Agent:** Agent 4
117
+ **Ready for Planning:** Yes/No
118
+
119
+ ### Files Explored
120
+
121
+ | File | Lines | Key Findings |
122
+ |------|-------|--------------|
123
+ | `path/to/client.ext` | XXX-YYY | [External API client] |
124
+
125
+ ### External Dependencies
126
+
127
+ | Dependency | Type | Purpose |
128
+ |------------|------|---------|
129
+ | [API Name] | HTTP API | [What it does] |
130
+ | [Library] | Package | [What it provides] |
131
+
132
+ ---
133
+
134
+ ## CHUNK-R5: Test Coverage
135
+
136
+ **Status:** FOUND | COMPLETE | PLANNED | IMPLEMENTED
137
+ **Parallel Agent:** Agent 5
138
+ **Ready for Planning:** Yes/No
139
+
140
+ ### Existing Tests
141
+
142
+ | Test File | Coverage Area |
143
+ |-----------|---------------|
144
+ | `tests/test_feature.ext` | [What scenarios] |
145
+
146
+ ### Coverage Gaps
147
+ - ❌ [Missing test scenario 1]
148
+ - ❌ [Missing test scenario 2]
149
+ - ⚠️ [Edge case not covered]
150
+
151
+ ---
152
+
153
+ ## Known Gotchas
154
+
155
+ Check `.ai-context/context/KNOWN_GOTCHAS.md` for:
156
+ - [ ] Similar past issues
157
+ - [ ] Related workarounds
158
+ - [ ] Anti-patterns to avoid
159
+
160
+ **Found Gotchas:**
161
+ 1. [Gotcha 1 if applicable]
162
+ 2. [Gotcha 2 if applicable]
163
+
164
+ ---
165
+
166
+ ## Open Questions
167
+
168
+ ### Technical Questions
169
+ - [ ] [Question about implementation detail]
170
+ - [ ] [Question about architecture choice]
171
+
172
+ ### Business Logic Questions
173
+ - [ ] [Question about requirements]
174
+ - [ ] [Question about edge cases]
175
+
176
+ ---
177
+
178
+ ## Summary (for Plan Phase)
179
+
180
+ **Word Count Target: 150 words max**
181
+
182
+ [Feature/Bug Name] is implemented across [X] files in [system area], organized into [N] research chunks.
183
+
184
+ **Entry Points:**
185
+ - [Primary entry point with file:line]
186
+ - [Secondary entry point if applicable]
187
+
188
+ **Core Logic:**
189
+ [1-2 sentences describing what the feature does]
190
+
191
+ **Key Files by Chunk:**
192
+ 1. CHUNK-R1 (API): [file_path:line]
193
+ 2. CHUNK-R2 (Logic): [file_path:line]
194
+ 3. CHUNK-R3 (DB): [file_path:line]
195
+
196
+ **Dependencies:**
197
+ - External: [API names]
198
+ - Internal: [Service names]
199
+
200
+ **Test Coverage:** [Good/Partial/Missing]
201
+
202
+ **Recommended Approach:**
203
+ [1 sentence on how to implement/fix]
204
+
205
+ **Known Risks:**
206
+ [1 sentence on primary risk]
207
+
208
+ ---
209
+
210
+ ## Inter-Phase Contract (RPI-Plan Consumption)
211
+
212
+ ```
213
+ EXPECTED_CONSUMER: rpi-plan
214
+ CHUNK_PROCESSING_ORDER: sequential (R1 → R2 → R3 → R4 → R5)
215
+ MARK_AS_PLANNED_WHEN: chunk todolist created
216
+ REQUIRED_OUTPUT: CHUNK-Pn per CHUNK-Rn
217
+ STATUS_UPDATE_FIELD: "Status" in each chunk section
218
+ ```
219
+
220
+ **What RPI-Plan Should Do:**
221
+ 1. Read each CHUNK-Rn in order
222
+ 2. Create corresponding CHUNK-Pn with todolist
223
+ 3. Mark CHUNK-Rn status as `PLANNED`
224
+ 4. Proceed to next chunk
225
+ 5. Loop until all chunks are PLANNED
226
+
227
+ ---
228
+
229
+ ## Next Steps
230
+
231
+ After research completes:
232
+ 1. ✅ Research document saved in `.ai-context/research/active/`
233
+ 2. ✅ All chunks marked as COMPLETE
234
+ 3. ⏳ Run `/rpi-plan [feature-name]` to create implementation plan
235
+ 4. ⏳ RPI-Plan will process chunks and create todolists
236
+ 5. ⏳ Human reviews plan before `/rpi-implement`
237
+
238
+ ---
239
+
240
+ **Context Usage Report:**
241
+ - Files read: X
242
+ - Tokens used: ~Xk (X% of 200k)
243
+ - Parallel agents spawned: 3-5
244
+ - Chunks created: N
245
+ - Compaction needed: Yes/No
File without changes
File without changes
@@ -0,0 +1,141 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "$id": "https://claude-context.dev/schemas/agent.schema.json",
4
+ "title": "Claude Context Agent",
5
+ "description": "Schema for agent manifest files",
6
+ "type": "object",
7
+ "required": ["name", "version", "description"],
8
+ "properties": {
9
+ "$schema": {
10
+ "type": "string",
11
+ "description": "JSON Schema reference"
12
+ },
13
+ "name": {
14
+ "type": "string",
15
+ "pattern": "^[a-z0-9-]+$",
16
+ "minLength": 1,
17
+ "maxLength": 50,
18
+ "description": "Agent identifier (lowercase, hyphens allowed)"
19
+ },
20
+ "version": {
21
+ "type": "string",
22
+ "pattern": "^\\d+\\.\\d+\\.\\d+$",
23
+ "description": "Agent version (semver)"
24
+ },
25
+ "displayName": {
26
+ "type": "string",
27
+ "maxLength": 100,
28
+ "description": "Human-readable agent name"
29
+ },
30
+ "description": {
31
+ "type": "string",
32
+ "maxLength": 500,
33
+ "description": "Brief description of agent capabilities"
34
+ },
35
+ "author": {
36
+ "type": "string",
37
+ "description": "Agent author"
38
+ },
39
+ "license": {
40
+ "type": "string",
41
+ "description": "SPDX license identifier"
42
+ },
43
+ "keywords": {
44
+ "type": "array",
45
+ "items": { "type": "string" },
46
+ "maxItems": 10,
47
+ "description": "Keywords for agent discovery"
48
+ },
49
+ "category": {
50
+ "type": "string",
51
+ "enum": [
52
+ "initialization",
53
+ "architecture",
54
+ "database",
55
+ "api",
56
+ "integration",
57
+ "deployment",
58
+ "testing",
59
+ "documentation",
60
+ "custom"
61
+ ],
62
+ "description": "Agent category"
63
+ },
64
+ "complexity": {
65
+ "type": "string",
66
+ "enum": ["low", "medium", "high", "very-high"],
67
+ "description": "Task complexity this agent handles"
68
+ },
69
+ "capabilities": {
70
+ "type": "array",
71
+ "items": { "type": "string" },
72
+ "description": "List of capabilities (e.g., diagram-generation, dependency-analysis)"
73
+ },
74
+ "workflows": {
75
+ "type": "array",
76
+ "items": { "type": "string" },
77
+ "description": "Workflows this agent specializes in"
78
+ },
79
+ "commands": {
80
+ "type": "array",
81
+ "items": { "type": "string" },
82
+ "description": "Commands this agent can invoke"
83
+ },
84
+ "dependencies": {
85
+ "type": "object",
86
+ "properties": {
87
+ "agents": {
88
+ "type": "array",
89
+ "items": { "type": "string" },
90
+ "description": "Required agents"
91
+ },
92
+ "commands": {
93
+ "type": "array",
94
+ "items": { "type": "string" },
95
+ "description": "Required commands"
96
+ }
97
+ }
98
+ },
99
+ "config": {
100
+ "type": "object",
101
+ "properties": {
102
+ "context_budget": {
103
+ "type": "string",
104
+ "description": "Typical context usage (e.g., '~50k tokens')"
105
+ },
106
+ "timeout_minutes": {
107
+ "type": "integer",
108
+ "minimum": 1,
109
+ "maximum": 120,
110
+ "description": "Execution timeout in minutes"
111
+ }
112
+ }
113
+ },
114
+ "hooks": {
115
+ "type": "object",
116
+ "properties": {
117
+ "pre_invoke": {
118
+ "type": ["string", "null"],
119
+ "description": "Command to run before agent invocation"
120
+ },
121
+ "post_invoke": {
122
+ "type": ["string", "null"],
123
+ "description": "Command to run after agent completion"
124
+ }
125
+ }
126
+ },
127
+ "examples": {
128
+ "type": "array",
129
+ "items": {
130
+ "type": "object",
131
+ "properties": {
132
+ "invocation": { "type": "string" },
133
+ "description": { "type": "string" }
134
+ },
135
+ "required": ["invocation", "description"]
136
+ },
137
+ "description": "Example invocations"
138
+ }
139
+ },
140
+ "additionalProperties": false
141
+ }