@kage-core/kage-graph-mcp 1.1.21 → 1.1.23

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 CHANGED
@@ -1,501 +1,153 @@
1
1
  # Kage Repo-Recall MCP
2
2
 
3
- This package exposes two surfaces:
4
-
5
- - `kage-graph-mcp`: MCP server for the public Kage graph plus repo-local recall.
6
- - `kage`: CLI for local repo memory packets, indexing, recall, capture, review,
7
- setup, optional daemon runtime, org/global artifact mode, marketplace packs,
8
- and validation.
9
-
10
- ## Latest Release
11
-
12
- `1.1.21` publishes the memory-code graph quality pass:
13
-
14
- - precise memory-code links now require explicit, non-generic symbol/test
15
- mentions instead of broad path-only matches.
16
- - generated memory symbol/route/test entities no longer carry file path aliases
17
- that can collapse stale graph nodes onto code file hubs.
18
- - the viewer's `Memory <-> Code only` relation shows actual cross-graph links,
19
- while path-level memory still appears through capped `affects_code_path`
20
- bridge edges.
21
-
22
- `1.1.20` published the large-repo indexing pass:
23
-
24
- - repeated `kage refresh` calls reuse unchanged code graph artifacts by source
25
- stat fingerprint, with `kage refresh --full` available for intentional clean
26
- rebuilds.
27
- - `kage code-index` prefers SCIP via `scip-typescript` plus the `scip` CLI when
28
- those tools are installed, then falls back to Kage's built-in LSP-compatible
29
- symbol index.
30
- - read-only commands and MCP sessions reuse current graph artifacts instead of
31
- rebuilding them when inputs are fresh.
32
-
33
- `1.1.17` publishes content-based graph freshness:
34
-
35
- - `kage pr check` now uses graph input hashes, so push-only operations and
36
- empty/same-tree commits do not force another refresh while real source,
37
- approved-memory, or code-index changes still stale generated graph artifacts.
38
-
39
- `1.1.16` fixes the guarded release helper's npm verification step:
40
-
41
- - exact-version `npm view` checks now retry with backoff after publish so npm
42
- registry propagation does not make a successful publish look failed.
43
- - the release helper is maintainer-only repo tooling: public package metadata no
44
- longer exposes npm release scripts, and `dist/release.js` is excluded from the
45
- published tarball.
46
-
47
- `1.1.15` hardened the npm release path and memory-only review flow:
48
-
49
- - the source-repo maintainer helper can run the guarded release checks without
50
- publishing, or push/publish/smoke-test when explicitly invoked from a built
51
- checkout.
52
- - it requires a clean worktree, fetches the remote branch, verifies local `HEAD`
53
- contains `origin/<branch>`, runs tests and `npm pack --dry-run`, pushes the
54
- branch before publishing, publishes with `--access public`, verifies npm
55
- registry metadata, and performs a smoke install.
56
- - all git steps run with `GIT_EDITOR=true` so agent sessions cannot get stuck in
57
- an interactive commit or rebase editor.
58
- - `kage propose --from-diff` now includes repo memory packet-only changes from
59
- `.agent_memory/packets/*.json` and `.agent_memory/pending/*.json`.
60
-
61
- `1.1.14` publishes the memory/code graph trust and retrieval pass:
62
-
63
- - recall now uses vectorless BM25 lexical ranking with graph, path/type/tag,
64
- intent, freshness, quality, and feedback boosts.
65
- - `kage audit`, `kage inbox`, `kage code-index`, and `kage graph-registry`
66
- are documented as first-class CLI and MCP surfaces.
67
- - the viewer coalesces memory graph code entities with code graph nodes and
68
- highlights memory-code links.
69
- - README and the website now report the current 79-test proof state and BM25
70
- retrieval behavior.
71
-
72
- `1.1.13` switches future Kage releases to GPL-3.0-only:
73
-
74
- - package metadata now advertises `GPL-3.0-only`.
75
- - the repo includes the official GPLv3 `LICENSE` text.
76
- - README clarifies that pre-switch releases were MIT, while future releases are
77
- GPL-3.0-only unless a separate written commercial license says otherwise.
78
-
79
- `1.1.12` published the launch-ready docs pass:
80
-
81
- - npm README now includes this explicit release note.
82
- - Root README leads with the animated Kage demo GIF.
83
- - README links clearly to the website and live viewer.
84
- - Hosted viewer publishes Kage repo graph, code graph, metrics, and inbox from
85
- GitHub Pages while local repos still use `kage viewer --project .`.
86
-
87
- ## Build
3
+ Local-first repo memory, code graph, and recall tools for AI coding agents.
4
+
5
+ Kage helps agents stop rediscovering the same project context. It stores
6
+ reviewable repo memory, builds generated recall/code indexes, and exposes the
7
+ result through an MCP server plus a CLI.
8
+
9
+ ## Install
88
10
 
89
11
  ```bash
90
- npm install
91
- npm run build
12
+ npm install -g @kage-core/kage-graph-mcp
13
+ ```
14
+
15
+ Set up Codex:
16
+
17
+ ```bash
18
+ cd your-repo
19
+ kage setup codex --project . --write
20
+ kage init --project .
21
+ kage setup verify-agent --agent codex --project .
92
22
  ```
93
23
 
94
- Publishing from the source repo should use the guarded maintainer helper after
95
- the release commit is ready. It is intentionally not exposed as a public npm
96
- script or included in the published tarball:
24
+ Set up Claude Code:
97
25
 
98
26
  ```bash
99
- npm run build --prefix mcp
100
- cd mcp
101
- node dist/release.js --dry-run
102
- node dist/release.js --publish --push --smoke
27
+ cd your-repo
28
+ kage setup claude-code --project . --write
29
+ kage init --project .
30
+ kage setup verify-agent --agent claude-code --project .
103
31
  ```
104
32
 
105
- The script fetches the current branch and blocks if the remote branch is not an
106
- ancestor of local `HEAD`, which prevents publishing an npm version from a branch
107
- that cannot be pushed cleanly.
33
+ Restart your agent once after setup so MCP tools reload.
108
34
 
109
- Do not refresh again just because the branch was pushed. Graph freshness is
110
- based on source, approved memory, and code-index inputs; empty/same-tree commits
111
- are accepted by `kage pr check`.
35
+ ## What Kage Gives Agents
112
36
 
113
- ## CLI
37
+ - repo-local memory for decisions, runbooks, bug fixes, gotchas, conventions,
38
+ and code explanations
39
+ - a code graph for files, symbols, imports, calls, routes, tests, and packages
40
+ - memory-code links so project knowledge points at the code it affects
41
+ - `AGENTS.md` bootstrap instructions so agents recall context automatically
42
+ - a local viewer for memory, code graph, metrics, evidence, and review state
43
+ - review and validation commands for stale or risky memory
44
+
45
+ No hosted service, external database, or API key is required.
46
+
47
+ ## Common Commands
114
48
 
115
49
  ```bash
116
50
  kage setup list
117
- kage setup codex --project /path/to/repo --write
118
- kage setup claude-code --project /path/to/repo
119
- kage setup generic-mcp --project /path/to/repo
120
- kage setup doctor --project /path/to/repo
121
- kage setup verify-agent --agent codex --project /path/to/repo
122
- kage init --project /path/to/repo
123
- kage policy --project /path/to/repo
124
- kage doctor --project /path/to/repo
125
- kage index --project /path/to/repo
126
- kage refresh --project /path/to/repo
127
- kage refresh --project /path/to/repo --full
128
- kage branch --project /path/to/repo
129
- kage code-index --project /path/to/repo
130
- kage code-graph --project /path/to/repo
131
- kage code-graph "createApp routes tests" --project /path/to/repo
132
- kage graph --project /path/to/repo
133
- kage graph --project /path/to/repo --mermaid
134
- kage graph "test command" --project /path/to/repo
135
- kage graph-registry --project /path/to/repo
136
- kage recall "how do I run tests" --project /path/to/repo
137
- kage recall "how do I run tests" --project /path/to/repo --explain --json
138
- kage quality --project /path/to/repo
139
- kage audit --project /path/to/repo
140
- kage inbox --project /path/to/repo
141
- kage benchmark --project /path/to/repo
142
- kage benchmark --project /path/to/repo --compare --task "how do I run tests"
143
- kage viewer --project /path/to/repo
144
- kage daemon start --project /path/to/repo
145
- kage observe --project /path/to/repo --event '{"type":"command_result","session_id":"s1","command":"npm test","exit_code":0}'
146
- kage distill --project /path/to/repo --session s1
147
- kage learn --project /path/to/repo --learning "Decision: use kage_learn for actual session discoveries." --paths mcp/index.ts
148
- kage feedback --project /path/to/repo --packet <approved-packet-id> --kind stale
149
- kage capture --project /path/to/repo --type runbook --title "Webhook tests" --body "Run pnpm test:api -- webhooks."
150
- kage propose --project /path/to/repo --from-diff
151
- kage pr summarize --project /path/to/repo
152
- kage pr check --project /path/to/repo
153
- kage review-artifact --project /path/to/repo
154
- kage registry --project /path/to/repo
155
- kage marketplace --project /path/to/repo
156
- kage promote --project /path/to/repo --public <approved-packet-id>
157
- kage export-public --project /path/to/repo
158
- kage org upload --project /path/to/repo --org acme --packet <approved-packet-id>
159
- kage org review --project /path/to/repo --org acme --packet <org-packet-id> --approve
160
- kage org recall "how do I run tests" --project /path/to/repo --org acme
161
- kage layered-recall "how do I run tests" --project /path/to/repo --org acme --global
162
- kage global build --project /path/to/repo --org acme
163
- kage review --project /path/to/repo
164
- kage validate --project /path/to/repo
165
- kage upgrade --dry-run
51
+ kage init --project .
52
+ kage recall "how do I run tests" --project .
53
+ kage recall "how do I run tests" --project . --json --explain
54
+ kage code-graph "auth routes tests" --project .
55
+ kage learn --project . --learning "Use npm test after parser changes."
56
+ kage refresh --project .
57
+ kage pr check --project .
58
+ kage metrics --project . --json
59
+ kage audit --project . --json
60
+ kage inbox --project . --json
61
+ kage viewer --project .
166
62
  ```
167
63
 
168
- `kage init` is the first-run command. It creates `.agent_memory/`, migrates
169
- legacy Markdown nodes into `.agent_memory/packets/*.json`, builds generated
170
- indexes, installs/updates `AGENTS.md`, validates the result, and prints a first
171
- recall preview.
172
-
173
- The graph builder writes evidence-backed graph artifacts under
174
- `.agent_memory/graph/`:
175
-
176
- - `episodes.json`: where graph facts came from, such as memory packets or
177
- repo manifests.
178
- - `entities.json`: typed nodes for repo, memory, path, tag, package, command,
179
- and memory type entities.
180
- - `edges.json`: typed facts such as `contains_memory`, `affects_path`,
181
- `mentions_tag`, `uses_package`, `documents_command`, and `defines_command`.
182
- - `graph.json`: compact graph metadata plus references to the split graph files.
183
-
184
- In the viewer, path-level memory such as `affects_path: src` is bridged to a
185
- small representative set of matching code files at render time. This keeps the
186
- stored graph compact while still making broad repo memories visibly connected
187
- to the code graph.
188
-
189
- The code graph builder writes source-derived artifacts under
190
- `.agent_memory/code_graph/`. `graph.json` is now a compact compatibility
191
- artifact: it keeps repo state plus calls, routes, tests, and packages inline, and
192
- references the canonical structural `files.json`, `symbols.json`, and
193
- `imports.json` instead of duplicating them.
194
-
195
- The code graph is multi-language by design. JS/TS/JSX/TSX files use the
196
- TypeScript compiler API for AST-backed symbols, imports, and call hints. Python,
197
- Go, Rust, Java, Kotlin, Ruby, PHP, C#, C/C++, and Swift use deterministic generic
198
- static extractors so every repo gets a useful graph immediately.
199
-
200
- For large repos, refresh also writes a complete structural index under
201
- `.agent_memory/structural/`:
202
-
203
- - `files.json`: every supported source/config/doc file, including files the
204
- code graph represents as metadata-only because they are too large to parse.
205
- - `symbols.json`: extracted functions, classes, constants, routes, and tests.
206
- - `edges.json`: file-to-symbol and file-to-import edges with confidence labels.
207
- - `manifest.json`: mtime/hash entries, cache hits/misses, ignored files, and
208
- deleted-file tracking.
209
- - `file-cache.json`: packed per-file structural facts keyed by source content
210
- hash. Refresh migrates older `.agent_memory/structural/file-cache/*.json`
211
- layouts and removes stale per-file cache entries.
212
- - `report.md`: a compact language/concept coverage report.
213
-
214
- This follows the same shape as fast graph indexers such as Graphify: discover
215
- files, skip generated/vendor paths, use a per-file content cache, parallelize
216
- extraction on large repos, rebuild only changed files, and keep generated
217
- structural facts separate from learned memory. Use `.kageignore` for
218
- repo-specific excludes.
219
-
220
- Kage also consumes external industry indexer artifacts when present:
221
-
222
- - `.agent_memory/code_index/tree-sitter.json`
223
- - `.agent_memory/code_index/scip.json`
224
- - `.agent_memory/code_index/lsp-symbols.json`
225
- - `.agent_memory/code_index/lsif.jsonl`
226
- - `tree-sitter-index.json`
227
- - `index.scip.json`
228
- - `dump.lsif`
229
-
230
- Those adapters are merge inputs, not required runtime dependencies. Facts from
231
- Tree-sitter, SCIP, LSIF, and LSP are tagged with parser provenance and outrank
232
- generic extraction in metrics and file parser coverage. This keeps installation
233
- light while allowing teams to plug in the strongest indexer available for their
234
- language stack.
235
-
236
- `kage code-index --project <repo>` now tries the best external indexer first for
237
- the common JS/TS case: if `scip-typescript` and the `scip` CLI are on the repo or
238
- shell path, it writes `.agent_memory/code_index/scip.json` from the generated
239
- SCIP index. If those tools are unavailable, it writes
240
- `.agent_memory/code_index/lsp-symbols.json` using Kage's local parser. The CI,
241
- PR, and sync workflows run it before refresh so the code graph has a committed
242
- precise-index slot without making first-run setup depend on external binaries.
243
-
244
- The memory graph follows the same product direction as temporal context graph
245
- systems such as Graphiti: immutable ingestion episodes, derived entities and
246
- facts, evidence/provenance on every edge, confidence, branch/commit context, and
247
- temporal validity fields (`valid_from`, `invalidated_at`). Kage keeps code facts
248
- and learned memory separate, then recalls across both when assembling context.
249
-
250
- Use `kage metrics --project <repo>` or the `kage_metrics` MCP tool to inspect
251
- whether the harness is actually carrying its weight. Metrics include language
252
- and parser coverage, code graph counts, evidence coverage, approved vs pending
253
- memory, validation status, estimated tokens saved per recall, duplicate
254
- candidates, average memory quality, and a readiness score.
255
-
256
- Use `kage audit --project <repo>` or the `kage_audit` MCP tool before relying
257
- on repo memory for agent work. Audit reports validation, pending memory inbox
258
- size, structured context coverage, stale/duplicate risk, memory-to-code graph
259
- links, precise code index coverage, and concrete recommendations such as
260
- extending SCIP/LSIF/LSP coverage or adding structured
261
- `why`/`verification`/`risk_if_forgotten` fields to high-value packets.
262
-
263
- Use `kage inbox --project <repo>` or the `kage_inbox` MCP tool for the
264
- actionable review queue. It consolidates pending packets, stale packets,
265
- duplicates, missing structured context, validation warnings/errors, and concrete
266
- actions into one report that the viewer also loads.
267
-
268
- Use `kage benchmark --compare --task "<task>" --project <repo>` or
269
- `kage_benchmark_compare` to compare the same task on the same repo with and
270
- without Kage. It estimates manual full-file rediscovery tokens/steps, compares
271
- them to compact Kage recall plus code graph context, and returns evidence plus
272
- caveats for honest marketing proof.
273
-
274
- Plain `kage benchmark --project <repo>` now includes explicit gates and an
275
- overall score for recall hit rate, evidence coverage, useful memory ratio, and
276
- code-flow coverage, so benchmark output has pass/fail criteria instead of loose
277
- claims.
278
-
279
- Use `kage graph-registry --project <repo>` or `kage_graph_registry` to write
280
- `.agent_memory/graph_registry/manifest.json`. The manifest is signed with the
281
- same canonical JSON scheme as registry bundles and records memory/code graph
282
- artifact hashes, generated index/report paths, source packet IDs and packet
283
- hashes, git state, audit trust, inbox counts, and metrics readiness. CI, PR, and
284
- sync workflows build it after refresh.
285
-
286
- Use `kage refresh --project <repo>` or the `kage_refresh` MCP tool after
287
- meaningful file/content changes. Refresh rebuilds indexes, code graph, memory
288
- graph, metrics, and stale-memory metadata. Memory is marked stale when status or
289
- feedback says it is stale, its TTL expires, or grounded paths disappear. Pushes
290
- and empty/same-tree commits do not need another refresh. Use `--full` or
291
- `kage_refresh` with `full: true` only when you intentionally want to bypass
292
- unchanged-graph reuse and rebuild the code graph from scratch.
293
-
294
- Use `kage gc --project <repo> --dry-run` to preview stale packet cleanup.
295
- `kage gc --project <repo>` marks stale repo packets deprecated, rebuilds
296
- indexes/graphs/metrics, and keeps helpful-voted memories unless `--force` is
297
- used.
298
-
299
- Use `kage pr summarize --project <repo>` / `kage_pr_summarize` before handoff to
300
- write branch review metadata and repo-local change memory from the git diff.
301
- Use `kage pr check --project <repo>` / `kage_pr_check` before merge to verify
302
- validation, graph freshness, stale packets, and memory packet changes.
303
-
304
- Review artifacts include memory quality reasons, risks, duplicate candidates,
305
- and estimated token savings for legacy pending/quarantine packets and promotion
306
- review.
307
-
308
- `kage observe` is the automatic-capture primitive for agent hooks and daemon
309
- clients. It accepts session, prompt, tool, file-change, command, test, and
310
- session-end events; deduplicates them; scans for secrets and PII; and stores raw
311
- observations locally only. `kage distill` turns useful observations into
312
- repo-local packets with observation session source refs. Distillation is not
313
- limited to action-changing instructions: durable rationale, bug causes, issue
314
- state, decisions, and code explanations are valid memory when source-backed. It
315
- never publishes memory.
316
-
317
- `kage recall --explain --json` exposes the hybrid scoring explanation used for
318
- ranking: BM25 lexical score, graph, path/type/tag, intent, freshness, quality,
319
- feedback, and a vector placeholder for future local or external embedding providers.
320
- Current fallback is vectorless BM25 plus graph retrieval.
321
-
322
- `kage_context` is the primary MCP entrypoint for agents. It validates repo
323
- memory, recalls relevant packets, and returns code/knowledge graph context in
324
- one call. Agents should use it at task start instead of loading separate
325
- `kage_validate`, `kage_recall`, `kage_code_graph`, and `kage_graph` schemas.
326
-
327
- `kage daemon start` exposes the optional local REST runtime on
328
- `127.0.0.1:3111`:
329
-
330
- - `GET /health`
331
- - `GET /kage/status`
332
- - `GET /kage/metrics`
333
- - `GET /kage/quality`
334
- - `GET /kage/inbox`
335
- - `GET /kage/benchmark`
336
- - `POST /kage/recall`
337
- - `POST /kage/observe`
338
- - `POST /kage/distill`
339
-
340
- The daemon is not required for stdio MCP or CLI use; it exists for agents and
341
- workflows that need REST, live observation ingestion, Aider-style scripting, or
342
- automatic index refresh. On start it indexes once, then watches repo file changes
343
- and refreshes generated graph/index artifacts after a short debounce.
344
-
345
- ## Local Graph Viewer
346
-
347
- Run `kage viewer --project <repo>` to start the local terminal console. It
348
- serves the viewer and the selected repo's `.agent_memory/` files from the same
349
- localhost server, then prints a URL that auto-loads memory graph, code graph,
350
- metrics, memory inbox, review artifact, and pending packets when present.
351
- Manual JSON selection remains as a fallback, not the main workflow.
352
-
353
- The viewer renders nodes and relations in SVG, supports memory/code/combined
354
- modes, filters by type and relation, displays metrics, shows packets and pending
355
- quarantine items when present, surfaces the memory inbox, and marks risks such
356
- as low-confidence or missing-evidence edges.
357
-
358
- For demos or local docs, the viewer also accepts URL params:
64
+ For stale or wrong memory:
359
65
 
360
- ```text
361
- mcp/viewer/index.html?graph=/repo/.agent_memory/graph/graph.json&code=/repo/.agent_memory/code_graph/graph.json&metrics=/repo/.agent_memory/metrics.json
66
+ ```bash
67
+ kage feedback --project . --packet <packet-id> --kind stale
68
+ kage gc --project . --dry-run
362
69
  ```
363
70
 
364
- The graph canvas supports drag-to-pan, wheel zoom, explicit zoom buttons,
365
- fit-to-view, click selection, and background deselect. This keeps review
366
- interactive enough to explain how repo facts, learned memory, evidence,
367
- confidence, and token-savings metrics connect.
368
-
369
- ## MCP Tools
370
-
371
- Local repo tools:
372
-
373
- - `kage_context`
374
- - `kage_recall`
375
- - `kage_graph_registry`
376
- - `kage_code_graph`
377
- - `kage_code_index`
378
- - `kage_metrics`
379
- - `kage_audit`
380
- - `kage_inbox`
381
- - `kage_refresh`
382
- - `kage_pr_summarize`
383
- - `kage_pr_check`
384
- - `kage_quality`
385
- - `kage_benchmark`
386
- - `kage_benchmark_compare`
387
- - `kage_setup_agent`
388
- - `kage_graph`
389
- - `kage_graph_visual`
390
- - `kage_learn`
391
- - `kage_capture`
392
- - `kage_observe`
393
- - `kage_distill`
394
- - `kage_feedback`
395
- - `kage_install_policy`
396
- - `kage_branch_overlay`
397
- - `kage_validate`
398
- - `kage_registry_recommend`
399
- - `kage_marketplace`
400
- - `kage_org_status`
401
- - `kage_org_upload_candidate`
402
- - `kage_org_recall`
403
- - `kage_layered_recall`
404
- - `kage_global_build`
405
- - `kage_review_artifact`
406
- - `kage_propose_from_diff`
407
- - `kage_promote_public_candidate`
408
- - `kage_export_public_bundle`
409
-
410
- Public graph tools:
411
-
412
- - `kage_search`
413
- - `kage_fetch`
414
- - `kage_list_domains`
415
-
416
- ## Codex MCP Configuration
417
-
418
- Fast path from the repo you want Kage to remember:
71
+ ## MCP Server
419
72
 
420
- ```bash
421
- curl -fsSL https://raw.githubusercontent.com/kage-core/Kage/master/codex-setup.sh | bash
422
- ```
73
+ The package exposes:
423
74
 
424
- This clones/updates Kage under `~/.kage/Kage`, builds this MCP package, writes
425
- the `mcp_servers.kage` block to `~/.codex/config.toml`, and runs `kage init` for
426
- the current repo. Restart Codex after it completes.
75
+ - `kage-graph-mcp`: stdio MCP server
76
+ - `kage`: CLI
427
77
 
428
- Local development path:
78
+ Typical MCP clients should use the setup command instead of hand-writing config:
429
79
 
430
80
  ```bash
431
- /path/to/Kage/codex-setup.sh --project /path/to/repo
81
+ kage setup codex --project . --write
82
+ kage setup claude-code --project . --write
83
+ kage setup generic-mcp --project .
432
84
  ```
433
85
 
434
- After building the package, add the local stdio server to Codex.
86
+ Supported setup targets include Codex, Claude Code, Cursor, Windsurf, Gemini
87
+ CLI, OpenCode, Cline, Goose, Roo Code, Kilo Code, Claude Desktop, Aider, and
88
+ generic MCP clients.
435
89
 
436
- `~/.codex/config.toml`:
90
+ ## Storage Model
437
91
 
438
- ```toml
439
- [mcp_servers.kage]
440
- command = "node"
441
- args = ["/absolute/path/to/Kage/mcp/dist/index.js"]
442
- ```
92
+ Kage keeps learned memory separate from generated code facts.
93
+
94
+ | Layer | Path | Purpose |
95
+ |---|---|---|
96
+ | Packets | `.agent_memory/packets/` | durable repo memory |
97
+ | Indexes | `.agent_memory/indexes/` | rebuildable recall indexes |
98
+ | Memory graph | `.agent_memory/graph/` | packet relationships and evidence |
99
+ | Structural map | `.agent_memory/structural/` | files, symbols, imports |
100
+ | Code graph | `.agent_memory/code_graph/` | source-derived code facts |
101
+ | Metrics | `.agent_memory/metrics.json` | readiness, quality, coverage |
443
102
 
444
- Then restart Codex. To make Kage ambient instead of manual, run `kage init` or
445
- `kage policy`; both install an `AGENTS.md` policy that tells Codex to call Kage
446
- automatically before and after coding tasks.
103
+ Repo-local packets are git-visible and reviewable. Generated indexes and graphs
104
+ are rebuildable.
447
105
 
448
- For other agents, generate the exact config with:
106
+ ## Performance Notes
107
+
108
+ Kage is optimized so repeat work scales with changed files, not the whole repo:
109
+
110
+ - read-only recall reuses fresh graph artifacts
111
+ - unchanged structural file facts are reused
112
+ - generated graphs are compact and avoid duplicated structural JSON
113
+ - generated/vendor/cache paths are ignored
114
+ - huge files are represented safely instead of deeply expanded
115
+ - recall builds lookup maps once per query instead of repeatedly scanning graph
116
+ edges for every memory packet
117
+
118
+ ## Viewer
119
+
120
+ Open a local viewer for the current repo:
449
121
 
450
122
  ```bash
451
- kage setup list
452
- kage setup cursor --project /path/to/repo
453
- kage setup windsurf --project /path/to/repo
454
- kage setup gemini-cli --project /path/to/repo
455
- kage setup opencode --project /path/to/repo
456
- kage setup generic-mcp --project /path/to/repo
123
+ kage viewer --project .
124
+ ```
125
+
126
+ Hosted demo:
127
+
128
+ ```text
129
+ https://kage-core.github.io/Kage/viewer/
457
130
  ```
458
131
 
459
- Minimum policy:
132
+ ## Development
460
133
 
461
- ```md
462
- Before code changes or repo-specific answers:
463
- 1. Call `kage_context` with `project_dir` and the user task as `query`.
464
- 2. Capture reusable learnings with `kage_learn` or `kage_capture`.
465
- 3. After meaningful file/content changes, call `kage_refresh`; skip it for push-only or same-tree commits.
466
- 4. Before finishing changed-file tasks, call `kage_propose_from_diff` or `kage_pr_summarize`.
467
- 5. Before merge, call `kage_pr_check`.
468
- 6. Never publish or promote org/global memory automatically.
134
+ ```bash
135
+ npm install
136
+ npm test
469
137
  ```
470
138
 
471
- Run `kage setup verify-agent --agent codex --project <repo>` after setup. The
472
- CLI verifies config, policy, indexes, recall, and code graph. It intentionally
473
- reports `restart_required` until the active agent can call the MCP
474
- `kage_verify_agent` tool, which proves Kage is live inside that agent session.
139
+ Build:
140
+
141
+ ```bash
142
+ npm run build
143
+ ```
475
144
 
476
- The official Codex MCP docs also support adding HTTP MCP servers with:
145
+ Package smoke check:
477
146
 
478
147
  ```bash
479
- codex mcp add <name> --url <server-url>
480
- codex mcp list
148
+ npm pack --dry-run
481
149
  ```
482
150
 
483
- Kage currently runs as a local stdio MCP server, so the TOML form is the direct
484
- fit for the current package.
485
-
486
- ## Safety Model
487
-
488
- - `kage_learn` is the preferred surface for actual session learning. It creates
489
- repo-local packets with explicit learning/evidence/verification text.
490
- - `kage_capture` creates repo-local packets.
491
- - `kage_propose_from_diff` writes a branch review summary under
492
- `.agent_memory/review/` and a repo-local change-memory packet under
493
- `.agent_memory/packets/`. Promotion beyond the repo still requires explicit
494
- review.
495
- - `kage_promote_public_candidate` writes a local sanitized review candidate
496
- under `.agent_memory/public-candidates/`; it does not publish.
497
- - Registry recommendations never auto-install skills, docs, or MCP servers.
498
- - Org/global shared memory still requires explicit review.
499
- - Capture blocks obvious secrets, tokens, private URL credentials, bearer
500
- tokens, private keys, and email addresses before writing a packet.
501
- - Generated indexes are disposable and can be rebuilt from packets.
151
+ ## License
152
+
153
+ GPL-3.0-only.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kage-core/kage-graph-mcp",
3
- "version": "1.1.21",
3
+ "version": "1.1.23",
4
4
  "description": "Local-first repo memory, code graph, and recall MCP server for coding agents",
5
5
  "main": "dist/index.js",
6
6
  "files": [
package/viewer/app.js CHANGED
@@ -272,7 +272,7 @@
272
272
  function loadHostedDefault() {
273
273
  setAutoLoad("loading hosted repo graph", false);
274
274
  Promise.all([
275
- fetchJson("./data/kage/graph.json"),
275
+ loadGraphPath("./data/kage/graph.json"),
276
276
  loadGraphPath("./data/kage/code_graph/graph.json"),
277
277
  fetchJson("./data/kage/metrics.json").catch(function () { return null; }),
278
278
  fetchJson("./data/kage/inbox.json").catch(function () { return null; })
@@ -1852,6 +1852,8 @@
1852
1852
  heading.className = "detail-section-title";
1853
1853
  heading.textContent = title;
1854
1854
  section.appendChild(heading);
1855
+ var list = document.createElement("div");
1856
+ list.className = "detail-section-list";
1855
1857
  items.forEach(function (item) {
1856
1858
  var button = document.createElement("button");
1857
1859
  button.type = "button";
@@ -1864,14 +1866,15 @@
1864
1866
  state.selected = item.entity ? { kind: "entity", id: item.entity.id } : { kind: "edge", id: item.edge.id };
1865
1867
  render();
1866
1868
  });
1867
- section.appendChild(button);
1869
+ list.appendChild(button);
1868
1870
  });
1869
1871
  if (hiddenCount > 0) {
1870
1872
  var more = document.createElement("div");
1871
1873
  more.className = "detail-more";
1872
1874
  more.textContent = "+" + hiddenCount + " more connected items hidden to keep the graph readable.";
1873
- section.appendChild(more);
1875
+ list.appendChild(more);
1874
1876
  }
1877
+ section.appendChild(list);
1875
1878
  return section;
1876
1879
  }
1877
1880
 
package/viewer/index.html CHANGED
@@ -4,7 +4,7 @@
4
4
  <meta charset="utf-8">
5
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
6
  <title>Kage Memory Terminal</title>
7
- <link rel="stylesheet" href="./styles.css?v=11">
7
+ <link rel="stylesheet" href="./styles.css?v=15">
8
8
  </head>
9
9
  <body>
10
10
  <header class="app-header">
@@ -149,6 +149,6 @@
149
149
  </section>
150
150
  </main>
151
151
 
152
- <script src="./app.js?v=11"></script>
152
+ <script src="./app.js?v=15"></script>
153
153
  </body>
154
154
  </html>
package/viewer/styles.css CHANGED
@@ -161,6 +161,8 @@ h2 { color: var(--terminal); font-size: 13px; letter-spacing: 0.04em; text-trans
161
161
  min-height: calc(100vh - 78px);
162
162
  }
163
163
 
164
+ .layout > * { min-width: 0; }
165
+
164
166
  .control-panel, .graph-panel, .details-panel, .table-panel, .review-panel, .proof-panel {
165
167
  border: 1px solid var(--line);
166
168
  border-radius: 6px;
@@ -425,20 +427,39 @@ input:focus, select:focus, button:focus, .file-picker:focus-within {
425
427
 
426
428
  .details-panel {
427
429
  grid-area: details;
430
+ align-self: start;
431
+ display: flex;
432
+ flex-direction: column;
433
+ height: min(960px, calc(100vh - 108px));
434
+ max-height: calc(100vh - 108px);
428
435
  min-height: 0;
429
- overflow: auto;
436
+ overflow: hidden;
430
437
  padding: 12px;
431
438
  }
432
439
  .details-empty { color: var(--terminal-dim); }
440
+ #selectionDetails {
441
+ min-height: 0;
442
+ overflow: auto;
443
+ overscroll-behavior: contain;
444
+ padding-right: 2px;
445
+ }
433
446
  .detail-title { margin-bottom: 8px; color: var(--text); font-weight: 780; font-size: 17px; overflow-wrap: anywhere; }
434
447
  .detail-kind { margin-bottom: 10px; color: var(--terminal-strong); background: #07130d; }
435
448
  .detail-row { padding: 9px 0; border-top: 1px solid var(--line); }
436
449
  .detail-row dt { margin: 0 0 4px; color: var(--terminal-dim); font-size: 11px; font-weight: 760; text-transform: uppercase; }
437
- .detail-row dd { margin: 0; color: var(--text); overflow-wrap: anywhere; white-space: pre-wrap; }
450
+ .detail-row dd {
451
+ max-height: 150px;
452
+ margin: 0;
453
+ color: var(--text);
454
+ overflow: auto;
455
+ overflow-wrap: anywhere;
456
+ white-space: pre-wrap;
457
+ }
438
458
  .detail-section {
439
459
  margin-top: 12px;
440
460
  padding-top: 12px;
441
461
  border-top: 1px solid var(--line);
462
+ min-height: 0;
442
463
  }
443
464
  .detail-section-title {
444
465
  margin-bottom: 8px;
@@ -447,6 +468,12 @@ input:focus, select:focus, button:focus, .file-picker:focus-within {
447
468
  font-weight: 800;
448
469
  text-transform: uppercase;
449
470
  }
471
+ .detail-section-list {
472
+ max-height: 260px;
473
+ overflow: auto;
474
+ overscroll-behavior: contain;
475
+ padding-right: 2px;
476
+ }
450
477
  .detail-link {
451
478
  width: 100%;
452
479
  display: grid;
@@ -475,8 +502,12 @@ input:focus, select:focus, button:focus, .file-picker:focus-within {
475
502
  overflow-wrap: anywhere;
476
503
  }
477
504
  .detail-link-body {
505
+ display: -webkit-box;
506
+ -webkit-box-orient: vertical;
507
+ -webkit-line-clamp: 3;
478
508
  color: var(--muted);
479
509
  font-size: 11px;
510
+ overflow: hidden;
480
511
  overflow-wrap: anywhere;
481
512
  }
482
513
  .detail-more {
@@ -663,6 +694,11 @@ input:focus, select:focus, button:focus, .file-picker:focus-within {
663
694
  .control-panel label, .control-panel button { margin-top: 0; }
664
695
  .graph-panel { min-height: 620px; }
665
696
  #graphCanvas, .graph-canvas-wrap, #graphSvg { min-height: 560px; }
697
+ .details-panel {
698
+ height: auto;
699
+ max-height: 70vh;
700
+ }
701
+ .detail-section-list { max-height: 220px; }
666
702
  }
667
703
 
668
704
  @media (max-width: 620px) {