knit-mcp 0.16.0 → 0.16.1

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 (2) hide show
  1. package/README.md +77 -20
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -88,16 +88,33 @@ Knit ships **Protocol Guard in `warn` mode by default** — hooks print reminder
88
88
  knit_set_protocol_strictness({ level: "off" })
89
89
  ```
90
90
 
91
- ### Uninstall in 30 seconds
91
+ ### Uninstall
92
+
93
+ One command kills all data:
92
94
 
93
95
  ```bash
94
96
  rm -rf ~/.knit # all per-project + global memory
95
97
  ```
96
98
 
97
- Then:
98
- 1. Remove `"knit-brain"` from `mcpServers` in `~/.claude.json`
99
- 2. Delete the `<!-- knit:start --> ... <!-- knit:end -->` block from each project's `CLAUDE.md`
100
- 3. Remove `_knitOwned` entries from each project's `.claude/settings.local.json`
99
+ Then remove Knit's registration from each agent you've used `knit setup` with:
100
+
101
+ | Agent | File to edit | What to remove |
102
+ |---|---|---|
103
+ | Claude Code (global) | `~/.claude.json` | the `"knit-brain"` entry under `mcpServers` |
104
+ | Claude Code (global) | `~/.claude/CLAUDE.md` | the `## Knit Brain (MCP)` block (appended by `knit setup`) |
105
+ | Cursor | `~/.cursor/mcp.json` or `.cursor/mcp.json` | the `"knit-brain"` entry under `mcpServers` |
106
+ | Codex CLI | `~/.codex/config.toml` | the `[mcp_servers.knit-brain]` section |
107
+ | Cline | `~/.cline/mcp.json` | the `"knit-brain"` entry under `mcpServers` |
108
+ | Continue | `.continue/mcpServers/knit-brain.yaml` | delete the file |
109
+ | VS Code Copilot | `.vscode/mcp.json` (or user `mcp.json`) | the `"knit-brain"` entry under `servers` |
110
+
111
+ Per-project residue to clean:
112
+
113
+ - `<project>/CLAUDE.md` — delete the `<!-- knit:start --> ... <!-- knit:end -->` block
114
+ - `<project>/.claude/settings.local.json` — remove hook entries tagged `_knitOwned: true`
115
+ - `<project>/.claude/KNIT.md` — sidecar written when CLAUDE.md had no markers; delete if present
116
+ - `<project>/.claude/agents/knit-*.md` — installed VoltAgent subagents; delete the `knit-` prefixed ones
117
+ - `<project>/AGENTS.md` — if you use Codex CLI or Cline, the marker-wrapped Knit block was written here; delete the block or the file
101
118
 
102
119
  Knit writes nowhere else on your machine.
103
120
 
@@ -165,6 +182,36 @@ a strict lexical-only baseline.
165
182
 
166
183
  ---
167
184
 
185
+ ## ✨ What's new in v0.16.0
186
+
187
+ v0.16 is the **semantic-lite release**. Two retrieval improvements that
188
+ close the most common BM25 lexical gaps without an embedding model or
189
+ external API call. Both default ON, both bench-pinned non-regressive.
190
+
191
+ - **Curated synonym expansion.** Hand-curated dictionary of ~50
192
+ coding-domain synonym pairs (`webhook` ↔ `hook`, `schema` ↔
193
+ `migration`, `auth` ↔ `authentication`, `cache` ↔ `memo`, `deploy` ↔
194
+ `ship` ↔ `release`, etc.) in `src/engine/retrieval/synonyms.ts`. When
195
+ a query token has known synonyms, BM25 scores documents containing
196
+ those synonyms with a 0.4× discount weight (higher than the 2-gram
197
+ fallback's 0.25 because synonyms are conceptually closer than
198
+ near-spelling matches). Fires both as a fallback (term unmatched,
199
+ synonym matched) and a boost (term matched directly, synonym widens
200
+ reach).
201
+ - **2-gram fallback default ON.** `enableNgramFallback` flipped from
202
+ default `false` → default `true`. v0.15 introduced this as opt-in to
203
+ avoid bench regression risk; v0.16 flips the default after both
204
+ benches verified strictly stable.
205
+ - **FIFO-safe `handleIndexRequirements`.** Latent v0.12.1 hardening
206
+ bug: `openSync(O_RDONLY)` on a named pipe blocked indefinitely
207
+ before `fstat` could reject it. Now passes `O_NONBLOCK`; regular
208
+ files unaffected.
209
+
210
+ Bench impact (v0.15 → v0.16): synthetic 86%/96% → **88%/100%**;
211
+ learnings 83.3%/96.7% → **86.7%/96.7%**. The synthetic recall@5 hit
212
+ 100% because synonym expansion closed the "hook events authenticated"
213
+ miss that BM25 alone couldn't bridge.
214
+
168
215
  ## ✨ What's new in v0.15.0
169
216
 
170
217
  v0.15 is the **deep-clean release**. A second six-dimension internal audit
@@ -606,9 +653,13 @@ Pair with `knit_compounding_metrics` for the value side of the ledger (sessions,
606
653
  ## 💻 CLI
607
654
 
608
655
  ```bash
609
- knit setup # one time: add MCP to Claude settings
610
- knit status # dashboard: sessions, learnings, hit rate, knowledge health
611
- knit refresh # force rebuild knowledge brain
656
+ knit setup # one time: detects all 6 MCP-speaking agents and registers Knit in each
657
+ knit doctor # install health check: version, MCP registration per agent, knowledgebase
658
+ knit ui # launch the local Knit dashboard (http://127.0.0.1:7421)
659
+ knit status # text snapshot: sessions, learnings, hit rate, knowledge health
660
+ knit refresh # force rebuild knowledge brain
661
+ knit install-agents # install VoltAgent subagents into <project>/.claude/agents/
662
+ knit export <fmt> # export learnings (current targets: obsidian)
612
663
  ```
613
664
 
614
665
  Example `knit status`:
@@ -624,11 +675,11 @@ Knowledge Base
624
675
  Accessed: 12 (67% hit rate)
625
676
  False positives: 3
626
677
 
627
- Token budget (v0.9)
678
+ Token budget (v0.16)
628
679
  CLAUDE.md: 2.0 KB → healthy
629
- Tool registry: 8.4 KB → healthy (31 active / 43 total)
630
- Instructions: 2.2 KB → healthy
631
- Per-session total: 12.6 KB → healthy
680
+ Tool registry: ~13 KB → warn (49 active / 55 total)
681
+ Instructions: ~4 KB → healthy
682
+ Per-session total: ~20 KB → healthy
632
683
 
633
684
  Compounding
634
685
  Sessions logged: 14
@@ -644,7 +695,7 @@ Compounding
644
695
  |--|---|---|---|---|
645
696
  | **Bet** | Slash-command flows | Agent rules | 100+ agents in swarms | **One disciplined agent, compounding memory** |
646
697
  | **Setup** | Install skills per-project | Manual `.claude/` setup | `npx ruflo init` (heavy) | **`npx knit-mcp setup` (light)** |
647
- | **Memory** | jsonl files in-tree | Memory directory | Vector DB + 4-tier consolidation | **Local, searchable, vectorless BM25 + graph fusion** |
698
+ | **Memory** | jsonl files in-tree | Memory directory | Vector DB + 4-tier consolidation | **Local, searchable, vectorless BM25 + graph fusion + 2-gram fallback + 50-pair synonym dictionary** |
648
699
  | **Token cost** | Skills loaded into context | Rules loaded into context | 314 tools advertised | **~2 KB CLAUDE.md, tier-gated registry, budget guardrail** |
649
700
  | **Parallel work** | None | None | Multi-agent swarms + federation | **Team-scoped git worktrees** |
650
701
  | **Cloud dependency** | None | None | Cognitum.One (cloud backbone) | **None — fully local** |
@@ -679,7 +730,7 @@ The mem0 / Letta / agentmemory comparison deserves a separate section because th
679
730
 
680
731
  Run it yourself: `npm run bench`. Source: [`benchmarks/retrieval-synthetic.ts`](./benchmarks/retrieval-synthetic.ts).
681
732
 
682
- **These numbers are NOT apples-to-apples with agentmemory's.** Their benchmark is 1,500 questions from real long conversations; Knit's is 50 hand-authored questions on a 7KB synthetic corpus. The numbers are close because the architecture is similar (BM25 + RRF), not because we've proven parity at scale. **Real comparison requires running LongMemEval-S on Knit** — on the roadmap for v0.13.
733
+ **These numbers are NOT apples-to-apples with agentmemory's.** Their benchmark is 1,500 questions from real long conversations; Knit's is 50 hand-authored questions on a 7KB synthetic corpus. The numbers are close because the architecture is similar (BM25 + RRF), not because we've proven parity at scale. **Real comparison requires running LongMemEval-S on Knit** — on the roadmap (a v0.20+ candidate alongside hybrid BM25 + local embeddings retrieval).
683
734
 
684
735
  **Knit isn't trying to be a better mem0.** It's a different product:
685
736
  - **MCP-native + zero-glue install** — mem0/Letta require SDK integration; Knit drops into any MCP host (Claude Code, Cursor, Codex) with one command.
@@ -697,7 +748,12 @@ LongMemEval-S R@5/R@10 + LOCOMO LLM-as-Judge runs are on the roadmap (v0.13+). U
697
748
 
698
749
  | Version | Headline |
699
750
  |---|---|
700
- | **v0.12.0** | **Picture Perfect: Structural Enforcement.** Diagnostic enforcing. Budget verdict surfaces in the MCP `instructions` field at handshake (before any tool description is read). `knit_load_session` carries `budget_health` + `learnings_health` nudges. `engram doctor` exits non-zero on over-budget; `engram setup` runs doctor as final step. New PostToolUse hook warns immediately on over-budget CLAUDE.md edits (HOOKS_VERSION 11→12; auto-rolls to existing users). This repo dogfoods: hand-curated 16KB CLAUDE.md migrated to lean 3.8KB plus an internal long-form sidecar. New `npm run bench:tokens` measures real MCP-on vs MCP-off cost: 93% smaller per-recall call, 50% smaller per-classify, payback at 3 recall calls. 53 tools, 705 tests. |
751
+ | **v0.16.0** | **Semantic-lite retrieval.** Curated coding-domain synonym dictionary (~50 pairs) closes the most common BM25 lexical gaps (`hook` `webhook`, `schema` `migration`, etc.) without an embedding model. 2-gram fallback for typos default ON after bench verification. Synthetic bench 88% top-1 / **100% recall@5** (was 96%); learnings 86.7% top-1 / 96.7% recall@5. Plus a FIFO-safe `O_NONBLOCK` fix to `handleIndexRequirements`. 55 tools, 818 tests. |
752
+ | **v0.15.0** | **Deep-clean audit release.** Six-dimension second audit + atomic-write helper applied to 9+ sites including `~/.claude.json` (a torn write there used to brick Claude Code). SHA256 sidecars on agent-fetcher cache writes detect tampering and re-fetch. `qs` CVE pinned via `npm overrides` → 0 vulns. Opt-in BM25 2-gram fallback for typos. `pruneLearningsByAge` + schema-validated `readLearnings`. Webapp DoctorView shows per-agent rows. Update notice surfaces in MCP `instructions` field for all 6 agents. 55 tools, 805+ tests. |
753
+ | **v0.14.1** | **Ship-readiness audit + atomicity hardening.** First six-dimension audit + 14 P1 fixes: `writeFileAtomic` helper across 9+ persistence paths; `handleSetupProject` redaction gap closed; `record_learning` substring dedup matches the description claim; soft-gate documented in instructions field; pre-publish leak gate. 55 tools. |
754
+ | **v0.14.0** | **Universality release.** Single `knit setup` detects + writes to every installed MCP-speaking agent (Claude Code, Cursor, Codex CLI, Cline, Continue, GitHub Copilot via VS Code Agent mode). Server-side soft-gates as the cross-platform protocol enforcement layer for agents without hook lifecycles. Slash-command auto-detection via `knit_scan_agent_commands` + `knit_suggest_command`. 55 tools. |
755
+ | **v0.13.0** | **Brain dashboard release.** `knit ui` opens a local-first analytics dashboard (Monetir-inspired bento, force-directed brain graph, real-time SSE sync, Host/Origin validation + CSP). Security hardening across every endpoint. Universal positioning copy across CLI + README. |
756
+ | **v0.12.0** | **Picture Perfect: Structural Enforcement.** Diagnostic → enforcing. Budget verdict surfaces in the MCP `instructions` field at handshake (before any tool description is read). `knit_load_session` carries `budget_health` + `learnings_health` nudges. `knit doctor` exits non-zero on over-budget; `knit setup` runs doctor as final step. New PostToolUse hook warns immediately on over-budget CLAUDE.md edits (HOOKS_VERSION 11→12; auto-rolls to existing users). This repo dogfoods: hand-curated 16KB CLAUDE.md migrated to lean 3.8KB plus an internal long-form sidecar. New `npm run bench:tokens` measures real MCP-on vs MCP-off cost: 93% smaller per-recall call, 50% smaller per-classify, payback at 3 recall calls. 53 tools, 705 tests. |
701
757
  | **v0.11.4** | Dogfood audit · ran a full audit of Knit's own codebase using its own `knit_spawn_team_worktree` primitive (4 parallel teams: Core Logic, Infrastructure, UI, Quality Assurance). Fixes: HIGH `engram refresh` no longer clobbers user-curated CLAUDE.md (now uses `spliceKnitBlock` like `cache.ts`); `saveSource`/`loadSource` validate `sourceId`; `appendGlobalLearning` propagates write failures; `redactSecrets` applied to `label`/`tags`/`domains` across all persistence boundaries; 100KB response ceiling on `knit_generate_test_cases`; full v0.11 tool surface now documented in `workflow-protocol.ts` generator (was frozen at the v0.4 surface). Plus: 16 key tools reclassified with `[PROTOCOL]`/`[REVIEW]`/`[MEMORY]`/`[GRAPH]` prefixes so the LLM picks the right tool reliably. 53 tools, 687 tests. |
702
758
  | **v0.11.3** | Propagation patch · `update_available` flag now surfaces in `knit_load_session` response (≈100% session reach vs. brain_status' low reach) + startup stderr nag on stale versions. Helps FUTURE upgrades land faster; doesn't retroactively reach v0.10.x users. 53 tools, 665 tests. |
703
759
  | **v0.11.2** | Pre-publish polish · chunk cap (2000) + `errorResponse` envelope across handlers + CLAUDE.md generator surfaces v0.11 tools · new `engram doctor` install health-check CLI · upgrade-path smoke test caught + fixed a data-loss bug in cache.ts (Case B was wiping user permissions on upgrade) · 11 real exploit-payload integration tests prove C1/C2/H1 fixes hold · `npm run bench` ships a synthetic retrieval harness (50 Q&A) measuring 86% top-1 / 96% R@5. 53 tools, 664 tests. |
@@ -733,17 +789,18 @@ git clone https://github.com/PDgit12/knit.git
733
789
  cd knit
734
790
  npm install
735
791
  npm run dev # run CLI locally
736
- npm run test # 492 tests
792
+ npm run test # 818 tests, ~8 s
737
793
  npm run typecheck # TypeScript strict mode
738
- npm run build # compile CLI + MCP server
794
+ npm run bench # retrieval bench: synthetic + learnings-shape
795
+ npm run build # compile CLI + MCP server + webapp
739
796
  ```
740
797
 
741
798
  ### Architecture
742
799
 
743
800
  ```
744
801
  knit (npm package)
745
- ├── dist/cli.js # CLI: setup, status, refresh
746
- └── dist/mcp/server.js # MCP server: 43 tools (tier-gated), auto-init
802
+ ├── dist/cli.js # CLI: setup, doctor, ui, status, refresh, install-agents, export
803
+ └── dist/mcp/server.js # MCP server: 55 tools (tier-gated), auto-init
747
804
 
748
805
  per-project, in ~/.knit/projects/<hash>/
749
806
  ├── knowledge.json # import graph + exports + test map
@@ -758,7 +815,7 @@ per-project, in <project>/
758
815
  └── .claude/settings.local.json # per-machine hooks, knit-managed
759
816
  ```
760
817
 
761
- **Zero external dependencies for the knowledge brain.** 492 tests. Strict-mode TypeScript.
818
+ **Zero external dependencies for the knowledge brain.** 818 tests, 0 `npm audit` vulnerabilities. Strict-mode TypeScript.
762
819
 
763
820
  ---
764
821
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "knit-mcp",
3
- "version": "0.16.0",
3
+ "version": "0.16.1",
4
4
  "description": "Knit — second brain for any MCP-speaking AI coding agent (Claude Code, Cursor, Codex CLI, Cline, Continue, GitHub Copilot). Per-project memory, tier-routed workflow protocol, parallel team worktrees.",
5
5
  "type": "module",
6
6
  "bin": {