Claude Code

Persistent memory for Claude Code

Every new Claude Code session re-reads the repository and asks you to re-explain where things stand. OnlyBots saves the working state of each session through Claude Code's own hooks and puts it back in front of the next one.

Install

Set up in your project

Run these from the root of the repository you work in. Quickstart creates your agent's identity, installs the Claude Code hooks, starts the local daemon and checks the connection.

  1. Install the CLI

    curl -fsSL https://onlybots.ai/install | bash

    Needs Node.js 18+, npm, curl and tar on macOS or Linux. The installer verifies the release checksum before unpacking; read the script first if you prefer.

  2. Put it on your PATH

    export PATH="$HOME/.onlybots/bin:$PATH"

    Add the same line to your shell profile to keep it.

  3. Connect Claude Code

    onlybotsctl quickstart --api-base https://onlybots.ai --adapter claude-code --workspace-root "$PWD"

    Then start Claude Code as usual. From the second session on, each prompt arrives with a short summary of where the work stands.

  4. Check it

    onlybotsctl status
    onlybotsctl doctor

    After a restart, run onlybotsctl start to bring the daemon back.

Under the hood

What the hooks do

Quickstart registers five standard Claude Code hooks. Each one calls the OnlyBots daemon on your machine.

HookWhat OnlyBots does
SessionStartAttaches the session to this repository's memory, on startup, resume and after compaction.
UserPromptSubmitAdds a compact context pack (about 360 tokens at most) with the current goal, recent turns and how the last session ended.
StopRecords what the turn did and whether it succeeded, and saves the updated working state.
PreCompact / PostCompactSaves working state immediately, so compaction doesn't erase it.

Set how much the agent saves with onlybotsctl memory mode off|manual|assist|auto. The default, assist, also runs a reflection step after each turn. Remove everything with onlybotsctl uninstall claude-code.

Compared

What Claude Code already remembers, and what it doesn't

OnlyBots works alongside Claude Code's own memory. Each tool below keeps something different.

FeatureWhat it keepsWho writes itNew session?Codex?
CLAUDE.mdInstructions and conventionsYouYesNo; Codex reads AGENTS.md
Auto memoryNotes Claude chooses to saveClaudeYesNo
--resumeOne past conversation, in fullAutomaticOnly that conversation, reloaded wholeNo
/compactA summary of the current conversationClaudeNoNo
OnlyBotsGoal, recent turns and outcomes, where the last session endedHooks, every turnYes, every session in the repoYes

Also using Codex?

Working state is kept per agent, not per tool. Install the Codex adapter under the same profile and a Codex session in the same repository picks up where Claude Code left off. For an explicit transfer, export a signed handoff from one and import it in the other.

Codex setup and handoffs →

Does it save anything?

In our 54-run Codex benchmark, OnlyBots used 19% less estimated token spend than cold restarts and 41% less than handoff files, with the largest gains on resume tasks. We haven't benchmarked Claude Code yet.

Method, data and limits →

FAQ

Claude Code memory questions

Does Claude Code remember between sessions?

Partly. Claude Code loads your CLAUDE.md files and its own auto-memory notes at the start of every session, and claude --resume reopens an earlier conversation. What it doesn't keep is a running record of where the work stands: the goal, what the last turns did and whether they worked. OnlyBots saves that through Claude Code's hooks and adds it to the next session in the same repository.

Should I still keep a CLAUDE.md?

Yes. CLAUDE.md is the right place for stable instructions: build commands, conventions, things that are true every session. OnlyBots tracks the changing state of the work, which goes stale too fast to maintain by hand. In our benchmark, hand-written handoff files used 31% more tokens than starting cold.

What happens to memory when Claude Code compacts the conversation?

/compact replaces the conversation with a summary, and detail is lost. OnlyBots hooks PreCompact and PostCompact and saves working state immediately on both, so the state from before compaction is still available on the next prompt.

Is it per project or global?

With --workspace-root "$PWD" the hooks go into that project's .claude/settings.json. Without it they go into your user-level ~/.claude/settings.json and run in every project. Either way, memory is kept separately for each repository.

Will OnlyBots ever block or slow down Claude Code?

Hook errors are caught and logged as warnings, and the hook exits cleanly, so Claude Code carries on. If the local OnlyBots daemon isn't running, the hooks do nothing; start it with onlybotsctl start.

Where is my memory stored?

Your agent's private key stays on your machine, in ~/.onlybots with owner-only file permissions. Memory is stored by the OnlyBots service so it can follow the agent between machines and tools; the service reads it to build context. To have hosted memory deleted, email josh@friendmachine.co from the address you'd like us to reply to, with your agent's npub.