engineering-intelligence 0.2.0 → 0.4.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 (44) hide show
  1. package/README.md +5 -1
  2. package/dist/adapters/index.js +3 -3
  3. package/dist/adapters/index.js.map +1 -1
  4. package/dist/cli/index.js +24 -3
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/templates.d.ts +1 -1
  7. package/dist/templates.js +2 -2
  8. package/dist/templates.js.map +1 -1
  9. package/dist/validation/index.js +1 -1
  10. package/dist/validation/index.js.map +1 -1
  11. package/dist/visualizer/index.d.ts +2 -0
  12. package/dist/visualizer/index.d.ts.map +1 -0
  13. package/dist/visualizer/index.js +599 -0
  14. package/dist/visualizer/index.js.map +1 -0
  15. package/package.json +3 -3
  16. package/templates/canonical/agents/change-agent.md +58 -1
  17. package/templates/canonical/agents/engineering-orchestrator.md +69 -3
  18. package/templates/canonical/agents/knowledge-agent.md +59 -2
  19. package/templates/canonical/agents/quality-agent.md +59 -2
  20. package/templates/canonical/rules/engineering-intelligence.md +42 -13
  21. package/templates/canonical/skills/architecture-review-engine/SKILL.md +112 -3
  22. package/templates/canonical/skills/change-detection-engine/SKILL.md +82 -7
  23. package/templates/canonical/skills/change-history-engine/SKILL.md +125 -5
  24. package/templates/canonical/skills/context-sync-engine/SKILL.md +116 -9
  25. package/templates/canonical/skills/deep-project-knowledge-extractor/SKILL.md +171 -5
  26. package/templates/canonical/skills/engineering-change-review/SKILL.md +145 -9
  27. package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +168 -0
  28. package/templates/canonical/skills/graph-engine/SKILL.md +134 -14
  29. package/templates/canonical/skills/impact-analysis-engine/SKILL.md +125 -11
  30. package/templates/canonical/skills/incremental-sync-engine/SKILL.md +75 -10
  31. package/templates/canonical/skills/initialize-intelligence-skill/SKILL.md +130 -0
  32. package/templates/canonical/skills/knowledge-base-validator/SKILL.md +92 -7
  33. package/templates/canonical/skills/knowledge-sync-engine/SKILL.md +77 -8
  34. package/templates/canonical/skills/memory-sync-engine/SKILL.md +70 -8
  35. package/templates/canonical/skills/refactoring-planner/SKILL.md +143 -2
  36. package/templates/canonical/skills/testing-intelligence-engine/SKILL.md +119 -3
  37. package/templates/canonical/workflows/analyze-impact.md +25 -3
  38. package/templates/canonical/workflows/engineering-intelligence.md +20 -3
  39. package/templates/canonical/workflows/initialize-engineering-intelligence.md +30 -3
  40. package/templates/canonical/workflows/map-architecture.md +17 -6
  41. package/templates/canonical/workflows/review-engineering-change.md +26 -2
  42. package/templates/canonical/workflows/sync-engineering-intelligence.md +20 -2
  43. package/templates/canonical/skills/engineering-intelligence/SKILL.md +0 -21
  44. package/templates/canonical/skills/initialize-engineering-intelligence/SKILL.md +0 -32
@@ -0,0 +1,168 @@
1
+ ---
2
+ name: engineering-intelligence-skill
3
+ description: Executes engineering changes with impact analysis, implementation, tests, validation, and incremental synchronization of project intelligence. Use for feature, bugfix, update, refactor, architecture, infrastructure, or security requests.
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # Engineering Intelligence Implementation
8
+
9
+ The core implementation skill for engineering work. Use after project intelligence has been initialized.
10
+
11
+ ## Inputs
12
+
13
+ - User request describing the desired change
14
+ - Repository with initialized intelligence (`knowledge-base/`, `.engineering-intelligence/`)
15
+
16
+ ## Request Classification
17
+
18
+ Classify the incoming request before starting:
19
+
20
+ | Type | Description | Risk Level |
21
+ |---|---|---|
22
+ | `feature` | New user-facing functionality | Medium–High |
23
+ | `bugfix` | Correction of incorrect behavior | Low–Medium |
24
+ | `update` | Dependency, config, or version updates | Low–Medium |
25
+ | `refactor` | Structural improvement without behavior change | Medium |
26
+ | `architecture` | Boundary, layer, or pattern changes | High |
27
+ | `infrastructure` | CI, deployment, environment changes | Medium–High |
28
+ | `security` | Auth, permissions, vulnerability fixes | High |
29
+ | `documentation` | Knowledge-only changes (no product code) | Low |
30
+
31
+ ## Procedure
32
+
33
+ ### 1. Pre-Flight: Read Intelligence
34
+
35
+ Read these artifacts and identify relevant context:
36
+ - `knowledge-base/` — architecture, APIs, runtime flow relevant to the change
37
+ - `.engineering-intelligence/memory/` — decisions, constraints, patterns that apply
38
+ - `.engineering-intelligence/context/` — module map, critical paths, dangerous areas near the change
39
+ - `.engineering-intelligence/graph/` — dependency and service relationships
40
+
41
+ **If intelligence is missing or stale**: Run `initialize-intelligence-skill` first.
42
+
43
+ ### 2. Impact Analysis: Write Report
44
+
45
+ Before any code edit, write `.engineering-intelligence/reports/IMP-XXX-<summary>.md`:
46
+
47
+ ```markdown
48
+ # IMP-XXX: <summary>
49
+
50
+ ## Classification
51
+ - Type: <feature|bugfix|update|refactor|architecture|infrastructure|security>
52
+ - Risk: <low|medium|high|critical>
53
+ - Scope: <files and modules affected>
54
+
55
+ ## Analysis
56
+ - Mode: <proposal|diff>
57
+ - Graph inputs consulted: <list>
58
+ - Directly affected: <files, modules, services>
59
+ - Indirectly affected: <downstream consumers, dependent services>
60
+ - Risk factors: <breaking changes, data migration, auth impact>
61
+
62
+ ## Validation Requirements
63
+ - <test types needed>
64
+ - <manual verification needed>
65
+
66
+ ## Intelligence Artifacts Affected
67
+ - <knowledge docs, memory entries, context maps, graph nodes>
68
+
69
+ ## Evidence
70
+ - <file paths supporting each claim>
71
+
72
+ ## Unknowns
73
+ - <areas where impact is uncertain>
74
+ ```
75
+
76
+ ### 3. Implement the Change
77
+
78
+ - Edit only the files necessary for the request
79
+ - Follow existing coding patterns from `.engineering-intelligence/memory/coding-patterns.md`
80
+ - Respect architectural boundaries from `.engineering-intelligence/memory/architecture-decisions.md`
81
+ - Consult `dangerous-areas.md` before modifying flagged code
82
+
83
+ ### 4. Add/Update Tests
84
+
85
+ - Add tests proportional to the change risk level
86
+ - For `bugfix`: add a regression test reproducing the original issue
87
+ - For `feature`: add unit tests and integration tests for the new behavior
88
+ - For `architecture`/`security`: add boundary and negative-path tests
89
+ - Run the project's test suite and record actual results
90
+
91
+ ### 5. Validate
92
+
93
+ - Run linters, type checks, and test suites available in the project
94
+ - **Never claim validation passed unless it actually ran and passed**
95
+ - Record partial or failed validation honestly
96
+
97
+ ### 6. Incremental Sync
98
+
99
+ Use `incremental-sync-engine` to update only affected artifacts:
100
+ - Knowledge docs reflecting changed behavior
101
+ - Memory entries if decisions/patterns changed
102
+ - Context maps if module/service topology changed
103
+ - Graph nodes/edges if dependencies or services changed
104
+ - Event guidance if API/schema/auth contracts changed
105
+
106
+ ### 7. Record Change
107
+
108
+ Create `.changes/CHG-XXX-<summary>.md`:
109
+
110
+ ```markdown
111
+ # CHG-XXX: <summary>
112
+
113
+ ## Request
114
+ <original user request>
115
+
116
+ ## Classification
117
+ - Type: <type> | Risk: <level>
118
+
119
+ ## Implementation Summary
120
+ <what was changed and why>
121
+
122
+ ## Files Changed
123
+ - <path> — <description of change>
124
+
125
+ ## Tests
126
+ - <tests added/modified>
127
+ - <test results: passed/failed/skipped>
128
+
129
+ ## Related Reports
130
+ - IMP-XXX: <link to impact report>
131
+ - REV-XXX: <link to review report, if applicable>
132
+
133
+ ## Synchronized Artifacts
134
+ - <list of updated intelligence artifacts>
135
+
136
+ ## Unresolved Risks
137
+ - <any remaining concerns>
138
+ ```
139
+
140
+ ### 8. High-Risk Review Gate
141
+
142
+ For changes classified as `high` or `critical` risk:
143
+ - Run `engineering-change-review` before final reporting
144
+ - Address any blocking findings before marking complete
145
+
146
+ ### 9. Report
147
+
148
+ Summarize to the user:
149
+ - Code changes made (files, lines)
150
+ - Tests run and results
151
+ - Affected systems and services
152
+ - Synchronized intelligence artifacts
153
+ - Unresolved risks or follow-ups
154
+
155
+ ## Quality Gates
156
+
157
+ - [ ] Impact report written before any code edit
158
+ - [ ] All changed behavior has corresponding test coverage
159
+ - [ ] Validation was actually executed (not just claimed)
160
+ - [ ] Only affected intelligence artifacts were updated
161
+ - [ ] Change record references the correct impact report
162
+ - [ ] High-risk changes went through review gate
163
+
164
+ ## Cross-References
165
+
166
+ - Depends on: `initialize-intelligence-skill` (prerequisite), `change-detection-engine`, `impact-analysis-engine`, `graph-engine`
167
+ - Uses during execution: `testing-intelligence-engine`, `incremental-sync-engine`, `change-history-engine`
168
+ - Optional: `engineering-change-review` (for high-risk), `refactoring-planner` (for refactors)
@@ -1,19 +1,24 @@
1
1
  ---
2
2
  name: graph-engine
3
- description: Builds and incrementally maintains evidence-backed dependency, service, runtime, and business-flow graph artifacts with a human-readable architecture map. Use during initialization, explicit architecture mapping, or changes that affect relationships.
3
+ description: Builds and maintains evidence-backed JSON architecture graphs and Mermaid architecture maps representing project dependencies, services, runtime flows, and business processes.
4
+ version: 3.0.0
4
5
  ---
5
6
 
6
7
  # Graph Engine
7
8
 
8
- Generate project graph intelligence under `.engineering-intelligence/graph/`:
9
+ Build and maintain structured, evidence-backed architecture graphs that enable impact analysis, dependency tracing, and architectural understanding.
9
10
 
10
- - `dependency-graph.json`: modules, packages, shared libraries, imports, and dependency relationships
11
- - `service-graph.json`: deployable services, databases, queues, external integrations, and communication links
12
- - `runtime-graph.json`: startup, request, job, and event execution paths
13
- - `business-flow-graph.json`: verified business/user workflows and participating code or services
14
- - `architecture-map.md`: Mermaid diagrams and human-readable interpretation of the JSON graphs
11
+ ## Inputs
15
12
 
16
- ## Graph JSON Contract
13
+ - Repository root path
14
+ - Mode: `full` (initialization/remapping) or `incremental` (post-change update)
15
+ - Optional: scope constraints for incremental updates
16
+
17
+ ## Graph Artifacts
18
+
19
+ All graphs are stored in `.engineering-intelligence/graph/`.
20
+
21
+ ### Graph JSON Schema
17
22
 
18
23
  Each JSON graph uses this envelope:
19
24
 
@@ -30,6 +35,7 @@ Each JSON graph uses this envelope:
30
35
  "label": "<human name>",
31
36
  "path": "<repository path when applicable>",
32
37
  "confidence": "verified | inferred | unknown",
38
+ "metadata": {},
33
39
  "evidence": ["<file path or configuration evidence>"]
34
40
  }
35
41
  ],
@@ -39,6 +45,7 @@ Each JSON graph uses this envelope:
39
45
  "to": "<node id>",
40
46
  "relation": "<relationship>",
41
47
  "confidence": "verified | inferred | unknown",
48
+ "metadata": {},
42
49
  "evidence": ["<file path or configuration evidence>"]
43
50
  }
44
51
  ],
@@ -46,13 +53,126 @@ Each JSON graph uses this envelope:
46
53
  }
47
54
  ```
48
55
 
56
+ ### 1. `dependency-graph.json` — Module/Package Dependencies
57
+
58
+ | Node Kind | Description |
59
+ |---|---|
60
+ | `package` | npm/pip/cargo/go package |
61
+ | `module` | Internal code module or directory |
62
+ | `config` | Configuration file or env dependency |
63
+ | `external` | Third-party library or service SDK |
64
+
65
+ | Edge Relation | Description |
66
+ |---|---|
67
+ | `imports` | Direct import/require dependency |
68
+ | `devDependency` | Development-only dependency |
69
+ | `peerDependency` | Peer/optional dependency |
70
+ | `configures` | Configuration dependency |
71
+
72
+ ### 2. `service-graph.json` — Service Communication Topology
73
+
74
+ | Node Kind | Description |
75
+ |---|---|
76
+ | `service` | Deployable service or process |
77
+ | `database` | Data store (SQL, NoSQL, cache) |
78
+ | `queue` | Message queue or event bus |
79
+ | `gateway` | API gateway or load balancer |
80
+ | `external-api` | Third-party API endpoint |
81
+
82
+ | Edge Relation | Description |
83
+ |---|---|
84
+ | `http` | HTTP/REST communication |
85
+ | `grpc` | gRPC communication |
86
+ | `publishes` | Event/message publishing |
87
+ | `subscribes` | Event/message consumption |
88
+ | `reads` | Data store read access |
89
+ | `writes` | Data store write access |
90
+
91
+ ### 3. `runtime-graph.json` — Runtime Call Flows
92
+
93
+ | Node Kind | Description |
94
+ |---|---|
95
+ | `entrypoint` | Application entry point |
96
+ | `middleware` | Request middleware/interceptor |
97
+ | `handler` | Route handler or controller |
98
+ | `service-layer` | Business logic service |
99
+ | `repository` | Data access layer |
100
+ | `background` | Background job or worker |
101
+
102
+ | Edge Relation | Description |
103
+ |---|---|
104
+ | `calls` | Synchronous function/method call |
105
+ | `delegates` | Async delegation or queue dispatch |
106
+ | `wraps` | Middleware wrapping |
107
+ | `returns` | Response return path |
108
+
109
+ ### 4. `business-flow-graph.json` — Business Process Flows
110
+
111
+ | Node Kind | Description |
112
+ |---|---|
113
+ | `user-action` | User-initiated action |
114
+ | `system-step` | System processing step |
115
+ | `decision` | Conditional branch point |
116
+ | `integration` | External system interaction |
117
+ | `outcome` | Terminal state or result |
118
+
119
+ | Edge Relation | Description |
120
+ |---|---|
121
+ | `triggers` | Causal trigger |
122
+ | `on-success` | Happy path flow |
123
+ | `on-failure` | Error/failure path |
124
+ | `requires` | Prerequisite relationship |
125
+
126
+ ### 5. `architecture-map.md` — Mermaid Visualization
127
+
128
+ Derive Mermaid diagrams from the JSON graphs. Include:
129
+
130
+ - **System Overview** — High-level service topology (from service-graph)
131
+ - **Module Dependencies** — Package/module dependency flow (from dependency-graph)
132
+ - **Request Flow** — Primary request lifecycle (from runtime-graph)
133
+ - **Key Business Flows** — Critical business processes (from business-flow-graph)
134
+
135
+ ## Procedure
136
+
137
+ ### Full Mode (initialization or remapping)
138
+
139
+ 1. Scan all package manifests, imports, route definitions, service configs, and infrastructure files
140
+ 2. Build all four graphs from scratch
141
+ 3. Assign `verified` confidence to edges backed by explicit code evidence
142
+ 4. Assign `inferred` confidence to edges derived from patterns or naming conventions
143
+ 5. Mark unresolvable relationships as `unknown` and add to `unknowns` array
144
+ 6. Generate Mermaid diagrams in `architecture-map.md`
145
+
146
+ ### Incremental Mode (post-change update)
147
+
148
+ 1. Accept changed files/scope from the impact report or diff
149
+ 2. Identify affected nodes and edges across all graphs
150
+ 3. Update, add, or remove only affected nodes and edges
151
+ 4. Preserve stable node IDs — only change an ID if the represented element was renamed
152
+ 5. Re-derive affected sections of `architecture-map.md`
153
+ 6. Require full remapping only when structural impact cannot be bounded
154
+
49
155
  ## Rules
50
156
 
51
- - Keep node IDs stable across incremental updates while the represented element still exists.
52
- - Never mark an edge `verified` without evidence paths.
53
- - Distinguish inferred and unknown relationships clearly.
54
- - Derive Mermaid diagrams in `architecture-map.md` from the JSON graph content.
55
- - Rebuild all graphs on initialization, explicit mapping, or when structural impact cannot be bounded.
56
- - For ordinary changes, update only impacted nodes, edges, maps, and connected context documents.
157
+ - Keep node IDs stable across incremental updates while the represented element still exists
158
+ - Never mark an edge `verified` without evidence paths
159
+ - Distinguish `inferred` and `unknown` relationships clearly
160
+ - Derive Mermaid diagrams in `architecture-map.md` from the JSON graph content — never hand-author diagrams that contradict the JSON
161
+ - For ordinary changes, update only impacted nodes, edges, maps, and connected context documents
162
+ - Rebuild all graphs on initialization, explicit mapping request, or when structural impact cannot be bounded
163
+
164
+ ## Quality Gates
165
+
166
+ - [ ] All four JSON graphs validate against the schema above
167
+ - [ ] Every `verified` edge has at least one evidence path
168
+ - [ ] No `unknown` relationships are left out of the `unknowns` array
169
+ - [ ] `architecture-map.md` Mermaid diagrams are syntactically valid
170
+ - [ ] Node IDs are stable across incremental updates
171
+
172
+ ## Cross-References
173
+
174
+ - Used by: `initialize-intelligence-skill`, `impact-analysis-engine`, `incremental-sync-engine`
175
+ - Supports: `map-architecture` workflow, `analyze-impact` workflow
176
+ - Feeds context to: `context-sync-engine`
57
177
 
58
178
  This capability may write intelligence artifacts. It must not modify product code.
@@ -1,20 +1,134 @@
1
1
  ---
2
2
  name: impact-analysis-engine
3
3
  description: Determines direct and indirect impact of a proposed or implemented change across modules, APIs, schemas, runtime flows, infrastructure, integrations, and tests. Use before implementation and during synchronization.
4
+ version: 3.0.0
4
5
  ---
5
6
 
6
- # Impact Analysis
7
+ # Impact Analysis Engine
7
8
 
8
- Determine what can break before changing code. Analyze imports, callers, routes, data schemas, events, configuration, services, infrastructure, and existing tests.
9
+ Determine what can break before changing code. Produce a reusable impact report that guides implementation, testing, and synchronization decisions.
9
10
 
10
- Read `.engineering-intelligence/graph/` when available. If graphs are missing or stale for the assessed scope, invoke `graph-engine` to establish or refresh the necessary graph context.
11
+ ## Inputs
11
12
 
12
- Write a reusable `.engineering-intelligence/reports/IMP-XXX-<slug>.md` impact report containing:
13
+ - Change scope from `change-detection-engine` (proposal description, diff, commit range, or file list)
14
+ - Graph intelligence from `.engineering-intelligence/graph/` (when available)
15
+ - Project intelligence from `knowledge-base/` and `.engineering-intelligence/`
13
16
 
14
- - mode (`proposal` or `diff`) and inspected scope
15
- - graph inputs consulted or refreshed
16
- - directly affected files and systems
17
- - indirect dependencies and risks
18
- - required validation and tests
19
- - documentation, memory, context, event, and graph artifacts affected by the change
20
- - evidence, unknowns, and an explicit statement that impact analysis did not modify product code
17
+ ## Procedure
18
+
19
+ 1. **Resolve Scope** Accept the change scope. If ambiguous, ask for clarification — never assume.
20
+
21
+ 2. **Consult Graphs** — Read `.engineering-intelligence/graph/` for dependency, service, runtime, and business-flow relationships. If graphs are missing or stale for the assessed scope, invoke `graph-engine` to establish or refresh the necessary graph context.
22
+
23
+ 3. **Trace Direct Impact** Identify:
24
+ - Files directly modified or proposed for modification
25
+ - Functions, classes, types, and interfaces changed
26
+ - API contracts affected (routes, request/response shapes)
27
+ - Database schemas or migrations affected
28
+ - Configuration changes
29
+
30
+ 4. **Trace Indirect Impact** — Using graph intelligence, identify:
31
+ - Downstream consumers of changed modules (from dependency-graph)
32
+ - Services communicating with changed services (from service-graph)
33
+ - Runtime flows passing through changed code (from runtime-graph)
34
+ - Business processes affected (from business-flow-graph)
35
+ - Test suites covering affected code
36
+
37
+ 5. **Score Risk** — Assign risk based on:
38
+
39
+ | Factor | Low | Medium | High | Critical |
40
+ |---|---|---|---|---|
41
+ | **Blast radius** | 1–2 files | 3–10 files | 10+ files | Cross-service |
42
+ | **Data impact** | None | Read paths | Write paths | Schema migration |
43
+ | **Auth impact** | None | UI changes | Permission logic | Auth flow |
44
+ | **API contract** | None | Additive | Deprecated | Breaking |
45
+ | **Test coverage** | Well-tested | Partial | Sparse | None |
46
+
47
+ 6. **Identify Validation Needs** — Map impact to required validation:
48
+
49
+ | Impact Area | Validation Required |
50
+ |---|---|
51
+ | API contract change | Integration tests, contract tests |
52
+ | Schema change | Migration test, rollback test |
53
+ | Auth change | Security test, permission matrix |
54
+ | Runtime flow change | End-to-end test |
55
+ | UI change | Visual regression, accessibility |
56
+ | Infrastructure | Deploy to staging, smoke test |
57
+
58
+ 7. **Map Intelligence Artifacts** — Determine which intelligence artifacts need synchronization after the change is implemented.
59
+
60
+ ## Output Format
61
+
62
+ Write `.engineering-intelligence/reports/IMP-XXX-<slug>.md`:
63
+
64
+ ```markdown
65
+ # IMP-XXX: <descriptive title>
66
+
67
+ ## Meta
68
+ - Generated: <ISO timestamp>
69
+ - Mode: proposal | diff
70
+ - Scope: <description of what was analyzed>
71
+ - Risk: low | medium | high | critical
72
+
73
+ ## Graph Inputs
74
+ - Consulted: <list of graph artifacts read>
75
+ - Refreshed: <list of graphs rebuilt, if any>
76
+ - Missing: <graphs not available>
77
+
78
+ ## Direct Impact
79
+ | File/Module | Change Type | Risk |
80
+ |---|---|---|
81
+ | path/to/file.ts | Modified function `handleAuth` | high |
82
+
83
+ ## Indirect Impact
84
+ | Affected Area | Relationship | Confidence |
85
+ |---|---|---|
86
+ | UserService | Imports changed module | verified |
87
+ | /api/users endpoint | Calls modified handler | inferred |
88
+
89
+ ## Risk Assessment
90
+ - Overall risk: <level>
91
+ - Key risk factors: <list>
92
+ - Mitigations: <recommended actions>
93
+
94
+ ## Validation Requirements
95
+ - [ ] <specific test or check needed>
96
+
97
+ ## Intelligence Artifacts Affected
98
+ | Artifact | Reason |
99
+ |---|---|
100
+ | knowledge-base/04-api-documentation.md | API contract changed |
101
+ | .engineering-intelligence/graph/service-graph.json | New service dependency |
102
+
103
+ ## Evidence
104
+ - <file path citations>
105
+
106
+ ## Unknowns
107
+ - <uncertain impact areas>
108
+
109
+ ---
110
+ *This impact analysis did not modify product code.*
111
+ ```
112
+
113
+ ## Rules
114
+
115
+ - Never assume scope — ask when ambiguous
116
+ - Always consult available graphs before tracing impact manually
117
+ - Risk scoring must be justified with evidence
118
+ - The output report is reusable by `incremental-sync-engine` and `engineering-change-review`
119
+ - This capability is analytical only — it must not modify product code
120
+
121
+ ## Quality Gates
122
+
123
+ - [ ] Scope is explicitly stated (not assumed)
124
+ - [ ] Graph inputs are listed (consulted, refreshed, or missing)
125
+ - [ ] Direct and indirect impact are separated
126
+ - [ ] Risk score is justified with evidence
127
+ - [ ] Validation requirements are specific (not generic)
128
+ - [ ] Report ends with the "did not modify product code" statement
129
+
130
+ ## Cross-References
131
+
132
+ - Depends on: `change-detection-engine`, `graph-engine`
133
+ - Used by: `engineering-intelligence-skill`, `incremental-sync-engine`, `analyze-impact` workflow
134
+ - Consumed by: `engineering-change-review`, `testing-intelligence-engine`
@@ -1,21 +1,86 @@
1
1
  ---
2
2
  name: incremental-sync-engine
3
3
  description: Synchronizes only intelligence artifacts affected by a completed change or identified diff, including knowledge, memory, context, events, graphs, and reports. Use for explicit synchronization or after implementation.
4
+ version: 3.0.0
4
5
  ---
5
6
 
6
7
  # Incremental Sync Engine
7
8
 
8
- Read the completed diff, change record, supplied changed scope, and any existing impact report. If no impact report exists for the scope, run impact analysis first and write one under `.engineering-intelligence/reports/`.
9
+ Update only the intelligence artifacts affected by a specific change. Never regenerate unrelated content.
9
10
 
10
- Update only affected:
11
+ ## Inputs
11
12
 
12
- - `knowledge-base/` documentation
13
- - `.engineering-intelligence/memory/`
14
- - `.engineering-intelligence/context/`
15
- - `.engineering-intelligence/events/`
16
- - `.engineering-intelligence/graph/` JSON graphs and `architecture-map.md`
17
- - the associated impact report synchronization notes
13
+ - Completed diff, change record, or supplied changed scope
14
+ - Existing impact report (`.engineering-intelligence/reports/IMP-XXX-*.md`)
15
+ - If no impact report exists for the scope, run `impact-analysis-engine` first
18
16
 
19
- Use incremental graph changes by default. Require full graph remapping only for broad or unbounded structural changes.
17
+ ## Sync Decision Matrix
20
18
 
21
- As a standalone synchronization capability, do not write `.changes/CHG-XXX-*` records and do not modify product code.
19
+ Use this matrix to determine which artifact types need updating based on the change type:
20
+
21
+ | Change Type | Knowledge Base | Memory | Context | Events | Graphs | Reports |
22
+ |---|---|---|---|---|---|---|
23
+ | API route added/changed | `04-api-documentation.md` | — | `module-map.md` | `api-changed.md` | runtime-graph | IMP update |
24
+ | Database schema changed | `05-database.md` | — | — | `schema-changed.md` | dependency-graph | IMP update |
25
+ | Auth flow changed | `06-authentication.md` | `business-rules.md` | `critical-paths.md` | `auth-changed.md` | runtime-graph | IMP update |
26
+ | New feature added | `07/08-frontend/backend.md` | — | `module-map.md` | `feature-added.md` | dependency-graph | IMP update |
27
+ | Architecture decision | `02-architecture.md` | `architecture-decisions.md` | all maps | — | all graphs | IMP update |
28
+ | Dependency added/removed | `01-repository-structure.md` | `technology-decisions.md` | `dependency-map.md` | — | dependency-graph | IMP update |
29
+ | Infrastructure changed | `09-infrastructure.md` | — | — | `infrastructure-changed.md` | service-graph | IMP update |
30
+ | Refactor (no behavior change) | — | `coding-patterns.md` | affected maps | — | dependency-graph | — |
31
+ | Test changes only | — | — | — | — | — | — |
32
+ | Config/env changes | `09-infrastructure.md` | `project-constraints.md` | — | — | — | — |
33
+
34
+ ## Procedure
35
+
36
+ 1. **Read Impact Report** — Get the list of affected intelligence artifacts from the impact report. If no report exists, run `impact-analysis-engine` to create one.
37
+
38
+ 2. **Classify Changes** — Match each change against the sync decision matrix above.
39
+
40
+ 3. **Update Knowledge Base** — For each affected `knowledge-base/` document:
41
+ - Read the current document
42
+ - Identify the specific section(s) affected
43
+ - Update only those sections with new evidence
44
+ - Preserve all accurate existing content
45
+ - Add evidence citations for all changed claims
46
+
47
+ 4. **Update Memory** — Only if a durable decision, rule, constraint, pattern, or technology choice changed:
48
+ - Update the specific entry in the relevant memory document
49
+ - Add a `Last updated:` timestamp and reason
50
+
51
+ 5. **Update Context** — Only if module, service, runtime, dependency, critical-path, or risk topology changed:
52
+ - Update the specific entries in affected map documents
53
+ - Keep maps concise and navigational
54
+
55
+ 6. **Update Events** — Only if API, schema, auth, feature, or infrastructure contracts changed:
56
+ - Verify the change-event guidance still reflects the current system
57
+
58
+ 7. **Update Graphs** — Use `graph-engine` in incremental mode:
59
+ - Update only affected nodes and edges
60
+ - Preserve stable node IDs
61
+ - Require full remapping only for unbounded structural changes
62
+
63
+ 8. **Update Impact Report** — Add a synchronization notes section to the original impact report recording what was synced.
64
+
65
+ ## Rules
66
+
67
+ - **Incremental only**: Update only artifacts identified by the impact report — never regenerate unrelated content
68
+ - **Evidence required**: Attach evidence for every changed claim
69
+ - **Preserve accuracy**: Don't modify correct existing content
70
+ - **Full remap trigger**: Require full graph remapping only for broad structural changes (major refactors, architecture changes)
71
+ - **No change records**: As a standalone synchronization capability, do not write `.changes/CHG-XXX-*` records
72
+ - **No product code**: Must not modify product code
73
+
74
+ ## Quality Gates
75
+
76
+ - [ ] Impact report was consulted (or created) before syncing
77
+ - [ ] Only affected artifacts were modified
78
+ - [ ] Unrelated content was preserved unchanged
79
+ - [ ] Evidence citations were added for changed claims
80
+ - [ ] Graph updates used incremental mode (unless structural change required full remap)
81
+
82
+ ## Cross-References
83
+
84
+ - Depends on: `change-detection-engine`, `impact-analysis-engine`, `graph-engine`
85
+ - Used by: `engineering-intelligence-skill`, `sync-engineering-intelligence` workflow
86
+ - Delegates to: `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`