mem0-context-loader

A context-loading tool that searches relevant project memories and adds them to the agent's working context before a task.

In plain words
What is it for?
Use it when starting work, changing context, or beginning a task involving a specific feature, file, module, or error.
Why use it?
It helps the agent use past decisions, coding conventions, and known problems without requiring the user to repeat them.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/mem0ai/mem0/mem0-context-loader
Any agent
npx skills add mem0ai/mem0 --skill mem0-context-loader
Clone the repo
git clone --depth 1 https://github.com/mem0ai/mem0

Made for: Claude Code, Codex.

Per session 47 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 581 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00047 $0.00581
Opus 5 $0.00023 $0.00291
Sonnet 5 $0.00009 $0.00116
Haiku 4.5 $0.00005 $0.00058

Measured yesterday against content hash 6a9b93f29d1f, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

mem0-context-loader scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

integrations/mem0-plugin/.opencode-plugin/opencode-skills/mem0-context-loader/SKILL.md · 53 lines

How it starts

The opening of the file, as written. The whole thing — 53 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Context Loader

Pre-fetches relevant memories to prime context before working on a task.

When to use

  • Session start (invoke manually or auto-triggered by skill description matching)
  • User starts work on a specific feature or file set
  • Complex multi-step task begins
  • User says "what do we know about X" or "context for X"

Steps

  1. Extract topics from current message/task. Identify: file paths, module names, feature areas, error patterns.

  2. Run 2-4 parallel search_memories calls with different angles:

    Query angle Filter Purpose
    Feature/module name {"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}, {"metadata": {"type": "decision"}}]} Architecture decisions
    File paths mentioned {"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}, {"metadata": {"type": "convention"}}]} Coding patterns
    Error keywords (if any) {"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}, {"metadata": {"type": "anti_pattern"}}]} Known pitfalls
    Broad project context {"AND": [{"user_id": "<id>"}, {"app_id": "<pid>"}]} Catch-all
  3. Deduplicate results by memory ID across all search responses.

  4. Output compact context block (max 10 memories):

context-loader: loaded <N> memories for "<task summary>"
  - [decision] <content> [mem0:<short_id>]
  - [convention] <content> [mem0:<short_id>]
  - [anti_pattern] <content> [mem0:<short_id>]
  1. If zero results: output nothing. Don't announce empty context.

Constraints

  • Read-only — never modify or delete memories
  • Max 10 memories returned (most relevant only)
  • Silent on empty — only surfaces findings if relevant context exists
  • Skip memories already visible in current session context

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.

Read the full file on GitHub · 53 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 53 lines · 47 tokens per session scan A 6a9b93f29d1f

Subscribe to this mod's changes

mem0-context-loader is a skill published in the GitHub repository mem0ai/mem0 (64,360 stars, last pushed 3d ago), licensed Apache-2.0. It adds 47 tokens to every session and 581 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.

Related

Other skills, from other repositories

mcp-apps-builder

MANDATORY for ALL MCP server work - mcp-use framework best practices and patterns. READ THIS FIRST before any MCP server work, including: Creating new MCP servers Modifying existing MCP servers (adding/updating tools, resources, prompts, widgets) Debugging MCP server issues or errors Reviewing MCP server code for…

Shubhamsaboo/awesome-llm-apps · 139 tokens

project-graveyard

Scans the developer's machine for dead side projects, autopsies each one from its git history (died at the payments wall, killed by a newer project, finished but never shipped), surfaces their personal death patterns, and picks the corpse most worth resurrecting — then helps ship it. Use when the user mentions…

Shubhamsaboo/awesome-llm-apps · 127 tokens

commit-archaeologist

Reconstructs why code exists from local git history, including the introducing commit, later changes, current authors, repeated companion files, and likely intent. Use when the user asks "why does this code exist", "who wrote this function and why", or to "explain the history of this function" before a rewrite…

Shubhamsaboo/awesome-llm-apps · 82 tokens

dependency-doctor

Checks requirements.txt, pyproject.toml, and package.json dependency manifests for surface-level direct-dependency footguns: standard-library shadowing pins, abandoned backports, unpinned dependencies, and obvious intra-manifest conflicts, plus opt-in PyPI yanked releases. Use when the user asks to check a manifest…

Shubhamsaboo/awesome-llm-apps · 115 tokens

scope-creep-detector

Analyzes git diffs against a stated intent to detect scope creep, unrelated files, broad pull requests, changes that grew beyond a fix, dependency additions, public API renames, config or CI edits, oversized hunks, and formatting-only files. Use when the user asks whether a change grew beyond the fix, a PR is too…

Shubhamsaboo/awesome-llm-apps · 98 tokens

chatgpt-app-builder

DEPRECATED: This skill has been replaced by mcp-app-builder. Check if mcp-app-builder is available in the skills folder. If not, install it: npx skills install mcp-use/mcp-use --skill mcp-app-builder Use mcp-app-builder instead of this skill. Build ChatGPT apps with interactive widgets using mcp-use and OpenAI Apps…

Shubhamsaboo/awesome-llm-apps · 129 tokens