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