Skip to content

Solution for long term memory for agent coding CLIs and to facilitate handoff between different agent vendors

Rust

Merge remote-tracking branch 'origin/main' into audit/pr-223-fix

AkitaOnRailsacd424f3fbf9
diff --cc CHANGELOG.md
index cc33e0bd,3d158d4b..c4942009
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@@ -8,35 -8,22 +8,51 @@@ and this project adheres to [Semantic V
## [Unreleased]
### Added
+ - Opt-in assistant/Stop capture for Claude Code (#196). When BOTH the server
+ (`capture_assistant = true` / `AI_MEMORY_CAPTURE_ASSISTANT=true`) and the
+ client (`install-hooks --agent claude-code --capture-assistant`) opt in, a
+ Claude Code `Stop` event carries a sanitized, 2 KB-capped excerpt of the
+ assistant's final turn as the Stop body. The client sanitizes with the
+ built-in patterns and truncates before the excerpt ever touches the spool or
+ wire, splicing a versioned `_ai_memory_assistant` marker into the body and a
+ `capture_assistant=1` flag onto the event URL; the server re-scrubs with its
+ configured `[sanitize]` patterns and re-enforces the 2 KB cap at the
+ persistence boundary (never trusting the client's length). Off by default,
+ and any gate failure (server off, wrong agent/event, malformed or
+ future-versioned marker, empty excerpt) degrades to an empty Stop with the
+ same `202` response. Assistant text is privacy-sensitive — see `SECURITY.md`
+ for what it can contain and where it flows. Script-fallback installs cannot
+ sanitize the field and drop the whole Stop event instead; move to a native
+ install to capture it.
+- Managed workstreams now support Kimi Code through `ai-memory run kimi`.
+ Returning runs resume the linked native session with `--session <id>`;
+ fresh sessions are discovered post-exit by exact checkout match through
+ `state.json`'s `workDir` (the session bucket name is a one-way hash and is
+ never parsed). The adapter reads `$KIMI_CODE_HOME/sessions` (default
+ `~/.kimi-code/sessions`) and imports only visible user/assistant/tool
+ messages and compaction summaries from `agents/main/wire.jsonl`, excluding
+ system prompts, hidden reasoning, hook-injected context (`hook_result` and
+ related origins), and subagent transcripts. Wrapper `--yolo` maps to Kimi
+ Code's `--yolo`, and kimi joins the automatic bare-run harness pool.
+
+### Fixed
+- Kimi Code handoffs are now delivered through the `UserPromptSubmit` hook
+ instead of `SessionStart`. Kimi Code fires `SessionStart` but discards the
+ hook's stdout/result (verified against kimi-code v0.28.1,
+ `packages/agent-core/src/session/index.ts`), so the previous hook consumed
+ pending handoffs — legacy and managed — without ever showing them to the
+ model. `UserPromptSubmit` stdout is injected as a user message before the
+ turn. The native `ai-memory hook` path now also accepts the
+ `user-prompt-submit` event token alongside `user-prompt` for kimi handoff
+ delivery. Re-run `ai-memory install-hooks --agent kimi-code --apply` after
+ upgrading.
+- The `[briefing]` compiled project brief is now gated to once per session
+ for Kimi Code: it rides the first user prompt (kimi discards SessionStart
+ hook stdout, so session-start delivery is impossible) and later prompts
+ keep fetching the handoff without the briefing params, so the server no
+ longer recomposes the brief on every prompt. Re-briefing after `/clear`
+ is not supported in v1.
+
## [1.17.3] - 2026-07-22
### Fixed