contextos-agents 2.2.0 → 2.3.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 (108) 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 +24 -4
  107. package/bin/lib/ui.js +2 -2
  108. package/package.json +5 -2
@@ -155,34 +155,3 @@ Anti-patterns and things to explicitly avoid. See `TROUBLESHOOTING.md`.
155
155
  ## Integration Notes
156
156
 
157
157
  How this skill interacts with other skills.
158
-
159
-
160
- # context-os Examples — Anti-patterns vs ContextOS Standard
161
-
162
- ## Example 1: Project Lifecycle Management
163
-
164
- ### Anti-pattern: Ad-hoc Unstructured Development
165
-
166
- ```text
167
- Coding -> Modifying DB -> Debugging -> Redesigning UI -> Changing Architecture
168
- All in one unstructured stream of consciousness.
169
- ```
170
-
171
- ### Best practice: ContextOS Standard (Phase-Gated Development)
172
-
173
- ```text
174
- Phase 1: DEFINE (PRD & Requirements)
175
- Phase 2: PLAN (Atomic Tasks & ADRs)
176
- Phase 3: BUILD (TDD & Minimalist Implementation)
177
- Phase 4: VERIFY (Automated Test Proof)
178
- Phase 5: REVIEW (Design QA & Code Review)
179
- Phase 6: SHIP (Production Release)
180
- ```
181
-
182
- # context-os Troubleshooting & Common Mistakes
183
-
184
- ## 1. Stale Compiled Artifacts
185
-
186
- - **Symptom**: Editor rules don't reflect newly updated skills.
187
- - **Root Cause**: Modifying .agents/core/skills/ without recompiling exports.
188
- - **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"
@@ -0,0 +1,135 @@
1
+ # Rule Engine
2
+ # Conditional logic for context compilation based on project profile and task type
3
+
4
+ rules:
5
+ # ═══════════════════════════════════════
6
+ # Profile-based rules
7
+ # ═══════════════════════════════════════
8
+
9
+ - name: mvp-minimal
10
+ description: MVP projects skip heavy infrastructure
11
+ if:
12
+ profile: mvp
13
+ then:
14
+ exclude_skills: [microservices, ddd, kubernetes, monitoring, cicd]
15
+ exclude_docs: [DEPLOYMENT.md]
16
+ prefer_skills: [sqlite, simple-auth, minimal-architecture]
17
+ max_doc_depth: 2 # Only Level 1 + Level 2
18
+
19
+ - name: enterprise-strict
20
+ description: Enterprise projects require full documentation and rigor
21
+ if:
22
+ profile: enterprise
23
+ then:
24
+ require_skills: [ddd, security, testing, cicd]
25
+ require_docs: [ARCHITECTURE.md, DATABASE.md, API.md, DECISIONS]
26
+ enforce_adr: true # Every architectural decision must be recorded
27
+ enforce_testing: true
28
+ min_doc_depth: 3 # All levels required
29
+
30
+ - name: hackathon-speed
31
+ description: Hackathon mode — maximum speed, minimum ceremony
32
+ if:
33
+ profile: hackathon
34
+ then:
35
+ exclude_skills: [kubernetes, monitoring, cicd, ddd, microservices]
36
+ exclude_docs: [DEPLOYMENT.md, ROADMAP.md]
37
+ prefer_skills: [sqlite, simple-auth]
38
+ skip_review: true
39
+ max_doc_depth: 1 # Vision only
40
+
41
+ - name: startup-balanced
42
+ description: Startup balance between speed and quality
43
+ if:
44
+ profile: startup
45
+ then:
46
+ exclude_skills: [kubernetes, ddd]
47
+ prefer_skills: [postgres, jwt-auth, docker]
48
+ enforce_adr: false
49
+ max_doc_depth: 2
50
+
51
+ # ═══════════════════════════════════════
52
+ # Task-based rules
53
+ # ═══════════════════════════════════════
54
+
55
+ - name: frontend-task
56
+ description: Frontend tasks don't need database or deployment docs
57
+ if:
58
+ task_type: frontend
59
+ then:
60
+ load_docs: [UI.md, ARCHITECTURE.md, API.md]
61
+ skip_docs: [DATABASE.md, DEPLOYMENT.md]
62
+ load_skill_categories: [frontend, design]
63
+ skip_skill_categories: [backend, infrastructure]
64
+
65
+ - name: backend-task
66
+ description: Backend tasks don't need UI docs
67
+ if:
68
+ task_type: backend
69
+ then:
70
+ load_docs: [ARCHITECTURE.md, DATABASE.md, API.md]
71
+ skip_docs: [UI.md]
72
+ load_skill_categories: [backend, architecture]
73
+ skip_skill_categories: [design]
74
+
75
+ - name: architecture-task
76
+ description: Architecture tasks load everything at high level
77
+ if:
78
+ task_type: architecture
79
+ then:
80
+ load_docs: [PRD.md, ARCHITECTURE.md, DATABASE.md, API.md, PROJECT_GRAPH.md]
81
+ load_skill_categories: [architecture]
82
+ skip_skill_categories: [design]
83
+
84
+ - name: bugfix-task
85
+ description: Bugfixes need minimal context — focus on affected module
86
+ if:
87
+ task_type: bugfix
88
+ then:
89
+ load_docs: [PROJECT_GRAPH.md] # Find affected module
90
+ max_doc_depth: 1
91
+ skip_docs: [PRD.md, ROADMAP.md]
92
+
93
+ - name: refactor-task
94
+ description: Refactoring needs architecture context
95
+ if:
96
+ task_type: refactor
97
+ then:
98
+ load_docs: [ARCHITECTURE.md, PROJECT_GRAPH.md]
99
+ load_skill_categories: [architecture]
100
+
101
+ # ═══════════════════════════════════════
102
+ # Stack-based rules
103
+ # ═══════════════════════════════════════
104
+
105
+ - name: react-ecosystem
106
+ description: React projects auto-load TypeScript
107
+ if:
108
+ skill_loaded: react
109
+ then:
110
+ auto_load: [typescript]
111
+ suggest: [tailwind, react-query]
112
+
113
+ - name: nextjs-ecosystem
114
+ description: Next.js implies React + TypeScript + SSR patterns
115
+ if:
116
+ skill_loaded: nextjs
117
+ then:
118
+ auto_load: [react, typescript]
119
+ suggest: [prisma, next-auth, tailwind]
120
+
121
+ - name: fastapi-ecosystem
122
+ description: FastAPI implies Python + Pydantic
123
+ if:
124
+ skill_loaded: fastapi
125
+ then:
126
+ auto_load: [python, pydantic]
127
+ suggest: [postgres, docker, testing]
128
+
129
+ - name: no-conflicts
130
+ description: Prevent incompatible frameworks
131
+ if:
132
+ any_loaded: [react, vue, angular, svelte]
133
+ then:
134
+ conflict_check: true
135
+ max_frontend_frameworks: 1
@@ -0,0 +1,57 @@
1
+ # engineering-workflow Examples — Anti-patterns vs ContextOS Standard
2
+
3
+ ## Example 1: Handling a New Feature Request
4
+
5
+ ### Anti-pattern: Jumping Straight to Code
6
+
7
+ ```text
8
+ User: "Add a user referral system."
9
+ Agent: Immediately creates src/referral.js, starts writing database queries, guesses schema,
10
+ and misses requirements like rate limiting, expiry dates, and fraud prevention.
11
+ ```
12
+
13
+ ### Best practice: ContextOS Standard (DEFINE -> PLAN -> BUILD)
14
+
15
+ ```markdown
16
+ [DOMAIN: Full-Stack] [PHASE: Define] [ROLE: Product Manager]
17
+ Skills loaded: engineering-workflow, interview-me
18
+
19
+ ## Feature Spec: User Referral System
20
+ ### Why (Problem)
21
+ Increase user acquisition through organic word-of-mouth incentives.
22
+
23
+ ### Scope
24
+ In-Scope:
25
+ - Unique referral code generation per registered user
26
+ - Referral code attribution on signup
27
+ - Credit reward trigger after first completed purchase
28
+ Out-of-Scope:
29
+ - Multi-tier MLM rewards
30
+ - Cash payout integrations
31
+
32
+ ### Acceptance Criteria
33
+ - [ ] Given a registered user, when visiting /referrals, then unique code is displayed.
34
+ - [ ] Given a new user with code, when signing up, then referrer_id is stored with status 'pending'.
35
+ ```
36
+
37
+ ---
38
+
39
+ ## Example 2: Atomic Task Execution in PLAN Phase
40
+
41
+ ### Anti-pattern: Monolithic Mega-Task
42
+
43
+ ```text
44
+ Task: "Implement entire referral system end-to-end in one shot."
45
+ Result: 15 files modified simultaneously, uncompilable intermediate state, untestable diff.
46
+ ```
47
+
48
+ ### Best practice: ContextOS Standard (Atomic Tasks with Test Gate)
49
+
50
+ ```markdown
51
+ [DOMAIN: Full-Stack] [PHASE: Plan] [ROLE: Architect]
52
+ Atomic Tasks:
53
+ 1. Database migration: referrals and referral_rewards tables + indexes. (Test: Migration rollback & apply)
54
+ 2. Domain service: ReferralService.createCode() and ReferralService.claimCode(). (Test: Unit tests)
55
+ 3. API route: POST /api/referrals/claim with Zod validation. (Test: Supertest integration)
56
+ 4. UI component: <ReferralCard /> with copy button. (Test: RTL component test)
57
+ ```