ai-mind-map 1.1.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/LICENSE +21 -0
- package/README.md +554 -0
- package/dist/change-tracker/change-log.d.ts +160 -0
- package/dist/change-tracker/change-log.d.ts.map +1 -0
- package/dist/change-tracker/change-log.js +507 -0
- package/dist/change-tracker/change-log.js.map +1 -0
- package/dist/change-tracker/diff-engine.d.ts +149 -0
- package/dist/change-tracker/diff-engine.d.ts.map +1 -0
- package/dist/change-tracker/diff-engine.js +530 -0
- package/dist/change-tracker/diff-engine.js.map +1 -0
- package/dist/change-tracker/watcher.d.ts +137 -0
- package/dist/change-tracker/watcher.d.ts.map +1 -0
- package/dist/change-tracker/watcher.js +300 -0
- package/dist/change-tracker/watcher.js.map +1 -0
- package/dist/cli.d.ts +20 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +937 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +38 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +222 -0
- package/dist/config.js.map +1 -0
- package/dist/context/compressor.d.ts +49 -0
- package/dist/context/compressor.d.ts.map +1 -0
- package/dist/context/compressor.js +769 -0
- package/dist/context/compressor.js.map +1 -0
- package/dist/context/progressive-disclosure.d.ts +71 -0
- package/dist/context/progressive-disclosure.d.ts.map +1 -0
- package/dist/context/progressive-disclosure.js +470 -0
- package/dist/context/progressive-disclosure.js.map +1 -0
- package/dist/context/token-budget.d.ts +121 -0
- package/dist/context/token-budget.d.ts.map +1 -0
- package/dist/context/token-budget.js +282 -0
- package/dist/context/token-budget.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +944 -0
- package/dist/index.js.map +1 -0
- package/dist/install.d.ts +66 -0
- package/dist/install.d.ts.map +1 -0
- package/dist/install.js +946 -0
- package/dist/install.js.map +1 -0
- package/dist/knowledge-graph/architecture.d.ts +213 -0
- package/dist/knowledge-graph/architecture.d.ts.map +1 -0
- package/dist/knowledge-graph/architecture.js +585 -0
- package/dist/knowledge-graph/architecture.js.map +1 -0
- package/dist/knowledge-graph/cypher.d.ts +113 -0
- package/dist/knowledge-graph/cypher.d.ts.map +1 -0
- package/dist/knowledge-graph/cypher.js +1051 -0
- package/dist/knowledge-graph/cypher.js.map +1 -0
- package/dist/knowledge-graph/dead-code.d.ts +121 -0
- package/dist/knowledge-graph/dead-code.d.ts.map +1 -0
- package/dist/knowledge-graph/dead-code.js +331 -0
- package/dist/knowledge-graph/dead-code.js.map +1 -0
- package/dist/knowledge-graph/flow-analyzer.d.ts +167 -0
- package/dist/knowledge-graph/flow-analyzer.d.ts.map +1 -0
- package/dist/knowledge-graph/flow-analyzer.js +739 -0
- package/dist/knowledge-graph/flow-analyzer.js.map +1 -0
- package/dist/knowledge-graph/graph.d.ts +291 -0
- package/dist/knowledge-graph/graph.d.ts.map +1 -0
- package/dist/knowledge-graph/graph.js +978 -0
- package/dist/knowledge-graph/graph.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +17 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +14 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/indexer.d.ts +112 -0
- package/dist/knowledge-graph/indexer.d.ts.map +1 -0
- package/dist/knowledge-graph/indexer.js +506 -0
- package/dist/knowledge-graph/indexer.js.map +1 -0
- package/dist/knowledge-graph/pagerank.d.ts +141 -0
- package/dist/knowledge-graph/pagerank.d.ts.map +1 -0
- package/dist/knowledge-graph/pagerank.js +493 -0
- package/dist/knowledge-graph/pagerank.js.map +1 -0
- package/dist/knowledge-graph/parser.d.ts +55 -0
- package/dist/knowledge-graph/parser.d.ts.map +1 -0
- package/dist/knowledge-graph/parser.js +1090 -0
- package/dist/knowledge-graph/parser.js.map +1 -0
- package/dist/knowledge-graph/snapshot.d.ts +107 -0
- package/dist/knowledge-graph/snapshot.d.ts.map +1 -0
- package/dist/knowledge-graph/snapshot.js +435 -0
- package/dist/knowledge-graph/snapshot.js.map +1 -0
- package/dist/memory/decision-log.d.ts +151 -0
- package/dist/memory/decision-log.d.ts.map +1 -0
- package/dist/memory/decision-log.js +482 -0
- package/dist/memory/decision-log.js.map +1 -0
- package/dist/memory/persistent-memory.d.ts +182 -0
- package/dist/memory/persistent-memory.d.ts.map +1 -0
- package/dist/memory/persistent-memory.js +579 -0
- package/dist/memory/persistent-memory.js.map +1 -0
- package/dist/memory/session-memory.d.ts +165 -0
- package/dist/memory/session-memory.d.ts.map +1 -0
- package/dist/memory/session-memory.js +382 -0
- package/dist/memory/session-memory.js.map +1 -0
- package/dist/stress-test.d.ts +10 -0
- package/dist/stress-test.d.ts.map +1 -0
- package/dist/stress-test.js +258 -0
- package/dist/stress-test.js.map +1 -0
- package/dist/tools/advanced-tools.d.ts +32 -0
- package/dist/tools/advanced-tools.d.ts.map +1 -0
- package/dist/tools/advanced-tools.js +480 -0
- package/dist/tools/advanced-tools.js.map +1 -0
- package/dist/tools/change-tools.d.ts +76 -0
- package/dist/tools/change-tools.d.ts.map +1 -0
- package/dist/tools/change-tools.js +93 -0
- package/dist/tools/change-tools.js.map +1 -0
- package/dist/tools/context-tools.d.ts +68 -0
- package/dist/tools/context-tools.d.ts.map +1 -0
- package/dist/tools/context-tools.js +141 -0
- package/dist/tools/context-tools.js.map +1 -0
- package/dist/tools/debug-tools.d.ts +25 -0
- package/dist/tools/debug-tools.d.ts.map +1 -0
- package/dist/tools/debug-tools.js +286 -0
- package/dist/tools/debug-tools.js.map +1 -0
- package/dist/tools/evolving-tools.d.ts +23 -0
- package/dist/tools/evolving-tools.d.ts.map +1 -0
- package/dist/tools/evolving-tools.js +207 -0
- package/dist/tools/evolving-tools.js.map +1 -0
- package/dist/tools/flow-tools.d.ts +24 -0
- package/dist/tools/flow-tools.d.ts.map +1 -0
- package/dist/tools/flow-tools.js +265 -0
- package/dist/tools/flow-tools.js.map +1 -0
- package/dist/tools/graph-tools.d.ts +71 -0
- package/dist/tools/graph-tools.d.ts.map +1 -0
- package/dist/tools/graph-tools.js +165 -0
- package/dist/tools/graph-tools.js.map +1 -0
- package/dist/tools/memory-tools.d.ts +62 -0
- package/dist/tools/memory-tools.d.ts.map +1 -0
- package/dist/tools/memory-tools.js +195 -0
- package/dist/tools/memory-tools.js.map +1 -0
- package/dist/tools/smart-tools.d.ts +23 -0
- package/dist/tools/smart-tools.d.ts.map +1 -0
- package/dist/tools/smart-tools.js +482 -0
- package/dist/tools/smart-tools.js.map +1 -0
- package/dist/tools/snapshot-tools.d.ts +19 -0
- package/dist/tools/snapshot-tools.d.ts.map +1 -0
- package/dist/tools/snapshot-tools.js +149 -0
- package/dist/tools/snapshot-tools.js.map +1 -0
- package/dist/types.d.ts +181 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +45 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/logger.d.ts +59 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +142 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/token-counter.d.ts +51 -0
- package/dist/utils/token-counter.d.ts.map +1 -0
- package/dist/utils/token-counter.js +181 -0
- package/dist/utils/token-counter.js.map +1 -0
- package/install.ps1 +321 -0
- package/install.sh +345 -0
- package/package.json +94 -0
- package/setup.bat +62 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 shdra06
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,554 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<h1 align="center">🧠 AI Mind Map</h1>
|
|
3
|
+
<p align="center">
|
|
4
|
+
<strong>MCP Server that reduces AI coding agent token usage by 80-99%</strong>
|
|
5
|
+
</p>
|
|
6
|
+
<p align="center">
|
|
7
|
+
<a href="https://github.com/shdra06/ai-mind-map/actions/workflows/ci.yml"><img src="https://github.com/shdra06/ai-mind-map/actions/workflows/ci.yml/badge.svg" alt="CI"></a>
|
|
8
|
+
<a href="https://github.com/shdra06/ai-mind-map/releases"><img src="https://img.shields.io/github/v/release/shdra06/ai-mind-map?label=release" alt="Release"></a>
|
|
9
|
+
<a href="LICENSE"><img src="https://img.shields.io/github/license/shdra06/ai-mind-map" alt="License"></a>
|
|
10
|
+
<a href="https://www.npmjs.com/package/ai-mind-map"><img src="https://img.shields.io/npm/v/ai-mind-map" alt="npm"></a>
|
|
11
|
+
</p>
|
|
12
|
+
<p align="center">
|
|
13
|
+
Stop wasting tokens re-reading your codebase. Give your AI agent a persistent memory.
|
|
14
|
+
</p>
|
|
15
|
+
<p align="center">
|
|
16
|
+
<a href="#-quick-start-windows">Quick Start</a> •
|
|
17
|
+
<a href="#-how-it-works">How It Works</a> •
|
|
18
|
+
<a href="#-41-mcp-tools">All 41 Tools</a> •
|
|
19
|
+
<a href="#-connect-to-your-ai-agent">Connect</a> •
|
|
20
|
+
<a href="#-configuration">Config</a>
|
|
21
|
+
</p>
|
|
22
|
+
</p>
|
|
23
|
+
|
|
24
|
+
---
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
## ❓ The Problem
|
|
28
|
+
|
|
29
|
+
Every time an AI coding agent (Claude Code, Cursor, Copilot, Windsurf, Antigravity) processes a request, it **re-reads your entire codebase from scratch**. This wastes massive amounts of tokens:
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
Without AI Mind Map:
|
|
33
|
+
❌ Agent reads auth.ts → 5,000 tokens
|
|
34
|
+
❌ Agent reads auth.ts AGAIN → 5,000 tokens (same file!)
|
|
35
|
+
❌ Agent reads auth.ts AGAIN → 5,000 tokens (still the same file!)
|
|
36
|
+
Total: 15,000 tokens for 3 questions about ONE file
|
|
37
|
+
|
|
38
|
+
With AI Mind Map:
|
|
39
|
+
✅ mindmap_get_signature("authenticate") → 50 tokens
|
|
40
|
+
✅ mindmap_get_signature("validateToken") → 40 tokens
|
|
41
|
+
✅ mindmap_trace_dependencies("authenticate") → 100 tokens
|
|
42
|
+
Total: 190 tokens — that's a 99% reduction
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
> **Industry research shows ~42% of all tokens consumed by AI coding agents are avoidable waste** — repeated file reads, re-discovering architecture, re-debating settled decisions.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## ✨ What AI Mind Map Does
|
|
50
|
+
|
|
51
|
+
AI Mind Map is an **MCP (Model Context Protocol) server** that gives your AI agent:
|
|
52
|
+
|
|
53
|
+
| Feature | What It Does | Token Savings |
|
|
54
|
+
|---------|-------------|---------------|
|
|
55
|
+
| 🗺️ **Knowledge Graph** | Parses your entire codebase into a queryable graph of functions, classes, and relationships | **99%** |
|
|
56
|
+
| 📝 **Change Tracker** | Knows exactly what changed since the AI's last session | **80%** |
|
|
57
|
+
| 🧠 **Persistent Memory** | Remembers architecture decisions, conventions, and context across sessions | **90%** |
|
|
58
|
+
| 🗜️ **Smart Compression** | Compresses build logs, test output, stack traces intelligently | **50-98%** |
|
|
59
|
+
| 📊 **Progressive Loading** | Loads only what's needed — signatures first, full code only when asked | **90%** |
|
|
60
|
+
| ⚡ **Real-time Sync** | File watcher keeps the graph updated as you code | Always fresh |
|
|
61
|
+
|
|
62
|
+
### Inspired By The Best
|
|
63
|
+
|
|
64
|
+
This project combines proven techniques from:
|
|
65
|
+
|
|
66
|
+
| Source | Technique | Their Result |
|
|
67
|
+
|--------|-----------|-------------|
|
|
68
|
+
| [codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp) | Knowledge Graph + SQLite | 99% reduction (120x fewer tokens) |
|
|
69
|
+
| [Aider](https://github.com/Aider-AI/aider) | PageRank-based Repo Map | 90%+ reduction |
|
|
70
|
+
| [Mem0](https://github.com/mem0ai/mem0) | Persistent Memory with Decay | 3-4x cost reduction |
|
|
71
|
+
| [context-mode](https://github.com/mksglu/context-mode) | Context Sandboxing + BM25 | 98% context reduction |
|
|
72
|
+
| [context-mem](https://github.com/context-mem/context-mem) | Progressive Disclosure | 90%+ savings |
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## 🚀 Quick Start
|
|
77
|
+
|
|
78
|
+
### Method 1: npx (Fastest — Zero Install)
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
# Run directly without installing anything
|
|
82
|
+
npx ai-mind-map install
|
|
83
|
+
|
|
84
|
+
# That's it. It auto-detects Claude, Cursor, VS Code, Windsurf, Antigravity, Zed, Continue.dev
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
### Method 2: Global Install
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npm install -g ai-mind-map
|
|
91
|
+
|
|
92
|
+
# Auto-detect and configure all your AI agents
|
|
93
|
+
ai-mind-map install
|
|
94
|
+
|
|
95
|
+
# Check everything is working
|
|
96
|
+
ai-mind-map doctor
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
### Method 3: Clone (For Development)
|
|
100
|
+
|
|
101
|
+
```bash
|
|
102
|
+
git clone https://github.com/shdra06/ai-mind-map.git
|
|
103
|
+
cd ai-mind-map
|
|
104
|
+
npm install --legacy-peer-deps
|
|
105
|
+
npm run build
|
|
106
|
+
node dist/cli.js install
|
|
107
|
+
```
|
|
108
|
+
|
|
109
|
+
### What `install` Does
|
|
110
|
+
|
|
111
|
+
1. ✅ Scans your system for AI coding agents (Claude, Cursor, VS Code, Windsurf, Antigravity, Zed, Continue.dev)
|
|
112
|
+
2. ✅ Writes MCP config to each agent's config file
|
|
113
|
+
3. ✅ Deploys rules files so agents know about our 41 tools
|
|
114
|
+
4. ✅ Runs diagnostics to verify everything works
|
|
115
|
+
|
|
116
|
+
### Verify It Works
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
ai-mind-map doctor
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
Output:
|
|
123
|
+
```
|
|
124
|
+
🩺 AI Mind Map — Diagnostics
|
|
125
|
+
────────────────────────────────────────────────────────
|
|
126
|
+
✔ Node.js v24.x (>= 18 required)
|
|
127
|
+
✔ SQLite In-memory test passed
|
|
128
|
+
✔ TypeScript Build dist/index.js exists
|
|
129
|
+
✔ Agents 3 detected, 3 configured
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## 🔌 Connect To Your AI Agent
|
|
135
|
+
|
|
136
|
+
### Claude Code
|
|
137
|
+
|
|
138
|
+
Add to your Claude Code MCP settings file (`~/.claude/claude_desktop_config.json`):
|
|
139
|
+
|
|
140
|
+
```json
|
|
141
|
+
{
|
|
142
|
+
"mcpServers": {
|
|
143
|
+
"ai-mind-map": {
|
|
144
|
+
"command": "node",
|
|
145
|
+
"args": [
|
|
146
|
+
"C:\\Users\\YOUR_USERNAME\\ai-mind-map\\dist\\index.js",
|
|
147
|
+
"--project-root",
|
|
148
|
+
"C:\\Users\\YOUR_USERNAME\\your-project"
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
> **💡 Tip:** Replace `YOUR_USERNAME` with your Windows username, and point `--project-root` to the project you want indexed.
|
|
156
|
+
|
|
157
|
+
### Cursor
|
|
158
|
+
|
|
159
|
+
Add to `.cursor/mcp.json` in your project root:
|
|
160
|
+
|
|
161
|
+
```json
|
|
162
|
+
{
|
|
163
|
+
"mcpServers": {
|
|
164
|
+
"ai-mind-map": {
|
|
165
|
+
"command": "node",
|
|
166
|
+
"args": [
|
|
167
|
+
"C:\\Users\\YOUR_USERNAME\\ai-mind-map\\dist\\index.js",
|
|
168
|
+
"--project-root",
|
|
169
|
+
"."
|
|
170
|
+
]
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
### Windsurf / Codeium
|
|
177
|
+
|
|
178
|
+
Add to your MCP configuration:
|
|
179
|
+
|
|
180
|
+
```json
|
|
181
|
+
{
|
|
182
|
+
"mcpServers": {
|
|
183
|
+
"ai-mind-map": {
|
|
184
|
+
"command": "node",
|
|
185
|
+
"args": [
|
|
186
|
+
"C:\\Users\\YOUR_USERNAME\\ai-mind-map\\dist\\index.js",
|
|
187
|
+
"--project-root",
|
|
188
|
+
"C:\\path\\to\\project"
|
|
189
|
+
],
|
|
190
|
+
"transportType": "stdio"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
### VS Code (Copilot / Continue.dev)
|
|
197
|
+
|
|
198
|
+
For any VS Code extension that supports MCP, add to your settings:
|
|
199
|
+
|
|
200
|
+
```json
|
|
201
|
+
{
|
|
202
|
+
"mcp.servers": {
|
|
203
|
+
"ai-mind-map": {
|
|
204
|
+
"command": "node",
|
|
205
|
+
"args": [
|
|
206
|
+
"C:\\Users\\YOUR_USERNAME\\ai-mind-map\\dist\\index.js",
|
|
207
|
+
"--project-root",
|
|
208
|
+
"${workspaceFolder}"
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Antigravity (Gemini)
|
|
216
|
+
|
|
217
|
+
Add to your Antigravity MCP config:
|
|
218
|
+
|
|
219
|
+
```json
|
|
220
|
+
{
|
|
221
|
+
"mcpServers": {
|
|
222
|
+
"ai-mind-map": {
|
|
223
|
+
"command": "node",
|
|
224
|
+
"args": [
|
|
225
|
+
"C:\\Users\\YOUR_USERNAME\\ai-mind-map\\dist\\index.js",
|
|
226
|
+
"--project-root",
|
|
227
|
+
"C:\\path\\to\\project"
|
|
228
|
+
]
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### Any MCP-Compatible Agent
|
|
235
|
+
|
|
236
|
+
AI Mind Map works with **any tool that supports the Model Context Protocol**. Just configure:
|
|
237
|
+
- **Command:** `node`
|
|
238
|
+
- **Args:** `["path/to/ai-mind-map/dist/index.js", "--project-root", "path/to/your/project"]`
|
|
239
|
+
- **Transport:** `stdio`
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## 🔧 41 MCP Tools
|
|
244
|
+
|
|
245
|
+
Once connected, your AI agent gets these powerful tools:
|
|
246
|
+
|
|
247
|
+
### 🗺️ Knowledge Graph (6)
|
|
248
|
+
|
|
249
|
+
| Tool | What It Does |
|
|
250
|
+
|------|-------------|
|
|
251
|
+
| `mindmap_search` | Search codebase by function/class name or free text |
|
|
252
|
+
| `mindmap_get_structure` | Project architecture overview in ~100 tokens |
|
|
253
|
+
| `mindmap_trace_dependencies` | Trace call chains — who calls what |
|
|
254
|
+
| `mindmap_get_signature` | Function signature without reading the file |
|
|
255
|
+
| `mindmap_find_references` | Find everywhere a symbol is used |
|
|
256
|
+
| `mindmap_get_file_map` | All symbols in a file with line ranges |
|
|
257
|
+
|
|
258
|
+
### 📝 Change Tracking (3)
|
|
259
|
+
|
|
260
|
+
| Tool | What It Does |
|
|
261
|
+
|------|-------------|
|
|
262
|
+
| `mindmap_what_changed` | Summary of recent code changes |
|
|
263
|
+
| `mindmap_session_diff` | What changed since last AI session |
|
|
264
|
+
| `mindmap_impact_analysis` | Blast radius of a change |
|
|
265
|
+
|
|
266
|
+
### 🧠 Memory (5)
|
|
267
|
+
|
|
268
|
+
| Tool | What It Does |
|
|
269
|
+
|------|-------------|
|
|
270
|
+
| `mindmap_recall` | Retrieve relevant memories |
|
|
271
|
+
| `mindmap_remember` | Store a fact or convention |
|
|
272
|
+
| `mindmap_get_decisions` | Past architectural decisions |
|
|
273
|
+
| `mindmap_decide` | Record a new decision |
|
|
274
|
+
| `mindmap_session_summary` | Previous session summaries |
|
|
275
|
+
|
|
276
|
+
### 🗜️ Context (4)
|
|
277
|
+
|
|
278
|
+
| Tool | What It Does |
|
|
279
|
+
|------|-------------|
|
|
280
|
+
| `mindmap_get_context` | Smart context for current task |
|
|
281
|
+
| `mindmap_compress` | Compress logs, traces, output |
|
|
282
|
+
| `mindmap_reindex` | Force full re-index |
|
|
283
|
+
| `mindmap_status` | Index stats and token savings |
|
|
284
|
+
|
|
285
|
+
### 🔬 Advanced Analysis (7)
|
|
286
|
+
|
|
287
|
+
| Tool | What It Does |
|
|
288
|
+
|------|-------------|
|
|
289
|
+
| `mindmap_query_graph` | Cypher-like graph queries |
|
|
290
|
+
| `mindmap_dead_code` | Detect unused functions |
|
|
291
|
+
| `mindmap_architecture` | Full architecture overview |
|
|
292
|
+
| `mindmap_get_code_snippet` | Read source by symbol name |
|
|
293
|
+
| `mindmap_search_code` | Grep-like text search |
|
|
294
|
+
| `mindmap_list_projects` | List indexed projects |
|
|
295
|
+
| `mindmap_health` | System diagnostics |
|
|
296
|
+
|
|
297
|
+
### 🔍 Debug (3)
|
|
298
|
+
|
|
299
|
+
| Tool | What It Does |
|
|
300
|
+
|------|-------------|
|
|
301
|
+
| `mindmap_debug_changes` | Detailed change analysis |
|
|
302
|
+
| `mindmap_file_before` | File content before changes |
|
|
303
|
+
| `mindmap_file_history` | Full file change history |
|
|
304
|
+
|
|
305
|
+
### 🏗️ Flow Analysis (4)
|
|
306
|
+
|
|
307
|
+
| Tool | What It Does |
|
|
308
|
+
|------|-------------|
|
|
309
|
+
| `mindmap_trace_flow` | Trace behavioral flows through layers |
|
|
310
|
+
| `mindmap_interaction_map` | Full interaction map of the codebase |
|
|
311
|
+
| `mindmap_classify_file` | Classify a file's architectural layer |
|
|
312
|
+
| `mindmap_layer_overview` | Layer distribution overview |
|
|
313
|
+
|
|
314
|
+
### 📸 Snapshot (3)
|
|
315
|
+
|
|
316
|
+
| Tool | What It Does |
|
|
317
|
+
|------|-------------|
|
|
318
|
+
| `mindmap_project_map` | Compact project map for context |
|
|
319
|
+
| `mindmap_change_delta` | What changed since last snapshot |
|
|
320
|
+
| `mindmap_session_start` | Start a new tracking session |
|
|
321
|
+
|
|
322
|
+
### ⭐ Smart Tools (3) — **99% Token Savings**
|
|
323
|
+
|
|
324
|
+
| Tool | What It Does |
|
|
325
|
+
|------|-------------|
|
|
326
|
+
| `mindmap_explain` | **Everything about a symbol in 1 call** — signature, callers, callees, layer, blast radius, git history |
|
|
327
|
+
| `mindmap_git_changes` | **Git-aware symbol-level diffs** — which functions changed, who's impacted |
|
|
328
|
+
| `mindmap_smart_search` | **Rich search** — returns full context so AI never reads files |
|
|
329
|
+
|
|
330
|
+
### 🧬 Self-Evolving (3)
|
|
331
|
+
|
|
332
|
+
| Tool | What It Does |
|
|
333
|
+
|------|-------------|
|
|
334
|
+
| `mindmap_teach` | **AI teaches new patterns** — classification rules, search aliases, conventions that persist per-project |
|
|
335
|
+
| `mindmap_get_learned` | View all rules the system has learned |
|
|
336
|
+
| `mindmap_forget` | Remove a learned rule |
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## 💻 CLI Mode
|
|
341
|
+
|
|
342
|
+
Every MCP tool is also available from the command line. No agent required:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
# Index a project
|
|
346
|
+
ai-mind-map index /path/to/project
|
|
347
|
+
|
|
348
|
+
# Search the graph
|
|
349
|
+
ai-mind-map search "authenticate" --type function
|
|
350
|
+
|
|
351
|
+
# Trace call chains
|
|
352
|
+
ai-mind-map trace "processOrder" --direction both --depth 3
|
|
353
|
+
|
|
354
|
+
# Show project structure
|
|
355
|
+
ai-mind-map structure
|
|
356
|
+
|
|
357
|
+
# Recall memories
|
|
358
|
+
ai-mind-map recall "authentication"
|
|
359
|
+
|
|
360
|
+
# Store a convention
|
|
361
|
+
ai-mind-map remember "We use camelCase for all function names" --category convention
|
|
362
|
+
|
|
363
|
+
# Show what changed
|
|
364
|
+
ai-mind-map changes --since last_session
|
|
365
|
+
|
|
366
|
+
# Auto-configure all AI agents
|
|
367
|
+
ai-mind-map install
|
|
368
|
+
|
|
369
|
+
# Diagnostics
|
|
370
|
+
ai-mind-map doctor
|
|
371
|
+
|
|
372
|
+
# Show config
|
|
373
|
+
ai-mind-map config list
|
|
374
|
+
```
|
|
375
|
+
|
|
376
|
+
---
|
|
377
|
+
|
|
378
|
+
## ⚙️ Configuration
|
|
379
|
+
|
|
380
|
+
### Project-Level Config (Optional)
|
|
381
|
+
|
|
382
|
+
Create a `.mindmap.json` file in your project root to customize behavior:
|
|
383
|
+
|
|
384
|
+
```json
|
|
385
|
+
{
|
|
386
|
+
"languages": ["typescript", "python", "javascript"],
|
|
387
|
+
"ignore": ["node_modules", "dist", "*.test.*", "coverage"],
|
|
388
|
+
"tokenBudgets": {
|
|
389
|
+
"graphResults": 2000,
|
|
390
|
+
"changeSummary": 1000,
|
|
391
|
+
"memoryRetrieval": 1500,
|
|
392
|
+
"fileContent": 3000,
|
|
393
|
+
"totalContext": 10000
|
|
394
|
+
},
|
|
395
|
+
"memory": {
|
|
396
|
+
"maxMemories": 500,
|
|
397
|
+
"decayRate": 0.95,
|
|
398
|
+
"importanceThreshold": 0.1,
|
|
399
|
+
"maxDecisions": 200
|
|
400
|
+
},
|
|
401
|
+
"compression": "moderate",
|
|
402
|
+
"watchEnabled": true
|
|
403
|
+
}
|
|
404
|
+
```
|
|
405
|
+
|
|
406
|
+
### CLI Options
|
|
407
|
+
|
|
408
|
+
```
|
|
409
|
+
node dist/index.js [options]
|
|
410
|
+
|
|
411
|
+
Options:
|
|
412
|
+
--project-root <path> Root of the project to index (default: auto-detect from git)
|
|
413
|
+
--db-path <path> SQLite database location (default: .mindmap/mindmap.db)
|
|
414
|
+
--log-level <level> debug | info | warn | error (default: info)
|
|
415
|
+
```
|
|
416
|
+
|
|
417
|
+
---
|
|
418
|
+
|
|
419
|
+
## 🌐 Language Support
|
|
420
|
+
|
|
421
|
+
Tree-sitter AST parsing with automatic regex fallback:
|
|
422
|
+
|
|
423
|
+
| Language | AST Parsing | Regex Fallback | Extracts |
|
|
424
|
+
|----------|:-----------:|:--------------:|----------|
|
|
425
|
+
| JavaScript | ✅ | ✅ | Functions, classes, imports, exports |
|
|
426
|
+
| TypeScript | ✅ | ✅ | + Interfaces, types, enums, decorators |
|
|
427
|
+
| Python | ✅ | ✅ | Functions, classes, decorators, docstrings |
|
|
428
|
+
| Java | ✅ | ✅ | Classes, methods, interfaces, annotations |
|
|
429
|
+
| Go | ✅ | ✅ | Functions, structs, interfaces, methods |
|
|
430
|
+
| Rust | ✅ | ✅ | Functions, structs, traits, impls, enums |
|
|
431
|
+
| C/C++ | ✅ | ✅ | Functions, classes, structs, macros |
|
|
432
|
+
| C# | ✅ | ✅ | Classes, methods, interfaces, properties |
|
|
433
|
+
| Ruby | ✅ | ✅ | Classes, modules, methods, blocks |
|
|
434
|
+
| PHP | ✅ | ✅ | Classes, functions, traits, namespaces |
|
|
435
|
+
| Bash | ✅ | ✅ | Functions, variables, aliases |
|
|
436
|
+
| CSS/HTML | ✅ | ✅ | Selectors, classes, IDs |
|
|
437
|
+
|
|
438
|
+
---
|
|
439
|
+
|
|
440
|
+
## 🏗️ Architecture
|
|
441
|
+
|
|
442
|
+
```
|
|
443
|
+
┌─────────────────────────────────────────────────────┐
|
|
444
|
+
│ AI Mind Map MCP Server │
|
|
445
|
+
│ │
|
|
446
|
+
│ ┌─────────────────┐ ┌────────────────┐ ┌────────┐ │
|
|
447
|
+
│ │ Knowledge Graph │ │ Change Tracker │ │ Memory │ │
|
|
448
|
+
│ │ ─────────────── │ │ ────────────── │ │ ────── │ │
|
|
449
|
+
│ │ Tree-sitter AST │ │ Chokidar Watch │ │ Mem0 │ │
|
|
450
|
+
│ │ SQLite + FTS5 │ │ Git Diff │ │ Style │ │
|
|
451
|
+
│ │ PageRank │ │ BM25 Search │ │ Decay │ │
|
|
452
|
+
│ └────────┬────────┘ └───────┬────────┘ └───┬────┘ │
|
|
453
|
+
│ │ │ │ │
|
|
454
|
+
│ ┌────────┴───────────────────┴────────────────┴────┐ │
|
|
455
|
+
│ │ Context Engine │ │
|
|
456
|
+
│ │ Content-Aware Compression (9 types) │ │
|
|
457
|
+
│ │ Progressive Disclosure (3 tiers) │ │
|
|
458
|
+
│ │ Token Budget Manager │ │
|
|
459
|
+
│ └──────────────────────┬────────────────────────────┘ │
|
|
460
|
+
│ │ │
|
|
461
|
+
│ 41 MCP Tools │
|
|
462
|
+
└─────────────────────────┼───────────────────────────────┘
|
|
463
|
+
│ stdio
|
|
464
|
+
┌─────────┴──────────┐
|
|
465
|
+
│ Your AI Agent │
|
|
466
|
+
│ Claude / Cursor / │
|
|
467
|
+
│ Copilot / Windsurf │
|
|
468
|
+
└────────────────────┘
|
|
469
|
+
```
|
|
470
|
+
|
|
471
|
+
### How the Memory System Works
|
|
472
|
+
|
|
473
|
+
AI Mind Map uses a **three-tier memory architecture** (inspired by cognitive science):
|
|
474
|
+
|
|
475
|
+
| Layer | What | Token Cost | Lifespan |
|
|
476
|
+
|-------|------|-----------|----------|
|
|
477
|
+
| **Working Memory** | Current task context | Full price | This conversation |
|
|
478
|
+
| **Episodic Memory** | Session summaries, recent decisions | On-demand retrieval | Days to weeks |
|
|
479
|
+
| **Semantic Memory** | Codebase graph, architecture, conventions | Queried, never dumped | Permanent (with decay) |
|
|
480
|
+
|
|
481
|
+
Memories have **importance scores** that:
|
|
482
|
+
- 📈 **Increase** when accessed (+0.1 per access, capped at 1.0)
|
|
483
|
+
- 📉 **Decay** over time (configurable, default 5% per day)
|
|
484
|
+
- 🗑️ **Get pruned** when importance drops below threshold
|
|
485
|
+
|
|
486
|
+
This means frequently-useful memories stick around, while stale ones naturally fade.
|
|
487
|
+
|
|
488
|
+
---
|
|
489
|
+
|
|
490
|
+
## 📊 Expected Token Savings
|
|
491
|
+
|
|
492
|
+
| Scenario | Without Mind Map | With Mind Map | Savings |
|
|
493
|
+
|----------|:----------------:|:-------------:|:-------:|
|
|
494
|
+
| Find a function signature | ~5,000 tokens | ~50 tokens | **99%** |
|
|
495
|
+
| Understand project structure | ~50,000 tokens | ~500 tokens | **99%** |
|
|
496
|
+
| Resume after session break | ~20,000 tokens | ~2,000 tokens | **90%** |
|
|
497
|
+
| Trace dependency chain | ~30,000 tokens | ~200 tokens | **99%** |
|
|
498
|
+
| Check what changed | ~10,000 tokens | ~500 tokens | **95%** |
|
|
499
|
+
| Compress build log | ~8,000 tokens | ~400 tokens | **95%** |
|
|
500
|
+
|
|
501
|
+
---
|
|
502
|
+
|
|
503
|
+
## 🤝 Contributing
|
|
504
|
+
|
|
505
|
+
Contributions are welcome! Here's how:
|
|
506
|
+
|
|
507
|
+
1. Fork the repo
|
|
508
|
+
2. Create a feature branch: `git checkout -b feature/amazing-feature`
|
|
509
|
+
3. Make your changes
|
|
510
|
+
4. Run the build: `npm run build`
|
|
511
|
+
5. Commit: `git commit -m "Add amazing feature"`
|
|
512
|
+
6. Push: `git push origin feature/amazing-feature`
|
|
513
|
+
7. Open a Pull Request
|
|
514
|
+
|
|
515
|
+
### Development
|
|
516
|
+
|
|
517
|
+
```powershell
|
|
518
|
+
# Watch mode (auto-recompile on changes)
|
|
519
|
+
npm run dev
|
|
520
|
+
|
|
521
|
+
# Type check without building
|
|
522
|
+
npx tsc --noEmit
|
|
523
|
+
|
|
524
|
+
# Run the server locally
|
|
525
|
+
node dist/index.js --project-root . --log-level debug
|
|
526
|
+
```
|
|
527
|
+
|
|
528
|
+
---
|
|
529
|
+
|
|
530
|
+
## 📄 License
|
|
531
|
+
|
|
532
|
+
MIT — use it however you want. See [LICENSE](LICENSE).
|
|
533
|
+
|
|
534
|
+
---
|
|
535
|
+
|
|
536
|
+
## 🙏 Acknowledgments
|
|
537
|
+
|
|
538
|
+
Built on the shoulders of giants:
|
|
539
|
+
|
|
540
|
+
- [codebase-memory-mcp](https://github.com/DeusData/codebase-memory-mcp) — Knowledge graph architecture (99% token reduction)
|
|
541
|
+
- [Aider](https://github.com/Aider-AI/aider) — Repository map with PageRank ranking
|
|
542
|
+
- [Mem0](https://github.com/mem0ai/mem0) — Persistent memory with importance decay
|
|
543
|
+
- [context-mode](https://github.com/mksglu/context-mode) — Context sandboxing with BM25
|
|
544
|
+
- [context-mem](https://github.com/context-mem/context-mem) — Progressive disclosure patterns
|
|
545
|
+
- [CocoIndex](https://github.com/cocoindex-io/cocoindex-code) — Incremental AST indexing
|
|
546
|
+
- [Repomix](https://github.com/yamadashy/repomix) — Codebase compression techniques
|
|
547
|
+
- [Tree-sitter](https://tree-sitter.github.io/tree-sitter/) — Multi-language AST parsing
|
|
548
|
+
- [MCP Protocol](https://modelcontextprotocol.io) — The standard that makes this possible
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
<p align="center">
|
|
553
|
+
<strong>⭐ Star this repo if it saves you tokens!</strong>
|
|
554
|
+
</p>
|