Everything on main since 0.4.0. New commands and an auto-reflect hook, and two changed defaults (maxBulletsInContext, the context history window; see Changed), so it is a minor bump.
Added
-
cm hook install --agent gemini: the same auto-reflect hook for Gemini CLI (.gemini/settings.json, same SessionEnd payload).cm hook statusandcm doctorcover both agents. -
cm hook install|uninstall|status|session-end: auto-reflection. A Claude CodeSessionEndhook reflects each finished session in the background (cm reflect --session <transcript>, detached, logged to~/.cass-memory/hooks.log). Transcripts of cm's own LLM subprocesses are skipped, and so are sessions that end inside a background reflect, so the hook cannot loop. Interactivecm initoffers it. Other agents can callcm hook session-end --transcript <path>. -
cm playbook scrub --from-sessions <pattern>... | --cm-subprocess-calls [--deprecate-orphans] [--dry-run]removes feedback events and source references by session path, recounts them and re-derives maturity (never raising it), and backs up each playbook first (#77). -
cm playbook conflicts: pairs of active rules that contradict each other, with a keep/retire suggestion.cm contextreports contradicting returned rules inconflictsand as a warning, andcm reflectnotes new rules that contradict existing ones. -
cm contexttakes the task from piped stdin (echo "..." | cm context --json, or-). -
cm context --max-tokens <n>/ MCPmaxTokens, configcontextTokenBudget(default 4000): a token budget for returned rules. Results carryretrievalstats. -
cm whyruns the rule's search pointer (or its text) against cass and returns matching sessions as evidence (--no-historyskips this). The top rules' pointers leadsuggestedCassQueries. -
The curator detects reworded duplicates by embedding similarity (
semanticDedupThreshold, default 0.75, calibrated on all-MiniLM-L6-v2: 0 of 14 related-but-distinct pairs merged, 7 of 15 rewordings caught) when semantic search is on. Rules whose directives disagree are never merged. -
Freebuff sessions are recognized (
.freebuff/,~/.config/freebuff/) and included in the default cross-agent allowlist (#69). -
cm diary <session>is registered. It was implemented but unreachable. -
Team playbook merge:
cm playbook importmatches rules by content as well as id. A teammate's copy of a rule (same text under another id, near-identical wording, or same id and text) merges into the existing rule. Feedback events are unioned without double counting, sources and tags are combined, and counts and maturity are recomputed. Imported rules that contradict existing ones are reported inconflicts. -
cm doctorMemory Quality checks: contradicting rules, feedback from cm's own LLM subprocess transcripts, and whether auto-reflection is installed, each pointing at the command that fixes it. -
MCP tools
cm_whyandcm_conflicts.memory_reflecttakesagent. -
cm reflect --agent claude,codex: the option was missing from the CLI, and it now takes a comma list.
Fixed
cm reflect,cm diaryand hook-started reflects work with the OpenAI provider again. The upgraded OpenAI SDK sends strict structured outputs, which rejected the diary schema with HTTP 400 on every session. Requests that really go to OpenAI with strict json_schema (also when cm auto-falls back to OpenAI because the configured provider has no key) now use a strict-compliant diary schema; other providers, the CLI provider anddisableStructuredOutputskeep the previous one.cm playbook export --yamlis accepted again (it is the default format). Dropping the flag broke scripts, andcm playbook export --yaml > backup.yamlleft an empty file.- Auto-reflect sessions that end together queue up: a hook-started reflect waits up to 30 minutes for the reflect in progress instead of giving up after 2 seconds and dropping its session.
- LLMs now receive the output schema. With ai 4 and the installed zod 3.25, the JSON schema sent to every provider was empty, so the reflector, validator, diary and audit models never saw the structure they had to produce, and only the post-hoc Zod check enforced it. After upgrading to ai 7 and zod 4, OpenAI gets strict
json_schema, Anthropic gets native structured output where the model supports it, Google getsresponseJsonSchema, and Ollama getsformat: <schema>. Thecliprovider (claude/codex/gemini subprocess) now gets the full JSON Schema in its prompt instead of top-level field names. - OpenAI requests stay on Chat Completions (
.chat()), because AI SDK 5+ defaults to the Responses API, which OpenAI-compatible gateways do not implement.disableStructuredOutputssendsjson_objectwith the schema in the prompt and validates with Zod. - The curator's word-overlap dedup (and
cm playbook import's content merge) folded "Never mock the database in unit tests" into "Mock the database in unit tests" (Jaccard 0.857), crediting the opposite advice. Rules whose directives disagree are never merged now, on either the lexical or the semantic path. cm reflect --workspace(and MCPmemory_reflectworkspace) now filters which sessions are reflected. It used to only choose the processed-log file, so every project's sessions were reflected. A session belongs to the workspace when cass reports it there, its Claude Code transcript folder is that directory's slug, or its transcript's first records carry acwdinside it.cm hook install --globaland doctor's Claude Code detection resolve~throughHOME, as the rest of cm does.os.homedir()ignores laterHOMEchanges under Bun.- Inline
// [cass: harmful b-x] - reasonfeedback from the shared converter put free text in the harmful-reason enum. It now goes incontext, and the reflect pipeline uses that one converter. - Tests are hermetic against ambient AWS/Ollama credentials and a missing
cassbinary.
Dependencies
- ai 4 → 7, @ai-sdk/openai|anthropic|google 1 → 4, @ai-sdk/amazon-bedrock 1 → 5, ollama-ai-provider → ollama-ai-provider-v2, zod 3 → 4, typescript 5 → 7, chalk 5 → 6, commander 14 → 15.
Removed
- Deprecated aliases
loadToxicLog,appendToxicLog,isSemanticallyToxic.
Changed
- Context ranking (#89). Keyword relevance is BM25 over the playbook (IDF-weighted query coverage, light stemming, prefix matches). Feedback is a bounded multiplier in
[1 - feedbackWeight, 1 + feedbackWeight](default 0.1, a tiebreak among near-equally relevant rules), damped while marks are few. Measured on the retrieval benchmark (test/context-retrieval-benchmark.test.ts) against the old ranker run on the same data. Before, relevance was multiplied by the raw effective score, so an unmarked rule got ×0.1 and a well-marked one ×10 or more. A relative relevance floorminRelativeRelevance(default 0.2 × the best match) drops the long tail. maxBulletsInContextdefault 50 → 10 (#89).- Bullets in
cm contextoutput are a compact projection: no feedback-event log, source-session list or embedding (cm playbook get <id>has the full record). cm contexthistory searcheshistoryLookbackDays(default 90) instead ofsessionLookbackDays(7).- Conflict detection works per clause, so a negation in an unrelated clause no longer flags a rule (the built-in starters went from 5 false positives to 0).
Known issues
cm hook installat project scope (whatcm initoffers) writes the shared.claude/settings.json; if that file is committed, teammates withcmon PATH get auto-reflection without opting in (#90). Install with--globalto keep the hook per user.
Gate
tsc --noEmit: cleanbun test --timeout 60000 --isolate, run file by file on Linux x64 with bun 1.4.2, compared with v0.4.0 on the same host: 2649 passed, 20 failed (the same 20 tests fail at v0.4.0 there). 13 files abort because bun 1.4.2 cannot load thesharpnative module in a source checkout (12 of them at v0.4.0 too); compiled binaries load it optionally and are unaffected.- Compiled binary (
bun build --compile): init, doctor, context, playbook add/list/export, mark, why, stats, top and similar all succeed in a fresh home.
Artifacts
cass-memory-linux-x64, cass-memory-linux-arm64, cass-memory-macos-arm64, cass-memory-macos-x64, cass-memory-windows-x64.exe, each with a .sha256 sidecar, plus install.sh.sha256. install.sh is unchanged since 0.4.0.