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,485 @@
1
+ ---
2
+ name: help
3
+ version: "1.0.0"
4
+ description: "Display help for all available commands and agents"
5
+ category: "system"
6
+ context_budget_estimate: "5K tokens"
7
+ typical_context_usage: "2%"
8
+ prerequisites: []
9
+ outputs:
10
+ - "Command and agent reference information"
11
+ next_commands: []
12
+ related_agents: []
13
+ examples:
14
+ - command: "/help"
15
+ description: "List all commands and agents"
16
+ - command: "/help commands"
17
+ description: "Detailed command reference"
18
+ - command: "/help agents"
19
+ description: "Agent capability overview"
20
+ - command: "/help rpi"
21
+ description: "RPI workflow deep dive"
22
+ - command: "/help rpi-research"
23
+ description: "Specific command help"
24
+ ---
25
+
26
+ # Help Command
27
+
28
+ Display help and reference information for Claude Context Engineering.
29
+
30
+ ## Syntax
31
+
32
+ ```bash
33
+ /help [topic]
34
+ ```
35
+
36
+ ## Topics
37
+
38
+ | Topic | Description |
39
+ |-------|-------------|
40
+ | *(none)* | Overview of all commands and agents |
41
+ | `commands` | Detailed command reference |
42
+ | `agents` | Agent capabilities and selection guide |
43
+ | `rpi` | RPI workflow deep dive |
44
+ | `[command-name]` | Specific command help |
45
+ | `[agent-name]` | Specific agent help |
46
+
47
+ ---
48
+
49
+ ## Quick Reference
50
+
51
+ ### Available Commands
52
+
53
+ | Command | Category | Description |
54
+ |---------|----------|-------------|
55
+ | `/rpi-research [name]` | RPI | Research phase - systematic codebase exploration |
56
+ | `/rpi-plan [name]` | RPI | Plan phase - create implementation blueprint |
57
+ | `/rpi-implement [name]` | RPI | Implement phase - execute with continuous testing |
58
+ | `/context-optimize` | Orchestration | Generate RPI TODO list with interactive scoping |
59
+ | `/verify-docs-current [file]` | Validation | Check documentation accuracy against code |
60
+ | `/validate-all` | Validation | Run complete validation suite |
61
+ | `/help [topic]` | System | Display this help information |
62
+
63
+ ### Available Agents
64
+
65
+ | Agent | Domain | Primary Use |
66
+ |-------|--------|-------------|
67
+ | `@context-engineer` | Initialization | Transform template for any codebase |
68
+ | `@core-architect` | Architecture | System design, state machines, high-level planning |
69
+ | `@database-ops` | Database | Migrations, schema, query optimization |
70
+ | `@api-developer` | API | Endpoints, contracts, API documentation |
71
+ | `@integration-hub` | Integration | External services, webhooks, third-party APIs |
72
+ | `@deployment-ops` | DevOps | CI/CD, infrastructure, deployment strategies |
73
+
74
+ ---
75
+
76
+ ## Commands Reference
77
+
78
+ ### RPI Workflow Commands
79
+
80
+ The Research-Plan-Implement workflow prevents cascading errors through structured development.
81
+
82
+ #### `/rpi-research [feature-name]`
83
+
84
+ **Purpose:** Systematic, zero-code-modification exploration of the codebase.
85
+
86
+ **Context Budget:** ~50K tokens (25%)
87
+
88
+ **What it does:**
89
+ 1. Launches 3 parallel exploration agents
90
+ 2. Traces call chains 3 levels deep with file:line references
91
+ 3. Maps dependencies (internal and external)
92
+ 4. Identifies test coverage gaps
93
+ 5. Creates research document in `.ai-context/research/active/`
94
+
95
+ **Exit Criteria:**
96
+ - [ ] 3-20 relevant files identified
97
+ - [ ] Call chains traced with line numbers
98
+ - [ ] Dependencies mapped
99
+ - [ ] 150-word summary for parent context
100
+
101
+ **Example:**
102
+ ```bash
103
+ /rpi-research user-authentication
104
+ ```
105
+
106
+ ---
107
+
108
+ #### `/rpi-plan [feature-name]`
109
+
110
+ **Purpose:** Create detailed implementation blueprint with file:line precision.
111
+
112
+ **Context Budget:** ~35K tokens (17%)
113
+
114
+ **Prerequisites:** Research document must exist in `.ai-context/research/active/`
115
+
116
+ **What it does:**
117
+ 1. Loads research document
118
+ 2. Defines scope (in-scope, out-of-scope)
119
+ 3. Creates modification table with file, lines, change, risk level
120
+ 4. Designs step-by-step implementation
121
+ 5. Defines test strategy
122
+ 6. Requires human approval before proceeding
123
+
124
+ **Exit Criteria:**
125
+ - [ ] All modifications listed with file:line
126
+ - [ ] Step-by-step implementation defined
127
+ - [ ] Test strategy documented
128
+ - [ ] Human approval obtained
129
+
130
+ **Example:**
131
+ ```bash
132
+ /rpi-plan user-authentication
133
+ ```
134
+
135
+ ---
136
+
137
+ #### `/rpi-implement [feature-name]`
138
+
139
+ **Purpose:** Execute approved plan with atomic changes and continuous testing.
140
+
141
+ **Context Budget:** ~60K tokens (30%)
142
+
143
+ **Prerequisites:** Approved plan in `.ai-context/plans/active/`
144
+
145
+ **Golden Rule:** ONE CHANGE → ONE TEST → ONE COMMIT
146
+
147
+ **What it does:**
148
+ 1. Verifies preconditions (plan approved, clean branch, tests pass)
149
+ 2. For each step: make change → run test → commit if pass
150
+ 3. Updates documentation after each change
151
+ 4. Runs full test suite after completion
152
+ 5. Archives plan to `.ai-context/plans/completed/`
153
+
154
+ **Error Recovery:**
155
+ - Syntax error: Fix immediately
156
+ - Test failure: Stop, investigate, don't proceed
157
+ - 3+ failures: Stop, start fresh session
158
+
159
+ **Example:**
160
+ ```bash
161
+ /rpi-implement user-authentication
162
+ ```
163
+
164
+ ---
165
+
166
+ ### Orchestration Commands
167
+
168
+ #### `/context-optimize`
169
+
170
+ **Purpose:** Generate RPI workflow TODO list with interactive scoping to optimize the context engineering system.
171
+
172
+ **Context Budget:** ~40K tokens (20%)
173
+
174
+ **What it does:**
175
+ 1. Asks up to 4 multiple choice questions to scope optimization goals
176
+ 2. Audits current context system for completeness and accuracy
177
+ 3. Generates actionable TODO list with RPI phases (research, plan, implement)
178
+ 4. Identifies redundant or outdated context files
179
+ 5. Recommends new agents or commands based on codebase patterns
180
+
181
+ **Scoping Questions:**
182
+ - Optimization focus (functionalize, update, cleanup, enhance)
183
+ - Codebase coverage priority (core logic, API, database, all)
184
+ - Enhancement preferences (agents, commands, docs, navigation)
185
+ - TODO priority order (quick wins, high impact, grouped, dependency order)
186
+
187
+ **Output:**
188
+ - TODO checklist: `.ai-context/plans/active/context-optimization_plan.md`
189
+ - Audit report: `.ai-context/research/active/context-audit_research.md`
190
+
191
+ **Examples:**
192
+ ```bash
193
+ /context-optimize # Interactive mode
194
+ /context-optimize --auto # Automatic scoping
195
+ /context-optimize --scope documentation
196
+ ```
197
+
198
+ ---
199
+
200
+ ### Validation Commands
201
+
202
+ #### `/verify-docs-current [file_path]`
203
+
204
+ **Purpose:** Validate documentation accuracy against current code.
205
+
206
+ **Context Budget:** ~20K tokens (10%)
207
+
208
+ **What it does:**
209
+ 1. Looks up file in CODE_TO_WORKFLOW_MAP.md
210
+ 2. Finds all workflows that document this file
211
+ 3. Verifies line number references (±10 line tolerance)
212
+ 4. Checks markdown links resolve
213
+ 5. Generates accuracy report
214
+
215
+ **Output:** Status per workflow (HEALTHY / NEEDS UPDATE / STALE)
216
+
217
+ **Example:**
218
+ ```bash
219
+ /verify-docs-current src/services/auth.py
220
+ ```
221
+
222
+ ---
223
+
224
+ #### `/validate-all`
225
+
226
+ **Purpose:** Run complete validation suite.
227
+
228
+ **Context Budget:** ~40K tokens (20%)
229
+
230
+ **What it does:**
231
+ 1. Documentation validation (line numbers, links, CODE_TO_WORKFLOW_MAP)
232
+ 2. Test validation (unit, integration, coverage threshold)
233
+ 3. Code quality checks (linting, type checking, security)
234
+ 4. Configuration validation
235
+
236
+ **Output:** Report with PASS/FAIL per category, overall READY/NOT READY
237
+
238
+ **Example:**
239
+ ```bash
240
+ /validate-all
241
+ ```
242
+
243
+ ---
244
+
245
+ ## Agents Reference
246
+
247
+ ### Agent Selection Guide
248
+
249
+ ```
250
+ START
251
+
252
+ ├── Is this initialization/setup? → @context-engineer
253
+
254
+ ├── Does it involve external APIs/webhooks? → @integration-hub
255
+
256
+ ├── Does it involve database changes? → @database-ops
257
+
258
+ ├── Does it involve API endpoints? → @api-developer
259
+
260
+ ├── Does it involve deployment/CI/CD? → @deployment-ops
261
+
262
+ └── Is it architecture/system design? → @core-architect
263
+ ```
264
+
265
+ ### Agent Details
266
+
267
+ #### `@context-engineer`
268
+
269
+ **Type:** Initialization Agent
270
+ **Complexity:** Very High
271
+ **Context Usage:** Up to 80K tokens (40%)
272
+
273
+ **Capabilities:**
274
+ - Tech stack detection
275
+ - Workflow discovery (8-15 workflows)
276
+ - Template population
277
+ - System validation
278
+ - Documentation generation
279
+
280
+ **Invocation:**
281
+ ```bash
282
+ @context-engineer "Initialize context engineering for this repository"
283
+ @context-engineer "Document workflow: [name]"
284
+ @context-engineer "Refresh workflow: [name]"
285
+ ```
286
+
287
+ ---
288
+
289
+ #### `@core-architect`
290
+
291
+ **Type:** Architecture Specialist
292
+ **Complexity:** High
293
+ **Context Usage:** ~50K tokens (25%)
294
+
295
+ **Capabilities:**
296
+ - System architecture design
297
+ - State machine analysis
298
+ - Dependency mapping
299
+ - Scalability planning
300
+ - High-level design patterns
301
+
302
+ **Invocation:**
303
+ ```bash
304
+ @core-architect "Document system architecture"
305
+ @core-architect "Analyze state transitions in [component]"
306
+ @core-architect "Identify scalability bottlenecks"
307
+ ```
308
+
309
+ ---
310
+
311
+ #### `@database-ops`
312
+
313
+ **Type:** Database Specialist
314
+ **Complexity:** Medium-High
315
+ **Context Usage:** ~40K tokens (20%)
316
+
317
+ **Capabilities:**
318
+ - Schema design and validation
319
+ - Migration planning and execution
320
+ - Query optimization
321
+ - Data integrity checks
322
+ - Performance tuning
323
+
324
+ **Invocation:**
325
+ ```bash
326
+ @database-ops "Document database schema"
327
+ @database-ops "Analyze query performance for [query]"
328
+ @database-ops "Plan migration for [change]"
329
+ ```
330
+
331
+ ---
332
+
333
+ #### `@api-developer`
334
+
335
+ **Type:** API Specialist
336
+ **Complexity:** Medium
337
+ **Context Usage:** ~35K tokens (17%)
338
+
339
+ **Capabilities:**
340
+ - API design (REST, GraphQL)
341
+ - Contract definition
342
+ - Endpoint documentation
343
+ - API testing strategies
344
+ - Version management
345
+
346
+ **Invocation:**
347
+ ```bash
348
+ @api-developer "Document API endpoints for [resource]"
349
+ @api-developer "Validate API contracts"
350
+ @api-developer "Generate OpenAPI spec"
351
+ ```
352
+
353
+ ---
354
+
355
+ #### `@integration-hub`
356
+
357
+ **Type:** Integration Specialist
358
+ **Complexity:** Medium-High
359
+ **Context Usage:** ~40K tokens (20%)
360
+
361
+ **Capabilities:**
362
+ - Third-party API integration
363
+ - Webhook handling
364
+ - Authentication management
365
+ - Rate limiting implementation
366
+ - Error handling for external services
367
+
368
+ **Invocation:**
369
+ ```bash
370
+ @integration-hub "Document integration with [service]"
371
+ @integration-hub "Analyze webhook endpoints"
372
+ @integration-hub "Review authentication flows"
373
+ ```
374
+
375
+ ---
376
+
377
+ #### `@deployment-ops`
378
+
379
+ **Type:** DevOps Specialist
380
+ **Complexity:** High
381
+ **Context Usage:** ~45K tokens (22%)
382
+
383
+ **Capabilities:**
384
+ - CI/CD pipeline design
385
+ - Infrastructure as code
386
+ - Deployment strategies (blue-green, canary)
387
+ - Environment management
388
+ - Monitoring and rollback
389
+
390
+ **Invocation:**
391
+ ```bash
392
+ @deployment-ops "Document deployment pipeline"
393
+ @deployment-ops "Review infrastructure configuration"
394
+ @deployment-ops "Plan rollback strategy"
395
+ ```
396
+
397
+ ---
398
+
399
+ ## RPI Workflow Deep Dive
400
+
401
+ ### Philosophy
402
+
403
+ The Research-Plan-Implement methodology prevents "slop" (degraded output quality) by:
404
+
405
+ 1. **Separating concerns:** Research loads context, Plan uses it, Implement executes
406
+ 2. **Human checkpoints:** Approval required between Plan and Implement
407
+ 3. **Atomic changes:** Small, testable, reversible modifications
408
+ 4. **Context discipline:** Each phase has a budget, compacts before next phase
409
+
410
+ ### Token Budget Strategy
411
+
412
+ | Phase | Budget | Cumulative |
413
+ |-------|--------|------------|
414
+ | Research | 50K | 50K (25%) |
415
+ | Plan | 35K | 85K (42%) |
416
+ | Implement | 60K | 145K (72%) |
417
+ | Buffer | 55K | 200K (100%) |
418
+
419
+ ### Workflow Diagram
420
+
421
+ ```
422
+ User Request
423
+
424
+
425
+ ┌─────────────────┐
426
+ │ /rpi-research │ → .ai-context/research/active/[name]_research.md
427
+ └────────┬────────┘
428
+
429
+
430
+ ┌─────────────────┐
431
+ │ /rpi-plan │ → .ai-context/plans/active/[name]_plan.md
432
+ └────────┬────────┘
433
+
434
+
435
+ ┌─────────┐
436
+ │ APPROVE │ ← Human Review
437
+ └────┬────┘
438
+
439
+
440
+ ┌─────────────────┐
441
+ │ /rpi-implement │ → Code changes + Doc updates
442
+ └────────┬────────┘
443
+
444
+
445
+ .ai-context/plans/completed/[name]_plan.md
446
+ ```
447
+
448
+ ---
449
+
450
+ ## CLI Tools
451
+
452
+ In addition to slash commands, CLI tools are available:
453
+
454
+ ```bash
455
+ # Validate setup
456
+ npx claude-context validate
457
+
458
+ # Run diagnostics
459
+ npx claude-context diagnose
460
+
461
+ # Initialize (partial - requires agent for full init)
462
+ npx claude-context init
463
+
464
+ # View configuration
465
+ npx claude-context config
466
+ ```
467
+
468
+ ---
469
+
470
+ ## Quick Tips
471
+
472
+ 1. **Start with indexes:** Load CATEGORY_INDEX.md before detail files
473
+ 2. **Use progressive loading:** 5K → 15K → 40K tokens as needed
474
+ 3. **After code changes:** Always run `/verify-docs-current`
475
+ 4. **For complex features:** Full RPI cycle prevents errors
476
+ 5. **When stuck:** Use `@context-engineer "help with [problem]"`
477
+
478
+ ---
479
+
480
+ ## Getting More Help
481
+
482
+ - **Quick Start:** See `docs/QUICK_START_5MIN.md`
483
+ - **Troubleshooting:** See `docs/TROUBLESHOOTING.md`
484
+ - **Full Documentation:** See `.ai-context/README.md`
485
+ - **RPI Details:** See `.ai-context/RPI_WORKFLOW_PLAN.md`
@@ -0,0 +1,164 @@
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/