Skip to main content
The AtomicMemory Claude Code plugin turns ephemeral Claude Code sessions into a continuously learning workspace. It ships three components that work together: an MCP server that exposes memory_search, memory_ingest, memory_package, and memory_list as first-class tools; a set of lifecycle hook scripts that automatically capture decisions, compaction summaries, and task completions without any manual prompting; and a skill file (SKILL.md) that teaches Claude exactly when and how to call the memory tools. All captured records survive session boundaries and are immediately searchable in future sessions.

Prerequisites

The lifecycle hook scripts are written in Bash and depend on jq for safe JSON parsing and curl for prompt-time memory retrieval. Install both before running the plugin installer.
brew install jq

Configuration

The MCP server and all hook scripts read their settings from shell environment variables. No variables are required when running against a local AtomicMemory core — the plugin ships with sensible defaults for local development.
Set environment variables only when you need to override a default, for example to connect to a hosted or team AtomicMemory service.

Local-mode defaults

VariableDefault
ATOMICMEMORY_API_URLhttp://127.0.0.1:17350
ATOMICMEMORY_API_KEYlocal-dev-key
ATOMICMEMORY_PROVIDERatomicmemory
ATOMICMEMORY_SCOPE_USERDerived from OS user
ATOMICMEMORY_CAPTURE_LEVELbalanced

Overriding for a hosted service

# Optional — override defaults to connect to a hosted AtomicMemory service:
export ATOMICMEMORY_API_URL="https://memory.yourco.com"
export ATOMICMEMORY_API_KEY="am_live_…"
export ATOMICMEMORY_SCOPE_USER="$USER"
export ATOMICMEMORY_CAPTURE_LEVEL="balanced"  # minimal|balanced|full
Set ATOMICMEMORY_SCOPE_USER explicitly when multiple operators share a machine or when you need a stable cross-machine identity. If you omit it, the MCP server derives a value from the host OS user automatically.

Optional scope variables

You can further narrow where memories are stored and retrieved by setting any of these optional variables:
VariablePurpose
ATOMICMEMORY_SCOPE_NAMESPACEPer-project isolation boundary (e.g. a repo name)
ATOMICMEMORY_SCOPE_AGENTIdentifies the agent role within a scope
ATOMICMEMORY_SCOPE_THREADIsolates a specific conversation thread

Local extraction with Claude Code auth

For personal or local use, AtomicMemory core can use Claude Code’s own local authentication for semantic extraction instead of a separate Anthropic API key:
claude auth login
export LLM_PROVIDER="claude-code"
# Optional: override the model Claude Code uses for extraction
# export LLM_MODEL="sonnet"
LLM_PROVIDER=claude-code is for personal local setups only. Do not use it for hosted or team deployments where a server would run under one operator’s Claude Code subscription. Embeddings still use core’s configured embedding provider.

Install

1

Register the local marketplace

From the root of the cloned AtomicMemory repository, register the repo as a local plugin marketplace. You only need to do this once.
claude plugin marketplace add ./
2

Install the plugin

Install the AtomicMemory plugin into Claude Code:
claude plugin install claude-code@atomicmemory
The plugin fetches @atomicmemory/mcp-server from npm via npx on first use — no local build is required.
3

Restart Claude Code

Fully restart Claude Code after installation. Existing sessions can retain old hook registrations in memory even after the on-disk cache is updated.
4

Verify the installation

Confirm the plugin is active by checking three things:
  • claude plugin list shows claude-code@atomicmemory as enabled.
  • A fresh Claude Code session can see memory_search, memory_ingest, memory_package, and memory_list as available tools.
  • The PreCompact hook exits cleanly when triggered — it should produce no output.

Lifecycle hooks

The plugin registers hooks for every significant Claude Code lifecycle event. Each hook fires automatically — you do not need to prompt Claude or call any tools manually.
HookTrigger
SessionStartBeginning of a Claude Code session — injects a bootstrap prompt so Claude calls memory_search early
UserPromptSubmitBefore each user prompt — searches memory via HTTP and injects matching memories as context
PreCompactBefore context window compaction — no-op by design; PostCompact handles capture
PostCompactAfter compaction — stores Claude Code’s generated compact_summary as a cleaned memory record
StopAgent stop — stores the cleaned last assistant response for meaningful turns
StopFailureAgent failure — debug telemetry only; no memory write
SessionEndEnd of session — cleans local dedupe and last-write markers
TaskCompletedTask completion — stores a cleaned task subject and optional description as a memory record
PreToolUse (Write|Edit)Before file write or edit tool calls — blocks writes to MEMORY.md and similar memory-file paths, redirecting the agent to use memory_ingest instead
Lifecycle writes are compact records, not raw prompt dumps. Hook scripts automatically redact secret-shaped values and strip fenced code blocks, XML-like tags, and markdown-heavy formatting before writing records.

Hook runtime

By default the plugin uses its versioned Bash hook scripts. For manual hook configurations, the AtomicMemory CLI can generate host-specific snippets with a choice of runtime:
# Recommended: bundled Node CLI hook runner
atomicmemory hooks install --host claude-code --runtime node

# Advanced: Python hook runner (for Python-first environments)
atomicmemory hooks install --host claude-code --runtime python
Node is the default because it shares the TypeScript SDK adapter and CLI packaging. Before relying on a generated snippet, verify that the atomicmemory CLI binary is available inside the hook environment — Claude Code hook environments are often spawned with a thinner PATH than your interactive shell:
command -v atomicmemory
If the command is not found, install @atomicmemory/cli globally or invoke it through a wrapper that adds the resolved bin to PATH.

Advanced capture controls

You can fine-tune memory capture volume with additional environment variables. All of these are optional and fail closed if set to invalid values.
VariablePurposeDefault
ATOMICMEMORY_PROMPT_SEARCH_ENABLEDSet to false to disable per-prompt retrievaltrue
ATOMICMEMORY_PROMPT_SEARCH_MIN_CHARSMinimum prompt length to trigger a search20
ATOMICMEMORY_PROMPT_SEARCH_LIMITNumber of results returned during prompt search5
ATOMICMEMORY_STOP_MIN_ASSISTANT_CHARSMinimum assistant response length for Stop capture200
ATOMICMEMORY_STOP_MAX_SUMMARY_CHARSMaximum assistant response excerpt stored by Stop600
ATOMICMEMORY_COMPACT_MAX_SUMMARY_CHARSMaximum PostCompact summary excerpt2400
ATOMICMEMORY_TASK_MIN_TOOL_CALLSTaskCompleted threshold under minimal capture level5
ATOMICMEMORY_TASK_MAX_DESCRIPTION_CHARSMaximum task description excerpt stored by TaskCompleted600
ATOMICMEMORY_SEMANTIC_PROMPTS_ENABLEDSet to false to disable Stop prompts that extract semantic learningstrue
The ATOMICMEMORY_STOP_MIN_ASSISTANT_CHARS default of 200 was tuned for Claude Code’s typical multi-paragraph assistant responses. If your workflow produces consistently shorter responses you still want captured, lower this value. Codex users sharing the bundled Node hook runtime should consult the Codex plugin page for host-specific guidance.

Updating an existing install

After pulling changes from the AtomicMemory repository, refresh Claude Code’s installed plugin cache:
claude plugin marketplace list

# If the plugin is already installed:
claude plugin update claude-code@atomicmemory

# If the plugin is not installed yet:
claude plugin install claude-code@atomicmemory
If the marketplace entry points to an old checkout, replace it first:
claude plugin marketplace remove atomicmemory
claude plugin marketplace add ./ --scope user
claude plugin install claude-code@atomicmemory