Sandbox
@NeoLi00/memX

Memory plugin for Claude Code, Codex, and MCP clients

memX stores past turns as searchable memory, keeps it updated, and feeds back only the evidence an agent needs for the next query. The repo wires that flow into native Claude Code and Codex plugins, OpenClaw support, MCP integration, and lifecycle hooks for capture and recall.

407 stars2 forksTypeScriptUpdated 3mo ago
Who it's for

Builders who want their coding agent to carry project memory across sessions without re-explaining the same context.

What it delivers

You can resume work with remembered decisions, preferences, and evidence instead of rebuilding context from scratch.

What it does

Structured long-term memory

Turns completed work into searchable memory for decisions, preferences, task state, relationships, and source evidence.

Evidence-based recall

Injects only the small evidence lines needed for the current query instead of dumping the whole memory store.

Native Claude Code and Codex support

Uses native hooks and hidden MCP tools by default for Claude Code and Codex installs.

OpenClaw and MCP support

Works with OpenClaw natively and can expose the same memory layer to any MCP-compatible client.

Self-maintaining memory

Promotes stable evidence, supersedes corrections, and lets stale task state stop competing with current state.

Managed local service

Installs, starts, restarts, and stops the local memX service with the CLI commands in the README.

How to get it

  1. 1This installs the shared memX config, a local Claude Code plugin marketplace, native…
    npx -y -p github:NeoLi00/memX memx quickstart claude-code \
      --llm-provider openai-compatible \
      --llm-base-url https://llm.example.com/v1 \
      --llm-model fast-memory-model \
      --llm-api-key sk-your-provider-key
  2. 2This installs the shared memX config, a local Codex plugin marketplace, native lifecycle…
    npx -y -p github:NeoLi00/memX memx quickstart codex \
      --llm-provider openai-compatible \
      --llm-base-url https://llm.example.com/v1 \
      --llm-model fast-memory-model \
      --llm-api-key sk-your-provider-key
  3. 3Run
    npx -y -p github:NeoLi00/memX memx quickstart openclaw \
      --llm-provider openai-compatible \
      --llm-base-url https://llm.example.com/v1 \
      --llm-model fast-memory-model \
      --llm-api-key sk-your-provider-key
  4. 4Use this path for MCP clients that do not have a native memX lifecycle adapter.…
    npx -y -p github:NeoLi00/memX memx quickstart mcp \
      --llm-provider openai-compatible \
      --llm-base-url https://llm.example.com/v1 \
      --llm-model fast-memory-model \
      --llm-api-key sk-your-provider-key
  5. 5Run
    npx -y -p github:NeoLi00/memX memx service status
    npx -y -p github:NeoLi00/memX memx service restart
    npx -y -p github:NeoLi00/memX memx service stop

README

memX - self-learning, self-maintaining memory for AI agents

English · 中文 · Architecture


memX turns completed work into structured, searchable, self-maintained memory, then injects only the evidence an agent needs for the current query. It connects natively to Codex, Claude Code, and OpenClaw, and reaches any MCP-compatible client through the same local memory layer.

Benchmarks

SuiteScopeR@3 success rate
LongMemEval-SLong-context memory retrieval94.2%
Real engineering cases30 cases, each with 20+ turns100%

Architecture

memX coarse architecture

Agent support

Codex logoCodexnative hooks, MCP hidden by default
Claude Code logoClaude Codenative hooks, MCP hidden by default
OpenClaw logoOpenClawnative + hooks
MCPMCP clientsany MCP-compatible client

Quick start

Requirements: Node.js 22.14+ or Node 24. OpenClaw installs require OpenClaw 2026.3.25+. Python 3 is needed only for the default local embedding runtime.

The README commands use the GitHub package spec. A fresh run pulls current GitHub code, so installs do not wait for an npm publish. To use the npm release channel later, replace github:NeoLi00/memX with @neoli00/memx.

Fill in these values before running a command:

  • --llm-provider: the provider adapter memX should call. Choose one of openai-compatible, anthropic, google, or ollama.
  • --llm-base-url: the base URL for that provider. Examples: https://api.openai.com/v1, https://api.anthropic.com/v1, https://generativelanguage.googleapis.com/v1beta, or http://127.0.0.1:11434 for Ollama.
  • --llm-model: the model memX uses for memory compilation, recall planning, and maintenance. Pick a fast, low-cost model with reliable JSON output.
  • --llm-api-key: the API key for the provider. Use --llm-api-key-env PROVIDER_API_KEY if you want the config to reference an environment variable instead of storing plaintext. For local Ollama, omit the key.

The default embedding setup is local sentence-transformers-local with intfloat/multilingual-e5-small. Add --embedding-provider and --embedding-model only when you want to override that default. Use --dry-run to preview the files and exec-form commands before writing anything.

For Codex and Claude Code, native hooks are the default lifecycle path for automatic recall and turn capture. Quickstart installs the native plugin, writes the shared memX config, starts or refreshes the managed local memX service, and keeps MCP memory tools hidden with --mcp-tools none by default. This prevents duplicate recall/write and prevents the agent from reading audit data as a side channel. Use --mcp-tools full only when you intentionally want the agent to see the complete MCP tool set. Generic MCP quickstart stays full by default because it has no native lifecycle hooks. Default native memories are also host-scoped, so Codex and Claude Code do not share the same local database unless you deliberately override the database path and actor settings.

If http://127.0.0.1:3878 is already used by an unmanaged memX-compatible service, quickstart stops instead of silently reusing it. Stop the old service or pass a free local URL, for example --memx-url http://127.0.0.1:3888.

Claude Code

This installs the shared memX config, a local Claude Code plugin marketplace, native lifecycle hooks, and the managed local memX service in one run.

npx -y -p github:NeoLi00/memX memx quickstart claude-code \
  --llm-provider openai-compatible \
  --llm-base-url https://llm.example.com/v1 \
  --llm-model fast-memory-model \
  --llm-api-key sk-your-provider-key

Codex

This installs the shared memX config, a local Codex plugin marketplace, native lifecycle hooks, and the managed local memX service in one run.

npx -y -p github:NeoLi00/memX memx quickstart codex \
  --llm-provider openai-compatible \
  --llm-base-url https://llm.example.com/v1 \
  --llm-model fast-memory-model \
  --llm-api-key sk-your-provider-key

OpenClaw

npx -y -p github:NeoLi00/memX memx quickstart openclaw \
  --llm-provider openai-compatible \
  --llm-base-url https://llm.example.com/v1 \
  --llm-model fast-memory-model \
  --llm-api-key sk-your-provider-key

Generic MCP

Use this path for MCP clients that do not have a native memX lifecycle adapter. Quickstart writes the shared memX config, starts the managed local memX service, and prints a ready-to-copy MCP server config.

npx -y -p github:NeoLi00/memX memx quickstart mcp \
  --llm-provider openai-compatible \
  --llm-base-url https://llm.example.com/v1 \
  --llm-model fast-memory-model \
  --llm-api-key sk-your-provider-key

Service management

npx -y -p github:NeoLi00/memX memx service status
npx -y -p github:NeoLi00/memX memx service restart
npx -y -p github:NeoLi00/memX memx service stop

Use the same --home, --memx-url, and --memx-secret values that you used during quickstart when you manage a non-default install.

Clean uninstall

Each uninstall command backs up the target config first, then removes only memX-owned entries. Claude Code and Codex cleanup also stop the managed local service, uninstall the native plugin, remove the local marketplace, and delete the generated marketplace snapshot. OpenClaw cleanup also removes stale memx / memory-memx slot, allow, and entry references, then best-effort uninstalls both current and legacy plugin files if OpenClaw can still see them.

npx -y -p github:NeoLi00/memX memx uninstall openclaw
npx -y -p github:NeoLi00/memX memx uninstall codex
npx -y -p github:NeoLi00/memX memx uninstall claude-code

Add --dry-run to preview, or --config /path/to/config when using a non-default config path.

What memX can do

  • Remember work over time: project decisions, user preferences, task status, long source segments, and raw evidence stay linked to the original turn.
  • Connect related things: projects, repos, tools, files, resources, blockers, and outcomes can be represented as entities and graph edges.
  • Learn collaboration patterns: repeated evidence can become reusable guidance without losing its supporting sources.
  • Maintain itself: corrections can supersede older facts, stable evidence can be promoted, and stale task state stops competing with current state.
  • Recall compact evidence: facts, events, state, chunks, relationships, resources, and learned patterns are searched together, then injected as small evidence lines.

Files in the repo

Repository payload23 top-level entries
  • .agents
  • .claude-plugin
  • .codex-plugin
  • assets
  • dist
  • hooks
  • scripts
  • skills
  • src
  • tests
  • types
  • .gitignore
  • .mcp.json
  • ARCHITECTURE-ch.md
  • ARCHITECTURE.md
  • hooks.json
  • index.ts
  • LICENSE
  • openclaw.plugin.json
  • package.json
  • README-ch.md
  • README.md
  • tsconfig.json

Discussion (0)

Ask about usage, or say what you built with it

Sign in to join the discussion.

No comments yet. Be the first to say what this is good for.

More plugins

Makes your AI agent think like the laziest senior dev in the room. The best code is the code you never wrote.

138k
1 add

Graphs that teach > graphs that impress. Turn any code into an interactive knowledge graph you can explore, search, and ask questions about. Works with Claude Code, Codex, Cursor, Copilot, Gemini CLI, and more.

82k
code-yeongyu/
oh-my-openagent

OmO: Just type "mass ulw" keyword with your prompt. Now you are the master of graph engineering.

69k

Persistent Context Across Sessions for Every Agent – Captures everything your agent does during sessions, compresses it with AI, and injects relevant context back into future sessions. Works with Claude Code, OpenClaw, Codex, Gemini, Hermes, Copilot, OpenCode + More

94k

Opinionated Oxlint rules for rejecting low-evidence TypeScript and JavaScript patterns

4.3k