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
TypeScript aiai-agentsai-memoryanthropicartificial-intelligencechromadbclaudeclaude-agent-sdkclaude-agentsclaude-codeclaude-code-pluginclaude-skillsembeddingslong-term-memorymem0memory-engineopenmemoryragsqlitesupermemory
---
title: AtomCode Integration
description: Memory for AtomCode, AtomGit's terminal coding agent — hook-based observation recording, session-start context, MCP memory search and read context
icon: terminal
---
## Overview
The AtomCode integration gives your AtomCode agent memory from Claude-Mem. It does four things:
1. **Observation recording**: AtomCode's lifecycle hooks send each tool result to the Claude-Mem worker, and the observer writes observations about it
2. **Context**: the `SessionStart` hook returns your memory as `hookSpecificOutput.additionalContext`, the Claude Code envelope AtomCode accepts
3. **MCP search tools**: the Claude-Mem MCP server gives AtomCode the `mcp__claude-mem__*` memory search tools
4. **Read context**: before a `read_file`, the `PreToolUse` hook adds the file's memory timeline as context and never blocks the read
<Info>
AtomCode reads global hooks from the `hooks` key in `$ATOMCODE_HOME/hooks.json` and MCP servers from the `mcpServers` key in `$ATOMCODE_HOME/mcp.json`. `$ATOMCODE_HOME` defaults to `~/.atomcode`. The installer adds Claude-Mem's hooks and the `claude-mem` MCP server to those files. It keeps your other hooks and MCP servers.
</Info>
## Requirements
- AtomCode (the `atomcode` command).
- Claude-Mem runs on your computer. You do not need CMEM Pro.
## Installation
```bash
npx claude-mem install --ide atomcode
```
Or manage the integration directly:
```bash
npx claude-mem atomcode install
npx claude-mem atomcode status
npx claude-mem atomcode uninstall
```
The installer reads `hooks.json` and `mcp.json`, saves a backup next to each (`hooks.json.bak-YYYYMMDD`, once per day, readable only by you), and writes each new file in one step. If a file does not exist, the installer creates it. If a file is not valid JSON, or `hooks` or `mcpServers` is not an object, the installer stops and changes nothing.
AtomCode allows `//` and `/* */` comments in both files. Claude-Mem can't rewrite a file with comments without losing them, so the installer stops and says the file is not plain JSON. Remove the comments, or add the entries by hand.
Start a new AtomCode session so AtomCode reads the new hooks.
## Verify
1. Run `npx claude-mem atomcode status`. It prints `AtomCode hooks: installed`. It prints `incomplete` when a hook or the `claude-mem` MCP server is missing, `not installed` when neither is there, and `unreadable config` when a file cannot be read. See [Troubleshooting](#troubleshooting).
2. Run `atomcode hooks list` to see the hooks AtomCode loaded.
3. Start a new AtomCode session in a project and ask the agent to run a command.
4. Watch the observation arrive in the viewer.
## What is captured and sent
- **Captured**: your prompts and each tool call's name and result, including failed calls.
- **Where it goes**: the hooks send this to the Claude-Mem worker on your computer. The worker sends it to the observer you chose with `CLAUDE_MEM_PROVIDER` (by default Claude, through your Claude account) to write observations. Memory is stored in `~/.claude-mem/`.
- **Opt out**: wrap text in [`<private>` tags](/usage/private-tags) to keep it out of memory, list tools in `CLAUDE_MEM_SKIP_TOOLS` to skip them, or run `npx claude-mem atomcode uninstall`.
## Event mapping
| AtomCode hook event | Claude-Mem event | Notes |
| --- | --- | --- |
| `SessionStart` | worker start, then `context` | memory is returned as `hookSpecificOutput.additionalContext` |
| `UserPromptSubmit` | `session-init` | |
| `PreToolUse` | `file-context` | only for `read_file` (matcher `read_file`); adds the file's [memory timeline](/file-read-gate) as context and never blocks the read |
| `PostToolUse` | `observation` | AtomCode tool names are mapped, see below |
| `PostToolUseFailure` | `observation` | recorded as a failed tool call |
| `Stop` | `summarize` | no summary is written yet, see [Limits](#limits) |
| `SessionEnd` | `session-end` | |
Each hook is an entry in AtomCode's flat `hooks` map, named `claude-mem-…`. Its command is the Bun runtime plus the worker script, both quoted. Each has its own `timeout_ms`: 60000 for the worker start and context, 15000 for `session-init` and `file-context`, 120000 for `observation` and `summarize`, and 30000 for `session-end`. AtomCode matchers are `|`-separated globs, not regular expressions, so the `PreToolUse` entry uses the plain name `read_file`.
### Tool names
AtomCode names its tools in snake_case. Claude-Mem maps the ones that have a direct Claude Code counterpart:
| AtomCode tool | Recorded as |
| --- | --- |
| `bash` | `Bash` |
| `read_file` | `Read` |
| `write_file` | `Write` |
| `edit_file` | `Edit` |
| `grep` | `Grep` |
| `glob` | `Glob` |
| `web_search` | `WebSearch` |
| `web_fetch` | `WebFetch` |
Every other tool keeps its AtomCode name. This includes the MCP tools (`mcp__<server>__<tool>`), `task`, `skill`, `ls` and `apply_patch`.
## Limits
- **Results without arguments**: AtomCode's `PostToolUse` and `PostToolUseFailure` hooks send the tool's result and its call id, but not the tool's arguments. Observations from AtomCode therefore don't carry the command that ran or the file path that was edited, only what the tool returned.
- **No session summaries yet**: AtomCode's `Stop` hook sends no last assistant message, and its `transcript_path` points to AtomCode's own session log, which Claude-Mem can't read yet. The `summarize` hook therefore writes no summary for AtomCode sessions. Observations and context are not affected.
- **Global hooks only**: the hooks go into `$ATOMCODE_HOME/hooks.json` so they run in every project. Claude-Mem does not write a project `.hooks.json`. AtomCode runs a project file only after you trust the project, and one next to the global hooks would run every hook twice.
- **Read context only, never blocks**: before a `read_file`, the `PreToolUse` hook adds the file's memory timeline as context. It never blocks or rewrites the read. The [File Read Gate](/file-read-gate) block text names Claude Code's tools, so a block could send the model to tools AtomCode does not have.
- **Files written at the same moment**: if AtomCode writes `hooks.json` or `mcp.json` while the installer does, the last writer wins.
## Troubleshooting
- **Hooks do not run**: run `npx claude-mem atomcode status` and `atomcode hooks list`, then start a new AtomCode session.
- **Status says incomplete**: a hook or the `claude-mem` MCP server was removed. The status line names what is missing. Run `npx claude-mem atomcode install` again.
- **Status says unreadable config, or install says a file is not plain JSON**: `hooks.json` or `mcp.json` has comments or is not valid JSON, or `hooks` or `mcpServers` is not an object. Fix the file, then run `npx claude-mem atomcode install`.
- **Files are somewhere else**: set `ATOMCODE_HOME` to the folder AtomCode uses before you run the installer.
- **Bun not found**: the hooks run Bun by its absolute path. If you moved or reinstalled Bun, run `npx claude-mem atomcode install` again.
- **More detail**: Claude-Mem writes its logs to `~/.claude-mem/logs/`.
## Uninstall
```bash
npx claude-mem atomcode uninstall
```
This removes only Claude-Mem's hooks from `hooks.json` and the `claude-mem` MCP server from `mcp.json`. Your other hooks and MCP servers stay. `npx claude-mem uninstall` does the same as part of a full uninstall. Your memory in `~/.claude-mem/` is not deleted.