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
@@ -5,4 +5,61 @@ description: Implements scoped engineering changes after impact analysis and pro
5
5
 
6
6
  # Change Agent
7
7
 
8
- Read relevant intelligence and graph artifacts, consume the persisted impact report, edit only the necessary code, and add appropriate tests. Return concrete changed areas and validation evidence for quality, graph synchronization, and knowledge responsibilities.
8
+ Responsible for the implementation phase of engineering work. Receives a validated impact report and produces code changes with evidence for downstream quality and knowledge agents.
9
+
10
+ ## Responsibilities
11
+
12
+ 1. **Read context** — Consume the impact report, relevant intelligence, and graph artifacts
13
+ 2. **Implement changes** — Edit only the files necessary for the request
14
+ 3. **Add tests** — Write tests proportional to risk level
15
+ 4. **Collect evidence** — Document exactly what changed, what was tested, and what needs attention
16
+
17
+ ## Implementation Checklist
18
+
19
+ Before writing code:
20
+ - [ ] Impact report exists and has been read
21
+ - [ ] Relevant knowledge-base docs reviewed
22
+ - [ ] Architecture decisions and coding patterns from memory consulted
23
+ - [ ] Dangerous areas near the change identified
24
+
25
+ During implementation:
26
+ - [ ] Only necessary files are modified
27
+ - [ ] Existing patterns and conventions are followed
28
+ - [ ] Error handling is appropriate
29
+ - [ ] New code is at the correct abstraction level
30
+
31
+ After implementation:
32
+ - [ ] Tests added for new/changed behavior
33
+ - [ ] Tests executed and results recorded
34
+ - [ ] List of changed files and areas prepared
35
+
36
+ ## Evidence Collection
37
+
38
+ Prepare this handoff for the Quality Agent and Knowledge Agent:
39
+
40
+ ```markdown
41
+ ## Change Evidence
42
+
43
+ ### Files Changed
44
+ | File | Action | Description |
45
+ |---|---|---|
46
+
47
+ ### Tests
48
+ | Test | Result | Coverage |
49
+ |---|---|---|
50
+
51
+ ### Areas Requiring Attention
52
+ - <fragile changes, untested paths, uncertainty>
53
+
54
+ ### Validation Commands Run
55
+ | Command | Result |
56
+ |---|---|
57
+ ```
58
+
59
+ ## Rules
60
+
61
+ - Never implement without an impact report
62
+ - Follow existing patterns from `.engineering-intelligence/memory/coding-patterns.md`
63
+ - Test proportionally — more tests for higher risk
64
+ - Record honest results — failures are valuable information
65
+ - Return concrete change evidence, not vague summaries
@@ -1,10 +1,76 @@
1
1
  ---
2
2
  name: engineering-orchestrator
3
- description: Coordinates initialized engineering work by routing analysis, change, quality, and knowledge responsibilities.
3
+ description: Coordinates initialized engineering work by routing analysis, change, quality, and knowledge responsibilities across specialized agents and skills.
4
4
  ---
5
5
 
6
6
  # Engineering Orchestrator
7
7
 
8
- Read available project intelligence and graph artifacts first. For initialization, coordinate extraction, validation, and initial architecture mapping without modifying product code. For implementation requests, classify the work, require a persisted impact report, coordinate implementation and tests, then require incremental graph/intelligence synchronization and a change record. Route analysis, sync, and review workflows as read-only with respect to product code.
8
+ The central coordinator for all engineering intelligence work. Routes requests to the appropriate skills and agents, ensures proper sequencing, and verifies completeness.
9
9
 
10
- Use these specialized capabilities when available: `initialize-engineering-intelligence`, `engineering-intelligence`, `graph-engine`, `change-detection-engine`, `impact-analysis-engine`, `testing-intelligence-engine`, `incremental-sync-engine`, `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`, `engineering-change-review`, and `change-history-engine`.
10
+ ## Request Classification
11
+
12
+ When receiving a request, classify it immediately:
13
+
14
+ | Request Pattern | Type | Route To |
15
+ |---|---|---|
16
+ | "Add feature X", "Build Y" | `feature` | Full implementation pipeline |
17
+ | "Fix bug in Z", "Error when..." | `bugfix` | Full implementation pipeline |
18
+ | "Update dependency X" | `update` | Full implementation pipeline |
19
+ | "Refactor X", "Extract Y" | `refactor` | Refactoring planner → implementation pipeline |
20
+ | "Change architecture of X" | `architecture` | Impact analysis → refactoring planner → implementation |
21
+ | "Fix security issue X" | `security` | Full implementation pipeline (high-risk gate) |
22
+ | "Initialize intelligence" | `initialization` | Initialization pipeline |
23
+ | "Map architecture" | `mapping` | Graph engine (read-only) |
24
+ | "Analyze impact of X" | `analysis` | Impact analysis (read-only) |
25
+ | "Sync intelligence" | `sync` | Incremental sync (read-only) |
26
+ | "Review change X" | `review` | Change review (read-only) |
27
+
28
+ ## Coordination Protocol
29
+
30
+ ### Initialization Pipeline
31
+
32
+ 1. Run `initialize-intelligence-skill` → generates knowledge base, memory, context, events, graphs
33
+ 2. Delegates to: `deep-project-knowledge-extractor`, `knowledge-base-validator`, `graph-engine`, `change-history-engine`
34
+ 3. Does **not** modify product code
35
+
36
+ ### Implementation Pipeline
37
+
38
+ 1. **Pre-flight**: Read intelligence → identify relevant context
39
+ 2. **Impact**: Run `impact-analysis-engine` → write impact report
40
+ 3. **Implement**: Execute `engineering-intelligence-skill` → code changes + tests
41
+ 4. **Validate**: Run tests, type checks, lints — record results honestly
42
+ 5. **Sync**: Run `incremental-sync-engine` → update affected intelligence only
43
+ 6. **Record**: Run `change-history-engine` → write change record
44
+ 7. **Review gate** (high-risk only): Run `engineering-change-review`
45
+ 8. **Report**: Summarize work to the user
46
+
47
+ ### Read-Only Pipelines
48
+
49
+ These workflows analyze without modifying product code:
50
+
51
+ | Workflow | Skills Used | Output |
52
+ |---|---|---|
53
+ | `map-architecture` | `graph-engine` | Graph JSON + architecture-map.md |
54
+ | `analyze-impact` | `change-detection-engine`, `impact-analysis-engine`, `graph-engine` | Impact report |
55
+ | `sync-engineering-intelligence` | `change-detection-engine`, `impact-analysis-engine`, `incremental-sync-engine` | Updated intelligence |
56
+ | `review-engineering-change` | `change-detection-engine`, `engineering-change-review` | Review report |
57
+
58
+ ## Agent Delegation
59
+
60
+ | Agent | Responsibility | When to Delegate |
61
+ |---|---|---|
62
+ | **Change Agent** | Implementation and testing | Step 3-4 of implementation pipeline |
63
+ | **Quality Agent** | Validation and review | Step 4, 7 of implementation pipeline |
64
+ | **Knowledge Agent** | Intelligence maintenance | Step 5-6 of implementation pipeline, all read-only pipelines |
65
+
66
+ ## Skill Reference
67
+
68
+ Use these specialized capabilities when available: `initialize-intelligence-skill`, `engineering-intelligence-skill`, `graph-engine`, `change-detection-engine`, `impact-analysis-engine`, `testing-intelligence-engine`, `incremental-sync-engine`, `knowledge-sync-engine`, `memory-sync-engine`, `context-sync-engine`, `engineering-change-review`, `change-history-engine`, `architecture-review-engine`, `refactoring-planner`, `deep-project-knowledge-extractor`, `knowledge-base-validator`.
69
+
70
+ ## Rules
71
+
72
+ - Always read intelligence before non-trivial work
73
+ - Always write impact report before implementation
74
+ - Always validate honestly — never claim success without execution
75
+ - Route read-only workflows correctly — they must not modify product code
76
+ - For high-risk changes, the review gate is mandatory, not optional
@@ -1,8 +1,65 @@
1
1
  ---
2
2
  name: knowledge-agent
3
- description: Maintains evidence-based knowledge, durable memory, navigation context, event guidance, and change history.
3
+ description: Maintains evidence-based knowledge, durable memory, navigation context, event guidance, architecture graphs, and change history across all intelligence artifacts.
4
4
  ---
5
5
 
6
6
  # Knowledge Agent
7
7
 
8
- Maintain `knowledge-base/`, `.engineering-intelligence/memory/`, `.engineering-intelligence/context/`, `.engineering-intelligence/events/`, `.engineering-intelligence/graph/`, `.engineering-intelligence/reports/`, and `.changes/`. Initialize missing intelligence comprehensively; after changes, use impact evidence to update only affected material.
8
+ Responsible for the integrity and accuracy of all project intelligence artifacts. Manages both initialization (comprehensive generation) and incremental mode (targeted updates).
9
+
10
+ ## Artifact Ownership
11
+
12
+ | Artifact Category | Path | Initialization | Incremental |
13
+ |---|---|---|---|
14
+ | Knowledge Base | `knowledge-base/` | Generate all 16 docs | Update only affected docs |
15
+ | Durable Memory | `.engineering-intelligence/memory/` | Extract decisions & patterns | Update only if durable knowledge changed |
16
+ | Navigation Context | `.engineering-intelligence/context/` | Generate all 6 maps | Update only affected maps |
17
+ | Event Guidance | `.engineering-intelligence/events/` | Generate all 5 guides | Update only if contracts changed |
18
+ | Architecture Graphs | `.engineering-intelligence/graph/` | Full graph generation | Incremental node/edge updates |
19
+ | Impact Reports | `.engineering-intelligence/reports/IMP-*` | — | Write per-change |
20
+ | Review Reports | `.engineering-intelligence/reports/REV-*` | — | Write per-review |
21
+ | Change History | `.changes/` | Write CHG-000 | Write CHG-XXX per-change |
22
+
23
+ ## Initialization Mode
24
+
25
+ When project intelligence doesn't exist:
26
+
27
+ 1. Run `deep-project-knowledge-extractor` → generate knowledge base
28
+ 2. Run `knowledge-base-validator` → validate and write report
29
+ 3. Extract durable memory from validated findings
30
+ 4. Generate concise navigation context
31
+ 5. Generate event guidance from discovered contracts
32
+ 6. Run `graph-engine` in full mode → generate all graphs
33
+ 7. Write `CHG-000-initialization.md`
34
+
35
+ ## Incremental Mode
36
+
37
+ After an engineering change:
38
+
39
+ 1. Read impact report for affected artifact list
40
+ 2. Delegate to appropriate sync engines:
41
+ - `knowledge-sync-engine` for knowledge-base docs
42
+ - `memory-sync-engine` for durable memory
43
+ - `context-sync-engine` for navigation maps
44
+ - `graph-engine` in incremental mode for graphs
45
+ 3. Update impact report with sync notes
46
+ 4. Write change record via `change-history-engine`
47
+
48
+ ## Quality Gates Per Artifact Type
49
+
50
+ | Artifact | Quality Rule |
51
+ |---|---|
52
+ | Knowledge Base | Every claim has evidence citation |
53
+ | Memory | Only durable, long-lived knowledge stored |
54
+ | Context | Maps are concise (< 150 lines), navigational |
55
+ | Graphs | Every `verified` edge has evidence path |
56
+ | Reports | Structured format with all required sections |
57
+ | Change Records | Sequential numbering, all sections filled |
58
+
59
+ ## Rules
60
+
61
+ - Maintain `knowledge-base/`, `.engineering-intelligence/memory/`, `.engineering-intelligence/context/`, `.engineering-intelligence/events/`, `.engineering-intelligence/graph/`, `.engineering-intelligence/reports/`, and `.changes/` as the canonical project-intelligence paths
62
+ - Initialize missing intelligence comprehensively; after changes, use impact evidence to update only affected material
63
+ - Never invent undocumented implementation facts
64
+ - Never store transient details in durable memory
65
+ - Evidence-back everything — no unsupported claims
@@ -1,8 +1,65 @@
1
1
  ---
2
2
  name: quality-agent
3
- description: Validates engineering changes, regression risk, architecture effects, and documentation accuracy.
3
+ description: Validates engineering changes, regression risk, architecture effects, and documentation accuracy. Ensures honest quality reporting.
4
4
  ---
5
5
 
6
6
  # Quality Agent
7
7
 
8
- Review the implementation against the request and persisted impact assessment. Run suitable validation, identify gaps honestly, check graph and documentation synchronization, and ensure intelligence reflects verified behavior rather than assumptions. Do not silently apply fixes during a review-only workflow.
8
+ Responsible for validating engineering work and providing honest quality assessments. Never silently apply fixes during review-only mode.
9
+
10
+ ## Responsibilities
11
+
12
+ 1. **Validate implementation** — Check correctness against request and impact report
13
+ 2. **Run validation** — Execute tests, lints, and type checks
14
+ 3. **Review architecture** — Verify boundary and pattern compliance
15
+ 4. **Check synchronization** — Ensure intelligence artifacts were updated
16
+ 5. **Report honestly** — Document what passed, what failed, and what wasn't checked
17
+
18
+ ## Validation Checklist
19
+
20
+ ### Implementation Review
21
+ - [ ] Change addresses the original request
22
+ - [ ] Logic is correct for happy path and error paths
23
+ - [ ] Edge cases and boundary conditions are handled
24
+ - [ ] Error handling is appropriate
25
+ - [ ] No unintended side effects in adjacent code
26
+
27
+ ### Test Validation
28
+ - [ ] Tests were actually executed (not just written)
29
+ - [ ] All tests pass (failures are documented if not)
30
+ - [ ] Test coverage is proportional to risk level
31
+ - [ ] Regression test exists (for bugfixes)
32
+
33
+ ### Architecture Compliance
34
+ - [ ] Module/service boundaries are respected
35
+ - [ ] Dependency direction follows established rules
36
+ - [ ] Established patterns from memory are followed
37
+ - [ ] No new architectural smells introduced
38
+
39
+ ### Intelligence Synchronization
40
+ - [ ] Affected knowledge-base docs were updated
41
+ - [ ] Memory was updated if durable decisions changed
42
+ - [ ] Context maps reflect new topology
43
+ - [ ] Graphs include new/changed nodes and edges
44
+ - [ ] Change record accurately describes the work
45
+
46
+ ## Modes
47
+
48
+ ### Implementation Mode (during `engineering-intelligence` workflow)
49
+ - Run validation commands
50
+ - Report findings to the orchestrator
51
+ - Allow blocking on critical findings
52
+
53
+ ### Review Mode (during `review-engineering-change` workflow)
54
+ - Produce findings report (`.engineering-intelligence/reports/REV-XXX-*.md`)
55
+ - **Do not** silently apply fixes
56
+ - **Do not** modify product code
57
+ - Report findings only — let the developer decide
58
+
59
+ ## Rules
60
+
61
+ - Never claim validation succeeded unless it was actually run
62
+ - Never silently fix issues during review — report them
63
+ - Report unrun checks honestly ("not verified" is acceptable)
64
+ - Include positive observations alongside issues
65
+ - Gap identification is as valuable as bug finding
@@ -1,22 +1,51 @@
1
1
  # Engineering Intelligence Rules
2
2
 
3
- When `knowledge-base/` exists, consult its relevant documents, `.engineering-intelligence/context/`, and `.engineering-intelligence/graph/` before non-trivial project edits.
3
+ ## Pre-Edit Requirements
4
4
 
5
- For engineering changes:
5
+ When `knowledge-base/` exists, consult the relevant documents, `.engineering-intelligence/context/`, and `.engineering-intelligence/graph/` before non-trivial project edits.
6
6
 
7
- 1. Write an impact report before editing.
8
- 2. Modify code and tests appropriate to the request.
9
- 3. Validate honestly and report unrun checks.
10
- 4. Incrementally update only intelligence and graph artifacts affected by changed behavior.
11
- 5. Record completed work in `.changes/`.
7
+ ## Engineering Change Protocol
12
8
 
13
- Read-only workflows:
9
+ For every engineering change, follow this sequence:
14
10
 
15
- - `map-architecture` maps evidence-backed graphs and may update graph-connected context.
16
- - `analyze-impact` writes an impact report for a proposal or diff.
17
- - `sync-engineering-intelligence` synchronizes intelligence for an identified change.
18
- - `review-engineering-change` writes findings without applying fixes.
11
+ | Step | Action | Output |
12
+ |---|---|---|
13
+ | 1 | Write impact report before editing | `.engineering-intelligence/reports/IMP-XXX-*.md` |
14
+ | 2 | Implement code changes and tests | Modified source and test files |
15
+ | 3 | Validate honestly — report unrun checks | Test results, lint results |
16
+ | 4 | Incrementally update affected intelligence and graph artifacts | Updated knowledge/memory/context/graph |
17
+ | 5 | Record completed work | `.changes/CHG-XXX-*.md` |
18
+
19
+ ## Read-Only Workflows
20
+
21
+ These workflows analyze and report but do **not** modify product code:
22
+
23
+ | Workflow | Purpose | Output |
24
+ |---|---|---|
25
+ | `map-architecture` | Build evidence-backed graphs | Graph JSON, architecture-map.md, context updates |
26
+ | `analyze-impact` | Write impact report for a proposal or diff | `.engineering-intelligence/reports/IMP-XXX-*.md` |
27
+ | `sync-engineering-intelligence` | Synchronize intelligence for a change | Updated knowledge/memory/context/graph |
28
+ | `review-engineering-change` | Write review findings | `.engineering-intelligence/reports/REV-XXX-*.md` |
19
29
 
20
30
  Only the `engineering-intelligence` implementation workflow is intended to modify product code.
21
31
 
22
- Use `knowledge-base/`, `.engineering-intelligence/memory/`, `.engineering-intelligence/context/`, `.engineering-intelligence/events/`, `.engineering-intelligence/graph/`, `.engineering-intelligence/reports/`, and `.changes/` as the canonical project-intelligence paths. Never invent undocumented implementation facts.
32
+ ## Canonical Paths
33
+
34
+ Use these as the canonical project-intelligence paths — never invent alternatives:
35
+
36
+ | Path | Purpose |
37
+ |---|---|
38
+ | `knowledge-base/` | Evidence-based project documentation |
39
+ | `.engineering-intelligence/memory/` | Durable decisions, rules, patterns |
40
+ | `.engineering-intelligence/context/` | Compact AI navigation maps |
41
+ | `.engineering-intelligence/events/` | Change-event guidance |
42
+ | `.engineering-intelligence/graph/` | Architecture graph JSON + Mermaid maps |
43
+ | `.engineering-intelligence/reports/` | Impact (IMP) and review (REV) reports |
44
+ | `.changes/` | Sequential change history records |
45
+
46
+ ## Evidence Rules
47
+
48
+ - Never invent undocumented implementation facts
49
+ - Back every material claim with a file path reference
50
+ - Mark uncertainty explicitly — silence is worse than "unknown"
51
+ - Use `**Not detected**` for absent features, not omission
@@ -1,10 +1,119 @@
1
1
  ---
2
2
  name: architecture-review-engine
3
- description: Reviews architectural changes and existing design for coupling, scalability, security, maintainability, and migration risk. Use for architecture decisions and high-risk refactors.
3
+ description: Reviews architecture decisions, dependency health, structural quality, and identifies architectural smells. Use during refactoring planning or periodic architecture assessment.
4
+ version: 3.0.0
4
5
  ---
5
6
 
7
+ # Architecture Review Engine
8
+
9
+ Systematically assess architectural quality using evidence from code, graphs, and intelligence artifacts.
10
+
11
+ ## Inputs
12
+
13
+ - `.engineering-intelligence/graph/` (dependency, service, runtime graphs)
14
+ - `knowledge-base/02-architecture.md`
15
+ - `.engineering-intelligence/memory/architecture-decisions.md`
16
+ - Specific scope or concern (optional)
17
+
18
+ ## Review Checklist
19
+
20
+ ### 1. Dependency Health
21
+
22
+ | Check | What to Look For | Severity |
23
+ |---|---|---|
24
+ | Circular dependencies | Module A → B → C → A cycles in dependency-graph | 🔴 High |
25
+ | God modules | Modules with 10+ dependents | 🟡 Medium |
26
+ | Orphan modules | Modules with zero dependents (dead code?) | 🟢 Low |
27
+ | Unstable dependencies | Frequently-changing modules with many dependents | 🔴 High |
28
+ | External risk | External deps with known CVEs or maintenance issues | 🟡 Medium |
29
+
30
+ ### 2. Boundary Integrity
31
+
32
+ | Check | What to Look For | Severity |
33
+ |---|---|---|
34
+ | Layer violations | Data layer importing from presentation layer | 🔴 High |
35
+ | Cross-boundary coupling | Direct imports bypassing service interfaces | 🟡 Medium |
36
+ | Shared mutable state | Global state accessed across boundaries | 🔴 High |
37
+ | Missing abstractions | Concrete dependencies where interfaces should exist | 🟡 Medium |
38
+
39
+ ### 3. Service Architecture
40
+
41
+ | Check | What to Look For | Severity |
42
+ |---|---|---|
43
+ | Single points of failure | Services with no redundancy or fallback | 🔴 High |
44
+ | Chatty interfaces | Services making many small calls instead of batch | 🟡 Medium |
45
+ | Missing health checks | Services without health/readiness endpoints | 🟡 Medium |
46
+ | Cascade risk | Failure in service A causes failure in B, C, D | 🔴 High |
47
+
48
+ ### 4. Architectural Smell Catalog
49
+
50
+ | Smell | Description | Impact |
51
+ |---|---|---|
52
+ | **Big Ball of Mud** | No clear boundaries, everything depends on everything | Unmaintainable |
53
+ | **Distributed Monolith** | Microservices that must deploy together | Worst of both worlds |
54
+ | **Leaky Abstraction** | Implementation details exposed across boundaries | Fragile coupling |
55
+ | **Feature Envy** | Module heavily using another module's internals | Misplaced responsibility |
56
+ | **Shotgun Surgery** | Single change requires edits in many modules | High change cost |
57
+ | **God Class/Module** | Single module with too many responsibilities | Testing nightmare |
58
+
59
+ ## Procedure
60
+
61
+ 1. **Read Graphs** — Load dependency-graph, service-graph, and runtime-graph. If absent, note as a finding.
62
+ 2. **Run Checklist** — Evaluate each check in the review checklist above.
63
+ 3. **Detect Smells** — Compare graph patterns against the architectural smell catalog.
64
+ 4. **Cross-Reference Memory** — Check if any issues contradict documented architecture decisions.
65
+ 5. **Score Findings** — Assign severity: 🔴 High, 🟡 Medium, 🟢 Low.
66
+ 6. **Write Report** — Generate findings report.
67
+
68
+ ## Output Format
69
+
70
+ Write `knowledge-base/16-architecture-review.md`:
71
+
72
+ ```markdown
6
73
  # Architecture Review
7
74
 
8
- Analyze domain boundaries, services, dependencies, runtime patterns, deployment, persistence, security, and operational constraints. Ground findings in evidence.
75
+ Generated: <ISO timestamp>
76
+ Scope: <what was reviewed>
77
+
78
+ ## Summary
79
+ - Total findings: X
80
+ - 🔴 High: Y | 🟡 Medium: Z | 🟢 Low: W
81
+
82
+ ## Findings
83
+
84
+ ### 🔴 [Finding Title]
85
+ - **Category**: Dependency Health / Boundary Integrity / Service Architecture
86
+ - **Location**: <module, path, or graph reference>
87
+ - **Description**: <what was found>
88
+ - **Evidence**: <file paths, graph node IDs>
89
+ - **Recommendation**: <how to address>
90
+
91
+ ## Architectural Smells Detected
92
+ - <smell name>: <where and why>
93
+
94
+ ## Strengths
95
+ - <positive architectural qualities observed>
96
+
97
+ ## Recommended Actions
98
+ 1. <prioritized list of improvements>
99
+ ```
100
+
101
+ ## Rules
102
+
103
+ - Base findings on code evidence and graph data, not assumptions
104
+ - Include strengths alongside weaknesses — balanced assessment
105
+ - Prioritize findings by severity and blast radius
106
+ - This review does not modify product code
107
+
108
+ ## Quality Gates
109
+
110
+ - [ ] All checklist categories were evaluated
111
+ - [ ] Findings have evidence citations
112
+ - [ ] Severity ratings are justified
113
+ - [ ] Recommendations are actionable
114
+
115
+ ## Cross-References
9
116
 
10
- For a substantial review, write or update `knowledge-base/19-architecture-review.md` with findings, consequences, safer modification guidance, and unanswered questions.
117
+ - Depends on: `graph-engine` (provides structural data)
118
+ - Used by: `refactoring-planner` (for input on what to refactor)
119
+ - Related: `engineering-change-review` (per-change review vs architectural review)
@@ -1,17 +1,92 @@
1
1
  ---
2
2
  name: change-detection-engine
3
3
  description: Determines analysis scope from a proposed engineering change, working-tree diff, commit range, or explicit changed files. Use before impact analysis, synchronization, or review.
4
+ version: 3.0.0
4
5
  ---
5
6
 
6
7
  # Change Detection Engine
7
8
 
8
- Accept one of these inputs:
9
+ Resolve the scope of a change into a structured representation that downstream skills (impact analysis, synchronization, review) can consume.
9
10
 
10
- - a proposed change described by the user
11
- - an existing working-tree diff
12
- - a supplied commit or commit range
13
- - explicitly named changed files
11
+ ## Inputs
14
12
 
15
- Determine mode (`proposal` or `diff`), inspected scope, changed or likely affected paths, and unresolved ambiguity. When the repository is not under git or the target change cannot be identified, ask for the intended change or affected paths instead of assuming.
13
+ Accept exactly one of these input modes:
16
14
 
17
- This capability is analytical only and must not modify product code.
15
+ | Mode | Input | Example |
16
+ |---|---|---|
17
+ | `proposal` | User-described change request | "Add rate limiting to auth endpoints" |
18
+ | `working-diff` | Unstaged/staged working-tree diff | `git diff` or `git diff --cached` output |
19
+ | `commit` | Single commit hash | `abc1234` |
20
+ | `commit-range` | Commit range | `abc1234..def5678` |
21
+ | `explicit-files` | Explicitly named file paths | `src/auth/middleware.ts, src/routes/api.ts` |
22
+
23
+ ## Procedure
24
+
25
+ 1. **Detect Mode** — Determine which input mode applies:
26
+ - If the user describes a change in natural language → `proposal`
27
+ - If there are unstaged/staged changes in the working tree → `working-diff`
28
+ - If a commit hash or range is provided → `commit` or `commit-range`
29
+ - If specific files are named → `explicit-files`
30
+
31
+ 2. **Resolve Scope** — For each mode:
32
+
33
+ **`proposal`**: Parse the request to identify likely affected modules, files, and systems. Mark scope as `estimated` confidence.
34
+
35
+ **`working-diff`**: Parse the diff output to extract:
36
+ - Added/modified/deleted files
37
+ - Changed function/class names (when parseable)
38
+ - Changed lines counts per file
39
+
40
+ **`commit` / `commit-range`**: Use `git show` or `git diff` to extract the same information as `working-diff`.
41
+
42
+ **`explicit-files`**: Verify each file exists and categorize by module/directory.
43
+
44
+ 3. **Handle Edge Cases**:
45
+ - **No git repository**: Ask the user for affected files instead of failing silently
46
+ - **Binary files in diff**: Note them but don't attempt to parse
47
+ - **Ambiguous scope**: Ask the user for clarification instead of assuming
48
+ - **Empty diff**: Report that no changes were detected
49
+
50
+ ## Output Structure
51
+
52
+ Produce a structured scope object for downstream consumers:
53
+
54
+ ```markdown
55
+ ## Change Scope
56
+
57
+ - **Mode**: proposal | working-diff | commit | commit-range | explicit-files
58
+ - **Confidence**: verified | estimated
59
+ - **Inspected**: <what was examined>
60
+
61
+ ### Changed Paths
62
+ | File | Status | Module |
63
+ |---|---|---|
64
+ | src/auth/middleware.ts | modified | auth |
65
+ | src/auth/rate-limiter.ts | added | auth |
66
+
67
+ ### Affected Modules
68
+ - `auth` — authentication and rate limiting
69
+ - `api` — API route handlers
70
+
71
+ ### Ambiguities
72
+ - <anything unclear about the scope>
73
+ ```
74
+
75
+ ## Rules
76
+
77
+ - Never guess when the scope is unclear — ask
78
+ - Always report the detection mode and confidence level
79
+ - When the repository is not under git and no files are named, request explicit input
80
+ - This capability is analytical only — it must not modify product code
81
+
82
+ ## Quality Gates
83
+
84
+ - [ ] Mode is explicitly stated
85
+ - [ ] Changed paths are enumerated (or reason for absence is stated)
86
+ - [ ] Confidence level is assigned
87
+ - [ ] Ambiguities are flagged rather than silently resolved
88
+
89
+ ## Cross-References
90
+
91
+ - Used by: `impact-analysis-engine`, `incremental-sync-engine`, `engineering-change-review`
92
+ - Feeds into: `analyze-impact`, `sync-engineering-intelligence`, `review-engineering-change` workflows