contextos-agents 2.2.0 → 2.3.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 (109) hide show
  1. package/.agents/AGENTS.md +53 -396
  2. package/.agents/adapters/aider/export.js +11 -16
  3. package/.agents/adapters/claude/export.js +13 -13
  4. package/.agents/adapters/copilot/export.js +29 -8
  5. package/.agents/adapters/cursor/export.js +9 -18
  6. package/.agents/adapters/gemini/export.js +11 -46
  7. package/.agents/adapters/pure-compiler.js +65 -42
  8. package/.agents/adapters/shared.js +35 -1
  9. package/.agents/adapters/zed/export.js +2 -2
  10. package/.agents/compiled/registry.v2.json +30 -18
  11. package/.agents/compiled/registry.v2.sha256 +1 -1
  12. package/.agents/compiler/manifest-compiler.js +5 -29
  13. package/.agents/core/skills/context-os/references/project-graph.md +3 -3
  14. package/.agents/core/skills/engineering-workflow/SKILL.md +11 -316
  15. package/.agents/core/skills/engineering-workflow/references/workflow.md +336 -0
  16. package/.agents/core/skills/engineering-workflow/skill.yaml +2 -4
  17. package/.agents/core/skills/gstack-roles/SKILL.md +11 -128
  18. package/.agents/core/skills/gstack-roles/references/roles.md +149 -0
  19. package/.agents/core/skills/gstack-roles/skill.yaml +2 -4
  20. package/.agents/core/skills/ponytail-mindset/SKILL.md +13 -165
  21. package/.agents/core/skills/ponytail-mindset/references/minimalism.md +186 -0
  22. package/.agents/core/skills/ponytail-mindset/skill.yaml +2 -5
  23. package/.agents/core/skills/security/skill.yaml +1 -0
  24. package/.agents/ctx.js +13 -13
  25. package/.agents/customization-dx.js +13 -9
  26. package/.agents/doctor.js +2 -2
  27. package/.agents/generated/claude/skills/context-manager/EXAMPLES.md +19 -0
  28. package/.agents/generated/claude/skills/context-manager/SKILL.md +0 -29
  29. package/.agents/generated/claude/skills/context-manager/TROUBLESHOOTING.md +7 -0
  30. package/.agents/generated/claude/skills/context-manager/VALIDATION.json +12 -0
  31. package/.agents/generated/claude/skills/context-manager/references/context-rules.md +59 -0
  32. package/.agents/generated/claude/skills/context-os/EXAMPLES.md +21 -0
  33. package/.agents/generated/claude/skills/context-os/SKILL.md +0 -31
  34. package/.agents/generated/claude/skills/context-os/TROUBLESHOOTING.md +7 -0
  35. package/.agents/generated/claude/skills/context-os/VALIDATION.json +12 -0
  36. package/.agents/generated/claude/skills/context-os/packs.yaml +59 -0
  37. package/.agents/generated/claude/skills/context-os/references/context-rules.md +68 -0
  38. package/.agents/generated/claude/skills/context-os/references/pipeline.md +119 -0
  39. package/.agents/generated/claude/skills/context-os/references/project-graph.md +103 -0
  40. package/.agents/generated/claude/skills/context-os/rules.yaml +135 -0
  41. package/.agents/generated/claude/skills/engineering-workflow/EXAMPLES.md +57 -0
  42. package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +10 -391
  43. package/.agents/generated/claude/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  44. package/.agents/generated/claude/skills/engineering-workflow/VALIDATION.json +12 -0
  45. package/.agents/generated/claude/skills/engineering-workflow/references/workflow.md +336 -0
  46. package/.agents/generated/claude/skills/gemini-precision/EXAMPLES.md +72 -0
  47. package/.agents/generated/claude/skills/gemini-precision/SKILL.md +0 -100
  48. package/.agents/generated/claude/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  49. package/.agents/generated/claude/skills/gemini-precision/VALIDATION.json +12 -0
  50. package/.agents/generated/claude/skills/gstack-roles/EXAMPLES.md +23 -0
  51. package/.agents/generated/claude/skills/gstack-roles/SKILL.md +10 -164
  52. package/.agents/generated/claude/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  53. package/.agents/generated/claude/skills/gstack-roles/VALIDATION.json +12 -0
  54. package/.agents/generated/claude/skills/gstack-roles/references/roles.md +149 -0
  55. package/.agents/generated/claude/skills/ponytail-mindset/EXAMPLES.md +45 -0
  56. package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +12 -228
  57. package/.agents/generated/claude/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  58. package/.agents/generated/claude/skills/ponytail-mindset/VALIDATION.json +12 -0
  59. package/.agents/generated/claude/skills/ponytail-mindset/references/minimalism.md +186 -0
  60. package/.agents/generated/claude/skills/security/EXAMPLES.md +64 -0
  61. package/.agents/generated/claude/skills/security/SKILL.md +0 -86
  62. package/.agents/generated/claude/skills/security/TROUBLESHOOTING.md +19 -0
  63. package/.agents/generated/claude/skills/security/VALIDATION.json +12 -0
  64. package/.agents/generated/gemini/skills/context-manager/EXAMPLES.md +19 -0
  65. package/.agents/generated/gemini/skills/context-manager/SKILL.md +1 -33
  66. package/.agents/generated/gemini/skills/context-manager/TROUBLESHOOTING.md +7 -0
  67. package/.agents/generated/gemini/skills/context-manager/VALIDATION.json +12 -0
  68. package/.agents/generated/gemini/skills/context-manager/references/context-rules.md +59 -0
  69. package/.agents/generated/gemini/skills/context-os/EXAMPLES.md +21 -0
  70. package/.agents/generated/gemini/skills/context-os/SKILL.md +0 -35
  71. package/.agents/generated/gemini/skills/context-os/TROUBLESHOOTING.md +7 -0
  72. package/.agents/generated/gemini/skills/context-os/VALIDATION.json +12 -0
  73. package/.agents/generated/gemini/skills/context-os/packs.yaml +59 -0
  74. package/.agents/generated/gemini/skills/context-os/references/context-rules.md +68 -0
  75. package/.agents/generated/gemini/skills/context-os/references/pipeline.md +119 -0
  76. package/.agents/generated/gemini/skills/context-os/references/project-graph.md +103 -0
  77. package/.agents/generated/gemini/skills/context-os/rules.yaml +135 -0
  78. package/.agents/generated/gemini/skills/engineering-workflow/EXAMPLES.md +57 -0
  79. package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +11 -396
  80. package/.agents/generated/gemini/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
  81. package/.agents/generated/gemini/skills/engineering-workflow/VALIDATION.json +12 -0
  82. package/.agents/generated/gemini/skills/engineering-workflow/references/workflow.md +336 -0
  83. package/.agents/generated/gemini/skills/gemini-precision/EXAMPLES.md +72 -0
  84. package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +0 -104
  85. package/.agents/generated/gemini/skills/gemini-precision/TROUBLESHOOTING.md +25 -0
  86. package/.agents/generated/gemini/skills/gemini-precision/VALIDATION.json +12 -0
  87. package/.agents/generated/gemini/skills/gstack-roles/EXAMPLES.md +23 -0
  88. package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +11 -169
  89. package/.agents/generated/gemini/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
  90. package/.agents/generated/gemini/skills/gstack-roles/VALIDATION.json +12 -0
  91. package/.agents/generated/gemini/skills/gstack-roles/references/roles.md +149 -0
  92. package/.agents/generated/gemini/skills/ponytail-mindset/EXAMPLES.md +45 -0
  93. package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +13 -233
  94. package/.agents/generated/gemini/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
  95. package/.agents/generated/gemini/skills/ponytail-mindset/VALIDATION.json +12 -0
  96. package/.agents/generated/gemini/skills/ponytail-mindset/references/minimalism.md +186 -0
  97. package/.agents/generated/gemini/skills/security/EXAMPLES.md +64 -0
  98. package/.agents/generated/gemini/skills/security/SKILL.md +2 -92
  99. package/.agents/generated/gemini/skills/security/TROUBLESHOOTING.md +19 -0
  100. package/.agents/generated/gemini/skills/security/VALIDATION.json +12 -0
  101. package/.agents/plugins.js +24 -5
  102. package/.agents/resolver/canonical-resolver.js +43 -7
  103. package/.agents/resolver/resolve-args.js +31 -0
  104. package/.agents/stats.js +8 -11
  105. package/.agents/workspace/workspace-graph.js +16 -6
  106. package/README.md +48 -18
  107. package/bin/index.js +1 -1
  108. package/bin/lib/ui.js +2 -2
  109. package/package.json +89 -86
@@ -0,0 +1,19 @@
1
+ # context-manager Examples — Anti-patterns vs ContextOS Standard
2
+
3
+ ## Example 1: Context Selection
4
+
5
+ ### Anti-pattern: Context Window Dumping
6
+
7
+ ```text
8
+ Agent reads all 180 files in src/ into context to debug a single button click handler.
9
+ Result: Exhausts 150k tokens, reaches rate limits, and forgets user instructions.
10
+ ```
11
+
12
+ ### Best practice: ContextOS Standard (Targeted AST Traversal)
13
+
14
+ ```text
15
+ 1. Inspect package.json and AGENTS.md.
16
+ 2. Grep for target symbol: grep_search for 'SubmitButton'.
17
+ 3. Read ONLY components/SubmitButton.tsx and its direct import types/button.ts.
18
+ Total tokens used: <1,500 tokens. Fast, accurate, zero hallucinations.
19
+ ```
@@ -2,6 +2,7 @@
2
2
  name: context-manager
3
3
  description: >
4
4
  Smart context selection engine. Analyzes the current task, consults the Project Graph, and returns only the documents and skills needed to prevent token overflow.
5
+
5
6
  ---
6
7
  # context-manager
7
8
 
@@ -121,36 +122,3 @@ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
121
122
  ## Integration Notes
122
123
 
123
124
  How this skill interacts with other skills.
124
-
125
-
126
- <!-- Source: EXAMPLES.md -->
127
-
128
- # context-manager Examples — Anti-patterns vs ContextOS Standard
129
-
130
- ## Example 1: Context Selection
131
-
132
- ### Anti-pattern: Context Window Dumping
133
-
134
- ```text
135
- Agent reads all 180 files in src/ into context to debug a single button click handler.
136
- Result: Exhausts 150k tokens, reaches rate limits, and forgets user instructions.
137
- ```
138
-
139
- ### Best practice: ContextOS Standard (Targeted AST Traversal)
140
-
141
- ```text
142
- 1. Inspect package.json and AGENTS.md.
143
- 2. Grep for target symbol: grep_search for 'SubmitButton'.
144
- 3. Read ONLY components/SubmitButton.tsx and its direct import types/button.ts.
145
- Total tokens used: <1,500 tokens. Fast, accurate, zero hallucinations.
146
- ```
147
-
148
- <!-- Source: TROUBLESHOOTING.md -->
149
-
150
- # context-manager Troubleshooting & Common Mistakes
151
-
152
- ## 1. Token Budget Blowout
153
-
154
- - **Symptom**: Model performance drops significantly, losing earlier conversational context.
155
- - **Root Cause**: Loading large JSON mocks, lockfiles, or build directories into prompt.
156
- - **Fix**: Never read package-lock.json, dist/, or build artifacts unless explicitly debugging bundle outputs.
@@ -0,0 +1,7 @@
1
+ # context-manager Troubleshooting & Common Mistakes
2
+
3
+ ## 1. Token Budget Blowout
4
+
5
+ - **Symptom**: Model performance drops significantly, losing earlier conversational context.
6
+ - **Root Cause**: Loading large JSON mocks, lockfiles, or build directories into prompt.
7
+ - **Fix**: Never read package-lock.json, dist/, or build artifacts unless explicitly debugging bundle outputs.
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "rules_followed": {
6
+ "type": "boolean"
7
+ }
8
+ },
9
+ "required": [
10
+ "rules_followed"
11
+ ]
12
+ }
@@ -0,0 +1,59 @@
1
+ # Context Loading Rules
2
+
3
+ Guidelines and deterministic decision tables for selecting, prioritizing, and budgeting context during AI agent execution.
4
+
5
+ ## Task Type to Document Mapping
6
+
7
+ | Task Type | Level 1 (Always) | Level 2 (If exists) | Level 3 (Per task) |
8
+ | --- | --- | --- | --- |
9
+ | **New project** | PRD, ROADMAP | ARCHITECTURE, DATABASE, API | UI, TASKS, all relevant skills |
10
+ | **New feature** | PRD | ARCHITECTURE, API | PROJECT_GRAPH, relevant skills |
11
+ | **Frontend** | — | ARCHITECTURE, API | UI, frontend skills |
12
+ | **Backend** | — | ARCHITECTURE, DATABASE, API | backend skills |
13
+ | **Database** | — | ARCHITECTURE, DATABASE | — |
14
+ | **Bugfix** | — | — | PROJECT_GRAPH (affected module only) |
15
+ | **Refactor** | — | ARCHITECTURE | PROJECT_GRAPH, affected skills |
16
+ | **Review** | PRD | ARCHITECTURE | TASKS, all loaded skills |
17
+ | **Deploy** | — | ARCHITECTURE | DEPLOYMENT, infrastructure skills |
18
+
19
+ ## Skill Category to Document Mapping
20
+
21
+ | Skill Category | Required Documents | Optional Documents |
22
+ | --- | --- | --- |
23
+ | `frontend` | UI.md, API.md | ARCHITECTURE.md |
24
+ | `backend` | API.md, DATABASE.md | ARCHITECTURE.md |
25
+ | `design` | UI.md | PRD.md |
26
+ | `architecture` | ARCHITECTURE.md, DATABASE.md | PRD.md, API.md |
27
+ | `infrastructure` | ARCHITECTURE.md | — |
28
+ | `security` | ARCHITECTURE.md, API.md | DATABASE.md |
29
+ | `testing` | API.md | ARCHITECTURE.md |
30
+
31
+ ## Context Budgeting
32
+
33
+ To prevent context window saturation and retain maximum LLM reasoning capacity, adhere strictly to the following 4-tier token budget:
34
+
35
+ | Priority Level | Max Tokens | Contents |
36
+ | --- | --- | --- |
37
+ | 1 (Critical) | 2,000 | Current task description, active brief, and primary skill rules |
38
+ | 2 (Important) | 3,000 | System architecture and API contracts for affected modules |
39
+ | 3 (Context) | 2,000 | Architectural Decision Records (ADRs) and relevant graph nodes |
40
+ | 4 (Background) | 1,000 | PRD summary and global project conventions |
41
+
42
+ **Total target context budget: ~8,000 tokens per subtask.**
43
+
44
+ ### Degradation Strategy When Over Budget
45
+
46
+ If accumulated context exceeds the 8,000 token limit:
47
+
48
+ 1. **Trim Level 1 documents** to high-level executive summaries.
49
+ 2. **Slice Level 2 documents** to extract only sections matching touched module signatures.
50
+ 3. **Preserve Level 3 skills** at full fidelity, as they contain non-negotiable operational instructions and validation guardrails.
51
+
52
+ ## Module-Based Filtering via Dependency Graph
53
+
54
+ When `PROJECT_GRAPH.md` or `.graphify/graph.json` is present, traverse dependency edges to filter candidate documents:
55
+
56
+ 1. Identify the primary module for the task from the symbol/path mapping.
57
+ 2. Resolve immediate inbound and outbound dependencies (`dependencies` and `dependents`).
58
+ 3. Include documents solely for the identified module and its immediate dependencies.
59
+ 4. Exclude orthogonal domain documents (for example, omit database schemas during purely presentation-layer CSS/layout tasks).
@@ -0,0 +1,21 @@
1
+ # context-os Examples — Anti-patterns vs ContextOS Standard
2
+
3
+ ## Example 1: Project Lifecycle Management
4
+
5
+ ### Anti-pattern: Ad-hoc Unstructured Development
6
+
7
+ ```text
8
+ Coding -> Modifying DB -> Debugging -> Redesigning UI -> Changing Architecture
9
+ All in one unstructured stream of consciousness.
10
+ ```
11
+
12
+ ### Best practice: ContextOS Standard (Phase-Gated Development)
13
+
14
+ ```text
15
+ Phase 1: DEFINE (PRD & Requirements)
16
+ Phase 2: PLAN (Atomic Tasks & ADRs)
17
+ Phase 3: BUILD (TDD & Minimalist Implementation)
18
+ Phase 4: VERIFY (Automated Test Proof)
19
+ Phase 5: REVIEW (Design QA & Code Review)
20
+ Phase 6: SHIP (Production Release)
21
+ ```
@@ -160,38 +160,3 @@ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
160
160
  ## Integration Notes
161
161
 
162
162
  How this skill interacts with other skills.
163
-
164
-
165
- <!-- Source: EXAMPLES.md -->
166
-
167
- # context-os Examples — Anti-patterns vs ContextOS Standard
168
-
169
- ## Example 1: Project Lifecycle Management
170
-
171
- ### Anti-pattern: Ad-hoc Unstructured Development
172
-
173
- ```text
174
- Coding -> Modifying DB -> Debugging -> Redesigning UI -> Changing Architecture
175
- All in one unstructured stream of consciousness.
176
- ```
177
-
178
- ### Best practice: ContextOS Standard (Phase-Gated Development)
179
-
180
- ```text
181
- Phase 1: DEFINE (PRD & Requirements)
182
- Phase 2: PLAN (Atomic Tasks & ADRs)
183
- Phase 3: BUILD (TDD & Minimalist Implementation)
184
- Phase 4: VERIFY (Automated Test Proof)
185
- Phase 5: REVIEW (Design QA & Code Review)
186
- Phase 6: SHIP (Production Release)
187
- ```
188
-
189
- <!-- Source: TROUBLESHOOTING.md -->
190
-
191
- # context-os Troubleshooting & Common Mistakes
192
-
193
- ## 1. Stale Compiled Artifacts
194
-
195
- - **Symptom**: Editor rules don't reflect newly updated skills.
196
- - **Root Cause**: Modifying .agents/core/skills/ without recompiling exports.
197
- - **Fix**: Run node .agents/ctx.js export all whenever source skills are updated.
@@ -0,0 +1,7 @@
1
+ # context-os Troubleshooting & Common Mistakes
2
+
3
+ ## 1. Stale Compiled Artifacts
4
+
5
+ - **Symptom**: Editor rules don't reflect newly updated skills.
6
+ - **Root Cause**: Modifying .agents/core/skills/ without recompiling exports.
7
+ - **Fix**: Run node .agents/ctx.js export all whenever source skills are updated.
@@ -0,0 +1,12 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema#",
3
+ "type": "object",
4
+ "properties": {
5
+ "rules_followed": {
6
+ "type": "boolean"
7
+ }
8
+ },
9
+ "required": [
10
+ "rules_followed"
11
+ ]
12
+ }
@@ -0,0 +1,59 @@
1
+ # Skill Packs — pre-configured skill bundles
2
+ # Users select a pack instead of individual skills
3
+
4
+ packs:
5
+ fullstack-next:
6
+ name: "Next.js Full-Stack"
7
+ description: "Full-stack web app with Next.js, React, TypeScript, Tailwind, Prisma"
8
+ skills: [nextjs, react, typescript, tailwind, prisma, testing, security]
9
+ profile: startup
10
+ generates: [PRD, ARCHITECTURE, DATABASE, API, UI, TASKS, PROJECT_GRAPH]
11
+
12
+ fastapi-backend:
13
+ name: "FastAPI Backend"
14
+ description: "Python backend with FastAPI, PostgreSQL, Docker"
15
+ skills: [fastapi, python, pydantic, postgres, docker, testing, security, rest]
16
+ profile: startup
17
+ generates: [PRD, ARCHITECTURE, DATABASE, API, TASKS, PROJECT_GRAPH]
18
+
19
+ react-spa:
20
+ name: "React SPA"
21
+ description: "Single Page Application with React, TypeScript, Tailwind"
22
+ skills: [react, typescript, tailwind, performance, web-accessibility, testing]
23
+ profile: startup
24
+ generates: [PRD, ARCHITECTURE, API, UI, TASKS, PROJECT_GRAPH]
25
+
26
+ nestjs-enterprise:
27
+ name: "NestJS Enterprise"
28
+ description: "Enterprise-grade Node.js backend with NestJS, DDD, full testing"
29
+ skills: [nestjs, typescript, node, postgres, ddd, security, testing, cicd, docker]
30
+ profile: enterprise
31
+ generates: [PRD, ARCHITECTURE, DATABASE, API, TASKS, ROADMAP, PROJECT_GRAPH]
32
+
33
+ design-system:
34
+ name: "Design System"
35
+ description: "UI/UX design system with accessibility and performance"
36
+ skills: [ui-design, ux-design, web-accessibility, performance]
37
+ profile: startup
38
+ generates: [PRD, UI, TASKS]
39
+
40
+ mobile-react-native:
41
+ name: "React Native Mobile"
42
+ description: "Cross-platform mobile app with React Native"
43
+ skills: [react, typescript, react-native, performance, web-accessibility]
44
+ profile: startup
45
+ generates: [PRD, ARCHITECTURE, API, UI, TASKS, PROJECT_GRAPH]
46
+
47
+ hackathon-fast:
48
+ name: "Hackathon Quick Start"
49
+ description: "Fastest possible setup — SQLite, minimal architecture"
50
+ skills: [react, typescript, node, sqlite]
51
+ profile: hackathon
52
+ generates: [TASKS, PROJECT_GRAPH]
53
+
54
+ ai-saas:
55
+ name: "AI SaaS Platform"
56
+ description: "SaaS with AI features, auth, payments, analytics"
57
+ skills: [nextjs, react, typescript, tailwind, prisma, security, stripe, openai]
58
+ profile: startup
59
+ generates: [PRD, ARCHITECTURE, DATABASE, API, UI, ROADMAP, TASKS, PROJECT_GRAPH]
@@ -0,0 +1,68 @@
1
+ # Context Loading Rules
2
+
3
+ ## Task Type → Document Mapping
4
+
5
+ | Task Type | Level 1 (Always) | Level 2 (If exists) | Level 3 (Per task) |
6
+ | --- | --- | --- | --- |
7
+ | **New project** | PRD, ROADMAP | ARCHITECTURE, DATABASE, API | UI, TASKS, all relevant skills |
8
+ | **New feature** | PRD | ARCHITECTURE, API | PROJECT_GRAPH, relevant skills |
9
+ | **Frontend** | — | ARCHITECTURE, API | UI, frontend skills |
10
+ | **Backend** | — | ARCHITECTURE, DATABASE, API | backend skills |
11
+ | **Database** | — | ARCHITECTURE, DATABASE | — |
12
+ | **Bugfix** | — | — | PROJECT_GRAPH (affected module only) |
13
+ | **Refactor** | — | ARCHITECTURE | PROJECT_GRAPH, affected skills |
14
+ | **Review** | PRD | ARCHITECTURE | TASKS, all loaded skills |
15
+ | **Deploy** | — | ARCHITECTURE | DEPLOYMENT, infrastructure skills |
16
+
17
+ ## Skill Category → Document Mapping
18
+
19
+ | Skill Category | Required Documents | Optional Documents |
20
+ | --- | --- | --- |
21
+ | `frontend` | UI.md, API.md | ARCHITECTURE.md |
22
+ | `backend` | API.md, DATABASE.md | ARCHITECTURE.md |
23
+ | `design` | UI.md | PRD.md |
24
+ | `architecture` | ARCHITECTURE.md, DATABASE.md | PRD.md, API.md |
25
+ | `infrastructure` | ARCHITECTURE.md | — |
26
+ | `security` | ARCHITECTURE.md, API.md | DATABASE.md |
27
+ | `testing` | API.md | ARCHITECTURE.md |
28
+
29
+ ## Context Budget
30
+
31
+ To prevent context window overflow, apply these limits:
32
+
33
+ | Priority | Max tokens | Content |
34
+ | --- | --- | --- |
35
+ | 1 (Critical) | 2000 | Current task description + relevant skill instructions |
36
+ | 2 (Important) | 3000 | Architecture + API contracts for affected modules |
37
+ | 3 (Context) | 2000 | Decision records + project graph (affected branch) |
38
+ | 4 (Background) | 1000 | PRD summary + coding rules |
39
+
40
+ **Total budget: ~8000 tokens of context per task.**
41
+
42
+ If context exceeds budget:
43
+
44
+ 1. Trim Level 1 docs to summaries only
45
+ 2. Load only affected sections of Level 2 docs
46
+ 3. Keep Level 3 (skills) at full detail — they contain the actual instructions
47
+
48
+ ## Module-Based Filtering
49
+
50
+ When the Project Graph is available, use it to filter context:
51
+
52
+ ```
53
+ Task: "Fix appointment reminder bug"
54
+ ↓
55
+ Project Graph lookup: "reminder" → module: appointments
56
+ ↓
57
+ Appointments depends_on: [patients, auth]
58
+ ↓
59
+ Load only:
60
+ - appointments module docs
61
+ - auth module docs (dependency)
62
+ - API.md (appointments section only)
63
+ ↓
64
+ Skip:
65
+ - patients module docs (not a dependency for this task)
66
+ - DATABASE.md (no schema change expected)
67
+ - UI.md (backend task)
68
+ ```
@@ -0,0 +1,119 @@
1
+ # Development Pipeline
2
+
3
+ ## The ContextOS Lifecycle
4
+
5
+ ```
6
+ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐ ┌──────────┐
7
+ │ DEFINE │ ──▶ │ PLAN │ ──▶ │ BUILD │ ──▶ │ VERIFY │ ──▶ │ REVIEW │ ──▶ │ SHIP │
8
+ │ │ │ │ │ │ │ │ │ │ │ │
9
+ │ What to │ │ How to │ │ Write │ │ Test & │ │ Quality │ │ Deploy & │
10
+ │ build │ │ build it │ │ code │ │ validate │ │ gates │ │ document │
11
+ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘ └──────────┘
12
+ │ │ │ │ │ │
13
+ PRD.md ARCHITECTURE.md source code tests code review DECISION.md
14
+ UI.md DATABASE.md components coverage self-review changelog
15
+ ROADMAP.md API.md API routes edge cases security scan deploy
16
+ PROJECT_GRAPH TASKS.md migrations performance a11y audit release notes
17
+ ```
18
+
19
+ ## Stage Details
20
+
21
+ ### 1. DEFINE — "What are we building?"
22
+
23
+ **Input:** User idea or feature request
24
+ **Output:** PRD.md, UI.md, ROADMAP.md, PROJECT_GRAPH.md
25
+
26
+ Process:
27
+
28
+ 1. Intent Analysis — parse the user's request
29
+ 2. Clarifying questions — fill gaps
30
+ 3. Generate PRD with clear requirements
31
+ 4. Generate UI spec if frontend is involved
32
+ 5. Create initial Project Graph
33
+
34
+ **Context loaded:** None (this is the starting point)
35
+
36
+ ### 2. PLAN — "How will we build it?"
37
+
38
+ **Input:** PRD.md
39
+ **Output:** ARCHITECTURE.md, DATABASE.md, API.md, TASKS.md
40
+
41
+ Process:
42
+
43
+ 1. Choose architecture based on profile + requirements
44
+ 2. Design database schema
45
+ 3. Define API contracts
46
+ 4. Break work into atomic tasks
47
+ 5. Update Project Graph with modules and features
48
+
49
+ **Context loaded:** PRD.md, profiles/
50
+
51
+ ### 3. BUILD — "Write the code"
52
+
53
+ **Input:** TASKS.md + relevant architecture docs
54
+ **Output:** Source code, migrations, configurations
55
+
56
+ Process:
57
+
58
+ 1. Pick next task from TASKS.md
59
+ 2. Context Compiler loads only relevant skills and docs
60
+ 3. Write code following loaded skill instructions
61
+ 4. Commit after each completed task
62
+ 5. Update Project Graph if structure changes
63
+
64
+ **Context loaded:** Task-specific (via Context Manager)
65
+
66
+ ### 4. VERIFY — "Prove it works"
67
+
68
+ **Input:** Source code
69
+ **Output:** Tests, coverage reports
70
+
71
+ Process:
72
+
73
+ 1. Write tests for new code
74
+ 2. Run existing tests — ensure nothing broke
75
+ 3. Check edge cases
76
+ 4. Verify performance (if applicable)
77
+
78
+ **Context loaded:** Testing skills + API.md
79
+
80
+ ### 5. REVIEW — "Quality check"
81
+
82
+ **Input:** Code changes (diff)
83
+ **Output:** Review comments, approved changes
84
+
85
+ Process:
86
+
87
+ 1. Self-review against coding standards
88
+ 2. Security scan (if security skill loaded)
89
+ 3. Accessibility audit (if frontend)
90
+ 4. Check against ARCHITECTURE.md — does this align?
91
+ 5. Check against Decision Records — does this contradict anything?
92
+
93
+ **Context loaded:** ARCHITECTURE.md + relevant skills + decisions/
94
+
95
+ ### 6. SHIP — "Deploy and document"
96
+
97
+ **Input:** Reviewed, tested code
98
+ **Output:** Deployment, decision records, release notes
99
+
100
+ Process:
101
+
102
+ 1. Record any architectural decisions made (ADR)
103
+ 2. Update ROADMAP.md — mark completed items
104
+ 3. Update TASKS.md — close completed tasks
105
+ 4. Deploy (if deployment skill loaded)
106
+ 5. Update Project Graph
107
+
108
+ **Context loaded:** ROADMAP.md, TASKS.md, deployment skills
109
+
110
+ ## Profiles and Pipeline
111
+
112
+ Different profiles customize the pipeline:
113
+
114
+ | Profile | Skips | Adds |
115
+ | --- | --- | --- |
116
+ | **Hackathon** | REVIEW, detailed PLAN | Speed shortcuts |
117
+ | **MVP** | Detailed REVIEW, DEPLOY | Quick iterations |
118
+ | **Startup** | Heavy docs | Balance of speed and quality |
119
+ | **Enterprise** | Nothing | ADR enforcement, security gates, full testing |
@@ -0,0 +1,103 @@
1
+ # Project Graph
2
+
3
+ The Project Graph is the **central nervous system** of ContextOS. It maps the entire project as a hierarchy:
4
+
5
+ ```
6
+ Project
7
+ └── Module
8
+ └── Feature
9
+ └── Task
10
+ └── File
11
+ └── Skill
12
+ ```
13
+
14
+ ## Why Project Graph?
15
+
16
+ Without a Project Graph, an AI agent sees a flat list of files. With it, the agent understands:
17
+
18
+ 1. **Impact analysis** — changing `calendar.ts` affects the Appointments module, which affects Patients
19
+ 2. **Scope detection** — a task touching `api/patients/` only needs Patient-related context
20
+ 3. **Skill selection** — files in `components/` need React skills, files in `api/` need backend skills
21
+ 4. **Dependency tracking** — the Calendar feature depends on the Auth module
22
+
23
+ ## Structure
24
+
25
+ The Project Graph lives in `docs/PROJECT_GRAPH.md` and follows this format:
26
+
27
+ ```yaml
28
+ project:
29
+ name: "DentalCRM"
30
+ type: crm
31
+
32
+ modules:
33
+ patients:
34
+ description: "Patient management"
35
+ features:
36
+ - patient-list
37
+ - patient-profile
38
+ - medical-history
39
+ files:
40
+ - src/modules/patients/**
41
+ skills: [react, typescript, postgres]
42
+ depends_on: [auth]
43
+
44
+ appointments:
45
+ description: "Appointment scheduling"
46
+ features:
47
+ - appointment-calendar
48
+ - appointment-booking
49
+ - notifications
50
+ files:
51
+ - src/modules/appointments/**
52
+ skills: [react, typescript, postgres]
53
+ depends_on: [patients, auth]
54
+
55
+ auth:
56
+ description: "Authentication and authorization"
57
+ features:
58
+ - login
59
+ - registration
60
+ - role-management
61
+ files:
62
+ - src/modules/auth/**
63
+ skills: [security, typescript, jwt]
64
+ depends_on: []
65
+ ```
66
+
67
+ ## How the Context Compiler Uses It
68
+
69
+ ### Task: "Add a reminder notification for appointments"
70
+
71
+ 1. **Locate module**: `appointments`
72
+ 2. **Check dependencies**: `appointments` → `patients`, `auth`
73
+ 3. **Load relevant files**: `src/modules/appointments/**`, `src/modules/notifications/**`
74
+ 4. **Load relevant skills**: `react`, `typescript`, notification patterns
75
+ 5. **Load relevant docs**: `ARCHITECTURE.md` (notifications section), `API.md` (endpoints)
76
+ 6. **Skip irrelevant**: `DATABASE.md` (no schema change), `UI.md` (if backend-only)
77
+
78
+ ### Task: "Refactor the database schema"
79
+
80
+ 1. **Affected modules**: ALL (schema change is cross-cutting)
81
+ 2. **Load**: `DATABASE.md`, `ARCHITECTURE.md`, `PROJECT_GRAPH.md`
82
+ 3. **Show impact**: which modules/features are affected by each table change
83
+ 4. **Load skills**: `postgres` (or relevant DB skill)
84
+
85
+ ## Automatic Updates
86
+
87
+ The Project Graph should be updated when:
88
+
89
+ - New modules are added
90
+ - Features are completed
91
+ - File structure changes significantly
92
+ - Dependencies between modules change
93
+
94
+ Use `ctx graph` to regenerate the Project Graph from the current codebase.
95
+
96
+ ## Graph Queries
97
+
98
+ The Context Compiler can answer questions like:
99
+
100
+ - "What modules does this file belong to?"
101
+ - "What skills are needed for this module?"
102
+ - "What other modules will be affected if I change this?"
103
+ - "Show me the dependency chain from here"