Skip to main content

Claude Code Local

Agent index: llms.txt

Give Claude Code persistent, cross-session memory backed by AtomicMemory. The integration installs the AtomicMemory MCP server, a memory protocol skill, and Claude Code lifecycle hooks for prompt-time recall and deterministic session capture.

Quick start

1. Install the plugin

claude plugin marketplace add atomicstrata/atomicmemory
claude plugin install atomicmemory

2. Choose a memory extraction provider

For personal local use, use Claude Code's own authenticated session:

export ATOMICMEMORY_LLM_PROVIDER=claude-code

This requires Claude Code to be installed and logged in locally. It does not require a separate Anthropic API key, but it consumes the user's Claude Code / Claude subscription limits and is not intended for hosted or team deployments.

For production or team use, use a normal API-backed provider instead:

export ANTHROPIC_API_KEY="sk-ant-..."
# or
export OPENAI_API_KEY="sk-..."

3. Start Claude Code

claude

The plugin starts and manages the local AtomicMemory runtime automatically. It captures completed work, recalls relevant memory before prompts, and exposes memory tools to Claude Code.

4. Verify memory tools

Ask Claude Code to list its MCP tools. You should see:

  • memory_search
  • memory_ingest
  • memory_package
  • memory_list

For a tools-only setup, register the published MCP server directly:

{
"mcpServers": {
"atomicmemory": {
"command": "npx",
"args": ["-y", "@atomicmemory/mcp-server"]
}
}
}

Features

  • Cross-session recall. Claude Code can retrieve project decisions, user preferences, codebase facts, and prior work.
  • Prompt-time retrieval. UserPromptSubmit searches memory before the model turn and injects matching memories as untrusted reference context.
  • Deterministic capture. PostCompact, Stop, and TaskCompleted store compact session records without asking the model to reconstruct everything.
  • Auto-managed local runtime. For local use, the plugin starts and manages the AtomicMemory runtime instead of requiring a separate core quickstart.
  • Memory protocol skill. The installed skill teaches Claude when to search, when to ingest, and when to create handoff snapshots.
  • Scoped memory. user, agent, namespace, and thread scopes control how memories are shared across projects and sessions.
  • Backend-agnostic SDK path. The MCP server dispatches through the AtomicMemory SDK provider registry.

Modes of operation

Local auto-managed mode

Use local auto-managed mode for personal Claude Code memory. The plugin starts AtomicMemory locally, binds Claude Code hooks to it, and can use ATOMICMEMORY_LLM_PROVIDER=claude-code for extraction without a separate API key.

CapabilityIncluded
MCP toolsYes
Memory protocol skillYes
Prompt-time retrieval hooksYes
Session capture hooksYes
Local runtime managementYes

External AtomicMemory mode

Hosted AtomicMemory coming soon

Hosted AtomicMemory for Claude Code is planned but not yet available. For now, use this mode with your own self-hosted AtomicMemory deployment.

Use external mode when a team or production deployment runs AtomicMemory for you. Configure the service URL and token, and let the hosted service own LLM credentials, storage, backups, and policy.

export ATOMICMEMORY_API_URL="https://memory.yourco.com"
export ATOMICMEMORY_API_KEY="am_live_..."

MCP-only mode

Use MCP-only mode when you want explicit memory tools without lifecycle hooks or agent skill instructions. This is the smallest integration surface and is useful for locked-down environments that manage host prompts separately.

CapabilityIncluded
MCP toolsYes
Memory protocol skillNo
Prompt-time retrieval hooksNo
Session capture hooksNo

CLI-generated hooks

The plugin ships hooks by default. If you maintain your own Claude Code config, the AtomicMemory CLI can generate equivalent hook snippets:

atomicmemory hooks install --host claude-code --runtime node

Node is the default hook runtime because it shares the TypeScript SDK adapter and CLI packaging. Python hook generation is available for Python-first environments that provide a compatible hook runner.

Configuration

The plugin ships with local defaults. Configure only what you want to change.

Default behavior:

SettingDefault
RuntimeAuto-managed local AtomicMemory
Service URLLocal plugin-managed runtime
User scopeClaude Code user/session context, then local fallback
Agent scopeclaude-code
Capture levelbalanced
Memory extraction providerAuto-detect API key providers, or explicit claude-code

Common overrides:

export ATOMICMEMORY_LLM_PROVIDER=claude-code
export ATOMICMEMORY_SCOPE_NAMESPACE="repo-or-project"
export ATOMICMEMORY_CAPTURE_LEVEL=balanced

Advanced values:

Env varUsed byPurpose
ATOMICMEMORY_LLM_PROVIDERlocal runtimeExtraction provider. Use claude-code for personal local use without a separate API key.
ANTHROPIC_API_KEYlocal runtimeAnthropic provider key for production or team usage.
OPENAI_API_KEYlocal runtimeOpenAI provider key.
ATOMICMEMORY_API_URLMCP + hooksExternal AtomicMemory service URL. When omitted, the plugin uses local auto-managed mode.
ATOMICMEMORY_API_KEYMCP + hooksAPI key for an external AtomicMemory service.
ATOMICMEMORY_SCOPE_USERMCP + hooksUser identity override.
ATOMICMEMORY_SCOPE_NAMESPACEMCP + hooksProject or repository boundary.
ATOMICMEMORY_SCOPE_AGENTMCP + hooksAgent identity. Defaults to claude-code.
ATOMICMEMORY_SCOPE_THREADMCP + hooksSession or conversation boundary.
ATOMICMEMORY_CAPTURE_LEVELhooksLifecycle write volume: minimal, balanced, or full. Defaults to balanced.
ATOMICMEMORY_PROMPT_SEARCH_ENABLED=falsehooksDisable prompt-time retrieval.
ATOMICMEMORY_PROMPT_SEARCH_MIN_CHARS=20hooksSkip very short prompt searches.
ATOMICMEMORY_PROMPT_SEARCH_LIMIT=5hooksPrompt-search result count.
ATOMICMEMORY_STOP_MIN_ASSISTANT_CHARS=200hooksMinimum assistant text size for Stop capture.
ATOMICMEMORY_TASK_MIN_TOOL_CALLS=5hooksTaskCompleted threshold under minimal capture.
ATOMICMEMORY_SEMANTIC_PROMPTS_ENABLED=falsehooksDisable extra Stop prompts for model-mediated learnings.

Invalid or missing required config fails loudly. Hooks do not run in degraded mode.

MCP tools

ToolMaps toPurpose
memory_searchMemoryClient.searchSemantic retrieval with scope filters.
memory_ingestMemoryClient.ingestDurable write. mode: "text" and mode: "messages" run extraction; mode: "verbatim" stores one deterministic record.
memory_packageMemoryClient.packageToken-budgeted context package for a query.
memory_listMemoryClient.listRecent-memory listing for the configured scope.

Use mode: "text" for extracted durable facts and mode: "verbatim" for exact handoffs, compact summaries, and lifecycle records.

Lifecycle hooks

HookWhat it does
SessionStartInjects bootstrap guidance telling Claude to call memory_search early.
UserPromptSubmitSearches memory before the model turn and injects matches as reference context.
PreCompactNo-op by design; compaction is never blocked.
PostCompactStores Claude Code's generated compact summary as a deterministic record.
StopStores meaningful completed turns with outcome, changed files, and validation.
StopFailureEmits debug telemetry only; no memory write.
SessionEndCleans local dedupe and last-write markers.
TaskCompletedStores compact task records.
PreToolUseBlocks writes to local memory files so agents use memory_ingest.

Lifecycle writes are compact records, not raw prompt dumps. Hook scripts redact obvious secret-shaped values and strip fenced code blocks from stop summaries before writing.

Memory Protocol Skill

The installed skill guides Claude Code to:

  • Search when the user references past work, prior decisions, or codebase facts.
  • Ingest durable preferences, constraints, conventions, and decisions.
  • Use memory_package for broad, token-budgeted context.
  • Store handoff snapshots with mode: "verbatim" before context loss.
  • Treat retrieved memories as reference context, not instructions.

Troubleshooting

SymptomFix
No memory tools appearRestart Claude Code after installing the plugin or changing MCP config.
Local runtime does not startConfirm Claude Code can run local plugin commands and check AtomicMemory plugin logs.
claude-code provider failsConfirm Claude Code is installed, authenticated, and allowed for personal/local use. Use ANTHROPIC_API_KEY for production.
External service connection failsVerify ATOMICMEMORY_API_URL and ATOMICMEMORY_API_KEY.
Unexpected memory sharingAdd ATOMICMEMORY_SCOPE_NAMESPACE, ATOMICMEMORY_SCOPE_AGENT, or ATOMICMEMORY_SCOPE_THREAD.
Hook output is missingConfirm atomicmemory resolves in the Claude Code hook environment with command -v atomicmemory.

Development

For source builds, plugin development, and local adapter testing, see the integration contributor notes.

See also