feat: proactive recall, selectable embedding model, full MCP control (v0.8.0)#8
Merged
Merged
Conversation
…(v0.8.0)
Make the brain proactive and give the agent (and user) full control over
it from inside Claude Code / Codex.
Proactive recall (mid-work):
* New PreToolUse / PostToolUse Bash hooks surface a memory while the
agent works: a fix after a failed command, a warning before a risky
command, and a stronger nudge on a repeated/looping failure.
* Lexical-FTS-only retrieval (no embedding-model load), high score
floor (0.45; loop 0.35), one capsule, per-session dedupe + refractory
throttle. ~0 token cost (silent when nothing qualifies). Wired into
both harnesses with matcher "Bash"; opt out with --no-proactive.
* Per-session state in <repo>/.kimetsu/proactive/<session_id>.json,
GC'd after 7 days (new crates/kimetsu-cli/src/proactive_state.rs).
Selectable embedding model:
* New [embedder] table in project.toml (env > config > default).
* kimetsu brain model list|set, plus MCP kimetsu_brain_model_list /
_model_set. model_set re-embeds the corpus with the new model via a
fresh, uncached embedder (reindex_all_with_embedder) — independent of
the process's cached default.
Full MCP control surface:
* New tools: model_list/_set, reindex, memory_search (FTS), conflict_
resolve, prune, config_show. Pagination (limit/offset) on memory_list
and proposals.
Fix: test isolation. discover_repo_root runs `git rev-parse`, so on a
machine whose $HOME is a git repo, temp project roots climbed to $HOME
and parallel tests shared one brain.db + project.lock (and the bench
harness would leak fixture memories into the enclosing repo). New
kimetsu_core::paths::git_init_boundary gives each fixture/test root its
own git boundary; plain `cargo test` is now hermetic.
Bumps workspace + path-dep versions to 0.8.0; CHANGELOG + HOW-KIMETSU-
WORKS updated.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Makes the brain proactive and gives the agent (and user) full control over it from inside Claude Code / Codex.
Proactive recall (mid-work)
The brain now surfaces a relevant memory while the agent works, not just on prompt — the way a memory "comes to you" rather than you fetching it. New
PreToolUse/PostToolUsehooks (matcherBash):failure_pattern/commandfix;failure_pattern;Discipline keeps it near-zero-cost: lexical-FTS-only (no embedding-model load), high score floor (0.45; loop 0.35), one capsule, per-session dedupe, and a refractory throttle. Silent (zero tokens) when nothing qualifies. Wired into both Claude Code (
.claude/settings.json) and Codex (.codex/hooks.json); opt out withkimetsu plugin install --no-proactive(orproactive:falseover MCP). Per-session state lives in<repo>/.kimetsu/proactive/<session_id>.json, GC'd after 7 days.Selectable embedding model
[embedder]table inproject.toml(precedence:KIMETSU_BRAIN_EMBEDDERenv > config > default).kimetsu brain model list/model set <id>+ MCPkimetsu_brain_model_list/kimetsu_brain_model_set.model setre-embeds the corpus with the new model via a fresh, uncached embedder (reindex_all_with_embedder), independent of the process's cached default. Curated built-ins:bge-small-en-v1.5(default),bge-m3,jina-v2-base-code.Full MCP control surface
New tools so an agent can manage the brain without leaving the harness:
kimetsu_brain_model_list/_model_set,_reindex,_memory_search(FTS),_conflict_resolve,_prune,_config_show._memory_listand_memory_proposalsgainedlimit/offsetpagination. (21 → 28 tools.)Fix: test isolation (+ a latent production bug)
discover_repo_rootrunsgit rev-parse --show-toplevel. On a machine whose$HOMEis itself a git repo, temp project roots created underAppData//tmpclimbed to$HOME, so parallel tests shared onebrain.db+project.lock— and the benchmark harness would init a fixture's brain at that ancestor, leaking fixture memories into the enclosing repo. Newkimetsu_core::paths::git_init_boundarygives each fixture/test root its own git boundary (also a real correctness fix forbench). Plaincargo testis now hermetic with no env overrides.Verification
cargo test(plain, noTMP/KIMETSU_USER_BRAINoverrides): agent 86, brain 106, chat 51, core 8, cli 18 + 7 smoke, e2e 8, 3 ignored — 0 failures.cargo check --features embeddingstypechecks;cargo fmtclean.proactive_state(dedupe/refractory/loop),capsule_matches_kind,search_memoriespagination,retrieve_proactivekind filtering,reindex_all_with_embedder, config round-trip, and a Codex proactive-hook wiring +--no-proactiveopt-out test.model list/set, and an MCP JSON-RPC smoke of all 7 new tools.Bumps workspace + path-dep versions to 0.8.0;
CHANGELOG.mdanddocs/HOW-KIMETSU-WORKS.mdupdated.🤖 Generated with Claude Code