create-claude-context 1.0.0 → 1.2.1

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