codeimpact 0.1.0 → 0.2.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 +107 -14
- package/dist/index.js +4997 -251
- package/dist/index.js.map +4 -4
- package/doc/IMPLEMENTATION.md +179 -0
- package/package.json +6 -2
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
# CodeImpact Implementation Guide
|
|
2
|
+
|
|
3
|
+
## Architecture Overview
|
|
4
|
+
|
|
5
|
+
CodeImpact is an MCP server that gives AI coding assistants persistent, deep understanding of any codebase. It exposes **17 tools** (6 gateway + 11 standalone) backed by **14 engine subsystems**, sharing a single SQLite database + embedding index per project.
|
|
6
|
+
|
|
7
|
+
## MCP Tool Surface (17 Tools)
|
|
8
|
+
|
|
9
|
+
### Gateway Tools (6)
|
|
10
|
+
|
|
11
|
+
| Tool | Sub-actions | Purpose |
|
|
12
|
+
|------|------------|---------|
|
|
13
|
+
| `memory_query` | context, search, file, summary, symbol, dependencies, predict, confidence, sources, existing | Semantic code search, AST symbol lookup, dependency graph traversal, deja vu, prediction, confidence scoring |
|
|
14
|
+
| `memory_record` | decision, pattern, feedback, feature, critical, example | Persist architectural choices, code patterns, critical requirements, pattern examples |
|
|
15
|
+
| `memory_review` | full, pattern, conflicts, tests, confidence, bugs, coverage | Pre-change safety: pattern validation + decision conflicts + ghost conflicts + test impact + bug history. Returns risk_score + verdict |
|
|
16
|
+
| `memory_status` | summary, happened, changed, architecture, changelog, health, patterns, stats, undocumented, critical, learning | Project observability: what changed, architecture state, doc freshness, context health |
|
|
17
|
+
| `memory_ghost` | full, conflicts, dejavu, resurrect | Silent intelligence: proactive conflict warnings, similar-problem detection, session resurrection |
|
|
18
|
+
| `memory_verify` | imports, security, dependencies, patterns, tests, all | Pre-commit quality gate: hallucinated import detection, OWASP scanning, pattern compliance. Returns pass/warning/fail verdict |
|
|
19
|
+
|
|
20
|
+
### Standalone Tools (11)
|
|
21
|
+
|
|
22
|
+
| Tool | Purpose |
|
|
23
|
+
|------|---------|
|
|
24
|
+
| `switch_project` | Switch active project context |
|
|
25
|
+
| `switch_feature_context` | Resume tracking a previous feature |
|
|
26
|
+
| `trigger_compaction` | Reduce memory token usage |
|
|
27
|
+
| `update_decision_status` | Mark decisions deprecated/superseded |
|
|
28
|
+
| `export_decisions_to_adr` | Export decisions as ADR markdown files |
|
|
29
|
+
| `discover_projects` | Find git repositories on the system |
|
|
30
|
+
| `knowledge_status` | Get knowledge workspace status |
|
|
31
|
+
| `knowledge_generate` | Generate/refresh knowledge artifacts |
|
|
32
|
+
| `knowledge_sync_rules` | Sync platform instruction files |
|
|
33
|
+
| `knowledge_research` | Refresh provider research notes |
|
|
34
|
+
| `memory_blast_radius` | Analyze risk of changing a file |
|
|
35
|
+
|
|
36
|
+
## Engine Subsystems (14)
|
|
37
|
+
|
|
38
|
+
### 1. Indexer + AST + Embeddings
|
|
39
|
+
- Tree-sitter WASM parsing for TS/JS, Python, Go, Rust, Java
|
|
40
|
+
- MiniLM L6 embeddings for semantic search
|
|
41
|
+
- Extracts symbols, imports, exports, dependency edges
|
|
42
|
+
- File watcher for live re-indexing
|
|
43
|
+
|
|
44
|
+
### 2. Context Assembler
|
|
45
|
+
- Assembles relevant context from all tiers for queries
|
|
46
|
+
- Token budget allocation across tiers
|
|
47
|
+
- Feature context integration
|
|
48
|
+
|
|
49
|
+
### 3. Decision Tracker + Extractor
|
|
50
|
+
- Persists architectural decisions with embeddings
|
|
51
|
+
- Extracts decisions from git commits and code comments
|
|
52
|
+
- Conflict detection via semantic similarity
|
|
53
|
+
|
|
54
|
+
### 4. Learning Engine
|
|
55
|
+
- Tracks file access patterns and query patterns
|
|
56
|
+
- Predicts relevant files based on usage
|
|
57
|
+
- Hot file caching and pre-fetching
|
|
58
|
+
|
|
59
|
+
### 5. Living Documentation
|
|
60
|
+
- Architecture overview generation (layers, data flow, key components)
|
|
61
|
+
- Per-file component documentation
|
|
62
|
+
- Git-based changelog generation
|
|
63
|
+
- Documentation validation and staleness detection
|
|
64
|
+
- Syncs to knowledge/docs/ on every generation
|
|
65
|
+
|
|
66
|
+
### 6. Context Rot Prevention
|
|
67
|
+
- Token utilization monitoring
|
|
68
|
+
- Drift detection from initial requirements
|
|
69
|
+
- Critical context marking (never compress)
|
|
70
|
+
- Compaction strategies (summarize, selective, aggressive)
|
|
71
|
+
|
|
72
|
+
### 7. Confidence Scorer
|
|
73
|
+
- Multi-signal confidence scoring (codebase + decisions + patterns)
|
|
74
|
+
- Source tracking with provenance
|
|
75
|
+
- Conflict detection against past decisions
|
|
76
|
+
|
|
77
|
+
### 8. Change Intelligence
|
|
78
|
+
- Git history analysis and change tracking
|
|
79
|
+
- Bug history with FTS5 search
|
|
80
|
+
- Fix correlation and suggestion
|
|
81
|
+
- Diagnosis engine for error investigation
|
|
82
|
+
|
|
83
|
+
### 9. Architecture Enforcement
|
|
84
|
+
- Pattern learning from codebase
|
|
85
|
+
- Pattern validation for new code
|
|
86
|
+
- Duplicate function detection via embeddings
|
|
87
|
+
- Pattern library with rules and examples
|
|
88
|
+
|
|
89
|
+
### 10. Test Awareness
|
|
90
|
+
- Test file indexing across frameworks (jest, vitest, pytest, etc.)
|
|
91
|
+
- File-to-test and function-to-test mapping
|
|
92
|
+
- Test impact analysis for changed files
|
|
93
|
+
- Test coverage gap detection
|
|
94
|
+
|
|
95
|
+
### 11. Ghost Mode
|
|
96
|
+
- Silent file access tracking
|
|
97
|
+
- Proactive decision conflict detection
|
|
98
|
+
- File impact correlation
|
|
99
|
+
- Telepathic context surfacing
|
|
100
|
+
|
|
101
|
+
### 12. Deja Vu Detector
|
|
102
|
+
- Query pattern recording and matching
|
|
103
|
+
- Similar-problem detection across sessions
|
|
104
|
+
- Solution recall from past interactions
|
|
105
|
+
|
|
106
|
+
### 13. Code Verifier
|
|
107
|
+
- Import existence validation (catches hallucinated imports)
|
|
108
|
+
- OWASP Top 10 security scanning
|
|
109
|
+
- Dependency verification (installed? in manifest?)
|
|
110
|
+
- Multi-check pipeline with scoring
|
|
111
|
+
|
|
112
|
+
### 14. Knowledge Orchestrator
|
|
113
|
+
- Autonomous skill and documentation generation
|
|
114
|
+
- Debounced triggers from index/git/file events
|
|
115
|
+
- Cross-platform instruction file sync
|
|
116
|
+
- Provider research management
|
|
117
|
+
- Intelligence fusion from all subsystems
|
|
118
|
+
|
|
119
|
+
## Data Flow
|
|
120
|
+
|
|
121
|
+
```
|
|
122
|
+
Code Changes
|
|
123
|
+
|
|
|
124
|
+
v
|
|
125
|
+
Indexer (AST + Embeddings)
|
|
126
|
+
|
|
|
127
|
+
v
|
|
128
|
+
SQLite Database (files, symbols, imports, exports, dependencies,
|
|
129
|
+
decisions, patterns, tests, changes, bugs,
|
|
130
|
+
documentation, activity_log, token_usage)
|
|
131
|
+
|
|
|
132
|
+
v
|
|
133
|
+
14 Engine Subsystems (read/write shared DB)
|
|
134
|
+
|
|
|
135
|
+
v
|
|
136
|
+
Knowledge Orchestrator (fuses intelligence from all subsystems)
|
|
137
|
+
|
|
|
138
|
+
v
|
|
139
|
+
knowledge/ workspace (skills + docs + manifest)
|
|
140
|
+
|
|
|
141
|
+
v
|
|
142
|
+
Platform Rule Sync (.cursorrules, CLAUDE.md, AGENTS.md, etc.)
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Knowledge Workspace Structure
|
|
146
|
+
|
|
147
|
+
```
|
|
148
|
+
knowledge/
|
|
149
|
+
index.json -- manifest with versions, timestamps, sources
|
|
150
|
+
skills/
|
|
151
|
+
_core/ -- always-present skills
|
|
152
|
+
_technology/ -- framework/library skills
|
|
153
|
+
_features/ -- codebase feature area skills
|
|
154
|
+
_risk/ -- blast radius and safety skills
|
|
155
|
+
docs/
|
|
156
|
+
architecture/ -- architecture overview
|
|
157
|
+
features/ -- per-component documentation
|
|
158
|
+
integrations/ -- provider research notes
|
|
159
|
+
changelog/ -- rolling changelog
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
## Intelligence Fusion
|
|
163
|
+
|
|
164
|
+
The knowledge system consumes intelligence from every engine subsystem:
|
|
165
|
+
|
|
166
|
+
| Source | Data Used | Feeds Into |
|
|
167
|
+
|--------|-----------|------------|
|
|
168
|
+
| Tier2 (Indexer) | File count, languages, dependency hotspots, imports/exports | Tech detection, feature mapping |
|
|
169
|
+
| Architecture Enforcement | Learned patterns, rules, usage counts | Skill constraints, review criteria |
|
|
170
|
+
| Decisions | Active decisions, tags, files | Skill rules, conflict prevention |
|
|
171
|
+
| Blast Radius | High-risk files, risk scores, critical paths | Risk skills, review warnings |
|
|
172
|
+
| Dead Code | Unused exports, safe-to-delete candidates | Cleanup skills |
|
|
173
|
+
| Test Awareness | Framework, test count, coverage gaps | Verification steps, test commands |
|
|
174
|
+
| Change Intelligence | Recent bugs, change hotspots | Pitfall warnings, bug history |
|
|
175
|
+
| Feature Context | Active feature, working files | Scoped skill generation |
|
|
176
|
+
| Ghost Mode | Conflict warnings, decision caches | Constraint generation |
|
|
177
|
+
| Deja Vu | Recurring query patterns | Problem-solving steps |
|
|
178
|
+
| Living Docs | Architecture, validation score, outdated docs | Documentation maintenance skills |
|
|
179
|
+
| Confidence | Pattern/decision alignment signals | Verification criteria |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codeimpact",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "MCP server that gives AI assistants persistent understanding of your codebase",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,10 @@
|
|
|
16
16
|
"build": "node esbuild.config.js",
|
|
17
17
|
"dev": "node --watch dist/index.js",
|
|
18
18
|
"start": "node dist/index.js",
|
|
19
|
-
"typecheck": "tsc --noEmit"
|
|
19
|
+
"typecheck": "tsc --noEmit",
|
|
20
|
+
"test": "node --import tsx --test test/**/*.test.ts",
|
|
21
|
+
"test:knowledge": "node --import tsx --test test/knowledge/*.test.ts",
|
|
22
|
+
"prepublishOnly": "npm run build"
|
|
20
23
|
},
|
|
21
24
|
"keywords": [
|
|
22
25
|
"mcp",
|
|
@@ -53,6 +56,7 @@
|
|
|
53
56
|
"@types/better-sqlite3": "^7.6.0",
|
|
54
57
|
"@types/node": "^22.0.0",
|
|
55
58
|
"esbuild": "^0.25.0",
|
|
59
|
+
"tsx": "^4.21.0",
|
|
56
60
|
"typescript": "^5.7.0"
|
|
57
61
|
},
|
|
58
62
|
"engines": {
|