engineering-intelligence 0.2.0 → 0.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.
- package/README.md +4 -0
- package/dist/cli/index.js +24 -3
- package/dist/cli/index.js.map +1 -1
- package/dist/templates.d.ts +1 -1
- package/dist/templates.js +2 -2
- package/dist/templates.js.map +1 -1
- package/dist/visualizer/index.d.ts +2 -0
- package/dist/visualizer/index.d.ts.map +1 -0
- package/dist/visualizer/index.js +599 -0
- package/dist/visualizer/index.js.map +1 -0
- package/package.json +2 -2
- package/templates/canonical/agents/change-agent.md +58 -1
- package/templates/canonical/agents/engineering-orchestrator.md +69 -3
- package/templates/canonical/agents/knowledge-agent.md +59 -2
- package/templates/canonical/agents/quality-agent.md +59 -2
- package/templates/canonical/rules/engineering-intelligence.md +42 -13
- package/templates/canonical/skills/architecture-review-engine/SKILL.md +112 -3
- package/templates/canonical/skills/change-detection-engine/SKILL.md +82 -7
- package/templates/canonical/skills/change-history-engine/SKILL.md +125 -5
- package/templates/canonical/skills/context-sync-engine/SKILL.md +116 -9
- package/templates/canonical/skills/deep-project-knowledge-extractor/SKILL.md +171 -5
- package/templates/canonical/skills/engineering-change-review/SKILL.md +145 -9
- package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +168 -0
- package/templates/canonical/skills/graph-engine/SKILL.md +134 -14
- package/templates/canonical/skills/impact-analysis-engine/SKILL.md +125 -11
- package/templates/canonical/skills/incremental-sync-engine/SKILL.md +75 -10
- package/templates/canonical/skills/initialize-intelligence-skill/SKILL.md +130 -0
- package/templates/canonical/skills/knowledge-base-validator/SKILL.md +92 -7
- package/templates/canonical/skills/knowledge-sync-engine/SKILL.md +77 -8
- package/templates/canonical/skills/memory-sync-engine/SKILL.md +70 -8
- package/templates/canonical/skills/refactoring-planner/SKILL.md +143 -2
- package/templates/canonical/skills/testing-intelligence-engine/SKILL.md +119 -3
- package/templates/canonical/workflows/analyze-impact.md +25 -3
- package/templates/canonical/workflows/engineering-intelligence.md +20 -3
- package/templates/canonical/workflows/initialize-engineering-intelligence.md +30 -3
- package/templates/canonical/workflows/map-architecture.md +17 -6
- package/templates/canonical/workflows/review-engineering-change.md +26 -2
- package/templates/canonical/workflows/sync-engineering-intelligence.md +20 -2
- package/templates/canonical/skills/engineering-intelligence/SKILL.md +0 -21
- package/templates/canonical/skills/initialize-engineering-intelligence/SKILL.md +0 -32
|
@@ -1,19 +1,24 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: graph-engine
|
|
3
|
-
description: Builds and
|
|
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
|
-
|
|
9
|
+
Build and maintain structured, evidence-backed architecture graphs that enable impact analysis, dependency tracing, and architectural understanding.
|
|
9
10
|
|
|
10
|
-
|
|
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
|
-
|
|
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
|
-
-
|
|
56
|
-
-
|
|
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.
|
|
9
|
+
Determine what can break before changing code. Produce a reusable impact report that guides implementation, testing, and synchronization decisions.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## Inputs
|
|
11
12
|
|
|
12
|
-
|
|
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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
-
|
|
19
|
-
|
|
20
|
-
|
|
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
|
-
|
|
9
|
+
Update only the intelligence artifacts affected by a specific change. Never regenerate unrelated content.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## Inputs
|
|
11
12
|
|
|
12
|
-
-
|
|
13
|
-
- `.engineering-intelligence/
|
|
14
|
-
-
|
|
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
|
-
|
|
17
|
+
## Sync Decision Matrix
|
|
20
18
|
|
|
21
|
-
|
|
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`
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: initialize-intelligence-skill
|
|
3
|
+
description: Initializes project engineering intelligence by analyzing repository evidence and generating knowledge, context, memory, event guidance, architecture graphs, and an initialization change record. Invoke when onboarding a repository or when asked to initialize engineering intelligence.
|
|
4
|
+
version: 3.0.0
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# Initialize Engineering Intelligence
|
|
8
|
+
|
|
9
|
+
Create a trustworthy, evidence-backed project intelligence baseline. Analyze only artifacts present in source code, configuration, tests, infrastructure, and existing documentation. Mark unknowns and uncertainties explicitly — never invent architecture, APIs, schemas, or business rules.
|
|
10
|
+
|
|
11
|
+
## Inputs
|
|
12
|
+
|
|
13
|
+
- Repository root path (current working directory by default)
|
|
14
|
+
- Optional: explicit scope constraints (monorepo package, service boundary)
|
|
15
|
+
|
|
16
|
+
## Outputs
|
|
17
|
+
|
|
18
|
+
Generate the following artifacts in order:
|
|
19
|
+
|
|
20
|
+
### Knowledge Base (`knowledge-base/`)
|
|
21
|
+
|
|
22
|
+
| Document | Purpose |
|
|
23
|
+
|---|---|
|
|
24
|
+
| `00-project-overview.md` | Name, purpose, tech stack, repo structure summary |
|
|
25
|
+
| `01-repository-structure.md` | Directory tree, package boundaries, build artifacts |
|
|
26
|
+
| `02-architecture.md` | Layers, modules, boundaries, communication patterns |
|
|
27
|
+
| `03-runtime-flow.md` | Request lifecycle, startup, shutdown, async flows |
|
|
28
|
+
| `04-api-documentation.md` | Routes, endpoints, GraphQL schemas, RPC interfaces |
|
|
29
|
+
| `05-database.md` | Schemas, migrations, ORMs, data stores, caching |
|
|
30
|
+
| `06-authentication.md` | Auth flows, session management, RBAC, tokens |
|
|
31
|
+
| `07-frontend.md` | UI framework, routing, state management, components |
|
|
32
|
+
| `08-backend.md` | Server framework, middleware, service patterns |
|
|
33
|
+
| `09-infrastructure.md` | CI/CD, containers, cloud, deployment, environments |
|
|
34
|
+
| `10-integrations.md` | Third-party APIs, SDKs, webhooks, message queues |
|
|
35
|
+
| `11-complex-areas.md` | High-complexity modules, tricky logic, footguns |
|
|
36
|
+
| `12-technical-debt.md` | Known debt, deprecated patterns, migration needs |
|
|
37
|
+
| `13-onboarding.md` | Setup guide, dev workflow, common tasks |
|
|
38
|
+
| `14-glossary.md` | Domain terms, abbreviations, naming conventions |
|
|
39
|
+
| `15-validation-report.md` | Evidence audit of all claims made above |
|
|
40
|
+
|
|
41
|
+
### Durable Memory (`.engineering-intelligence/memory/`)
|
|
42
|
+
|
|
43
|
+
| Document | Content |
|
|
44
|
+
|---|---|
|
|
45
|
+
| `architecture-decisions.md` | ADRs, architectural choices, rationale |
|
|
46
|
+
| `business-rules.md` | Domain rules, invariants, constraints from code |
|
|
47
|
+
| `coding-patterns.md` | Recurring patterns, conventions, idioms |
|
|
48
|
+
| `project-constraints.md` | Performance budgets, compatibility, regulatory |
|
|
49
|
+
| `technology-decisions.md` | Stack choices, version policies, deprecation plans |
|
|
50
|
+
|
|
51
|
+
### Navigation Context (`.engineering-intelligence/context/`)
|
|
52
|
+
|
|
53
|
+
| Document | Content |
|
|
54
|
+
|---|---|
|
|
55
|
+
| `module-map.md` | Module names → paths → responsibilities |
|
|
56
|
+
| `service-map.md` | Services → ports → protocols → dependencies |
|
|
57
|
+
| `runtime-map.md` | Entry points → middleware chains → handlers |
|
|
58
|
+
| `critical-paths.md` | Revenue, auth, data-integrity flows |
|
|
59
|
+
| `dangerous-areas.md` | Fragile code, missing tests, race conditions |
|
|
60
|
+
| `dependency-map.md` | External deps → internal consumers → risk |
|
|
61
|
+
|
|
62
|
+
### Event Guidance (`.engineering-intelligence/events/`)
|
|
63
|
+
|
|
64
|
+
| Document | Trigger |
|
|
65
|
+
|---|---|
|
|
66
|
+
| `api-changed.md` | When API routes, payloads, or contracts change |
|
|
67
|
+
| `schema-changed.md` | When database schemas or migrations change |
|
|
68
|
+
| `auth-changed.md` | When auth flows or permissions change |
|
|
69
|
+
| `feature-added.md` | When new user-facing features are introduced |
|
|
70
|
+
| `infrastructure-changed.md` | When CI, deployment, or infra config changes |
|
|
71
|
+
|
|
72
|
+
### Architecture Graphs (`.engineering-intelligence/graph/`)
|
|
73
|
+
|
|
74
|
+
| Artifact | Content |
|
|
75
|
+
|---|---|
|
|
76
|
+
| `dependency-graph.json` | Module/package dependency relationships |
|
|
77
|
+
| `service-graph.json` | Service-to-service communication topology |
|
|
78
|
+
| `runtime-graph.json` | Runtime call flows and middleware chains |
|
|
79
|
+
| `business-flow-graph.json` | Business process flows across system boundaries |
|
|
80
|
+
| `architecture-map.md` | Mermaid diagrams derived from JSON graphs |
|
|
81
|
+
|
|
82
|
+
### Change History
|
|
83
|
+
|
|
84
|
+
| Artifact | Content |
|
|
85
|
+
|---|---|
|
|
86
|
+
| `.changes/CHG-000-initialization.md` | Record of this initialization run |
|
|
87
|
+
|
|
88
|
+
## Procedure
|
|
89
|
+
|
|
90
|
+
1. **Discover** — Scan for: package manifests, workspace configs, runtimes (`package.json`, `go.mod`, `Cargo.toml`, `pyproject.toml`, etc.), build systems, entrypoints, CI configs, Dockerfiles, deployment manifests, environment examples, database schemas/migrations, API definitions, auth configs, test suites.
|
|
91
|
+
|
|
92
|
+
2. **Trace Architecture** — Follow imports, dependency injection, middleware registration, route definitions, event handlers, and service boundaries. Map the critical runtime flows from code evidence, not assumptions.
|
|
93
|
+
|
|
94
|
+
3. **Write Knowledge Base** — For each document:
|
|
95
|
+
- Open with a one-paragraph summary
|
|
96
|
+
- Back every material claim with a file path reference: `(evidence: path/to/file:L42)`
|
|
97
|
+
- Use `**Not detected**` for absent features, not silence
|
|
98
|
+
- Use `**Unclear from evidence** — [reason]` for ambiguous areas
|
|
99
|
+
- Use tables, code blocks, and structured lists — never prose walls
|
|
100
|
+
|
|
101
|
+
4. **Validate Claims** — Re-read each knowledge document, check major claims against actual files, and write `15-validation-report.md` with findings categorized as: ✅ Supported, ⚠️ Partially Supported, ❌ Unsupported, ❓ Needs Human Review.
|
|
102
|
+
|
|
103
|
+
5. **Generate Memory** — Extract only durable, long-lived decisions and patterns. Do NOT store transient implementation details. Each entry needs a `Source:` evidence reference.
|
|
104
|
+
|
|
105
|
+
6. **Generate Context** — Create concise, navigational maps. Each map should fit in ~100 lines. Optimize for an AI agent quickly finding the right file, not for human reading.
|
|
106
|
+
|
|
107
|
+
7. **Build Graphs** — Invoke `graph-engine` to produce all four JSON graphs and `architecture-map.md`. Every node and edge must have `evidence` and `confidence` fields.
|
|
108
|
+
|
|
109
|
+
8. **Generate Events** — Write change-event guidance documents that describe what to check and update when specific types of changes occur.
|
|
110
|
+
|
|
111
|
+
9. **Write History** — Create `CHG-000-initialization.md` with: timestamp, artifacts generated, confidence summary, areas needing human confirmation.
|
|
112
|
+
|
|
113
|
+
10. **Report** — Summarize: total artifacts created, evidence coverage percentage estimate, high-confidence vs low-confidence areas, explicit list of items requiring human review.
|
|
114
|
+
|
|
115
|
+
## Quality Gates
|
|
116
|
+
|
|
117
|
+
- [ ] Every knowledge document has at least one evidence citation
|
|
118
|
+
- [ ] No document contains invented implementation details
|
|
119
|
+
- [ ] Validation report exists and covers all knowledge documents
|
|
120
|
+
- [ ] All four graph JSON files validate against the graph-engine schema
|
|
121
|
+
- [ ] Memory contains only durable, long-lived knowledge
|
|
122
|
+
- [ ] Context maps are concise (< 150 lines each)
|
|
123
|
+
- [ ] CHG-000 record exists and lists all generated artifacts
|
|
124
|
+
|
|
125
|
+
## Cross-References
|
|
126
|
+
|
|
127
|
+
- Uses: `deep-project-knowledge-extractor`, `knowledge-base-validator`, `graph-engine`, `change-history-engine`
|
|
128
|
+
- Consumed by: `engineering-intelligence-skill`, all sync engines, `impact-analysis-engine`
|
|
129
|
+
|
|
130
|
+
This initialization documents and validates the project. It does not implement product changes.
|
|
@@ -1,17 +1,102 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: knowledge-base-validator
|
|
3
3
|
description: Validates project knowledge documentation against source and configuration evidence, identifying stale, unsupported, or uncertain claims. Use after initialization or documentation synchronization.
|
|
4
|
+
version: 3.0.0
|
|
4
5
|
---
|
|
5
6
|
|
|
6
7
|
# Knowledge Base Validator
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
Systematically audit every significant claim in `knowledge-base/*.md` against actual repository evidence. Produce a structured validation report that identifies exactly what is supported, what is stale, and what needs human review.
|
|
9
10
|
|
|
10
|
-
|
|
11
|
+
## Inputs
|
|
11
12
|
|
|
12
|
-
-
|
|
13
|
-
-
|
|
14
|
-
- confidence and stale-documentation risks
|
|
15
|
-
- areas needing human review
|
|
13
|
+
- Repository root path with `knowledge-base/` present
|
|
14
|
+
- Optional: specific documents to validate (defaults to all)
|
|
16
15
|
|
|
17
|
-
|
|
16
|
+
## Procedure
|
|
17
|
+
|
|
18
|
+
1. **Enumerate Claims** — Read each `knowledge-base/*.md` document. Extract every material claim about architecture, APIs, schemas, dependencies, configurations, flows, and behavior.
|
|
19
|
+
|
|
20
|
+
2. **Verify Against Evidence** — For each claim, check:
|
|
21
|
+
- Does the referenced file/path still exist?
|
|
22
|
+
- Does the code at that location still support the claim?
|
|
23
|
+
- Has the relevant code changed since the claim was written?
|
|
24
|
+
- Are there new files/patterns that contradict the claim?
|
|
25
|
+
|
|
26
|
+
3. **Categorize Findings** — Assign each finding a status:
|
|
27
|
+
|
|
28
|
+
| Status | Symbol | Meaning |
|
|
29
|
+
|---|---|---|
|
|
30
|
+
| Supported | ✅ | Claim verified against current code |
|
|
31
|
+
| Partially Supported | ⚠️ | Claim is partly true but missing nuance or outdated in some aspect |
|
|
32
|
+
| Unsupported | ❌ | Claim contradicted by current code or evidence is missing |
|
|
33
|
+
| Unclear | ❓ | Cannot determine accuracy — needs human review |
|
|
34
|
+
| Stale | 🔄 | Claim references code that has changed significantly |
|
|
35
|
+
|
|
36
|
+
4. **Assess Confidence** — For each document, calculate:
|
|
37
|
+
- Total claims examined
|
|
38
|
+
- Distribution across statuses
|
|
39
|
+
- Overall document confidence: High (>90% ✅), Medium (70-90% ✅), Low (<70% ✅)
|
|
40
|
+
|
|
41
|
+
5. **Write Report** — Generate `knowledge-base/15-validation-report.md`
|
|
42
|
+
|
|
43
|
+
## Output Format
|
|
44
|
+
|
|
45
|
+
```markdown
|
|
46
|
+
# Validation Report
|
|
47
|
+
|
|
48
|
+
Generated: <ISO timestamp>
|
|
49
|
+
Scope: <documents validated>
|
|
50
|
+
|
|
51
|
+
## Summary
|
|
52
|
+
|
|
53
|
+
| Document | Claims | ✅ | ⚠️ | ❌ | ❓ | Confidence |
|
|
54
|
+
|---|---|---|---|---|---|---|
|
|
55
|
+
| 00-project-overview.md | 12 | 10 | 1 | 0 | 1 | High |
|
|
56
|
+
| ... | ... | ... | ... | ... | ... | ... |
|
|
57
|
+
|
|
58
|
+
## Detailed Findings
|
|
59
|
+
|
|
60
|
+
### 00-project-overview.md
|
|
61
|
+
|
|
62
|
+
#### ✅ Supported
|
|
63
|
+
- "Uses Express.js 4.18" (evidence: package.json:L15)
|
|
64
|
+
|
|
65
|
+
#### ⚠️ Partially Supported
|
|
66
|
+
- "PostgreSQL is the primary database" — true, but Redis is also used for caching (evidence: docker-compose.yml:L22)
|
|
67
|
+
|
|
68
|
+
#### ❌ Unsupported
|
|
69
|
+
- "Uses Passport.js for auth" — no Passport dependency found; appears to use custom JWT middleware (evidence: package.json, src/middleware/auth.ts)
|
|
70
|
+
|
|
71
|
+
#### ❓ Needs Human Review
|
|
72
|
+
- "Supports multi-tenancy" — tenant isolation code exists but completeness is unclear
|
|
73
|
+
|
|
74
|
+
## Stale Documentation Risks
|
|
75
|
+
|
|
76
|
+
- <areas where code has diverged from docs>
|
|
77
|
+
|
|
78
|
+
## Recommended Actions
|
|
79
|
+
|
|
80
|
+
- <specific documents needing update>
|
|
81
|
+
- <claims needing human confirmation>
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## Rules
|
|
85
|
+
|
|
86
|
+
- Do NOT silently rewrite knowledge documents during validation
|
|
87
|
+
- Update knowledge documents only as part of an explicit synchronization workflow
|
|
88
|
+
- Report honestly — a low-confidence score is valuable information
|
|
89
|
+
- Flag areas where you lack sufficient context to validate
|
|
90
|
+
|
|
91
|
+
## Quality Gates
|
|
92
|
+
|
|
93
|
+
- [ ] Every knowledge document (00-14) is covered in the report
|
|
94
|
+
- [ ] Each finding has an evidence path or explicit "no evidence found"
|
|
95
|
+
- [ ] Summary table has accurate counts
|
|
96
|
+
- [ ] Stale documentation risks are identified
|
|
97
|
+
- [ ] Recommended actions are actionable
|
|
98
|
+
|
|
99
|
+
## Cross-References
|
|
100
|
+
|
|
101
|
+
- Used by: `initialize-intelligence-skill`, `incremental-sync-engine`
|
|
102
|
+
- Depends on: `deep-project-knowledge-extractor` (produces the docs to validate)
|