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.
- package/README.md +88 -0
- package/bin/cli.mjs +91 -0
- package/lib/copy.mjs +102 -0
- package/lib/init.mjs +166 -0
- package/lib/prompts.mjs +144 -0
- package/lib/update.mjs +198 -0
- package/package.json +35 -0
- package/templates/checksums.json +68 -0
- package/templates/claude/.claude/rules/context-maintenance.md +38 -0
- package/templates/claude/.claude/rules/experience-capture.md +46 -0
- package/templates/claude/.claude/settings.project.json +22 -0
- package/templates/claude/.claude/skills/bootstrap/SKILL.md +223 -0
- package/templates/claude/.claude/skills/dev/SKILL.md +119 -0
- package/templates/claude/.claude/skills/dev-capture/SKILL.md +111 -0
- package/templates/claude/.claude/skills/dev-commit/SKILL.md +90 -0
- package/templates/claude/.claude/skills/dev-decompose/SKILL.md +113 -0
- package/templates/claude/.claude/skills/dev-deps/SKILL.md +108 -0
- package/templates/claude/.claude/skills/dev-execute/SKILL.md +196 -0
- package/templates/claude/.claude/skills/dev-prd/SKILL.md +100 -0
- package/templates/claude/.claude/skills/dev-quality/SKILL.md +109 -0
- package/templates/claude/.claude/skills/dev-requirements/SKILL.md +75 -0
- package/templates/claude/.claude/skills/review-context/SKILL.md +120 -0
- package/templates/claude/.claude/skills/sync/SKILL.md +107 -0
- package/templates/claude/.claude/skills/update-context/SKILL.md +105 -0
- package/templates/claude/.claude/workflow/agents/implementer.md +65 -0
- package/templates/claude/.claude/workflow/agents/reviewer.md +96 -0
- package/templates/claude/.claude/workflow/agents/team-config.md +97 -0
- package/templates/claude/.claude/workflow/agents/tester.md +98 -0
- package/templates/claude/.claude/workflow/interfaces/phase-contract.md +157 -0
- package/templates/claude/CLAUDE.md +50 -0
- package/templates/core/.context/_meta/concepts.md +9 -0
- package/templates/core/.context/_meta/drift-report.md +16 -0
- package/templates/core/.context/_meta/last-sync.json +6 -0
- package/templates/core/.context/_meta/schema.md +242 -0
- package/templates/core/.context/architecture/api-surface.md +52 -0
- package/templates/core/.context/architecture/class-index.md +49 -0
- package/templates/core/.context/architecture/data-flow.md +103 -0
- package/templates/core/.context/architecture/data-model.md +35 -0
- package/templates/core/.context/architecture/decisions/001-template.md +35 -0
- package/templates/core/.context/architecture/dependencies.md +35 -0
- package/templates/core/.context/architecture/infrastructure.md +42 -0
- package/templates/core/.context/architecture/module-graph.md +68 -0
- package/templates/core/.context/architecture/overview.md +87 -0
- package/templates/core/.context/business/domain-model.md +43 -0
- package/templates/core/.context/business/glossary.md +23 -0
- package/templates/core/.context/business/overview.md +29 -0
- package/templates/core/.context/business/workflows.md +61 -0
- package/templates/core/.context/constitution.md +84 -0
- package/templates/core/.context/conventions/code-style.md +47 -0
- package/templates/core/.context/conventions/error-handling.md +50 -0
- package/templates/core/.context/conventions/git.md +46 -0
- package/templates/core/.context/conventions/patterns.md +41 -0
- package/templates/core/.context/conventions/testing.md +49 -0
- package/templates/core/.context/experience/debugging.md +21 -0
- package/templates/core/.context/experience/incidents.md +26 -0
- package/templates/core/.context/experience/lessons.md +23 -0
- package/templates/core/.context/experience/performance.md +29 -0
- package/templates/core/.context/index.md +93 -0
- package/templates/core/.context/progress/backlog.md +23 -0
- package/templates/core/.context/progress/status.md +30 -0
- package/templates/core/.context/workflow/artifacts/.gitkeep +0 -0
- package/templates/core/.context/workflow/config.md +35 -0
- package/templates/core/AGENTS.md +53 -0
- package/templates/core/scripts/compact-experience.sh +83 -0
- package/templates/core/scripts/detect-drift.sh +388 -0
- package/templates/core/scripts/extract-structure.sh +757 -0
- package/templates/core/scripts/sync-context.sh +510 -0
- package/templates/cursor/.cursor/rules/always.mdc +18 -0
- package/templates/cursor/.cursor/rules/backend.mdc +16 -0
- package/templates/cursor/.cursor/rules/database.mdc +16 -0
- package/templates/cursor/.cursor/rules/frontend.mdc +13 -0
- package/templates/cursor/.cursorrules +23 -0
- package/templates/github/.github/copilot-instructions.md +15 -0
- package/templates/github/.github/workflows/context-drift.yml +73 -0
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
# Phase Interface Contract
|
|
2
|
+
|
|
3
|
+
Every workflow phase — built-in or plugin — follows this contract.
|
|
4
|
+
|
|
5
|
+
## Generic Interface
|
|
6
|
+
|
|
7
|
+
```
|
|
8
|
+
Input: [required artifact files] + [.context/ files for reference]
|
|
9
|
+
Output: [artifact files produced]
|
|
10
|
+
Plugin types: skill | mcp | script
|
|
11
|
+
Checkpoint: configurable (true/false in config.md)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Plugin Resolution Order
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
1. Config override → .context/workflow/config.md "Plugin Overrides" table
|
|
18
|
+
2. Convention dir → .claude/workflow/phases/{phase-id}/SKILL.md
|
|
19
|
+
3. Built-in default → .claude/skills/dev-{phase}/SKILL.md
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
## Phase Definitions
|
|
23
|
+
|
|
24
|
+
### P0: Requirements Gathering
|
|
25
|
+
- **Input**: User conversation / issue links / raw text
|
|
26
|
+
- **Output**: `.context/workflow/artifacts/requirements.md`
|
|
27
|
+
- **Context**: `business/overview.md`, `business/domain-model.md`
|
|
28
|
+
|
|
29
|
+
### P1: PRD Generation
|
|
30
|
+
- **Input**: `artifacts/requirements.md`
|
|
31
|
+
- **Output**: `artifacts/prd.md`
|
|
32
|
+
- **Context**: `business/*`, `architecture/overview.md`, `architecture/api-surface.md`
|
|
33
|
+
|
|
34
|
+
### P2: Task Decomposition
|
|
35
|
+
- **Input**: `artifacts/prd.md`
|
|
36
|
+
- **Output**: `artifacts/tasks.json`
|
|
37
|
+
- **Context**: `architecture/overview.md`, `architecture/module-graph.md`, `conventions/patterns.md`
|
|
38
|
+
|
|
39
|
+
### P3: Dependency Analysis
|
|
40
|
+
- **Input**: `artifacts/tasks.json`
|
|
41
|
+
- **Output**: `artifacts/dep-graph.json`
|
|
42
|
+
- **Context**: `architecture/module-graph.md`
|
|
43
|
+
|
|
44
|
+
### P4: Agent Execution
|
|
45
|
+
- **Input**: `artifacts/dep-graph.json` + `artifacts/tasks.json` + `agents/team-config.md`
|
|
46
|
+
- **Output**: `artifacts/execution-log.md` + code changes
|
|
47
|
+
- **Context**: Per-task `context_files` + `conventions/*`
|
|
48
|
+
- **Agent team**: Uses role definitions from `.claude/workflow/agents/` (implementer, reviewer, tester)
|
|
49
|
+
- **Patterns**: `default` (implement→review→test), `lite` (implement→test), `implement-only`
|
|
50
|
+
|
|
51
|
+
### P5: Quality Gate
|
|
52
|
+
- **Input**: Code changes from P4
|
|
53
|
+
- **Output**: `artifacts/quality-report.md`
|
|
54
|
+
- **Context**: `conventions/testing.md`, `constitution.md`
|
|
55
|
+
|
|
56
|
+
### P6: Commit & Integration
|
|
57
|
+
- **Input**: Verified code changes + `artifacts/quality-report.md`
|
|
58
|
+
- **Output**: Git commits
|
|
59
|
+
- **Context**: `conventions/git.md`
|
|
60
|
+
|
|
61
|
+
### P7: Knowledge Capture
|
|
62
|
+
- **Input**: All changes from this workflow cycle
|
|
63
|
+
- **Output**: Updated `.context/` files
|
|
64
|
+
- **Context**: Full `.context/` system
|
|
65
|
+
|
|
66
|
+
## Writing a Custom Plugin (Skill Type)
|
|
67
|
+
|
|
68
|
+
Place a `SKILL.md` file in `.claude/workflow/phases/{phase-id}/`:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
---
|
|
72
|
+
phase: quality-gate
|
|
73
|
+
replaces: dev-quality
|
|
74
|
+
requires: [node, playwright]
|
|
75
|
+
---
|
|
76
|
+
|
|
77
|
+
# Custom Quality Gate
|
|
78
|
+
|
|
79
|
+
## Input
|
|
80
|
+
- Reads: artifacts/execution-log.md, git diff of changes
|
|
81
|
+
|
|
82
|
+
## Output
|
|
83
|
+
- Writes: artifacts/quality-report.md
|
|
84
|
+
|
|
85
|
+
## Implementation
|
|
86
|
+
[Your custom instructions here...]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### Writing a Custom Agent Role
|
|
90
|
+
|
|
91
|
+
Place a role definition in `.claude/workflow/agents/`:
|
|
92
|
+
|
|
93
|
+
```markdown
|
|
94
|
+
# Agent Role: [Name]
|
|
95
|
+
|
|
96
|
+
## Identity
|
|
97
|
+
[Who is this agent and what is its responsibility]
|
|
98
|
+
|
|
99
|
+
## Core Principles
|
|
100
|
+
[Key behavioral rules]
|
|
101
|
+
|
|
102
|
+
## Behavior
|
|
103
|
+
[Step-by-step process the agent follows]
|
|
104
|
+
|
|
105
|
+
## Output Format
|
|
106
|
+
[Structured output the agent must produce]
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
Reference it in `team-config.md` to include it in a collaboration pattern.
|
|
110
|
+
|
|
111
|
+
### Rules for Plugins
|
|
112
|
+
1. **Accept** the same input artifacts as the phase it replaces
|
|
113
|
+
2. **Produce** the same output artifacts (same file names, compatible schema)
|
|
114
|
+
3. **Document** requirements in frontmatter (dependencies, env vars, etc.)
|
|
115
|
+
|
|
116
|
+
## Artifact Schemas
|
|
117
|
+
|
|
118
|
+
### tasks.json
|
|
119
|
+
```json
|
|
120
|
+
{
|
|
121
|
+
"feature": "feature-name",
|
|
122
|
+
"created_at": "ISO-8601",
|
|
123
|
+
"tasks": [
|
|
124
|
+
{
|
|
125
|
+
"id": "T1",
|
|
126
|
+
"title": "Short task title",
|
|
127
|
+
"description": "What to implement and why",
|
|
128
|
+
"type": "feature | bugfix | refactor | test | docs | infra",
|
|
129
|
+
"scope": "backend | frontend | fullstack | database | infra",
|
|
130
|
+
"files_to_modify": ["src/..."],
|
|
131
|
+
"files_to_create": ["src/..."],
|
|
132
|
+
"depends_on": [],
|
|
133
|
+
"acceptance_criteria": ["..."],
|
|
134
|
+
"context_files": ["architecture/..."],
|
|
135
|
+
"complexity": "small | medium | large",
|
|
136
|
+
"test_requirements": "..."
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
}
|
|
140
|
+
```
|
|
141
|
+
|
|
142
|
+
### dep-graph.json
|
|
143
|
+
```json
|
|
144
|
+
{
|
|
145
|
+
"groups": [
|
|
146
|
+
{
|
|
147
|
+
"order": 1,
|
|
148
|
+
"tasks": ["T1", "T2"],
|
|
149
|
+
"isolation": { "T1": "none", "T2": "none" }
|
|
150
|
+
}
|
|
151
|
+
],
|
|
152
|
+
"critical_path": ["T1", "T3"],
|
|
153
|
+
"file_conflicts": {},
|
|
154
|
+
"total_groups": 1,
|
|
155
|
+
"max_parallelism": 2
|
|
156
|
+
}
|
|
157
|
+
```
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
# CLAUDE.md
|
|
2
|
+
|
|
3
|
+
> Claude Code-specific configuration. For the full context system, see `.context/`.
|
|
4
|
+
|
|
5
|
+
## Context System
|
|
6
|
+
|
|
7
|
+
This project uses a structured context system. Follow this loading protocol:
|
|
8
|
+
|
|
9
|
+
1. **Read `.context/constitution.md`** for principles and the Context Loading Route Table
|
|
10
|
+
2. **Use the Route Table** to determine which context files to load for your current task
|
|
11
|
+
3. Do NOT load all context files — only load what is relevant
|
|
12
|
+
|
|
13
|
+
## Available Skills
|
|
14
|
+
|
|
15
|
+
### Context Management
|
|
16
|
+
- `/bootstrap-context` — Build the .context/ system for a new project
|
|
17
|
+
- `/update-context` — Sync context files after code changes (detects uncommitted + new files)
|
|
18
|
+
- `/review-context` — Audit context system health (auto-fixes by default)
|
|
19
|
+
- `/sync` — Fast regeneration of all auto-generated files + concept index
|
|
20
|
+
|
|
21
|
+
### Development Workflow (`/dev`)
|
|
22
|
+
- `/dev` — Full automated SDLC pipeline (orchestrator)
|
|
23
|
+
- `/dev-requirements` — P0: Gather and structure requirements
|
|
24
|
+
- `/dev-prd` — P1: Generate PRD from requirements
|
|
25
|
+
- `/dev-decompose` — P2: Break PRD into tasks with file scope
|
|
26
|
+
- `/dev-deps` — P3: Analyze task dependencies, produce execution plan
|
|
27
|
+
- `/dev-execute` — P4: Orchestrate agents to implement tasks in parallel
|
|
28
|
+
- `/dev-quality` — P5: Run build/lint/test quality gates
|
|
29
|
+
- `/dev-commit` — P6: Create git commits following conventions
|
|
30
|
+
- `/dev-capture` — P7: Update .context/ with new knowledge
|
|
31
|
+
|
|
32
|
+
## Rules
|
|
33
|
+
|
|
34
|
+
- When modifying code that affects architecture, data models, or APIs, update corresponding `.context/` files
|
|
35
|
+
- When fixing non-trivial bugs, record in `.context/experience/debugging.md`
|
|
36
|
+
- When making significant decisions, create an ADR in `.context/architecture/decisions/`
|
|
37
|
+
- Files marked `<!-- AUTO-GENERATED -->` should not be edited manually
|
|
38
|
+
|
|
39
|
+
## Quick Reference
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
# Build
|
|
43
|
+
[BUILD_COMMAND]
|
|
44
|
+
|
|
45
|
+
# Test
|
|
46
|
+
[TEST_COMMAND]
|
|
47
|
+
|
|
48
|
+
# Check context drift
|
|
49
|
+
bash scripts/detect-drift.sh
|
|
50
|
+
```
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Concept Index
|
|
2
|
+
|
|
3
|
+
<!-- AUTO-GENERATED: Run /sync to regenerate. -->
|
|
4
|
+
<!-- generated-at: N/A -->
|
|
5
|
+
|
|
6
|
+
> Inverted index mapping concepts to context files.
|
|
7
|
+
> Search this file to find which context files discuss a topic without loading all files.
|
|
8
|
+
|
|
9
|
+
No concept index generated yet. Run `/sync` to build.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Drift Detection Report
|
|
2
|
+
|
|
3
|
+
<!-- AUTO-GENERATED by scripts/detect-drift.sh -->
|
|
4
|
+
<!-- generated-at: N/A -->
|
|
5
|
+
|
|
6
|
+
## Status: No report generated yet
|
|
7
|
+
|
|
8
|
+
Run `scripts/detect-drift.sh` to generate a drift detection report.
|
|
9
|
+
|
|
10
|
+
## Report Format
|
|
11
|
+
|
|
12
|
+
When generated, this file will contain:
|
|
13
|
+
|
|
14
|
+
| File | Status | Details |
|
|
15
|
+
|------|--------|---------|
|
|
16
|
+
| [context file] | [OK / STALE / DRIFT] | [Description of drift] |
|
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
# Context File Schema
|
|
2
|
+
|
|
3
|
+
> Self-documenting schema that defines the format, conventions, and size budgets for all context files.
|
|
4
|
+
|
|
5
|
+
## General Rules
|
|
6
|
+
|
|
7
|
+
1. **Format**: All context files are Markdown (`.md`), except `last-sync.json`
|
|
8
|
+
2. **Encoding**: UTF-8
|
|
9
|
+
3. **Line Endings**: LF (Unix-style)
|
|
10
|
+
4. **Size Budget**: Each file has a maximum line count (see constitution.md). When exceeded, the file must be split or compacted.
|
|
11
|
+
5. **Self-Contained**: Each file should be understandable on its own without requiring other context files to be loaded simultaneously.
|
|
12
|
+
|
|
13
|
+
## Metadata Comments
|
|
14
|
+
|
|
15
|
+
Every context file should include these HTML comments near the top:
|
|
16
|
+
|
|
17
|
+
```markdown
|
|
18
|
+
<!-- confidence: high|medium|low -->
|
|
19
|
+
<!-- source: [list of files/sources analyzed to generate this content] -->
|
|
20
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
- `confidence`: How reliable the content is (set during bootstrap, updated during validation)
|
|
24
|
+
- `source`: Traceability — which code files or documents were analyzed
|
|
25
|
+
- `last-updated`: When the content was last modified
|
|
26
|
+
|
|
27
|
+
## Auto-Generated Files
|
|
28
|
+
|
|
29
|
+
Files that can be 100% generated from code must include this header:
|
|
30
|
+
|
|
31
|
+
```markdown
|
|
32
|
+
<!-- AUTO-GENERATED: Do not edit manually. Run scripts/sync-context.sh to regenerate. -->
|
|
33
|
+
<!-- generated-from: [source files/patterns] -->
|
|
34
|
+
<!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Auto-generated files:
|
|
38
|
+
- `architecture/data-model.md` — from ORM models / migration files
|
|
39
|
+
- `architecture/api-surface.md` — from route definitions / OpenAPI specs
|
|
40
|
+
- `architecture/dependencies.md` — from package manifest files
|
|
41
|
+
- `architecture/class-index.md` — from source code class/struct/interface definitions (via `scripts/extract-structure.sh`)
|
|
42
|
+
- `_meta/concepts.md` — inverted concept-to-file index (via `/sync`)
|
|
43
|
+
|
|
44
|
+
## File Templates
|
|
45
|
+
|
|
46
|
+
### Business Files
|
|
47
|
+
|
|
48
|
+
```markdown
|
|
49
|
+
# [Title]
|
|
50
|
+
|
|
51
|
+
<!-- confidence: medium -->
|
|
52
|
+
<!-- source: [analyzed files] -->
|
|
53
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
54
|
+
|
|
55
|
+
## Summary
|
|
56
|
+
[3-5 line summary of this file's content]
|
|
57
|
+
|
|
58
|
+
## [Content Sections...]
|
|
59
|
+
[Structured content relevant to the file's purpose]
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Architecture Decision Record (ADR)
|
|
63
|
+
|
|
64
|
+
```markdown
|
|
65
|
+
# ADR-{NNN}: [Title]
|
|
66
|
+
|
|
67
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
68
|
+
|
|
69
|
+
## Status
|
|
70
|
+
[Proposed | Accepted | Deprecated | Superseded by ADR-XXX]
|
|
71
|
+
|
|
72
|
+
## Context
|
|
73
|
+
[What is the issue that we're seeing that is motivating this decision?]
|
|
74
|
+
|
|
75
|
+
## Decision
|
|
76
|
+
[What is the change that we're proposing and/or doing?]
|
|
77
|
+
|
|
78
|
+
## Consequences
|
|
79
|
+
[What becomes easier or more difficult to do because of this change?]
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### Experience Entry
|
|
83
|
+
|
|
84
|
+
```markdown
|
|
85
|
+
### YYYY-MM-DD: [Short Title]
|
|
86
|
+
- **Context**: [What was happening when this was discovered]
|
|
87
|
+
- **Root Cause**: [Why it happened]
|
|
88
|
+
- **Resolution**: [How it was fixed]
|
|
89
|
+
- **Prevention**: [What was done to prevent recurrence]
|
|
90
|
+
- **Tags**: #tag1 #tag2
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
### Feature Spec (OpenSpec-style)
|
|
94
|
+
|
|
95
|
+
```markdown
|
|
96
|
+
# Feature: [Feature Name]
|
|
97
|
+
|
|
98
|
+
<!-- confidence: high -->
|
|
99
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
100
|
+
|
|
101
|
+
## Overview
|
|
102
|
+
[What this feature does and why it exists]
|
|
103
|
+
|
|
104
|
+
## User Stories
|
|
105
|
+
- As a [role], I want to [action], so that [benefit]
|
|
106
|
+
|
|
107
|
+
## Requirements
|
|
108
|
+
### Functional
|
|
109
|
+
- [ ] [Requirement 1]
|
|
110
|
+
- [ ] [Requirement 2]
|
|
111
|
+
|
|
112
|
+
### Non-Functional
|
|
113
|
+
- [ ] [Performance, security, etc.]
|
|
114
|
+
|
|
115
|
+
## Data Model Changes
|
|
116
|
+
[Any new entities, fields, or relationships]
|
|
117
|
+
|
|
118
|
+
## API Changes
|
|
119
|
+
[New or modified endpoints]
|
|
120
|
+
|
|
121
|
+
## Design Notes
|
|
122
|
+
[Implementation approach, trade-offs considered]
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
### Module Graph
|
|
126
|
+
|
|
127
|
+
```markdown
|
|
128
|
+
# Module Graph
|
|
129
|
+
|
|
130
|
+
<!-- confidence: medium -->
|
|
131
|
+
<!-- source: [analyzed files] -->
|
|
132
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
133
|
+
|
|
134
|
+
## Subsystems
|
|
135
|
+
[Table: Module | Directory | Responsibility | Key Classes]
|
|
136
|
+
|
|
137
|
+
## Dependency Graph
|
|
138
|
+
[ASCII diagram of module dependencies]
|
|
139
|
+
|
|
140
|
+
## Module Interfaces
|
|
141
|
+
[Per-module: public entry points, depends on, depended by]
|
|
142
|
+
|
|
143
|
+
## Namespace / Directory Mapping
|
|
144
|
+
[Table: Namespace | Directory | File Count]
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
### Data Flow
|
|
148
|
+
|
|
149
|
+
```markdown
|
|
150
|
+
# Data Flow & Pipelines
|
|
151
|
+
|
|
152
|
+
<!-- confidence: medium -->
|
|
153
|
+
<!-- source: [analyzed files] -->
|
|
154
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
155
|
+
|
|
156
|
+
## Application Lifecycle
|
|
157
|
+
[Startup → Main Loop → Shutdown]
|
|
158
|
+
|
|
159
|
+
## Core Pipelines
|
|
160
|
+
[Per-pipeline: purpose, trigger, stage diagram, data transformations]
|
|
161
|
+
|
|
162
|
+
## Threading / Concurrency Model
|
|
163
|
+
[Table: Thread/Task | Responsibility | Communicates With]
|
|
164
|
+
|
|
165
|
+
## Event / Message Flow
|
|
166
|
+
[Table: Event | Producer | Consumer(s) | Payload]
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
### Class Index (Auto-Generated)
|
|
170
|
+
|
|
171
|
+
```markdown
|
|
172
|
+
# Class Index
|
|
173
|
+
|
|
174
|
+
<!-- AUTO-GENERATED: Run scripts/extract-structure.sh to regenerate. -->
|
|
175
|
+
|
|
176
|
+
## Core Classes by Module
|
|
177
|
+
[Per-module table: Class | File | Role | Description]
|
|
178
|
+
[Role categories: Base class, Interface, Facade, Core, Enum]
|
|
179
|
+
|
|
180
|
+
## Inheritance Trees
|
|
181
|
+
[ASCII trees for classes with 3+ descendants]
|
|
182
|
+
|
|
183
|
+
## Key Interfaces
|
|
184
|
+
[Table: Interface | File | Implemented By | Purpose]
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
### Change Proposal
|
|
188
|
+
|
|
189
|
+
```markdown
|
|
190
|
+
# Change: [Change Name]
|
|
191
|
+
|
|
192
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
193
|
+
|
|
194
|
+
## Motivation
|
|
195
|
+
[Why this change is needed]
|
|
196
|
+
|
|
197
|
+
## Proposal
|
|
198
|
+
[What we want to do]
|
|
199
|
+
|
|
200
|
+
## Impact Analysis
|
|
201
|
+
- **Files affected**: [list]
|
|
202
|
+
- **Breaking changes**: [yes/no, details]
|
|
203
|
+
- **Context files to update**: [list of .context/ files that need updating]
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
### Concept Index (Auto-Generated)
|
|
207
|
+
|
|
208
|
+
```markdown
|
|
209
|
+
# Concept Index
|
|
210
|
+
|
|
211
|
+
<!-- AUTO-GENERATED: Run /sync to regenerate. -->
|
|
212
|
+
<!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
|
|
213
|
+
|
|
214
|
+
> Inverted index mapping concepts to context files.
|
|
215
|
+
> Search this file to find which context files discuss a topic without loading all files.
|
|
216
|
+
|
|
217
|
+
| Concept | Discussed In |
|
|
218
|
+
|---------|-------------|
|
|
219
|
+
| concept-name | relative/path/to/file1.md, relative/path/to/file2.md |
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
Concept extraction rules:
|
|
223
|
+
- `##` and `###` headings → lowercased, spaces replaced with hyphens
|
|
224
|
+
- `**bold terms**` → lowercased
|
|
225
|
+
- First-column entries in markdown tables → lowercased
|
|
226
|
+
- Cap at 300 lines; if exceeded, keep only concepts appearing in 2+ files
|
|
227
|
+
|
|
228
|
+
## last-sync.json Schema
|
|
229
|
+
|
|
230
|
+
```json
|
|
231
|
+
{
|
|
232
|
+
"version": "1.0",
|
|
233
|
+
"lastFullSync": "YYYY-MM-DDTHH:MM:SSZ",
|
|
234
|
+
"files": {
|
|
235
|
+
"business/overview.md": {
|
|
236
|
+
"lastUpdated": "YYYY-MM-DDTHH:MM:SSZ",
|
|
237
|
+
"sourceHash": "sha256-of-source-files",
|
|
238
|
+
"confidence": "high"
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
```
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<!-- AUTO-GENERATED: Do not edit manually. Run scripts/sync-context.sh to regenerate. -->
|
|
2
|
+
<!-- generated-from: [route definitions / OpenAPI spec] -->
|
|
3
|
+
<!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
|
|
4
|
+
|
|
5
|
+
# API Surface
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
<!-- API contracts, endpoints, authentication, and protocols -->
|
|
10
|
+
|
|
11
|
+
[PLACEHOLDER: Run `scripts/sync-context.sh` or `/bootstrap-context` to auto-generate from route definitions and OpenAPI specs.]
|
|
12
|
+
|
|
13
|
+
## Base URL
|
|
14
|
+
|
|
15
|
+
- Development: `http://localhost:[PORT]`
|
|
16
|
+
- Production: `[PROD_URL]`
|
|
17
|
+
|
|
18
|
+
## Authentication
|
|
19
|
+
|
|
20
|
+
- Method: [e.g., JWT Bearer, OAuth 2.0, API Key]
|
|
21
|
+
- Header: `Authorization: Bearer <token>`
|
|
22
|
+
|
|
23
|
+
## Endpoints
|
|
24
|
+
|
|
25
|
+
### [Module/Controller 1]
|
|
26
|
+
|
|
27
|
+
| Method | Path | Description | Auth |
|
|
28
|
+
|--------|------|-------------|------|
|
|
29
|
+
| GET | `/api/v1/[resource]` | [Description] | [Yes/No] |
|
|
30
|
+
| POST | `/api/v1/[resource]` | [Description] | [Yes/No] |
|
|
31
|
+
| PUT | `/api/v1/[resource]/:id` | [Description] | [Yes/No] |
|
|
32
|
+
| DELETE | `/api/v1/[resource]/:id` | [Description] | [Yes/No] |
|
|
33
|
+
|
|
34
|
+
### [Module/Controller 2]
|
|
35
|
+
|
|
36
|
+
| Method | Path | Description | Auth |
|
|
37
|
+
|--------|------|-------------|------|
|
|
38
|
+
| GET | `/api/v1/[resource]` | [Description] | [Yes/No] |
|
|
39
|
+
|
|
40
|
+
## Common Response Formats
|
|
41
|
+
|
|
42
|
+
```json
|
|
43
|
+
// Success
|
|
44
|
+
{ "data": {...}, "message": "OK" }
|
|
45
|
+
|
|
46
|
+
// Error
|
|
47
|
+
{ "error": { "code": "ERROR_CODE", "message": "Description" } }
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Rate Limiting
|
|
51
|
+
|
|
52
|
+
[Rate limiting rules if applicable]
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
# Class Index
|
|
2
|
+
|
|
3
|
+
<!-- AUTO-GENERATED: Do not edit manually. Run scripts/extract-structure.sh to regenerate. -->
|
|
4
|
+
<!-- generated-from: source code analysis -->
|
|
5
|
+
<!-- generated-at: YYYY-MM-DDTHH:MM:SSZ -->
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
<!-- Auto-generated index of core classes, interfaces, and key data structures per module.
|
|
10
|
+
Only includes: base classes, abstract classes, interfaces, facade/manager/system classes,
|
|
11
|
+
and core data structures. Internal implementation classes are excluded. -->
|
|
12
|
+
|
|
13
|
+
[PLACEHOLDER: Run `/bootstrap-context` or `scripts/extract-structure.sh` to auto-generate.]
|
|
14
|
+
|
|
15
|
+
## Core Classes by Module
|
|
16
|
+
|
|
17
|
+
### [module_name/] ([N] core classes out of [M] total)
|
|
18
|
+
|
|
19
|
+
| Class | File | Role | Description |
|
|
20
|
+
|-------|------|------|-------------|
|
|
21
|
+
| [ClassName] | [path/file.ext] | [Base class / Interface / Facade / Core] | [One-line description] |
|
|
22
|
+
|
|
23
|
+
<!-- Role categories:
|
|
24
|
+
- Base class: Abstract/virtual base that others inherit from
|
|
25
|
+
- Interface: Pure interface / trait / protocol
|
|
26
|
+
- Facade: Entry point class for a module (Manager, System, Service)
|
|
27
|
+
- Core: Key data structure or essential class
|
|
28
|
+
- Enum: Important enumeration type
|
|
29
|
+
-->
|
|
30
|
+
|
|
31
|
+
## Inheritance Trees
|
|
32
|
+
|
|
33
|
+
<!-- Key inheritance hierarchies (only for classes with 3+ descendants) -->
|
|
34
|
+
|
|
35
|
+
```
|
|
36
|
+
[BaseClass]
|
|
37
|
+
├── [DerivedA]
|
|
38
|
+
│ ├── [DerivedA1]
|
|
39
|
+
│ └── [DerivedA2]
|
|
40
|
+
└── [DerivedB]
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Key Interfaces
|
|
44
|
+
|
|
45
|
+
<!-- Interfaces/traits/protocols that define module boundaries -->
|
|
46
|
+
|
|
47
|
+
| Interface | File | Implemented By | Purpose |
|
|
48
|
+
|-----------|------|---------------|---------|
|
|
49
|
+
| [IInterface] | [path/file.ext] | [Class1, Class2] | [What this contract defines] |
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
# Data Flow & Pipelines
|
|
2
|
+
|
|
3
|
+
<!-- confidence: low -->
|
|
4
|
+
<!-- source: [TO BE FILLED BY BOOTSTRAP] -->
|
|
5
|
+
<!-- last-updated: YYYY-MM-DD -->
|
|
6
|
+
|
|
7
|
+
## Summary
|
|
8
|
+
|
|
9
|
+
<!-- Key data flows, processing pipelines, and execution sequences in the system -->
|
|
10
|
+
|
|
11
|
+
[PLACEHOLDER: Run `/bootstrap-context` to auto-generate from codebase analysis.]
|
|
12
|
+
|
|
13
|
+
## Application Lifecycle
|
|
14
|
+
|
|
15
|
+
<!-- The main execution flow from startup to shutdown -->
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
[Entry Point] → [Initialization] → [Main Loop / Request Handling] → [Shutdown / Cleanup]
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Startup Sequence
|
|
22
|
+
|
|
23
|
+
1. [Step 1 — e.g., Parse config, initialize logging]
|
|
24
|
+
2. [Step 2 — e.g., Initialize subsystems]
|
|
25
|
+
3. [Step 3 — e.g., Load resources]
|
|
26
|
+
4. [Step 4 — e.g., Enter main loop / start listening]
|
|
27
|
+
|
|
28
|
+
### Shutdown Sequence
|
|
29
|
+
|
|
30
|
+
1. [Step 1 — e.g., Signal shutdown]
|
|
31
|
+
2. [Step 2 — e.g., Flush buffers, save state]
|
|
32
|
+
3. [Step 3 — e.g., Release resources]
|
|
33
|
+
4. [Step 4 — e.g., Destroy subsystems]
|
|
34
|
+
|
|
35
|
+
## Core Pipelines
|
|
36
|
+
|
|
37
|
+
<!-- Major data processing pipelines. Use ASCII flow diagrams. -->
|
|
38
|
+
|
|
39
|
+
### [Pipeline Name 1]
|
|
40
|
+
|
|
41
|
+
**Purpose**: [What this pipeline does]
|
|
42
|
+
**Trigger**: [What initiates this pipeline — e.g., per frame, per request, on event]
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
[Stage 1] → [Stage 2] → [Stage 3] → [Stage 4] → [Output]
|
|
46
|
+
│
|
|
47
|
+
└─→ [Branch/Error path]
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
**Key data transformations**:
|
|
51
|
+
- Stage 1 → Stage 2: [Input type] → [Output type]
|
|
52
|
+
- Stage 2 → Stage 3: [Transformation description]
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
### [Pipeline Name 2]
|
|
57
|
+
|
|
58
|
+
**Purpose**: [What this pipeline does]
|
|
59
|
+
**Trigger**: [What initiates this pipeline]
|
|
60
|
+
|
|
61
|
+
```
|
|
62
|
+
[Stage 1] → [Stage 2] → [Stage 3] → [Output]
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Threading / Concurrency Model
|
|
66
|
+
|
|
67
|
+
<!-- How work is distributed across threads, processes, or async tasks -->
|
|
68
|
+
|
|
69
|
+
| Thread / Task | Responsibility | Communicates With |
|
|
70
|
+
|--------------|----------------|-------------------|
|
|
71
|
+
| [Main thread] | [Description] | [Other threads via mechanism] |
|
|
72
|
+
| [Worker pool] | [Description] | [Queue/channel/shared state] |
|
|
73
|
+
|
|
74
|
+
### Synchronization Points
|
|
75
|
+
|
|
76
|
+
- [Sync point 1 — e.g., Frame boundary: main thread waits for render thread]
|
|
77
|
+
- [Sync point 2 — e.g., Resource loading: async callback on main thread]
|
|
78
|
+
|
|
79
|
+
## Event / Message Flow
|
|
80
|
+
|
|
81
|
+
<!-- If the system uses events, signals, or message passing -->
|
|
82
|
+
|
|
83
|
+
### Key Events
|
|
84
|
+
|
|
85
|
+
| Event | Producer | Consumer(s) | Payload |
|
|
86
|
+
|-------|----------|-------------|---------|
|
|
87
|
+
| [EventName] | [Module] | [Module1, Module2] | [Data description] |
|
|
88
|
+
|
|
89
|
+
## External Data Flow
|
|
90
|
+
|
|
91
|
+
<!-- Data flow with external systems (files, network, databases, hardware) -->
|
|
92
|
+
|
|
93
|
+
```
|
|
94
|
+
[External Source] ──→ [Input Processing] ──→ [Internal Representation]
|
|
95
|
+
│
|
|
96
|
+
[External Sink] ←── [Output Processing] ←──────────┘
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
| External System | Direction | Format | Module Responsible |
|
|
100
|
+
|----------------|-----------|--------|-------------------|
|
|
101
|
+
| [FileSystem] | In/Out | [Format] | [ModuleName] |
|
|
102
|
+
| [Network/API] | In/Out | [Protocol] | [ModuleName] |
|
|
103
|
+
| [Hardware/GPU] | Out | [Commands] | [ModuleName] |
|