create-universal-ai-context 2.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.
- package/LICENSE +21 -0
- package/README.md +171 -0
- package/bin/create-ai-context.js +337 -0
- package/lib/adapters/antigravity.js +160 -0
- package/lib/adapters/claude.js +122 -0
- package/lib/adapters/cline.js +111 -0
- package/lib/adapters/copilot.js +117 -0
- package/lib/adapters/index.js +69 -0
- package/lib/ai-context-generator.js +234 -0
- package/lib/ai-orchestrator.js +431 -0
- package/lib/call-tracer.js +444 -0
- package/lib/detector.js +726 -0
- package/lib/environment-detector.js +239 -0
- package/lib/index.js +310 -0
- package/lib/installer.js +418 -0
- package/lib/migrate.js +319 -0
- package/lib/placeholder.js +541 -0
- package/lib/prompts.js +287 -0
- package/lib/spinner.js +60 -0
- package/lib/static-analyzer.js +729 -0
- package/lib/template-populator.js +843 -0
- package/lib/template-renderer.js +382 -0
- package/lib/validate.js +155 -0
- package/package.json +70 -0
- package/templates/AI_CONTEXT.md.template +245 -0
- package/templates/base/README.md +257 -0
- package/templates/base/RPI_WORKFLOW_PLAN.md +320 -0
- package/templates/base/agents/api-developer.md +76 -0
- package/templates/base/agents/context-engineer.md +525 -0
- package/templates/base/agents/core-architect.md +76 -0
- package/templates/base/agents/database-ops.md +76 -0
- package/templates/base/agents/deployment-ops.md +76 -0
- package/templates/base/agents/integration-hub.md +76 -0
- package/templates/base/analytics/README.md +114 -0
- package/templates/base/automation/config.json +58 -0
- package/templates/base/automation/generators/code-mapper.js +308 -0
- package/templates/base/automation/generators/index-builder.js +321 -0
- package/templates/base/automation/hooks/post-commit.sh +83 -0
- package/templates/base/automation/hooks/pre-commit.sh +103 -0
- package/templates/base/ci-templates/README.md +108 -0
- package/templates/base/ci-templates/github-actions/context-check.yml +144 -0
- package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -0
- package/templates/base/commands/analytics.md +238 -0
- package/templates/base/commands/auto-sync.md +172 -0
- package/templates/base/commands/collab.md +194 -0
- package/templates/base/commands/help.md +450 -0
- package/templates/base/commands/rpi-implement.md +115 -0
- package/templates/base/commands/rpi-plan.md +93 -0
- package/templates/base/commands/rpi-research.md +88 -0
- package/templates/base/commands/session-resume.md +144 -0
- package/templates/base/commands/session-save.md +112 -0
- package/templates/base/commands/validate-all.md +77 -0
- package/templates/base/commands/verify-docs-current.md +86 -0
- package/templates/base/config/base.json +57 -0
- package/templates/base/config/environments/development.json +13 -0
- package/templates/base/config/environments/production.json +17 -0
- package/templates/base/config/environments/staging.json +13 -0
- package/templates/base/config/local.json.example +21 -0
- package/templates/base/context/.meta/generated-at.json +18 -0
- package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -0
- package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -0
- package/templates/base/context/FILE_OWNERSHIP.md +57 -0
- package/templates/base/context/INTEGRATION_POINTS.md +92 -0
- package/templates/base/context/KNOWN_GOTCHAS.md +195 -0
- package/templates/base/context/TESTING_MAP.md +95 -0
- package/templates/base/context/WORKFLOW_INDEX.md +129 -0
- package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -0
- package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -0
- package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -0
- package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -0
- package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -0
- package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -0
- package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -0
- package/templates/base/knowledge/README.md +98 -0
- package/templates/base/knowledge/sessions/README.md +88 -0
- package/templates/base/knowledge/sessions/TEMPLATE.md +150 -0
- package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -0
- package/templates/base/knowledge/shared/decisions/README.md +49 -0
- package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -0
- package/templates/base/knowledge/shared/patterns/README.md +62 -0
- package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -0
- package/templates/base/plans/PLAN_TEMPLATE.md +250 -0
- package/templates/base/plans/active/.gitkeep +0 -0
- package/templates/base/plans/completed/.gitkeep +0 -0
- package/templates/base/research/RESEARCH_TEMPLATE.md +153 -0
- package/templates/base/research/active/.gitkeep +0 -0
- package/templates/base/research/completed/.gitkeep +0 -0
- package/templates/base/schemas/agent.schema.json +141 -0
- package/templates/base/schemas/anchors.schema.json +54 -0
- package/templates/base/schemas/automation.schema.json +93 -0
- package/templates/base/schemas/command.schema.json +134 -0
- package/templates/base/schemas/hashes.schema.json +40 -0
- package/templates/base/schemas/manifest.schema.json +117 -0
- package/templates/base/schemas/plan.schema.json +136 -0
- package/templates/base/schemas/research.schema.json +115 -0
- package/templates/base/schemas/roles.schema.json +34 -0
- package/templates/base/schemas/session.schema.json +77 -0
- package/templates/base/schemas/settings.schema.json +244 -0
- package/templates/base/schemas/staleness.schema.json +53 -0
- package/templates/base/schemas/team-config.schema.json +42 -0
- package/templates/base/schemas/workflow.schema.json +126 -0
- package/templates/base/session/checkpoints/.gitkeep +2 -0
- package/templates/base/session/current/state.json +20 -0
- package/templates/base/session/history/.gitkeep +2 -0
- package/templates/base/settings.json +3 -0
- package/templates/base/standards/COMPATIBILITY.md +219 -0
- package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -0
- package/templates/base/standards/QUALITY_CHECKLIST.md +211 -0
- package/templates/base/standards/README.md +66 -0
- package/templates/base/sync/anchors.json +6 -0
- package/templates/base/sync/hashes.json +6 -0
- package/templates/base/sync/staleness.json +10 -0
- package/templates/base/team/README.md +168 -0
- package/templates/base/team/config.json +79 -0
- package/templates/base/team/roles.json +145 -0
- package/templates/base/tools/bin/claude-context.js +151 -0
- package/templates/base/tools/lib/anchor-resolver.js +276 -0
- package/templates/base/tools/lib/config-loader.js +363 -0
- package/templates/base/tools/lib/detector.js +350 -0
- package/templates/base/tools/lib/diagnose.js +206 -0
- package/templates/base/tools/lib/drift-detector.js +373 -0
- package/templates/base/tools/lib/errors.js +199 -0
- package/templates/base/tools/lib/index.js +36 -0
- package/templates/base/tools/lib/init.js +192 -0
- package/templates/base/tools/lib/logger.js +230 -0
- package/templates/base/tools/lib/placeholder.js +201 -0
- package/templates/base/tools/lib/session-manager.js +354 -0
- package/templates/base/tools/lib/validate.js +521 -0
- package/templates/base/tools/package.json +49 -0
- package/templates/handlebars/antigravity.hbs +337 -0
- package/templates/handlebars/claude.hbs +184 -0
- package/templates/handlebars/cline.hbs +63 -0
- package/templates/handlebars/copilot.hbs +131 -0
- package/templates/handlebars/partials/gotcha-list.hbs +11 -0
- package/templates/handlebars/partials/header.hbs +3 -0
- package/templates/handlebars/partials/workflow-summary.hbs +16 -0
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
# AI_CONTEXT.md - {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
This file provides guidance to AI coding assistants when working with code in this repository.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Project Identity
|
|
8
|
+
|
|
9
|
+
**Platform:** {{PROJECT_DESCRIPTION}}
|
|
10
|
+
**Domain:** {{PRODUCTION_URL}}
|
|
11
|
+
**Tech Stack:** {{TECH_STACK}}
|
|
12
|
+
**Status:** {{PROJECT_STATUS}}
|
|
13
|
+
|
|
14
|
+
**Quick Reference:**
|
|
15
|
+
- **API:** {{API_URL}}
|
|
16
|
+
- **Repo:** {{REPO_URL}}
|
|
17
|
+
- **Deploy:** {{DEPLOYMENT_PLATFORM}}
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Essential Commands
|
|
22
|
+
|
|
23
|
+
### Development
|
|
24
|
+
```bash
|
|
25
|
+
{{INSTALL_COMMAND}}
|
|
26
|
+
{{DEV_START_COMMAND}}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Testing
|
|
30
|
+
```bash
|
|
31
|
+
{{TEST_COMMAND}} # All tests
|
|
32
|
+
{{TEST_E2E_COMMAND}} # E2E only
|
|
33
|
+
{{TEST_COVERAGE_COMMAND}} # With coverage
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Database
|
|
37
|
+
```bash
|
|
38
|
+
{{MIGRATION_CREATE_COMMAND}}
|
|
39
|
+
{{MIGRATION_RUN_COMMAND}}
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
### Deployment
|
|
43
|
+
```bash
|
|
44
|
+
{{DEPLOY_COMMAND}}
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Navigation Rules
|
|
50
|
+
|
|
51
|
+
### High-Level Task (Refactoring a Flow)
|
|
52
|
+
**Example:** "{{EXAMPLE_REFACTOR_TASK}}"
|
|
53
|
+
|
|
54
|
+
**Chain:**
|
|
55
|
+
1. Start: [.ai-context/indexes/workflows/CATEGORY_INDEX.md](./.ai-context/indexes/workflows/CATEGORY_INDEX.md)
|
|
56
|
+
2. Find: Relevant category
|
|
57
|
+
3. Load: Domain index
|
|
58
|
+
4. Detail: Workflow file
|
|
59
|
+
5. Code: [.ai-context/indexes/code/DOMAIN_LAYER_INDEX.md](./.ai-context/indexes/code/DOMAIN_LAYER_INDEX.md)
|
|
60
|
+
6. Implement: Use appropriate specialized agent
|
|
61
|
+
|
|
62
|
+
**Context Budget:** ~40k tokens (20% of 200k window)
|
|
63
|
+
|
|
64
|
+
---
|
|
65
|
+
|
|
66
|
+
### Low-Level Task (Fix Hardcoded Value)
|
|
67
|
+
**Example:** "{{EXAMPLE_LOWLEVEL_TASK}}"
|
|
68
|
+
|
|
69
|
+
**Chain:**
|
|
70
|
+
1. Start: Search Patterns section below
|
|
71
|
+
2. Pattern: Use grep/find
|
|
72
|
+
3. Verify: [.ai-context/indexes/code/REVERSE_INDEXES.md](./.ai-context/indexes/code/REVERSE_INDEXES.md)
|
|
73
|
+
4. Fix: Direct file edits
|
|
74
|
+
5. Validate: Run tests
|
|
75
|
+
|
|
76
|
+
**Context Budget:** ~15k tokens (7.5% of 200k window)
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
### Feature Task (Add New Feature)
|
|
81
|
+
**Example:** "{{EXAMPLE_FEATURE_TASK}}"
|
|
82
|
+
|
|
83
|
+
**Chain:**
|
|
84
|
+
1. Start: [.ai-context/indexes/routing/CATEGORY_INDEX.md](./.ai-context/indexes/routing/CATEGORY_INDEX.md)
|
|
85
|
+
2. Route: [.ai-context/indexes/routing/HIGH_LEVEL_ROUTER.md](./.ai-context/indexes/routing/HIGH_LEVEL_ROUTER.md)
|
|
86
|
+
3. Research: /rpi-research
|
|
87
|
+
4. Plan: /rpi-plan
|
|
88
|
+
5. Implement: /rpi-implement
|
|
89
|
+
|
|
90
|
+
**Context Budget:** ~50k tokens (25% of 200k window)
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Search Patterns
|
|
95
|
+
|
|
96
|
+
### Finding Configuration Values
|
|
97
|
+
|
|
98
|
+
**Environment variables:**
|
|
99
|
+
```bash
|
|
100
|
+
{{CONFIG_SEARCH_PATTERN}}
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
**Hardcoded URLs/domains:**
|
|
104
|
+
```bash
|
|
105
|
+
{{URL_SEARCH_PATTERN}}
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
### Finding Business Logic
|
|
111
|
+
|
|
112
|
+
**Core Files:**
|
|
113
|
+
{{CORE_FILES_LIST}}
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
### Finding Database Schema
|
|
118
|
+
|
|
119
|
+
**Models:** {{MODELS_PATH}}
|
|
120
|
+
**Migrations:** {{MIGRATIONS_PATH}}
|
|
121
|
+
|
|
122
|
+
---
|
|
123
|
+
|
|
124
|
+
### Finding External Integrations
|
|
125
|
+
|
|
126
|
+
{{EXTERNAL_INTEGRATIONS_LIST}}
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## System Architecture Mini-Map
|
|
131
|
+
|
|
132
|
+
{{ARCHITECTURE_DIAGRAM}}
|
|
133
|
+
|
|
134
|
+
---
|
|
135
|
+
|
|
136
|
+
## Index Directory
|
|
137
|
+
|
|
138
|
+
**3-Level Chain:** AI_CONTEXT.md → Category (5) → Domain (15) → Detail (53)
|
|
139
|
+
|
|
140
|
+
**Level 1 - Categories:** [.ai-context/indexes/*/CATEGORY_INDEX.md](./.ai-context/indexes/)
|
|
141
|
+
- Workflows, Code, Search, Agents, Routing
|
|
142
|
+
|
|
143
|
+
**Level 2 - Domains:** [.ai-context/indexes/workflows/*.md](./.ai-context/indexes/workflows/)
|
|
144
|
+
- {{WORKFLOW_DOMAINS_COUNT}} workflow domains, {{CODE_DOMAINS_COUNT}} code domains
|
|
145
|
+
|
|
146
|
+
**Level 3 - Details:** [.ai-context/context/workflows/](./.ai-context/context/workflows/), [.ai-context/agents/](./.ai-context/agents/), [.ai-context/commands/](./.ai-context/commands/)
|
|
147
|
+
- {{WORKFLOWS_COUNT}} workflows, {{AGENTS_COUNT}} agents, {{COMMANDS_COUNT}} commands
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Critical Constants
|
|
152
|
+
|
|
153
|
+
### Domain & URLs
|
|
154
|
+
{{CRITICAL_URLS}}
|
|
155
|
+
|
|
156
|
+
### Business Constants
|
|
157
|
+
{{BUSINESS_CONSTANTS}}
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Quick Reference
|
|
162
|
+
|
|
163
|
+
**Understanding:** [ARCHITECTURE_SNAPSHOT.md](./.ai-context/context/ARCHITECTURE_SNAPSHOT.md), [workflows/CATEGORY_INDEX.md](./.ai-context/indexes/workflows/CATEGORY_INDEX.md), [KNOWN_GOTCHAS.md](./.ai-context/context/KNOWN_GOTCHAS.md)
|
|
164
|
+
|
|
165
|
+
**Implementing:** [workflows/*.md](./.ai-context/context/workflows/), [CODE_TO_WORKFLOW_MAP.md](./.ai-context/context/CODE_TO_WORKFLOW_MAP.md)
|
|
166
|
+
|
|
167
|
+
**Debugging:** {{DEBUGGING_QUICK_REFS}}
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Agent & Command Routing
|
|
172
|
+
|
|
173
|
+
**Agents:** {{AGENT_ROUTING_TABLE}}
|
|
174
|
+
**Full matrix:** [.ai-context/indexes/agents/router.md](./.ai-context/indexes/agents/router.md)
|
|
175
|
+
|
|
176
|
+
**Commands:** /rpi-research, /rpi-plan, /rpi-implement, /verify-docs-current, /validate-all, /help, /collab, /analytics
|
|
177
|
+
**All commands:** [.ai-context/commands/](./.ai-context/commands/)
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## Gotcha Quick Reference
|
|
182
|
+
|
|
183
|
+
### {{GOTCHA_CATEGORY_1}}
|
|
184
|
+
{{GOTCHA_1_ITEMS}}
|
|
185
|
+
|
|
186
|
+
### {{GOTCHA_CATEGORY_2}}
|
|
187
|
+
{{GOTCHA_2_ITEMS}}
|
|
188
|
+
|
|
189
|
+
**Full gotchas:** [.ai-context/context/KNOWN_GOTCHAS.md](./.ai-context/context/KNOWN_GOTCHAS.md)
|
|
190
|
+
|
|
191
|
+
---
|
|
192
|
+
|
|
193
|
+
## Documentation System
|
|
194
|
+
|
|
195
|
+
**Navigation:** 3-level chain (AI_CONTEXT.md → Category → Domain → Detail)
|
|
196
|
+
**Self-maintaining:** CODE_TO_WORKFLOW_MAP.md guides updates after code changes
|
|
197
|
+
**Validation:** Run /verify-docs-current [file_path] after modifications
|
|
198
|
+
**RPI Workflow:** /rpi-research → /rpi-plan → /rpi-implement
|
|
199
|
+
|
|
200
|
+
**See:** [.ai-context/RPI_WORKFLOW_PLAN.md](./.ai-context/RPI_WORKFLOW_PLAN.md), [.ai-context/README.md](./.ai-context/README.md)
|
|
201
|
+
|
|
202
|
+
---
|
|
203
|
+
|
|
204
|
+
## Production
|
|
205
|
+
|
|
206
|
+
**Platform:** {{PRODUCTION_PLATFORM}}
|
|
207
|
+
**Services:** {{PRODUCTION_SERVICES}}
|
|
208
|
+
**Monitoring:** {{MONITORING_COMMANDS}}
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Key Constraints
|
|
213
|
+
|
|
214
|
+
**Migrations:** {{MIGRATION_CONSTRAINTS}}
|
|
215
|
+
**Testing:** {{TESTING_CONSTRAINTS}}
|
|
216
|
+
**Security:** {{SECURITY_CONSTRAINTS}}
|
|
217
|
+
|
|
218
|
+
---
|
|
219
|
+
|
|
220
|
+
## Maintenance
|
|
221
|
+
|
|
222
|
+
**After changes:** Check CODE_TO_WORKFLOW_MAP.md → Update workflows → Run /verify-docs-current
|
|
223
|
+
**Docs hub:** [.ai-context/README.md](./.ai-context/README.md)
|
|
224
|
+
**RPI:** [.ai-context/RPI_WORKFLOW_PLAN.md](./.ai-context/RPI_WORKFLOW_PLAN.md)
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## AI Tools Configuration
|
|
229
|
+
|
|
230
|
+
This context is optimized for:
|
|
231
|
+
- **Claude Code** - Full context reading
|
|
232
|
+
- **GitHub Copilot** - See `.github/copilot-instructions.md`
|
|
233
|
+
- **Cline** - See `.clinerules`
|
|
234
|
+
- **Antigravity** - See `.agent/` directory
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Contact
|
|
239
|
+
|
|
240
|
+
{{CONTACT_INFO}}
|
|
241
|
+
|
|
242
|
+
---
|
|
243
|
+
|
|
244
|
+
**Version:** 2.0 | **Last Updated:** {{DATE}} | **Context Target:** 200k
|
|
245
|
+
**Architecture:** 3-Level Chain-of-Index | **Index Files:** {{INDEX_FILES_COUNT}}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# .claude Configuration - {{PROJECT_NAME}}
|
|
2
|
+
|
|
3
|
+
This directory contains a comprehensive context engineering system for the {{PROJECT_NAME}} repository.
|
|
4
|
+
|
|
5
|
+
**Configuration Summary**:
|
|
6
|
+
- **Agents**: {{AGENTS_COUNT}} specialized agents (workflow-aligned)
|
|
7
|
+
- **Commands**: {{COMMANDS_COUNT}} custom commands
|
|
8
|
+
- **Workflows**: {{WORKFLOWS_COUNT}} documented workflows
|
|
9
|
+
- **Context Budget**: 200k tokens max, target <40% utilization
|
|
10
|
+
- **Output Budget**: 30k tokens max per response
|
|
11
|
+
- **Last Updated**: {{DATE}}
|
|
12
|
+
|
|
13
|
+
**System Benefits**:
|
|
14
|
+
- <40% context utilization (vs 60%+ without this system)
|
|
15
|
+
- 10× faster issue resolution with pre-computed knowledge
|
|
16
|
+
- Self-maintaining documentation (zero drift)
|
|
17
|
+
- Proactive bug discovery through validation
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Table of Contents
|
|
22
|
+
|
|
23
|
+
1. [Agent Architecture](#agent-architecture)
|
|
24
|
+
2. [Custom Commands](#custom-commands)
|
|
25
|
+
3. [Context Documentation](#context-documentation)
|
|
26
|
+
4. [RPI Workflow](#rpi-workflow)
|
|
27
|
+
5. [Quick Start Guide](#quick-start-guide)
|
|
28
|
+
6. [Self-Maintaining Documentation](#self-maintaining-documentation)
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## Agent Architecture
|
|
33
|
+
|
|
34
|
+
### Specialized Agents (Workflow-Aligned)
|
|
35
|
+
|
|
36
|
+
| Agent | Primary Workflows | Use For |
|
|
37
|
+
|-------|------------------|---------|
|
|
38
|
+
| `context-engineer` | INITIALIZATION | Transform this template for any codebase |
|
|
39
|
+
| {{AGENT_TABLE_ROWS}} |
|
|
40
|
+
|
|
41
|
+
**Agent Location:** `.ai-context/agents/*.md`
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## Custom Commands
|
|
46
|
+
|
|
47
|
+
### RPI Workflow Commands (3)
|
|
48
|
+
| Command | Description |
|
|
49
|
+
|---------|-------------|
|
|
50
|
+
| `/rpi-research` | Research phase - codebase exploration |
|
|
51
|
+
| `/rpi-plan` | Plan phase - implementation blueprint |
|
|
52
|
+
| `/rpi-implement` | Implement phase - execution with doc updates |
|
|
53
|
+
|
|
54
|
+
### Validation Commands
|
|
55
|
+
| Command | Description |
|
|
56
|
+
|---------|-------------|
|
|
57
|
+
| `/validate-all` | Complete validation suite |
|
|
58
|
+
| `/verify-docs-current` | Documentation freshness validation |
|
|
59
|
+
|
|
60
|
+
### System Commands (NEW in v1.1)
|
|
61
|
+
| Command | Description |
|
|
62
|
+
|---------|-------------|
|
|
63
|
+
| `/help` | Comprehensive help system |
|
|
64
|
+
| `/collab` | Team collaboration (handoffs, sync) |
|
|
65
|
+
| `/analytics` | Local usage statistics |
|
|
66
|
+
|
|
67
|
+
**Command Location:** `.ai-context/commands/*.md`
|
|
68
|
+
|
|
69
|
+
---
|
|
70
|
+
|
|
71
|
+
## Context Documentation
|
|
72
|
+
|
|
73
|
+
### 3-Level Chain-of-Index Architecture
|
|
74
|
+
|
|
75
|
+
**Purpose:** Minimize context usage through progressive loading
|
|
76
|
+
|
|
77
|
+
**Level 1 - Category Indexes (5 files in `indexes/`):**
|
|
78
|
+
| Category | Purpose | Load When |
|
|
79
|
+
|----------|---------|-----------|
|
|
80
|
+
| `workflows/CATEGORY_INDEX.md` | Workflow categories | Starting workflow task |
|
|
81
|
+
| `code/CATEGORY_INDEX.md` | Domain × Layer overview | Finding code files |
|
|
82
|
+
| `search/CATEGORY_INDEX.md` | Search strategies | Low-level debugging |
|
|
83
|
+
| `agents/CATEGORY_INDEX.md` | Agent selection matrix | Choosing agent |
|
|
84
|
+
| `routing/CATEGORY_INDEX.md` | Task routing | Classifying task type |
|
|
85
|
+
|
|
86
|
+
**Level 2 - Domain Indexes:** See `indexes/workflows/*.md`, `indexes/code/*.md`
|
|
87
|
+
|
|
88
|
+
**Level 3 - Detail Files:** workflows/, agents/, commands/
|
|
89
|
+
|
|
90
|
+
### Pre-Computed Knowledge
|
|
91
|
+
|
|
92
|
+
| File | Purpose |
|
|
93
|
+
|------|---------|
|
|
94
|
+
| `ARCHITECTURE_SNAPSHOT.md` | High-level system map |
|
|
95
|
+
| `FILE_OWNERSHIP.md` | What each file does |
|
|
96
|
+
| `INTEGRATION_POINTS.md` | External APIs |
|
|
97
|
+
| `KNOWN_GOTCHAS.md` | Documented fixes and lessons |
|
|
98
|
+
| `TESTING_MAP.md` | Test coverage mapping |
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## RPI Workflow
|
|
103
|
+
|
|
104
|
+
**Research-Plan-Implement** methodology for structured development.
|
|
105
|
+
|
|
106
|
+
### Phases
|
|
107
|
+
|
|
108
|
+
1. **RESEARCH** (`/rpi-research`)
|
|
109
|
+
- Use sub-agents to investigate
|
|
110
|
+
- Output: Research document in `research/active/`
|
|
111
|
+
- Context budget: 25-30%
|
|
112
|
+
|
|
113
|
+
2. **PLAN** (`/rpi-plan`)
|
|
114
|
+
- Create implementation blueprint with file:line precision
|
|
115
|
+
- Output: Plan document in `plans/active/`
|
|
116
|
+
- Context budget: 20-25%
|
|
117
|
+
|
|
118
|
+
3. **IMPLEMENT** (`/rpi-implement`)
|
|
119
|
+
- Execute with atomic changes
|
|
120
|
+
- ONE CHANGE → ONE TEST → ONE COMMIT
|
|
121
|
+
- Update documentation (mandatory)
|
|
122
|
+
- Context budget: 30-40%
|
|
123
|
+
|
|
124
|
+
### Directory Structure
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
.ai-context/
|
|
128
|
+
├── research/
|
|
129
|
+
│ ├── active/ # Current research
|
|
130
|
+
│ ├── completed/ # Archived research
|
|
131
|
+
│ └── RESEARCH_TEMPLATE.md
|
|
132
|
+
├── plans/
|
|
133
|
+
│ ├── active/ # Current plans
|
|
134
|
+
│ ├── completed/ # Archived plans
|
|
135
|
+
│ └── PLAN_TEMPLATE.md
|
|
136
|
+
├── context/
|
|
137
|
+
│ ├── WORKFLOW_INDEX.md # Primary entry point
|
|
138
|
+
│ ├── CODE_TO_WORKFLOW_MAP.md
|
|
139
|
+
│ └── workflows/ # Workflow detail files
|
|
140
|
+
├── indexes/
|
|
141
|
+
│ ├── workflows/ # Workflow category indexes
|
|
142
|
+
│ ├── code/ # Code domain indexes
|
|
143
|
+
│ ├── agents/ # Agent selection indexes
|
|
144
|
+
│ ├── routing/ # Task routing indexes
|
|
145
|
+
│ └── search/ # Search pattern indexes
|
|
146
|
+
├── agents/ # Specialized agent definitions
|
|
147
|
+
├── commands/ # Custom command definitions
|
|
148
|
+
├── tools/ # CLI tooling (NEW v1.1)
|
|
149
|
+
├── schemas/ # JSON validation schemas (NEW v1.1)
|
|
150
|
+
├── config/ # Environment configurations (NEW v1.1)
|
|
151
|
+
├── team/ # Team collaboration config (NEW v1.1)
|
|
152
|
+
├── knowledge/ # Shared knowledge base (NEW v1.1)
|
|
153
|
+
├── standards/ # Community standards (NEW v1.1)
|
|
154
|
+
└── ci-templates/ # CI/CD workflow templates (NEW v1.1)
|
|
155
|
+
```
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Quick Start Guide
|
|
160
|
+
|
|
161
|
+
### 1. Session Initialization
|
|
162
|
+
```bash
|
|
163
|
+
# Load workflow index (~15k tokens)
|
|
164
|
+
Read: .ai-context/context/WORKFLOW_INDEX.md
|
|
165
|
+
|
|
166
|
+
# Load specific workflows as needed (~20-50k each)
|
|
167
|
+
Read: .ai-context/context/workflows/[relevant_workflow].md
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
### 2. Debugging an Issue
|
|
171
|
+
```
|
|
172
|
+
1. Scan WORKFLOW_INDEX.md → Find relevant workflow
|
|
173
|
+
2. Load workflow file → Get file:line references
|
|
174
|
+
3. Fix issue with complete context
|
|
175
|
+
4. Update documentation (CODE_TO_WORKFLOW_MAP guides)
|
|
176
|
+
5. Run /verify-docs-current
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### 3. Implementing a Feature
|
|
180
|
+
```
|
|
181
|
+
1. Run /rpi-research → Explore codebase
|
|
182
|
+
2. Run /rpi-plan → Create implementation blueprint
|
|
183
|
+
3. Run /rpi-implement → Execute with doc updates
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## Self-Maintaining Documentation
|
|
189
|
+
|
|
190
|
+
### Automatic Documentation Updates
|
|
191
|
+
|
|
192
|
+
After every code change, update documentation:
|
|
193
|
+
|
|
194
|
+
1. Check `CODE_TO_WORKFLOW_MAP.md` for affected workflows
|
|
195
|
+
2. Update workflow files with new line numbers
|
|
196
|
+
3. Verify function signatures match code
|
|
197
|
+
4. Update diagrams if state machine changed
|
|
198
|
+
5. Run `/verify-docs-current` for validation
|
|
199
|
+
6. Commit documentation updates with code changes
|
|
200
|
+
|
|
201
|
+
### Post-Implementation Checklist (Embedded in All Agents)
|
|
202
|
+
|
|
203
|
+
```markdown
|
|
204
|
+
## Post-Implementation Checklist
|
|
205
|
+
|
|
206
|
+
**MANDATORY:** After making ANY code changes, update documentation.
|
|
207
|
+
|
|
208
|
+
1. Check CODE_TO_WORKFLOW_MAP.md for affected workflows
|
|
209
|
+
2. Update workflows with new line numbers
|
|
210
|
+
3. Verify function signatures match
|
|
211
|
+
4. Run /verify-docs-current
|
|
212
|
+
5. Commit doc updates with code changes
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Context Budget Limits
|
|
218
|
+
|
|
219
|
+
**Hard Caps (Non-Negotiable):**
|
|
220
|
+
- **Maximum Context:** 200,000 tokens
|
|
221
|
+
- **Maximum Output:** 30,000 tokens per response
|
|
222
|
+
- **Target Utilization:** <40% (80,000 tokens)
|
|
223
|
+
- **Compaction Trigger:** 35% (70,000 tokens)
|
|
224
|
+
|
|
225
|
+
**Budget Allocation:**
|
|
226
|
+
```
|
|
227
|
+
Workflow Indexes: ~15k tokens (7.5%)
|
|
228
|
+
Workflow Details: ~40k tokens (20%)
|
|
229
|
+
Active Code: ~30k tokens (15%)
|
|
230
|
+
Tool Results: ~15k tokens (7.5%)
|
|
231
|
+
─────────────────────────────────────────
|
|
232
|
+
Typical Session: ~100k tokens (50%)
|
|
233
|
+
Buffer: ~100k tokens (50%)
|
|
234
|
+
```
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Initialization
|
|
239
|
+
|
|
240
|
+
To transform this template for your codebase, use:
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
@context-engineer "Initialize context engineering for this repository"
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
This agent will:
|
|
247
|
+
1. Analyze your codebase structure
|
|
248
|
+
2. Identify major workflows (8-15)
|
|
249
|
+
3. Create workflow documentation
|
|
250
|
+
4. Set up index hierarchy
|
|
251
|
+
5. Configure specialized agents
|
|
252
|
+
6. Validate the system
|
|
253
|
+
|
|
254
|
+
---
|
|
255
|
+
|
|
256
|
+
*Configuration updated: {{DATE}}*
|
|
257
|
+
*Version: 1.2.0 (Template)*
|