knodin 0.5.1 → 0.6.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 (38) hide show
  1. package/README.md +167 -535
  2. package/dist/bin/cli.js +5 -5
  3. package/dist/src/agent-integration.js +1 -15
  4. package/dist/src/artifact-refresh.js +1 -1
  5. package/dist/src/competitive-sandbox.js +4 -4
  6. package/dist/src/context-export.js +1 -1
  7. package/dist/src/docs-sections.js +5 -5
  8. package/dist/src/engine/ann-hnsw.js +5 -5
  9. package/dist/src/engine/embeddings.js +4 -4
  10. package/dist/src/engine/index.js +33 -33
  11. package/dist/src/engine/prune.js +2 -2
  12. package/dist/src/engine/symbol-delete.js +1 -1
  13. package/dist/src/index-activity.js +1 -1
  14. package/dist/src/init-progress-worker.js +1 -1
  15. package/dist/src/init.js +42 -59
  16. package/dist/src/lifecycle-health.js +10 -11
  17. package/dist/src/lsp-readonly.js +1 -1
  18. package/dist/src/output-compression.js +1 -1
  19. package/dist/src/output-telemetry.js +4 -4
  20. package/dist/src/pr-triage.js +2 -2
  21. package/dist/src/repair-progress-worker.js +1 -1
  22. package/dist/src/repository-init-process.js +1 -1
  23. package/dist/src/repository-management.js +3 -3
  24. package/dist/src/server.js +1 -1
  25. package/dist/src/system-config.js +7 -7
  26. package/dist/src/tools/knodin-tools.js +2 -2
  27. package/dist/src/update-policy.js +4 -4
  28. package/dist/src/wait-for-fresh.js +2 -2
  29. package/dist/src/worktree-lifecycle.js +2 -2
  30. package/docs/COMMAND-OUTPUT-COMPRESSION.md +1 -1
  31. package/docs/DOCTOR-AND-UPDATES.md +2 -2
  32. package/docs/INSTALLATION.md +1 -1
  33. package/docs/REPOSITORIES-AND-WORKTREES.md +1 -1
  34. package/docs/SYSTEMS-AND-RELATIONSHIPS.md +2 -2
  35. package/docs/TELEMETRY.md +2 -2
  36. package/docs/releases/0.6.0.md +18 -0
  37. package/package.json +3 -3
  38. package/dist/src/tools/reckon-tools.js +0 -5
package/README.md CHANGED
@@ -2,589 +2,221 @@
2
2
 
3
3
  <img src="https://cdn.jsdelivr.net/npm/knodin@latest/docs/assets/knodin-favicon.svg" alt="knodin caret-beak logo" width="96" height="96">
4
4
 
5
- > knodin remembers how your code is connected and shows what may move when it
6
- > changes.
7
-
8
- knodin is a native local code-intelligence engine, CLI, and one-tool MCP
9
- gateway. It persists and refreshes a repository graph, resolves symbols without
10
- hiding ambiguity, and delivers source-evidenced impact analysis, review,
11
- architecture maps, hybrid search, bounded context export, and lifecycle
12
- health/repair behind one compact local tool.
13
-
14
- | Command | Job | Modeled on |
5
+ > Local code intelligence that remembers how your code connects—and shows what
6
+ > may move before you change it.
7
+
8
+ knodin builds and continuously refreshes a local graph of an existing codebase.
9
+ Engineers and coding agents use it to understand unfamiliar code, find affected
10
+ dependencies, review changes, search by meaning or name, and assemble bounded
11
+ source context without sending source code to a hosted service.
12
+
13
+ It ships as one CLI and one operation-routed MCP tool. There is no account,
14
+ hosted index, authentication flow, source egress, or separate database service.
15
+
16
+ ## Why use knodin?
17
+
18
+ A code change usually starts with repeated manual work: find the definition,
19
+ read its callers, inspect dependencies, locate tests, understand the diff, and
20
+ assemble enough source for the next decision. knodin composes those steps over
21
+ one persistent local graph.
22
+
23
+ - **Understand before editing:** resolved symbols, verbatim source, call paths,
24
+ architecture communities, and execution flows.
25
+ - **See potential impact:** upstream and downstream relationships, affected
26
+ tests, changed symbols, review risk, and explicit ambiguity.
27
+ - **Give agents better context:** hybrid search and deterministic source packs
28
+ with hard line, byte, and token budgets.
29
+ - **Keep evidence trustworthy:** source locations, graph freshness, lifecycle
30
+ health, repair commands, and truthful truncation metadata.
31
+ - **Adopt locally:** initialize the checkout you already have and use the CLI or
32
+ connect one MCP gateway.
33
+
34
+ The practical payoff is less manual context assembly, fewer agent round trips,
35
+ and fewer dependencies missed during review—with no hosted-service or
36
+ source-egress overhead.
37
+
38
+ ## How it compares
39
+
40
+ Code-intelligence tools often specialize in one part of the workflow. knodin
41
+ combines navigation, impact analysis, architecture, retrieval, and bounded
42
+ context over one locally persisted index.
43
+
44
+ | Job | Typical specialized tools | knodin |
15
45
  |---|---|---|
16
- | `knodin explain <symbol>` | edit-ready verbatim source + call paths + blast radius | codegraph |
17
- | `knodin review [base] [--scope unstaged\|staged\|all\|compare]` | risk-scored context for a selected diff; always reports changed files separately from mapped symbols | code-review-graph |
18
- | `knodin map` | subsystems (communities) + confidence-tagged edges | Graphify |
19
-
20
- For context efficiency, `knodin pack` exports bounded source and
21
- `knodin compress` reduces already-produced build/test logs under hard line and
22
- UTF-8 byte budgets. Compression preserves exit metadata and detected
23
- diagnostics, reports exact omissions, and retains private local drill-down
24
- without running a command. A retained failure can then be mapped to owning
25
- symbols and packages, related tests, callers, dependencies, recent changes,
26
- bounded source, and exact graph freshness with
27
- `knodin compress diagnose <artifact-id>`. See the
28
- [compression and command-security contract](docs/COMMAND-OUTPUT-COMPRESSION.md).
29
-
30
- Its core graph runs **locally, with no auth** through standard CLI and MCP
31
- interfaces. A generic JSON-RPC handshake is tested; named-client compatibility
32
- is limited to the adapters and environments actually exercised. The optional
33
- `prs` operation delegates to the user's authenticated `gh` CLI. An external gateway such as
34
- an organization’s existing MCP gateway can optionally federate it; that
35
- integration is not required for knodin’s engine, CLI, or MCP server.
36
-
37
- ## Show me the value
38
-
39
- knodin is for an engineer or coding agent about to change unfamiliar code. It
40
- answers three practical questions before the edit:
41
-
42
- 1. **What does this code do?** Read-ready source and resolved relationships
43
- orient the next investigation.
44
- 2. **What else could this change affect?** Diff scope, typed traversal, and
45
- bounded impact evidence make the review surface explicit.
46
- 3. **Can I adopt it tomorrow?** Run one local CLI or MCP gateway against the
47
- existing repository from this source checkout or a locally built package—no
48
- account, hosted index, source egress, or workflow migration.
49
-
50
- The intended value is not “AI code intelligence.” It is fewer missed
51
- dependencies and less manual context assembly in the orient → edit → review
52
- loop. Those human/agent outcomes have not yet been established by an end-to-end
53
- controlled study; checked-in replays measure narrower correctness, latency,
54
- response-size, and retrieval outcomes. The engine,
55
- CLI, and MCP gateway are implemented today; knodin reports only outcomes that
56
- its checked-in fixtures and replays support. See
57
- [`roadmap/competitive-roadmap.md`](roadmap/competitive-roadmap.md) for the
58
- current evidence and known gaps.
59
-
60
- ## What is the ROI?
61
-
62
- knodin compresses repeated “find the definition, read it, find callers, inspect
63
- the diff, locate tests” work into bounded, source-evidenced calls. That means
64
- fewer agent round trips, less duplicated context, and fewer changes reviewed
65
- without their reachable dependencies. Operationally, it is one local process
66
- with no account, hosted index, credential flow, source egress, or mandatory
67
- database/vector daemon. ROI is measured in correctness, latency, response size,
68
- safety, and effort by the checked-in replay harness—not an unsupported generic
69
- productivity percentage.
70
-
71
- ## Where does knodin compete?
72
-
73
- There is no canonical industry standard that divides code-intelligence products
74
- into exactly four categories. Current products overlap. Their primary jobs do,
75
- however, fall into four useful categories when deciding what to give an engineer
76
- or coding agent:
77
-
78
- | Category | Question it answers | Representative tools | knodin surface |
79
- |---|---|---|---|
80
- | **Symbol navigation and graph exploration** | Where is this symbol, what calls it, and what does it call? | [CodeGraph](https://github.com/colbymchenry/codegraph), [Serena](https://github.com/oraios/serena), [Sourcegraph code navigation](https://sourcegraph.com/docs/code-navigation) | `explain`, `query callers_of` / `callees_of`, `shortest_path`, LSP queries |
81
- | **Change impact and code review** | What can this diff affect, how risky is it, and where are the test gaps? | [code-review-graph](https://github.com/tirth8205/code-review-graph), [Greptile](https://www.greptile.com/docs/introduction), Graphify’s [PR-impact tools](https://graphify.com/mcp) | `review`, `impact`, `traverse`, `tests_for`, `prs` |
82
- | **Architecture and dependency mapping** | What are the subsystems, hubs, boundaries, and execution flows? | [Graphify](https://graphify.com/concepts), [GitNexus](https://github.com/abhigyanpatwari/GitNexus) | `map`, `architecture_overview`, `community`, `flows`, `wiki`, `visualize` |
83
- | **Retrieval and context assembly** | Which code or diagnostic evidence should the agent receive for this task and token budget? | [Aider repo map](https://aider.chat/docs/repomap.html), [Repomix](https://repomix.com/guide/), semantic-search/context engines | `context`, hybrid `search`, bounded `pack`, recoverable `compress` |
84
-
85
- This is a job-based taxonomy, not a claim that every product fits only one box.
86
- CodeGraph and Graphify now expose impact features, for example, while
87
- Sourcegraph combines search and precise navigation. knodin competes by composing
88
- all four jobs over one fresh local index and exposing them through one CLI and
89
- one operation-routed MCP tool. Breadth alone is not proof of superiority; the
90
- [comparison notes](docs/COMPARISON.md) and
91
- [competitive roadmap](roadmap/competitive-roadmap.md) distinguish checked-in
92
- replays, attributed vendor claims, setup blockers, and known limitations.
93
- The [Token Optimizer scorecard](docs/TOKEN-OPTIMIZER-SCORECARD.md) gives the
94
- evidence-linked disposition for every pinned capability and records where
95
- knodin is still weaker or intentionally different.
96
-
97
- Static application-security products such as
98
- [CodeQL](https://codeql.github.com/docs/codeql-overview/about-codeql/) and
99
- [Semgrep](https://semgrep.dev/docs/) are adjacent, not substitutes: knodin can
100
- report structural dead-code candidates and selected diagnostics, but it is not
101
- a SAST engine or a proof that dynamically wired code is unreachable. That
102
- distinction matters for framework and Salesforce entrypoints that static
103
- analysis may not fully resolve.
104
-
105
- ## What happens tomorrow?
106
-
107
- Public npm remains the primary cross-platform path. The commands below become
108
- canonical when the first `knodin` release is published. Existing
109
- `reckon-graph` installs continue to work through the legacy package and
110
- `reckon` executable alias. Homebrew and GHES paths remain on their legacy names
111
- until those external repositories are renamed and their knodin artifacts pass
112
- the release gates.
113
-
114
- On Windows, macOS, or Linux with Node.js 24 or newer, install the public
115
- [npm package](https://www.npmjs.com/package/knodin):
46
+ | Symbol navigation | CodeGraph, Serena, Sourcegraph | Ambiguity-safe definitions, callers, callees, paths, and verbatim source |
47
+ | Change impact and review | code-review-graph, Greptile, Graphify | Diff-aware review, impact traversal, tests, risks, and PR triage |
48
+ | Architecture mapping | Graphify, GitNexus | Communities, hubs, boundaries, flows, wiki, and local visualization |
49
+ | Search and context assembly | Aider repo map, Repomix, semantic search tools | Hybrid search, bounded source packs, and recoverable diagnostic compression |
50
+ | Deployment | Hosted services or separate local tools | One local process, SQLite graph, CLI, and one MCP gateway |
51
+
52
+ ### Measured results
53
+
54
+ On the checked-in Token Optimizer replay, knodin passed the shared correctness
55
+ oracle for all five safe structural workflows while using fewer real tokens and
56
+ running faster at warm p50 and p95 in every case:
57
+
58
+ | Workflow | Tokens (knodin vs competitor) | Warm p50 (knodin vs competitor) | Result |
59
+ |---|---:|---:|---:|
60
+ | File outline | 56 vs 64 | 0.203 vs 0.478 ms | 2.4× faster |
61
+ | Exact symbol source | 33 vs 37 | 0.258 vs 0.419 ms | 1.6× faster |
62
+ | Symbol search | 76 vs 84 | 0.227 vs 1.112 ms | 4.9× faster |
63
+ | Batch outline | 331 vs 377 | 0.184 vs 1.387 ms | 7.5× faster |
64
+ | Project overview | 14 vs 127 | 0.135 vs 0.589 ms | 4.4× faster, 89% fewer tokens |
65
+
66
+ Across the broader checked-in competitive replay, knodin was faster in 488 of
67
+ 713 paired cases (68.4%). It did not win every workload: competitors won 225
68
+ cases, including the aggregate warm-latency result for several packing and
69
+ memory tools. Cold startup is also slower in the Token Optimizer comparison.
70
+
71
+ These are fixture-scoped measurements, not estimates. See the
72
+ [replay synthesis](benchmarks/competitors/SYNTHESIS.md),
73
+ [scorecard](docs/TOKEN-OPTIMIZER-SCORECARD.md), and raw benchmark artifacts for
74
+ methods, pinned revisions, correctness oracles, and limitations.
75
+
76
+ This table describes product scope, not a universal superiority claim. Product
77
+ capabilities overlap, and static analysis has limits in dynamically wired or
78
+ framework-driven code. The [comparison notes](docs/COMPARISON.md) separate
79
+ checked-in measurements, vendor claims, setup blockers, and known gaps. The
80
+ [competitive roadmap](roadmap/competitive-roadmap.md) records remaining
81
+ limitations.
82
+
83
+ ## Install
84
+
85
+ knodin requires Node.js 24 or newer.
116
86
 
117
87
  ```bash
118
88
  npm install --global --ignore-scripts knodin
119
89
  ```
120
90
 
121
- After the Homebrew tap migration, the macOS or Linux path will be:
91
+ Initialize an existing repository:
122
92
 
123
93
  ```bash
124
- brew install knodin/tap/knodin
94
+ cd /path/to/repository
95
+ knodin init
96
+ knodin status --deep
125
97
  ```
126
98
 
127
- pnpm, Bun, mise, Volta, nvm, fnm, and asdf behavior and verification status are
128
- listed in the installation matrix. Commands without a recorded release gate
129
- are guidance, not verified support:
99
+ `knodin init` builds the local graph, installs lifecycle hooks, and can configure
100
+ detected coding agents. Choose an integration scope explicitly when needed:
130
101
 
131
102
  ```bash
132
- pnpm add --global --ignore-scripts knodin@<version>
133
- bun add --global --ignore-scripts knodin@<version>
103
+ knodin init --scope personal # local configuration; keeps the repo clean
104
+ knodin init --scope team # commit-ready shared agent configuration
105
+ knodin init --scope cli-only # graph and CLI without agent configuration
134
106
  ```
135
107
 
136
- Temporary runners are not suitable for the stable hook and MCP command paths
137
- created by `knodin init`. See the [installation guide](docs/INSTALLATION.md)
138
- for verified status, Node/version-manager behavior, registries, Homebrew,
139
- upgrades, and uninstall commands.
108
+ See the [installation guide](docs/INSTALLATION.md) for package-manager details,
109
+ managed registries, upgrades, and uninstall instructions.
140
110
 
141
- P&T engineers without GitHub SaaS access can continue using the current GHES
142
- mirror until the knodin path is promoted. See the
143
- [P&T GHES procedure](docs/PT-ACCESS-RECOMMENDATION.md) for the migration gate.
111
+ ## First workflow
144
112
 
145
- Then initialize an existing checkout:
113
+ Start broad, inspect the likely change surface, then review the actual diff:
146
114
 
147
115
  ```bash
148
- cd /path/to/repository
149
- knodin init
116
+ # Orient on an unfamiliar checkout
117
+ knodin context
118
+
119
+ # Explain a symbol with source and relationships
120
+ knodin explain createServer
121
+
122
+ # Find what depends on it
123
+ knodin query impact createServer --direction upstream
124
+
125
+ # Review current changes
126
+ knodin review --scope all
150
127
  ```
151
128
 
152
- On an interactive terminal, `knodin init` asks how agent integration should be
153
- scoped and configures all detected supported agents in one operation:
154
-
155
- - **Personal (recommended):** configures local Claude Code, Codex, Gemini CLI,
156
- and Antigravity adapters when detected. knodin-owned untracked files are
157
- listed in `.git/info/exclude`, so the repository stays clean and teammates
158
- are not required to install knodin.
159
- - **Team:** creates merge-safe, commit-ready MCP configuration for the primary
160
- agents in `.mcp.json`, `.codex/config.toml`, `.gemini/settings.json`, and
161
- `.agents/mcp_config.json`, plus managed instruction blocks in `AGENTS.md` and
162
- `GEMINI.md`. Commit these files so every supported agent sees the same
163
- gateway. Repeated team initialization is byte-idempotent once they are
164
- current.
165
- - **CLI-only:** builds and refreshes the graph but does not configure agents.
166
- Agents will generally not discover or invoke knodin; commands must be run
167
- manually.
168
-
169
- Non-interactive initialization defaults to `personal`. Select explicitly or
170
- change the choice later:
129
+ For discovery and bounded context:
171
130
 
172
131
  ```bash
173
- knodin init --scope personal
174
- knodin configure --scope team
175
- knodin configure --scope cli-only
176
- knodin configure --status
132
+ knodin search "authentication middleware"
133
+ knodin map
134
+ knodin pack createServer --max-tokens 4000
177
135
  ```
178
136
 
179
- Scope changes are reversible and modify only knodin-owned configuration.
180
- Before adding any exclusion, knodin verifies that the path is untracked.
181
- Already-tracked files are never added to `.git/info/exclude` or `.gitignore`,
182
- and personal mode never overwrites tracked agent configuration.
183
-
184
- The package is public on npm, and consumers do not need Bun. Organizations may
185
- also mirror it through an approved npm-compatible registry without changing the
186
- CLI workflow. To test an unpublished change, build and install the exact tarball
187
- from a source checkout:
137
+ If freshness or lifecycle checks fail:
188
138
 
189
139
  ```bash
190
- npm ci
191
- TARBALL=$(npm pack --silent)
192
- npm install --global --ignore-scripts "./$TARBALL"
193
- cd /path/to/repository
194
- knodin init
140
+ knodin status --deep
141
+ knodin repair
195
142
  ```
196
143
 
197
- ### About npm install warnings
198
-
199
- knodin’s standard CPU workflow is verified with dependency lifecycle scripts
200
- disabled. The `--ignore-scripts` flag makes that policy explicit and avoids
201
- prompting users to approve transitive install code they do not need. The native
202
- CPU binaries used by knodin are already supplied as platform packages.
144
+ ## What it does
203
145
 
204
- Without that flag, recent npm releases may report blocked scripts from
205
- `onnxruntime-node`, `sharp`, and `protobufjs`. Do not approve them blindly for a
206
- normal knodin installation. ONNX Runtime’s script can fetch optional Linux x64
207
- CUDA components; Sharp’s checks whether it needs a local source build; and
208
- ProtobufJS performs a dependency-version compatibility check. None is required
209
- by knodin’s verified CPU path.
146
+ | Command | Purpose |
147
+ |---|---|
148
+ | `knodin context` | Compact repository orientation and next-operation hint |
149
+ | `knodin explain <symbol>` | Source, identity, callers, callees, and blast radius |
150
+ | `knodin review` | Diff-aware risks, changed symbols, affected flows, and test gaps |
151
+ | `knodin query …` | Impact, paths, callers, callees, tests, flows, and structured graph queries |
152
+ | `knodin search <query>` | Hybrid semantic and keyword symbol search |
153
+ | `knodin map` | Subsystems, communities, hubs, bridges, and boundaries |
154
+ | `knodin pack …` | Deterministic source context under hard budgets |
155
+ | `knodin compress …` | Bounded diagnostic output with recoverable local detail |
156
+ | `knodin prs` | Open-PR triage using the authenticated local `gh` CLI |
157
+ | `knodin wiki` | Static Markdown architecture documentation |
158
+ | `knodin visualize` | Self-contained local graph visualization |
159
+ | `knodin status --deep` | Index freshness, health, hooks, and integration status |
160
+ | `knodin repair` | Repair or rebuild unhealthy local graph state |
210
161
 
211
- You may also see a deprecation notice for `boolean@3.2.0`. It is an upstream
212
- transitive dependency in the current
213
- `@huggingface/transformers → onnxruntime-node → global-agent` chain, not a
214
- package knodin calls directly. A deprecation notice is not by itself a
215
- vulnerability, but it is dependency debt that must be removed when the upstream
216
- runtime pin permits it. Use `npm audit --omit=dev` to check the installed
217
- production tree for current advisories.
162
+ Run `knodin --help` or read the [CLI reference](docs/CLI.md) for complete syntax.
218
163
 
219
- The package is verified for npm tarball consumption; registry publication is a
220
- separate release action documented in the
221
- [release runbook](docs/RELEASING.md). Use the CLI directly or connect the
222
- single `knodin` MCP gateway. The first useful calls are:
164
+ ## MCP
223
165
 
224
- - `knodin status --deep` to verify index health and coverage;
225
- - `knodin context "<task>"` for bounded orientation;
226
- - `knodin explain <symbol>` before an edit;
227
- - `knodin review --scope all` before review or handoff;
228
- - `knodin map`, `search`, and `query` for architecture and targeted graph facts.
166
+ `knodin init` configures supported agents automatically. A manual MCP
167
+ configuration uses one local server:
229
168
 
230
- No workflow migration or hosted rollout is required.
169
+ ```json
170
+ {
171
+ "mcpServers": {
172
+ "knodin": {
173
+ "command": "knodin",
174
+ "args": ["serve"]
175
+ }
176
+ }
177
+ }
178
+ ```
231
179
 
232
- Dependency provenance, blocked-script behavior, and the scheduled upstream
233
- deprecation canary are documented in
234
- [`docs/dependency-hygiene.md`](docs/dependency-hygiene.md).
180
+ The gateway exposes one `knodin` tool whose `operation` selects context,
181
+ explain, review, map, search, query, pack, compress, PR, wiki, telemetry,
182
+ repository, and lifecycle capabilities. See the [MCP guide](docs/MCP.md).
235
183
 
236
- ### Verify the locally built distributable package
184
+ ## Local data and privacy
237
185
 
238
- Before tagging or publishing a release, run the clean-consumer acceptance
239
- gate:
186
+ Each checkout stores its graph and lifecycle state in `.knodin/`. Shared model
187
+ files live in the user cache rather than being duplicated per repository.
188
+ Source and graph data stay local. Telemetry is metadata-only, disabled by
189
+ default, and never sent by knodin.
240
190
 
241
- ```bash
242
- npm run test:pack-install
243
- ```
191
+ The optional `prs` command invokes the user's authenticated `gh` CLI. Network
192
+ access may also occur when installing packages, downloading the configured
193
+ embedding model, or explicitly checking for updates.
244
194
 
245
- The gate requires Node.js 24+, npm, `git`, `tar`, `ps`, and `expect` on the
246
- release host. It creates a real `npm pack` tarball, checks its compiled CLI, engine,
247
- MCP gateway, license, metadata, and parser WASMs, and installs that exact
248
- artifact globally under a temporary prefix with an isolated npm cache and a
249
- `PATH` that contains no Bun executable. It runs `knodin init` in two repositories,
250
- then exercises foreground
251
- post-commit, post-checkout, post-merge, and post-rewrite refreshes across
252
- TypeScript and Salesforce source/metadata. It also checks deep index health,
253
- graph query evidence, rename/deletion reconciliation, and repair output stream
254
- separation for plain, JSON, JSONL, silent, and automatic TTY progress modes. A
255
- real JSON-RPC initialize plus `tools/list` handshake proves that the packed MCP
256
- server exposes the single `knodin` gateway.
257
-
258
- Every child command is sequential and bounded by time, output, and a 2,750 MiB
259
- aggregate process-tree RSS safety limit that includes the runner, command,
260
- descendants, and sampler. Limit failures terminate the command process group.
261
- The temporary artifact, cache, consumer checkout, and local graph are removed
262
- whether the gate passes or fails. A passing run prints one JSON evidence record
263
- containing tarball size, command time, and observed peak RSS.
264
-
265
- This proves the exact locally built tarball. It does not claim registry
266
- publication, remote release upload, or compatibility beyond the environments
267
- covered by the gate.
268
-
269
- ### Model and repository storage
270
-
271
- Each checkout keeps its graph in `.reckon/db.sqlite`. The local
272
- `Xenova/all-MiniLM-L6-v2` model is downloaded once per user account into the
273
- machine cache and shared by every repository:
274
-
275
- - macOS: `~/Library/Caches/knodin/models`
276
- - Linux: `${XDG_CACHE_HOME:-~/.cache}/knodin/models`
277
- - Windows: `%LOCALAPPDATA%\knodin\models`
278
-
279
- Set `RECKON_MODEL_CACHE` to use a different shared location. Repository
280
- initialization never places a duplicate model inside `.reckon` or the installed
281
- npm package. Managed networks can set `RECKON_MODEL_HOST` to an approved
282
- HTTP(S) mirror of the Hugging Face repository; the mirror is used only when the
283
- shared cache is cold.
284
-
285
- ### Language and metadata support
286
-
287
- knodin does not claim universal programming-language support. Its native parser
288
- set currently covers TypeScript, JavaScript, Python, Java, C#, Apex, SQL/PLSQL,
289
- Prisma, and XML-backed formats. It also has specialized structural indexers for
290
- Salesforce source and selected metadata, Terraform/HCL, Dockerfiles, dbt
291
- manifests, Workday Studio XML, and LSIF graph imports.
292
-
293
- Coverage is not identical across those formats, and a file being parseable does
294
- not imply every dynamic dependency can be resolved. Go, Rust, PHP, Ruby, Kotlin,
295
- Swift, Perl, PowerShell, Bash, and MuleSoft/RAML are among the currently known
296
- native-parser gaps. See the
297
- [language and metadata support matrix](docs/LANGUAGE-SUPPORT.md) for exact
298
- extensions, capability tiers, Salesforce limitations, and the evidence-based
299
- Docusign coverage assessment.
300
-
301
- ## What makes knodin unique? What is the secret sauce?
302
-
303
- Individual graph features are easy to copy. knodin’s differentiator is the
304
- combination of stable symbol resolution, source-evidenced review/impact answers,
305
- truthful response budgets, explicit freshness, and a local one-tool MCP surface.
306
- The native engine composes those constraints across orientation, editing,
307
- review, architecture, search, and export. That system-level combination—not a
308
- single algorithm—is the secret sauce. It must remain measurable,
309
- privacy-preserving, and compatible with ordinary Git and editor workflows.
310
-
311
- ## Why an agent picks this over grep
312
-
313
- One MCP tool with operation-routed capabilities, no account to create and
314
- nothing sent off the machine—versus a Grep/Read loop, or a competitor that pays
315
- a much larger fixed context cost every session for tools it may never call. See
316
- [`docs/COMPARISON.md`](docs/COMPARISON.md) for the honest, claim-attributed
317
- comparison against codegraph, code-review-graph, graphify, and the wider field.
318
-
319
- ### Review diff selection
320
-
321
- `review` supports four explicit scopes: `unstaged` compares the index to the
322
- working tree (and includes untracked files), `staged` compares `HEAD` to the
323
- index, `all` compares the supplied base through the complete working tree, and
324
- `compare` compares the supplied base (default `HEAD~1`) to `HEAD`. The legacy
325
- `knodin review [base]` call remains compatible and maps to `scope=all`.
326
-
327
- For a checkout-independent review, use `--from <older> --to <newer>` for an
328
- explicit revision pair, or `--files <a,b>` for an explicit repo-relative file
329
- list. MCP callers use `diffScope`, `from`/`toRevision`, and `reviewFiles`.
330
- Results return `changedFiles` for every path plus `mappedChangedFiles`,
331
- `unmappedChangedFiles`, and truthful counts; symbol analysis remains separate in
332
- `changedSymbols`.
333
-
334
- Capability alone does not win the routing decision. The compact always-on tool
335
- description distinguishes orientation and graph work from exact literals,
336
- non-code files, and recent edits where direct reads win. Full operation and
337
- parameter guidance is retrieved on demand with
338
- `{ "operation": "docs", "section": "quickstart" }`. See
339
- [`src/tools/knodin-tools.ts`](src/tools/knodin-tools.ts) for the exact text an
340
- agent sees.
341
-
342
- ## Status and proof
343
-
344
- The native local engine, CLI, and MCP gateway are implemented and covered by
345
- hundreds of tests and labeled replays. Competitive leadership claims are
346
- narrower: symbol identity, diff/traversal, architecture, and context-packing
347
- replays are complete. C28's frozen replay records stronger dead-code precision
348
- and semantic relevance than pinned GitNexus on the shared oracle. C31's pinned
349
- codebase-memory and grepai lifecycle replay covers stale-state detection,
350
- documented refresh, healthy-symbol preservation, and native telemetry gaps;
351
- Claude Context remains a separately classified setup blocker. C32's bounded
352
- local API and statement-flow replay found no broader production-surface gap.
353
- Local graph-artifact freshness across checkout and merge events is implemented
354
- with bounded, auditable refresh states. See the
355
- [competitive roadmap](roadmap/competitive-roadmap.md) and
356
- [comparison notes](docs/COMPARISON.md) for the evidence rather than relying on
357
- feature lists.
358
-
359
- ### Refresh optional graph artifacts
360
-
361
- `knodin refresh-artifacts checkout|merge|code-change` is an explicit local
362
- maintenance command for installed GitNexus and Graphify indexes. It prefers the
363
- repository's GitNexus runner when present, bounds each rebuild to 30 seconds,
364
- and records every artifact as `success`, `failed`, or `skipped` in
365
- `.reckon/artifact-refresh.jsonl`. It never runs from a commit hook and never
366
- reports an unavailable external index as fresh.
367
-
368
- ## Stack
369
-
370
- Node.js 24+ · TypeScript · Node SQLite · `@modelcontextprotocol/sdk` · Zod ·
371
- Biome · Vitest · lefthook.
372
- Tools are registered via the low-level request-handler API (never the high-level
373
- `server.tool()` overload — see `CLAUDE.md`).
195
+ ## Evidence and limitations
374
196
 
375
- ## License
197
+ knodin reports ambiguity, stale indexes, incomplete language coverage, and
198
+ budget truncation instead of presenting uncertain results as complete. Its
199
+ checked-in tests and competitive replays measure narrower correctness, latency,
200
+ retrieval, and response-size outcomes; they do not establish a universal
201
+ productivity percentage or superiority over every competing product.
376
202
 
377
- knodin is open-source software licensed under the
378
- [MIT License](LICENSE). You may use, copy, modify, merge, publish, distribute,
379
- sublicense, and sell copies subject to the license terms.
203
+ - [Status and evidence](docs/HANDOFF.md)
204
+ - [Comparison notes](docs/COMPARISON.md)
205
+ - [Competitive landscape](docs/COMPETITIVE-LANDSCAPE-2026-08.md)
206
+ - [Competitive roadmap and limitations](roadmap/competitive-roadmap.md)
207
+ - [Systems and relationships](docs/SYSTEMS-AND-RELATIONSHIPS.md)
208
+ - [Command-output compression](docs/COMMAND-OUTPUT-COMPRESSION.md)
380
209
 
381
210
  ## Develop
382
211
 
383
212
  ```bash
384
213
  npm ci
385
- npm run dev
386
- npm run cli -- map
387
- npm run cli -- visualize createServer --output .reckon/architecture.html --depth 3
214
+ npm run build
388
215
  npm test
389
- npm run test:handles
390
216
  npm run lint
391
217
  npm run typecheck
392
- npm run test:pack-install
393
- ```
394
-
395
- For the additional local SonarQube quality gate, see
396
- [docs/SONARQUBE.md](docs/SONARQUBE.md). It uses a project-scoped token outside
397
- Git and distinguishes the SonarQube CLI from the full repository scanner.
398
-
399
- ## Use as an MCP server
400
-
401
- The installed package exposes a stdio MCP server through `knodin serve`.
402
- `knodin init` registers it for detected clients according to the selected
403
- scope. Manual registration remains available for unsupported clients or
404
- custom setups. The server advertises exactly one top-level tool named
405
- `knodin`, with capabilities selected by its `operation` argument.
406
- For clients that accept the common `mcpServers` JSON shape:
407
-
408
- ```json
409
- {
410
- "mcpServers": {
411
- "knodin": {
412
- "command": "knodin",
413
- "args": ["serve"]
414
- }
415
- }
416
- }
417
218
  ```
418
219
 
419
- If the client does not inherit the interactive shell's `PATH`, replace
420
- `"knodin"` with the absolute path printed by `command -v knodin`. From this
421
- source checkout, an uninstalled development fallback is:
422
-
423
- ```json
424
- {
425
- "mcpServers": {
426
- "knodin": {
427
- "command": "node",
428
- "args": ["/absolute/path/to/knodin/dist/bin/cli.js", "serve"]
429
- }
430
- }
431
- }
432
- ```
220
+ ## License
433
221
 
434
- Run `npm run build` in the source checkout before using that compiled fallback.
435
-
436
- After registration, an MCP `tools/list` call returns the single `knodin`
437
- gateway. Its operations include `context`, `explain`, `review`, `map`,
438
- `search`, `query`, `prs`, `wiki`, `docs`, `pack`, `status`, `repair`, and
439
- `telemetry`. The `prs` operation uses the caller's local authenticated `gh`
440
- CLI; knodin stores no GitHub credentials.
441
-
442
- ## Response budgets
443
-
444
- Every gateway operation is bounded after JSON serialization and returns a
445
- `responseBudget` block with the effective byte/token/item limits, serialized
446
- size, estimated tokens, original collection totals, truncation state, and a
447
- continuation instruction. Token estimates are deterministic: four serialized
448
- UTF-8 bytes per token. Callers may override `byteBudget`, `tokenBudget`, and
449
- `itemBudget`; the tightest limit wins. The minimum accepted envelope is 256
450
- bytes (64 estimated tokens). Defaults are 64 KiB/16K tokens/100 items,
451
- with operation-specific ceilings of 16 KiB for minimal explain, 32 KiB for
452
- minimal map, 64 KiB for standard explain, and 128 KiB for standard map.
453
- The CLI exposes the same envelope on every JSON command as `--bytes`,
454
- `--tokens`, and `--items`; its compact JSON output is the exact serialization
455
- used for accounting. `knodin search <query> [limit]` remains supported, with
456
- `--limit` taking precedence when both forms are present.
457
-
458
- Minimal explain omits source by default; pass `includeSource: true` to request
459
- it. Standard explain retains edit-ready source and, if a requested budget is
460
- too small, reports an explicit continuation instead of silently dropping it.
461
- Minimal map contains only counts, aggregates, and bounded top summaries: it
462
- does not return community member arrays or full edge lists.
463
-
464
- `knodin status` audits the local index schema, embedding model, package
465
- version, file/symbol coverage, missing and orphaned records, and last successful
466
- reconciliation. It also verifies that active Git hooks still route to knodin's
467
- background indexer and records the last failed background execution. A healthy
468
- snapshot with displaced hooks or a failed refresh command carries explicit
469
- `lifecycle-degraded` availability metadata, with `.reckon/indexer.log` named
470
- for diagnosis. Graph reads may continue from an otherwise complete index while
471
- preserving that degraded freshness state. `knodin repair` rebuilds only damaged or missing state and then
472
- verifies it, preserving healthy data. MCP exposes the same `status` and
473
- `repair` operations. The MCP `telemetry` operation reads the process-local,
474
- metadata-only benchmark log (operation, latency, serialized bytes, estimated
475
- tokens, truncation, and detail mode) without changing existing response shapes.
476
- Persistence is off by default; `persistTelemetry: true`
477
- explicitly appends source-free records to `.reckon-telemetry.jsonl`. No telemetry
478
- or source is sent over the network.
479
-
480
- Graph reads never turn missing health evidence into an ordinary empty answer.
481
- CLI and MCP results distinguish `no-match`, `not-initialized`,
482
- `empty-repository`, `empty-index`, `repair-needed`, `indexing`,
483
- `lifecycle-degraded`, and `unknown`. Unavailable states fail closed with
484
- remediation; a queryable but lifecycle-degraded graph retains that state in its
485
- availability metadata.
486
-
487
- ### Repository and system management
488
-
489
- `knodin repos discover|init|status|doctor <root...>` manages local checkouts
490
- without declaring them one system. Linked worktrees require the explicit
491
- `--linked-worktrees=include` option. Main worktrees, linked worktrees, nested
492
- repositories, stale metadata, and unrelated repositories remain distinct.
493
- `knodin repos search "<query>" --root <path>` searches those independent
494
- checkouts sequentially under hard item/token/byte budgets. It fails closed for
495
- unhealthy selected graphs unless `--allow-partial` is explicit, in which case
496
- every omission is named.
497
- `knodin fleet init` is a deprecated JSON-safe compatibility alias for two minor
498
- releases.
499
-
500
- Team-owned stable identities and cooperating components belong in
501
- `reckon.yaml`; personal checkout paths belong under XDG configuration. Use
502
- `knodin system list|show|validate|query`. See:
503
-
504
- - [Repositories and worktrees](docs/REPOSITORIES-AND-WORKTREES.md)
505
- - [Systems and relationships](docs/SYSTEMS-AND-RELATIONSHIPS.md)
506
- - [Indexing policy and provenance](docs/INDEXING-POLICY-AND-PROVENANCE.md)
507
- - [Dead code and impact](docs/DEAD-CODE-AND-IMPACT.md)
508
- - [MCP configuration](docs/MCP.md)
509
- - [Doctor and updates](docs/DOCTOR-AND-UPDATES.md)
510
-
511
- `knodin init` and `knodin index` render phase-aware, asynchronous progress on
512
- stderr, so terminal animation and elapsed time continue even while parsing or
513
- embedding keeps the main process busy. An explicit `knodin index <files...>`
514
- updates only files whose indexed snapshots differ from disk; files made current
515
- by a preceding repair finish immediately. Use `--force` only when an unchanged
516
- file truly needs rebuilding. Every index run ends with a forced graph-health
517
- audit. If an explicit file list omitted other repository drift, the command
518
- names the first remaining issue and exits nonzero instead of allowing a chained
519
- review to consume an unhealthy graph. `knodin init` enforces the same verified
520
- postcondition: lifecycle hooks may be installed, but initialization does not
521
- report success when graph issues remain. Human `status` and initialization
522
- errors name the first concrete inconsistency before directing the user to
523
- `knodin repair`. When Lefthook is present, initialization keeps its generated
524
- hook jobs active while disabling their implicit hook reinstall, so they do not
525
- replace knodin's lifecycle wrappers. Repair scopes stable-identity and reference
526
- rebinding to repaired files and reports embedding candidates as they complete,
527
- while the final human summary remains on stdout.
528
-
529
- For a Git checkout, full indexing, reconciliation, deep status, and repair use
530
- the same source universe: tracked files plus unignored untracked files. Generated
531
- files excluded by Git are not counted as missing coverage, and legacy indexed
532
- rows that have since become ignored are removed during reconciliation or repair.
533
-
534
- `knodin refresh-artifacts [checkout|merge|code-change]` is an explicit opt-in
535
- refresh for locally installed GitNexus and Graphify indexes. Each rebuild is
536
- bounded to 30 seconds and records only success, failure, or skipped metadata in
537
- `.reckon/artifact-refresh.jsonl`; it never runs from a commit hook.
538
-
539
- Search supports composable `languages`, `extensions`, `kinds`, `path`,
540
- `testScope`, and `includeSource` filters. Its paged response contains
541
- `results`, `total`, `offset`, `limit`, and `hasMore`; use `offset` to continue.
542
- Large-code queries accept `minLines`, `minComplexity`, `kinds`, and `path`.
543
-
544
- `knodin pack` creates portable Markdown, JSON, or XML source context with
545
- deterministic relative-path ordering and an explicit local four-bytes-per-token
546
- cost estimate. Includes, excludes, already-present/chat-file suppression, and
547
- per-glob `full`, `summary`, or `structure-only` policies compose under hard byte
548
- and token limits. Optional line numbers, a file tree, C5-compatible Git diff
549
- scopes, and local log context are available. `knodin pack read` retrieves at
550
- most 1,000 artifact lines under a byte cap; `knodin pack grep` applies an exact
551
- regular expression with a bounded match count. Output paths are restricted to
552
- the repository, and no pack operation sends code or metadata off-machine.
553
-
554
- `knodin visualize <entry> --output <path.html>` writes an optional,
555
- self-contained local HTML artifact from the existing persisted graph. It offers
556
- native subsystem drill-down, hub/bridge inspection, and a bounded downstream
557
- static call-flow view (`--depth 1..6`); `--identity`, `--file`, and `--kind`
558
- disambiguate the entry symbol. Each displayed relationship is labeled with
559
- bounded source evidence or an explicit heuristic label, and the artifact records
560
- the local source commit plus index freshness. `--max-bytes` (4–64 KiB, 32 KiB
561
- default) bounds generation; output paths must remain inside the repository. This
562
- is a CLI export only: it adds no MCP tool, network service, credentials,
563
- telemetry, or source egress.
564
- Map and community/flow/traversal drill-downs accept `topN`, `sort`,
565
- `relationKinds`, and `detailLevel`. The CLI exposes the same controls as
566
- `--languages`, `--extensions`, `--kinds`, `--path`, `--tests-only`,
567
- `--production-only`, `--offset`, `--min-lines`, `--min-complexity`, `--top`,
568
- `--sort`, and `--relations`. Traversal also accepts `--direction` and `--data-flow`
569
- and returns typed evidence for every hop. `architecture_overview` accepts `--facets`
570
- (`packages,layers,boundaries,hotspots,entryPoints,languages`) and a consistent `--path` scope.
571
-
572
- `knodin query feature_path <symbol>` follows a deterministic, downstream DFS
573
- over resolved source references. It is bounded by depth (1–6) and the response
574
- item cap, reports explicit truncation whenever either bound cuts off reachable
575
- nodes, includes source file/line evidence on each hop, and guards cycles. It
576
- is a static feature-navigation aid, not a
577
- runtime execution trace; dynamic dispatch and unresolved references are omitted.
578
- Gateway byte/token budgets can additionally crop the serialized response; that
579
- separate C3 condition is reported in `responseBudget.truncated`.
580
-
581
- `knodin query flow_analysis <symbol> [--variable name]` performs a compact,
582
- on-demand source analysis of one selected TypeScript/JavaScript function. It returns
583
- simple definition, use, and control facts with file/line/source evidence, is bounded
584
- by knodin's normal response budgets, and never persists a program-dependence graph.
585
- Aliases, destructuring, closures, dynamic properties, and runtime control flow are
586
- explicitly heuristic or unresolved rather than presented as proof.
587
-
588
- ### MCP tool and handler map
589
-
590
- After indexing, `knodin query mcp_tools` lists TypeScript MCP SDK registrations and associates each tool name with its description, schema declaration, handler symbol, and source file. Use `knodin query mcp_tools <tool-name>` for an exact-name lookup. Dynamic registrations are retained with `confidence: "heuristic"` instead of being presented as exact facts.
222
+ [Apache-2.0](LICENSE)