memtrace 0.1.3 → 0.1.5
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 +242 -0
- package/package.json +1 -1
package/README.md
ADDED
|
@@ -0,0 +1,242 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<img src="https://raw.githubusercontent.com/syncable-dev/memtrace/main/assets/logo.svg" alt="Memtrace" width="120" height="120" />
|
|
3
|
+
</p>
|
|
4
|
+
|
|
5
|
+
<h1 align="center">Memtrace</h1>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Code intelligence graph for AI agents</strong><br/>
|
|
9
|
+
Structural search · Relationship analysis · Temporal evolution · Architectural understanding
|
|
10
|
+
</p>
|
|
11
|
+
|
|
12
|
+
<p align="center">
|
|
13
|
+
<a href="https://www.npmjs.com/package/memtrace"><img src="https://img.shields.io/npm/v/memtrace?style=flat-square&color=00D4B8&label=npm" alt="npm version" /></a>
|
|
14
|
+
<a href="https://www.npmjs.com/package/memtrace"><img src="https://img.shields.io/npm/dm/memtrace?style=flat-square&color=0A1628&label=downloads" alt="npm downloads" /></a>
|
|
15
|
+
<a href="https://github.com/syncable-dev/memtrace/stargazers"><img src="https://img.shields.io/github/stars/syncable-dev/memtrace?style=flat-square&color=00D4B8" alt="GitHub stars" /></a>
|
|
16
|
+
<a href="https://github.com/syncable-dev/memtrace/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-FSL--1.1--MIT-0A1628?style=flat-square" alt="license" /></a>
|
|
17
|
+
<a href="https://memtrace.dev"><img src="https://img.shields.io/badge/docs-memtrace.dev-00D4B8?style=flat-square" alt="docs" /></a>
|
|
18
|
+
</p>
|
|
19
|
+
|
|
20
|
+
<p align="center">
|
|
21
|
+
<a href="#quick-start">Quick Start</a> ·
|
|
22
|
+
<a href="#skills">Skills</a> ·
|
|
23
|
+
<a href="#mcp-tools">MCP Tools</a> ·
|
|
24
|
+
<a href="#evolution-engine">Evolution Engine</a> ·
|
|
25
|
+
<a href="#claude-code-setup">Claude Code</a> ·
|
|
26
|
+
<a href="#claude-desktop-setup">Claude Desktop</a>
|
|
27
|
+
</p>
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
Memtrace is an MCP server that builds a **persistent knowledge graph** from your codebase. It parses source files, resolves cross-file relationships, detects API endpoints, runs community detection, and embeds all symbols for semantic search — then exposes 25+ tools via the [Model Context Protocol](https://modelcontextprotocol.io) so AI agents can explore, analyze, and reason about your code structurally.
|
|
32
|
+
|
|
33
|
+
## Quick Start
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
# Install (binary + skills + MCP server — all in one)
|
|
37
|
+
npm install -g memtrace
|
|
38
|
+
|
|
39
|
+
# Start the graph database
|
|
40
|
+
memtrace start
|
|
41
|
+
|
|
42
|
+
# Index your project
|
|
43
|
+
memtrace index /path/to/your/project
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
That's it. The installer handles everything:
|
|
47
|
+
|
|
48
|
+
| Step | What happens |
|
|
49
|
+
|------|-------------|
|
|
50
|
+
| **Binary** | Platform-specific native binary installed via npm |
|
|
51
|
+
| **Skills** | 12 AI agent skills written to `~/.claude/skills/` and plugin cache |
|
|
52
|
+
| **Plugin** | `memtrace-skills@memtrace` enabled in `~/.claude/settings.json` |
|
|
53
|
+
| **Marketplace** | GitHub marketplace registered for auto-updates |
|
|
54
|
+
| **MCP Server** | `memtrace mcp` registered in `mcpServers` |
|
|
55
|
+
|
|
56
|
+
> **Zero configuration required** — just install and start exploring your codebase with Claude.
|
|
57
|
+
|
|
58
|
+
## Skills
|
|
59
|
+
|
|
60
|
+
Memtrace ships with **12 skills** that teach Claude _how_ to use the knowledge graph. Skills fire automatically based on what you ask.
|
|
61
|
+
|
|
62
|
+
### Command Skills
|
|
63
|
+
|
|
64
|
+
| Skill | Triggers when you say... |
|
|
65
|
+
|:------|:------------------------|
|
|
66
|
+
| `memtrace-index` | _"index this project"_, _"set up code intelligence"_, _"parse this codebase"_ |
|
|
67
|
+
| `memtrace-search` | _"find this function"_, _"where is X defined"_, _"search for authentication logic"_ |
|
|
68
|
+
| `memtrace-relationships` | _"who calls this"_, _"what does this function call"_, _"show class hierarchy"_ |
|
|
69
|
+
| `memtrace-evolution` | _"what changed this week"_, _"how did this evolve"_, _"what's different since Monday"_ |
|
|
70
|
+
| `memtrace-impact` | _"what will break if I change this"_, _"blast radius"_, _"risk assessment"_ |
|
|
71
|
+
| `memtrace-quality` | _"find dead code"_, _"complexity hotspots"_, _"code smells"_ |
|
|
72
|
+
| `memtrace-graph` | _"show me the architecture"_, _"find bottlenecks"_, _"most important functions"_ |
|
|
73
|
+
| `memtrace-api-topology` | _"list API endpoints"_, _"service dependencies"_, _"who calls this API"_ |
|
|
74
|
+
|
|
75
|
+
### Workflow Skills
|
|
76
|
+
|
|
77
|
+
Multi-step orchestrations that chain tools together with decision logic:
|
|
78
|
+
|
|
79
|
+
| Skill | Triggers when you say... |
|
|
80
|
+
|:------|:------------------------|
|
|
81
|
+
| `memtrace-codebase-exploration` | _"explore this codebase"_, _"I'm new to this project"_, _"give me an overview"_ |
|
|
82
|
+
| `memtrace-change-impact-analysis` | _"what will break if I refactor this"_, _"pre-change risk assessment"_ |
|
|
83
|
+
| `memtrace-incident-investigation` | _"something broke"_, _"root cause analysis"_, _"what went wrong"_ |
|
|
84
|
+
| `memtrace-refactoring-guide` | _"help me refactor"_, _"reduce complexity"_, _"clean up tech debt"_ |
|
|
85
|
+
|
|
86
|
+
## MCP Tools
|
|
87
|
+
|
|
88
|
+
25+ tools exposed via the Model Context Protocol:
|
|
89
|
+
|
|
90
|
+
<table>
|
|
91
|
+
<tr>
|
|
92
|
+
<td width="50%" valign="top">
|
|
93
|
+
|
|
94
|
+
**Search & Discovery**
|
|
95
|
+
- `find_code` — hybrid BM25 + semantic search with RRF
|
|
96
|
+
- `find_symbol` — exact/fuzzy name match with Levenshtein
|
|
97
|
+
|
|
98
|
+
**Relationships**
|
|
99
|
+
- `analyze_relationships` — callers, callees, hierarchy, imports
|
|
100
|
+
- `get_symbol_context` — 360° view in one call
|
|
101
|
+
|
|
102
|
+
**Impact Analysis**
|
|
103
|
+
- `get_impact` — blast radius with risk rating
|
|
104
|
+
- `detect_changes` — diff-to-symbols scope mapping
|
|
105
|
+
|
|
106
|
+
**Code Quality**
|
|
107
|
+
- `find_dead_code` — zero-caller detection
|
|
108
|
+
- `find_most_complex_functions` — complexity hotspots
|
|
109
|
+
- `calculate_cyclomatic_complexity` — per-symbol scoring
|
|
110
|
+
- `get_repository_stats` — repo-wide metrics
|
|
111
|
+
|
|
112
|
+
</td>
|
|
113
|
+
<td width="50%" valign="top">
|
|
114
|
+
|
|
115
|
+
**Temporal Analysis**
|
|
116
|
+
- `get_evolution` — 6 scoring modes (see below)
|
|
117
|
+
- `get_timeline` — full symbol version history
|
|
118
|
+
- `detect_changes` — diff-based impact scope
|
|
119
|
+
|
|
120
|
+
**Graph Algorithms**
|
|
121
|
+
- `find_bridge_symbols` — betweenness centrality
|
|
122
|
+
- `find_central_symbols` — PageRank / degree
|
|
123
|
+
- `list_communities` — Louvain module detection
|
|
124
|
+
- `list_processes` / `get_process_flow` — execution tracing
|
|
125
|
+
|
|
126
|
+
**API Topology**
|
|
127
|
+
- `get_api_topology` — cross-repo HTTP call graph
|
|
128
|
+
- `find_api_endpoints` — all exposed routes
|
|
129
|
+
- `find_api_calls` — all outbound HTTP calls
|
|
130
|
+
|
|
131
|
+
**Indexing & Watch**
|
|
132
|
+
- `index_directory` — parse, resolve, embed
|
|
133
|
+
- `watch_directory` — live incremental re-indexing
|
|
134
|
+
- `execute_cypher` — direct graph queries
|
|
135
|
+
|
|
136
|
+
</td>
|
|
137
|
+
</tr>
|
|
138
|
+
</table>
|
|
139
|
+
|
|
140
|
+
## Evolution Engine
|
|
141
|
+
|
|
142
|
+
The temporal analysis engine implements **six distinct scoring algorithms** — choose the right one for the question you're asking:
|
|
143
|
+
|
|
144
|
+
| Mode | Formula | Best for |
|
|
145
|
+
|:-----|:--------|:---------|
|
|
146
|
+
| **`compound`** | `0.50 × rank(impact) + 0.35 × rank(novel) + 0.15 × rank(recent)` | General-purpose _"what changed?"_ |
|
|
147
|
+
| **`impact`** | `sig(n) = in_degree^0.7 × (1 + out_degree)^0.3` | _"What broke?"_ — largest blast radius |
|
|
148
|
+
| **`novel`** | `surprise(n) = (1 + in_degree) / (1 + change_freq_90d)` | _"What's unexpected?"_ — anomaly detection |
|
|
149
|
+
| **`recent`** | `impact × exp(−0.5 × Δhours)` | _"What changed near the incident?"_ |
|
|
150
|
+
| **`directional`** | Asymmetric: added → out_degree, removed → in_degree | _"What was added vs removed?"_ |
|
|
151
|
+
| **`overview`** | Module-level rollup only | Quick summary, no per-symbol scoring |
|
|
152
|
+
|
|
153
|
+
Uses **Structural Significance Budgeting (SSB)** to select the minimum set of changes covering ≥80% of total significance — surfaces what matters without drowning you in noise.
|
|
154
|
+
|
|
155
|
+
## Claude Code Setup
|
|
156
|
+
|
|
157
|
+
`npm install -g memtrace` handles everything. For manual setup:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# 1. Register the marketplace
|
|
161
|
+
claude plugin marketplace add syncable-dev/memtrace
|
|
162
|
+
|
|
163
|
+
# 2. Install the skills plugin
|
|
164
|
+
claude plugin install memtrace-skills@memtrace --scope user
|
|
165
|
+
|
|
166
|
+
# 3. Register the MCP server
|
|
167
|
+
claude mcp add memtrace -- memtrace mcp -e MEMGRAPH_URL=bolt://localhost:7687
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
<details>
|
|
171
|
+
<summary><strong>What this writes to <code>~/.claude/settings.json</code></strong></summary>
|
|
172
|
+
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"mcpServers": {
|
|
176
|
+
"memtrace": {
|
|
177
|
+
"command": "memtrace",
|
|
178
|
+
"args": ["mcp"],
|
|
179
|
+
"env": { "MEMGRAPH_URL": "bolt://localhost:7687" }
|
|
180
|
+
}
|
|
181
|
+
},
|
|
182
|
+
"enabledPlugins": {
|
|
183
|
+
"memtrace-skills@memtrace": true
|
|
184
|
+
},
|
|
185
|
+
"extraKnownMarketplaces": {
|
|
186
|
+
"memtrace": {
|
|
187
|
+
"source": { "source": "github", "repo": "syncable-dev/memtrace" }
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
</details>
|
|
194
|
+
|
|
195
|
+
### Installing skills separately
|
|
196
|
+
|
|
197
|
+
```bash
|
|
198
|
+
npx memtrace-skills install # install skills + register MCP
|
|
199
|
+
npx memtrace-skills uninstall # remove everything
|
|
200
|
+
```
|
|
201
|
+
|
|
202
|
+
## Claude Desktop Setup
|
|
203
|
+
|
|
204
|
+
Skills are installed to `~/.claude/skills/` which is shared between Claude Code and Claude Desktop — both pick up skills automatically after `npm install -g memtrace`.
|
|
205
|
+
|
|
206
|
+
Add the MCP server to your `claude_desktop_config.json`:
|
|
207
|
+
|
|
208
|
+
```json
|
|
209
|
+
{
|
|
210
|
+
"mcpServers": {
|
|
211
|
+
"memtrace": {
|
|
212
|
+
"command": "memtrace",
|
|
213
|
+
"args": ["mcp"],
|
|
214
|
+
"env": { "MEMGRAPH_URL": "bolt://localhost:7687" }
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
## Supported Languages
|
|
221
|
+
|
|
222
|
+
Rust · Go · TypeScript · JavaScript · Python · Java · C · C++ · C# · Swift · Kotlin · Ruby · PHP · Dart · Scala · Perl — and more via Tree-sitter.
|
|
223
|
+
|
|
224
|
+
## Requirements
|
|
225
|
+
|
|
226
|
+
| Dependency | Purpose |
|
|
227
|
+
|:-----------|:--------|
|
|
228
|
+
| **Memgraph** | Knowledge graph backend — auto-managed via `memtrace start` |
|
|
229
|
+
| **Node.js ≥ 18** | npm installation |
|
|
230
|
+
| **Git** | Temporal analysis (commit history) |
|
|
231
|
+
|
|
232
|
+
## Links
|
|
233
|
+
|
|
234
|
+
- [Documentation](https://memtrace.dev)
|
|
235
|
+
- [npm Package](https://www.npmjs.com/package/memtrace)
|
|
236
|
+
- [Report an Issue](https://github.com/syncable-dev/memtrace/issues)
|
|
237
|
+
|
|
238
|
+
---
|
|
239
|
+
|
|
240
|
+
<p align="center">
|
|
241
|
+
<sub>Built by <a href="https://syncable.dev">Syncable</a> · Licensed under <a href="LICENSE">FSL-1.1-MIT</a></sub>
|
|
242
|
+
</p>
|