Available in
Marketplaces, most starred first
Tags
Add to README
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Marketplaces, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
By nicolasacchiv0.1.0MITIn 1 marketplace
Provenance-aware code browsing via a kb-code daemon: a PreToolUse hook (kb-code-why) that injects trailer/exact-confidence "who wrote this and why" context right before an Edit/Write touches a line kb-code can attribute, LLM-free and fail-open. A second hook (kb-code-annotations) surfaces the operator's `flag-for-agent` review annotations into the same sessions — a per-file PreToolUse nudge with the exact reply/resolve commands, plus a one-line SessionStart summary of any repo with open flags — turning reader-side review comments into a live human-to-agent dialogue. Ships `kb-code hook install|uninstall|status` to print the settings.json wiring for both hooks and check daemon reachability (never edits settings.json silently), and `kb-code bench-search` — a retrieval-quality/latency instrument over the unified Search-Everywhere box, with a starter query set for the kb repo itself.
Claude loads one when your task matches it, or you run it by name.
1 caution to review before installing
A hook runs when Claude writes or edits files
Static checks of hooks, mods, MCP servers and commands. Not a security audit.
1 marketplace, most starred first
Shows its components, always-on context cost and install status, kept current. Add ?tokens=0 to hide the cost.
Claude Code integration for the kb-code daemon (kb-code-server) — the
sibling read-oriented code-browsing daemon (design v4, "the read-first IDE").
Three pieces:
kb-code-why.sh (hooks/) — a PreToolUse hook that injects
trailer/exact-confidence provenance ("which session wrote this, and why")
right before Claude edits a file it can attribute. LLM-free, fail-open,
never fuzzy.kb-code-annotations.sh (hooks/) — a PreToolUse + SessionStart
hook (D4) that surfaces the operator's flag-for-agent review
annotations into the same sessions, turning a reader-side "flag for
agent" into a live human-to-agent code-review dialogue.kb-code hook install|uninstall|status (kb-code-cli) — prints the
settings.json wiring for BOTH hooks and checks whether each is live;
never edits your settings.json for you.| Hook | Event | What it does |
|---|---|---|
kb-code-why.sh | PreToolUse (matcher Edit|Write) | Resolves the file being edited to a configured kb-code repo (longest-prefix match against GET /api/repos, 5-min cached), queries GET /api/why (line-grade when an Edit's old_string locates a line, else file-grade), and — only on confidence: trailer or confidence: exact, never fuzzy/none — injects a 3-5 line block: which session wrote it, when (from the covering blame region), its top recorded decision (line-grade only), and a link to the session in kb. |
Injected block shape:
kb-code provenance — src/lib.rs:
- Session: fixed the gizmo race (committed 2026-07-02)
- Decision: use a trailer instead of a squash-subject match
- kb session: http://127.0.0.1:4000/sessions?focus=<session_id>&kb=<kb>
(&kb=<kb> is appended only when the line-grade response resolved one —
see "Known limitation" below.)
Verified injection mechanism (see the header comment in
hooks/kb-code-why.sh for the full note): current
Claude Code hooks docs (code.claude.com/docs/en/hooks) confirm PreToolUse
supports hookSpecificOutput.additionalContext, matched on tool_name with
the target file at tool_input.file_path — the same
hookSpecificOutput/additionalContext mechanism kb-memory's
UserPromptSubmit kb-recall.sh already uses in production, just on a
different event. No fallback event was needed.
Caps + dedupe: at most 3 injections per Claude Code session; a given
(repo, path) pair is injected at most once per session — both tracked in
~/.cache/kb-code/why-hook-seen-<session_id> (one line per injection; its
line count IS the counter).
Fails open everywhere: missing jq/curl, kb-code daemon unreachable,
malformed JSON, no repo match, fuzzy/none confidence, cap hit, dedupe
hit — every one of these exits 0 with no output; the Edit/Write
proceeds completely unaffected. A 1.5s curl --max-time bounds each of the
(at most two) network calls per invocation.
| Var | Default | Purpose |
|---|---|---|
KB_CODE_WHY_HOOK=off | unset | Kill switch — the hook exits immediately. |
KB_CODE_DAEMON_URL | http://127.0.0.1:4747 | The kb-code daemon (provenance API). |
KB_DAEMON_URL | http://127.0.0.1:4000 | The kb daemon — used only to build the "kb session" deep link (same env var kb-memory's kb-recall.sh already uses for the same daemon). |
GET /api/why's line-grade response carries which kb corpus a resolved
session lives in on .attribution.kb (see
crates/kb-code-server/src/provenance/why.rs's AttributionOut) — best
effort, absent when neither the join ladder nor its loopback-only
enrichment follow-up resolved one. The file-grade response
(.sessions[], no line) carries no such field at all. The "kb session"
link is scoped with ?kb= when .attribution.kb is present, else falls
back to ?focus= alone — not always corpus-pre-scoped.
| Hook | Event | What it does |
|---|---|---|
kb-code-annotations.sh | PreToolUse (matcher Edit|Write) | Resolves the edited file to its configured repo (SAME longest-prefix match + repos cache as kb-code-why.sh — one shared cache file, not a second one), queries GET /api/annotations/open?repo=&intent=flag-for-agent, client-filters to the annotations anchored on THIS file, and injects up to 2 per call with the exact commands to close the loop. |
kb-code-annotations.sh --session-start | SessionStart (matcher startup|resume|clear) | If the session's cwd sits inside a configured repo with ANY open flag-for-agent annotations, emits ONE summary line (no per-annotation dump). |
PreToolUse injected block shape (one per annotation, blank-line separated — at most 2 per call):
npx claudepluginhub nicolasacchi/kb --plugin kb-codeBuilt from public signals: copy clicks on this site, GitHub stars and activity, the README and the manifest. Not a security audit or an endorsement.
Plugins from other owners that cover similar ground