跳到主要内容

mem0-status 精选

Diagnoses mem0 connectivity, API key validity, and memory read/write functionality. Use when memory operations fail, searches return empty, add_memory errors occur, or to verify the plugin is working correctly.

在 GitHub 打开

安装方式

cp -r integrations/opencode-plugin/opencode-skills/mem0-status ~/.claude/skills/mem0-status

把该 skill 目录放进客户端 skills 目录。不同客户端的目录可能不同,Claude Code 默认是 ~/.claude/skills/

整仓一次性获取:git clone --depth 1 https://github.com/mem0ai/mem0.git

依赖与权限

  • 需要 API Key —— 使用前需配置相应的密钥环境变量
  • 无需联网
  • 依赖外部命令:git
  • 以上为按正文与 frontmatter 自动推断的信号,仅供参考;安装前建议先阅读原文。
触发场景
memory operations failsearches return emptyadd_memory errors occurto verify the p

SKILL.md 正文

来源 mem0ai/mem0@b7ad69a · 许可 Apache-2.0 · 内容未修改

Mem0 Status

Run a diagnostic check on the mem0 plugin. Useful for troubleshooting.

Execution

Run ALL checks, then display a single summary. Do not stop on the first failure.

Check 1: API key

_KEY="${MEM0_API_KEY:-}"
[ -n "$_KEY" ] && echo "${_KEY:0:6}..." || echo "NOT_SET"
  • If NOT_SET: FAIL — "No API key configured"
  • If set: PASS — the command already prints only the first 6 chars

Check 2: Identity resolution

Resolve identity from the MEM0_* environment variables set by the plugin's shell.env hook. These are the exact values the plugin uses to scope memories, so report them directly. Do NOT re-run git here: the plugin already resolved branch and project from git at session start, and re-shelling git can disagree with it — e.g. it prints an empty branch that renders as (not a git repo) while the Session check below shows branch=main. One source of truth keeps the two lines consistent.

echo "user_id=${MEM0_USER_ID:-${USER:-default}}"
echo "project_id=${MEM0_APP_ID:-}"
echo "branch=${MEM0_BRANCH:-main}"
_S="$HOME/.mem0/settings.json"
_SCOPE="$(grep -o '"default_scope"[[:space:]]*:[[:space:]]*"[a-z]*"' "$_S" 2>/dev/null | grep -o '[a-z]*"$' | tr -d '"')"
echo "default_scope=${_SCOPE:-project}"
  • user_id: from MEM0_USER_ID, falling back to $USER
  • project_id: from MEM0_APP_ID
  • branch: from MEM0_BRANCH (the plugin's resolved value; falls back to main outside a git repo)
  • default_scope: from ~/.mem0/settings.json (default_scope), falling back to project. This is the scope memory tools use when none is given; change it with /mem0-scope.

PASS if user_id and project_id are non-empty. WARN if project_id is empty — the shell.env hook may not have fired (restart OpenCode). Report the branch verbatim from MEM0_BRANCH; never invent a string like (not a git repo).

Check 3: Memory tool connectivity

Call search_memories with:

  • query="health check"
  • filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}]}
  • top_k=1
  • If returns successfully (even empty): PASS
  • If errors: FAIL — show the error message

Check 4: Memory write capability

Call add_memory with:

  • text="Health check probe — safe to delete."
  • user_id=<active_user_id>
  • app_id=<active_project_id>
  • metadata={"type": "health_check", "probe": true}
  • infer=False

The response returns event_id (v3 writes are async). Call get_event_status(event_id=<event_id>) to check processing.

  • If status is SUCCEEDED: PASS — extract the memory ID from the event result, then call delete_memory with that ID to clean up.
  • If status is PENDING after 5 seconds: PASS (write accepted, processing delayed)
  • If errors: FAIL — show the error.

Check 5: Session context

Check that the plugin's shell.env hook has injected session context into the environment:

echo "session_id=${MEM0_SESSION_ID:-}"
echo "app_id=${MEM0_APP_ID:-}"
echo "branch=${MEM0_BRANCH:-}"
  • If all three are non-empty: PASS — "Session active"
  • If any are missing: WARN — "Plugin env vars not set; shell.env hook may not have fired"

Display

## mem0 status

PASS  API Key         m0-dVe...
PASS  Identity        user=kartik, project=mem0, branch=main
PASS  Default scope   project
PASS  Memory Tools    142ms
PASS  Write/Read      write + delete OK
PASS  Session         session_id=abc123, app_id=mem0, branch=main

All checks passed.

If any check fails, add a ## Troubleshooting section with specific fix steps for each failure.

Extended mode: Memory Quality Analysis

When invoked with --deep (e.g., /mem0-status --deep), run the standard 5 checks above plus a memory quality scan.

Quality Check 1: Duplicates

Call get_memories with filters={"AND": [{"user_id": "<active_user_id>"}, {"app_id": "<active_project_id>"}]}, page_size=200. Compare all pairs within the same metadata.type group for high textual overlap (shared nouns/keywords > 60%). Report:

Potential duplicates: <N> pairs
  [mem0:<id1>] ≈ [mem0:<id2>] — both about "<shared topic>"

Quality Check 2: Stale memories

Flag memories where:

  • metadata.type is session_state or compact_summary AND older than 90 days
  • metadata.confidence < 0.3 AND older than 30 days
Stale candidates: <N>
  [mem0:<id>] — session_state, 142d old

Quality Check 2b: Low-confidence memories

Flag memories where metadata.confidence < 0.5 (regardless of age). Report separately from stale:

Low-confidence memories: <N>
  [mem0:<id>] — confidence=0.3, "<content preview>"

Quality Check 3: Contradictions

Within each metadata.type group, flag pairs that assert opposing facts about the same topic. Use semantic judgment — look for negation patterns, conflicting tool/framework choices, or reversed decisions.

Possible contradictions: <N>
  [mem0:<idA>] vs [mem0:<idB>] — conflicting on "<topic>"

Quality Check 4: Orphan memories

Memories with no metadata.type set, or with metadata.type not in the 17 known coding categories. These were likely written without proper tagging.

Untagged/orphan memories: <N>

Quality summary

## Memory Quality

Duplicates: <N> · Stale: <N> · Contradictions: <N> · Orphans: <N>

If all counts are 0: Memory quality: clean.

If any non-zero, list the affected memory IDs so the user can review them with the normal search, update, and delete tools.

Output formatting

IMPORTANT: Do NOT use markdown in your output. OpenCode TUI renders text verbatim — markdown like bold, ## headers, and | table | syntax appears as raw characters. Use plain text with indentation for structure. Use dashes for lists. Use spaces to align columns instead of markdown tables.

质量与来源

所属仓库
mem0ai/mem0
仓库星标
6.7 万
最近更新
3 天前
采集时间
今天
commit
b7ad69afda6b
内容指纹
sha256:5dd571d3662e088
文件路径
integrations/opencode-plugin/opencode-skills/mem0-status/SKILL.md

相似 Skill

更多「编码」
access
Manage Discord channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Discord channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Discord channel — save the bot token and review access policy. Use when the user pastes a Discord bot token, asks to configure Discord, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage iMessage channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the iMessage channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Check iMessage channel setup and review access policy. Use when the user asks to configure iMessage, asks "how do I set this up" or "who can reach me," or wants to know why texts aren't reaching the assistant.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
access
Manage Telegram channel access — approve pairings, edit allowlists, set DM/group policy. Use when the user asks to pair, approve someone, check who's allowed, or change policy for the Telegram channel.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端
configure
Set up the Telegram channel — save the bot token and review access policy. Use when the user pastes a Telegram bot token, asks to configure Telegram, asks "how do I set this up" or "who can reach me," or wants to check channel status.
精选 anthropics/claude-plugins-official 3.8 万 原文
Claude CodeMCP 客户端