2c796d144f
Co-authored-by: Claude <noreply@anthropic.com>
45 KiB
45 KiB
Changelog
All notable changes to the Mem0 plugin will be documented in this file.
0.2.9 — File-context injection, session summaries & activity timeline
Added
- File-context injection (
PreToolUse/Readhook): Before Claude reads a file, the newon_file_read.shhook searches mem0 for memories that reference that file path and injects a compact timeline of prior work asadditionalContext. Gives Claude "I've seen this file before and here's what I remember" context automatically. Gates on file size (>= 1,500 bytes), 5-second hard timeout, silent skip on any failure. Applies to Claude Code, Codex, and Cursor (on_file_read_cursor.sh). - Stop hook session summary (
on_stop.sh): On session end, parses the transcript JSONL, extracts the last assistant message and files touched, builds a structured prompt, and stores it via the mem0 API withinfer=True— letting the platform's backend AI extract structured facts (request, decisions, learnings, next steps). Memories are stored asmetadata.type=session_summarywith 90-day expiry. Guards: skips subagent sessions (agent_idpresent), dedup via marker file, always exits 0. Applies to Claude Code, Codex, and Cursor (on_stop_cursor.sh). - SessionStart activity timeline (
session_timeline.py): On startup (when project has existing memories), fetches the 10 most recent memories and renders a compact timeline with type icons, age indicators, and short text below the existing banner. Shows recent decisions, bug fixes, and session summaries at a glance. 5-second timeout — if the API is slow, the timeline silently skips while the banner still displays. scripts/file_context.py: Core Python module for file-context injection. Searches mem0 cloud API with both relative and absolute file paths, deduplicates results, formats as compact timeline with type icons and memory age.scripts/capture_session_summary.py: Core Python module for Stop hook. Reads transcript JSONL (tail 3,000 lines), extracts last assistant message, extracts file paths from tool_input fields, strips system tags and<private>blocks, stores via mem0 API.scripts/session_timeline.py: Core Python module for SessionStart timeline. Fetches recent memories from mem0 API, formats with type icons, relative age, and short text.
Changed
on_session_start.sh: On startup (when memories > 0), callssession_timeline.pyto inject a compact recent activity timeline below the existing banner and rubric instructions.hooks/hooks.json: AddedPreToolUsematcher forRead(5s timeout) andStophook (30s timeout).hooks/codex-hooks.json: AddedPreToolUsematcher forRead(5s timeout) andStophook (30s timeout).hooks/cursor-hooks.json: AddedpreToolUsematcher forRead(5s timeout) andstophook (30s timeout).
0.2.8 — Automatic coding categories & global search
Added
- Global search mode (
global_searchsetting): Newglobal_searchtoggle in~/.mem0/settings.json(default:false). When enabled,search_memoriesandget_memoriescalls use{"OR": [{"user_id": "*"}]}instead of the per-user per-projectANDfilter — returning all memories across all users and allapp_idscopes in the platform project. Writes (add_memory) still tag with the currentuser_idandapp_id. Solves the team-shared-memory use case where multiple team members need access to all memories regardless of which repo or user created them. Works on Claude Code, Cursor, and Codex. /mem0:switch-project --global/--no-global: Enables or disables global search via the switch-project skill. Persists to~/.mem0/settings.json. No manual config editing needed.- Session banner scope indicator: Banner shows
scope=globalwhen global search is active instead ofproject=<app_id>. - Global-aware memory count: Session start memory count query uses the global filter when
global_searchis enabled. - Background coding-category setup (
scripts/auto_setup_categories.py): The coding-focused category taxonomy (17 categories tuned for development work) is now installed automatically in the background on session start — the same wayauto_import.pyimportsCLAUDE.md/AGENTS.md. Users are no longer asked to configure it during onboarding. Mirrors the auto-import design: resolves the API key, holds a lock file (~/.mem0/categories_setup.lock), reuses the provensetup_coding_categories.pytaxonomy +project.updatepath via the plugin venv, logs to stderr only, and always exits 0 so it can never block a session. - Per-account state gating (
~/.mem0/categories_setup.json): Keyed by a hash of the API key → a hash of the taxonomy. Categories are scoped to the mem0 project tied to the API key (not the local repo), so setup runs once per account and skips all network calls thereafter — re-applying only if the taxonomy itself changes. tests/test_auto_setup_categories.py: Covers fingerprint determinism/sensitivity, state-file load/save/gating, and idempotent apply via an injected fake client (no SDK, no network).
Changed
on_session_start.sh: Spawnsauto_setup_categories.pyin the background onstartup(alongsideauto_import.py), preferring the venv python so the SDK is available. Covers Claude Code, Cursor, and Codex, which all route SessionStart through this script./mem0:onboardStep 5 is no longer interactive: Removed theInstall coding categories? [Y/n]prompt. Categories now configure automatically in the background; the onboarding step only verifies status and applies them if the background run hasn't finished yet — mirroring how Step 4 (project-file import) already works.- Session-start "new project" hint now notes that coding categories install automatically in the background.
0.1.0 — Antigravity
Added
- Antigravity plugin (
.antigravity/): Restructured to follow the same shared-infrastructure pattern as Claude Code, Cursor, and Codex. Self-contained plugin directory withplugin.json,mcp_config.json,hooks/hooks.json(own file),scripts/(symlink →../scripts/), andskills/(symlink →../skills/). Installable viaagy plugin install .antigravityornpx degit mem0ai/mem0/mem0-plugin/.antigravity ~/.gemini/config/plugins/mem0. UsescontextFileName: "AGENTS.md"per Antigravity convention. - Codex hooks parity: Added missing
PreToolUseWrite/Edit/MultiEdit block andPreCompacthook to Codex hooks config, bringing it to full parity with Claude Code.
Changed
- Antigravity plugin directory: Renamed
.antigravity-plugin/→.antigravity/to match the naming convention of.claude-plugin/,.cursor-plugin/,.codex-plugin/. Plugin is now self-contained soagy plugin installandnpx degitboth work. - Antigravity hooks: Hooks now live directly in
.antigravity/hooks/hooks.jsonas a standalone file — no indirection. - Antigravity install command: Updated from
npx degit mem0ai/mem0/mem0-plugintonpx degit mem0ai/mem0/mem0-plugin/.antigravity. Addedagy plugin installas alternative for local clones.
Removed
- Stale root-level files: Deleted
mem0-plugin/hooks.json,mem0-plugin/mcp_config.json,mem0-plugin/plugin.json— leftover artifacts from before plugin restructuring into per-editor subdirectories. Nothing referenced them; install commands point to.antigravity/.
0.2.7
Fixed
- First-install auth failure (closes #4876): Removed
authorizationUrlfrom.mcp.json. When both a staticAuthorizationheader andauthorizationUrlwere present, Claude Code preferred the OAuth flow, which failed on reconnect — leaving new users stuck with onlyauthenticate/complete_authenticationstub tools. Authentication now uses theMEM0_API_KEYheader exclusively; no browser OAuth flow is triggered. - Onboarding skill removed OAuth step:
/mem0:onboardStep 2 no longer guides users through a browser-based OAuth login. The MCP server authenticates via the API key set in Step 1. - Removed
claude plugin configure mem0references: This CLI command does not exist. TheuserConfigmechanism works through the plugin enable UI prompt — Claude Code prompts for the API key when the plugin is first enabled and stores it securely in the system keychain. Updated session start banner, onboarding skill, identity script comments, and manual testing guide.
0.2.6
Fixed
- Memory count zero / stats and tour showing 0 memories: The
run_id: "*"wildcard filter — added in the initial v0.2.6 fix — returns 0 on both the v3 list endpoint (/v3/memories/) and search endpoint (/v3/memories/search/) when memories were written without arun_id(which is all memories since v0.2.6 stopped settingrun_idonadd_memory). Removedrun_id: "*"from:on_session_start.shcount queries,enforce_metadata_defaults.shhook injection (was injecting into everysearch_memoriesandget_memoriescall),_search.pysearch payload,/mem0:statsand/mem0:tourskill instructions. All read paths now use simpleuser_id+app_idfilters withoutrun_id, matching how v0.2.3 worked. add_memoryno longer setsrun_id: Session tracking moved from top-levelrun_id(which creates a separate API partition) tometadata.session_id. New memories land in the default partition and are visible to all queries.enforce_metadata_defaults.shno longer injectsrun_id: The hook was appending{"run_id": "*"}to everysearch_memoriesandget_memoriesfilter, which broke both endpoints. Removed entirely — identity injection (user_id/app_id) still works._search.pysimplified: Removedrun_id: "*"from search payload. Uses plainuser_id+app_idfilters.auto_import.pydelete endpoint 404: Stale chunk deletion usedDELETE /v3/memories/{id}/which returns 404 (v3 is ADD-only). Changed toDELETE /v1/memories/{id}/.- Banner count accurate:
on_session_start.shcount query usesuser_id+app_idfilters withoutrun_id. Shows total count only (removed noisy auto-import breakdown). quickstart.mdwrong add endpoint: cURL example usedPOST /v1/memories/(v1 add is removed). Fixed toPOST /v3/memories/add/.- Session stats always 0: PostToolUse hooks never fire for plugin MCP tools (confirmed via debug logs — only SessionStart, UserPromptSubmit, PreToolUse, and Stop fire). Moved session stats tracking (
session_stats.py add/search) intoenforce_metadata_defaults.sh(PreToolUse), which does fire on every MCP tool call. - Periodic nudge never firing: Message count file used session UUID in filename (
/tmp/mem0_msg_count_${SESSION_ID}) which was cleared on session start. Changed to$USER-keyed filename, matching the session stats file convention. /mem0:statssession query returning 0: Stats skill attempted API queries withrun_idandmetadata.session_idfilters that return empty results. Session stats now come exclusively from the local stats file (which is accurate now that PreToolUse tracks adds).- Auto-capture stops working mid-session: After the initial rubric injection (first message), subsequent messages got zero context from the UserPromptSubmit hook. The banner instruction to "proactively store learnings" fades as conversation grows and Claude forgets. Two-pronged fix: (1) Direct API auto-capture hook (
auto_capture.py): every 3rd message,on_user_prompt.shspawns a background Python script that reads the last 3 exchanges from the transcript JSONL and sends them directly toPOST /v3/memories/add/withinfer=True. No reliance on Claude callingadd_memory. (2) Proportional prompt nudge as fallback: starting from 3rd message, if Claude has stored fewer than 1 memory per 3 messages, a brief "store learnings via add_memory" directive is injected. - Desktop app: API key not found: Claude Code Desktop does not inherit shell environment variables — only
PATHis read from shell profiles. Users who setexport MEM0_API_KEY=m0-...in~/.zshrcor~/.bashrcgot "Setup Required" on Desktop while CLI worked fine. Added grep-based shell profile extraction as a 4th fallback in both_identity.sh(bash) and_identity.py(Python). Scans~/.zshrc,~/.bashrc,~/.zprofile,~/.bash_profile,~/.profileforMEM0_API_KEY=assignments. Skips variable references ($OTHER_VAR), commented-out lines, and strips quotes/inline comments. - Desktop app: zero memories added over multi-day usage: Agent never proactively called
add_memory— onlysearch_memoriesandget_all. Root cause: session banner instruction was passive ("before finishing a session, store learnings") and easily ignored. No mechanism existed to re-prompt the agent mid-session. Fixed with a periodic nudge inon_user_prompt.sh: every 5th substantial message, the hook checkssession_statsfor add count; if fewer than 2 memories stored, injects a directive into Claude's context viaadditionalContexttelling it to store learnings immediately. Counter resets on session start. - Setup Required banner missing Desktop instructions: Updated no-API-key banner with Desktop-specific setup paths:
claude plugin configure mem0, Desktop app environment editor (Settings > Environment), and CLIexportas fallback.
Removed
- Stop hook (all 3 editors): Removed from
hooks.json,cursor-hooks.json,codex-hooks.json. Deletedon_stop.sh,on_stop_cursor.sh,on_stop_codex.sh,stop_hook_check.py. The Stop hook could not reliably feed context back to Claude (command-type hooks'reasonfield is user-facing only, not injected into Claude's context). Auto-capture handled by PreCompact hook instead. - SessionEnd hook: Removed from
hooks.json. Deletedon_session_end.sh. Redundant with PreCompact auto-capture. - 5 redundant hook scripts:
on_git_commit_capture.sh(fired on every Bash command containing "git"),on_post_commit.sh(fired on every Bash command),on_task_completed.sh,on_post_compact.sh,on_subagent_stop.sh. These were already removed from Claude'shooks.jsonin v0.2.5 but script files remained on disk. Also removedon_post_commit.shreferences fromcursor-hooks.jsonandcodex-hooks.json. - Dead settings: Removed
output_style,skip_tools,capture_toolsfromload_settings.pydefaults. Theoutput-styles/directory andon_tool_failure.shscript were already deleted. test_on_file_read.py: Removed test file for deletedon_file_read.shhook.
Changed
/mem0:statslifetime query: Singleget_memoriescall withuser_id+app_idfilters (norun_id)./mem0:tourfull fetch: Singleget_memoriescall withuser_id+app_idfilters (norun_id).- API key resolution order (4 fallbacks):
MEM0_API_KEYenv var >CLAUDE_PLUGIN_OPTION_API_KEY(plugin configure) >CLAUDE_PLUGIN_OPTION_MEM0_API_KEY(legacy userConfig) > shell profile extraction. Applies to both_identity.shand_identity.py. - Session start banner: Proactive memory instruction changed from passive "before finishing a session" to active "proactively store learnings incrementally as work progresses. Do NOT wait until the session ends."
- Message counter on session start:
on_session_start.shnow resets/tmp/mem0_msg_count_*files to ensure nudge counter starts fresh each session.
0.2.5
Fixed
- PostToolUse field name:
tool_output→tool_response: All three PostToolUse scripts (on_bash_output.sh,on_post_commit.sh,on_post_tool_use.sh) were reading.tool_outputfrom stdin JSON — a field that never existed in the Claude Code hooks spec. The correct field is.tool_response(confirmed via official docs at code.claude.com/docs/en/hooks). This was silentlynullon every invocation, meaning bash error detection and post-commit checks never actually fired. - Stop hook invalid
hookSpecificOutput:on_stop.shreturnedhookSpecificOutputwithhookEventName: "Stop"— butStopis not a validhookEventNamediscriminant. Claude Code rejected the JSON with "Hook JSON output validation failed". Replaced with spec-compliant{ decision: "block", reason: "..." }. - SessionStart banner invisible: Switched from JSON
hookSpecificOutput.additionalContext(discrete/hidden system reminder) back to raw textcat <<BANNER(shown directly in transcript). Per official docs, raw stdout from SessionStart hooks is visible context;additionalContextis not. Write|Editmatcher missingMultiEdit:block_memory_write.shcould be bypassed viaMultiEdittool. Matcher nowWrite|Edit|MultiEdit.- PreToolUse MCP matcher coverage gap:
enforce_metadata_defaults.shnot triggered forget_memoryorupdate_memory. Added 4 tool name variants. capture_compact_summary.pynever called:on_session_start.shcompact branch never spawned it. Post-compaction summaries were not stored. Added background spawn.- Unguarded variables under
set -uinon_session_start.sh: Bare${MEM0_RESOLVED_USER_ID}etc. without:-fallbacks. Script died silently if_identity.shfailed to source. All references now use${VAR:-default}. enforce_metadata_defaults.shsilent failure on jq error: Finaljq -n --argjsonhad no error guard underset -euo pipefail. Added|| true.- Single-quote injection in
on_git_commit_capture.sh: Shell variables interpolated via'$VAR'insidepython3 -c. Filenames with'broke Python syntax. Replaced withos.environ.get(). - Identity injection on
add_memory(enforce_metadata_defaults.sh): Hook now sources_identity.shand injectsuser_idandapp_idas top-level params when the agent omits them. Prevents orphaned memories with null scoping that were invisible to filtered queries. Root cause of onboarding writes landing withuser_id=null, app_id=null. - Identity injection on
search_memoriesandget_memories: Hook now intercepts these tools and injectsuser_id/app_idintofilters.AND[]when missing. Handles three filter states: no filters (creates from scratch), flat filters (converts to AND format), existing AND array (appends missing clauses). Prevents MCP server from auto-injecting wrong identity. - Identity injection on
delete_all_memories: Hook injects top-leveluser_id/app_idto prevent accidental cross-scope deletion. /mem0:exportincorrectget_memoriescall: Was passinguser_id/app_idas top-level params; MCP tool only accepts them insidefilters. Changed tofilters={"AND": [{"user_id": "..."}, {"app_id": "..."}]}./mem0:statssameget_memoriesissue: Fixed both lifetime and session stat queries to usefiltersinstead of top-level identity params./mem0:pinpassesmetadatatoupdate_memory: MCPupdate_memorytool only acceptsmemory_id,text,source— nometadataparam. Pin/unpin now uses[PINNED]text prefix marker instead. Also added explicituser_id/app_idtoadd_memoryfor new pinned memories./mem0:health --deepambiguousget_memoriescall: Clarified identity goes infilters, not as top-level params./mem0:memory-reviewersame ambiguity: Explicitfilters={"AND": [...]}forget_memories./mem0:dreamstale artifact: Removed(item 15)from Step 4 heading./mem0:dreamcontradiction resolution no-op:update_memoryon loser with its own text did nothing. Changed todelete_memory(memory_id=<loser_id>)to actually remove the losing memory./mem0:healthCheck 3search_memoriestop-leveluser_id: Removed top-leveluser_idparam; identity only infilters.AND[]. Changedlimittotop_k./mem0:healthCheck 4add_memorymissinginfer=False: Health probe wasted LLM tokens on extraction. Addedinfer=False. Also fixed: was expectingmemory_idin response but v3 returnsevent_id. Now usesget_event_statusto get memory ID for cleanup./mem0:tourget_memoriestop-level identity: Both standard and cross-project modes passeduser_id/app_idas top-level params. Moved tofilters.AND[]./mem0:onboardsearch_memoriestop-leveluser_id: Removed extra top-leveluser_idparam from connectivity check./mem0:context-loaderincomplete filter table: Filter examples showed onlymetadata.typewithoutuser_id/app_id. Now shows fullANDfilter structure.- 7 skills used
limitinstead oftop_kforsearch_memories: MCP tool param istop_k, notlimit. Fixed in: health, onboard, tour (3 places), switch-project, stats (weekly mode + latency probe). /mem0:statslatency probe missingfilters:search_memoriescall had no identity filters. Addeduser_id/app_idinfilters.AND[].
Added
stop_hook_check.py: Pure-stdlib transcript analyzer for the Stop hook. Reads last 500 lines of transcript JSONL, parses tool calls, file modifications, and git commands. Returns{"should_block": bool, "context": "..."}. Trivial sessions (< 3 tool calls, no file edits) skip capture entirely.- Checklist for
/mem0:dream: 6-step progress tracker per Claude skill best practices for complex multi-step workflows. - Checklist for
/mem0:onboard: 7-step progress tracker for onboarding wizard. - Expanded hook matcher (all 3 configs):
enforce_metadata_defaults.shnow triggers onadd_memory,search_memories,get_memories,get_memory,update_memory, anddelete_all_memories(12 tool name variants covering both MCP naming conventions).
Changed
- Stop hook uses MCP-driven capture: When meaningful work detected and no memories stored, returns
decision: "block"asking Claude to calladd_memoryvia MCP. One-shot flag prevents infinite loops. REST API capture runs in background as fallback. - SessionStart banner uses raw text stdout: Replaced JSON
additionalContextwithcat <<BANNERfor reliable display per official hooks spec. enforce_metadata_defaults.shrewritten: Handler-based dispatch for 4 tool types.add_memorygets top-level identity + metadata defaults.search_memories/get_memoriesget filter identity injection.delete_all_memoriesgets top-level identity. Never overrides explicitly-passed identity.
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).