engineering-intelligence 0.8.0 → 1.0.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 (38) hide show
  1. package/dist/adapters/index.d.ts.map +1 -1
  2. package/dist/adapters/index.js +6 -4
  3. package/dist/adapters/index.js.map +1 -1
  4. package/dist/cli/index.js +20 -2
  5. package/dist/cli/index.js.map +1 -1
  6. package/dist/installer/index.d.ts.map +1 -1
  7. package/dist/installer/index.js +2 -10
  8. package/dist/installer/index.js.map +1 -1
  9. package/dist/manifest/index.d.ts +1 -1
  10. package/dist/manifest/index.js +1 -1
  11. package/dist/templates.d.ts +3 -2
  12. package/dist/templates.d.ts.map +1 -1
  13. package/dist/templates.js +24 -1
  14. package/dist/templates.js.map +1 -1
  15. package/dist/validation/index.d.ts.map +1 -1
  16. package/dist/validation/index.js +2 -11
  17. package/dist/validation/index.js.map +1 -1
  18. package/dist/visualizer/index.d.ts.map +1 -1
  19. package/dist/visualizer/index.js +100 -5
  20. package/dist/visualizer/index.js.map +1 -1
  21. package/package.json +1 -1
  22. package/templates/canonical/agents/engineering-orchestrator.md +21 -2
  23. package/templates/canonical/skills/codebase-discovery-engine/SKILL.md +428 -0
  24. package/templates/canonical/skills/convention-detector/SKILL.md +199 -0
  25. package/templates/canonical/skills/debugging-engine/SKILL.md +189 -0
  26. package/templates/canonical/skills/engineering-intelligence-skill/SKILL.md +4 -1
  27. package/templates/canonical/skills/git-intelligence-engine/SKILL.md +146 -0
  28. package/templates/canonical/skills/graph-engine/SKILL.md +30 -5
  29. package/templates/canonical/skills/greenfield-architect/SKILL.md +287 -0
  30. package/templates/canonical/skills/impact-analysis-engine/SKILL.md +12 -4
  31. package/templates/canonical/skills/incremental-sync-engine/SKILL.md +17 -0
  32. package/templates/canonical/skills/ongoing-learning-engine/SKILL.md +175 -0
  33. package/templates/canonical/skills/performance-analysis-engine/SKILL.md +156 -0
  34. package/templates/canonical/skills/pr-intelligence-engine/SKILL.md +127 -0
  35. package/templates/canonical/skills/security-audit-engine/SKILL.md +165 -0
  36. package/templates/canonical/skills/staleness-detector/SKILL.md +185 -0
  37. package/templates/canonical/workflows/create-project.md +63 -0
  38. package/templates/canonical/workflows/discover-codebase.md +60 -0
@@ -0,0 +1,199 @@
1
+ ---
2
+ name: convention-detector
3
+ description: Detects and codifies project conventions by analyzing naming patterns, import organization, code structure, API patterns, test patterns, git conventions, and architecture patterns. Produces a conventions document and enhances coding-patterns memory.
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # Convention Detector
8
+
9
+ Systematically analyze a codebase to detect, classify, and document conventions that are implicitly followed but not explicitly written down. Conventions are inferred from statistical patterns across the codebase — a pattern must appear in >70% of relevant files to be classified as a convention.
10
+
11
+ This capability does not modify product code.
12
+
13
+ ## Inputs
14
+
15
+ - Repository root path
16
+ - Optional: scope constraints (specific package, service, or directory)
17
+ - Optional: output from `codebase-discovery-engine` (tech stack, framework, file patterns)
18
+
19
+ ## Procedure
20
+
21
+ 1. **Sample files** — Select a representative sample of at least 20 source files across different modules. Prioritize recently modified files and files by different contributors to capture team-wide conventions (not individual habits).
22
+
23
+ 2. **Detect naming conventions** — Analyze the following naming patterns:
24
+
25
+ | Target | What to Detect | Example Patterns |
26
+ |---|---|---|
27
+ | Variables | camelCase, snake_case, PascalCase, SCREAMING_SNAKE | `userName` vs `user_name` |
28
+ | Functions | camelCase, snake_case, verb-first, noun-first | `getUser()` vs `user_get()` |
29
+ | Classes/Types | PascalCase, suffixes (Service, Controller, Repository) | `UserService`, `AuthMiddleware` |
30
+ | Files | kebab-case, camelCase, PascalCase, dot-separated | `user-service.ts` vs `UserService.ts` |
31
+ | Directories | singular, plural, kebab-case, camelCase | `model/` vs `models/` |
32
+ | Tests | `.test.`, `.spec.`, `_test`, `Test` suffix | `user.test.ts` vs `user.spec.ts` |
33
+ | Constants | SCREAMING_SNAKE, PascalCase enum members | `MAX_RETRIES`, `HttpStatus.OK` |
34
+ | Database | snake_case tables, camelCase columns, pluralization | `user_accounts` vs `UserAccount` |
35
+ | API routes | kebab-case, snake_case, camelCase, plural resources | `/api/user-accounts` vs `/api/userAccounts` |
36
+
37
+ 3. **Detect import organization** — Analyze import blocks for:
38
+
39
+ | Pattern | What to Detect |
40
+ |---|---|
41
+ | **Grouping** | External → internal → relative? Alphabetical within groups? |
42
+ | **Path style** | Absolute (`@/components/Button`) vs relative (`../../components/Button`) |
43
+ | **Path aliases** | `@/`, `~/`, `#/` — check `tsconfig.json` paths, webpack aliases |
44
+ | **Barrel files** | `index.ts` re-exports? Per-directory or selective? |
45
+ | **Type imports** | Separate `import type` vs inline `type` keyword |
46
+ | **Wildcard imports** | `import * as` usage frequency |
47
+ | **Default vs named** | Preference for default or named exports |
48
+ | **Side-effect imports** | CSS/style imports, polyfills |
49
+
50
+ 4. **Detect code structure patterns** — Analyze:
51
+
52
+ | Pattern | What to Detect |
53
+ |---|---|
54
+ | **Paradigm** | Functional vs class-based vs mixed |
55
+ | **Error handling** | Try-catch, Result/Either types, error-first callbacks, custom error classes |
56
+ | **Logging** | Logger library, log levels, structured logging, log format |
57
+ | **Validation** | Zod, Joi, class-validator, manual checks, where validation lives |
58
+ | **Configuration** | Environment variables, config files, feature flags, config patterns |
59
+ | **Dependency injection** | Constructor injection, container-based, module-based, manual wiring |
60
+ | **Async patterns** | async/await, Promises, callbacks, Observables |
61
+ | **Null handling** | Optional chaining, null checks, Maybe/Option types, assertions |
62
+ | **Comment style** | JSDoc, docstrings, inline comments, section headers |
63
+ | **Function length** | Typical function LOC, max observed, decomposition style |
64
+ | **Module exports** | Single responsibility per file? Multiple exports? |
65
+
66
+ 5. **Detect API patterns** — Analyze API endpoints for:
67
+
68
+ | Pattern | What to Detect |
69
+ |---|---|
70
+ | **REST conventions** | Resource naming, HTTP method usage, nested resources |
71
+ | **Response envelope** | `{ data, error, meta }` vs raw responses vs `{ success, result }` |
72
+ | **Error format** | Error codes, error messages, error detail structure |
73
+ | **Pagination** | Cursor-based, offset-based, page-based, query params |
74
+ | **Versioning** | URL path (`/v1/`), header-based, query param |
75
+ | **Auth headers** | Bearer token, API key, cookie-based |
76
+ | **Request validation** | Schema validation middleware, manual checks |
77
+ | **Status codes** | Consistent status code usage patterns |
78
+ | **Serialization** | camelCase vs snake_case in JSON responses |
79
+
80
+ 6. **Detect test patterns** — Analyze test files for:
81
+
82
+ | Pattern | What to Detect |
83
+ |---|---|
84
+ | **File placement** | Co-located (`__tests__/`, adjacent), separate `test/` tree, or `spec/` |
85
+ | **Naming** | `*.test.*`, `*.spec.*`, `*_test.*`, `Test*` prefix |
86
+ | **Structure** | `describe`/`it` nesting, flat tests, BDD-style, given-when-then |
87
+ | **Assertion style** | `expect().toBe()`, `assert.*`, `should.*`, custom matchers |
88
+ | **Mocking** | `jest.mock()`, `vi.mock()`, dependency injection, manual stubs |
89
+ | **Fixtures** | Factory functions, fixture files, inline data, builders |
90
+ | **Setup/teardown** | `beforeEach`/`afterEach`, `setup()`/`teardown()`, per-test setup |
91
+ | **Coverage** | Coverage thresholds, ignored paths, branch vs line coverage |
92
+ | **Integration tests** | Database setup, API testing, test containers |
93
+ | **E2E tests** | Page objects, test selectors (`data-testid`), base URLs |
94
+
95
+ 7. **Detect git patterns** — Analyze git history and config for:
96
+
97
+ | Pattern | What to Detect |
98
+ |---|---|
99
+ | **Commit format** | Conventional commits, free-form, ticket references, emoji |
100
+ | **Branch naming** | `feature/`, `fix/`, `chore/`, ticket number prefix, kebab-case |
101
+ | **PR conventions** | PR templates, required reviewers, auto-merge, squash vs merge |
102
+ | **Release process** | Tags, changelogs, release branches, semantic versioning |
103
+ | **Hooks** | Husky, lefthook, pre-commit, lint-staged |
104
+ | **Merge strategy** | Squash merge, merge commits, rebase, linear history |
105
+
106
+ 8. **Detect architecture patterns** — Analyze structural boundaries:
107
+
108
+ | Pattern | What to Detect |
109
+ |---|---|
110
+ | **Layer boundaries** | Clear separation of presentation/business/data layers |
111
+ | **Module boundaries** | Feature-based, layer-based, domain-based organization |
112
+ | **State management** | Redux, Zustand, Jotai, MobX, React Context, Vuex/Pinia, signals |
113
+ | **Data fetching** | React Query, SWR, tRPC, REST clients, GraphQL clients |
114
+ | **Middleware chains** | Ordered middleware, decorator patterns, interceptors |
115
+ | **Event patterns** | Event emitters, pub/sub, event sourcing, domain events |
116
+ | **Repository pattern** | Data access abstraction, query encapsulation |
117
+ | **Service pattern** | Business logic isolation, service layer thickness |
118
+
119
+ 9. **Calculate adherence scores** — For each detected convention, calculate:
120
+ - **Adherence rate**: percentage of relevant files/instances following the convention
121
+ - **Exceptions**: specific files or modules that deviate (and possible reasons)
122
+ - **Confidence**: how certain the detection is (based on sample size)
123
+
124
+ 10. **Write conventions document** — Generate `knowledge-base/16-conventions.md` following the output format below.
125
+
126
+ 11. **Enhance coding patterns memory** — Update `.engineering-intelligence/memory/coding-patterns.md` with durable conventions that are unlikely to change.
127
+
128
+ ## Output: `knowledge-base/16-conventions.md`
129
+
130
+ ```markdown
131
+ # Project Conventions
132
+
133
+ Generated: <timestamp>
134
+ Sample size: <N files analyzed across M modules>
135
+
136
+ ## Naming Conventions
137
+
138
+ | Target | Convention | Adherence | Exceptions | Evidence |
139
+ |---|---|---|---|---|
140
+ | Variables | camelCase | 98% | None | Sampled 150 variable declarations |
141
+ | Files | kebab-case | 94% | Legacy `utils/` dir uses camelCase | `src/components/user-profile.tsx` |
142
+ | ... | ... | ... | ... | ... |
143
+
144
+ ## Import Organization
145
+
146
+ <detected import ordering rules, path conventions, barrel file usage>
147
+
148
+ ## Code Structure
149
+
150
+ <paradigm, error handling, logging, validation patterns>
151
+
152
+ ## API Conventions
153
+
154
+ <REST conventions, response format, error format>
155
+
156
+ ## Test Conventions
157
+
158
+ <file placement, naming, assertion style, mocking approach>
159
+
160
+ ## Git Conventions
161
+
162
+ <commit format, branch naming, merge strategy>
163
+
164
+ ## Architecture Conventions
165
+
166
+ <layer boundaries, module organization, state management>
167
+
168
+ ## Convention Violations
169
+
170
+ | Convention | Violation | Location | Severity |
171
+ |---|---|---|---|
172
+ | ... | ... | ... | ... |
173
+ ```
174
+
175
+ ## Output: `.engineering-intelligence/memory/coding-patterns.md` (Enhanced)
176
+
177
+ Add a `## Conventions` section with only durable patterns that pass the durability check: "Will this convention still be relevant after 10+ more changes?"
178
+
179
+ ## Quality Gates
180
+
181
+ - [ ] At least 20 source files sampled across different modules
182
+ - [ ] Naming convention detection covers files, variables, functions, and types
183
+ - [ ] Import organization patterns are documented with examples
184
+ - [ ] Test patterns include file placement and assertion style
185
+ - [ ] Git conventions are extracted from actual git history (not assumed)
186
+ - [ ] Each convention has an adherence rate and evidence citation
187
+ - [ ] Exceptions to conventions are listed (not hidden)
188
+ - [ ] `knowledge-base/16-conventions.md` exists and follows the output format
189
+ - [ ] `coding-patterns.md` is enhanced with a Conventions section
190
+ - [ ] Only patterns with >70% adherence are classified as conventions
191
+
192
+ ## Cross-References
193
+
194
+ - Depends on: `codebase-discovery-engine` (tech stack context)
195
+ - Used by: `initialize-intelligence-skill`, `engineering-intelligence-skill`
196
+ - Feeds into: `knowledge-base/16-conventions.md`, `.engineering-intelligence/memory/coding-patterns.md`
197
+ - Consumed by: `ongoing-learning-engine` (for convention drift detection)
198
+
199
+ This capability does not modify product code.
@@ -0,0 +1,189 @@
1
+ ---
2
+ name: debugging-engine
3
+ description: Performs structured root cause analysis using graph intelligence, log correlation, error propagation tracing, and reproduction step generation. Produces evidence-backed debug reports with fix suggestions and impact analysis.
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # Debugging Engine
8
+
9
+ Systematically diagnose issues through evidence-driven root cause analysis, leveraging graph intelligence to trace error propagation and suggest fixes with assessed impact.
10
+
11
+ ## Inputs
12
+
13
+ - Bug report or error description (symptoms, error messages, stack traces)
14
+ - Repository root path
15
+ - Graph intelligence from `.engineering-intelligence/graph/` (when available)
16
+ - Project intelligence from `knowledge-base/` and `.engineering-intelligence/`
17
+ - Optional: log output, reproduction steps from reporter, environment details
18
+
19
+ ## Procedure
20
+
21
+ 1. **Classify the Issue** — Determine the bug category and initial scope:
22
+
23
+ | Category | Indicators |
24
+ |---|---|
25
+ | Runtime error | Stack trace, exception, crash |
26
+ | Logic error | Wrong output, incorrect behavior, data corruption |
27
+ | Performance | Slowness, timeouts, resource exhaustion |
28
+ | Integration | API failures, service communication errors |
29
+ | Concurrency | Race conditions, deadlocks, data inconsistency |
30
+ | Configuration | Environment-specific failures, missing config |
31
+
32
+ 2. **Root Cause Analysis Workflow** — Follow a structured elimination process:
33
+
34
+ a. **Reproduce** — Determine the minimal conditions to trigger the issue:
35
+ - Identify required inputs, state, and environment
36
+ - Distinguish deterministic from intermittent failures
37
+ - Note any timing or ordering dependencies
38
+
39
+ b. **Localize** — Narrow the fault location:
40
+ - Start from the error manifestation point (stack trace, log entry)
41
+ - Trace backward through the call chain
42
+ - Use graph intelligence to understand the execution path
43
+ - Identify the boundary between working and failing behavior
44
+
45
+ c. **Identify** — Determine the root cause:
46
+ - Distinguish symptom from cause — trace to the origin
47
+ - Check for recent changes in the fault area (correlate with git history)
48
+ - Verify assumptions about inputs, state, and invariants
49
+ - Consider environmental factors (config, dependencies, infrastructure)
50
+
51
+ 3. **Log Analysis and Correlation** — When logs are available:
52
+
53
+ | Technique | Application |
54
+ |---|---|
55
+ | Timeline reconstruction | Order events chronologically across log sources |
56
+ | Pattern matching | Identify recurring error patterns and frequencies |
57
+ | Correlation | Link events across services using request IDs or trace IDs |
58
+ | Anomaly detection | Identify unusual log patterns preceding the failure |
59
+ | Context extraction | Extract relevant state from surrounding log entries |
60
+
61
+ 4. **Error Propagation Tracing** — Using graph intelligence:
62
+
63
+ - Trace the error path through `runtime-graph.json` (call flows)
64
+ - Identify affected services via `service-graph.json` (communication topology)
65
+ - Map downstream impact via `dependency-graph.json` (module dependencies)
66
+ - Assess business impact via `business-flow-graph.json` (affected flows)
67
+
68
+ Build an error propagation chain:
69
+
70
+ ```
71
+ Origin → [module/function where fault occurs]
72
+ ↓ propagates via [mechanism: exception, error return, bad state]
73
+ Intermediate → [modules that pass through or transform the error]
74
+ ↓ manifests as [observable symptom]
75
+ Symptom → [where the user or system observes the failure]
76
+ ```
77
+
78
+ 5. **Reproduction Step Generation** — Produce minimal, deterministic reproduction steps:
79
+
80
+ ```markdown
81
+ ## Reproduction Steps
82
+ 1. Preconditions: <required state, config, data>
83
+ 2. Action: <specific steps to trigger the issue>
84
+ 3. Expected: <what should happen>
85
+ 4. Actual: <what happens instead>
86
+ 5. Environment: <runtime, OS, versions, config>
87
+ 6. Frequency: deterministic | intermittent (<rate>)
88
+ ```
89
+
90
+ 6. **Fix Suggestion with Impact Analysis** — Propose fixes with assessed risk:
91
+
92
+ | Fix Aspect | Description |
93
+ |---|---|
94
+ | Root fix | Address the underlying cause |
95
+ | Symptom mitigation | Temporary workaround if root fix is complex |
96
+ | Defensive hardening | Additional checks to prevent recurrence class |
97
+ | Files to modify | Specific files and functions that need changes |
98
+ | Risk assessment | Blast radius of the proposed fix |
99
+ | Test requirements | Tests to add for regression prevention |
100
+
101
+ When applicable, invoke `impact-analysis-engine` on the proposed fix to assess its blast radius.
102
+
103
+ 7. **Generate Debug Report** — Write `.engineering-intelligence/reports/DEBUG-XXX-<slug>.md`.
104
+
105
+ ## Output Format
106
+
107
+ Write `.engineering-intelligence/reports/DEBUG-XXX-<slug>.md`:
108
+
109
+ ```markdown
110
+ # DEBUG-XXX: <descriptive title>
111
+
112
+ ## Meta
113
+ - Generated: <ISO timestamp>
114
+ - Category: <runtime | logic | performance | integration | concurrency | configuration>
115
+ - Severity: <critical | high | medium | low>
116
+ - Status: <diagnosed | investigating | unresolved>
117
+
118
+ ## Symptoms
119
+ - <observable manifestation of the issue>
120
+ - Error message: `<exact error text>`
121
+ - Stack trace: <if available>
122
+
123
+ ## Root Cause Analysis
124
+ - **Root cause**: <concise description>
125
+ - **Origin**: <file:line where the fault originates>
126
+ - **Mechanism**: <how the fault propagates>
127
+ - **Contributing factors**: <environmental or contextual factors>
128
+
129
+ ## Error Propagation
130
+ | Step | Location | Mechanism | Evidence |
131
+ |---|---|---|---|
132
+ | Origin | src/auth/validate.ts:42 | Null reference | Missing null check |
133
+ | Propagation | src/api/middleware.ts:18 | Unhandled exception | No try/catch |
134
+ | Symptom | HTTP 500 response | Error response | Client-reported |
135
+
136
+ ## Reproduction Steps
137
+ 1. <minimal reproduction steps>
138
+
139
+ ## Fix Suggestion
140
+ ### Root Fix
141
+ - File: <path>
142
+ - Change: <description>
143
+ - Risk: <level>
144
+
145
+ ### Defensive Hardening
146
+ - <additional preventive measures>
147
+
148
+ ### Test Requirements
149
+ - [ ] <regression test to add>
150
+
151
+ ## Impact of Fix
152
+ - Blast radius: <assessment>
153
+ - Affected modules: <list>
154
+
155
+ ## Evidence
156
+ - <file path citations>
157
+
158
+ ## Unknowns
159
+ - <unresolved questions>
160
+
161
+ ---
162
+ *This debug report did not modify product code.*
163
+ ```
164
+
165
+ ## Rules
166
+
167
+ - Never guess the root cause — trace with evidence or mark as `investigating`
168
+ - Distinguish symptoms from causes explicitly
169
+ - Fix suggestions must include impact assessment
170
+ - Log analysis must not expose sensitive data (redact credentials, PII)
171
+ - This capability is analytical only — it must not modify product code
172
+
173
+ ## Quality Gates
174
+
175
+ - [ ] Issue is classified by category and severity
176
+ - [ ] Root cause is traced with evidence (not assumed)
177
+ - [ ] Error propagation path is documented with graph references
178
+ - [ ] Reproduction steps are minimal and actionable
179
+ - [ ] Fix suggestion includes impact assessment and test requirements
180
+ - [ ] Sensitive data is redacted from logs and traces in the report
181
+ - [ ] Report ends with the "did not modify product code" statement
182
+
183
+ ## Cross-References
184
+
185
+ - Depends on: `graph-engine` (error propagation tracing), `impact-analysis-engine` (fix impact assessment)
186
+ - Used by: `engineering-intelligence-skill`
187
+ - Consumed by: `engineering-change-review` (when fix is implemented as a change)
188
+
189
+ This capability is analytical only. It must not modify product code.
@@ -77,6 +77,8 @@ Before any code edit, write `.engineering-intelligence/reports/IMP-XXX-<summary>
77
77
 
78
78
  - Edit only the files necessary for the request
79
79
  - Follow existing coding patterns from `.engineering-intelligence/memory/coding-patterns.md`
80
+ - Read conventions from `knowledge-base/16-conventions.md` and `.engineering-intelligence/memory/coding-patterns.md` — match naming patterns, import style, error handling patterns, and code structure
81
+ - If conventions document is missing or outdated, run `convention-detector` first
80
82
  - Respect architectural boundaries from `.engineering-intelligence/memory/architecture-decisions.md`
81
83
  - Consult `dangerous-areas.md` before modifying flagged code
82
84
 
@@ -160,9 +162,10 @@ Summarize to the user:
160
162
  - [ ] Only affected intelligence artifacts were updated
161
163
  - [ ] Change record references the correct impact report
162
164
  - [ ] High-risk changes went through review gate
165
+ - [ ] Generated code follows detected project conventions (naming, imports, structure)
163
166
 
164
167
  ## Cross-References
165
168
 
166
169
  - Depends on: `initialize-intelligence-skill` (prerequisite), `change-detection-engine`, `impact-analysis-engine`, `graph-engine`
167
170
  - Uses during execution: `testing-intelligence-engine`, `incremental-sync-engine`, `change-history-engine`
168
- - Optional: `engineering-change-review` (for high-risk), `refactoring-planner` (for refactors)
171
+ - Optional: `engineering-change-review` (for high-risk), `refactoring-planner` (for refactors), `convention-detector` (for convention compliance)
@@ -0,0 +1,146 @@
1
+ ---
2
+ name: git-intelligence-engine
3
+ description: Extracts structural intelligence from git history — hotspot analysis, ownership mapping, change coupling, velocity tracking, and drift detection. Feeds graph intelligence and impact analysis with git-derived edges.
4
+ version: 3.0.0
5
+ ---
6
+
7
+ # Git Intelligence Engine
8
+
9
+ Extract actionable intelligence from git history to reveal hidden dependencies, ownership patterns, and codebase evolution trends.
10
+
11
+ ## Inputs
12
+
13
+ - Repository root path
14
+ - Mode: `full` (analyze complete history) or `incremental` (analyze since last run)
15
+ - Optional: time window (e.g., last 90 days, last 6 months)
16
+ - Optional: branch filter (specific branches to analyze)
17
+
18
+ ## Procedure
19
+
20
+ 1. **Collect History** — Extract commit log with file-level diffs, authors, timestamps, and branch metadata. For `incremental` mode, scope to commits since the last recorded analysis timestamp.
21
+
22
+ 2. **Hotspot Analysis** — Identify the most frequently changed files and directories:
23
+
24
+ | Metric | Description |
25
+ |---|---|
26
+ | Change frequency | Number of commits touching each file |
27
+ | Churn rate | Lines added + deleted per file over the time window |
28
+ | Complexity trend | Whether hotspot files are growing in size/complexity |
29
+ | Bug correlation | Commits linked to bugfix keywords touching each file |
30
+
31
+ Rank files by composite hotspot score (frequency × churn × bug correlation).
32
+
33
+ 3. **Ownership Mapping** — Determine contributor ownership per module:
34
+
35
+ | Field | Description |
36
+ |---|---|
37
+ | Primary owner | Contributor with most commits to the module |
38
+ | Secondary owners | Other significant contributors (>10% of commits) |
39
+ | Bus factor | Number of contributors with meaningful knowledge |
40
+ | Last active | Most recent commit date per contributor per module |
41
+ | Orphaned modules | Modules where all significant contributors are inactive (>90 days) |
42
+
43
+ 4. **Change Coupling Analysis** — Identify files that always change together:
44
+
45
+ | Metric | Description |
46
+ |---|---|
47
+ | Co-change frequency | Number of commits where both files are modified |
48
+ | Coupling strength | Co-change frequency / total changes of either file |
49
+ | Confidence | `verified` if coupling > 0.7, `inferred` if 0.4–0.7, `unknown` below |
50
+
51
+ Flag high-coupling pairs that span module boundaries — these indicate hidden dependencies not visible in import graphs.
52
+
53
+ 5. **Velocity Tracking** — Measure change rate per module per time period:
54
+
55
+ | Metric | Description |
56
+ |---|---|
57
+ | Commits per week | Average commit frequency per module |
58
+ | Active contributors | Unique contributors per module per period |
59
+ | Acceleration | Whether velocity is increasing, stable, or declining |
60
+ | Staleness | Modules with zero commits in the analysis window |
61
+
62
+ 6. **Drift Detection** — Identify branches that have diverged significantly:
63
+
64
+ | Metric | Description |
65
+ |---|---|
66
+ | Divergence score | Number of commits ahead/behind between branch pairs |
67
+ | Conflict potential | Files modified in both branches |
68
+ | Merge complexity | Estimated effort to reconcile (based on overlapping changes) |
69
+ | Stale branches | Branches with no commits in >30 days |
70
+
71
+ 7. **Feed Graph Intelligence** — Write git-derived edges to `.engineering-intelligence/graph/`:
72
+ - Add `co-changes-with` edges to `dependency-graph.json` for verified change-coupled pairs
73
+ - Add `owned-by` metadata to graph nodes based on ownership mapping
74
+ - Mark edge confidence based on analysis evidence
75
+
76
+ 8. **Generate Report** — Write `.engineering-intelligence/reports/GIT-intelligence.md` with all findings, ranked by actionability.
77
+
78
+ ## Output Format
79
+
80
+ Write `.engineering-intelligence/reports/GIT-intelligence.md`:
81
+
82
+ ```markdown
83
+ # Git Intelligence Report
84
+
85
+ ## Meta
86
+ - Generated: <ISO timestamp>
87
+ - Mode: full | incremental
88
+ - Time window: <start> to <end>
89
+ - Commits analyzed: <count>
90
+
91
+ ## Hotspots
92
+ | Rank | File | Change Freq | Churn | Bug Correlation | Score |
93
+ |---|---|---|---|---|---|
94
+ | 1 | path/to/file.ts | 47 | 1,240 | 8 | 95.2 |
95
+
96
+ ## Ownership Map
97
+ | Module | Primary Owner | Bus Factor | Orphaned |
98
+ |---|---|---|---|
99
+ | src/auth/ | alice | 3 | No |
100
+
101
+ ## Change Coupling
102
+ | File A | File B | Co-changes | Strength | Cross-module |
103
+ |---|---|---|---|---|
104
+ | src/api/users.ts | src/db/user-repo.ts | 23 | 0.82 | Yes |
105
+
106
+ ## Velocity
107
+ | Module | Commits/Week | Trend | Staleness |
108
+ |---|---|---|---|
109
+ | src/core/ | 12.3 | Accelerating | — |
110
+
111
+ ## Drift
112
+ | Branch | Divergence | Conflict Files | Stale |
113
+ |---|---|---|---|
114
+ | feature/payments | +47 / -12 | 3 | No |
115
+
116
+ ## Graph Updates
117
+ - Edges added: <count>
118
+ - Nodes annotated: <count>
119
+
120
+ ## Evidence
121
+ - <file path citations>
122
+ ```
123
+
124
+ ## Rules
125
+
126
+ - Never fabricate git history — all metrics must derive from actual commit data
127
+ - Ownership mapping must not assume contributor activity from naming conventions alone
128
+ - Change coupling edges added to graphs must include evidence paths
129
+ - This capability is analytical only — it must not modify product code
130
+
131
+ ## Quality Gates
132
+
133
+ - [ ] All metrics cite commit SHAs or date ranges as evidence
134
+ - [ ] Hotspot ranking uses composite scoring (not single-metric)
135
+ - [ ] Ownership includes bus factor and orphaned module flags
136
+ - [ ] Change coupling distinguishes intra-module from cross-module pairs
137
+ - [ ] Graph edges added carry `confidence` and `evidence` fields
138
+ - [ ] Report ends with graph update summary
139
+
140
+ ## Cross-References
141
+
142
+ - Depends on: `graph-engine` (for writing git-derived edges)
143
+ - Used by: `impact-analysis-engine`, `graph-engine`
144
+ - Consumed by: `pr-intelligence-engine`
145
+
146
+ This capability is analytical only. It must not modify product code.
@@ -68,6 +68,8 @@ Each JSON graph uses this envelope:
68
68
  | `devDependency` | Development-only dependency |
69
69
  | `peerDependency` | Peer/optional dependency |
70
70
  | `configures` | Configuration dependency |
71
+ | `implicit-dependency` | Shared database tables, shared config |
72
+ | `event-coupling` | Event-driven coupling |
71
73
 
72
74
  ### 2. `service-graph.json` — Service Communication Topology
73
75
 
@@ -87,6 +89,8 @@ Each JSON graph uses this envelope:
87
89
  | `subscribes` | Event/message consumption |
88
90
  | `reads` | Data store read access |
89
91
  | `writes` | Data store write access |
92
+ | `shares-data` | Shared database/cache |
93
+ | `feature-flag` | Feature-flag-controlled behavior |
90
94
 
91
95
  ### 3. `runtime-graph.json` — Runtime Call Flows
92
96
 
@@ -123,7 +127,25 @@ Each JSON graph uses this envelope:
123
127
  | `on-failure` | Error/failure path |
124
128
  | `requires` | Prerequisite relationship |
125
129
 
126
- ### 5. `architecture-map.md` — Mermaid Visualization
130
+ ### 5. `data-flow-graph.json` — Data Transformation Graph
131
+
132
+ | Node Kind | Description |
133
+ |---|---|
134
+ | `source` | Data origin |
135
+ | `transform` | Processing step |
136
+ | `store` | Persistence |
137
+ | `sink` | Data output/consumer |
138
+ | `validator` | Validation step |
139
+
140
+ | Edge Relation | Description |
141
+ |---|---|
142
+ | `feeds` | Data feed |
143
+ | `transforms` | Data transformation |
144
+ | `validates` | Data validation |
145
+ | `persists` | Data persistence |
146
+ | `emits` | Data emission/output |
147
+
148
+ ### 6. `architecture-map.md` — Mermaid Visualization
127
149
 
128
150
  Derive Mermaid diagrams from the JSON graphs. Include:
129
151
 
@@ -131,17 +153,19 @@ Derive Mermaid diagrams from the JSON graphs. Include:
131
153
  - **Module Dependencies** — Package/module dependency flow (from dependency-graph)
132
154
  - **Request Flow** — Primary request lifecycle (from runtime-graph)
133
155
  - **Key Business Flows** — Critical business processes (from business-flow-graph)
156
+ - **Data Flow** — Data transformation pipelines (from data-flow-graph)
134
157
 
135
158
  ## Procedure
136
159
 
137
160
  ### Full Mode (initialization or remapping)
138
161
 
139
162
  1. Scan all package manifests, imports, route definitions, service configs, and infrastructure files
140
- 2. Build all four graphs from scratch
163
+ 2. Build all five graphs from scratch
141
164
  3. Assign `verified` confidence to edges backed by explicit code evidence
142
165
  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`
166
+ 5. Integrate git change coupling data from `git-intelligence-engine` as `inferred` edges files that frequently change together suggest hidden dependencies
167
+ 6. Mark unresolvable relationships as `unknown` and add to `unknowns` array
168
+ 7. Generate Mermaid diagrams in `architecture-map.md`
145
169
 
146
170
  ### Incremental Mode (post-change update)
147
171
 
@@ -163,7 +187,7 @@ Derive Mermaid diagrams from the JSON graphs. Include:
163
187
 
164
188
  ## Quality Gates
165
189
 
166
- - [ ] All four JSON graphs validate against the schema above
190
+ - [ ] All five JSON graphs (`dependency-graph.json`, `service-graph.json`, `runtime-graph.json`, `business-flow-graph.json`, `data-flow-graph.json`) validate against the schema above
167
191
  - [ ] Every `verified` edge has at least one evidence path
168
192
  - [ ] No `unknown` relationships are left out of the `unknowns` array
169
193
  - [ ] `architecture-map.md` Mermaid diagrams are syntactically valid
@@ -174,5 +198,6 @@ Derive Mermaid diagrams from the JSON graphs. Include:
174
198
  - Used by: `initialize-intelligence-skill`, `impact-analysis-engine`, `incremental-sync-engine`
175
199
  - Supports: `map-architecture` workflow, `analyze-impact` workflow
176
200
  - Feeds context to: `context-sync-engine`
201
+ - Integrates data from: `git-intelligence-engine`
177
202
 
178
203
  This capability may write intelligence artifacts. It must not modify product code.