release: v0.9.0 — auto-harvested memories#15
Merged
Conversation
publish-npm extracted the Windows archive with unzip, but PowerShell Compress-Archive writes ZIP entries with backslash separators that ubuntu's unzip flattens into a literal filename, so the win32 binary was not found and the job failed after publishing the three Unix platform packages. Extract the Windows zip with 7z (interprets the backslash as a path separator) plus a suffix-match find fallback, and make publishing idempotent so a re-run skips already-published versions.
v0.8.2 published @kimetsu-ai/{linux-x64,darwin-x64,darwin-arm64}; the complete set incl. win32 + the main kimetsu-ai package ships in v0.8.3.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
`kimetsu plugin install` now merges its hooks into existing Claude settings.json / Codex hooks.json instead of replacing them: hooks you already have — even on the same events Kimetsu uses (UserPromptSubmit, PreToolUse, ...) — are preserved, with Kimetsu's group added alongside. Re-running is idempotent (no duplicate groups) and the MCP config and generated docs refresh without needing --force. Adds --scope workspace|global (default workspace). Global installs the surface into the user's home for every session: ~/.claude + ~/.claude.json (mcpServers) for Claude Code, ~/.codex for Codex. Also exposed as the `scope` argument on the kimetsu_plugin_install MCP tool. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…tate Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
PostToolUse: when a command that failed earlier this session succeeds, cue the agent (throttled) to dispatch the kimetsu-memory-harvester subagent. Stop: read the real transcript_path JSONL (fixes a latent bug where the inline transcript was never present in Claude Code), count records correctly, and cue a harvest at end of a non-trivial session that recorded nothing. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Real Claude Code JSONL transcripts carry tool_use names as mcp__kimetsu__kimetsu_brain_record, not the bare form, so the record count was always 0 — the 'lessons recorded' banner never fired and the no-record harvest cue misfired even when the agent did record. Match both bare and namespaced names; raise the non-trivial threshold to suit line-counting; test fixtures now use the namespaced form. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
The hooks now drive memory *generation*, not just retrieval. When a command that failed earlier in the session succeeds, or a non-trivial session ends with nothing recorded, Kimetsu cues the agent to dispatch a background kimetsu-memory-harvester subagent (installed at .claude/agents, pinned to a cheap model) that distills generalizable lessons and records them through the confidence-gated kimetsu_brain_record path. No separate API key or kimetsu-side model credentials; in-agent and non-blocking; toggle with [learning] auto_harvest. Also fixes the Stop hook to read the real transcript_path JSONL and match the MCP-namespaced record tool name, and strips internal version-history prefixes from --help and the MCP tool menus. Bundles the v0.8.4 plugin-install work (hook merge + --scope) this branch is stacked on. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…lish - BOM tolerance (#1): strip a leading UTF-8 BOM before parsing existing settings.json/hooks.json/config.toml/.mcp.json, so a config saved by a BOM-emitting editor (older Windows Notepad) no longer fails install with 'expected value at line 1 column 1'. - Bounded transcript read (#7): the Stop hook now streams the transcript JSONL line-by-line (count_transcript_jsonl) instead of loading the whole file, so a long session's multi-MB transcript never lands in memory. - Install polish (#3): document that --force overwrites an existing CLAUDE.md (incl. the global one); warn instead of silently ignoring --scope global for the workspace-only kimetsu target; canonicalize --workspace leniently so a global install doesn't fail on a missing path. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…-hook Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
… a parent repo The wizard located its config dir via ProjectPaths::discover(), which walks up to the nearest enclosing git repository. For a user whose home (or any parent) is a git repo and who installs into a non-git subdir, that wrote the distiller config + secret .env into the PARENT repo instead of the install workspace. Add ProjectPaths::at_root() (non-climbing) and use it for the wizard. Rewrite apply_distiller_config to write project.toml directly (load-or-default) instead of init_project (which also climbs and opens the brain DB). Now the wizard writes strictly under --workspace. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
RodCor
force-pushed
the
feat/auto-harvest-memories
branch
from
June 3, 2026 02:21
d89fd54 to
93c34cc
Compare
… replace) Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…gate Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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
v0.9.0 — the Kimetsu hooks now drive memory generation, not just retrieval ("the other way" the brain was missing), plus a credentialed end-of-session distiller, Codex parity, and a round of non-destructive install hardening.
This branch is stacked on the v0.8.4 work (#14) and folds in the global distiller / OpenAI provider (#16), so this PR is the full v0.8.4 + v0.9.0 delta against
main.What's in this branch
🧠 Auto-harvested memories (in-agent, no credentials)
The hooks now generate memories. When a command that failed earlier in the session later succeeds (PostToolUse), or a non-trivial session ends having recorded nothing (Stop), Kimetsu emits a throttled
[kimetsu-harvest]cue telling the agent to dispatch a new backgroundkimetsu-memory-harvestersubagent (installed at.claude/agents/for Claude Code and.codex/agents/for Codex, pinned to a cheap model). The subagent distills 0–3 generalizable lessons and records them through the confidence-gatedkimetsu_brain_recordpath — no separate API key, billed in-agent at the cheap model's rate, non-blocking. Disable with[learning] auto_harvest = false.🔑 Credentialed SessionEnd distiller (opt-in)
A second, deterministic harvest path alongside the in-agent harvester.
kimetsu plugin install claude-code/... codexnow runs an interactive wizard (on a TTY; skip with--no-setup, force with--setup-harvest) configuring a cheap distiller model — Anthropic (claude-haiku-4-5), OpenAI (gpt-5.4-mini), or a compatible endpoint viaANTHROPIC_BASE_URL/OPENAI_BASE_URL. The key + base URL go to a gitignored.env; the selection lands in[learning.distiller]inproject.toml. ASessionEndhook (Claude Code) runskimetsu brain session-end-hook; when credentialed it reads the transcript with that model and records viapropose_or_merge_memory. When the distiller is enabled it owns end-of-session — the Stop harvest cue is suppressed, while the mid-session PostToolUse resolved-failure cue stays.AnthropicProvidergained an optional base URL (LiteLLM); a new OpenAI Responses-API provider was added.🤖 Codex parity
kimetsu plugin install codexwrites.codex/config.toml,.codex/hooks.json, thekimetsu-bridgeskill, and a.codex/agents/kimetsu-memory-harvester.tomlcustom agent — the Codex equivalent of the Claude harvester subagent (Codex's standalone TOML agent format). So the in-agent auto-harvest flow works on Codex too.UserPromptSubmit→kimetsu brain context-hook,Stop→kimetsu brain stop-hook --distill-on-stop, plus proactive Bash-wrappingPreToolUse/PostToolUsehooks. Existing user hooks on the same events are preserved alongside Kimetsu's; re-install is idempotent.Stophook. Current Codex releases exposeStopbut notSessionEnd, so the credentialed distiller runs from Codex'sStophook via--distill-on-stop(Claude Code uses the dedicatedSessionEndevent).codexharness configures the OpenAI provider (defaultgpt-5.4-mini) or a compatible endpoint viaOPENAI_BASE_URL; the key lands in the gitignored.envand the selection in[learning.distiller].OpenAiProvider,crates/kimetsu-agent/src/openai.rs) powers the OpenAI/Codex distiller path.🌍 Global distiller in
~/.kimetsu/With
--scope globalthe wizard configures the distiller once in~/.kimetsu/(config +.env). That global distiller then runs in every project and records into the user brain (~/.kimetsu/brain.db, available everywhere), with a per-project distiller taking precedence when one is configured.📄 CLAUDE.md merge (append, never replace)
kimetsu plugin installnow merges its guidance into an existingCLAUDE.md— workspace.claude/CLAUDE.mdor global~/.claude/CLAUDE.md— inside<!-- kimetsu:begin -->/<!-- kimetsu:end -->markers: write-if-missing / append-if-absent / replace-the-marked-region-in-place / repair-a-corrupt-half-block / BOM-tolerant. The user's content is never overwritten.--forceno longer overwritesCLAUDE.md(the whole install is idempotent and non-destructive; the flag is retained only for compatibility).🔧 Non-destructive install hardening (v0.8.4, bundled)
plugin installmerges its hooks into existing Claudesettings.json/ Codexhooks.jsoninstead of replacing them — hooks you already have, even on the same events (UserPromptSubmit,PreToolUse, …), are preserved with Kimetsu's group added alongside. Idempotent (no duplicate groups).--scope workspace|global. Install the Kimetsu surface into the workspace (default) or the user's home (~/.claude/+~/.claude.json,~/.codex/) for every session. Also exposed as thescopearg on thekimetsu_plugin_installMCP tool.settings.json/hooks.json/config.toml/.mcp.json(older Windows editors no longer break the install).--scope globalon the workspace-onlykimetsutarget warns instead of silently no-op'ing;--workspaceis canonicalized leniently so a global install doesn't fail on a missing path.🐛 Stop hook fix
The Stop hook counted
kimetsu_brain_recordcalls from a non-existent inlinetranscriptarray; Claude Code actually passes atranscript_pathto a JSONL file. It now streams the JSONL line-by-line (multi-MB transcripts never load fully into memory), keeps the inline array as a fallback, and counts both the bare and MCP-namespaced (mcp__kimetsu__kimetsu_brain_record) tool names — so the "lessons recorded" banner and the end-of-session cue actually fire.🧹 Cleaner help & tool menus
Stripped internal version-history prefixes (
v0.x:,MP-…:) from--helptext and the MCP tool/argument descriptions so menus read as plain present-tense descriptions (code comments unchanged).Test Plan
cargo test --workspace— all green (333 tests). New coverage includes:count_brain_record_callsbare + namespaced shapes;[learning]/[learning.distiller]config back-compat; harvester subagent install.write_codex_hooksidempotent merge +Stop --distill-on-stop+ proactivePostToolUse;.codex/agents/kimetsu-memory-harvester.tomlinstall; wizard accepts thecodexharness → OpenAI (wizard_accepts_codex_harness,wizard_accepts_openai_custom_model);OpenAiProviderResponses-URL / base-URL resolution.resolve_distillerprecedence (workspace > global) under an env-locked temp user brain;distill_and_recordGlobalUser routing; string-aware lesson extraction.merge_claude_mdmatrix (fresh / preserve / idempotent / in-place upgrade / begin-without-end repair / BOM) +install_preserves_existing_user_claude_md.cargo fmt --all --checkclean;cargo build --workspacewarning-clean after the 0.9.0 bump.[kimetsu-harvest]cue; Stop reads a JSONL transcript and reports recorded lessons (verified with the namespaced tool name) vs cues a harvest when none;plugin installinto a workspace with a pre-existingCLAUDE.mdpreserves the user content and is idempotent (exactly one marker block after a re-install).Merge notes
Bundles #14 (v0.8.4) and #16 (global distiller / OpenAI provider). Merge this and close #14, or merge #14 first — the overlap reconciles automatically.