Agent skill · mem0ai

mem0-scope

Views or changes the default memory scope (project, session, or global) used when saving and searching memories. Use when the user wants to control whether memories are scoped to this repo, this run, or shared across all their projects.

What it needs

About 3k tokens when loaded.

What this skill does

Mem0 Scope View or change the default memory scope — the scope the memory tools use when no explicit scope is given. The setting persists in ~/.mem0/settings.json (defaultscope) and the plugin reads it fresh on each memory operation, so a change takes effect immediately in the current session. The three scopes: project (default) — this repo only. Filters by userid + appid. session — this run only. Adds runid (the current session) so memories are isolated to this conversation. global — across ALL your projects. Reads use appid=""; writes drop appid so the memory is user-wide. Execution Step 1: Determine intent Look at the user's message for a target scope word: project, session, or global (also accept "repo"→project, "run"→session, "all"/"everywhere"→global). No target word present → View mode (Step 2). A target word present → Change mode (Step 3). Step 2: View mode — show the current scope 1. Read the current default scope from settings: If the command prints nothing, the scope is project (the default). 2. (Optional) Show how many memories live in the current scope by calling getmemories with scope="<current>", pagesize=1, and reading the count (or result length) from the response. 3. Display using the identity the plugin exported (do NOT re-shell git): Put [active] next to the current scope. If you fetched a count in step 2, add a Memories in scope: <N> line. Step 3: Change mode — set a new scope 1. Validate the target is one of project, session, global. If not, show the three options and stop. 2. Read the existing settings so you preserve every other key. Use the Read tool on ~/.mem0/settings.json (it may not exist yet — treat a missing file as {}). 3. Write the file back with the Write tool, keeping ALL existing keys and only setting "defaultscope" to the target. Pretty-print with 2-space indent and a trailing newline. Do not drop globalsearch, autosave, or any other field that was present. Example resulting file (when other keys already existed): 4. …

How to use it

Reference it in AdaL, Claude Code, Cursor or any coding agent — nothing to install:

@skills mem0ai/mem0-scope--2d428e

View the source on GitHub

Browse the @skills marketplace