23 KiB
23 KiB
Changelog
All notable changes to the Mem0 plugin will be documented in this file.
0.2.4
Fixed
- PostToolUse matcher mismatch (
hooks.json:81): Changed frommcp__mem0__tomcp__mem0__|mcp__plugin_mem0_mem0__. Root cause of session stats recording nothing — 146 consecutive "no memory operations" entries. Unblocks/mem0:statssession line, stop-hook report, andsession_stats.pytracking. - File-read hook noise (
on_file_read.sh): Replaced bare-filename semantic search withmetadata.filesfilter + score threshold (≥ 0.4). Falls back to basename search if metadata filter returns nothing. Eliminates irrelevant context injection on every Read. /mem0:pinuses v3-removedimmutable=True: Removed Step 3a entirely. Standardized onmetadata.pinned: true(whichdream/SKILL.mdalready respects during pruning). Fixed unconditional...appended to short pin confirmations./mem0:list-projectsundercounts (implicit null scoping): Dual-query approach — runs both null-scoped and app-scopedget_memoriescalls, merges by ID. Handles legacymetadata.project_idandmetadata.projectfields./mem0:peekfree-text search on memory IDs: Detects bare hex IDs (^[a-f0-9]{8}$) and[mem0:<hex>]citation refs, routes toget_memorydirect lookup instead of semantic search.- Dead
PostToolUseFailurehook block: Removed entirely — this hook event does not exist in Claude Code.
Added
- Session ID capture (
on_session_start.sh): Extractssession_idfrom Claude Code stdin JSON, persists to/tmp/mem0_session_id_$USER. Falls back to timestamp-based ID. Enablesrun_id-based session scoping. run_idinjection (enforce_metadata_defaults.sh): Reads session ID from temp file, injects asrun_idinto everyadd_memorycall. Tags all memories with session identity for entity-scoped filtering.min_score,metadata_filters,rerank,thresholdparams (_search.py):search_memories()now acceptsmin_score: floatto filter low-relevance results,metadata_filters: dictfor field-level filtering,rerank: boolfor managed reranker, andthreshold: float(default 0.3, up from platform default 0.1) for server-side relevance gating. Existing callers unaffected (new params have defaults).- Rerank on tour/peek:
/mem0:tourand/mem0:peeksearch calls now passrerank=truefor better result ordering (+150–200ms latency, significantly improved precision). /mem0:statssession query viarun_id: Queries memories byrun_idfilter for API-backed session counts. Cross-checks against local stats file. Shows truncated session ID in output.
Removed
/mem0:protocolskill: Routing table fully superseded by individual skill descriptions (auto-trigger). Operational guidelines (search patterns, metadata rules) covered byenforce_metadata_defaults.shhook and individual skill bodies.
Changed
- All 17 skill descriptions: Rewritten per Claude skill best practices — each now includes what the skill does AND when to trigger it, with specific keywords for auto-discovery. Average length 200–270 chars (under 1024 max). Third person, action verbs.
- Onboarding auto-trigger (
on_session_start.sh): Replaced 3-state marker-file logic with memory-count detection. New project (0 memories) → prompts Claude to invoke/mem0:onboard. No marker files, no OAuth state. Simplified no-API-key path to single inactive banner.
0.2.3
Added
- Read hook (
on_file_read.sh):PreToolUse(Read)hook that searches mem0 for memories tagged with the file being opened and injects them as context. Skips non-code files, lockfiles, andnode_modules/. Deduplicates repeated reads within a session. - Shared search module (
_search.py): WrapsPOST /v3/memories/search/into a reusablesearch_memories()call withformat_results_for_context()for consistent[type] content [mem0:id]display. Used by all pre-fetch hooks. - User settings (
load_settings.py): Loads config from~/.mem0/settings.jsonwith 9 keys:auto_save,auto_search,search_limit,retention_session_days,confidence_threshold,output_style,debug,skip_tools,capture_tools. Supportsinitsubcommand for first-run creation. /mem0:forgetskill: Standalone skill for deleting memories by search query or UUID with confirmation. Supports undo-last-N viasession_stats.py peek./mem0:peekskill: Compact quick-search with one-liner output. Runs 2 parallel searches (broad +decision-filtered), deduplicates by ID./mem0:memory-reviewerskill: Read-only memory quality audit. Scans for near-duplicates (>60% noun overlap), contradictions, low-confidence entries, untagged memories, and stale entries (>180 days). Refers to/mem0:dreamfor remediation./mem0:context-loaderskill: Pre-fetch agent that runs 2–4 parallelsearch_memoriescalls across query angles and type filters, deduplicates, outputs up to 10 memories. Silent on empty results.- Compact memory output style (
output-styles/compact-memory.md):[<type>] <content, max 80 chars> [mem0:<short_id>]format used bypeek,tour, and inline search display. userConfigin.claude-plugin/plugin.json:api_keyfield (sensitive: true) enables key storage viaclaude plugin configure mem0.- OAuth support:
authorizationUrladded to.mcp.jsonfor OAuth flow alongside token-based auth. - Tests:
test_search.py,test_rubric_dedup.py,test_on_file_read.py.
Changed
- Skills renamed: All
mem0-*prefixed skill directories renamed to shorter forms (e.g.,mem0-dream→dream,mem0-mcp→protocol,mem0-tour→tour). 12 skills renamed total. - Pre-fetch on bash errors:
on_bash_output.shnow performs actualsearch_memoriescalls via_search.pyinstead of emitting search query templates as text. - Session-resume pre-fetch:
on_user_prompt.shdetects resume phrases ("where did we leave off", "continue from where") and pre-fetchessession_state+decisionmemories. - Remember-intent routing:
on_user_prompt.shdetects save phrases ("remember this", "don't forget that") and routes to/mem0:rememberskill instead of rawadd_memory. - Rubric deduplication: Search guidance rubric injected only on first user prompt per session via flag file.
- Namespace-agnostic tool matching:
on_post_tool_use.shandon_tool_failure.shnow use wildcard suffix matching (*__add_memory) instead of hardcodedmcp__mem0__prefix. - API key resolution:
_identity.sh/_identity.pynow checkCLAUDE_PLUGIN_OPTION_API_KEY(fromuserConfig) before legacyCLAUDE_PLUGIN_OPTION_MEM0_API_KEY. - Session start: Three-state no-key handling (first run → auto-onboard, OAuth mode → proceed, neither → inactive banner). Banner now shows
auth=api_key|oauth. - Hook timeouts:
on_user_prompt.shandon_bash_output.shraised from 5s to 12s. - Compact prompts:
on_task_completed.shandon_stop.shreplaced multi-step checklists with single-line directives (0–2 durable facts max). /mem0:dream: Removed--forget(now standaloneforgetskill) and--scheduleflags./mem0:health: Removed--fixauto-fix mode; output condensed toPASS/FAIL CheckName Detailone-liners./mem0:protocol(wasmem0-mcp): Added 14-entry natural-language-to-skill routing table. (Removed in 0.2.4 — superseded by skill descriptions.)- CLI config fallback removed:
_identity.sh/_identity.pyno longer read~/.mem0/config.json; API key resolution is env-var-only. auto_import.py: Added content-hash deduplication to skip files with identical content within a single import run.- All skill descriptions: Shortened to concise one-liners.
Fixed
- Namespace-agnostic tool name parsing in
on_tool_failure.sh:${TOOL_NAME##*__}correctly strips any MCP namespace prefix, not justmcp__mem0__. _identity.py/_identity.sh:CLAUDE_PLUGIN_OPTION_API_KEYenv var was not checked, causing key-not-found when usinguserConfig.- Three previously failing tests (
test_on_file_read.py,test_rubric_dedup.py,test_write_path.py) fixed after hook changes.
Removed
/mem0:dream --forgetflag: Extracted to standaloneforgetskill./mem0:dream --scheduleflag: Use Claude Code's built-in/schedulecommand instead./mem0:health --fixflag: Auto-fix mode removed entirely; use/mem0:dreamfor remediation.- CLI dependency for key management: All
~/.mem0/config.jsonfallback code removed.
0.2.2
Fixed
- Duplicate memory writes on compaction:
on_pre_compact.pywas running as both primary and backup capture path. Now readssession_statsand skips if agent already stored 2+ memories.on_stop.shandon_session_end.shwere both callingon_pre_compact.py, creating double captures — removed redundant calls. - Verbose session-state blobs:
on_pre_compact.pybuild_content()was producing 5000+ char structured markdown. Now produces minimal 2-line summary (Working on:,Files touched:), relying oninfer=Truefor extraction. - Pre-compaction prompt rewrite: Instruction changed from "store a single large
session_stateblob withinfer=False" to "store 0–3 durable facts per session (15–50 words each), one peradd_memorycall, tagged by category." - False-positive error detection:
on_bash_output.shandon_user_prompt.sherror grep pattern was too broad, triggering on routine test/linter output. Now uses two-tier approach: high-signal patterns (Traceback,panic:,FATAL:) fire always; lower-signal (Error:,Exception:) require 2+ occurrences. - Background
on_pre_commit.pyon every git commit:on_git_commit_capture.shwas storingcommit_contextmemories regardless of usefulness. Background call removed; hook now only performs memory search.on_pre_commit.pydeleted. - Post-commit prompt always firing:
on_post_commit.shnow gated behindsettings.commit_prompts: trueinmem0.md(defaults to off). - Project ID lost after folder rename:
_project.pyonly looked upproject_map.jsonby CWD path. Added remote-hash fallback: hashesgit remote.origin.urlto a 16-char key, self-heals map on hit. - Subagent skip list hardcoded:
on_subagent_stop.shnow readssettings.subagent_skipfrommem0.mdinstead of hardcodedExplore|Plan. - Auto-import missed project-root files:
auto_import.pyonly searched CWD. Added_git_root()helper to also search git root when invoked from subdirectory. - Concurrent
ensure_deps.shinstall race: Multiple parallel sessions could corrupt the venv. Added lock directory with 60s spin-wait and.install-failedsentinel. - Telemetry
distinct_idused MD5: Changed to SHA-256 (truncated 32 chars). - Telemetry caller props could override system props: Moved system fields after spread so they always win.
- Plugin version hardcoded in
telemetry.py: Replaced with_load_plugin_version()reading fromplugin.json. - Onboard marker race: Marker now created in
on_session_start.shwhen prompt is first displayed, not after skill completes.
Changed
capture_compact_summary.py:inferchanged fromFalsetoTrueso platform can extract structured facts.- Chunking utilities extracted to
_chunking.py:split_by_headers,split_by_hr_or_headers,filter_and_truncatemoved fromimport_competing_tools.pyto shared module. auto_import.pynow chunks Markdown files:.mdfiles split by##headers before import instead of single blob.enforce_metadata_defaults.sh: NewPreToolUsehook onadd_memoryfor all three editors. Injects default metadata (confidence: 0.7,source: "auto_capture",type: "task_learning") when agent omits them.mem0.mdSettings section parsing:parse_mem0_config.pynow parsesSettingssection; added--key <dotted.path>CLI argument for programmatic lookup.- Project config display condensed: Session start shows compact summary line instead of raw JSON dump.
Added
scripts/_chunking.py— shared content-chunking utilities.scripts/enforce_metadata_defaults.sh— metadata defaults injection hook.parse_mem0_config.py --key— CLI accessor for individualmem0.mdconfig keys.- Native
MEMORY.mddetection:on_session_start.shdetects Claude Code auto-memory and prompts to disable or run/mem0:import. /mem0:list-projectsskill: Discovers all projectapp_idscopes by paginatingget_memorieswithout anapp_idfilter./mem0:tourcross-project mode (--all-projects) and peek mode (query argument)./mem0:statsweekly digest mode (--weekly)./mem0:dream --forgetmode: Search-confirm-delete flow with undo-last-write./mem0:import --toolsflag: Import from competing AI tool configs.conftest.py—_clean_project_mapautouse fixture preventing cross-test pollution.
Removed
scripts/on_pre_commit.py— source of unwanted background writes on every commit./mem0:digestskill — merged into/mem0:stats --weekly./mem0:forgetskill — merged into/mem0:dream --forget./mem0:import-toolsskill — merged into/mem0:import --tools./mem0:peekskill — merged into/mem0:tour <query>.tests/test_pre_commit.py— tests for deleted script.
0.2.1
Added
- 11 new skills:
/mem0:dream(memory consolidation),/mem0:export(portable YAML-frontmatter export),/mem0:import(re-import exported memories),/mem0:import-tools(import from Cursor/Copilot/Cline/Continue configs),/mem0:forget(delete with confirmation),/mem0:health(diagnostic check — API key, MCP connectivity, read/write),/mem0:peek(compact quick-search),/mem0:pin(mark memory as high-priority),/mem0:remember(quick verbatim store with auto-classification),/mem0:stats(session + lifetime statistics),/mem0:digest(weekly memory summary). - 8 new hook scripts:
on_bash_output.sh(scan bash output for errors, surfaceanti_pattern/bug_fixmemories),on_git_commit_capture.sh(detect git commit/merge/rebase, search relevant memories),on_post_commit.sh(prompt to save commit learnings),on_post_compact.sh(recovery prompt to reload context after compaction),on_session_end.sh(last-chance transcript capture with dedup marker),on_subagent_stop.sh(remind to capture learnings from non-Explore/Plan subagents),on_tool_failure.sh(classify MCP failures as auth/rate-limit/network, suggest recovery),on_pre_commit.py(capture staged changes via REST API). - PostHog telemetry (
telemetry.py): Anonymous, fire-and-forget, 10% sampled. Uses stdliburllib(no SDK dependency). Sends event type, platform, plugin version, anonymized identity. Never sends memory content or API keys. Opt-out viaMEM0_TELEMETRY=false. - 10 new memory categories in
setup_coding_categories.py:dependency_decisions,performance_findings,security_constraints,testing_patterns,data_model,api_contracts,deployment_runbook,team_norms,domain_glossary,experiment_results. - Dependency management (
ensure_deps.sh): Installsmem0aiinto persistent venv at${CLAUDE_PLUGIN_DATA}/venv. Skips re-install ifrequirements.txthash unchanged. Runs onSetup(init|maintenance)hook and everySessionStart. - Competing tool importer (
import_competing_tools.py): Parses and uploads configs from.cursorrules,.github/copilot-instructions.md,memory-bank/,.continue/rules.md. Splits by Markdown headers/horizontal rules. - Export file parser (
parse_export_file.py): Parses YAML-frontmatter Markdown format into JSON array. - Config parser (
parse_mem0_config.py): Readsmem0.mdand extractsRetentionsection into category-to-days mapping. - Auto-onboarding:
on_session_start.shdetects first-time projects and triggers/mem0:onboardautomatically. mem0.mdconfig loading: Session start parsesmem0.mdand injects project config into context.- Inactive API key banner: Shows
Mem0 Inactivewithapi_key=NOT_SETinstead of silently exiting. requirements.txt: Declaresmem0aias plugin's Python dependency.- Tests:
test_coding_categories.py,test_import_competing_tools.py,test_parse_export_file.py,test_parse_mem0_config.py,test_pre_commit.py,test_session_stats.py,test_telemetry.py,test_write_path.py.
Changed
- API scoping:
metadata.project_id→app_id: All scripts and skills now passproject_idas top-levelapp_idparameter instead of insidemetadata. Affectsauto_import.py,capture_compact_summary.py,on_pre_compact.py, all stop hooks, all skill instructions. - API endpoint: v1 → v3:
auto_import.py,capture_compact_summary.py,on_pre_compact.pynow call/v3/memories/add/. - API key resolution:
_identity.pyand_identity.shnow checkCLAUDE_PLUGIN_OPTION_MEM0_API_KEY(Claude CodeuserConfigenv var) as fallback afterMEM0_API_KEY. session_stats.py: Added per-category counters, rolling list of up to 50 recent memory IDs,peeksubcommand for non-destructive stat reading.setup_coding_categories.py: Now importsmem0aifrom managed venv viasys.pathinjection.on_stop_cursor.sh: Addedloop_countguard to prevent re-entry loops.on_stop.sh: Removedset -eso session-end reminder always emits even ifsession_stats.pyfails. Added dedup marker (~/.mem0/.captured_<session_id>).on_user_prompt.sh: Detects source file paths in prompt and addsmetadata.files containssearch filter. Handles no-API-key case gracefully./mem0:tour: Replaced 7 parallel type-filteredsearch_memoriescalls with singleget_memories(app_id=...)+ 3 broad searches (type filtering misses auto-categorized memories)./mem0:onboard: Added SDK install step, changed MCP check to use ToolSearch, writes onboard marker to prevent re-triggering./mem0:mcp: Added 16-row category-to-query routing table, inline citations requirement,branchin metadata requirement.
Fixed
auto_import.py,capture_compact_summary.py,on_pre_compact.py: Were readingMEM0_API_KEYdirectly; now useresolve_api_key()soCLAUDE_PLUGIN_OPTION_MEM0_API_KEYis honored.on_pre_compact.py:resolve_project_id()andresolve_branch()now receivecwdfrom hook input instead ofos.getcwd(), fixing incorrect identification when hook fires in different directory.on_stop_codex.sh,on_stop_cursor.sh: Missing_identity.shsource call; API key resolution viauserConfigfallback was broken.on_post_tool_use.sh: Input field corrected fromtool_resulttotool_outputto match hook JSON schema.
0.2.0
Added
- Project-scoped memories: Deterministic
project_idfrom git remote (_project.sh/_project.py). Memories are now isolated per-repo viametadata.project_idon everyadd_memoryandsearch_memoriescall. Same repo cloned twice → sameproject_id. - Branch-aware tagging:
metadata.branchstamped on session-state and compact-summary memories. Enables branch-scoped recall (e.g. "what was I doing on feature/auth-rewrite?"). - Auto-import of project files: SessionStart detects CLAUDE.md, AGENTS.md, .cursorrules, .windsurfrules, mem0.md — hashes them (SHA-256), imports changed files as
project_profilememories. Idempotent across sessions. - Active identity banner: SessionStart now prints
user=X | project=Y | branch=Z | memories=Ninstead of a silent bootstrap. - Session-end report: Stop hook prints
Session: wrote N memories, retrieved M. Categories touched: ...and appends to~/.mem0/session-log.md. /mem0:onboardskill: Post-install wizard — verifies API key, detects and imports project files, installs coding categories, prints setup summary. 30 seconds to value./mem0:tourskill: Shows all memories for the current project grouped by category. Proof-of-value demo./mem0:switch-projectskill: Manualproject_idoverride for monorepos and non-git directories. Persists to~/.mem0/project_map.json.- Session stats tracker (
session_stats.py): Tracks memory adds/searches per session for the end-of-session report.
Changed
- All hooks and
mem0-mcp/SKILL.mdnow includeproject_idin every filter and metadata example. - SessionStart banner replaces the previous "## Mem0 Identity" block with a compact one-liner.
on_pre_compact.pyandcapture_compact_summary.pynow includeproject_idandbranchin stored metadata.
0.1.3
Fixed
- user_id resolution no longer derives from
MEM0_API_KEY. v0.1.2 changed the resolver to fall back to"mem0-" + sha256(MEM0_API_KEY)[:12]ahead of$USER, which silently moved every existing user to a new bucket on update. Memories written under the previous$USERvalue became unreachable from the plugin. Resolution is now back toMEM0_USER_ID→$USER→"default". - Dropped the "regardless of which machine you're on" line from the SessionStart bootstrap, since cross-machine consolidation now requires setting
MEM0_USER_IDexplicitly.
Notes for users upgrading from 0.1.2
- The
~/.mem0/identity.jsoncache file is no longer read or written. Safe to delete. - If you wrote memories during the v0.1.2 window, they live under
mem0-<sha256(api_key)[:12]>. To recover: temporarilyexport MEM0_USER_ID=mem0-<hash>, search/export, then unset. - Want a single bucket across machines (the original goal of #5076)? Set
MEM0_USER_IDexplicitly in your shell profile. The plugin will not auto-derive one.
0.1.2
Added
- Deterministic
user_idresolver (_identity.sh/_identity.py) — reverted in 0.1.3, see above. - SessionStart-compact handler (
capture_compact_summary.py) that stores the post-compaction summary as a memory withmetadata.type=compact_summary. - Coding-taxonomy setup script (
setup_coding_categories.py) — one-shotproject.update(custom_categories=[...])forarchitecture_decisions,anti_patterns,task_learnings,tooling_setup,bug_fixes,coding_conventions,user_preferences. - Opt-in hook logging via
MEM0_DEBUG=1→~/.mem0/hooks.log. mem0-mcpskill replacing the Claude-Code-specificmem0-codexskill.
Fixed
session_idnow written to memory metadata (on_pre_compact.py).- SessionStart bootstrap exits silently when
MEM0_API_KEYis unset. block_memory_write.shregex tightened toMEMORY.md/.claude/memory/*— no longer blocksdocs/memory/*.md.- Removed duplicate PreCompact write path (kept agent-driven, dropped the parallel Python REST entry from
hooks.json/cursor-hooks.json). - Hook-side captures (
session_state,compact_summary) now setexpiration_date = today + 90 days.
0.1.1
- Cursor plugin fully functional (
#4547). - Codex plugin support and integration docs (
#4665). - Codex lifecycle hooks via opt-in installer (
#4917). - Removed invalid keys from Claude plugin config (
#4821).
0.1.0
- Initial release: Mem0 plugin for Claude Code and Cursor (
#4518).