agent-knowledge 2.0.0 → 3.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +59 -0
- package/README.md +35 -32
- package/dist/embeddings/local.d.ts.map +1 -1
- package/dist/embeddings/local.js +3 -1
- package/dist/embeddings/local.js.map +1 -1
- package/dist/events.d.ts +6 -0
- package/dist/events.d.ts.map +1 -1
- package/dist/events.js +10 -2
- package/dist/events.js.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/knowledge/analyze.d.ts.map +1 -1
- package/dist/knowledge/analyze.js +18 -11
- package/dist/knowledge/analyze.js.map +1 -1
- package/dist/knowledge/distill.d.ts.map +1 -1
- package/dist/knowledge/distill.js +28 -16
- package/dist/knowledge/distill.js.map +1 -1
- package/dist/knowledge/git.d.ts +3 -4
- package/dist/knowledge/git.d.ts.map +1 -1
- package/dist/knowledge/git.js +60 -46
- package/dist/knowledge/git.js.map +1 -1
- package/dist/knowledge/graph.d.ts +2 -0
- package/dist/knowledge/graph.d.ts.map +1 -1
- package/dist/knowledge/graph.js +8 -0
- package/dist/knowledge/graph.js.map +1 -1
- package/dist/knowledge/ingest-freshness.d.ts +22 -0
- package/dist/knowledge/ingest-freshness.d.ts.map +1 -0
- package/dist/knowledge/ingest-freshness.js +93 -0
- package/dist/knowledge/ingest-freshness.js.map +1 -0
- package/dist/knowledge/remove.d.ts +11 -0
- package/dist/knowledge/remove.d.ts.map +1 -0
- package/dist/knowledge/remove.js +24 -0
- package/dist/knowledge/remove.js.map +1 -0
- package/dist/knowledge/search.d.ts +74 -8
- package/dist/knowledge/search.d.ts.map +1 -1
- package/dist/knowledge/search.js +321 -40
- package/dist/knowledge/search.js.map +1 -1
- package/dist/knowledge/similar.d.ts +7 -0
- package/dist/knowledge/similar.d.ts.map +1 -0
- package/dist/knowledge/similar.js +51 -0
- package/dist/knowledge/similar.js.map +1 -0
- package/dist/knowledge/store.d.ts +17 -0
- package/dist/knowledge/store.d.ts.map +1 -1
- package/dist/knowledge/store.js +117 -79
- package/dist/knowledge/store.js.map +1 -1
- package/dist/rest-server.d.ts +12 -2
- package/dist/rest-server.d.ts.map +1 -1
- package/dist/rest-server.js +75 -10
- package/dist/rest-server.js.map +1 -1
- package/dist/search/bm25.d.ts +8 -0
- package/dist/search/bm25.d.ts.map +1 -1
- package/dist/search/bm25.js +32 -20
- package/dist/search/bm25.js.map +1 -1
- package/dist/search/excerpt.d.ts +1 -1
- package/dist/search/excerpt.d.ts.map +1 -1
- package/dist/search/excerpt.js +19 -1
- package/dist/search/excerpt.js.map +1 -1
- package/dist/search/lexicon.d.ts +37 -0
- package/dist/search/lexicon.d.ts.map +1 -0
- package/dist/search/lexicon.js +83 -0
- package/dist/search/lexicon.js.map +1 -0
- package/dist/search/mmr.d.ts +9 -3
- package/dist/search/mmr.d.ts.map +1 -1
- package/dist/search/mmr.js +21 -7
- package/dist/search/mmr.js.map +1 -1
- package/dist/search/types.d.ts +2 -0
- package/dist/search/types.d.ts.map +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +0 -5
- package/dist/server.js.map +1 -1
- package/dist/sessions/human.d.ts +12 -0
- package/dist/sessions/human.d.ts.map +1 -0
- package/dist/sessions/human.js +52 -0
- package/dist/sessions/human.js.map +1 -0
- package/dist/sessions/parser.d.ts +39 -0
- package/dist/sessions/parser.d.ts.map +1 -1
- package/dist/sessions/parser.js +142 -18
- package/dist/sessions/parser.js.map +1 -1
- package/dist/sessions/search.d.ts +2 -0
- package/dist/sessions/search.d.ts.map +1 -1
- package/dist/sessions/search.js +147 -67
- package/dist/sessions/search.js.map +1 -1
- package/dist/sessions/snapshot.d.ts +19 -0
- package/dist/sessions/snapshot.d.ts.map +1 -0
- package/dist/sessions/snapshot.js +118 -0
- package/dist/sessions/snapshot.js.map +1 -0
- package/dist/sessions/summary.d.ts +24 -5
- package/dist/sessions/summary.d.ts.map +1 -1
- package/dist/sessions/summary.js +106 -145
- package/dist/sessions/summary.js.map +1 -1
- package/dist/slice.d.ts +5 -0
- package/dist/slice.d.ts.map +1 -0
- package/dist/slice.js +28 -0
- package/dist/slice.js.map +1 -0
- package/dist/text.d.ts +9 -0
- package/dist/text.d.ts.map +1 -0
- package/dist/text.js +16 -0
- package/dist/text.js.map +1 -0
- package/dist/tool-handlers.d.ts.map +1 -1
- package/dist/tool-handlers.js +6 -10
- package/dist/tool-handlers.js.map +1 -1
- package/dist/transport/rest.d.ts.map +1 -1
- package/dist/transport/rest.js +152 -35
- package/dist/transport/rest.js.map +1 -1
- package/dist/vectorstore/store.d.ts +9 -0
- package/dist/vectorstore/store.d.ts.map +1 -1
- package/dist/vectorstore/store.js +23 -0
- package/dist/vectorstore/store.js.map +1 -1
- package/dist/wakeup.d.ts +5 -0
- package/dist/wakeup.d.ts.map +1 -1
- package/dist/wakeup.js +10 -1
- package/dist/wakeup.js.map +1 -1
- package/docs/ARCHITECTURE.md +6 -9
- package/docs/HOOKS.md +138 -237
- package/docs/SETUP.md +61 -122
- package/docs/USER-MANUAL.md +45 -31
- package/package.json +6 -6
- package/plugin/skills/knowledge-ingest/scripts/validate.mjs +2 -2
- package/scripts/plugins/opencode/agent-knowledge.ts +32 -81
- package/scripts/setup.js +78 -145
- package/scripts/source-walk.d.mts +12 -0
- package/scripts/source-walk.mjs +94 -0
- package/scripts/tree-sitter-extract.mjs +10 -76
- package/scripts/hooks/first-prompt-inject.mjs +0 -242
- package/scripts/hooks/precompact-distill.mjs +0 -105
- package/scripts/hooks/precompact-flush.mjs +0 -192
- package/scripts/hooks/session-start-ingest.mjs +0 -238
- package/scripts/hooks/session-start.js +0 -211
- package/scripts/hooks/sessionend-distill.mjs +0 -198
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,64 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 3.1.0 (2026-11-21) — the /knowledge pane in the desktop app
|
|
4
|
+
|
|
5
|
+
### Added
|
|
6
|
+
|
|
7
|
+
- **A desktop layout for /knowledge**: in the Claude desktop app the pane is drawn natively, the way the old web dashboard read: a head with the server's state, git sync, Refresh and **Sync now** as its main action, and tiles for entries, sessions, snapshots and vectors; a side column with the tabs and the categories, each with its count; the view beside it. An entry's page draws its body as one Markdown and its links as a graph of the entry and its neighbours (arrows by direction, coloured by category) above the list of links; Health adds charts of entries per category and of entries updated per week over the last 12 weeks. Below 90 columns the side column stacks above the view.
|
|
8
|
+
- **A widget glance**: minimized to a widget in the desktop app, the pane shows the counts, the categories as one stacked bar, git and the latest activity, and a Search button.
|
|
9
|
+
|
|
10
|
+
### Changed
|
|
11
|
+
|
|
12
|
+
- **The terminal pane is calmer**: a rule under the tabs and the key line separates the controls from the view, and from 80 columns (a wide terminal, the desktop) a list row is one line: the title, its facts at the right. Charts are left out on the terminal, which draws no Svg.
|
|
13
|
+
|
|
14
|
+
## 3.0.0 (2026-11-13) — the session lifecycle moves into the plugin
|
|
15
|
+
|
|
16
|
+
### Breaking
|
|
17
|
+
|
|
18
|
+
- **The six Claude Code command hooks are gone** (`scripts/hooks/session-start.js`, `session-start-ingest.mjs`, `first-prompt-inject.mjs`, `precompact-flush.mjs`, `precompact-distill.mjs`, `sessionend-distill.mjs`) and `scripts/setup.js` no longer installs hooks. The plugin's mod does their work (Claude Code 2.1.289+); see [docs/HOOKS.md](docs/HOOKS.md). Coming from 2.x: `node scripts/setup.js --host=claude` removes their entries from `~/.claude/settings.json`, then install the plugin. `setup.js` no longer registers the MCP server in `~/.claude.json` either (the plugin runs it) and installs the knowledge-ingest skill to `~/.agents/skills` only (the plugin carries it for Claude Code).
|
|
19
|
+
- **One session snapshot replaces three files**: the session's gist is written to `sessions/<project>/<day>-<id>.md`, rewritten at each compaction and at the end, in place of `projects/session-<cwd>-<id>.md`, `projects/precompact-<cwd>-<id>.md` and `sessions/<project>/PreCompact-<time>-<id>.md`, and with no `sessions/index.md` breadcrumb. Files the 2.x hooks wrote stay where they are.
|
|
20
|
+
- **`AGENT_KNOWLEDGE_EVENTS` is gone**: the session-end receipt is a live event recorded by the server itself.
|
|
21
|
+
- **The first-prompt marker files** (`<data dir>/.first-prompt-seen/`) are no longer written for Claude Code: the mod keeps the conversation's id in its session state. The opencode plugin keeps its own markers.
|
|
22
|
+
- `plugin/.mcp.json` runs `agent-knowledge@^3`.
|
|
23
|
+
|
|
24
|
+
### Added
|
|
25
|
+
|
|
26
|
+
- **The session lifecycle in the plugin's mod**: the conversation's first message carries what the knowledge base holds, who the person is (or the onboarding question) and the project's ingest state; the first real prompt carries the matching entries (MMR re-ranked) with one line naming them; a compaction of the main thread snapshots the session and asks the summary to keep, under "Knowledge to save", what was not yet written; the session ending (or `/clear`) takes the last snapshot. Each fails open; the `AGENT_KNOWLEDGE_*` switches and budgets of 2.x apply.
|
|
27
|
+
- **REST**: `POST /api/sessions/:id/snapshot`, `GET /api/wakeup` (with `onboarding`: configured, declined or pending), `GET /api/ingest?cwd=`, and `mmr=true` on `GET /api/knowledge/search`. Any host can drive the same lifecycle.
|
|
28
|
+
- **The /knowledge pane draws a progress indicator** while it loads the entries, an entry, the sessions or a session.
|
|
29
|
+
- **The plugin manifest names its documentation** (`documentationUrl`) and carries an icon.
|
|
30
|
+
|
|
31
|
+
### Fixed
|
|
32
|
+
|
|
33
|
+
- **A deleted entry left its graph edges behind**: its links still showed on other pages, led nowhere, and counted in Analyze. Deleting (the MCP tool and the pane alike, now one pipeline) drops them; a link to an entry that is not there is drawn as `· gone`, not pressed, and Analyze counts only links whose ends exist. Following a link to an entry deleted meanwhile says so on the page, which stays.
|
|
34
|
+
- **MMR re-ranking diversified nothing**: raw BM25 relevance (20 and more) outweighed any similarity in [0, 1], and MMR only reorders, so with no strong alternative the slots still filled with copies. Relevance is now taken against the best candidate, and a candidate 0.8 similar or more to one already picked is dropped: near-copies come once.
|
|
35
|
+
- **The first-prompt hits misled more than they helped**: chit-chat, sums ("what's 17 times 23?") and asks about the person's own code ("add a dark mode toggle to the settings page", "the build is green now, thanks") brought entries that shared a word, and on-topic prompts came with unrelated ones beside the answer. Precision now comes first (no hit costs little, the model can still search): two hits at most, each named by the prompt's specific words (its title, path or tags, for 40% of what the prompt's words tell) and holding 60% of it, near the best; a prompt of generic words (said in a tenth of the person's sessions, naming almost no entry: commit, push, build) brings nothing, nor news that ends in thanks, a task on what is at hand, or a bare sum. With the local embedding model, the entry closest in meaning (cosine 0.6 or more) answers too. Measured in tests/first-prompt-eval.test.ts on prompts it was never tuned on (the reviewers', rounds 6 and 7), and on a copy of a real store: no off-topic injection on any base, 92% of the hits on topic (words) and 94% (with embeddings), against 4 of 10 off-topic prompts injected and 9 of 39 hits on topic before.
|
|
36
|
+
- **Sessions and snapshots read slash commands as questions**: a session after `/clear` was titled "/clear" and its summary began with it, most sessions in the list showed no prompt or "/clear". Slash commands and notices are not prompts: a session's preview, prompt count, "What was asked" and snapshot title skip them, and a session where nothing was asked writes no snapshot. The list folds such sessions away and marks this session; session hits in Search are named by their folder, as the list names them.
|
|
37
|
+
- **Counts disagreed**: the status line, Browse and Health counted the knowledge base three ways. The overview and `/health` count the curated entries and the session snapshots apart (`entries`, `snapshots`), and every count in the pane reads them; snapshots are named `snapshots` throughout.
|
|
38
|
+
- **Analyze capped its list at 30**: the rest of the entries with one link or none could not be reached. They come 30 at a time, fewest links first; on an empty knowledge base Analyze says only that there is nothing to analyze.
|
|
39
|
+
- **Session summaries missed errors**: `FAILED tests/…` and `psycopg2.errors.UniqueViolation: …` were not found (the match was case-sensitive and wanted `FAIL:`). A coloured error line (`\x1b[31mFAILED`) is found too.
|
|
40
|
+
- **Toasts stopped after the REST server changed hands**: each process numbered its events from 1, and the pane, remembering the highest it had seen, showed none until the new numbers caught up. Event ids now rise across processes.
|
|
41
|
+
- **Titles kept their YAML quotes** (`"Task #1: …"`): a quoted frontmatter value is read without its quotes, escapes included, tags too.
|
|
42
|
+
- **`/knowledge tools/gitbook-sync` was taken for a path**: words with a slash are a path only with `.md` or a folder of the knowledge base first; else they are searched.
|
|
43
|
+
- **Analyze sorted numbered titles as text** (1, 10, 2): it sorts them as numbers.
|
|
44
|
+
- **The 2.x hooks' session dumps flooded the knowledge base** (`projects/session-*`, `projects/precompact-*`, typed session-end, precompact): they are told apart as session records, like the snapshots: counted apart, out of Browse's all, the first-prompt hits and Analyze, left where they are. An entry without a title is named by its first heading; one without a date sorts by the date in its file name, else the file's.
|
|
45
|
+
- **A search right after the server started failed**: it waits for the index a bounded while, then the server says it is warming up (503) and the pane tries again, saying so.
|
|
46
|
+
- **Text with terminal control in it blanked the pane** (a session's tool output in colour, `\x1b[31m`): Claude Code refuses a whole drawing that holds a control character. Everything the server sends the pane is cleaned where it comes in (escape sequences dropped whole, the one-byte C1 forms of CSI, OSC and the other strings too, other controls shown as `�`), and the server writes no escape sequence into a snapshot, nor into an excerpt.
|
|
47
|
+
- **A compaction's summary counted as a prompt**: it was "What was asked" in the snapshot (and in git) and one more prompt in the session's count. A compaction summary is no prompt.
|
|
48
|
+
- **The /knowledge pane**: an open entry follows its file (an edit elsewhere shows, a delete elsewhere takes you back, said); a snapshot whose transcript is not on this machine no longer offers to open it, and one that is comes back to the snapshot; the digits stay the pane's while the server is down; code is drawn apart from the prose and a wrapped command reads as one; a table too wide keeps every value with its header; the ingest never done or behind reaches the person (a toast, Health, the empty Browse's **Ingest ›**), not only the model.; Sessions go on past the newest 100, a page at a time from the server; an edit made elsewhere to the open entry is said (`! … changed elsewhere`); the ring waits on Refresh while a delete is drawn away, never on a category in its place; the snapshots are named snapshots in their heading and facts; the first-prompt line names its hits whole; the folder is shown whole; a search with no entry hit says so beside the session hits; a snapshot page says when its session was last active; the row a page added is shown whole; `/knowledge <path>` leaves no old Find behind it; the ring in Find stays there when a folder appears or goes above it, written or emptied elsewhere; after `/clear` an open pane draws its list again; the snapshot `/clear` takes is said in the next conversation's first line (a toast is drawn neither in the one ending nor in a screen `/clear` just emptied), and a compaction's toast says "at compaction"; plain `/knowledge` is Browse; Find wants all its words; `/knowledge projects/` opens that folder; a tab key while the server is down is said; Enter twice on Ingest no longer runs the command it put in the prompt (the prompt takes the keys with the text; an Enter there within 400 ms is held and the command put back), and Ingest, Sync and Delete hold a press that comes as the view changes; a key pressed while the ring lands wins over the landing, a search typed in its field leaving it while it runs; a Find or Search field drawn anew shows what is applied or typed; after a delete the ring rests on Refresh; a 2.x dump without a title is named by its project, day and kind
|
|
49
|
+
- **The /knowledge pane follows the conventions it shares with /pipeline and /discover**: replies to `/knowledge` say something only when something is wrong; the busy line is a progress line; outcomes marked ✓ done, ✗ failed, ! changed elsewhere, – nothing happened, and mirrored in the status line while the pane shows; toasts `Label: subject`, three at most; folds `▸ N more` / `▾ Show less`, dimmed; the delete confirmation says what goes and what links are lost, with **Keep it** first; the ring never lands on Sync; the rows keep their order while the pane has the keyboard; an open pane is opened afresh by `/knowledge`; a failed sync is kept under Recent activity.
|
|
50
|
+
- **Session summaries**: Commits are the ones `git commit` reported (a SHA a log or a push showed is not one made in the session), and Files are the ones an editing or writing tool call changed (a path a result mentioned is not).
|
|
51
|
+
- **The /knowledge pane**: Search lands on its tab (2 again or Enter on the tab types), so the tab hotkeys never dead-end in the field; a deleted entry leaves the search hits; a new view starts at its top; a capped list says it shows the best; One link or none says how many in all; the onboarding names the folder as it is on disk; an outcome is no longer wiped by one slow poll; toasts say what happened in words; the folder keeps its root (`~\…\knowledge`); list items and Recent activity hang-indent; the age comes before the tags in a row.
|
|
52
|
+
- **Session names and previews read as the person typed them**: a slash command shows as `/name args`, not its `<command-name>` wrapper, and the caveat, stdout and reminder blocks Claude Code wraps around it are left out of previews, prompt counts and summary topics; a session's project is its folder's name and a detached `HEAD` is no branch. A session summary in the pane names its id and how to resume it (`claude --resume <id>`).
|
|
53
|
+
- **Session snapshots stay apart from curated knowledge**: Browse counts and lists the curated entries (the snapshots are their own category, _snapshots_, with an empty state that leads to them), Analyze leaves them out, and the first-prompt hits skip them (`skip=sessions` on `GET /api/knowledge/search`). A snapshot page names its session and opens it.
|
|
54
|
+
- **Entry pages**: an incoming link reads with the other entry first (`← title · depends on this`); links in the body are listed as _mentions_ that open their entry (a gone one marked), the text plain; a table wider than the pane reads one row a line; times carry their date (`YYYY-MM-DD HH:MM`), ages past a day count days; a row drops a fact that does not fit whole; Find narrows as it is typed; `/knowledge README.md` opens the entry; command replies say what was found for the words, or that nothing was; an unknown event kind reads as words; Analyze on an empty knowledge base says there is nothing to analyze; back from a session opened from a search lands on its hit; the snapshot a session made is toasted once.
|
|
55
|
+
- **Search excerpts**: a question not found as one phrase is centred on the first of its words that is, and a short code line stays in the excerpt.
|
|
56
|
+
- **The REST server stopped answering for seconds at a time, and a stuck holder kept the port**: the search indexes were thrown away every 60 s and rebuilt in one synchronous block (4.7 s for 2,000 entries; 25–35 s for a gigabyte of session transcripts), so the process holding the port answered nothing meanwhile and every caller timed out. Both indexes now follow their files: a search compares sizes and times and re-reads only what changed, and a live session's file is read from where the last read ended (warm searches: about 0.2 s). Builds run in slices that give the event loop back, and the process that takes the port warms them as it starts. The holder asks itself for `/health` every 30 s; two unanswered checks close its listener and it binds again, so a listener that stopped accepting no longer holds the port for every session.
|
|
57
|
+
- **The plugin never waits on a stuck server**: every call gives up after a bound (2 s for the session's first message and the first prompt, 5 s for the pane's poll, 10 s for other pane calls, 60 s for a git sync or delete), and the session goes on as without the plugin.
|
|
58
|
+
- **The real-CLI suites build into `dist-e2e/`**, never the `dist/` running sessions' servers were started from.
|
|
59
|
+
- **Session files carried secrets and noise into git**: the 2.x session-end and pre-compact files held prompts as typed, tokens and task notifications included. The snapshot scrubs them as the distiller does (secrets, e-mail addresses, home paths, system reminders, task notifications, command wrappers) and leaves out a session where nothing was asked.
|
|
60
|
+
- **A background task's notice or another session's message no longer spends the first-prompt injection**, and a server that does not answer leaves it for the next prompt.
|
|
61
|
+
|
|
3
62
|
## 2.0.0 (2026-10-23) — the /knowledge pane replaces the web dashboard
|
|
4
63
|
|
|
5
64
|
### Breaking
|
package/README.md
CHANGED
|
@@ -76,7 +76,7 @@ No configuration needed. Additional session roots can be added via the `AGENT_KN
|
|
|
76
76
|
- **Deterministic pre-extraction in distillation** — session summaries now include git commits, error patterns, URLs accessed, and packages changed extracted via regex from bash/tool output (no LLM cost)
|
|
77
77
|
- **Freshness metadata on every search hit** — every knowledge result carries `freshness: { body_age_days, last_accessed, access_count, verified_at, verification_age_days, evergreen }`. Agent reads the trust signal and decides; we impose no policy demotion.
|
|
78
78
|
- **Per-category decay windows** — the "Unused" filter and bytype chart honor per-category thresholds (projects 180d, people 365d, decisions 90d, workflows 60d, notes 30d) so identity-shaped content doesn't look stale just because it isn't re-read weekly.
|
|
79
|
-
- **
|
|
79
|
+
- **Session lifecycle (Claude Code plugin)** — each conversation starts knowing what the knowledge base holds, who the person is (or asks them once) and whether the project's ingest is current; the first real prompt carries the entries that match it; the session is snapshotted into the knowledge base when it is compacted and when it ends, secrets scrubbed. No command hooks: the plugin's mod does it, fail-open, each part switchable by an `AGENT_KNOWLEDGE_*` env var. See [`docs/HOOKS.md`](docs/HOOKS.md).
|
|
80
80
|
- **Replaces host auto-memory** — on hosts with a per-session memory system (Claude Code's `~/.claude/projects/*/memory/`, similar in other IDEs), route durable user facts and feedback to agent-knowledge instead. Auto-memory is machine-local and invisible to other machines; agent-knowledge is git-synced, cross-machine, searchable, and surfaces in wakeup. See the Claude Code integration note in [`docs/USER-MANUAL.md`](docs/USER-MANUAL.md#persistent-memory--agent-knowledge-not-host-auto-memory).
|
|
81
81
|
|
|
82
82
|
## Codebase Ingestion
|
|
@@ -122,7 +122,7 @@ Add to your MCP client config (Claude Code, Cline, etc.):
|
|
|
122
122
|
}
|
|
123
123
|
```
|
|
124
124
|
|
|
125
|
-
The first MCP process also serves a local REST API on `127.0.0.1:3423` (what the
|
|
125
|
+
The first MCP process also serves a local REST API on `127.0.0.1:3423` (what the Claude Code plugin, the opencode plugin and agent-tasks call); when it exits, another running session takes the port over.
|
|
126
126
|
|
|
127
127
|
See [Setup Guide](docs/SETUP.md) for client-specific instructions (Claude Code, Cursor, Windsurf, OpenCode).
|
|
128
128
|
|
|
@@ -133,7 +133,7 @@ claude plugin marketplace add keshrath/agent-knowledge
|
|
|
133
133
|
claude plugin install agent-knowledge@agent-knowledge
|
|
134
134
|
```
|
|
135
135
|
|
|
136
|
-
The plugin brings the MCP server, the `knowledge-ingest` skill and the `/knowledge` pane (Claude Code 2.
|
|
136
|
+
The plugin brings the MCP server, the `knowledge-ingest` skill and a mod (Claude Code 2.1.289+): the `/knowledge` pane and the [session lifecycle](docs/HOOKS.md). Use it in place of Option 1 in Claude Code; a hand-written `agent-knowledge` entry in `~/.claude.json` would list the tools twice. Coming from 2.x, run `node scripts/setup.js --host=claude` once: it removes the old command hooks from `settings.json`.
|
|
137
137
|
|
|
138
138
|
## MCP Tools (6)
|
|
139
139
|
|
|
@@ -228,22 +228,25 @@ Write-bench harness: `npm run bench:promote` — offline replay with auto-labeli
|
|
|
228
228
|
|
|
229
229
|
Loopback only (`127.0.0.1`), JSON only. Every request goes through a guard: a foreign `Host` or any `Origin` header gets 403, a request body must be `application/json`. A `:path` with a slash is sent encoded (`notes%2Fx.md`).
|
|
230
230
|
|
|
231
|
-
| Method | Endpoint
|
|
232
|
-
| ------ |
|
|
233
|
-
| GET | `/health`
|
|
234
|
-
| GET | `/api/overview`
|
|
235
|
-
| GET | `/api/knowledge?category=&tag=`
|
|
236
|
-
| GET | `/api/knowledge/search?q=&max_results=` | pane, opencode plugin
|
|
237
|
-
| GET | `/api/knowledge/:path`
|
|
238
|
-
| GET | `/api/knowledge/:path/links`
|
|
239
|
-
| DELETE | `/api/knowledge/:path`
|
|
240
|
-
| POST | `/api/knowledge`
|
|
241
|
-
| POST | `/api/knowledge/sync`
|
|
242
|
-
| GET | `/api/analysis
|
|
243
|
-
| GET | `/api/sessions?limit=&offset=&project=`
|
|
244
|
-
| GET | `/api/sessions/search?q=&role=`
|
|
245
|
-
| GET | `/api/sessions/:id/summary`
|
|
246
|
-
| POST | `/api/
|
|
231
|
+
| Method | Endpoint | Caller | Description |
|
|
232
|
+
| ------ | -------------------------------------------- | --------------------------- | ---------------------------------------------------------- |
|
|
233
|
+
| GET | `/health` | pane | Status, version, `entries` (curated), `snapshots` |
|
|
234
|
+
| GET | `/api/overview` | `/knowledge` pane | `entries`, `snapshots`, curated `categories`, events |
|
|
235
|
+
| GET | `/api/knowledge?category=&tag=` | pane | List entries with their scoring |
|
|
236
|
+
| GET | `/api/knowledge/search?q=&max_results=&mmr=` | pane, mod, opencode plugin | Search (`mmr`, `skip=sessions`, `min_terms=2`, `prompt`) |
|
|
237
|
+
| GET | `/api/knowledge/:path` | pane | Read one entry (a snapshot: `session_on_machine`) |
|
|
238
|
+
| GET | `/api/knowledge/:path/links` | pane | The entry's graph edges, each with the other end's title |
|
|
239
|
+
| DELETE | `/api/knowledge/:path` | pane | Delete an entry (git synced) |
|
|
240
|
+
| POST | `/api/knowledge` | agent-tasks KnowledgeBridge | Write an entry (full write pipeline) |
|
|
241
|
+
| POST | `/api/knowledge/sync` | pane | git pull + push |
|
|
242
|
+
| GET | `/api/analysis?offset=&limit=` | pane | Hubs; `sparse` paged (fewest links, title), `sparse_total` |
|
|
243
|
+
| GET | `/api/sessions?limit=&offset=&project=` | pane | Sessions, paged: `{ sessions, total }` |
|
|
244
|
+
| GET | `/api/sessions/search?q=&role=` | pane | Search sessions (each hit's project as `name`) |
|
|
245
|
+
| GET | `/api/sessions/:id/summary` | pane | Session summary |
|
|
246
|
+
| POST | `/api/sessions/:id/snapshot` | mod, opencode plugin | `{ event, cwd? }`: the session into `sessions/<project>/` |
|
|
247
|
+
| GET | `/api/wakeup?sections=&budget=` | mod (first message) | The wakeup bundle and `onboarding` (identity state) |
|
|
248
|
+
| GET | `/api/ingest?cwd=` | mod (first message) | The folder's ingest freshness |
|
|
249
|
+
| POST | `/api/events` | any host | `{ kind, message }`: a receipt the pane toasts |
|
|
247
250
|
|
|
248
251
|
## Architecture
|
|
249
252
|
|
|
@@ -272,7 +275,7 @@ graph LR
|
|
|
272
275
|
|
|
273
276
|
subgraph Clients
|
|
274
277
|
AG[Agent Sessions]
|
|
275
|
-
PN["/knowledge pane<br/>
|
|
278
|
+
PN["/knowledge pane + mod<br/>agent-tasks"]
|
|
276
279
|
end
|
|
277
280
|
|
|
278
281
|
KB <-->|git pull/push| KM
|
|
@@ -402,7 +405,7 @@ All env vars live under the `AGENT_KNOWLEDGE_*` prefix. No host name is baked in
|
|
|
402
405
|
| `AGENT_KNOWLEDGE_INDEX_VERBATIM` | `true` | Index raw session message chunks into the vector store so conversation is retrievable later. Set `false` to save disk at scale. |
|
|
403
406
|
| `AGENT_KNOWLEDGE_DATA_DIR` | (platform config) | Override the primary host data root. Leave unset in the common case — adapters auto-detect every well-known host root under `~/`. |
|
|
404
407
|
| `AGENT_KNOWLEDGE_EXTRA_SESSION_ROOTS` | -- | Extra session directories, comma-separated. Added to whatever auto-detection finds. |
|
|
405
|
-
| `AGENT_KNOWLEDGE_PORT` | `3423` | Local REST API port (the
|
|
408
|
+
| `AGENT_KNOWLEDGE_PORT` | `3423` | Local REST API port (the Claude Code plugin, the opencode plugin, agent-tasks) |
|
|
406
409
|
| `AGENT_KNOWLEDGE_HOST` | `127.0.0.1` | REST bind address |
|
|
407
410
|
|
|
408
411
|
### Embeddings
|
|
@@ -425,16 +428,16 @@ Project-scoped overrides win over the standard keys. Set either; the scoped form
|
|
|
425
428
|
| `AGENT_KNOWLEDGE_ANTHROPIC_API_KEY` | `ANTHROPIC_API_KEY` | Claude / Voyage embeddings |
|
|
426
429
|
| `AGENT_KNOWLEDGE_GEMINI_API_KEY` | `GEMINI_API_KEY` | Gemini embeddings |
|
|
427
430
|
|
|
428
|
-
###
|
|
431
|
+
### Session lifecycle (Claude Code plugin, opencode plugin)
|
|
429
432
|
|
|
430
|
-
| Variable | Default | Description
|
|
431
|
-
| -------------------------------------- | ------- |
|
|
432
|
-
| `AGENT_KNOWLEDGE_AUTOWAKE` | `1` |
|
|
433
|
-
| `AGENT_KNOWLEDGE_WAKEUP_BUDGET` | `
|
|
434
|
-
| `AGENT_KNOWLEDGE_FIRSTPROMPT_INJECT` | `1` |
|
|
435
|
-
| `AGENT_KNOWLEDGE_FIRSTPROMPT_BUDGET` | `600` | Tokens for
|
|
436
|
-
| `AGENT_KNOWLEDGE_FIRSTPROMPT_MAX_HITS` | `
|
|
437
|
-
| `AGENT_KNOWLEDGE_PRECOMPACT_NUDGE` | `1` |
|
|
433
|
+
| Variable | Default | Description |
|
|
434
|
+
| -------------------------------------- | ------- | --------------------------------------------------------------------------------------------------------- |
|
|
435
|
+
| `AGENT_KNOWLEDGE_AUTOWAKE` | `1` | Who the person is (or the onboarding question) in the first message. `0` / `false` / `off` to disable. |
|
|
436
|
+
| `AGENT_KNOWLEDGE_WAKEUP_BUDGET` | `200` | Tokens for the identity section (clamp `[50, 4000]`) |
|
|
437
|
+
| `AGENT_KNOWLEDGE_FIRSTPROMPT_INJECT` | `1` | The first real prompt carries the matching entries. `0` / `false` / `off` to disable. |
|
|
438
|
+
| `AGENT_KNOWLEDGE_FIRSTPROMPT_BUDGET` | `600` | Tokens for those entries (clamp `[100, 8000]`) |
|
|
439
|
+
| `AGENT_KNOWLEDGE_FIRSTPROMPT_MAX_HITS` | `2` | Entries at most (clamp `[1, 2]`) |
|
|
440
|
+
| `AGENT_KNOWLEDGE_PRECOMPACT_NUDGE` | `1` | A compaction's summary keeps what is still to be saved. `0` / `false` leaves it; `off` takes no snapshot. |
|
|
438
441
|
|
|
439
442
|
### External tool overrides
|
|
440
443
|
|
|
@@ -444,10 +447,10 @@ Project-scoped overrides win over the standard keys. Set either; the scoped form
|
|
|
444
447
|
|
|
445
448
|
## Documentation
|
|
446
449
|
|
|
447
|
-
- [Setup Guide](docs/SETUP.md) — installation, client setup (Claude Code, OpenCode, Cursor, Windsurf),
|
|
450
|
+
- [Setup Guide](docs/SETUP.md) — installation, client setup (Claude Code, OpenCode, Cursor, Windsurf), skills
|
|
448
451
|
- [Ingestion Guide](docs/INGEST.md) — codebase ingestion skill, tree-sitter extraction, incremental updates
|
|
449
452
|
- [Architecture](docs/ARCHITECTURE.md) — source structure, design principles, database schema
|
|
450
|
-
- [
|
|
453
|
+
- [Session lifecycle](docs/HOOKS.md) — what the Claude Code plugin does around each session
|
|
451
454
|
- [Changelog](CHANGELOG.md)
|
|
452
455
|
|
|
453
456
|
## License
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"local.d.ts","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAmEpD,qBAAa,sBAAuB,YAAW,iBAAiB;IAC9D,QAAQ,CAAC,IAAI,WAAW;IACxB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAS;gBAEvB,aAAa,CAAC,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,EAAE,MAAM;IAOxE,KAAK,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC;IA0B3C,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,EAAE,CAAC;IAKzC,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC;YAKvB,WAAW;CAW1B"}
|
package/dist/embeddings/local.js
CHANGED
|
@@ -13,7 +13,9 @@ process.env.OMP_NUM_THREADS = String(_numThreads);
|
|
|
13
13
|
async function loadPipeline(model) {
|
|
14
14
|
try {
|
|
15
15
|
console.error(`[knowledge] Loading embedding model ${model} (quantized, ${_numThreads} thread(s))...`);
|
|
16
|
-
|
|
16
|
+
// Optional dependency: npm drops it when its install fails, so the build must not need its types.
|
|
17
|
+
const optional = '@huggingface/transformers';
|
|
18
|
+
const { pipeline } = (await import(optional));
|
|
17
19
|
const pipe = await pipeline('feature-extraction', model, {
|
|
18
20
|
dtype: 'q8',
|
|
19
21
|
session_options: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,uBAAuB,GAAG,MAAM,CAAC;AACvC,MAAM,mBAAmB,GAAG,CAAC,CAAC;AAO9B,IAAI,SAAS,GAAsB,IAAI,CAAC;AACxC,IAAI,gBAAgB,GAAsC,IAAI,CAAC;AAC/D,IAAI,UAAU,GAAyC,IAAI,CAAC;AAC5D,IAAI,cAAc,GAAG,uBAAuB,CAAC;AAE7C,MAAM,WAAW,GAAG,QAAQ,CAC1B,OAAO,CAAC,GAAG,CAAC,iCAAiC,IAAI,MAAM,CAAC,mBAAmB,CAAC,EAC5E,EAAE,CACH,CAAC;AACF,OAAO,CAAC,GAAG,CAAC,gBAAgB,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AACnD,OAAO,CAAC,GAAG,CAAC,eAAe,GAAG,MAAM,CAAC,WAAW,CAAC,CAAC;AAElD,KAAK,UAAU,YAAY,CAAC,KAAa;IACvC,IAAI,CAAC;QACH,OAAO,CAAC,KAAK,CACX,uCAAuC,KAAK,gBAAgB,WAAW,gBAAgB,CACxF,CAAC;QACF,MAAM,EAAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,
|
|
1
|
+
{"version":3,"file":"local.js","sourceRoot":"","sources":["../../src/embeddings/local.ts"],"names":[],"mappings":"AAEA,MAAM,aAAa,GAAG,yBAAyB,CAAC;AAChD,MAAM,kBAAkB,GAAG,GA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AAC,IAAI,EAAE,EAAE;gBACxD,SAAS,GAAG,IAAI,CAAC;gBACjB,IAAI,IAAI;oBAAE,cAAc,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC;YACd,CAAC,CAAC,CAAC;QACL,CAAC;QACD,OAAO,gBAAgB,CAAC;IAC1B,CAAC;CACF"}
|
package/dist/events.d.ts
CHANGED
|
@@ -4,6 +4,12 @@ export interface LiveEvent {
|
|
|
4
4
|
message: string;
|
|
5
5
|
ts: number;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* Ids rise across processes, not only within one: each is the time it was recorded (in ms),
|
|
9
|
+
* or one past the last when two come in the same ms. A process that takes the port over
|
|
10
|
+
* after another goes on above the ids that one gave, so a reader that remembers the highest
|
|
11
|
+
* id it saw (the pane) sees the new events, not none until the ids catch up.
|
|
12
|
+
*/
|
|
7
13
|
export declare function recordEvent(kind: string, message: string): LiveEvent;
|
|
8
14
|
/** The ring's events, oldest first. */
|
|
9
15
|
export declare function recentEvents(): LiveEvent[];
|
package/dist/events.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,EAAE,EAAE,MAAM,CAAC;CACZ;AAMD;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,CAOpE;AAED,uCAAuC;AACvC,wBAAgB,YAAY,IAAI,SAAS,EAAE,CAE1C"}
|
package/dist/events.js
CHANGED
|
@@ -8,9 +8,17 @@
|
|
|
8
8
|
// =============================================================================
|
|
9
9
|
const EVENT_RING_MAX = 10;
|
|
10
10
|
const ring = [];
|
|
11
|
-
let
|
|
11
|
+
let lastId = 0;
|
|
12
|
+
/**
|
|
13
|
+
* Ids rise across processes, not only within one: each is the time it was recorded (in ms),
|
|
14
|
+
* or one past the last when two come in the same ms. A process that takes the port over
|
|
15
|
+
* after another goes on above the ids that one gave, so a reader that remembers the highest
|
|
16
|
+
* id it saw (the pane) sees the new events, not none until the ids catch up.
|
|
17
|
+
*/
|
|
12
18
|
export function recordEvent(kind, message) {
|
|
13
|
-
const
|
|
19
|
+
const ts = Date.now();
|
|
20
|
+
lastId = Math.max(lastId + 1, ts);
|
|
21
|
+
const evt = { id: lastId, kind, message, ts };
|
|
14
22
|
ring.push(evt);
|
|
15
23
|
while (ring.length > EVENT_RING_MAX)
|
|
16
24
|
ring.shift();
|
package/dist/events.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oCAAoC;AACpC,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,gDAAgD;AAChD,gFAAgF;AAShF,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,IAAI,GAAgB,EAAE,CAAC;AAC7B,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAe;IACvD,MAAM,GAAG,
|
|
1
|
+
{"version":3,"file":"events.js","sourceRoot":"","sources":["../src/events.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,oCAAoC;AACpC,EAAE;AACF,2EAA2E;AAC3E,yEAAyE;AACzE,yEAAyE;AACzE,gDAAgD;AAChD,gFAAgF;AAShF,MAAM,cAAc,GAAG,EAAE,CAAC;AAC1B,MAAM,IAAI,GAAgB,EAAE,CAAC;AAC7B,IAAI,MAAM,GAAG,CAAC,CAAC;AAEf;;;;;GAKG;AACH,MAAM,UAAU,WAAW,CAAC,IAAY,EAAE,OAAe;IACvD,MAAM,EAAE,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IACtB,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,MAAM,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IAClC,MAAM,GAAG,GAAc,EAAE,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;IACzD,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACf,OAAO,IAAI,CAAC,MAAM,GAAG,cAAc;QAAE,IAAI,CAAC,KAAK,EAAE,CAAC;IAClD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,uCAAuC;AACvC,MAAM,UAAU,YAAY;IAC1B,OAAO,IAAI,CAAC,KAAK,EAAE,CAAC;AACtB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -10,9 +10,21 @@ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
|
10
10
|
import { createServer } from './server.js';
|
|
11
11
|
import { DEFAULT_PORT, serveRestWhenFree } from './rest-server.js';
|
|
12
12
|
import { backgroundIndex, closeVectorStore } from './sessions/indexer.js';
|
|
13
|
+
import { warmKnowledgeIndex } from './knowledge/search.js';
|
|
14
|
+
import { warmSessionIndex } from './sessions/search.js';
|
|
15
|
+
import { getConfig } from './types.js';
|
|
16
|
+
import { ensureRepo } from './knowledge/git.js';
|
|
13
17
|
async function main() {
|
|
18
|
+
// The knowledge folder exists (cloned from the remote the first time) before anything reads it.
|
|
19
|
+
const config = getConfig();
|
|
20
|
+
const repo = await ensureRepo(config.memoryDir, config.gitUrl);
|
|
21
|
+
console.error(`[knowledge] Repo init: ${repo.message}`);
|
|
14
22
|
const port = parseInt(process.env.AGENT_KNOWLEDGE_PORT || String(DEFAULT_PORT), 10);
|
|
15
23
|
const rest = serveRestWhenFree(port, 5_000, () => {
|
|
24
|
+
// The searches the plugin's lifecycle and the pane send land on warm indexes.
|
|
25
|
+
warmKnowledgeIndex(getConfig().memoryDir)
|
|
26
|
+
.then(() => warmSessionIndex())
|
|
27
|
+
.catch((err) => console.error('[knowledge] warming the search indexes failed:', err));
|
|
16
28
|
setTimeout(() => backgroundIndex().catch((bgErr) => console.error('[knowledge] Background index failed:', bgErr)), 5000).unref();
|
|
17
29
|
});
|
|
18
30
|
process.on('exit', () => {
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,6DAA6D;AAC7D,gFAAgF;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,gFAAgF;AAChF,0CAA0C;AAC1C,EAAE;AACF,wEAAwE;AACxE,6EAA6E;AAC7E,6DAA6D;AAC7D,gFAAgF;AAEhF,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC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,QAAQ,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAW,GAAG,OAAO,EAAE,CAkDlE;AAID;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,GAAE,MAAU,GAAG,MAAM,EAAE,CA2G/D;AAID;;;GAGG;AACH,wBAAgB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,GAAE,MAAW,GAAG,GAAG,EAAE,CAoDhE;AAID,MAAM,WAAW,iBAAiB;IAChC,4CAA4C;IAC5C,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,0EAA0E;IAC1E,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,qEAAqE;IACrE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAED;;;;;GAKG;AACH,wBAAgB,UAAU,CAAC,OAAO,GAAE,iBAAsB,GAAG,SAAS,EAAE,CAYvE;AAMD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AACrD,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAYxE,wBAAgB,oBAAoB,IAAI,IAAI,CAE3C;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,cAAc,CA6FzD"}
|
|
@@ -9,6 +9,11 @@ import { getKnowledgeGraph } from './graph.js';
|
|
|
9
9
|
import { getEntryScoring } from './scoring.js';
|
|
10
10
|
import { getSearchGaps } from './query-log.js';
|
|
11
11
|
// ── God Nodes ────────────────────────────────────────────────────────────────
|
|
12
|
+
/** The edges whose both ends exist: an entry, or a code node of an ingest. */
|
|
13
|
+
function liveEdges(edges, entries) {
|
|
14
|
+
const isLive = (p) => p.startsWith('code:') || entries.has(p);
|
|
15
|
+
return edges.filter((e) => isLive(e.source) && isLive(e.target));
|
|
16
|
+
}
|
|
12
17
|
/**
|
|
13
18
|
* Find the most-connected entries in the knowledge graph (degree centrality).
|
|
14
19
|
* Excludes auto-distilled entries that only have auto-link edges (noise).
|
|
@@ -18,10 +23,17 @@ export function godNodes(dir, topN = 10) {
|
|
|
18
23
|
const allEdges = graph.links();
|
|
19
24
|
if (allEdges.length === 0)
|
|
20
25
|
return [];
|
|
21
|
-
//
|
|
26
|
+
// Load entry metadata
|
|
27
|
+
// A session's record (a snapshot, a 2.x dump) is no knowledge to link: left out.
|
|
28
|
+
const entries = listEntries(dir).filter((e) => !e.snapshot);
|
|
29
|
+
const entryMap = new Map();
|
|
30
|
+
for (const e of entries) {
|
|
31
|
+
entryMap.set(e.path, e);
|
|
32
|
+
}
|
|
33
|
+
// Count degree per entry; an edge to an entry no longer there counts for neither end
|
|
22
34
|
const degree = new Map();
|
|
23
35
|
const hasManualEdge = new Set();
|
|
24
|
-
for (const edge of allEdges) {
|
|
36
|
+
for (const edge of liveEdges(allEdges, entryMap)) {
|
|
25
37
|
degree.set(edge.source, (degree.get(edge.source) ?? 0) + 1);
|
|
26
38
|
degree.set(edge.target, (degree.get(edge.target) ?? 0) + 1);
|
|
27
39
|
if (edge.origin !== 'auto-link') {
|
|
@@ -29,12 +41,6 @@ export function godNodes(dir, topN = 10) {
|
|
|
29
41
|
hasManualEdge.add(edge.target);
|
|
30
42
|
}
|
|
31
43
|
}
|
|
32
|
-
// Load entry metadata
|
|
33
|
-
const entries = listEntries(dir);
|
|
34
|
-
const entryMap = new Map();
|
|
35
|
-
for (const e of entries) {
|
|
36
|
-
entryMap.set(e.path, e);
|
|
37
|
-
}
|
|
38
44
|
// Sort by degree, filter out pure auto-link nodes and code graph nodes
|
|
39
45
|
const sorted = Array.from(degree.entries())
|
|
40
46
|
.filter(([path]) => entryMap.has(path) && !path.startsWith('code:'))
|
|
@@ -174,13 +180,14 @@ export function gaps(dir, maxEntries = 30) {
|
|
|
174
180
|
const graph = getKnowledgeGraph();
|
|
175
181
|
const allEdges = graph.links();
|
|
176
182
|
const scoring = getEntryScoring();
|
|
177
|
-
//
|
|
183
|
+
// A session's record (a snapshot, a 2.x dump) is no knowledge to link: left out.
|
|
184
|
+
const entries = listEntries(dir).filter((e) => !e.snapshot);
|
|
185
|
+
// Count degree per entry; an edge to an entry no longer there counts for neither end
|
|
178
186
|
const degree = new Map();
|
|
179
|
-
for (const edge of allEdges) {
|
|
187
|
+
for (const edge of liveEdges(allEdges, new Set(entries.map((e) => e.path)))) {
|
|
180
188
|
degree.set(edge.source, (degree.get(edge.source) ?? 0) + 1);
|
|
181
189
|
degree.set(edge.target, (degree.get(edge.target) ?? 0) + 1);
|
|
182
190
|
}
|
|
183
|
-
const entries = listEntries(dir);
|
|
184
191
|
const result = [];
|
|
185
192
|
for (const entry of entries) {
|
|
186
193
|
if (entry.path.startsWith('code:'))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analyze.js","sourceRoot":"","sources":["../../src/knowledge/analyze.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,WAAW,EAAuB,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAkB,MAAM,gBAAgB,CAAC;AAyC/D,gFAAgF;AAEhF;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,GAAW,EAAE,OAAe,EAAE;IACrD,MAAM,KAAK,GAAG,iBAAiB,EAAE,CAAC;IAClC,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC;IAE/B,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IAErC,yBAAyB;IACzB,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,MAAM,aAAa,GAAG,IAAI,GAAG,EAAU,CAAC;IAExC,KAAK,MAAM,IAAI,IAAI,QAAQ,EAAE,CAAC;QAC5B,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC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,GAAG,CAAC;QAAE,WAAW,CAAC,IAAI,CAAC,SAAS,QAAQ,sBAAsB,CAAC,CAAC;IAC5E,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC3B,KAAK,CAAC,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,KAAK,GAAmB;QAC5B,aAAa,EAAE,OAAO,CAAC,MAAM;QAC7B,WAAW,EAAE,QAAQ,CAAC,MAAM;QAC5B,aAAa,EAAE,gBAAgB;QAC/B,eAAe,EAAE,cAAc,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QAC3C,gBAAgB,EAAE,eAAe;QACjC,WAAW,EAAE,UAAU;QACvB,SAAS,EAAE,QAAQ;QACnB,YAAY,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACtC,IAAI,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;KACvB,CAAC;IAEF,WAAW,GAAG,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;IAC/C,OAAO,KAAK,CAAC;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"distill.d.ts","sourceRoot":"","sources":["../../src/knowledge/distill.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"distill.d.ts","sourceRoot":"","sources":["../../src/knowledge/distill.ts"],"names":[],"mappings":"AAwHA;;GAEG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAoBjD;AA0BD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CA+CxD;AA6ND,wBAAsB,eAAe,IAAI,OAAO,CAAC;IAC/C,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB,CAAC,CAkGD"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { readFileSync, writeFileSync, existsSync } from 'fs';
|
|
2
2
|
import { join } from 'path';
|
|
3
|
+
import { withoutControls } from '../text.js';
|
|
3
4
|
import { getProjectDirs, getSessionFiles, parseSessionFile, getSessionMeta, } from '../sessions/parser.js';
|
|
4
5
|
import { getSessionSummary } from '../sessions/summary.js';
|
|
5
6
|
import { listEntries, readEntry, writeEntry } from './store.js';
|
|
@@ -27,30 +28,40 @@ function setLastDistillTime(iso) {
|
|
|
27
28
|
}
|
|
28
29
|
// ── Secrets / sensitive data scrubbing ──────────────────────────────────────
|
|
29
30
|
const SECRET_PATTERNS = [
|
|
30
|
-
// API keys and tokens (common prefixes)
|
|
31
|
-
|
|
32
|
-
{ pattern: /\b(
|
|
33
|
-
{ pattern: /\b(
|
|
34
|
-
{ pattern: /\b(
|
|
35
|
-
{ pattern: /\b(
|
|
36
|
-
{ pattern: /\b(
|
|
31
|
+
// API keys and tokens (common prefixes). A key's body runs on through `-` and `_`
|
|
32
|
+
// (sk-ant-api03-…, sk-proj-…, github_pat_…): a rule that stopped there would match nothing.
|
|
33
|
+
{ pattern: /\b(sk-[a-zA-Z0-9_-]{20,})/g, replacement: '[REDACTED_API_KEY]' },
|
|
34
|
+
{ pattern: /\b([sr]k_(?:live|test)_[a-zA-Z0-9]{16,})/g, replacement: '[REDACTED_API_KEY]' },
|
|
35
|
+
{ pattern: /\b(gh[pousr]_[a-zA-Z0-9]{36,})\b/g, replacement: '[REDACTED_GITHUB_TOKEN]' },
|
|
36
|
+
{ pattern: /\b(github_pat_[a-zA-Z0-9_]{22,})/g, replacement: '[REDACTED_GITHUB_TOKEN]' },
|
|
37
|
+
{ pattern: /\b(glpat-[a-zA-Z0-9_-]{20,})/g, replacement: '[REDACTED_GITLAB_TOKEN]' },
|
|
38
|
+
{ pattern: /\b(npm_[a-zA-Z0-9]{36,})\b/g, replacement: '[REDACTED_NPM_TOKEN]' },
|
|
39
|
+
{ pattern: /\b(xox[bsapr]-[a-zA-Z0-9-]{10,})/g, replacement: '[REDACTED_SLACK_TOKEN]' },
|
|
40
|
+
{ pattern: /\b(AIza[a-zA-Z0-9_-]{35})/g, replacement: '[REDACTED_GOOGLE_KEY]' },
|
|
37
41
|
{ pattern: /\b(AKIA[A-Z0-9]{16})\b/g, replacement: '[REDACTED_AWS_KEY]' },
|
|
38
42
|
{
|
|
39
|
-
pattern: /\b(eyJ[a-zA-Z0-9_-]{20,}\.[a-zA-Z0-9_-]{20,}\.[a-zA-Z0-9_-]{20,})
|
|
43
|
+
pattern: /\b(eyJ[a-zA-Z0-9_-]{20,}\.[a-zA-Z0-9_-]{20,}\.[a-zA-Z0-9_-]{20,})/g,
|
|
40
44
|
replacement: '[REDACTED_JWT]',
|
|
41
45
|
},
|
|
42
|
-
//
|
|
46
|
+
// An assignment to a name that says it holds a secret (aws_secret_access_key = …,
|
|
47
|
+
// "client_secret": "…", DB_PASSWORD=…, authToken: …): the value goes, the name stays. A value
|
|
48
|
+
// of digits only (a count) or under 8 characters is left, as is a name like "author".
|
|
43
49
|
{
|
|
44
|
-
pattern: /(?:api[_-]?key|
|
|
45
|
-
replacement: '[REDACTED_CREDENTIAL]',
|
|
50
|
+
pattern: /(["']?\b[\w.-]*?(?:secret|token|password|passwd|api[_-]?key|access[_-]?key|private[_-]?key|client[_-]?secret|credential|bearer|auth(?:orization|entication)?(?![a-z]))[\w.-]*["']?\s*[:=]\s*["']?)(?!\[REDACTED)(?![0-9]+(?=[\s"']|$))[^\s"']{8,}/gi,
|
|
51
|
+
replacement: '$1[REDACTED_CREDENTIAL]',
|
|
52
|
+
},
|
|
53
|
+
// Basic credentials in a header
|
|
54
|
+
{
|
|
55
|
+
pattern: /\b(Authorization:\s*Basic)\s+[A-Za-z0-9+/]{8,}={0,2}/gi,
|
|
56
|
+
replacement: '$1 [REDACTED]',
|
|
46
57
|
},
|
|
47
58
|
// Bearer tokens in headers
|
|
48
59
|
{ pattern: /Bearer\s+[a-zA-Z0-9._\-+/=]{20,}/gi, replacement: 'Bearer [REDACTED]' },
|
|
49
60
|
// Connection strings with passwords
|
|
50
|
-
{ pattern:
|
|
51
|
-
// Private key blocks
|
|
61
|
+
{ pattern: /\b([a-z][a-z0-9+.-]*:\/\/[^\s:/@]+:)[^\s@]+(@)/gi, replacement: '$1[REDACTED]$2' },
|
|
62
|
+
// Private key blocks, and one cut before its end (a prompt cut short)
|
|
52
63
|
{
|
|
53
|
-
pattern: /-----BEGIN[A-Z ]*PRIVATE KEY-----[\s\S]
|
|
64
|
+
pattern: /-----BEGIN[A-Z ]*PRIVATE KEY-----[\s\S]*?(?:-----END[A-Z ]*PRIVATE KEY-----|$)/g,
|
|
54
65
|
replacement: '[REDACTED_PRIVATE_KEY]',
|
|
55
66
|
},
|
|
56
67
|
// .env style secrets
|
|
@@ -90,7 +101,7 @@ const NOISE_PATTERNS = [
|
|
|
90
101
|
* Scrub secrets and system noise from text before it reaches git.
|
|
91
102
|
*/
|
|
92
103
|
export function scrubContent(text) {
|
|
93
|
-
let result = text;
|
|
104
|
+
let result = withoutControls(text);
|
|
94
105
|
for (const pattern of NOISE_PATTERNS) {
|
|
95
106
|
result = result.replace(pattern, '');
|
|
96
107
|
}
|
|
@@ -99,7 +110,8 @@ export function scrubContent(text) {
|
|
|
99
110
|
pattern.lastIndex = 0;
|
|
100
111
|
result = result.replace(pattern, replacement);
|
|
101
112
|
}
|
|
102
|
-
|
|
113
|
+
// The path keeps its own separator: a Windows path stays one, not half of each.
|
|
114
|
+
result = result.replace(/[A-Z]:([/\\])Users[/\\][^/\\\s]+[/\\]/gi, '~$1');
|
|
103
115
|
result = result.replace(/\/home\/[^/\s]+\//g, '~/');
|
|
104
116
|
result = result.replace(/\n{3,}/g, '\n\n');
|
|
105
117
|
return result.trim();
|