kirograph 0.14.1 → 0.16.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.
Files changed (125) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +239 -20
  3. package/dist/assets/logo.png +0 -0
  4. package/dist/bin/commands/docs.js +357 -0
  5. package/dist/bin/commands/docs.js.map +7 -0
  6. package/dist/bin/commands/help.js +3 -0
  7. package/dist/bin/commands/help.js.map +2 -2
  8. package/dist/bin/commands/uninit.js +10 -13
  9. package/dist/bin/commands/uninit.js.map +2 -2
  10. package/dist/bin/installer/config-prompt.js +53 -23
  11. package/dist/bin/installer/config-prompt.js.map +2 -2
  12. package/dist/bin/installer/hooks.js +20 -1
  13. package/dist/bin/installer/hooks.js.map +2 -2
  14. package/dist/bin/installer/index.js +14 -4
  15. package/dist/bin/installer/index.js.map +2 -2
  16. package/dist/bin/installer/prompts.js +37 -6
  17. package/dist/bin/installer/prompts.js.map +2 -2
  18. package/dist/bin/installer/steering.js +40 -0
  19. package/dist/bin/installer/steering.js.map +2 -2
  20. package/dist/bin/installer/targets/aider.js +72 -0
  21. package/dist/bin/installer/targets/aider.js.map +7 -0
  22. package/dist/bin/installer/targets/amp.js +91 -0
  23. package/dist/bin/installer/targets/amp.js.map +7 -0
  24. package/dist/bin/installer/targets/antigravity.js +109 -0
  25. package/dist/bin/installer/targets/antigravity.js.map +7 -0
  26. package/dist/bin/installer/targets/augment.js +81 -0
  27. package/dist/bin/installer/targets/augment.js.map +7 -0
  28. package/dist/bin/installer/targets/claude.js +1 -1
  29. package/dist/bin/installer/targets/claude.js.map +2 -2
  30. package/dist/bin/installer/targets/cline.js +91 -0
  31. package/dist/bin/installer/targets/cline.js.map +7 -0
  32. package/dist/bin/installer/targets/codex.js +1 -1
  33. package/dist/bin/installer/targets/codex.js.map +2 -2
  34. package/dist/bin/installer/targets/continue.js +107 -0
  35. package/dist/bin/installer/targets/continue.js.map +7 -0
  36. package/dist/bin/installer/targets/copilot.js +123 -0
  37. package/dist/bin/installer/targets/copilot.js.map +7 -0
  38. package/dist/bin/installer/targets/cursor.js +143 -0
  39. package/dist/bin/installer/targets/cursor.js.map +7 -0
  40. package/dist/bin/installer/targets/devin.js +148 -0
  41. package/dist/bin/installer/targets/devin.js.map +7 -0
  42. package/dist/bin/installer/targets/gemini-cli.js +126 -0
  43. package/dist/bin/installer/targets/gemini-cli.js.map +7 -0
  44. package/dist/bin/installer/targets/generic.js +120 -0
  45. package/dist/bin/installer/targets/generic.js.map +7 -0
  46. package/dist/bin/installer/targets/goose.js +72 -0
  47. package/dist/bin/installer/targets/goose.js.map +7 -0
  48. package/dist/bin/installer/targets/index.js.map +1 -1
  49. package/dist/bin/installer/targets/junie.js +105 -0
  50. package/dist/bin/installer/targets/junie.js.map +7 -0
  51. package/dist/bin/installer/targets/kilo.js +122 -0
  52. package/dist/bin/installer/targets/kilo.js.map +7 -0
  53. package/dist/bin/installer/targets/kiro.js +3 -3
  54. package/dist/bin/installer/targets/kiro.js.map +2 -2
  55. package/dist/bin/installer/targets/opencode.js +135 -0
  56. package/dist/bin/installer/targets/opencode.js.map +7 -0
  57. package/dist/bin/installer/targets/openhands.js +90 -0
  58. package/dist/bin/installer/targets/openhands.js.map +7 -0
  59. package/dist/bin/installer/targets/replit.js +72 -0
  60. package/dist/bin/installer/targets/replit.js.map +7 -0
  61. package/dist/bin/installer/targets/roo.js +96 -0
  62. package/dist/bin/installer/targets/roo.js.map +7 -0
  63. package/dist/bin/installer/targets/tabnine.js +82 -0
  64. package/dist/bin/installer/targets/tabnine.js.map +7 -0
  65. package/dist/bin/installer/targets/trae.js +84 -0
  66. package/dist/bin/installer/targets/trae.js.map +7 -0
  67. package/dist/bin/installer/targets/warp.js +97 -0
  68. package/dist/bin/installer/targets/warp.js.map +7 -0
  69. package/dist/bin/installer/targets/windsurf.js +141 -0
  70. package/dist/bin/installer/targets/windsurf.js.map +7 -0
  71. package/dist/bin/kirograph.js +5 -1
  72. package/dist/bin/kirograph.js.map +3 -3
  73. package/dist/compression/naive-cost.js +33 -0
  74. package/dist/compression/naive-cost.js.map +2 -2
  75. package/dist/compression/tracker.js +27 -4
  76. package/dist/compression/tracker.js.map +2 -2
  77. package/dist/compression/types.js.map +1 -1
  78. package/dist/config.js +66 -1
  79. package/dist/config.js.map +2 -2
  80. package/dist/core/pipeline.js +23 -0
  81. package/dist/core/pipeline.js.map +2 -2
  82. package/dist/db/database.js +28 -0
  83. package/dist/db/database.js.map +2 -2
  84. package/dist/db/docs-schema.sql +50 -0
  85. package/dist/docs/formats/asciidoc.js +108 -0
  86. package/dist/docs/formats/asciidoc.js.map +7 -0
  87. package/dist/docs/formats/html.js +100 -0
  88. package/dist/docs/formats/html.js.map +7 -0
  89. package/dist/docs/formats/index.js +81 -0
  90. package/dist/docs/formats/index.js.map +7 -0
  91. package/dist/docs/formats/markdown.js +146 -0
  92. package/dist/docs/formats/markdown.js.map +7 -0
  93. package/dist/docs/formats/openapi.js +228 -0
  94. package/dist/docs/formats/openapi.js.map +7 -0
  95. package/dist/docs/formats/org.js +117 -0
  96. package/dist/docs/formats/org.js.map +7 -0
  97. package/dist/docs/formats/plaintext.js +119 -0
  98. package/dist/docs/formats/plaintext.js.map +7 -0
  99. package/dist/docs/formats/rdoc.js +105 -0
  100. package/dist/docs/formats/rdoc.js.map +7 -0
  101. package/dist/docs/formats/rst.js +121 -0
  102. package/dist/docs/formats/rst.js.map +7 -0
  103. package/dist/docs/indexer.js +340 -0
  104. package/dist/docs/indexer.js.map +7 -0
  105. package/dist/docs/linker.js +151 -0
  106. package/dist/docs/linker.js.map +7 -0
  107. package/dist/docs/lint.js +92 -0
  108. package/dist/docs/lint.js.map +7 -0
  109. package/dist/docs/queries.js +295 -0
  110. package/dist/docs/queries.js.map +7 -0
  111. package/dist/docs/section-id.js +57 -0
  112. package/dist/docs/section-id.js.map +7 -0
  113. package/dist/docs/summarizer.js +55 -0
  114. package/dist/docs/summarizer.js.map +7 -0
  115. package/dist/docs/types.js +17 -0
  116. package/dist/docs/types.js.map +7 -0
  117. package/dist/docs/vectors.js +217 -0
  118. package/dist/docs/vectors.js.map +7 -0
  119. package/dist/index.js +3 -0
  120. package/dist/index.js.map +2 -2
  121. package/dist/mcp/tool-names.js +10 -1
  122. package/dist/mcp/tool-names.js.map +2 -2
  123. package/dist/mcp/tools.js +476 -3
  124. package/dist/mcp/tools.js.map +2 -2
  125. package/package.json +1 -1
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Davide De Sio
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 CHANGED
@@ -80,6 +80,49 @@ Enable via `kirograph install` or directly in `.kirograph/config.json`:
80
80
 
81
81
  See the [Architecture Analysis](#architecture-analysis-opt-in-1) section below for full details.
82
82
 
83
+ ### Memory (opt-in)
84
+
85
+ When `enableMemory: true` is set, KiroGraph stores persistent observations across sessions — decisions, errors, patterns, and architecture notes. Inspired by [cavemem](https://github.com/JuliusBrussee/cavemem) by [Julius Brussee](https://www.linkedin.com/in/julius-brussee/). Observations are:
86
+
87
+ - **Compressed** with the caveman grammar (if caveman mode is enabled) — deterministic, no LLM tokens spent
88
+ - **Linked to code symbols** — identifiers in observation text are matched against the graph and stored as stable `qualified_name` references
89
+ - **Embedded** with the configured semantic engine — enabling natural-language search over past observations
90
+ - **Deduplicated** — SHA-256 content hash prevents storing the same observation twice
91
+
92
+ Memory surfaces automatically in `kirograph_context` and `kirograph_impact` results when relevant observations are linked to the symbols being queried. The agent can also search memory directly via `kirograph_mem_search` or store new observations via `kirograph_mem_store`.
93
+
94
+ Zero LLM tokens on write. ~150-350 tokens per search (vs ~2000-5000 tokens to re-discover context by reading files).
95
+
96
+ Enable via `kirograph install` or directly in `.kirograph/config.json`:
97
+
98
+ ```json
99
+ {
100
+ "enableMemory": true
101
+ }
102
+ ```
103
+
104
+ See the [Memory](#memory-requires-enablememory-true) section below for full details.
105
+
106
+ ### Documentation indexing (opt-in)
107
+
108
+ When `enableDocs: true` is set, KiroGraph indexes project documentation by heading hierarchy and section structure. Instead of reading entire doc files, agents retrieve exactly the section they need via stable section IDs. Inspired by [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/).
109
+
110
+ - **9 format parsers**: Markdown, MDX, reStructuredText, AsciiDoc, RDoc, Org-mode, HTML, plain text, OpenAPI/Swagger
111
+ - **Code ↔ docs cross-references**: Backtick references, CamelCase identifiers, and snake_case patterns in docs are resolved against the code graph
112
+ - **Section-level FTS search**: Independent from code search (`kirograph_docs_search`)
113
+ - **Stable section IDs**: `{file_path}::{ancestor-chain/slug}#{level}` — stable across re-indexing
114
+ - **Token savings**: 92–97% reduction vs reading full doc files (tracked in `kirograph_gain`)
115
+
116
+ Enable via `kirograph install` or directly in `.kirograph/config.json`:
117
+
118
+ ```json
119
+ {
120
+ "enableDocs": true
121
+ }
122
+ ```
123
+
124
+ See the [Documentation](#documentation-requires-enabledocs-true) section below for full details.
125
+
83
126
  ## Installation
84
127
 
85
128
  ### From npm (not yet available on npm registry)
@@ -179,7 +222,7 @@ kg install
179
222
  └───────────────────────────────────────────┘
180
223
  ```
181
224
 
182
- Kiro hooks mark the index dirty on every file save or create, then flush on agent idle, batching changes efficiently with no overhead during active editing.
225
+ A single Kiro hook triggers on `agentStop` and asks the agent to sync the index if any source files were changed during the session. No per-file hooks, no background watcher — zero overhead during active editing.
183
226
 
184
227
  ## Using with Kiro
185
228
 
@@ -201,37 +244,36 @@ Registers the KiroGraph MCP server. Used by both the IDE and the CLI agent:
201
244
  "kirograph_status", "kirograph_files", "kirograph_dead_code",
202
245
  "kirograph_circular_deps", "kirograph_path", "kirograph_type_hierarchy",
203
246
  "kirograph_architecture", "kirograph_coupling", "kirograph_package",
204
- "kirograph_hotspots", "kirograph_surprising", "kirograph_diff"
247
+ "kirograph_hotspots", "kirograph_surprising", "kirograph_diff",
248
+ "kirograph_exec", "kirograph_gain"
249
+ "kirograph_mem_search", "kirograph_mem_store",
250
+ "kirograph_mem_timeline", "kirograph_mem_status"
205
251
  ]
206
252
  }
207
253
  }
208
254
  }
209
255
  ```
210
256
 
211
- ### IDE Auto-Sync Hooks (`.kiro/hooks/`)
212
-
213
- Four hooks keep the index fresh automatically in the Kiro IDE:
257
+ ### IDE Hooks (`.kiro/hooks/`)
214
258
 
215
- | Hook | Event | Action |
216
- |------|-------|--------|
217
- | `kirograph-mark-dirty-on-save.json` | `fileEdited` | `kirograph mark-dirty` |
218
- | `kirograph-mark-dirty-on-create.json` | `fileCreated` | `kirograph mark-dirty` |
219
- | `kirograph-sync-on-delete.json` | `fileDeleted` | `kirograph sync-if-dirty` |
220
- | `kirograph-sync-if-dirty.json` | `agentStop` | `kirograph sync-if-dirty --quiet` |
259
+ Up to two hooks are installed (`.kiro.hook` extension):
221
260
 
222
- File changes are batched: saves and creates write a dirty marker; the actual sync runs when the agent stops. Deletes sync immediately. This means no overhead during active editing.
261
+ | Hook file | Event | Type | Behavior |
262
+ |-----------|-------|------|----------|
263
+ | `kirograph-sync-if-dirty.kiro.hook` | `agentStop` | `runCommand` | Runs `kirograph sync --quiet` when the agent stops, syncing any file changes from the session. The sync command skips unchanged files via content hashing, so it's fast even when nothing changed. |
264
+ | `kirograph-compress-hint.kiro.hook` | `preToolUse` (shell) | `askAgent` | Reminds the agent to use `kirograph_exec` for commands that benefit from token compression (git, gh, test, lint, build, docker, aws, grep). Only installed when shell compression is enabled. |
223
265
 
224
- Hooks fire for: `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.rs`, `.java`, `.cs`, `.rb`, `.php`, `.swift`, `.kt`, `.dart`, `.ex`, `.exs`
266
+ The sync hook replaces the previous per-file approach (mark-dirty-on-save, mark-dirty-on-create, sync-on-delete). A single `agentStop` hook handles all file changes in one pass with zero overhead during active editing.
225
267
 
226
268
  ### CLI Agent Config (`.kiro/agents/kirograph.json`)
227
269
 
228
- A custom agent for Kiro CLI that wires up the MCP server, inlines the steering instructions as a prompt, and handles sync in the CLI's own hook format. The CLI has no file-watch events, so syncing is handled at session boundaries instead:
270
+ A custom agent for Kiro CLI that wires up the MCP server, references the steering file as a resource, and handles sync in the CLI's own hook format. The CLI has no file-watch events, so syncing is handled at session boundaries:
229
271
 
230
- | Hook | Event | Action |
231
- |------|-------|--------|
232
- | `agentSpawn` | Agent starts | `kirograph sync-if-dirty --quiet` (catches edits made between sessions) |
233
- | `userPromptSubmit` | Each prompt | `kirograph sync-if-dirty --quiet` (keeps graph fresh within a session) |
234
- | `stop` | End of each turn | `kirograph sync-if-dirty --quiet` (deferred flush, mirrors IDE `agentStop`) |
272
+ | Event | Action |
273
+ |-------|--------|
274
+ | `agentSpawn` | `kirograph sync-if-dirty --quiet` (catches edits made between sessions) |
275
+ | `userPromptSubmit` | `kirograph sync-if-dirty --quiet` (keeps graph fresh within a session) |
276
+ | `stop` | `kirograph sync-if-dirty --quiet` (deferred flush, mirrors IDE `agentStop`) |
235
277
 
236
278
  Use it with:
237
279
 
@@ -531,6 +573,100 @@ Show token savings statistics from compressed command outputs.
531
573
 
532
574
  Returns total commands, original/compressed token counts, savings percentage, breakdown by command family, and recent command history.
533
575
 
576
+ ### `kirograph_mem_search` *(requires `enableMemory: true`)*
577
+
578
+ Search project memory for past decisions, errors, patterns, and context.
579
+
580
+ | Parameter | Type | Default | Description |
581
+ |-----------|------|---------|-------------|
582
+ | `query` | string | required | Natural language search query |
583
+ | `kind` | string | - | Filter: `decision`, `error`, `pattern`, `architecture`, `summary`, `note` |
584
+ | `limit` | number | 10 | Max results |
585
+ | `sessionId` | string | - | Filter to specific session |
586
+ | `projectPath` | string | cwd | Project root path |
587
+
588
+ **How it works:** Hybrid search combining FTS5 keyword matching and vector cosine similarity (using the configured semantic engine). Results are ranked by a blended score (configurable via `memorySearchAlpha`). Falls back to FTS-only if embeddings are disabled or model mismatch is detected.
589
+
590
+ ### `kirograph_mem_store` *(requires `enableMemory: true`)*
591
+
592
+ Store an observation in project memory. Content is automatically compressed (if caveman mode is on) and linked to relevant code symbols.
593
+
594
+ | Parameter | Type | Default | Description |
595
+ |-----------|------|---------|-------------|
596
+ | `content` | string | required | Observation text |
597
+ | `kind` | string | `note` | `decision`, `error`, `pattern`, `architecture`, `summary`, `note` |
598
+ | `projectPath` | string | cwd | Project root path |
599
+
600
+ **How it works:** Strips `<private>` blocks → applies caveman compression (if enabled) → computes SHA-256 hash for deduplication → stores in `mem_observations` → detects symbol identifiers and creates `mem_links` → embeds with the configured model. Zero LLM tokens consumed.
601
+
602
+ ### `kirograph_mem_timeline` *(requires `enableMemory: true`)*
603
+
604
+ List recent sessions and their observations chronologically.
605
+
606
+ | Parameter | Type | Default | Description |
607
+ |-----------|------|---------|-------------|
608
+ | `limit` | number | 5 | Number of sessions to show |
609
+ | `sessionId` | string | - | Show observations for a specific session |
610
+ | `projectPath` | string | cwd | Project root path |
611
+
612
+ ### `kirograph_mem_status` *(requires `enableMemory: true`)*
613
+
614
+ Memory subsystem health: session count, observations, embedding coverage, model mismatch detection.
615
+
616
+ | Parameter | Type | Default | Description |
617
+ |-----------|------|---------|-------------|
618
+ | `projectPath` | string | cwd | Project root path |
619
+
620
+ ### `kirograph_docs_toc` *(requires `enableDocs: true`)*
621
+
622
+ Get table of contents for a documentation file or the whole project. Returns section IDs, titles, levels, and summaries.
623
+
624
+ | Parameter | Type | Default | Description |
625
+ |-----------|------|---------|-------------|
626
+ | `file` | string | - | Filter to a specific doc file (relative path). Omit for project-wide TOC. |
627
+ | `tree` | boolean | false | Return nested tree structure |
628
+ | `projectPath` | string | cwd | Project root path |
629
+
630
+ ### `kirograph_docs_search` *(requires `enableDocs: true`)*
631
+
632
+ Search documentation sections by query. Returns matching sections ranked by relevance. Independent from `kirograph_search` (code-only).
633
+
634
+ | Parameter | Type | Default | Description |
635
+ |-----------|------|---------|-------------|
636
+ | `query` | string | required | Search query (natural language or keywords) |
637
+ | `file` | string | - | Narrow search to a specific doc file |
638
+ | `limit` | number | 10 | Max results |
639
+ | `projectPath` | string | cwd | Project root path |
640
+
641
+ ### `kirograph_docs_section` *(requires `enableDocs: true`)*
642
+
643
+ Retrieve full content of a documentation section by its stable ID. Use `context=true` to also get ancestor headings and child summaries.
644
+
645
+ | Parameter | Type | Default | Description |
646
+ |-----------|------|---------|-------------|
647
+ | `id` | string | required | Section ID (from `kirograph_docs_toc` or `kirograph_docs_search` results) |
648
+ | `context` | boolean | false | Include ancestor heading chain and child summaries |
649
+ | `projectPath` | string | cwd | Project root path |
650
+
651
+ ### `kirograph_docs_outline` *(requires `enableDocs: true`)*
652
+
653
+ Get the heading hierarchy for a single documentation file. Lighter than full TOC when you know which file is relevant.
654
+
655
+ | Parameter | Type | Default | Description |
656
+ |-----------|------|---------|-------------|
657
+ | `file` | string | required | Relative path to the doc file |
658
+ | `projectPath` | string | cwd | Project root path |
659
+
660
+ ### `kirograph_docs_refs` *(requires `enableDocs: true`)*
661
+
662
+ Find code symbols referenced by a doc section, or doc sections that reference a code symbol. Bidirectional lookup.
663
+
664
+ | Parameter | Type | Default | Description |
665
+ |-----------|------|---------|-------------|
666
+ | `sectionId` | string | - | Doc section ID (find code symbols it references) |
667
+ | `nodeId` | string | - | Code symbol qualified name (find doc sections that reference it) |
668
+ | `projectPath` | string | cwd | Project root path |
669
+
534
670
  ## CLI Reference
535
671
 
536
672
  ### Setup
@@ -809,6 +945,8 @@ The `kirograph_gain` MCP tool exposes the same stats to the agent.
809
945
  | `kirograph_dead_code` | Not feasible manually (read every file) | 5× output, min 15,000 |
810
946
  | `kirograph_hotspots` | Not feasible manually (count edges for every symbol) | 5× output, min 15,000 |
811
947
  | `kirograph_architecture` | Not feasible manually | 4× output, min 7,500 |
948
+ | `kirograph_mem_search` | Re-read 3-5 files to recall past decisions + grep | ~5,800 tokens |
949
+ | `kirograph_mem_timeline` | Ask user or re-read session history | ~2,300 tokens |
812
950
 
813
951
  Constants used: 1,500 tokens per average source file (~200 lines), 800 tokens per grep result set, 2,000 tokens per directory listing. These are conservative estimates; in practice agents often read more files, retry failed searches, and explore dead ends.
814
952
 
@@ -930,6 +1068,82 @@ kirograph path --format json # JSON output
930
1068
 
931
1069
  The command resolves symbol names using the same fuzzy search as `kirograph query`, preferring real symbol kinds (class, function, method…) over import/file nodes. The result shows each hop with file and line.
932
1070
 
1071
+ ### Memory *(requires `enableMemory: true`)*
1072
+
1073
+ Persistent cross-session observations — search, store, and manage project memory from the CLI.
1074
+
1075
+ ```bash
1076
+ # Search (mirrors kirograph_mem_search)
1077
+ kirograph mem search "payment retry" # hybrid FTS + vector search
1078
+ kirograph mem search "auth bug" --kind error # filter by kind
1079
+ kirograph mem search "refactor" --limit 5 # limit results
1080
+ kirograph mem search "token" --format json # JSON output
1081
+
1082
+ # Store (mirrors kirograph_mem_store)
1083
+ kirograph mem store "decided to use idempotency keys for payments"
1084
+ kirograph mem store "auth bug: token refresh missing" --kind error
1085
+ kirograph mem store --kind decision < decision.txt # pipe from stdin
1086
+
1087
+ # Timeline (mirrors kirograph_mem_timeline)
1088
+ kirograph mem timeline # last 5 sessions
1089
+ kirograph mem timeline --limit 10 # more sessions
1090
+ kirograph mem timeline --session <id> # specific session
1091
+ kirograph mem timeline --format json
1092
+
1093
+ # Status (mirrors kirograph_mem_status)
1094
+ kirograph mem status # health dashboard
1095
+
1096
+ # Maintenance
1097
+ kirograph mem prune --older-than 90d # cleanup old observations
1098
+ kirograph mem export --format jsonl # machine-readable export (importable)
1099
+ kirograph mem export --format md # human-readable export
1100
+ kirograph mem import backup.jsonl # restore from backup (deduplicates)
1101
+ kirograph mem reembed # re-embed after model change
1102
+ kirograph mem reembed --batch 50 # control batch size
1103
+ kirograph mem lint # find stale links, model mismatch
1104
+ kirograph mem lint --fix # auto-repair issues
1105
+ ```
1106
+
1107
+ **How observations are stored:** Text → strip `<private>` blocks → caveman compress (if enabled) → SHA-256 dedup check → store → detect symbol identifiers → link to graph → embed. Zero LLM tokens.
1108
+
1109
+ **How observations surface:** `kirograph_context` and `kirograph_impact` automatically include relevant memory observations (max 3, above relevance threshold 0.3) when memory is enabled. No extra tool call needed.
1110
+
1111
+ ### Documentation *(requires `enableDocs: true`)*
1112
+
1113
+ Section-level documentation navigation — search, browse, and retrieve doc sections from the CLI.
1114
+
1115
+ ```bash
1116
+ # Table of contents
1117
+ kirograph docs toc # whole project
1118
+ kirograph docs toc README.md # single file
1119
+ kirograph docs toc README.md --tree # nested tree structure
1120
+ kirograph docs toc --json # JSON output
1121
+
1122
+ # Search (mirrors kirograph_docs_search)
1123
+ kirograph docs search "authentication"
1124
+ kirograph docs search "config" --file docs/guide.md
1125
+ kirograph docs search "install" --limit 5
1126
+
1127
+ # Retrieve a section (mirrors kirograph_docs_section)
1128
+ kirograph docs section "README.md::installation#1"
1129
+ kirograph docs section "README.md::installation#1" --context
1130
+
1131
+ # Outline (mirrors kirograph_docs_outline)
1132
+ kirograph docs outline docs/api.md
1133
+
1134
+ # Cross-references (mirrors kirograph_docs_refs)
1135
+ kirograph docs refs "docs/auth.md::oauth/token-refresh#2"
1136
+
1137
+ # Maintenance
1138
+ kirograph docs reindex # force full re-index
1139
+ kirograph docs lint # health checks (broken refs, stale sections)
1140
+ kirograph docs reembed # re-embed with current model
1141
+ ```
1142
+
1143
+ **How sections are identified:** Each section gets a stable ID in the format `{file_path}::{ancestor-chain/slug}#{level}`. IDs remain stable across re-indexing as long as the file path, heading text, heading level, and parent chain don't change.
1144
+
1145
+ **How code linking works:** When `docsLinkCode: true` (default), the indexer scans section content for backtick references (`` `functionName` ``), CamelCase identifiers, and snake_case patterns, then resolves them against the code graph. Matches are stored as `doc_code_refs` using `qualified_name` (stable across reindex).
1146
+
933
1147
  ### Graph Export
934
1148
 
935
1149
  Export the full graph as an interactive dashboard. three files served from a local directory, no server required, works offline.
@@ -1062,7 +1276,7 @@ By default, KiroGraph uses exact name lookup and full-text search. Enable semant
1062
1276
  }
1063
1277
  ```
1064
1278
 
1065
- This generates vector embeddings for all functions, methods, classes, interfaces, type aliases, components, and modules using a local embedding model (downloaded automatically to `~/.kirograph/models/` on first use). Embeddings are kept in sync automatically via Kiro hooks. on every file save, create, or delete.
1279
+ This generates vector embeddings for all functions, methods, classes, interfaces, type aliases, components, and modules using a local embedding model (downloaded automatically to `~/.kirograph/models/` on first use). Embeddings are kept in sync automatically via the Kiro `agentStop` hook, which syncs the index (including embeddings) whenever files change during a session.
1066
1280
 
1067
1281
  Run `kirograph install` to be guided through model and engine selection interactively with arrow-key menus, or set the fields manually in `.kirograph/config.json`.
1068
1282
 
@@ -1448,6 +1662,11 @@ Detected frameworks are stored in config and used to improve symbol extraction a
1448
1662
 
1449
1663
  KiroGraph is inspired by [CodeGraph](https://github.com/colbymchenry/codegraph) by [Colby McHenry](https://www.linkedin.com/in/colby-mchenry/). the original concept of building a semantic code graph for AI coding agents comes from his work.
1450
1664
 
1665
+ ### Inspirations
1666
+
1667
+ - [cavemem](https://github.com/JuliusBrussee/cavemem) by [Julius Brussee](https://www.linkedin.com/in/julius-brussee/): the memory module's hook-based observation capture, deterministic compression, and SQLite storage pattern.
1668
+ - [jDocMunch-MCP](https://github.com/jgravelle/jdocmunch-mcp) by [J. Gravelle](https://www.linkedin.com/in/j-gravelle-2778223/): the documentation module's section-first retrieval approach, stable section IDs, and byte-offset addressing.
1669
+
1451
1670
  ### Contributors
1452
1671
 
1453
1672
  - [Alessandro Franceschi](https://www.linkedin.com/in/alessandrofranceschi/). Claude Code and Codex integration, Elixir/Phoenix language and framework support.
Binary file