knit-mcp 0.9.0 → 0.11.2
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 +368 -215
- package/dist/cache-3LPETDUT.js +19 -0
- package/dist/{chunk-XFS2XGZI.js → chunk-27TA2ZQZ.js} +24 -0
- package/dist/{chunk-KLNUEE3O.js → chunk-7UFS67HP.js} +9 -1
- package/dist/{chunk-4K4FHOKE.js → chunk-HROSQ5MS.js} +256 -344
- package/dist/{chunk-5NCSZYRJ.js → chunk-LV73YTVN.js} +5 -0
- package/dist/{chunk-B2KZ5UR7.js → chunk-ORKWLA33.js} +1 -1
- package/dist/{chunk-BU3VHX3W.js → chunk-RZOVZYTF.js} +12 -4
- package/dist/{chunk-7PPC6IG6.js → chunk-ST4X7LZT.js} +60 -2
- package/dist/chunk-TWHNYJAJ.js +328 -0
- package/dist/{chunk-FLNV2IQC.js → chunk-VB2TIR6L.js} +2 -2
- package/dist/{chunk-BAUQEFYY.js → chunk-WKQHCLLO.js} +45 -10
- package/dist/cli.js +18 -9
- package/dist/doctor-4DN2P2JR.js +179 -0
- package/dist/{export-I5Y26WUL.js → export-CGSEUYZA.js} +3 -3
- package/dist/{install-agents-D2KJQUH3.js → install-agents-OBDCWCPB.js} +8 -7
- package/dist/{instructions-4FI32YZU.js → instructions-JARSXQPO.js} +1 -1
- package/dist/{integration-scanner-PS47AHGM.js → integration-scanner-LBD2PIZ3.js} +3 -3
- package/dist/{refresh-BXN32CNA.js → refresh-SMJ2NGIW.js} +3 -3
- package/dist/{status-RQWRIM2Y.js → status-VJDB75X2.js} +2 -2
- package/dist/{tools-EISDGPS5.js → tools-MIROTK2A.js} +1146 -91
- package/package.json +2 -1
- package/dist/cache-JSN6ETUF.js +0 -18
package/README.md
CHANGED
|
@@ -1,73 +1,64 @@
|
|
|
1
1
|
<p align="center">
|
|
2
2
|
<a href="https://www.npmjs.com/package/knit-mcp"><img src="https://img.shields.io/npm/v/knit-mcp?style=for-the-badge&color=7c3aed&label=npm" alt="npm version" /></a>
|
|
3
|
-
<img src="https://img.shields.io/
|
|
4
|
-
<
|
|
5
|
-
<img src="https://img.shields.io/badge/node-%
|
|
3
|
+
<a href="https://github.com/PDgit12/knit/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/PDgit12/knit/ci.yml?style=for-the-badge&label=CI&color=10b981" alt="CI" /></a>
|
|
4
|
+
<img src="https://img.shields.io/badge/license-MIT-3b82f6?style=for-the-badge" alt="license" />
|
|
5
|
+
<img src="https://img.shields.io/badge/node-%E2%89%A518-339933?style=for-the-badge&logo=node.js&logoColor=white" alt="node" />
|
|
6
|
+
<img src="https://img.shields.io/badge/tests-664%20passing-22c55e?style=for-the-badge" alt="tests" />
|
|
7
|
+
<img src="https://img.shields.io/badge/MCP%20tools-53-7c3aed?style=for-the-badge" alt="tools" />
|
|
6
8
|
</p>
|
|
7
9
|
|
|
8
|
-
<h1 align="center"
|
|
10
|
+
<h1 align="center">🧶 knit</h1>
|
|
9
11
|
|
|
10
12
|
<p align="center">
|
|
11
|
-
<strong>An intelligent command layer for Claude Code.</strong
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
and honest token accounting — all in one MCP server.
|
|
13
|
+
<strong>An intelligent command layer for Claude Code.</strong><br/>
|
|
14
|
+
Project-scoped memory · on-demand workflow · parallel team worktrees · honest token accounting.<br/>
|
|
15
|
+
<em>All in one MCP server.</em>
|
|
15
16
|
</p>
|
|
16
17
|
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **Workflow** — a 4-tier classification (Inquiry / Trivial / Standard / Complex) with phase-triggered plan mode, quality-gated `LEARN`, and team-scoped git worktrees so parallel agents don't step on each other.
|
|
26
|
-
|
|
27
|
-
It's a **single product**, not three. Every design choice has to win on memory + tokens + workflow together.
|
|
18
|
+
<p align="center">
|
|
19
|
+
<a href="#-quick-start">Quick start</a> ·
|
|
20
|
+
<a href="#-what-knit-is">What it is</a> ·
|
|
21
|
+
<a href="#-whats-new-in-v0110">v0.11</a> ·
|
|
22
|
+
<a href="#-52-mcp-tools">Tools</a> ·
|
|
23
|
+
<a href="#-how-its-different">Comparison</a> ·
|
|
24
|
+
<a href="#-honest-comparison-vs-memory-libraries">vs mem0/Letta</a>
|
|
25
|
+
</p>
|
|
28
26
|
|
|
29
|
-
|
|
27
|
+
---
|
|
30
28
|
|
|
31
|
-
|
|
32
|
-
- **Tier-gated tool surface.** 38 tools split into three tiers: Tier 1 (26 universal — memory, knowledge graph, workflow, classification, false-positive suppression, reflection, Protocol Guard config, diagnostics) is always exposed. Tier 2 (team worktrees, subagent installer) auto-activates when the project shape matches (≥3 detected domains, `.claude/agents/` exists) or via explicit opt-in. Tier 3 (admin/setup) is opt-in only. Solo-domain projects no longer see 9 team-worktree tools cluttering their decision space.
|
|
33
|
-
- **`knit_list_features`** is the discoverability escape hatch — always available, always tells you what's hidden and exactly how to enable it (`knit_enable_feature({feature: "teams" | "subagents" | "admin"})`). Persisted to `~/.knit/projects/<hash>/features.json` so the choice survives sessions.
|
|
34
|
-
- **Inquiry tier in the classifier.** Read-only "what / where / audit / explain" tasks now route to `tier: "inquiry"` with no plan mode and no phases — fixes a long-standing over-routing bug where audit-style questions hijacked Complex.
|
|
35
|
-
- **CLAUDE.md cut ~88%** (16.7 KB → ~2 KB on typical projects). The per-turn context tax dropped sharply; all project-specific content (header, project map, domain architecture, build gates, false positives) stays intact.
|
|
36
|
-
- **Lazy / minimal response modes.** `knit_load_session` returns the lean core by default; opt into more via `include=patterns,teams,metrics,recent_sessions,full_learnings,full_knowledge,all`. `knit_classify_task` returns the minimal shape by default; pass `verbose=true` for the diagnostic fields.
|
|
37
|
-
- **Legacy CLAUDE.md migration.** Users upgrading from v0.5.x with `<!-- engram:start -->/<!-- engram:end -->` markers are auto-migrated — the legacy block is replaced cleanly with the new lean block instead of leaving an orphan.
|
|
29
|
+
## 🧠 What knit is
|
|
38
30
|
|
|
39
|
-
|
|
31
|
+
Knit makes Claude Code do the right thing automatically — because you can't predict how a user will phrase a request. It does three jobs at once:
|
|
40
32
|
|
|
41
|
-
|
|
|
42
|
-
|
|
43
|
-
|
|
|
44
|
-
|
|
|
45
|
-
|
|
|
46
|
-
| `knit_load_session` response | ~3–5 KB | ~1.5 KB | ~60% |
|
|
33
|
+
| | |
|
|
34
|
+
|---|---|
|
|
35
|
+
| 🧠 **Memory** | Every project keeps a brain at `~/.knit/projects/<hash>/`. Sessions compound: learnings, false positives, session summaries, and a static-analysis import graph are all queryable next session. |
|
|
36
|
+
| 🪶 **Tokens** | `CLAUDE.md` is ~2 KB (project facts only). Protocol depth is fetched on demand via `knit_get_workflow(phase)`. Knit is **net-negative** on context cost. |
|
|
37
|
+
| 🛠️ **Workflow** | A 4-tier classification (Inquiry / Trivial / Standard / Complex) with phase-triggered plan mode, quality-gated `LEARN`, and team-scoped git worktrees so parallel agents don't step on each other. |
|
|
47
38
|
|
|
48
|
-
|
|
39
|
+
It's a **single product**, not three. Every design choice has to win on memory + tokens + workflow together.
|
|
49
40
|
|
|
50
|
-
|
|
41
|
+
---
|
|
51
42
|
|
|
52
|
-
##
|
|
43
|
+
## 🚀 Quick start
|
|
53
44
|
|
|
54
45
|
```bash
|
|
55
46
|
npx knit-mcp@latest setup
|
|
56
47
|
```
|
|
57
48
|
|
|
58
|
-
Adds the Knit MCP server to your Claude Code config (`~/.claude.json`). No per-project setup
|
|
49
|
+
Adds the Knit MCP server to your Claude Code config (`~/.claude.json`). **No per-project setup.** Open Claude Code in any project — the first MCP tool call auto-initializes the brain, hooks, and per-project CLAUDE.md block.
|
|
59
50
|
|
|
60
|
-
**Supported shells:** macOS, Linux, WSL, Git Bash,
|
|
51
|
+
> **Supported shells:** macOS, Linux, WSL, Git Bash, PowerShell. Windows `cmd.exe` is not supported as the hook-runner shell — use PowerShell (default in modern Windows Terminal) or Git Bash.
|
|
61
52
|
|
|
62
|
-
### Quiet mode
|
|
53
|
+
### Quiet mode
|
|
63
54
|
|
|
64
|
-
Knit ships Protocol Guard in `warn` mode by default — hooks print reminders, they never block.
|
|
55
|
+
Knit ships **Protocol Guard in `warn` mode by default** — hooks print reminders, they never block. Fully silent:
|
|
65
56
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
57
|
+
```js
|
|
58
|
+
knit_set_protocol_strictness({ level: "off" })
|
|
59
|
+
```
|
|
69
60
|
|
|
70
|
-
### Uninstall
|
|
61
|
+
### Uninstall in 30 seconds
|
|
71
62
|
|
|
72
63
|
```bash
|
|
73
64
|
rm -rf ~/.knit # all per-project + global memory
|
|
@@ -76,13 +67,173 @@ rm -rf ~/.knit # all per-project + global memory
|
|
|
76
67
|
Then:
|
|
77
68
|
1. Remove `"knit-brain"` from `mcpServers` in `~/.claude.json`
|
|
78
69
|
2. Delete the `<!-- knit:start --> ... <!-- knit:end -->` block from each project's `CLAUDE.md`
|
|
79
|
-
3. Remove `_knitOwned` entries from each project's `.claude/settings.local.json`
|
|
70
|
+
3. Remove `_knitOwned` entries from each project's `.claude/settings.local.json`
|
|
71
|
+
|
|
72
|
+
Knit writes nowhere else on your machine.
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## ✨ What's new in v0.9.0
|
|
77
|
+
|
|
78
|
+
v0.9 closes the **enforcement story** — every honest limit from the v0.8 architecture got a structural fix.
|
|
79
|
+
|
|
80
|
+
### Anti-hallucination
|
|
81
|
+
|
|
82
|
+
- 📎 **Citation rule in the MCP `instructions` field.** Every session's system prompt now tells the agent: *"when you state a fact about this codebase, cite the Knit tool result that verified it — e.g. (per `knit_query_imports`). If you can't cite, say 'unverified' explicitly."* Makes hallucinations visible at the **claim level**.
|
|
83
|
+
- 🔍 **`knit_verify_claim` tool.** Single-call fact-check against the knowledge graph. Parses *"A imports B"*, *"X exports Y"*, *"A is tested by B"*, *"X exists"* and returns `verified | contradicted | unparseable` with evidence.
|
|
80
84
|
|
|
81
|
-
|
|
85
|
+
### Smarter retrieval
|
|
82
86
|
|
|
83
|
-
|
|
87
|
+
- ⚡ **Auto-search inside `knit_classify_task`.** For `standard` / `complex` tier, classify now runs BM25 over (description + affected domains) automatically and embeds top-3 hits as `pre_emptive_learnings`. Closes the *"agent skipped `knit_search_learnings` before re-investigating"* gap with **zero extra calls**.
|
|
88
|
+
- 📚 **`suggested_reads` from `knit_build_context`.** Curated list of files worth opening *before* editing — three signals: graph-importers (blast radius), graph-imports (likely needed), memory-mentions (files referenced by past learnings). Each entry carries `{ path, reason, via }`.
|
|
89
|
+
- 🪜 **`knit_get_learning` — hierarchical retrieval.** Search returns headlines (summary + tags); the agent expands a specific learning by id only when needed. **Pay-per-detail.**
|
|
90
|
+
- 🧮 **`knit_consolidate_learnings`.** Tag-Jaccard clustering of similar learnings → one pattern entry per cluster. Dry-run by default; `commit=true` persists with originals tagged `#consolidated` (preserved but deprioritized).
|
|
84
91
|
|
|
85
|
-
|
|
92
|
+
### Hook-level enforcement (`HOOKS_VERSION` 6 → 7)
|
|
93
|
+
|
|
94
|
+
| Hook | What it does |
|
|
95
|
+
|---|---|
|
|
96
|
+
| **PreToolUse search-gate** | For `standard`/`complex` tasks, blocks Edit/Write (in `block` mode) or warns (default `warn`) when `knit_search_learnings` hasn't fired in the current turn. |
|
|
97
|
+
| **PreToolUse content inspection** | Reads proposed Edit/Write content, parses local imports, warns on relative paths that don't resolve on disk — **catches hallucinated imports before they land**. |
|
|
98
|
+
| **PostToolUse import validation** | After the file lands, re-parses imports and warns about unresolved relative paths — catches anything that slipped past the pre-check. |
|
|
99
|
+
| **Stop-hook budget watch** | Cheap CLAUDE.md size check at session end; warns if it crosses the 12.5 KB over-budget threshold. Drift becomes visible even when the agent doesn't call `knit_brain_status`. |
|
|
100
|
+
|
|
101
|
+
> **Upgrade note.** After `npx knit-mcp@latest setup`, **restart Claude Code**. The `instructions` field and tier-gated `tools/list` only flow into the system prompt at handshake. The `HOOKS_VERSION` bump auto-regenerates installed hooks on the next brain load — no manual `knit refresh` needed.
|
|
102
|
+
|
|
103
|
+
---
|
|
104
|
+
|
|
105
|
+
## 📉 Token budget — measured, not vibes
|
|
106
|
+
|
|
107
|
+
| Surface | v0.6.5 | v0.9.0 | Cut |
|
|
108
|
+
|---|---|---|---|
|
|
109
|
+
| CLAUDE.md per-turn | ~16.7 KB | **~2 KB** | **88%** |
|
|
110
|
+
| Tool registry (typical project) | ~6–8 KB | **~3–4 KB** | ~50% |
|
|
111
|
+
| `knit_classify_task` response | ~500 tok | **~150 tok** | 70% |
|
|
112
|
+
| `knit_load_session` response | ~3–5 KB | **~1.5 KB** | ~60% |
|
|
113
|
+
|
|
114
|
+
Each surface gets a `healthy | warn | over-budget` verdict from `knit_brain_status.token_budget`. **Drift is a regression test, not a vibes claim.**
|
|
115
|
+
|
|
116
|
+
---
|
|
117
|
+
|
|
118
|
+
## 🛠️ 43 MCP Tools
|
|
119
|
+
|
|
120
|
+
<details open>
|
|
121
|
+
<summary><strong>🕸️ Knowledge graph</strong> <em>(Tier 1, ~5ms)</em></summary>
|
|
122
|
+
|
|
123
|
+
| Tool | What it does |
|
|
124
|
+
|---|---|
|
|
125
|
+
| `knit_query_imports` | Reverse dependencies — who imports this file. |
|
|
126
|
+
| `knit_query_dependents` | Forward dependencies — what this file imports. |
|
|
127
|
+
| `knit_query_exports` | Functions / classes / interfaces / types this file exposes. |
|
|
128
|
+
| `knit_query_tests` | Test coverage for a file, or list all untested with `filter=untested`. |
|
|
129
|
+
| `knit_find_fanout` | High-fanout files — the contracts to change carefully. |
|
|
130
|
+
| `knit_verify_claim` | **v0.9.** Fact-check one claim against the graph — `verified \| contradicted \| unparseable` with evidence. |
|
|
131
|
+
|
|
132
|
+
</details>
|
|
133
|
+
|
|
134
|
+
<details open>
|
|
135
|
+
<summary><strong>📚 Memory + retrieval</strong> <em>(Tier 1)</em></summary>
|
|
136
|
+
|
|
137
|
+
| Tool | What it does |
|
|
138
|
+
|---|---|
|
|
139
|
+
| `knit_load_session` | Call at session start — returns handoff, top learnings, false positives, project knowledge. Lazy by default; opt in via `include=patterns,teams,metrics,recent_sessions,full_learnings,full_knowledge,all`. |
|
|
140
|
+
| `knit_search_learnings` | **v0.8+.** BM25 + import-graph hybrid. `query=text` for BM25, `domains=#tag` for tag filter, `files=src/a.ts` for graph-neighborhood boost. Fused via RRF (k=60). |
|
|
141
|
+
| `knit_search_sessions` | BM25 over session summaries + branch + commits + tags. Branch-diversified (max 2 per branch) — one feature branch can't flood. |
|
|
142
|
+
| `knit_search_global_learnings` | BM25 across the cross-project pool at `~/.knit/global/learnings.jsonl`. |
|
|
143
|
+
| `knit_get_learning` | **v0.9.** Fetch one full learning by id. Pair with search (headlines) for hierarchical retrieval. |
|
|
144
|
+
| `knit_record_learning` | Save a non-obvious insight. Quality check first; secret patterns redacted before persistence. |
|
|
145
|
+
| `knit_record_global_learning` | Opt-in: cross-project pool when the insight generalizes beyond this project. |
|
|
146
|
+
| `knit_record_false_positive` | Mark a finding as confirmed non-issue so future reviewers don't re-flag it. |
|
|
147
|
+
| `knit_get_false_positives` | List confirmed non-issues to suppress in review prompts. |
|
|
148
|
+
| `knit_save_session_summary` | Opt-in narrative — record only when this session accomplished something a future session would search for. |
|
|
149
|
+
| `knit_save_handoff` | Save state when context degrades. `failed_attempts` is the load-bearing field. |
|
|
150
|
+
| `knit_consolidate_learnings` | **v0.9.** Cluster similar learnings via tag-Jaccard → one pattern entry per cluster. Dry-run by default. |
|
|
151
|
+
|
|
152
|
+
</details>
|
|
153
|
+
|
|
154
|
+
<details>
|
|
155
|
+
<summary><strong>🧭 Workflow + classification</strong> <em>(Tier 1)</em></summary>
|
|
156
|
+
|
|
157
|
+
| Tool | What it does |
|
|
158
|
+
|---|---|
|
|
159
|
+
| `knit_classify_task` | First call on every task. Returns tier (`inquiry \| trivial \| standard \| complex`), phases, `auto_plan_mode`. **v0.9.** For standard/complex, auto-runs BM25 and embeds top-3 hits as `pre_emptive_learnings`. |
|
|
160
|
+
| `knit_build_context` | Domain context for the current task. **v0.9.** Includes `suggested_reads` — files worth opening (graph-importers, graph-imports, memory-mentions). |
|
|
161
|
+
| `knit_get_workflow` | Fetch protocol depth for one phase on demand. Sections: `overview, tier, phases, research, ideate, plan, execute, optimize, review, tdd, learn, handoff, ship, tools`. |
|
|
162
|
+
| `knit_get_suggestions` | Adaptive warnings from past patterns in given domains. |
|
|
163
|
+
| `knit_reflect` | Detect patterns across recorded learnings (per-project + global pool). Useful with ≥3 entries. |
|
|
164
|
+
| `knit_setup_project` | Describe a non-code project (legal, marketing, research) to bootstrap domain teams. |
|
|
165
|
+
| `knit_prune_sessions` | Prune `sessions.jsonl` by age (default 90 days). Atomic rewrite. |
|
|
166
|
+
|
|
167
|
+
</details>
|
|
168
|
+
|
|
169
|
+
<details>
|
|
170
|
+
<summary><strong>🛡️ Protocol Guard</strong> <em>(Tier 1)</em></summary>
|
|
171
|
+
|
|
172
|
+
Runtime enforcement of the Knit protocol via PreToolUse and SessionStart hooks. Default strictness: `warn`.
|
|
173
|
+
|
|
174
|
+
| Tool | What it does |
|
|
175
|
+
|---|---|
|
|
176
|
+
| `knit_set_protocol_strictness` | Set strictness: `off` (no checks), `warn` (reminder, default), `block` (hard-fail Edit/Write without prior `knit_classify_task` AND `knit_search_learnings`). |
|
|
177
|
+
| `knit_get_protocol_strictness` | Read current strictness level. |
|
|
178
|
+
|
|
179
|
+
</details>
|
|
180
|
+
|
|
181
|
+
<details>
|
|
182
|
+
<summary><strong>📊 Discoverability + diagnostics</strong> <em>(Tier 1)</em></summary>
|
|
183
|
+
|
|
184
|
+
| Tool | What it does |
|
|
185
|
+
|---|---|
|
|
186
|
+
| `knit_brain_status` | Brain health + **token-budget** verdicts per surface + `update_available` notification + integrations summary. |
|
|
187
|
+
| `knit_list_features` | Surfaces hidden tools and tells you how to enable them. The escape hatch. |
|
|
188
|
+
| `knit_enable_feature` | Flip on a Tier-2/3 feature (`teams`, `subagents`, `admin`). Emits `notifications/tools/list_changed` — new tools appear without a Claude Code restart. |
|
|
189
|
+
| `knit_disable_feature` | Symmetric to enable. |
|
|
190
|
+
| `knit_scan_integrations` | Re-detect existing workflow frameworks (Ruflo, gstack, CodeTour, Conductor, other MCP servers, custom CLAUDE.md sections). |
|
|
191
|
+
| `knit_compounding_metrics` | Quantifies *"Knit gets cheaper over time"* — sessions, cache hits, reuse-ratio %, estimated tokens saved. Verdict: `cold \| warming \| compounding \| strong`. |
|
|
192
|
+
|
|
193
|
+
</details>
|
|
194
|
+
|
|
195
|
+
<details>
|
|
196
|
+
<summary><strong>👥 Parallel team worktrees</strong> <em>(Tier 2 — auto-active with ≥3 domains)</em></summary>
|
|
197
|
+
|
|
198
|
+
| Tool | What it does |
|
|
199
|
+
|---|---|
|
|
200
|
+
| `knit_spawn_team_worktree` | Create a git worktree for a team so they can write in parallel without colliding. |
|
|
201
|
+
| `knit_list_team_worktrees` | List active team worktrees. |
|
|
202
|
+
| `knit_finalize_team_worktree` | Merge or discard a team's worktree; surfaces conflicts without destroying it. |
|
|
203
|
+
| `knit_get_teams` | List auto-detected or custom teams. |
|
|
204
|
+
| `knit_define_team` | Create a custom team. |
|
|
205
|
+
| `knit_start_team_review` | Start a parallel review with a shared findings board. |
|
|
206
|
+
| `knit_get_team_prompt` | Per-team prompt including other teams' findings. |
|
|
207
|
+
| `knit_post_team_findings` | Post findings to the shared board. |
|
|
208
|
+
| `knit_get_board_summary` | Cross-team summary, severity-gated. |
|
|
209
|
+
|
|
210
|
+
</details>
|
|
211
|
+
|
|
212
|
+
<details>
|
|
213
|
+
<summary><strong>🤖 Subagents</strong> <em>(Tier 2 — auto-active when `.claude/agents/` exists)</em></summary>
|
|
214
|
+
|
|
215
|
+
| Tool | What it does |
|
|
216
|
+
|---|---|
|
|
217
|
+
| `knit_install_agent` | Install a VoltAgent subagent (e.g. `typescript-pro`) into `.claude/agents/knit-<name>.md`, personalized with project context. |
|
|
218
|
+
|
|
219
|
+
</details>
|
|
220
|
+
|
|
221
|
+
<details>
|
|
222
|
+
<summary><strong>⚙️ Admin</strong> <em>(Tier 3 — opt-in only)</em></summary>
|
|
223
|
+
|
|
224
|
+
| Tool | What it does |
|
|
225
|
+
|---|---|
|
|
226
|
+
| `knit_setup_project` | Bootstrap domain teams for a non-code project. One-time. |
|
|
227
|
+
|
|
228
|
+
</details>
|
|
229
|
+
|
|
230
|
+
> The **cross-project pool** (`knit_search_global_learnings` + `knit_record_global_learning`) holds the lessons that travel between projects — *"Stripe signature rules", "GitHub API pagination quirks", "Redis cluster failover behavior"* — the kind of thing future-you will be glad you wrote down once, somewhere.
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## 💾 How data is stored
|
|
235
|
+
|
|
236
|
+
Knit data is **centralized** — not in every repo's working tree:
|
|
86
237
|
|
|
87
238
|
```
|
|
88
239
|
~/.knit/
|
|
@@ -104,15 +255,17 @@ your-project/
|
|
|
104
255
|
└── settings.local.json ← per-machine hooks (knit-managed; gitignored by convention)
|
|
105
256
|
```
|
|
106
257
|
|
|
107
|
-
The project's own `CLAUDE.md` is wrapped in `<!-- knit:start --> ... <!-- knit:end -->` markers. Knit regenerates only the block between markers — never clobbers anything else
|
|
258
|
+
The project's own `CLAUDE.md` is wrapped in `<!-- knit:start --> ... <!-- knit:end -->` markers. Knit regenerates **only** the block between markers — never clobbers anything else. If your project already has a `CLAUDE.md` without markers, knit writes a sidecar at `.claude/KNIT.md` instead.
|
|
108
259
|
|
|
109
260
|
Override the data location with `KNIT_HOME=/custom/path` (useful for sandboxes and tests).
|
|
110
261
|
|
|
111
|
-
|
|
262
|
+
---
|
|
112
263
|
|
|
113
|
-
|
|
264
|
+
## 🧩 Workflow on demand
|
|
114
265
|
|
|
115
|
-
|
|
266
|
+
The protocol is in MCP, **not preloaded** in every session. CLAUDE.md tells the agent to call `knit_get_workflow(phase)` when it needs the actual procedure:
|
|
267
|
+
|
|
268
|
+
```js
|
|
116
269
|
knit_get_workflow({phase: "research"}) // RESEARCH phase details
|
|
117
270
|
knit_get_workflow({phase: "plan"}) // PLAN + plan-mode rules
|
|
118
271
|
knit_get_workflow({phase: "execute"}) // EXECUTE + TDD
|
|
@@ -127,111 +280,40 @@ knit_get_workflow({phase: "tools"}) // knit MCP tools reference
|
|
|
127
280
|
|
|
128
281
|
Plus `overview`, `tier`, `phases`. Call with no `phase` to list all sections.
|
|
129
282
|
|
|
130
|
-
**Effect:** v0.1's CLAUDE.md was ~700 lines / ~20 KB per session
|
|
283
|
+
> **Effect:** v0.1's CLAUDE.md was ~700 lines / ~20 KB per session. v0.9's is ~100 lines / ~2 KB. **Protocol depth pulled only when needed.**
|
|
131
284
|
|
|
132
|
-
|
|
285
|
+
---
|
|
133
286
|
|
|
134
|
-
|
|
287
|
+
## 🌳 Parallel team worktrees
|
|
135
288
|
|
|
136
|
-
|
|
137
|
-
|------|--------------|
|
|
138
|
-
| `knit_query_imports` | Reverse dependencies for a file. Use before edits. |
|
|
139
|
-
| `knit_query_dependents` | What a file imports. |
|
|
140
|
-
| `knit_query_exports` | What a file exposes. |
|
|
141
|
-
| `knit_query_tests` | Test coverage for a file, or list all untested. |
|
|
142
|
-
| `knit_find_fanout` | High-fanout files — the contracts. |
|
|
143
|
-
| `knit_search_learnings` | Past lessons by domain tag. |
|
|
144
|
-
| `knit_get_false_positives` | Confirmed non-issues to suppress in review. |
|
|
145
|
-
| `knit_brain_status` | Brain health + **token accounting**. |
|
|
146
|
-
| `knit_search_sessions` | Search past sessions by free text over summary+tags+branch. |
|
|
147
|
-
| `knit_load_session` | Call at session start — returns last sessions, handoff, learnings, false positives, teams, project knowledge in one round trip. |
|
|
148
|
-
|
|
149
|
-
### Update the brain (write — quality-gated)
|
|
150
|
-
|
|
151
|
-
| Tool | What it does |
|
|
152
|
-
|------|--------------|
|
|
153
|
-
| `knit_classify_task` | First call on every task. Returns tier, phases, affected domains. |
|
|
154
|
-
| `knit_build_context` | Domain context for the current task. |
|
|
155
|
-
| `knit_record_learning` | Save a non-obvious insight. Quality check first. |
|
|
156
|
-
| `knit_record_false_positive` | Mark a finding as a confirmed non-issue. |
|
|
157
|
-
| `knit_save_session_summary` | Opt-in narrative summary of what this session did. |
|
|
158
|
-
| `knit_save_handoff` | Save state when context degrades. |
|
|
159
|
-
| `knit_setup_project` | Describe a non-code project (legal, marketing, research). |
|
|
160
|
-
| `knit_prune_sessions` | Prune sessions.jsonl by age — keep recent N or drop entries older than N days. |
|
|
161
|
-
| `knit_install_agent` | Install a single VoltAgent subagent (e.g. `typescript-pro`) into `.claude/agents/`. |
|
|
162
|
-
|
|
163
|
-
### Protocol Guard (v0.5.0+)
|
|
164
|
-
|
|
165
|
-
Runtime enforcement of the knit protocol via PreToolUse and SessionStart hooks. Default strictness: `warn`.
|
|
289
|
+
A Complex task gets broken across multiple teams. Each team works in its own git worktree (sibling to the main repo, native `git worktree` convention). Multiple agents within one team share the team's worktree. The orchestrator collects each team's work, runs gates, and merges back.
|
|
166
290
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
291
|
+
```
|
|
292
|
+
/Users/p/my-repo ← main
|
|
293
|
+
/Users/p/my-repo-knit-ui-<ts> ← UI team
|
|
294
|
+
/Users/p/my-repo-knit-api-security-<ts> ← API & Security team
|
|
295
|
+
```
|
|
171
296
|
|
|
172
|
-
|
|
297
|
+
```js
|
|
298
|
+
const ui = await knit_spawn_team_worktree({ team_name: "UI", task_description: "..." })
|
|
299
|
+
// Spawn agents with ui.path; they cd there and work
|
|
300
|
+
await knit_finalize_team_worktree({ team_name: "UI", action: "merge" })
|
|
301
|
+
```
|
|
173
302
|
|
|
174
|
-
|
|
175
|
-
|------|--------------|
|
|
176
|
-
| `knit_get_workflow` | Fetch protocol depth for one phase. |
|
|
303
|
+
**Merge conflicts surface cleanly** — `knit_finalize_team_worktree` with `action: "merge"` returns `{status: "conflict", conflict_files: [...]}` without destroying the worktree. Resolve manually, then call again.
|
|
177
304
|
|
|
178
|
-
|
|
305
|
+
Compatible with Claude Code's `EnterWorktree({path})` — knit's worktrees register via native `git worktree add`, so any session can switch into one.
|
|
179
306
|
|
|
180
|
-
|
|
181
|
-
|------|--------------|
|
|
182
|
-
| `knit_spawn_team_worktree` | Create a git worktree for a team. |
|
|
183
|
-
| `knit_list_team_worktrees` | List active team worktrees. |
|
|
184
|
-
| `knit_finalize_team_worktree` | Merge or discard a team's worktree. |
|
|
307
|
+
---
|
|
185
308
|
|
|
186
|
-
|
|
309
|
+
## 🧬 Subagents — VoltAgent + project personalization
|
|
187
310
|
|
|
188
|
-
|
|
189
|
-
|------|--------------|
|
|
190
|
-
| `knit_get_teams` | List auto-detected or custom teams. |
|
|
191
|
-
| `knit_define_team` | Create a custom team. |
|
|
192
|
-
| `knit_start_team_review` | Start a parallel review with shared findings. |
|
|
193
|
-
| `knit_get_team_prompt` | Per-team prompt including other teams' findings. |
|
|
194
|
-
| `knit_post_team_findings` | Post findings to the shared board. |
|
|
195
|
-
| `knit_get_board_summary` | Cross-team summary, severity-gated. |
|
|
311
|
+
On first MCP call, knit installs **personalized subagents** into `<project>/.claude/agents/knit-<name>.md`. Each agent has:
|
|
196
312
|
|
|
197
|
-
|
|
313
|
+
1. **The VoltAgent base** — the curated system prompt from [github.com/VoltAgent/awesome-claude-code-subagents](https://github.com/VoltAgent/awesome-claude-code-subagents) (MIT, 131+ agents). Knit bundles the 6 most common (`code-reviewer`, `security-engineer`, `qa-expert`, `typescript-pro`, `python-pro`, `golang-pro`) so they install with zero network. Specialized agents fetch at a pinned SHA the first time knit needs them.
|
|
314
|
+
2. **A knit context block** appended at the end with project name, stack, high-fanout files, recent relevant learnings, false positives to suppress, and the knit MCP tools the agent can call.
|
|
198
315
|
|
|
199
|
-
|
|
200
|
-
|------|--------------|
|
|
201
|
-
| `knit_record_global_learning` | Opt-in: save an insight to `~/.knit/global/learnings.jsonl` when it generalizes beyond this project. |
|
|
202
|
-
| `knit_search_global_learnings` | Free-text search across **all** of your projects' shared learnings. |
|
|
203
|
-
| `knit_reflect` | Detect patterns across recorded learnings. Useful with ≥3 entries (which Model C makes easy to reach). |
|
|
204
|
-
| `knit_get_suggestions` | Adaptive suggestions for the current task based on past patterns in given domains. |
|
|
205
|
-
|
|
206
|
-
Per-project `knit_record_learning` stays primary. The global pool is for the lessons that travel between projects — "Stripe signature rules", "GitHub API pagination quirks", "Redis cluster failover behavior" — the kind of thing future-you will be glad you wrote down once, somewhere.
|
|
207
|
-
|
|
208
|
-
## Subagents — VoltAgent + project personalization
|
|
209
|
-
|
|
210
|
-
v0.4 closes the gap where knit's team configs referenced agent names
|
|
211
|
-
(`typescript-pro`, `security-engineer`, etc.) without actually installing them.
|
|
212
|
-
A fresh user opening Claude Code had none of those agents on disk, so teams
|
|
213
|
-
fell back to generic prompts.
|
|
214
|
-
|
|
215
|
-
Now: on first MCP call, knit **installs personalized subagents** into
|
|
216
|
-
`<project>/.claude/agents/knit-<name>.md`. Each agent has:
|
|
217
|
-
|
|
218
|
-
1. **The VoltAgent base** — the curated system prompt from
|
|
219
|
-
[github.com/VoltAgent/awesome-claude-code-subagents](https://github.com/VoltAgent/awesome-claude-code-subagents)
|
|
220
|
-
(MIT-licensed, 131+ agents). Knit bundles the 6 most common
|
|
221
|
-
(`code-reviewer`, `security-engineer`, `qa-expert`, `typescript-pro`,
|
|
222
|
-
`python-pro`, `golang-pro`) so they install with zero network. Specialized
|
|
223
|
-
agents fetch from VoltAgent at a pinned SHA the first time knit needs them.
|
|
224
|
-
2. **An knit context block** appended at the end with project name, stack,
|
|
225
|
-
high-fanout files, recent relevant learnings, false positives to suppress,
|
|
226
|
-
and the knit MCP tools the agent can call.
|
|
227
|
-
|
|
228
|
-
Each agent now has both VoltAgent's role expertise AND knit's project-specific
|
|
229
|
-
context. When a team dispatches via Claude Code's Agent tool, the agent inherits
|
|
230
|
-
both layers.
|
|
231
|
-
|
|
232
|
-
**Never clobbers user-curated agents.** If you have your own
|
|
233
|
-
`<project>/.claude/agents/typescript-pro.md`, knit writes
|
|
234
|
-
`knit-typescript-pro.md` alongside it. Different filename, no conflict.
|
|
316
|
+
**Never clobbers user-curated agents.** If you have your own `typescript-pro.md`, knit writes `knit-typescript-pro.md` alongside it. Different filename, no conflict.
|
|
235
317
|
|
|
236
318
|
```bash
|
|
237
319
|
knit install-agents # install agents this project's teams need
|
|
@@ -239,116 +321,181 @@ knit install-agents --all # install every known agent
|
|
|
239
321
|
knit install-agents --refresh # re-fetch from network even if cached
|
|
240
322
|
```
|
|
241
323
|
|
|
242
|
-
`KNIT_OFFLINE=1` disables network fetches (bundled-core still works).
|
|
243
|
-
`KNIT_AGENT_REGISTRY_REF=main` overrides the pinned VoltAgent SHA.
|
|
244
|
-
(Legacy `ENGRAM_OFFLINE` / `ENGRAM_AGENT_REGISTRY_REF` are still honored.)
|
|
245
|
-
|
|
246
|
-
## Parallel team worktrees
|
|
247
|
-
|
|
248
|
-
A Complex task gets broken across multiple teams. Each team works in its own git worktree (sibling to the main repo, native `git worktree` convention). Multiple agents within one team share the team's worktree. The orchestrator collects each team's work, runs gates, and merges back.
|
|
249
|
-
|
|
250
|
-
```
|
|
251
|
-
/Users/p/my-repo <- main
|
|
252
|
-
/Users/p/my-repo-knit-ui-<ts> <- UI team
|
|
253
|
-
/Users/p/my-repo-knit-api-security-<ts> <- API & Security team
|
|
254
|
-
```
|
|
255
|
-
|
|
256
|
-
```js
|
|
257
|
-
// Orchestrator workflow
|
|
258
|
-
const ui = await knit_spawn_team_worktree({ team_name: "UI", task_description: "..." })
|
|
259
|
-
// Spawn agents with ui.path; they cd there and work
|
|
260
|
-
// ...
|
|
261
|
-
await knit_finalize_team_worktree({ team_name: "UI", action: "merge" })
|
|
262
|
-
```
|
|
263
|
-
|
|
264
|
-
**Merge conflicts surface cleanly** — `knit_finalize_team_worktree` with `action: "merge"` returns `{status: "conflict", conflict_files: [...]}` without destroying the worktree. Resolve manually, then call again.
|
|
324
|
+
`KNIT_OFFLINE=1` disables network fetches (bundled-core still works). `KNIT_AGENT_REGISTRY_REF=main` overrides the pinned SHA.
|
|
265
325
|
|
|
266
|
-
|
|
326
|
+
---
|
|
267
327
|
|
|
268
|
-
## Token accounting
|
|
328
|
+
## 💰 Token accounting
|
|
269
329
|
|
|
270
|
-
`knit_brain_status` answers the only question that matters: is knit saving more than it costs
|
|
330
|
+
`knit_brain_status` answers the only question that matters: **is knit saving more than it costs?**
|
|
271
331
|
|
|
272
332
|
```json
|
|
273
333
|
{
|
|
274
|
-
"
|
|
275
|
-
"
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
334
|
+
"token_budget": {
|
|
335
|
+
"budgets": {
|
|
336
|
+
"claude_md": { "bytes": 2048, "target_bytes": 6500, "verdict": "healthy" },
|
|
337
|
+
"tool_registry": { "bytes": 8400, "target_bytes": 8500, "verdict": "healthy", "active_tool_count": 31, "total_tool_count": 43 },
|
|
338
|
+
"instructions": { "bytes": 2200, "target_bytes": 2500, "verdict": "healthy" },
|
|
339
|
+
"per_session_overhead": { "bytes": 12648, "target_bytes": 17500, "verdict": "healthy" }
|
|
340
|
+
},
|
|
341
|
+
"overall_verdict": "healthy",
|
|
342
|
+
"compounding": {
|
|
343
|
+
"session_count": 12,
|
|
344
|
+
"total_learnings": 18,
|
|
345
|
+
"learnings_hit_rate_pct": 67,
|
|
346
|
+
"note": "Strong compounding — learnings are getting reused across sessions."
|
|
347
|
+
}
|
|
348
|
+
},
|
|
349
|
+
"update_available": {
|
|
350
|
+
"current": "0.8.0",
|
|
351
|
+
"latest": "0.9.0",
|
|
352
|
+
"upgrade": "Restart Claude Code to spawn a fresh MCP — npx will auto-fetch the new version."
|
|
279
353
|
}
|
|
280
354
|
}
|
|
281
355
|
```
|
|
282
356
|
|
|
283
|
-
|
|
357
|
+
Pair with `knit_compounding_metrics` for the value side of the ledger (sessions, hit rate, estimated tokens saved by skipped re-investigations).
|
|
284
358
|
|
|
285
|
-
|
|
359
|
+
---
|
|
360
|
+
|
|
361
|
+
## 💻 CLI
|
|
286
362
|
|
|
287
363
|
```bash
|
|
288
|
-
knit setup #
|
|
289
|
-
knit status #
|
|
290
|
-
knit refresh #
|
|
364
|
+
knit setup # one time: add MCP to Claude settings
|
|
365
|
+
knit status # dashboard: sessions, learnings, hit rate, knowledge health
|
|
366
|
+
knit refresh # force rebuild knowledge brain
|
|
291
367
|
```
|
|
292
368
|
|
|
293
|
-
Example `knit status
|
|
369
|
+
Example `knit status`:
|
|
294
370
|
|
|
295
371
|
```
|
|
296
372
|
Knowledge Index
|
|
297
|
-
Files:
|
|
298
|
-
Imports:
|
|
299
|
-
Untested:
|
|
373
|
+
Files: 54 indexed (11,495 lines)
|
|
374
|
+
Imports: 46 edges mapped
|
|
375
|
+
Untested: 5 files
|
|
300
376
|
|
|
301
377
|
Knowledge Base
|
|
302
|
-
Learnings:
|
|
303
|
-
Accessed:
|
|
378
|
+
Learnings: 18 total
|
|
379
|
+
Accessed: 12 (67% hit rate)
|
|
304
380
|
False positives: 3
|
|
305
381
|
|
|
306
|
-
Token
|
|
307
|
-
CLAUDE.md:
|
|
308
|
-
|
|
309
|
-
|
|
382
|
+
Token budget (v0.9)
|
|
383
|
+
CLAUDE.md: 2.0 KB → healthy
|
|
384
|
+
Tool registry: 8.4 KB → healthy (31 active / 43 total)
|
|
385
|
+
Instructions: 2.2 KB → healthy
|
|
386
|
+
Per-session total: 12.6 KB → healthy
|
|
387
|
+
|
|
388
|
+
Compounding
|
|
389
|
+
Sessions logged: 14
|
|
390
|
+
Reuse ratio: 67% → strong
|
|
391
|
+
Tokens saved (est.): 65,000
|
|
310
392
|
```
|
|
311
393
|
|
|
312
|
-
|
|
394
|
+
---
|
|
395
|
+
|
|
396
|
+
## 🆚 How it's different
|
|
397
|
+
|
|
398
|
+
| | gstack (skills) | ECC (agents) | Ruflo (orchestration) | **Knit** |
|
|
399
|
+
|--|---|---|---|---|
|
|
400
|
+
| **Bet** | Slash-command flows | Agent rules | 100+ agents in swarms | **One disciplined agent, compounding memory** |
|
|
401
|
+
| **Setup** | Install skills per-project | Manual `.claude/` setup | `npx ruflo init` (heavy) | **`npx knit-mcp setup` (light)** |
|
|
402
|
+
| **Memory** | jsonl files in-tree | Memory directory | Vector DB + 4-tier consolidation | **Local, searchable, vectorless BM25 + graph fusion** |
|
|
403
|
+
| **Token cost** | Skills loaded into context | Rules loaded into context | 314 tools advertised | **~2 KB CLAUDE.md, tier-gated registry, budget guardrail** |
|
|
404
|
+
| **Parallel work** | None | None | Multi-agent swarms + federation | **Team-scoped git worktrees** |
|
|
405
|
+
| **Cloud dependency** | None | None | Cognitum.One (cloud backbone) | **None — fully local** |
|
|
406
|
+
| **Self-measurement** | None | None | Cost-tracker plugin | **`knit_brain_status.token_budget` + `knit_compounding_metrics`** |
|
|
407
|
+
| **Anti-hallucination** | None | None | None advertised | **`knit_verify_claim` + citation rule + pre/post import validation** |
|
|
408
|
+
| **Non-code projects** | No | No | Limited | **Description-driven via `knit_setup_project`** |
|
|
409
|
+
|
|
410
|
+
**The bet:** Ruflo for agent quantity (swarms, federation, plugins). Knit for **agent quality** (memory, classification, token discipline, hallucination defense). Different markets. The integration scanner detects Ruflo when installed and tailors instructions to defer routing to it — Knit operates as the memory + classification substrate underneath.
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## 🧭 Honest comparison vs memory libraries
|
|
415
|
+
|
|
416
|
+
The mem0 / Letta / agentmemory comparison deserves a separate section because they're a different category — **memory-as-a-service libraries**, not MCP-native workflow layers. Reading their published benchmarks side-by-side:
|
|
313
417
|
|
|
314
|
-
|
|
|
315
|
-
|
|
316
|
-
|
|
|
317
|
-
|
|
|
318
|
-
|
|
|
319
|
-
|
|
|
320
|
-
| Self-
|
|
321
|
-
| Non-code projects | No | No | Description-driven domains via `knit_setup_project` |
|
|
418
|
+
| | mem0 | Letta (MemGPT) | agentmemory | **Knit** |
|
|
419
|
+
|--|---|---|---|---|
|
|
420
|
+
| **Published benchmark** | LOCOMO: 67–92% LLM-as-Judge; ~90% token reduction (1.7K vs 26K per conversation) | No head-to-head token-reduction number; "Letta Leaderboard" benchmarks *LLMs* on agentic memory, not Letta | LongMemEval-S: **95.2% R@5** with BM25+RRF+graph; 86.2% BM25-only | **Not yet measured.** Same architecture as agentmemory; no published number. |
|
|
421
|
+
| **Retrieval architecture** | Vector + graph (Mem0g variant) | OS-inspired tiered memory (core/recall/archival) | BM25 + local vectors + KG fused via RRF (k=60) | BM25 + RRF + graph-traversal (fused via RRF k=60). Per-project + cross-project diversity caps. |
|
|
422
|
+
| **Install shape** | SDK integration; managed cloud or self-hosted | SDK integration; self-hosted server | Python library | **`npx knit-mcp setup` → MCP server, zero glue.** Works with Claude Code / Cursor / Codex / any MCP host. |
|
|
423
|
+
| **Workflow primitive** | None — pure memory | Agent-managed memory operations | None — pure retrieval | **4-tier classifier + plan-mode + protocol guard + parallel team worktrees.** |
|
|
424
|
+
| **Self-calibration** | No | No | No | **Per-project classifier calibration** (v0.11): user FP feedback shifts thresholds; classifier gets less wrong over time. |
|
|
322
425
|
|
|
323
|
-
|
|
426
|
+
### What's honest about this
|
|
324
427
|
|
|
325
|
-
|
|
428
|
+
**Knit's measured retrieval on a 50-question synthetic harness (v0.11.2):**
|
|
429
|
+
|
|
430
|
+
| Metric | Knit (v0.11.2 synthetic) | agentmemory (LongMemEval-S, published) |
|
|
431
|
+
|---|---|---|
|
|
432
|
+
| Top-1 accuracy | **86.0%** | not published in that form |
|
|
433
|
+
| Recall@5 | **96.0%** | **95.2%** |
|
|
434
|
+
|
|
435
|
+
Run it yourself: `npm run bench`. Source: [`benchmarks/retrieval-synthetic.ts`](./benchmarks/retrieval-synthetic.ts).
|
|
436
|
+
|
|
437
|
+
**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.
|
|
438
|
+
|
|
439
|
+
**Knit isn't trying to be a better mem0.** It's a different product:
|
|
440
|
+
- **MCP-native + zero-glue install** — mem0/Letta require SDK integration; Knit drops into any MCP host (Claude Code, Cursor, Codex) with one command.
|
|
441
|
+
- **Workflow primitive** — the 4-tier classifier + plan-mode + protocol guard + team worktrees is what makes Knit a *command layer*, not a memory library.
|
|
442
|
+
- **Per-project classifier calibration** (v0.11 slice 4) — `knit_record_false_positive` with a direction tag shifts thresholds over time. Nobody else does this; nobody else needs to, because they're memory libraries, not workflow routers.
|
|
443
|
+
- **Measurable cheapness** — `knit_compounding_metrics` + `knit_get_metrics_history` make the "cheaper over time" claim *chartable per project*. mem0 publishes aggregate dataset numbers; Knit ships per-user instrumentation.
|
|
444
|
+
|
|
445
|
+
### What's deferred
|
|
446
|
+
|
|
447
|
+
LongMemEval-S R@5/R@10 + LOCOMO LLM-as-Judge runs are on the roadmap (v0.13+). Until they're published, treat any cross-system token-savings comparison as architectural-claim-only.
|
|
448
|
+
|
|
449
|
+
---
|
|
450
|
+
|
|
451
|
+
## 📜 Release history
|
|
452
|
+
|
|
453
|
+
| Version | Headline |
|
|
454
|
+
|---|---|
|
|
455
|
+
| **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. |
|
|
456
|
+
| **v0.11.1** | Audit-driven hardening · 3 CRITICAL (source_id path traversal, post-edit tsc shell injection, live calibration bug) + 10 HIGH fixes from a 5-agent audit, implemented in 3 parallel `knit_spawn_team_worktree` teams. HOOKS_VERSION 11 (auto-upgrades existing users). New `knit_delete_requirements` tool. Honest comparison vs mem0/Letta added. 53 tools, 636 tests. |
|
|
457
|
+
| **v0.11.0** | Verify Layer + auto-config foundation · mandatory `knit_verify_claim` REVIEW gate · post-edit diff verify + universal `tsc` check · drift detector · self-healing classifier (per-project calibration) · `knit_index_requirements` + `knit_generate_test_cases` (BM25 over long specs) · `knit_get_fingerprint` + `knit_infer_domains` + `knit_compose_template` (zero-config CLAUDE.md). 52 tools, 625 tests. |
|
|
458
|
+
| **v0.10.0** | Token-economics release · risk × scope × change_kind classifier split · `context_budget_remaining` graceful degradation · per-project diversity cap on cross-project search · 11 new compounding-metrics fields + weekly snapshot persistence + `knit_get_metrics_history`. Makes "Knit makes Claude cheaper" a chartable number from day 1. |
|
|
459
|
+
| **v0.9.0** | Hook-level enforcement · citation rule · `knit_verify_claim` · auto-search in classify · `suggested_reads` · `knit_get_learning` · `knit_consolidate_learnings`. |
|
|
460
|
+
| **v0.8.x** | Vectorless RAG (BM25 + RRF) · graph-traversal retriever · per-project instruction tailoring · `knit_compounding_metrics` · integration scanner. |
|
|
461
|
+
| **v0.7.x** | Universal protocol injection via MCP `instructions` · tier-gated tool surface · `knit_list_features` · Inquiry classification tier · CLAUDE.md cut 88% · lazy response modes · token-budget guardrail · legacy migration. |
|
|
462
|
+
| **v0.5.x** | Protocol Guard — runtime enforcement via hooks (off / warn / block). |
|
|
463
|
+
| **v0.4.x** | VoltAgent subagent integration · personalization layer · `engram install-agents` CLI · hybrid hook merging · `export obsidian`. |
|
|
464
|
+
| **v0.3.x** | Centralized data at `~/.knit/projects/<hash>/` · marker-wrapped CLAUDE.md · on-demand workflow · cross-project learnings pool. |
|
|
465
|
+
|
|
466
|
+
---
|
|
467
|
+
|
|
468
|
+
## 🔄 Migration from v0.1
|
|
469
|
+
|
|
470
|
+
If you have an existing project with knit v0.1 data at `<project>/.claude/`, knit auto-migrates on the first MCP call:
|
|
326
471
|
|
|
327
472
|
1. Detects `<project>/.claude/knowledge.json` (or `knowledgebase.json`)
|
|
328
473
|
2. Copies all knit data forward to `~/.knit/projects/<hash>/`
|
|
329
474
|
3. Writes `<project>/.claude/MIGRATED.txt` breadcrumb explaining where the data went
|
|
330
475
|
4. Leaves the old `.claude/` directory intact (delete at your discretion)
|
|
331
476
|
|
|
332
|
-
No data loss, no dual-writes
|
|
477
|
+
**No data loss, no dual-writes.** Single migration per project.
|
|
478
|
+
|
|
479
|
+
---
|
|
333
480
|
|
|
334
|
-
## Development
|
|
481
|
+
## 🛠️ Development
|
|
335
482
|
|
|
336
483
|
```bash
|
|
337
484
|
git clone https://github.com/PDgit12/knit.git
|
|
338
485
|
cd knit
|
|
339
486
|
npm install
|
|
340
|
-
npm run dev
|
|
341
|
-
npm run test
|
|
342
|
-
npm run typecheck
|
|
343
|
-
npm run build
|
|
487
|
+
npm run dev # run CLI locally
|
|
488
|
+
npm run test # 492 tests
|
|
489
|
+
npm run typecheck # TypeScript strict mode
|
|
490
|
+
npm run build # compile CLI + MCP server
|
|
344
491
|
```
|
|
345
492
|
|
|
346
|
-
|
|
493
|
+
### Architecture
|
|
347
494
|
|
|
348
495
|
```
|
|
349
496
|
knit (npm package)
|
|
350
497
|
├── dist/cli.js # CLI: setup, status, refresh
|
|
351
|
-
└── dist/mcp/server.js # MCP server:
|
|
498
|
+
└── dist/mcp/server.js # MCP server: 43 tools (tier-gated), auto-init
|
|
352
499
|
|
|
353
500
|
per-project, in ~/.knit/projects/<hash>/
|
|
354
501
|
├── knowledge.json # import graph + exports + test map
|
|
@@ -360,11 +507,17 @@ per-project, in ~/.knit/projects/<hash>/
|
|
|
360
507
|
|
|
361
508
|
per-project, in <project>/
|
|
362
509
|
├── CLAUDE.md # ≤150-line thin shape, marker-wrapped
|
|
363
|
-
└── .claude/settings.local.json # per-machine hooks, knit-managed
|
|
510
|
+
└── .claude/settings.local.json # per-machine hooks, knit-managed
|
|
364
511
|
```
|
|
365
512
|
|
|
366
|
-
Zero external dependencies for the knowledge brain
|
|
513
|
+
**Zero external dependencies for the knowledge brain.** 492 tests. Strict-mode TypeScript.
|
|
367
514
|
|
|
368
|
-
|
|
515
|
+
---
|
|
369
516
|
|
|
370
|
-
|
|
517
|
+
## 📄 License
|
|
518
|
+
|
|
519
|
+
[MIT](./LICENSE) © 2026
|
|
520
|
+
|
|
521
|
+
<p align="center">
|
|
522
|
+
<sub>If knit saved you tokens, <a href="https://github.com/PDgit12/knit">give it a ⭐</a>.</sub>
|
|
523
|
+
</p>
|