Memory expiration + recency
Hook-side captures (session_state in on_pre_compact.py and
compact_summary in capture_compact_summary.py) now set
expiration_date = today + 90 days. These types describe a single
moment of project state and become stale clutter after a quarter.
Durable types written by the agent (decision, anti_pattern,
convention, user_preference, task_learning, environmental) stay
unexpired by design -- a decision from a year ago is still a
decision.
Skill updated with two new sections:
- "Expiration: high-churn vs durable" -- table mapping each
metadata.type to whether it should carry an expiration_date.
- "Recency filter on recall" -- agent should layer a
created_at >= <90 days ago> filter on recall when the user
asks about *current* state, and skip it when looking for
durable facts.
Plugin-update / MCP reconnect
When the plugin updates, the MCP server connection in the running
client goes stale -- there's no in-process reconnection path from
inside the plugin. Documenting the workaround is the realistic
fix: README now has an "Updating the plugin" section explaining
/restart (Claude Code), quit-and-relaunch (Cursor), restart
(Codex). The auth header re-reads MEM0_API_KEY from the new
shell, so users don't have to re-enter the key.
mem0 auto-tags every memory with one or more `categories` from a
project-level list. The default list is consumer-oriented (food,
hobbies, music, ...), which produces meaningless tags for code
workflows.
Per-request `custom_categories` is not supported on the managed API,
so the fix has to be a one-time project-level configuration. New
script `setup_coding_categories.py` does this:
- Dry-run by default: prints current vs proposed taxonomy, exits.
- `--apply` flag actually calls `project.update(custom_categories=...)`.
- Falls back gracefully when mem0ai SDK isn't installed or
MEM0_API_KEY is missing/invalid (friendly error, no stack trace).
Recommended taxonomy:
architecture_decisions, anti_patterns, task_learnings,
tooling_setup, bug_fixes, coding_conventions, user_preferences
Skill clarification: `metadata.type` (agent-applied explicit tag,
used in filters) and `categories` (platform-applied auto-tag, used
in dashboards) are complementary; agent should keep using
`metadata.type` and not try to set `categories` per-request.
README: section under Step 2 explaining how to run the script.
Two changes to the compaction flow:
PreCompact: agent stores its summary with infer=False
on_pre_compact.sh now instructs the agent to call add_memory with
infer=False. The agent has full conversation context and writes a
structured summary; without infer=False the platform runs a second
LLM extraction pass over that summary, losing structure and
producing fragmented facts. With it, the structured text is
preserved verbatim. Same guidance added to mem0-mcp/SKILL.md so
the agent applies it to other already-extracted writes (decisions,
anti-patterns, conventions).
SessionStart-compact: capture the platform-generated summary
PreCompact fires BEFORE Claude Code generates its compact summary,
so the summary is unreachable from that hook. SessionStart-compact
fires AFTER, so a new background helper (capture_compact_summary.py)
reads the transcript at that point, finds the isCompactSummary=true
entry, and stores its content as a separate memory tagged
metadata.type=compact_summary. The post-compaction bootstrap text
now tells the agent to layer its recall queries across
session_state (its own pre-compact summary), compact_summary (the
platform's condensed view), and topical types like decision /
anti_pattern.
Net effect: three complementary memory types from one session
boundary, none of which used to be filterable or even captured
correctly.