context-engineer 1.1.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 (74) hide show
  1. package/README.md +88 -0
  2. package/bin/cli.mjs +91 -0
  3. package/lib/copy.mjs +102 -0
  4. package/lib/init.mjs +166 -0
  5. package/lib/prompts.mjs +144 -0
  6. package/lib/update.mjs +198 -0
  7. package/package.json +35 -0
  8. package/templates/checksums.json +68 -0
  9. package/templates/claude/.claude/rules/context-maintenance.md +38 -0
  10. package/templates/claude/.claude/rules/experience-capture.md +46 -0
  11. package/templates/claude/.claude/settings.project.json +22 -0
  12. package/templates/claude/.claude/skills/bootstrap/SKILL.md +223 -0
  13. package/templates/claude/.claude/skills/dev/SKILL.md +119 -0
  14. package/templates/claude/.claude/skills/dev-capture/SKILL.md +111 -0
  15. package/templates/claude/.claude/skills/dev-commit/SKILL.md +90 -0
  16. package/templates/claude/.claude/skills/dev-decompose/SKILL.md +113 -0
  17. package/templates/claude/.claude/skills/dev-deps/SKILL.md +108 -0
  18. package/templates/claude/.claude/skills/dev-execute/SKILL.md +196 -0
  19. package/templates/claude/.claude/skills/dev-prd/SKILL.md +100 -0
  20. package/templates/claude/.claude/skills/dev-quality/SKILL.md +109 -0
  21. package/templates/claude/.claude/skills/dev-requirements/SKILL.md +75 -0
  22. package/templates/claude/.claude/skills/review-context/SKILL.md +120 -0
  23. package/templates/claude/.claude/skills/sync/SKILL.md +107 -0
  24. package/templates/claude/.claude/skills/update-context/SKILL.md +105 -0
  25. package/templates/claude/.claude/workflow/agents/implementer.md +65 -0
  26. package/templates/claude/.claude/workflow/agents/reviewer.md +96 -0
  27. package/templates/claude/.claude/workflow/agents/team-config.md +97 -0
  28. package/templates/claude/.claude/workflow/agents/tester.md +98 -0
  29. package/templates/claude/.claude/workflow/interfaces/phase-contract.md +157 -0
  30. package/templates/claude/CLAUDE.md +50 -0
  31. package/templates/core/.context/_meta/concepts.md +9 -0
  32. package/templates/core/.context/_meta/drift-report.md +16 -0
  33. package/templates/core/.context/_meta/last-sync.json +6 -0
  34. package/templates/core/.context/_meta/schema.md +242 -0
  35. package/templates/core/.context/architecture/api-surface.md +52 -0
  36. package/templates/core/.context/architecture/class-index.md +49 -0
  37. package/templates/core/.context/architecture/data-flow.md +103 -0
  38. package/templates/core/.context/architecture/data-model.md +35 -0
  39. package/templates/core/.context/architecture/decisions/001-template.md +35 -0
  40. package/templates/core/.context/architecture/dependencies.md +35 -0
  41. package/templates/core/.context/architecture/infrastructure.md +42 -0
  42. package/templates/core/.context/architecture/module-graph.md +68 -0
  43. package/templates/core/.context/architecture/overview.md +87 -0
  44. package/templates/core/.context/business/domain-model.md +43 -0
  45. package/templates/core/.context/business/glossary.md +23 -0
  46. package/templates/core/.context/business/overview.md +29 -0
  47. package/templates/core/.context/business/workflows.md +61 -0
  48. package/templates/core/.context/constitution.md +84 -0
  49. package/templates/core/.context/conventions/code-style.md +47 -0
  50. package/templates/core/.context/conventions/error-handling.md +50 -0
  51. package/templates/core/.context/conventions/git.md +46 -0
  52. package/templates/core/.context/conventions/patterns.md +41 -0
  53. package/templates/core/.context/conventions/testing.md +49 -0
  54. package/templates/core/.context/experience/debugging.md +21 -0
  55. package/templates/core/.context/experience/incidents.md +26 -0
  56. package/templates/core/.context/experience/lessons.md +23 -0
  57. package/templates/core/.context/experience/performance.md +29 -0
  58. package/templates/core/.context/index.md +93 -0
  59. package/templates/core/.context/progress/backlog.md +23 -0
  60. package/templates/core/.context/progress/status.md +30 -0
  61. package/templates/core/.context/workflow/artifacts/.gitkeep +0 -0
  62. package/templates/core/.context/workflow/config.md +35 -0
  63. package/templates/core/AGENTS.md +53 -0
  64. package/templates/core/scripts/compact-experience.sh +83 -0
  65. package/templates/core/scripts/detect-drift.sh +388 -0
  66. package/templates/core/scripts/extract-structure.sh +757 -0
  67. package/templates/core/scripts/sync-context.sh +510 -0
  68. package/templates/cursor/.cursor/rules/always.mdc +18 -0
  69. package/templates/cursor/.cursor/rules/backend.mdc +16 -0
  70. package/templates/cursor/.cursor/rules/database.mdc +16 -0
  71. package/templates/cursor/.cursor/rules/frontend.mdc +13 -0
  72. package/templates/cursor/.cursorrules +23 -0
  73. package/templates/github/.github/copilot-instructions.md +15 -0
  74. package/templates/github/.github/workflows/context-drift.yml +73 -0
@@ -0,0 +1,35 @@
1
+ <!-- AUTO-GENERATED: Do not edit manually. Run scripts/sync-context.sh to regenerate. -->
2
+ <!-- generated-from: [ORM models / migration files] -->
3
+ <!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
4
+
5
+ # Data Model
6
+
7
+ ## Summary
8
+
9
+ <!-- Database schema, tables/collections, entity relationships, indexes -->
10
+
11
+ [PLACEHOLDER: Run `scripts/sync-context.sh` or `/bootstrap-context` to auto-generate from ORM models and migration files.]
12
+
13
+ ## Tables / Collections
14
+
15
+ | Table | Description | Key Columns |
16
+ |-------|-------------|-------------|
17
+ | [table_name] | [What it stores] | [Primary key, important columns] |
18
+
19
+ ## Relationships
20
+
21
+ | From | To | Type | FK Column |
22
+ |------|----|------|-----------|
23
+ | [Table1] | [Table2] | 1:N | [fk_column] |
24
+
25
+ ## Indexes
26
+
27
+ | Table | Index Name | Columns | Type |
28
+ |-------|-----------|---------|------|
29
+ | [table] | [idx_name] | [columns] | [unique/btree/gin] |
30
+
31
+ ## Migrations
32
+
33
+ - Latest migration: [name/number]
34
+ - Migration tool: [e.g., EF Core Migrations, Prisma Migrate, Alembic]
35
+ - Migration command: `[command to run migrations]`
@@ -0,0 +1,35 @@
1
+ # ADR-001: [Decision Title]
2
+
3
+ <!-- last-updated: YYYY-MM-DD -->
4
+
5
+ ## Status
6
+
7
+ Proposed
8
+
9
+ <!-- Proposed | Accepted | Deprecated | Superseded by ADR-XXX -->
10
+
11
+ ## Context
12
+
13
+ [What is the issue that we're seeing that is motivating this decision or change?]
14
+
15
+ ## Decision
16
+
17
+ [What is the change that we're proposing and/or doing?]
18
+
19
+ ## Alternatives Considered
20
+
21
+ | Alternative | Pros | Cons |
22
+ |------------|------|------|
23
+ | [Option A] | [Pros] | [Cons] |
24
+ | [Option B] | [Pros] | [Cons] |
25
+
26
+ ## Consequences
27
+
28
+ ### Positive
29
+ - [What becomes easier]
30
+
31
+ ### Negative
32
+ - [What becomes harder]
33
+
34
+ ### Risks
35
+ - [What could go wrong]
@@ -0,0 +1,35 @@
1
+ <!-- AUTO-GENERATED: Do not edit manually. Run scripts/sync-context.sh to regenerate. -->
2
+ <!-- generated-from: [package manifest files] -->
3
+ <!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
4
+
5
+ # Dependencies
6
+
7
+ ## Summary
8
+
9
+ <!-- External services, libraries, and their versions -->
10
+
11
+ [PLACEHOLDER: Run `scripts/sync-context.sh` or `/bootstrap-context` to auto-generate from package manifest files.]
12
+
13
+ ## Runtime Dependencies
14
+
15
+ | Package | Version | Purpose |
16
+ |---------|---------|---------|
17
+ | [package-name] | [version] | [What it's used for] |
18
+
19
+ ## Development Dependencies
20
+
21
+ | Package | Version | Purpose |
22
+ |---------|---------|---------|
23
+ | [package-name] | [version] | [What it's used for] |
24
+
25
+ ## External Services
26
+
27
+ | Service | Purpose | Environment Variable |
28
+ |---------|---------|---------------------|
29
+ | [e.g., PostgreSQL] | [Primary database] | `DATABASE_URL` |
30
+ | [e.g., Redis] | [Caching] | `REDIS_URL` |
31
+ | [e.g., AWS S3] | [File storage] | `AWS_S3_BUCKET` |
32
+
33
+ ## Version Constraints
34
+
35
+ [Any important version pinning or compatibility notes]
@@ -0,0 +1,42 @@
1
+ # Infrastructure
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Deployment strategy, CI/CD pipelines, environments, and infrastructure configuration -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate, or fill in manually.]
12
+
13
+ ## Environments
14
+
15
+ | Environment | URL | Purpose | Deploy Method |
16
+ |-------------|-----|---------|---------------|
17
+ | Local | `localhost:[PORT]` | Development | Manual |
18
+ | Dev/Staging | [URL] | Testing | [Auto/Manual] |
19
+ | Production | [URL] | Live | [Auto/Manual] |
20
+
21
+ ## CI/CD Pipeline
22
+
23
+ - **Platform**: [e.g., GitHub Actions, Azure DevOps, GitLab CI]
24
+ - **Trigger**: [e.g., Push to main, PR merge]
25
+ - **Steps**:
26
+ 1. [Build]
27
+ 2. [Test]
28
+ 3. [Lint]
29
+ 4. [Deploy]
30
+
31
+ ## Infrastructure
32
+
33
+ - **Hosting**: [e.g., AWS, Azure, GCP, Docker, K8s]
34
+ - **Database**: [Managed/Self-hosted, backup strategy]
35
+ - **CDN**: [If applicable]
36
+ - **Monitoring**: [e.g., Datadog, Prometheus, Application Insights]
37
+
38
+ ## Environment Variables
39
+
40
+ | Variable | Description | Required | Default |
41
+ |----------|-------------|----------|---------|
42
+ | `[VAR_NAME]` | [Description] | [Yes/No] | [Default value] |
@@ -0,0 +1,68 @@
1
+ # Module Graph
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- High-level map of all modules/subsystems, their responsibilities, and dependency relationships -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from project structure analysis.]
12
+
13
+ ## Subsystems
14
+
15
+ | Module | Directory | Responsibility | Key Classes |
16
+ |--------|-----------|---------------|-------------|
17
+ | [ModuleName] | [src/module/] | [One-line description] | [Class1, Class2, Class3] |
18
+
19
+ ## Dependency Graph
20
+
21
+ ```
22
+ [ASCII dependency diagram showing module relationships]
23
+
24
+ Example:
25
+ ModuleA ──→ ModuleB ──→ ModuleC
26
+ │ │
27
+ └──→ ModuleD ──→ ModuleE
28
+
29
+ Legend:
30
+ ──→ depends on (uses/calls)
31
+ ──▷ implements/extends
32
+ - - → optional/weak dependency
33
+ ```
34
+
35
+ ## Module Interfaces
36
+
37
+ <!-- For each module: key public entry points, what it depends on, and what depends on it -->
38
+
39
+ ### [Module Name]
40
+
41
+ **Public Interface**:
42
+ - `ClassName::method(params)` — One-line description
43
+ - `ClassName::method(params)` — One-line description
44
+
45
+ **Depends on**: [Module1, Module2]
46
+ **Depended by**: [Module3, Module4]
47
+
48
+ ---
49
+
50
+ ### [Module Name 2]
51
+
52
+ **Public Interface**:
53
+ - `ClassName::method(params)` — One-line description
54
+
55
+ **Depends on**: [Module1]
56
+ **Depended by**: [Module5]
57
+
58
+ ## Circular Dependencies
59
+
60
+ <!-- List any circular dependencies detected, with notes on whether they are intentional -->
61
+
62
+ None detected. <!-- Or: ModuleA ↔ ModuleB (via shared types) — intentional -->
63
+
64
+ ## Namespace / Directory Mapping
65
+
66
+ | Namespace / Package | Directory | File Count |
67
+ |---------------------|-----------|------------|
68
+ | [com.example.module] | [src/module/] | [N] |
@@ -0,0 +1,87 @@
1
+ # Architecture Overview
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- High-level system architecture: what components exist, how they interact, key design decisions -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from project structure analysis.]
12
+
13
+ ## Tech Stack
14
+
15
+ | Layer | Technology | Version |
16
+ |-------|-----------|---------|
17
+ | Language | [e.g., C# / TypeScript / Python] | [version] |
18
+ | Framework | [e.g., ASP.NET Core / Express / FastAPI] | [version] |
19
+ | Database | [e.g., PostgreSQL / MongoDB / SQL Server] | [version] |
20
+ | ORM | [e.g., EF Core / Prisma / SQLAlchemy] | [version] |
21
+ | Frontend | [e.g., React / Vue / Angular] | [version] |
22
+ | Testing | [e.g., xUnit / Jest / pytest] | [version] |
23
+
24
+ ## System Architecture
25
+
26
+ ```
27
+ [High-level architecture diagram using ASCII or Mermaid]
28
+
29
+ ┌─────────────┐ ┌─────────────┐ ┌─────────────┐
30
+ │ Client │────▶│ API Layer │────▶│ Database │
31
+ │ (Browser) │ │ (REST/gRPC)│ │ (PostgreSQL)│
32
+ └─────────────┘ └──────┬──────┘ └─────────────┘
33
+
34
+ ┌──────▼──────┐
35
+ │ Service │
36
+ │ Layer │
37
+ └─────────────┘
38
+ ```
39
+
40
+ ## Directory Structure
41
+
42
+ ```
43
+ src/
44
+ ├── [layer1]/ # [Description]
45
+ ├── [layer2]/ # [Description]
46
+ └── [layer3]/ # [Description]
47
+ ```
48
+
49
+ ## Key Design Decisions
50
+
51
+ - **[Decision 1]**: [Brief rationale — see ADR-001 for details]
52
+ - **[Decision 2]**: [Brief rationale — see ADR-002 for details]
53
+
54
+ ## Subsystem Breakdown
55
+
56
+ <!-- One-line description of each major subsystem/module and its directory location.
57
+ For detailed dependency relationships, see architecture/module-graph.md -->
58
+
59
+ | Subsystem | Directory | Responsibility |
60
+ |-----------|-----------|---------------|
61
+ | [Subsystem1] | [src/subsystem1/] | [What it does] |
62
+ | [Subsystem2] | [src/subsystem2/] | [What it does] |
63
+
64
+ ## Key Interfaces Between Subsystems
65
+
66
+ <!-- The most important interfaces/contracts that define module boundaries.
67
+ For the complete class index, see architecture/class-index.md -->
68
+
69
+ - **[Subsystem1] → [Subsystem2]**: [Interface/class name] — [What this boundary defines]
70
+ - **[Subsystem2] → [Subsystem3]**: [Interface/class name] — [What this boundary defines]
71
+
72
+ ## Threading / Concurrency Model
73
+
74
+ <!-- How the application uses threads, async tasks, or processes.
75
+ For detailed data flow across threads, see architecture/data-flow.md -->
76
+
77
+ - **Main Thread**: [What runs here]
78
+ - **Worker Threads**: [What runs here, how many]
79
+ - **Synchronization**: [Mutexes, channels, message queues, etc.]
80
+
81
+ ## Cross-Cutting Concerns
82
+
83
+ - **Authentication**: [How auth works]
84
+ - **Authorization**: [How permissions are enforced]
85
+ - **Logging**: [Logging strategy]
86
+ - **Error Handling**: [See conventions/error-handling.md]
87
+ - **Caching**: [Caching strategy if applicable]
@@ -0,0 +1,43 @@
1
+ # Domain Model
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Core business entities, their relationships, and the ubiquitous language (DDD) -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from ORM models and code analysis.]
12
+
13
+ ## Core Entities
14
+
15
+ | Entity | Description | Key Attributes |
16
+ |--------|-------------|----------------|
17
+ | [Entity1] | [What it represents] | [Key fields] |
18
+
19
+ ## Entity Relationships
20
+
21
+ ```
22
+ [Entity1] 1──* [Entity2]
23
+ [Entity2] *──* [Entity3]
24
+ ```
25
+
26
+ <!-- Or use Mermaid diagram:
27
+ ```mermaid
28
+ erDiagram
29
+ Entity1 ||--o{ Entity2 : has
30
+ Entity2 }o--o{ Entity3 : relates
31
+ ```
32
+ -->
33
+
34
+ ## Ubiquitous Language
35
+
36
+ | Term | Definition | Code Representation |
37
+ |------|------------|---------------------|
38
+ | [Business Term] | [What it means in business context] | [Class/type name in code] |
39
+
40
+ ## Invariants & Business Rules
41
+
42
+ 1. [Rule 1: e.g., "An Order must have at least one OrderItem"]
43
+ 2. [Rule 2: e.g., "A User cannot belong to more than 5 Organizations"]
@@ -0,0 +1,23 @@
1
+ # Domain Glossary
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Domain-specific terminology definitions to ensure consistent language across code and communication -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from code analysis.]
12
+
13
+ ## Terms
14
+
15
+ | Term | Definition | Also Known As | Used In |
16
+ |------|------------|---------------|---------|
17
+ | [Term 1] | [Precise definition] | [Aliases] | [Which code modules/areas] |
18
+
19
+ ## Abbreviations
20
+
21
+ | Abbreviation | Full Form | Context |
22
+ |-------------|-----------|---------|
23
+ | [ABBR] | [Full form] | [Where it's used] |
@@ -0,0 +1,29 @@
1
+ # Business Overview
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- 3-5 line summary: What does this product do? Who does it serve? Why does it exist? -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from existing code and documentation, or fill in manually.]
12
+
13
+ ## Product Vision
14
+
15
+ [What is the long-term vision for this product?]
16
+
17
+ ## Target Users
18
+
19
+ | User Role | Description | Key Needs |
20
+ |-----------|-------------|-----------|
21
+ | [Role 1] | [Who they are] | [What they need] |
22
+
23
+ ## Core Value Proposition
24
+
25
+ [What unique value does this product provide?]
26
+
27
+ ## Business Constraints
28
+
29
+ [Budget, timeline, regulatory, compliance, or other business constraints that affect technical decisions]
@@ -0,0 +1,61 @@
1
+ # Key Processes & Workflows
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Key processes and flows that drive the application.
10
+ For web/business apps: business workflows (user registration, checkout, etc.)
11
+ For engines/frameworks: technical pipelines (render pipeline, build pipeline, etc.)
12
+ For CLI/tools: processing workflows (input → transform → output) -->
13
+
14
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate, or fill in manually.]
15
+
16
+ ## Core Workflows
17
+
18
+ <!-- Use this section for business/user-facing processes -->
19
+
20
+ ### [Workflow Name 1]
21
+
22
+ **Trigger**: [What initiates this workflow]
23
+ **Actors**: [Who/what is involved — users, services, or system components]
24
+ **Steps**:
25
+ 1. [Step 1]
26
+ 2. [Step 2]
27
+ 3. [Step 3]
28
+
29
+ **Success Criteria**: [What defines successful completion]
30
+ **Error Cases**: [What can go wrong and how it's handled]
31
+
32
+ ---
33
+
34
+ ## Technical Pipelines
35
+
36
+ <!-- Use this section for internal processing pipelines and data flows.
37
+ For detailed pipeline diagrams, see architecture/data-flow.md -->
38
+
39
+ ### [Pipeline Name 1]
40
+
41
+ **Purpose**: [What this pipeline achieves]
42
+ **Trigger**: [Per frame / per request / on event / on demand]
43
+ **Stages**:
44
+
45
+ ```
46
+ [Input] → [Stage 1] → [Stage 2] → [Stage 3] → [Output]
47
+ ```
48
+
49
+ **Key constraints**: [Timing, ordering, thread-safety requirements]
50
+
51
+ ---
52
+
53
+ ### [Pipeline Name 2]
54
+
55
+ **Purpose**: [What this pipeline achieves]
56
+ **Trigger**: [When this runs]
57
+ **Stages**:
58
+
59
+ ```
60
+ [Input] → [Stage 1] → [Stage 2] → [Output]
61
+ ```
@@ -0,0 +1,84 @@
1
+ # Project Constitution
2
+
3
+ > Non-negotiable principles and the Context Loading Route Table.
4
+ > This file is part of the "hot memory" tier — it should always be loaded.
5
+
6
+ <!-- TEMPLATE: Replace the placeholders below with your project's actual values -->
7
+
8
+ ## Project Identity
9
+
10
+ - **Project Name**: [PROJECT_NAME]
11
+ - **Tech Stack**: [e.g., .NET 8 / ASP.NET Core / EF Core / PostgreSQL]
12
+ - **Primary Language**: [e.g., C#, TypeScript, Python]
13
+ - **Repository**: [URL]
14
+
15
+ ## Non-Negotiable Principles
16
+
17
+ <!-- Add your project's non-negotiable constraints here. Examples: -->
18
+
19
+ 1. **Security First**: Never store secrets in code. All sensitive data must use environment variables or a secret manager.
20
+ 2. **Type Safety**: Use strict typing. Avoid `any` (TypeScript), `dynamic` (C#), or equivalent escape hatches.
21
+ 3. **Test Coverage**: All new features must include unit tests. Critical paths must have integration tests.
22
+ 4. **No Direct DB Access from Controllers**: All database operations go through service/repository layers.
23
+ 5. **Immutable Infrastructure**: Configuration changes must go through version-controlled config files, never manual edits.
24
+
25
+ ## Build & Test Commands
26
+
27
+ ```bash
28
+ # Build
29
+ [BUILD_COMMAND]
30
+
31
+ # Test
32
+ [TEST_COMMAND]
33
+
34
+ # Lint
35
+ [LINT_COMMAND]
36
+
37
+ # Run locally
38
+ [RUN_COMMAND]
39
+ ```
40
+
41
+ ## Context Loading Route Table
42
+
43
+ **IMPORTANT**: Use this table to determine which `.context/` files to load based on your current task. Do NOT load all files — only load what is relevant.
44
+
45
+ | Task Type | Load These Files |
46
+ |-----------|-----------------|
47
+ | New feature development | `business/domain-model.md`, `specs/{feature}/spec.md`, `conventions/patterns.md` |
48
+ | Bug fix | `experience/debugging.md`, `experience/lessons.md`, `architecture/overview.md` |
49
+ | Database / Schema change | `architecture/data-model.md`, `conventions/patterns.md` |
50
+ | API endpoint development | `architecture/api-surface.md`, `conventions/code-style.md` |
51
+ | Refactoring | `architecture/overview.md`, `conventions/patterns.md`, `conventions/code-style.md` |
52
+ | Testing | `conventions/testing.md` |
53
+ | CI/CD or deployment | `architecture/infrastructure.md` |
54
+ | Performance optimization | `experience/performance.md`, `architecture/overview.md` |
55
+ | New developer onboarding | `business/overview.md`, `business/glossary.md`, `architecture/overview.md` |
56
+ | Module restructuring | `architecture/module-graph.md`, `architecture/overview.md` |
57
+ | Pipeline / flow changes | `architecture/data-flow.md`, `architecture/module-graph.md` |
58
+ | Adding new subsystem | `architecture/module-graph.md`, `conventions/patterns.md`, `architecture/overview.md` |
59
+ | Understanding codebase | `_meta/concepts.md`, `architecture/module-graph.md`, `architecture/data-flow.md`, `architecture/class-index.md` |
60
+ | Concept / topic lookup | `_meta/concepts.md` |
61
+ | Context system maintenance | `_meta/schema.md`, `index.md` |
62
+ | Workflow execution (`/dev`) | `workflow/config.md`, `conventions/patterns.md`, `conventions/testing.md`, `conventions/git.md` |
63
+
64
+ ## Context Maintenance Rules
65
+
66
+ 1. **When you modify code that changes architecture, data models, API surfaces, or conventions**, you MUST update the corresponding `.context/` file in the same commit.
67
+ 2. **When you fix a non-trivial bug**, append the issue and resolution to `experience/debugging.md`.
68
+ 3. **When you make a significant architectural decision**, create an ADR in `architecture/decisions/`.
69
+ 4. **When you discover a new pattern or anti-pattern**, record it in `experience/lessons.md`.
70
+ 5. **Auto-generated files** (marked `<!-- AUTO-GENERATED -->`) should NOT be edited manually — regenerate them using `scripts/sync-context.sh`.
71
+
72
+ ## File Size Budgets
73
+
74
+ | Category | Max Lines Per File |
75
+ |----------|-------------------|
76
+ | constitution.md | 200 |
77
+ | AGENTS.md | 150 |
78
+ | Business context files | 500 |
79
+ | Architecture overview | 800 |
80
+ | Architecture context files (other) | 500 |
81
+ | Convention files | 400 |
82
+ | ADR files | 200 |
83
+ | Experience files | 500 (compact when exceeded) |
84
+ | Spec files | 500 |
@@ -0,0 +1,47 @@
1
+ # Code Style
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Naming conventions, formatting rules, and language-specific style guidelines -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from code analysis.]
12
+
13
+ ## Naming Conventions
14
+
15
+ | Element | Convention | Example |
16
+ |---------|-----------|---------|
17
+ | Files | [e.g., kebab-case, PascalCase] | [example] |
18
+ | Classes/Types | [e.g., PascalCase] | `UserService` |
19
+ | Functions/Methods | [e.g., camelCase] | `getUserById` |
20
+ | Variables | [e.g., camelCase] | `currentUser` |
21
+ | Constants | [e.g., UPPER_SNAKE] | `MAX_RETRIES` |
22
+ | Database tables | [e.g., snake_case] | `user_profiles` |
23
+ | API endpoints | [e.g., kebab-case] | `/api/user-profiles` |
24
+
25
+ ## File Organization
26
+
27
+ ```
28
+ [Describe the standard file structure for a typical module/feature]
29
+ ```
30
+
31
+ ## Formatting
32
+
33
+ - **Indentation**: [tabs/spaces, size]
34
+ - **Line length**: [max characters]
35
+ - **Quotes**: [single/double]
36
+ - **Semicolons**: [yes/no, for JS/TS]
37
+ - **Trailing commas**: [yes/no]
38
+
39
+ ## Imports / Using Statements
40
+
41
+ [Order and grouping conventions for imports]
42
+
43
+ ## Comments
44
+
45
+ - Use comments only when the logic is not self-evident
46
+ - Do NOT add comments to explain what code does — make the code itself readable
47
+ - DO add comments to explain WHY something is done a certain way
@@ -0,0 +1,50 @@
1
+ # Error Handling Conventions
2
+
3
+ <!-- confidence: low -->
4
+ <!-- source: [TO BE FILLED BY BOOTSTRAP] -->
5
+ <!-- last-updated: YYYY-MM-DD -->
6
+
7
+ ## Summary
8
+
9
+ <!-- Error handling patterns, logging conventions, and error reporting -->
10
+
11
+ [PLACEHOLDER: Run `/bootstrap-context` to auto-generate from code analysis.]
12
+
13
+ ## Error Handling Strategy
14
+
15
+ ### Application Errors
16
+ - [How custom errors/exceptions are defined]
17
+ - [Error hierarchy if applicable]
18
+
19
+ ### API Error Responses
20
+ ```json
21
+ {
22
+ "error": {
23
+ "code": "ERROR_CODE",
24
+ "message": "Human-readable message",
25
+ "details": {}
26
+ }
27
+ }
28
+ ```
29
+
30
+ ### HTTP Status Code Usage
31
+ | Status | When to Use |
32
+ |--------|------------|
33
+ | 400 | Validation errors, bad request |
34
+ | 401 | Unauthenticated |
35
+ | 403 | Unauthorized (no permission) |
36
+ | 404 | Resource not found |
37
+ | 409 | Conflict (duplicate, etc.) |
38
+ | 422 | Unprocessable entity |
39
+ | 500 | Unexpected server error |
40
+
41
+ ## Logging
42
+
43
+ - **Framework**: [e.g., Serilog, Winston, Python logging]
44
+ - **Levels**: DEBUG, INFO, WARN, ERROR, FATAL
45
+ - **Structured logging**: [Yes/No, format]
46
+ - **Sensitive data**: NEVER log passwords, tokens, PII
47
+
48
+ ## Monitoring & Alerting
49
+
50
+ [How errors are tracked and alerted on]