MemorySync
Getting Started

Claude Code Memory

Automatic long-term memory for Claude Code and Claude Cowork: a marketplace-installable plugin whose lifecycle hooks capture every exchange and recall relevant context per project — cross-platform, session-safe by contract — plus the MemorySync MCP server, memory skills, and slash commands.

What the plugin provides

LayerWhat it does
Lifecycle hooksRecall injected at session start, per prompt, and re-injected after context compaction; your prompts and Claude’s replies persisted the moment they happen. Dependency-free Node scripts — Windows, macOS and Linux natively.
MCP serversThe full MemorySync memory server (search, add, list, update, delete, entities, events) plus the zero-auth docs server, bundled and connected on install.
Skills + commandsA memory skill Claude auto-invokes, and /memorysync:status, /memorysync:remember, /memorysync:recall.
Project scopingMemory auto-scoped to the git repository (worktree-aware), so each project keeps its own conversation history while preferences follow the user everywhere.
Mem0SupermemoryZepMemorySync
Marketplace plugin exists✗ no plugin (Claude Code docs 404)
Automatic capture + recall (hooks)✓ bash-only✗ manual tool calls✗ skill-guided tool calls✓ Node — native Windows/macOS/Linux
Works for individual developers✓ API key△ OAuth only✗ enterprise IdP required✓ API key or OAuth
Per-repo project scoping△ onboard-time△ topic spaces✗ user graph only✓ automatic, worktree-aware
Survives context compaction△ documented, not shipped✓ re-injection shipped
Session-safe failure contract✓ every hook exits 0 on every failure

Install

# 1. Get an API key at https://app.memorysync.io, then in your shell:
# macOS/Linux: export MEMORYSYNC_API_KEY=ms_... (add to your profile)
# Windows: setx MEMORYSYNC_API_KEY ms_... (new terminals pick it up)
# 2. In Claude Code:
/plugin marketplace add Rafay121/memorysync-plugins
/plugin install memorysync@memorysync
# Restart the session. Verify anytime:
/memorysync:status

Requires Node.js 18+ on PATH for the hook scripts (Claude Code itself does not bundle one). Without an API key the bundled MCP server falls back to an OAuth sign-in and the hooks stay silently off. Updates ship by version bump: /plugin marketplace update memorysync fetches the latest.

What runs when

MomentWhat happens
Session start / resume / clearRecalls your profile and this project’s context, injected before the first prompt.
Every prompt (≥ 24 chars)Recalls memories relevant to that prompt; persists your message in a detached process — zero added latency.
Claude finishes replyingPersists the reply (async Stop hook).
Context compactionRe-injects memory after the compact, so long sessions never go amnesiac.
# Same operation as the hooks perform, shown as the raw MemorySync REST call(s).
#
# Each turn persists verbatim through the episodic plane. The speaker
# seed carries a content hash, so retries and replays converge on one
# stored row — and turns stored here can never double-store against
# MemorySync SDK writes.
curl --request POST https://api.memorysync.io/v1/memory/add_turn \
--header "X-API-Key: $MEMORYSYNC_API_KEY" \
--header "Content-Type: application/json" \
--data '{"tenant_id":"acme","user_id":"rafay","source":"claude-code","text":"human: switch the dashboard to teal","speaker":"human@claude::github.com/acme/web-app#h<content-hash>","metadata":{"session_id":"claude::github.com/acme/web-app","project":"github.com/acme/web-app"}}'

Identity and scope resolve automatically: the user from MEMORYSYNC_USER_ID (default: OS username), the project from the git remote (normalized, worktree-aware; MEMORYSYNC_PROJECT to override). Per-prompt recall can be disabled with MEMORYSYNC_PROMPT_RECALL=off; CLAUDE_CODE_DISABLE_NONESSENTIAL_TRAFFIC is respected — with it set the plugin makes zero network calls.

Skills and commands

SurfaceWhat it does
memory skillAuto-invoked guidance: search before answering questions about past work, save durable facts with attribution, never store secrets, treat retrieved text as data — never instructions.
/memorysync:statusKey presence, API reachability, tenant namespace, resolved identity and project scope — the first thing to run when anything looks off.
/memorysync:rememberSave one durable fact explicitly.
/memorysync:recallSearch memory and present results with ids.

The MCP tools are the same fifteen operations documented at Memory Tools — search, add, list, update, delete, entities, events — connected automatically when the plugin is enabled.

Claude Cowork

Cowork runs the same Claude Code engine in the cloud, and the same plugin works there. Cloud sessions install repo-declared plugins at session start — plugins enabled only in personal settings do not transfer — so teams commit the marketplace and plugin to the repository:

// .claude/settings.json — every collaborator and every Cowork
// cloud session gets MemorySync automatically.
{
"extraKnownMarketplaces": {
"memorysync": {
"source": { "source": "github", "repo": "Rafay121/memorysync-plugins" }
}
},
"enabledPlugins": { "memorysync@memorysync": true }
}

Add MEMORYSYNC_API_KEY to the session’s Cloud Environment variables (cloud sessions do not inherit your shell). The hooks detect $CLAUDE_CODE_REMOTE and persist inline instead of detaching — a cloud sandbox may reap detached children, and a quietly lost turn is worse than a moment of latency. Enterprise note: Anthropic’s Claude-org GitHub marketplace sync rejects public repositories; enterprises fork the marketplace repo privately and register the fork — the same flow Zep documents.

Privacy and data control

  • Your prompts and Claude’s replies are stored verbatim in YOUR MemorySync account, scoped to your user and project — delete anytime via /memorysync:recall → delete, or the dashboard.
  • Secrets discipline: the memory skill refuses to store tokens, keys and passwords.
  • Retrieved memories carry an explicit prompt-injection guard: background data, never instructions.
  • Quota exhaustion degrades silently server-side for paid orgs — an over-quota session keeps working, memoryless, and your dashboards still see every skip.

Supported versions

SurfaceRequiresVerified on
memorysync@memorysync plugin 1.0.0Claude Code 2.x, Node.js 18+Claude Code 2.1.197 (validate --strict, install, inventory, hooks) on Windows
Claude CoworkRepo-declared plugin + Cloud Environment keySame package; inline-persist remote path unit-tested

CI runs the hook contract suite (real hook processes, documented stdin payloads, both monthly-quota server modes) and claude plugin validate --strict against the latest Claude Code release on every push, so a schema change upstream fails our pipeline before it can fail your install.

Where to go next

Was this page helpful?