knit-mcp 0.16.1 → 0.22.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.
- package/README.md +180 -141
- package/dist/cache-3QREKWAW.js +21 -0
- package/dist/chunk-2GDNMY7N.js +57 -0
- package/dist/{chunk-27TA2ZQZ.js → chunk-5EUQ2DCN.js} +12 -0
- package/dist/{chunk-2FAS6CV4.js → chunk-5R5YKDNT.js} +895 -13
- package/dist/{chunk-BBQSWT4H.js → chunk-6BQPXFRL.js} +40 -0
- package/dist/{chunk-VB2TIR6L.js → chunk-DIU7RE5X.js} +2 -2
- package/dist/{chunk-OINYMLOV.js → chunk-DXV5NAQ3.js} +10 -4
- package/dist/{chunk-ZESAIRIL.js → chunk-ESTWQMZZ.js} +61 -6
- package/dist/{tools-7VJRV64S.js → chunk-NT7S4F72.js} +591 -158
- package/dist/chunk-T55DZTYS.js +70 -0
- package/dist/{chunk-Q3GNWHEW.js → chunk-WPXK5IHO.js} +60 -9
- package/dist/{chunk-YRLAWCYW.js → chunk-X4PHSVRB.js} +399 -1
- package/dist/chunk-YINPCUVZ.js +198 -0
- package/dist/cli.js +42 -15
- package/dist/doctor-HKC7JQST.js +26 -0
- package/dist/{export-4BO6HCXP.js → export-QKUVOV3O.js} +3 -2
- package/dist/host-SZN2NCFM.js +18 -0
- package/dist/{install-agents-2JYKFLU6.js → install-agents-3ZTV6EQW.js} +8 -11
- package/dist/{instructions-4SLOUME2.js → instructions-N5VV4ESJ.js} +3 -1
- package/dist/{integration-scanner-LBD2PIZ3.js → integration-scanner-5O6XSGGP.js} +2 -2
- package/dist/prompts-3MSBEU5V.js +49 -0
- package/dist/{refresh-4X4HMDMT.js → refresh-4FWFEZP3.js} +4 -6
- package/dist/{setup-2YN36GWS.js → setup-GFU5HIA5.js} +144 -19
- package/dist/{status-RPHO7QQO.js → status-J2Q4ACID.js} +4 -4
- package/dist/tools-AVMVTHON.js +30 -0
- package/dist/{ui-GN4JT4XR.js → ui-W2SAVL73.js} +166 -82
- package/package.json +1 -1
- package/webapp/dist/assets/index-DxyZTqwU.js +40 -0
- package/webapp/dist/index.html +1 -1
- package/dist/cache-7S5DFFQ6.js +0 -21
- package/dist/chunk-FX3SVNHX.js +0 -364
- package/dist/chunk-JE4BZQUD.js +0 -333
- package/dist/chunk-OZCVBNHF.js +0 -120
- package/dist/chunk-QM4U75VE.js +0 -475
- package/dist/doctor-2ESSKFZE.js +0 -14
- package/webapp/dist/assets/index-BvEqg_UZ.js +0 -40
package/README.md
CHANGED
|
@@ -3,8 +3,6 @@
|
|
|
3
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
4
|
<img src="https://img.shields.io/badge/license-MIT-3b82f6?style=for-the-badge" alt="license" />
|
|
5
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/MCP%20tools-55-7c3aed?style=for-the-badge" alt="tools" />
|
|
7
|
-
<img src="https://img.shields.io/badge/agents-6-10b981?style=for-the-badge" alt="agents supported" />
|
|
8
6
|
<img src="https://img.shields.io/badge/local--first-100%25-3b82f6?style=for-the-badge" alt="local-first" />
|
|
9
7
|
</p>
|
|
10
8
|
|
|
@@ -20,14 +18,14 @@
|
|
|
20
18
|
<a href="#-quick-start">Quick start</a> ·
|
|
21
19
|
<a href="#-what-knit-is">What it is</a> ·
|
|
22
20
|
<a href="#-how-search-works">How search works</a> ·
|
|
23
|
-
<a href="#-
|
|
21
|
+
<a href="#-56-mcp-tools">Tools</a> ·
|
|
24
22
|
<a href="#-the-dashboard">Dashboard</a> ·
|
|
25
|
-
<a href="#-
|
|
23
|
+
<a href="#-why-knit">Why Knit</a>
|
|
26
24
|
</p>
|
|
27
25
|
|
|
28
26
|
---
|
|
29
27
|
|
|
30
|
-
## 🧠 What
|
|
28
|
+
## 🧠 What Knit is
|
|
31
29
|
|
|
32
30
|
Knit gives **any MCP-speaking coding agent** the right defaults automatically — because you can't predict how a user will phrase a request, and every agent (Claude Code, Cursor, Codex CLI, Cline, Continue, GitHub Copilot) ends up burning tokens re-discovering the same project facts. Knit does four jobs at once:
|
|
33
31
|
|
|
@@ -36,11 +34,11 @@ Knit gives **any MCP-speaking coding agent** the right defaults automatically
|
|
|
36
34
|
| 🧠 **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. Cross-project pool at `~/.knit/global/`. |
|
|
37
35
|
| 🪶 **Tokens** | `CLAUDE.md` is ~2 KB (project facts only). Protocol depth is fetched on demand via `knit_get_workflow(phase)`. Per-cache-hit savings ≈ 15K tokens (calibrated from instrumented RESEARCH phases — override via env). Reuse-ratio + ROI surfaced in the dashboard. |
|
|
38
36
|
| 🛠️ **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. |
|
|
39
|
-
| 📊 **Dashboard** |
|
|
37
|
+
| 📊 **Dashboard** | `knit` opens the brain — a local-first dashboard at `http://127.0.0.1:7421`: bento layout, brain savings, per-project ROI, **force-directed brain graph**, real-time sync via SSE. See [Dashboard](#-the-dashboard). |
|
|
40
38
|
|
|
41
39
|
**Local-first** invariant: zero cloud calls in memory/retrieval/classification. Dashboard binds to `127.0.0.1` only, with Host/Origin validation + CSP headers. Your brain stays on your machine.
|
|
42
40
|
|
|
43
|
-
|
|
41
|
+
One product: every design choice wins on memory, tokens, workflow, and analytics together.
|
|
44
42
|
|
|
45
43
|
---
|
|
46
44
|
|
|
@@ -48,12 +46,28 @@ It's a **single product**, not four. Every design choice has to win on memory +
|
|
|
48
46
|
|
|
49
47
|
```bash
|
|
50
48
|
npm install -g knit-mcp
|
|
51
|
-
knit setup #
|
|
52
|
-
knit
|
|
49
|
+
knit setup # one-time: register Knit with your agents (Claude Code / Cursor / Codex / …)
|
|
50
|
+
knit # open the brain — the dashboard at http://127.0.0.1:7421
|
|
53
51
|
```
|
|
54
52
|
|
|
53
|
+
Two commands: `knit setup` for one-time agent registration, then `knit` to open the brain. Agents communicate with the MCP server over stdio; that process is launched by the host, not invoked manually.
|
|
54
|
+
|
|
55
55
|
**No per-project setup.** Open your MCP-speaking agent in any project — the first MCP tool call auto-initializes the brain, hooks, and per-project CLAUDE.md block.
|
|
56
56
|
|
|
57
|
+
### First prompt — onboard your project
|
|
58
|
+
|
|
59
|
+
Once Knit is connected, open your project in your agent and paste this once. Fill in the brackets, or just describe the project in your own words — the agent does the rest:
|
|
60
|
+
|
|
61
|
+
> You have the Knit MCP connected. Call `knit_load_session`, then call `knit_onboard` with:
|
|
62
|
+
> - **project_description** — what this project is
|
|
63
|
+
> - **intent** — what I'm building right now
|
|
64
|
+
> - **strictness** — `off` | `warn` | `block` (how strictly to enforce the workflow)
|
|
65
|
+
> - **focus_domains** — comma-separated areas (e.g. `api, billing`)
|
|
66
|
+
>
|
|
67
|
+
> Then summarize what you configured and call `knit_classify_task` for my first task.
|
|
68
|
+
|
|
69
|
+
Knit persists these preferences and surfaces your project intent at the start of every session. It's a plain MCP tool, so the same prompt works on **any** host — Claude Code, Cursor, Codex, Cline, Continue, Copilot — new session or resumed.
|
|
70
|
+
|
|
57
71
|
### Adoption per agent
|
|
58
72
|
|
|
59
73
|
v0.14: a single `knit setup` detects **every** installed MCP-speaking agent on
|
|
@@ -78,8 +92,6 @@ per-agent manual setup, no copy-pasted JSON.
|
|
|
78
92
|
|
|
79
93
|
> **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.
|
|
80
94
|
|
|
81
|
-
> **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.
|
|
82
|
-
|
|
83
95
|
### Quiet mode
|
|
84
96
|
|
|
85
97
|
Knit ships **Protocol Guard in `warn` mode by default** — hooks print reminders, they never block. Fully silent:
|
|
@@ -120,68 +132,101 @@ Knit writes nowhere else on your machine.
|
|
|
120
132
|
|
|
121
133
|
---
|
|
122
134
|
|
|
135
|
+
## 🎬 A real session
|
|
136
|
+
|
|
137
|
+
A new TypeScript project, from install to a compounding brain:
|
|
138
|
+
|
|
139
|
+
1. **Install + register.** `npm i -g knit-mcp && knit setup` — Knit registers with every MCP-speaking agent on the machine.
|
|
140
|
+
2. **Onboard.** Open the project in your agent and paste the onboarding prompt. The agent calls `knit_onboard` — *"Project: a billing API. Intent: add Stripe webhooks. strictness: warn. focus: api, webhooks."* Knit persists those preferences and records the intent.
|
|
141
|
+
3. **Ask for the feature.** The agent calls `knit_classify_task` → e.g. *complex, high-risk* → plan mode. It pulls context with `knit_build_context` (ripple effects), `knit_search_learnings` (anything learned before), and `knit_query_dependents` on the files it will touch.
|
|
142
|
+
4. **Build + verify.** It implements, runs `knit_verify_claim` to check its claims against the knowledge graph, and `knit_record_learning` to save what was non-obvious.
|
|
143
|
+
5. **Compound.** Next session, `knit_load_session` surfaces your intent plus that learning — the brain is already sharper. Run **`knit`** to see it: the dashboard shows the project, its knowledge index, learnings, and token ROI building over time. Hit **Refresh** to re-index or **Export brain** to write an Obsidian vault.
|
|
144
|
+
|
|
145
|
+
Every step is local, deterministic, and works on any MCP host.
|
|
146
|
+
|
|
123
147
|
## 🔍 How search works
|
|
124
148
|
|
|
125
149
|
Knit's retrieval is **BM25 + Reciprocal Rank Fusion** over your learnings,
|
|
126
|
-
session summaries, and the cross-project pool, with two
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
- **
|
|
135
|
-
|
|
136
|
-
- **
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
direct BM25 hit so genuine matches always rank higher.
|
|
158
|
-
|
|
159
|
-
**What it still cannot do.** Multi-word paraphrase ("how do schema
|
|
160
|
-
changes ship" with no shared terms). Deep abstraction-level bridging
|
|
161
|
-
("data consistency" → "atomic temp+rename"). Question intent
|
|
162
|
-
("what's the right pattern for X"). Negation. Cross-entry synthesis
|
|
163
|
-
("based on the auth lessons, what should I do for OAuth"). These need
|
|
164
|
-
either embeddings (model dependency + bundle weight, breaks local-first
|
|
165
|
-
unless run locally via ONNX) or an LLM call layer (Knit-as-retrieval
|
|
166
|
-
becomes Knit-as-agent, different identity). v0.20+ candidate: hybrid
|
|
167
|
-
retrieval (BM25 + local embeddings via RRF) — opt-in, bench-gated.
|
|
168
|
-
|
|
169
|
-
**The practical implication.** Search with words close to how you
|
|
170
|
-
recorded the learning, OR words that have a synonym pair in the
|
|
171
|
-
dictionary. If you write a learning about *webhook signatures*, you
|
|
172
|
-
can now search either *webhook signatures* OR *hook signatures* —
|
|
173
|
-
the dictionary bridges those. For genuinely different vocabulary that
|
|
174
|
-
isn't in the synonym table, use `knit_search_global_learnings` to widen
|
|
175
|
-
the corpus, or call `knit_search_sessions` to pull from past narrative
|
|
176
|
-
summaries that may use more terms.
|
|
177
|
-
|
|
178
|
-
**Bench numbers (v0.16):** synthetic 88.0% top-1 / **100% recall@5**,
|
|
179
|
-
learnings (real-prose) 86.7% top-1 / 96.7% recall@5. Both default ON;
|
|
180
|
-
opt-out via `enableNgramFallback: false` + `enableSynonyms: false` for
|
|
181
|
-
a strict lexical-only baseline.
|
|
150
|
+
session summaries, and the cross-project pool, with two lexical-bridging
|
|
151
|
+
layers on top: a **2-gram fallback** for typos and rare compounds, and
|
|
152
|
+
**curated coding-domain synonym expansion** for common semantic-gap pairs.
|
|
153
|
+
No vector embeddings, no remote inference, no API calls.
|
|
154
|
+
|
|
155
|
+
The design is deliberate:
|
|
156
|
+
|
|
157
|
+
- **Deterministic** — same query, same ranking, every time. No model drift.
|
|
158
|
+
- **Fast** — sub-millisecond on typical project corpora (≤ 1K entries). No cold start.
|
|
159
|
+
- **Local-first** — zero network calls; your memory never leaves the machine.
|
|
160
|
+
- **Auditable** — every hit is explainable from term overlap plus the 50-pair synonym dictionary.
|
|
161
|
+
|
|
162
|
+
**Capabilities.** Exact term + identifier match (`knit_classify_task`),
|
|
163
|
+
rare-term emphasis (`PIPE_BUF`), multi-word ranking, tag filtering,
|
|
164
|
+
cross-project diversification (max 2 per project), branch diversification on
|
|
165
|
+
sessions (max 2 per branch), typo recovery via 2-gram fallback
|
|
166
|
+
(`knit_clasify` → `knit_classify_task`), and synonym recovery (`hook` ↔
|
|
167
|
+
`webhook`, `schema` ↔ `migration`, `auth` ↔ `authentication`, `cache` ↔
|
|
168
|
+
`memo`, `deploy` ↔ `ship` ↔ `release`, … — see
|
|
169
|
+
[`src/engine/retrieval/synonyms.ts`](src/engine/retrieval/synonyms.ts) for the
|
|
170
|
+
full ~50-pair dictionary). Synonym matches score at 0.4× a direct hit, so exact
|
|
171
|
+
matches always rank higher.
|
|
172
|
+
|
|
173
|
+
**Benchmarks.** Synthetic 88.0% top-1 / **100% recall@5**; real-prose learnings
|
|
174
|
+
86.7% top-1 / 96.7% recall@5. Both layers default on; set
|
|
175
|
+
`enableNgramFallback: false` + `enableSynonyms: false` for a strict
|
|
176
|
+
lexical-only baseline.
|
|
177
|
+
|
|
178
|
+
**Roadmap.** A hybrid retriever (BM25 + local embeddings, fused via RRF) for
|
|
179
|
+
paraphrase and abstraction-bridging is a v0.21+ candidate — opt-in,
|
|
180
|
+
bench-gated, and local-first.
|
|
182
181
|
|
|
183
182
|
---
|
|
184
183
|
|
|
184
|
+
## ✨ What's new in v0.22.0
|
|
185
|
+
|
|
186
|
+
- **Host composition.** Knit detects the host at the MCP handshake (`clientInfo`) and composes with its native orchestration on complex tasks: Claude Code → dynamic workflow, Cursor → parallel worktree agents, Codex → subagents, Copilot/VS Code → agent mode + `/mcp.knit.*`. **Suggest-only hosts stay suggest-only** — Knit suggests its own worktree primitive, never fakes auto-trigger.
|
|
187
|
+
- **Stale-index fix.** `knit_query_*` and `knit_verify_claim` no longer return a confident *false* answer when a file changed after the index was built — `getBrain` auto-refreshes on source drift, and `verify_claim` **self-heals** (rebuilds + re-verifies in one call).
|
|
188
|
+
- **Full tool-use.** `knit_classify_task` returns an ordered, signal-gated `tool_plan` so the diverse tool surface actually gets used instead of collapsing to 1–2 tools.
|
|
189
|
+
- **Per-host adherence hooks** for Cursor / Codex / Copilot (merged with existing config; non-Claude hooks marked `_knitUnverified` — confirm in-host).
|
|
190
|
+
- **Token optimization.** Hierarchical retrieval everywhere (headline + `id` + preview; full lesson via `knit_get_learning`), `token_mode: lean`, and a handshake-instructions rewrite that's **~22% leaner** while adding the new clauses.
|
|
191
|
+
- **56 tools** (Tier-1 37). Shipped after a six-dimension audit and a real-life stdio end-to-end run across five `clientInfo` values.
|
|
192
|
+
|
|
193
|
+
## ✨ What's new in v0.21.0
|
|
194
|
+
|
|
195
|
+
- **Onboarding (`knit_onboard`).** Paste the README prompt after connecting Knit, describe your project + how you want Knit to behave, and the agent persists your preferences (strictness, features, focus domains) and records the project intent — surfaced every session, on any MCP host.
|
|
196
|
+
- **Dashboard actions.** The dashboard can now **Refresh** (re-index a project) and **Export all projects** (Obsidian vault), in addition to viewing. Actions run as child processes (non-blocking) and stay loopback-bound + Host/Origin-gated.
|
|
197
|
+
- **56 tools** (Tier-1 37). Shipped after a second six-dimension audit (0 critical) and a real-life end-to-end run.
|
|
198
|
+
|
|
199
|
+
## ✨ What's new in v0.20.0
|
|
200
|
+
|
|
201
|
+
v0.20 makes Knit a **fully-ready, dashboard-first brain** — a consolidated
|
|
202
|
+
release (internal phases v0.17–v0.20) shipped after a six-dimension deep-clean
|
|
203
|
+
audit (0 critical findings).
|
|
204
|
+
|
|
205
|
+
- **Brain freshness layer.** One shared primitive governs staleness across every
|
|
206
|
+
store, so the brain never serves data it can't vouch for: handoffs auto-clear
|
|
207
|
+
once resolved or stale, idle classifier signals decay, old cross-project
|
|
208
|
+
learnings drop from search, and a learning that names a now-deleted file is
|
|
209
|
+
flagged. Freshness drives prune/clear/flag only — never the bench-gated
|
|
210
|
+
retrieval ranking.
|
|
211
|
+
- **Tool count you can explain.** `knit doctor` and `knit_list_features` print
|
|
212
|
+
the live active count *with the reason* (e.g. `46 of 56 = 37 always-on + 9
|
|
213
|
+
teams [≥3 domains] · …`), so a number that legitimately varies by project
|
|
214
|
+
shape stops looking like a bug. A drift test pins the docs to the registry.
|
|
215
|
+
- **Stays on-protocol mid-session.** A throttled, escalating reminder rides the
|
|
216
|
+
MCP tool response when an agent drifts (e.g. records work before classifying)
|
|
217
|
+
— reaching every MCP host, not just Claude Code. Silence with
|
|
218
|
+
`knit_set_protocol_strictness({ level: "off" })`.
|
|
219
|
+
- **Dashboard-first.** Run **`knit`** to open the brain; the agent/stdio path is
|
|
220
|
+
unchanged. The dashboard gains a Knowledge-index view and a `knit doctor`
|
|
221
|
+
webapp health check. (v0.21 adds Refresh + Export actions to the dashboard;
|
|
222
|
+
`knit setup` remains CLI-only.)
|
|
223
|
+
- **Composes with your setup.** Scans Claude Code Skills
|
|
224
|
+
(`.claude/skills/<name>/SKILL.md`) alongside slash commands; positioning leads
|
|
225
|
+
with the integrated brain rather than competitor comparisons.
|
|
226
|
+
|
|
227
|
+
Security/hygiene from the audit: the command/Skill scanner now guards size and
|
|
228
|
+
rejects symlinks before reading (no OOM, no arbitrary-file reads into the brain).
|
|
229
|
+
|
|
185
230
|
## ✨ What's new in v0.16.0
|
|
186
231
|
|
|
187
232
|
v0.16 is the **semantic-lite release**. Two retrieval improvements that
|
|
@@ -268,6 +313,7 @@ return `{ status: 'protocol_required', next_action: '...' }` instead of
|
|
|
268
313
|
proceeding — the agent reads the response, follows the breadcrumb, retries.
|
|
269
314
|
This is the universality answer: same enforcement, transport layer instead
|
|
270
315
|
of host layer. Default strictness stays `warn` so existing flows are unchanged.
|
|
316
|
+
(v0.20 extends this with mid-session re-surfacing — see *What's new in v0.20.0* above.)
|
|
271
317
|
|
|
272
318
|
### ⚡ Agent-native slash-command auto-detection
|
|
273
319
|
|
|
@@ -325,7 +371,7 @@ A single command opens a local-first analytics surface at `http://127.0.0.1:7421
|
|
|
325
371
|
|
|
326
372
|
**Real-time sync via SSE.** The server watches `~/.knit/` via `fs.watch`; any agent recording a learning anywhere updates the open dashboard within ~250ms. No polling.
|
|
327
373
|
|
|
328
|
-
### 🔐 Security hardening
|
|
374
|
+
### 🔐 Security hardening
|
|
329
375
|
|
|
330
376
|
The dashboard is a localhost HTTP server, which has real attack surface. v0.13 closes it:
|
|
331
377
|
|
|
@@ -363,30 +409,30 @@ The dashboard works regardless of which agent you use — it reads the brain fro
|
|
|
363
409
|
| `knit_classify_task` response | ~500 tok | **~150 tok** | 70% |
|
|
364
410
|
| `knit_load_session` response | ~3–5 KB | **~1.5 KB** | ~60% |
|
|
365
411
|
|
|
366
|
-
Each surface gets a `healthy | warn | over-budget` verdict from `knit_brain_status.token_budget
|
|
412
|
+
Each surface gets a `healthy | warn | over-budget` verdict from `knit_brain_status.token_budget`, enforced by a regression test.
|
|
367
413
|
|
|
368
414
|
---
|
|
369
415
|
|
|
370
416
|
## 📊 The dashboard
|
|
371
417
|
|
|
372
|
-
Run
|
|
418
|
+
Run **`knit`** to open the brain (the local analytics surface); `knit ui` is an explicit alias:
|
|
373
419
|
|
|
374
420
|
```bash
|
|
375
|
-
knit
|
|
421
|
+
knit
|
|
376
422
|
# Knit Dashboard — http://127.0.0.1:7421
|
|
377
423
|
# Reading from: /Users/<you>/.knit
|
|
378
424
|
# Press Ctrl-C to stop.
|
|
379
|
-
# (
|
|
425
|
+
# (opens your default browser; visit the URL above if it does not)
|
|
380
426
|
```
|
|
381
427
|
|
|
382
428
|
| Feature | What you see |
|
|
383
429
|
|---|---|
|
|
384
430
|
| **Bento home** | Big "Net tokens saved" hero card (dark), live recent activity (green "live" dot when SSE connected), memory hit-rate gauge, top projects by ROI as color-blocked cards |
|
|
385
431
|
| **Brain graph** | Force-directed visualization of one project's learnings. Nodes sized by access count, colored by domain. Edges by Jaccard similarity over tags + domains. Click any node → side panel with the full lesson. Threshold slider live-recomputes the graph. |
|
|
386
|
-
| **Per-project deep dive** | Hero card with verdict tone (cold/warming/compounding/strong), retrieval signals, classifications-by-tier breakdown, top domains heatmap, searchable learnings list |
|
|
387
|
-
| **Health** | Install diagnostics — Node version, Knit version, ~/.knit permissions, MCP registration
|
|
432
|
+
| **Per-project deep dive** | Hero card with verdict tone (cold/warming/compounding/strong), retrieval signals, classifications-by-tier breakdown, top domains heatmap, searchable learnings list, Knowledge index, and **Refresh** (re-index this project) + **Export all projects** (Obsidian vault) actions |
|
|
433
|
+
| **Health** | Install diagnostics — Node version, Knit version, ~/.knit permissions, per-agent MCP registration |
|
|
388
434
|
|
|
389
|
-
**API endpoints** (
|
|
435
|
+
**API endpoints** (127.0.0.1 only, Host/Origin-gated):
|
|
390
436
|
|
|
391
437
|
- `GET /api/version` — runtime version + update check + security metadata
|
|
392
438
|
- `GET /api/brain/summary` — global counts
|
|
@@ -394,20 +440,28 @@ knit ui
|
|
|
394
440
|
- `GET /api/projects` — project list
|
|
395
441
|
- `GET /api/projects/:id/learnings` — full learning entries
|
|
396
442
|
- `GET /api/projects/:id/metrics` — compounding ROI for one project
|
|
443
|
+
- `GET /api/projects/:id/knowledge` — knowledge-index summary
|
|
397
444
|
- `GET /api/projects/:id/graph` — force-directed node + edge data (Jaccard threshold tunable)
|
|
398
445
|
- `GET /api/global/learnings` — cross-project pool
|
|
399
446
|
- `GET /api/doctor` — install diagnostics
|
|
400
447
|
- `GET /api/events` — Server-Sent Events stream for real-time sync
|
|
448
|
+
- `POST /api/projects/:id/refresh` — re-index a project (source path from its meta; spawned as a child process)
|
|
449
|
+
- `POST /api/export` — export all projects to a fixed `~/.knit/exports/` vault
|
|
401
450
|
|
|
402
451
|
---
|
|
403
452
|
|
|
404
|
-
## 🛠️
|
|
453
|
+
## 🛠️ 56 MCP Tools
|
|
405
454
|
|
|
406
|
-
> **
|
|
407
|
-
>
|
|
408
|
-
>
|
|
409
|
-
>
|
|
410
|
-
>
|
|
455
|
+
> **37 always-on, up to 19 conditional, 56 total.** The active count varies by
|
|
456
|
+
> project shape, so it isn't one fixed number — it's `37` plus whichever
|
|
457
|
+
> conditional groups your project triggers: teams (9 tools, auto-on when ≥3
|
|
458
|
+
> domains detected), diagnostics (6 tools, on during your first session),
|
|
459
|
+
> subagents (1 tool, auto-on when `.claude/agents/` exists), and admin (3 tools,
|
|
460
|
+
> opt-in via `knit_enable_feature("admin")`). That's why one machine shows 46
|
|
461
|
+
> and another 44 — it reflects each project's shape. Run `knit doctor` (or call
|
|
462
|
+
> `knit_list_features`) for your project's **live count and the reason for it**.
|
|
463
|
+
> The groups below cover the main tools; `knit_list_features` is the
|
|
464
|
+
> authoritative live list.
|
|
411
465
|
|
|
412
466
|
<details open>
|
|
413
467
|
<summary><strong>🕸️ Knowledge graph</strong> <em>(Tier 1, ~5ms)</em></summary>
|
|
@@ -453,8 +507,9 @@ knit ui
|
|
|
453
507
|
| `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`. |
|
|
454
508
|
| `knit_get_suggestions` | Adaptive warnings from past patterns in given domains. |
|
|
455
509
|
| `knit_reflect` | Detect patterns across recorded learnings (per-project + global pool). Useful with ≥3 entries. |
|
|
456
|
-
| `
|
|
457
|
-
| `
|
|
510
|
+
| `knit_onboard` | **v0.21.** One-time onboarding: captures the project + how the user wants Knit, persists preferences (strictness, features, focus domains), records the project intent. |
|
|
511
|
+
| `knit_scan_agent_commands` | Scan each MCP host's slash-command + skill directories; surface user-defined commands so Knit composes with them. |
|
|
512
|
+
| `knit_suggest_command` | Per-phase lookup against scanned commands; returns the agent-native command to invoke. |
|
|
458
513
|
|
|
459
514
|
</details>
|
|
460
515
|
|
|
@@ -477,7 +532,7 @@ Runtime enforcement of the Knit protocol via PreToolUse and SessionStart hooks.
|
|
|
477
532
|
|---|---|
|
|
478
533
|
| `knit_brain_status` | Brain health + **token-budget** verdicts per surface + `update_available` notification + integrations summary. |
|
|
479
534
|
| `knit_list_features` | Surfaces hidden tools and tells you how to enable them. The escape hatch. |
|
|
480
|
-
| `knit_enable_feature` | Flip on a Tier-2/3 feature (`teams`, `subagents`, `admin`). Emits `notifications/tools/list_changed` — new tools appear without
|
|
535
|
+
| `knit_enable_feature` | Flip on a Tier-2/3 feature (`teams`, `subagents`, `admin`). Emits `notifications/tools/list_changed` — new tools appear without an agent restart. |
|
|
481
536
|
| `knit_disable_feature` | Symmetric to enable. |
|
|
482
537
|
| `knit_scan_integrations` | Re-detect existing workflow frameworks (Ruflo, gstack, CodeTour, Conductor, other MCP servers, custom CLAUDE.md sections). |
|
|
483
538
|
| `knit_compounding_metrics` | Quantifies *"Knit gets cheaper over time"* — sessions, cache hits, reuse-ratio %, estimated tokens saved. Verdict: `cold \| warming \| compounding \| strong`. |
|
|
@@ -515,7 +570,9 @@ Runtime enforcement of the Knit protocol via PreToolUse and SessionStart hooks.
|
|
|
515
570
|
|
|
516
571
|
| Tool | What it does |
|
|
517
572
|
|---|---|
|
|
518
|
-
| `knit_setup_project` | Bootstrap domain teams for a non-code project. One-time. |
|
|
573
|
+
| `knit_setup_project` | Bootstrap domain teams for a non-code project (legal, marketing, research). One-time. |
|
|
574
|
+
| `knit_prune_sessions` | Prune `sessions.jsonl` by age (default 90 days). Atomic rewrite. Auto-prune handles this normally. |
|
|
575
|
+
| `knit_reset_calibration` | Wipe per-project classifier calibration. Discards accumulated tuning. |
|
|
519
576
|
|
|
520
577
|
</details>
|
|
521
578
|
|
|
@@ -626,7 +683,7 @@ knit install-agents --refresh # re-fetch from network even if cached
|
|
|
626
683
|
"token_budget": {
|
|
627
684
|
"budgets": {
|
|
628
685
|
"claude_md": { "bytes": 2048, "target_bytes": 6500, "verdict": "healthy" },
|
|
629
|
-
"tool_registry": { "bytes": 8400, "target_bytes": 8500, "verdict": "healthy", "active_tool_count":
|
|
686
|
+
"tool_registry": { "bytes": 8400, "target_bytes": 8500, "verdict": "healthy", "active_tool_count": 46, "total_tool_count": 56 },
|
|
630
687
|
"instructions": { "bytes": 2200, "target_bytes": 2500, "verdict": "healthy" },
|
|
631
688
|
"per_session_overhead": { "bytes": 12648, "target_bytes": 17500, "verdict": "healthy" }
|
|
632
689
|
},
|
|
@@ -641,7 +698,7 @@ knit install-agents --refresh # re-fetch from network even if cached
|
|
|
641
698
|
"update_available": {
|
|
642
699
|
"current": "0.8.0",
|
|
643
700
|
"latest": "0.9.0",
|
|
644
|
-
"upgrade": "Restart
|
|
701
|
+
"upgrade": "Restart your agent to spawn a fresh MCP — npx will auto-fetch the new version."
|
|
645
702
|
}
|
|
646
703
|
}
|
|
647
704
|
```
|
|
@@ -652,14 +709,19 @@ Pair with `knit_compounding_metrics` for the value side of the ledger (sessions,
|
|
|
652
709
|
|
|
653
710
|
## 💻 CLI
|
|
654
711
|
|
|
712
|
+
The surface is dashboard-first: `knit` opens the brain, `knit setup` performs
|
|
713
|
+
one-time agent registration. The remaining commands are operational tooling for
|
|
714
|
+
scripting and CI; their views are progressively moving into the dashboard.
|
|
715
|
+
|
|
655
716
|
```bash
|
|
656
|
-
knit
|
|
657
|
-
knit
|
|
658
|
-
knit
|
|
659
|
-
knit
|
|
660
|
-
knit
|
|
661
|
-
knit
|
|
662
|
-
knit
|
|
717
|
+
knit # open the brain (the dashboard at http://127.0.0.1:7421)
|
|
718
|
+
knit setup # one-time: detect installed MCP-speaking agents and register Knit in each
|
|
719
|
+
knit doctor # install health check: version, per-agent MCP registration, webapp bundle, knowledgebase
|
|
720
|
+
knit ui # explicit alias for the dashboard (same as bare `knit`)
|
|
721
|
+
knit status # terminal snapshot: sessions, learnings, hit rate, knowledge-index health
|
|
722
|
+
knit refresh # rebuild the knowledge index from source
|
|
723
|
+
knit install-agents # install subagent definitions into <project>/.claude/agents/
|
|
724
|
+
knit export <fmt> # export learnings (supported targets: obsidian)
|
|
663
725
|
```
|
|
664
726
|
|
|
665
727
|
Example `knit status`:
|
|
@@ -677,7 +739,7 @@ Knowledge Base
|
|
|
677
739
|
|
|
678
740
|
Token budget (v0.16)
|
|
679
741
|
CLAUDE.md: 2.0 KB → healthy
|
|
680
|
-
Tool registry: ~13 KB → warn (
|
|
742
|
+
Tool registry: ~13 KB → warn (46 active / 56 total)
|
|
681
743
|
Instructions: ~4 KB → healthy
|
|
682
744
|
Per-session total: ~20 KB → healthy
|
|
683
745
|
|
|
@@ -689,58 +751,32 @@ Compounding
|
|
|
689
751
|
|
|
690
752
|
---
|
|
691
753
|
|
|
692
|
-
##
|
|
693
|
-
|
|
694
|
-
| | gstack (skills) | ECC (agents) | Ruflo (orchestration) | **Knit** |
|
|
695
|
-
|--|---|---|---|---|
|
|
696
|
-
| **Bet** | Slash-command flows | Agent rules | 100+ agents in swarms | **One disciplined agent, compounding memory** |
|
|
697
|
-
| **Setup** | Install skills per-project | Manual `.claude/` setup | `npx ruflo init` (heavy) | **`npx knit-mcp setup` (light)** |
|
|
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** |
|
|
699
|
-
| **Token cost** | Skills loaded into context | Rules loaded into context | 314 tools advertised | **~2 KB CLAUDE.md, tier-gated registry, budget guardrail** |
|
|
700
|
-
| **Parallel work** | None | None | Multi-agent swarms + federation | **Team-scoped git worktrees** |
|
|
701
|
-
| **Cloud dependency** | None | None | Cognitum.One (cloud backbone) | **None — fully local** |
|
|
702
|
-
| **Self-measurement** | None | None | Cost-tracker plugin | **`knit_brain_status.token_budget` + `knit_compounding_metrics`** |
|
|
703
|
-
| **Anti-hallucination** | None | None | None advertised | **`knit_verify_claim` + citation rule + pre/post import validation** |
|
|
704
|
-
| **Non-code projects** | No | No | Limited | **Description-driven via `knit_setup_project`** |
|
|
754
|
+
## 🧠 Why Knit
|
|
705
755
|
|
|
706
|
-
|
|
756
|
+
Knit is a **project brain your agent plugs into** — a live code knowledge graph wired into ranked memory and a task classifier that routes work by impact. The pieces aren't sold separately; the value is the integration:
|
|
707
757
|
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
758
|
+
- **Graph-grounded recall** — memory ranked by what your change *structurally* touches (dependents, fanout), not just keyword overlap.
|
|
759
|
+
- **Impact classifier** — every task is sized (Inquiry → Trivial → Standard → Complex) and complex work auto-enters plan mode. The brain decides *how carefully* to handle a change, not just what to recall.
|
|
760
|
+
- **Self-calibrating** — `knit_record_false_positive` shifts the classifier's thresholds per project; it gets less wrong over time.
|
|
761
|
+
- **Token accounting** — `knit_compounding_metrics` makes "cheaper over time" chartable per project.
|
|
762
|
+
- **Parallel team worktrees** — multi-domain work fans out into isolated git worktrees so agents don't collide.
|
|
763
|
+
- **Brain integrity** — a freshness layer keeps every datum trustworthy: stale handoffs auto-clear, idle classifier signals decay, deleted-file references get flagged.
|
|
764
|
+
- **Fully local, zero-glue** — `npx knit-mcp setup` and it's a brain every MCP host (Claude Code, Cursor, Codex, Cline, Continue, Copilot) shares. No cloud, no SDK wiring.
|
|
711
765
|
|
|
712
|
-
|
|
766
|
+
**"Why use Knit if my agent already has memory?"** Your agent's memory *stores notes*; Knit *decides* — it ranks recall by what your change structurally touches, classifies each task to set the right workflow depth, and tracks the cost over time. Graph-grounded routing, not a markdown notepad.
|
|
713
767
|
|
|
714
|
-
|
|
715
|
-
|--|---|---|---|---|
|
|
716
|
-
| **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. |
|
|
717
|
-
| **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. |
|
|
718
|
-
| **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. |
|
|
719
|
-
| **Workflow primitive** | None — pure memory | Agent-managed memory operations | None — pure retrieval | **4-tier classifier + plan-mode + protocol guard + parallel team worktrees.** |
|
|
720
|
-
| **Self-calibration** | No | No | No | **Per-project classifier calibration** (v0.11): user FP feedback shifts thresholds; classifier gets less wrong over time. |
|
|
768
|
+
Knit also **composes with** whatever else you run: `knit_scan_integrations` detects existing workflow frameworks and slash commands and defers to them where they fit — Knit stays the memory + classification brain underneath.
|
|
721
769
|
|
|
722
|
-
###
|
|
770
|
+
### Retrieval benchmarks
|
|
723
771
|
|
|
724
|
-
|
|
772
|
+
Knit's retrieval is BM25 + reciprocal-rank fusion + graph traversal — **vectorless, deterministic, auditable**, no embedding model or cloud call. In-repo regression gates:
|
|
725
773
|
|
|
726
|
-
|
|
|
727
|
-
|
|
728
|
-
|
|
|
729
|
-
|
|
|
730
|
-
|
|
731
|
-
Run it yourself: `npm run bench`. Source: [`benchmarks/retrieval-synthetic.ts`](./benchmarks/retrieval-synthetic.ts).
|
|
732
|
-
|
|
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).
|
|
734
|
-
|
|
735
|
-
**Knit isn't trying to be a better mem0.** It's a different product:
|
|
736
|
-
- **MCP-native + zero-glue install** — mem0/Letta require SDK integration; Knit drops into any MCP host (Claude Code, Cursor, Codex) with one command.
|
|
737
|
-
- **Workflow primitive** — the 4-tier classifier + plan-mode + protocol guard + team worktrees is what makes Knit a *command layer*, not a memory library.
|
|
738
|
-
- **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.
|
|
739
|
-
- **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.
|
|
740
|
-
|
|
741
|
-
### What's deferred
|
|
774
|
+
| Harness | Top-1 | Recall@5 | Run it |
|
|
775
|
+
|---|---|---|---|
|
|
776
|
+
| 50-question synthetic | **88%** | **100%** | `npm run bench` |
|
|
777
|
+
| 30-question narrative prose | **86.7%** | **96.7%** | `npm run bench:learnings` |
|
|
742
778
|
|
|
743
|
-
|
|
779
|
+
These are focused in-repo regression gates that block a merge if retrieval degrades. A run on a standard long-memory benchmark and a hybrid BM25 + local-embeddings retriever are v0.21+ candidates.
|
|
744
780
|
|
|
745
781
|
---
|
|
746
782
|
|
|
@@ -748,6 +784,9 @@ LongMemEval-S R@5/R@10 + LOCOMO LLM-as-Judge runs are on the roadmap (v0.13+). U
|
|
|
748
784
|
|
|
749
785
|
| Version | Headline |
|
|
750
786
|
|---|---|
|
|
787
|
+
| **v0.22.0** | **Host composition + full tool-use + stale-index fix.** Knit detects the host at the handshake and composes with its native orchestration (Claude Code dynamic workflows, Cursor worktree agents, Codex subagents, Copilot/VS Code `/mcp.knit.*`); suggest-only hosts stay suggest-only. `getBrain` auto-refreshes a stale index and `knit_verify_claim` self-heals, so `query_*`/`verify` never return a confident false answer. `knit_classify_task` returns a signal-gated `tool_plan`; per-host adherence hooks (Cursor/Codex/Copilot, unverified-in-host flagged); `orchestration`/`token_mode` onboarding prefs; hierarchical retrieval + a ~22% leaner handshake. Shipped after a six-dimension audit + a real-life stdio E2E across five `clientInfo` values (incl. a live mid-session no-staleness run). 56 tools, 935 tests. |
|
|
788
|
+
| **v0.21.0** | **Onboarding + dashboard actions.** `knit_onboard` captures the project + how the user wants Knit (preferences persisted, intent surfaced every session, host-agnostic). The dashboard gains **Refresh** + **Export all projects** actions (non-blocking child processes, Host/Origin-gated). New `GET /api/projects/:id/knowledge` + a `knit doctor` webapp check. Shipped after a second six-dimension audit (0 critical) + a real-life E2E. 56 tools. |
|
|
789
|
+
| **v0.20.0** | **Brain integrity + clarity + dashboard-first.** A freshness layer keeps every datum trustworthy (handoffs auto-clear, idle classifier signals decay, deleted-file references get flagged). `knit doctor`/`knit_list_features` explain the live tool count. Mid-session protocol re-surfacing keeps agents on-protocol across every MCP host. **`knit`** opens the brain dashboard; a read-only Knowledge-index view + Skills composition land. Removed competitor comparisons for intrinsic positioning. Shipped after a six-dimension deep-clean audit (0 critical). 55 tools, 855 tests. |
|
|
751
790
|
| **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
791
|
| **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
792
|
| **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. |
|
|
@@ -757,7 +796,7 @@ LongMemEval-S R@5/R@10 + LOCOMO LLM-as-Judge runs are on the roadmap (v0.13+). U
|
|
|
757
796
|
| **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. |
|
|
758
797
|
| **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. |
|
|
759
798
|
| **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. |
|
|
760
|
-
| **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.
|
|
799
|
+
| **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. 53 tools, 636 tests. |
|
|
761
800
|
| **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. |
|
|
762
801
|
| **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. |
|
|
763
802
|
| **v0.9.0** | Hook-level enforcement · citation rule · `knit_verify_claim` · auto-search in classify · `suggested_reads` · `knit_get_learning` · `knit_consolidate_learnings`. |
|
|
@@ -800,7 +839,7 @@ npm run build # compile CLI + MCP server + webapp
|
|
|
800
839
|
```
|
|
801
840
|
knit (npm package)
|
|
802
841
|
├── dist/cli.js # CLI: setup, doctor, ui, status, refresh, install-agents, export
|
|
803
|
-
└── dist/mcp/server.js # MCP server:
|
|
842
|
+
└── dist/mcp/server.js # MCP server: 56 tools (tier-gated), auto-init
|
|
804
843
|
|
|
805
844
|
per-project, in ~/.knit/projects/<hash>/
|
|
806
845
|
├── knowledge.json # import graph + exports + test map
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import {
|
|
2
|
+
detectProjectRoot,
|
|
3
|
+
getBrain,
|
|
4
|
+
refreshBrain,
|
|
5
|
+
resetStalenessThrottle
|
|
6
|
+
} from "./chunk-5R5YKDNT.js";
|
|
7
|
+
import "./chunk-X4PHSVRB.js";
|
|
8
|
+
import "./chunk-6BQPXFRL.js";
|
|
9
|
+
import "./chunk-2GDNMY7N.js";
|
|
10
|
+
import "./chunk-WKQHCLLO.js";
|
|
11
|
+
import "./chunk-V54QPQ6K.js";
|
|
12
|
+
import "./chunk-POXT5OYN.js";
|
|
13
|
+
import "./chunk-DIU7RE5X.js";
|
|
14
|
+
import "./chunk-7UFS67HP.js";
|
|
15
|
+
import "./chunk-5EUQ2DCN.js";
|
|
16
|
+
export {
|
|
17
|
+
detectProjectRoot,
|
|
18
|
+
getBrain,
|
|
19
|
+
refreshBrain,
|
|
20
|
+
resetStalenessThrottle
|
|
21
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// src/engine/freshness.ts
|
|
2
|
+
import { existsSync } from "fs";
|
|
3
|
+
import { isAbsolute, resolve } from "path";
|
|
4
|
+
var MS_PER_DAY = 864e5;
|
|
5
|
+
var FRESHNESS = {
|
|
6
|
+
/** A handoff older than this is considered abandoned, not in-flight. */
|
|
7
|
+
HANDOFF_TTL_DAYS: 14,
|
|
8
|
+
/** Global cross-project learnings older than this drop out of search. */
|
|
9
|
+
GLOBAL_LEARNING_TTL_DAYS: 365,
|
|
10
|
+
/** Classifier FP counters idle longer than this decay (stale tuning signal). */
|
|
11
|
+
CALIBRATION_DECAY_DAYS: 120,
|
|
12
|
+
/** Project session entries older than this are pruned. */
|
|
13
|
+
SESSION_TTL_DAYS: 90,
|
|
14
|
+
/** Project learnings older than this are pruned (FPs + accessed entries kept). */
|
|
15
|
+
LEARNING_TTL_DAYS: 180,
|
|
16
|
+
/** Re-run throttle: at most one age-prune sweep per project per this window. */
|
|
17
|
+
PRUNE_THROTTLE_DAYS: 1
|
|
18
|
+
};
|
|
19
|
+
function ageDays(iso, nowMs = Date.now()) {
|
|
20
|
+
if (typeof iso !== "string" || iso.length === 0) return null;
|
|
21
|
+
const t = Date.parse(iso);
|
|
22
|
+
if (!Number.isFinite(t)) return null;
|
|
23
|
+
return (nowMs - t) / MS_PER_DAY;
|
|
24
|
+
}
|
|
25
|
+
function isStale(iso, maxAgeDays, nowMs = Date.now()) {
|
|
26
|
+
const age = ageDays(iso, nowMs);
|
|
27
|
+
if (age === null) return false;
|
|
28
|
+
return age > maxAgeDays;
|
|
29
|
+
}
|
|
30
|
+
function resolveRef(rootPath, ref) {
|
|
31
|
+
if (typeof ref !== "string" || ref.trim().length === 0) return null;
|
|
32
|
+
const r = ref.trim();
|
|
33
|
+
return isAbsolute(r) ? r : resolve(rootPath, r);
|
|
34
|
+
}
|
|
35
|
+
function sourceExists(rootPath, ref) {
|
|
36
|
+
const abs = resolveRef(rootPath, ref);
|
|
37
|
+
return abs !== null && existsSync(abs);
|
|
38
|
+
}
|
|
39
|
+
function extractFileRefs(text) {
|
|
40
|
+
if (typeof text !== "string" || text.length === 0) return [];
|
|
41
|
+
const re = /\b([\w.-]+\/[\w./-]+\.[a-z0-9]{1,5})\b/gi;
|
|
42
|
+
const out = /* @__PURE__ */ new Set();
|
|
43
|
+
let m;
|
|
44
|
+
while ((m = re.exec(text)) !== null) {
|
|
45
|
+
out.add(m[1]);
|
|
46
|
+
}
|
|
47
|
+
return [...out];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export {
|
|
51
|
+
FRESHNESS,
|
|
52
|
+
ageDays,
|
|
53
|
+
isStale,
|
|
54
|
+
resolveRef,
|
|
55
|
+
sourceExists,
|
|
56
|
+
extractFileRefs
|
|
57
|
+
};
|