@kage-core/kage-graph-mcp 1.1.35 → 1.1.37
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 +157 -135
- package/dist/cli.js +429 -3
- package/dist/daemon.js +314 -7
- package/dist/index.js +329 -3
- package/dist/kernel.js +3255 -64
- package/package.json +1 -1
- package/viewer/app.js +2421 -316
- package/viewer/data.html +296 -0
- package/viewer/graph.html +296 -0
- package/viewer/index.html +170 -165
- package/viewer/intel.html +296 -0
- package/viewer/memory.html +367 -0
- package/viewer/owners.html +296 -0
- package/viewer/review.html +307 -0
- package/viewer/styles.css +1581 -371
package/README.md
CHANGED
|
@@ -1,92 +1,123 @@
|
|
|
1
|
-
# Kage
|
|
1
|
+
# Kage — repo memory for AI coding agents
|
|
2
2
|
|
|
3
|
-
Local-first repo memory, code graph, and recall tools for
|
|
3
|
+
Local-first repo memory, code graph, and recall tools for MCP-capable coding
|
|
4
|
+
agents (Codex, Claude Code, Cursor, etc.).
|
|
4
5
|
|
|
5
6
|
Kage helps agents stop rediscovering the same project context. It stores
|
|
6
7
|
reviewable repo memory, builds generated recall/code indexes, and exposes the
|
|
7
8
|
result through an MCP server plus a CLI.
|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
- Website: https://kage-core.github.io/Kage/
|
|
11
|
+
- Docs: https://kage-core.github.io/Kage/guide.html
|
|
12
|
+
- Hosted viewer: https://kage-core.github.io/Kage/viewer/
|
|
10
13
|
|
|
11
|
-
|
|
12
|
-
npm install -g @kage-core/kage-graph-mcp
|
|
13
|
-
```
|
|
14
|
+
## Install
|
|
14
15
|
|
|
15
|
-
|
|
16
|
+
Requires Node.js 18 or newer. The package installs two binaries: `kage` and
|
|
17
|
+
`kage-graph-mcp`.
|
|
16
18
|
|
|
17
19
|
```bash
|
|
20
|
+
npm install -g @kage-core/kage-graph-mcp
|
|
18
21
|
cd your-repo
|
|
19
|
-
kage setup codex --project . --write
|
|
20
22
|
kage init --project .
|
|
23
|
+
kage setup codex --project . --write
|
|
24
|
+
# or: kage setup claude-code --project . --write
|
|
25
|
+
# restart the agent once
|
|
21
26
|
kage setup verify-agent --agent codex --project .
|
|
27
|
+
kage recall "how do I run tests" --project .
|
|
22
28
|
```
|
|
23
29
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
-
|
|
43
|
-
|
|
44
|
-
- memory-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
-
|
|
51
|
-
|
|
52
|
-
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
-
|
|
30
|
+
Other supported targets: Cursor, Windsurf, Gemini CLI, OpenCode, Cline, Goose,
|
|
31
|
+
Roo Code, Kilo Code, Claude Desktop, Aider, generic MCP (`kage setup list`).
|
|
32
|
+
|
|
33
|
+
## What you get
|
|
34
|
+
|
|
35
|
+
- Repo-local memory for decisions, runbooks, bug fixes, gotchas, conventions,
|
|
36
|
+
and code explanations.
|
|
37
|
+
- Claude Code ambient hooks for prompt-time recall, tool-result observation,
|
|
38
|
+
failure capture, pre-compact/session-end distillation, and stop-time review
|
|
39
|
+
refresh.
|
|
40
|
+
- A code graph for files, symbols, imports, confidence-scored calls, routes
|
|
41
|
+
(FastAPI / Flask / Django / Rails / Laravel / Spring / Go / Rust / ASP.NET),
|
|
42
|
+
tests, and packages.
|
|
43
|
+
- Memory-code links so repo knowledge points at the code it affects.
|
|
44
|
+
- Local git intelligence: risk, reviewers, contributors, co-change warnings,
|
|
45
|
+
ownership silos, module health.
|
|
46
|
+
- Conservative cleanup review input (unreferenced files, unused exports,
|
|
47
|
+
internal-looking unused symbols). Never deletes code.
|
|
48
|
+
- A local viewer for memory, code graph, risks, review, and metrics, served
|
|
49
|
+
with conservative browser security headers.
|
|
50
|
+
- Local memory-access tracking in `.agent_memory/reports/memory-access.json`
|
|
51
|
+
so agents can learn which memories are reused and recommend what to verify,
|
|
52
|
+
ground, or clean up without changing shareable packet files on every recall.
|
|
53
|
+
- Memory lifecycle reporting in `.agent_memory/reports/lifecycle.json` so
|
|
54
|
+
teammates can review healthy, hot, stale, disputed, ungrounded, pending, and
|
|
55
|
+
generated packets with concrete actions.
|
|
56
|
+
- Memory timeline reporting in `.agent_memory/reports/timeline.json` so
|
|
57
|
+
handoffs show recently added, updated, pending, and retired repo knowledge.
|
|
58
|
+
- Memory lineage reporting in `.agent_memory/reports/lineage.json` so
|
|
59
|
+
superseded packets point at the current replacement memory agents should use.
|
|
60
|
+
- Memory audit reporting in `.agent_memory/audit/events.jsonl` and
|
|
61
|
+
`.agent_memory/reports/memory-audit.json` so memory mutations are reviewable.
|
|
62
|
+
- Memory handoff reporting in `.agent_memory/reports/handoff.json` so the next
|
|
63
|
+
teammate or agent gets one queue across inbox, lifecycle, audit, timeline,
|
|
64
|
+
lineage, and distillable session learnings.
|
|
65
|
+
- Project profile reporting in `.agent_memory/reports/profile.json` so agents
|
|
66
|
+
get a compact orientation across repo shape, top concepts, key files,
|
|
67
|
+
commands, memory focus, and next actions.
|
|
68
|
+
- Capability audit reporting in `.agent_memory/reports/capabilities.json` so
|
|
69
|
+
teams can see evidence-backed readiness across memory, collaboration,
|
|
70
|
+
benchmark proof, and dashboard/viewer proof.
|
|
71
|
+
- Pinned context slots in `.agent_memory/slots/slots.json` so teams can review
|
|
72
|
+
tiny always-relevant repo guidance that Kage includes before task-specific
|
|
73
|
+
recall.
|
|
74
|
+
- Session replay digest in `.agent_memory/reports/replay.json` so teams can
|
|
75
|
+
review observed agent timelines, paths, commands, durable candidates, and
|
|
76
|
+
distill actions without exposing raw transcript text.
|
|
77
|
+
- A viewer benchmark proof ledger that shows measured results, thresholds,
|
|
78
|
+
exact commands, and next actions for retrieval, scale, and repo trust gates.
|
|
56
79
|
|
|
57
80
|
No hosted service, external database, or API key is required.
|
|
58
81
|
|
|
59
|
-
## Common
|
|
82
|
+
## Common commands
|
|
60
83
|
|
|
61
84
|
```bash
|
|
62
|
-
kage setup list
|
|
63
|
-
kage init --project .
|
|
64
85
|
kage recall "how do I run tests" --project .
|
|
65
|
-
kage recall "how do I run tests" --project . --json --explain
|
|
66
86
|
kage code-graph "auth routes tests" --project .
|
|
67
|
-
kage cleanup-candidates --project . --json
|
|
68
|
-
kage dependency-path --project . --from src/app.ts --to src/auth.ts --json
|
|
69
|
-
kage module-health --project . --json
|
|
70
|
-
kage graph-insights --project . --json
|
|
71
|
-
kage workspace --project .. --json
|
|
72
|
-
kage workspace recall "auth header contract" --project .. --json
|
|
73
|
-
kage contributors --project . --json
|
|
74
|
-
kage decisions --project . --json
|
|
75
|
-
kage reviewers --project . --changed-files src/auth.ts,src/session.ts --json
|
|
76
87
|
kage risk --project . --targets src/auth.ts --json
|
|
88
|
+
kage profile --project . --json
|
|
89
|
+
kage capabilities --project . --json
|
|
90
|
+
kage slots set --project . --label project_context --content "Always run retry tests after changing retry modules." --paths src/retry.ts --tags retry,tests
|
|
91
|
+
kage slots --project . --json
|
|
77
92
|
kage learn --project . --learning "Use npm test after parser changes."
|
|
93
|
+
kage sessions --project . # observed sessions and distillation actions
|
|
94
|
+
kage replay --project . # privacy-preserving observed-session timeline
|
|
95
|
+
kage memory-access --project . # hot/cold memories and review actions
|
|
96
|
+
kage memory-audit --project . # auditable memory mutations
|
|
97
|
+
kage handoff --project . # combined teammate/agent handoff queue
|
|
98
|
+
kage lifecycle --project . # memory health, freshness, grounding, and feedback
|
|
99
|
+
kage timeline --project . # recent memory changes for handoff
|
|
100
|
+
kage lineage --project . # current replacements for retired memories
|
|
101
|
+
kage supersede --project . --packet <old-id> --replacement <new-id> --reason "why"
|
|
102
|
+
kage benchmark --memory-quality # coding-memory retrieval proof
|
|
103
|
+
kage benchmark --scale --sizes 240,1000,5000 # large-memory recall proof
|
|
78
104
|
kage refresh --project .
|
|
105
|
+
kage embeddings build --project . # optional dense local recall
|
|
79
106
|
kage hook install --project .
|
|
80
107
|
kage pr check --project .
|
|
81
|
-
kage metrics --project . --json
|
|
82
|
-
kage audit --project . --json
|
|
83
|
-
kage inbox --project . --json
|
|
84
108
|
kage viewer --project .
|
|
85
109
|
```
|
|
86
110
|
|
|
87
111
|
MCP agents should start with `kage_context`. When the query or target list
|
|
88
|
-
mentions file paths, it includes risk and dependency-path context
|
|
89
|
-
|
|
112
|
+
mentions file paths, it also includes risk and dependency-path context.
|
|
113
|
+
|
|
114
|
+
Normal recall is local and dependency-free. For repos that need denser semantic
|
|
115
|
+
matching, install `@xenova/transformers` in the same Node environment as Kage,
|
|
116
|
+
then run `kage embeddings build --project .`. The default lexical layer is
|
|
117
|
+
Unicode-aware and adds CJK bigrams for memory written without spaces. Dense
|
|
118
|
+
embeddings write an optional rebuildable
|
|
119
|
+
`.agent_memory/indexes/embeddings-local.json` artifact, and
|
|
120
|
+
`kage recall "query" --project . --embeddings --explain` uses it.
|
|
90
121
|
|
|
91
122
|
For stale or wrong memory:
|
|
92
123
|
|
|
@@ -95,14 +126,9 @@ kage feedback --project . --packet <packet-id> --kind stale
|
|
|
95
126
|
kage gc --project . --dry-run
|
|
96
127
|
```
|
|
97
128
|
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
The package exposes:
|
|
101
|
-
|
|
102
|
-
- `kage-graph-mcp`: stdio MCP server
|
|
103
|
-
- `kage`: CLI
|
|
129
|
+
For the full CLI and MCP reference, see the [docs](https://kage-core.github.io/Kage/guide.html).
|
|
104
130
|
|
|
105
|
-
|
|
131
|
+
## MCP server
|
|
106
132
|
|
|
107
133
|
```bash
|
|
108
134
|
kage setup codex --project . --write
|
|
@@ -110,54 +136,65 @@ kage setup claude-code --project . --write
|
|
|
110
136
|
kage setup generic-mcp --project .
|
|
111
137
|
```
|
|
112
138
|
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
Kage keeps learned memory separate from generated code facts.
|
|
120
|
-
|
|
121
|
-
| Layer | Path | Purpose |
|
|
122
|
-
|---|---|---|
|
|
123
|
-
| Packets | `.agent_memory/packets/` | durable repo memory |
|
|
124
|
-
| Indexes | `.agent_memory/indexes/` | rebuildable recall indexes |
|
|
125
|
-
| Memory graph | `.agent_memory/graph/` | packet relationships and evidence |
|
|
126
|
-
| Structural map | `.agent_memory/structural/` | files, symbols, imports |
|
|
127
|
-
| Code graph | `.agent_memory/code_graph/` | source-derived code facts |
|
|
128
|
-
| Metrics | `.agent_memory/metrics.json` | readiness, quality, coverage |
|
|
129
|
-
| Reports | `.agent_memory/reports/` | risk, contributors, decisions, module health, graph insights, workspace, quality, benchmark |
|
|
130
|
-
|
|
131
|
-
Repo-local packets are git-visible and reviewable. Generated indexes and graphs
|
|
132
|
-
are rebuildable.
|
|
133
|
-
|
|
134
|
-
## Performance Notes
|
|
135
|
-
|
|
136
|
-
Kage is optimized so repeat work scales with changed files, not the whole repo:
|
|
137
|
-
|
|
138
|
-
- read-only recall reuses fresh graph artifacts
|
|
139
|
-
- unchanged structural file facts are reused
|
|
140
|
-
- generated graphs are compact and avoid duplicated structural JSON
|
|
141
|
-
- optional git `post-commit` hooks keep repo memory and branch summaries current
|
|
142
|
-
- generated/vendor/cache paths are ignored
|
|
143
|
-
- huge files are represented safely instead of deeply expanded
|
|
144
|
-
- recall builds lookup maps once per query instead of repeatedly scanning graph
|
|
145
|
-
edges for every memory packet
|
|
146
|
-
- local risk reports include hidden co-change warnings and ownership-silo
|
|
147
|
-
signals from git history
|
|
148
|
-
- contributor reports show commits, recent activity, touched files/modules,
|
|
149
|
-
primary ownership, ownership silos, hotspot ownership, and commit category mix
|
|
150
|
-
- decision reports show why-memory coverage, weak/stale decision packets, and
|
|
151
|
-
high-signal source paths with no linked decision memory
|
|
152
|
-
- graph insights include language parser coverage and edge mix so large-repo
|
|
153
|
-
index gaps are visible instead of hidden
|
|
154
|
-
- the generic non-TypeScript indexer extracts bounded call edges and test
|
|
155
|
-
function coverage, while SCIP/LSP/LSIF/tree-sitter artifacts override it when
|
|
156
|
-
available
|
|
139
|
+
`kage setup claude-code --write` installs the MCP server plus SessionStart,
|
|
140
|
+
UserPromptSubmit, PostToolUse, PostToolUseFailure, PreCompact, Stop, and
|
|
141
|
+
SessionEnd hooks. The hooks observe reusable work signals, inject relevant
|
|
142
|
+
repo memory on new prompts, and distill durable learnings before compaction or
|
|
143
|
+
handoff.
|
|
157
144
|
|
|
158
|
-
|
|
145
|
+
`kage setup verify-agent --agent claude-code --project .` checks those hooks,
|
|
146
|
+
not only the MCP config. If a teammate has the server configured but missing
|
|
147
|
+
ambient hooks, verification reports the missing events and tells them to rerun
|
|
148
|
+
setup.
|
|
149
|
+
|
|
150
|
+
`kage setup doctor --project . --json` also includes the Claude hook summary,
|
|
151
|
+
so teams can audit partial installs before relying on automatic capture.
|
|
152
|
+
MCP agents can call `kage_setup_doctor` for the same audit without shelling out.
|
|
153
|
+
|
|
154
|
+
## REST daemon
|
|
155
|
+
|
|
156
|
+
HTTP-only agents can use the same memory system through the local daemon:
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
kage daemon start --project .
|
|
160
|
+
curl -X POST http://127.0.0.1:3111/kage/context \
|
|
161
|
+
-H 'content-type: application/json' \
|
|
162
|
+
-d '{"query":"how does auth work?","limit":5}'
|
|
163
|
+
```
|
|
159
164
|
|
|
160
|
-
|
|
165
|
+
Useful endpoints:
|
|
166
|
+
|
|
167
|
+
- `POST /kage/context` - combined recall, graph facts, validation, risk, and dependency context.
|
|
168
|
+
- `POST /kage/recall` - repo memory recall.
|
|
169
|
+
- `POST /kage/capture` and `POST /kage/learn` - write durable repo memory.
|
|
170
|
+
- `POST /kage/feedback` - mark recalled memory helpful, wrong, or stale.
|
|
171
|
+
- `POST /kage/observe` and `POST /kage/distill` - session observation and durable learning distillation.
|
|
172
|
+
- `GET /kage/replay` - privacy-preserving session replay digest without raw transcript text.
|
|
173
|
+
- `GET /kage/setup-doctor` - supported-agent setup and Claude hook readiness.
|
|
174
|
+
- `GET /kage/profile` - compact project profile for agent orientation.
|
|
175
|
+
- `GET /kage/capabilities` - evidence-backed memory system readiness across memory, collaboration, benchmarks, and viewer proof.
|
|
176
|
+
- `GET /kage/context-slots`, `POST /kage/context-slots`, `DELETE /kage/context-slots/:label` - pinned repo context slots.
|
|
177
|
+
- `GET /kage/metrics`, `/kage/quality`, `/kage/inbox`, `/kage/benchmark`, `/kage/handoff`, `/kage/lifecycle`, `/kage/timeline`, `/kage/lineage`, `/kage/memory-audit` - human and agent review reports.
|
|
178
|
+
|
|
179
|
+
## Storage
|
|
180
|
+
|
|
181
|
+
Kage writes to `.agent_memory/`. Packets are durable repo memory; everything
|
|
182
|
+
else is rebuildable with `kage refresh`.
|
|
183
|
+
|
|
184
|
+
| Path | Purpose |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `.agent_memory/packets/` | durable repo memory |
|
|
187
|
+
| `.agent_memory/graph/` | memory graph (rebuildable) |
|
|
188
|
+
| `.agent_memory/code_graph/` | source-derived code facts (rebuildable) |
|
|
189
|
+
| `.agent_memory/structural/` | files, symbols, imports |
|
|
190
|
+
| `.agent_memory/slots/` | pinned repo context slots |
|
|
191
|
+
| `.agent_memory/indexes/` | recall indexes, including optional embeddings |
|
|
192
|
+
| `.agent_memory/reports/` | profile, capabilities, context-slots, replay, risk, contributors, decisions, module health, workspace, quality, benchmark, handoff, lifecycle, timeline, lineage |
|
|
193
|
+
|
|
194
|
+
Repo-local packets are git-visible and reviewable. Generated indexes and
|
|
195
|
+
graphs are rebuildable.
|
|
196
|
+
|
|
197
|
+
## Viewer
|
|
161
198
|
|
|
162
199
|
```bash
|
|
163
200
|
kage viewer --project .
|
|
@@ -165,37 +202,22 @@ kage viewer --project .
|
|
|
165
202
|
|
|
166
203
|
The local viewer loads graph artifacts plus `.agent_memory/reports/*.json`.
|
|
167
204
|
It opens with a dashboard for repo readiness, memory coverage, graph health,
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
Hosted demo:
|
|
178
|
-
|
|
179
|
-
```text
|
|
180
|
-
https://kage-core.github.io/Kage/viewer/
|
|
181
|
-
```
|
|
205
|
+
risks, review, and workspace links, then jumps to focused Graph, Memory,
|
|
206
|
+
Risks, and Review pages. Use it when you need to:
|
|
207
|
+
|
|
208
|
+
- Inspect what agents recall and why.
|
|
209
|
+
- Check risk before editing shared files.
|
|
210
|
+
- Find repo lore by file, feature, bug, command, or decision.
|
|
211
|
+
- Clear the review queue before handoff.
|
|
212
|
+
|
|
213
|
+
Hosted demo: https://kage-core.github.io/Kage/viewer/
|
|
182
214
|
|
|
183
215
|
## Development
|
|
184
216
|
|
|
185
217
|
```bash
|
|
186
218
|
npm install
|
|
187
219
|
npm test
|
|
188
|
-
```
|
|
189
|
-
|
|
190
|
-
Build:
|
|
191
|
-
|
|
192
|
-
```bash
|
|
193
220
|
npm run build
|
|
194
|
-
```
|
|
195
|
-
|
|
196
|
-
Package smoke check:
|
|
197
|
-
|
|
198
|
-
```bash
|
|
199
221
|
npm pack --dry-run
|
|
200
222
|
```
|
|
201
223
|
|