Skip to Content
ownmemDocs

Nest mode: one encrypted memory for every agent (CLI + hooks)

Give Claude Code and Codex the same end-to-end encrypted memory on every machine: the ownmem CLI syncs your vault to a local Markdown folder and loads your rules and resident memory at every session start, with no git and no server that can read your notes.

Last updated

Short answer: install the open-source ownmem CLI, log in with your email and vault passphrase, and run ownmem install claude (and/or codex). Every session then starts with your rules and always-loaded memory, the agent writes notes as plain Markdown in its own folder, and a hook encrypts and syncs them to your other machines, your other agents and the ownmem web app. The server only ever stores ciphertext.

npm install -g https://github.com/ownmem-ai/cli/archive/refs/heads/main.tar.gz   # Node 20 or newer
ownmem login
ownmem install claude      # Claude Code
ownmem install codex       # Codex CLI

What you get

  • One memory for all agents and machines. Claude Code on your laptop, Codex on your desktop and the ownmem web app read and write the same vault.
  • Loaded automatically. A SessionStart hook syncs and adds a short bundle to the agent's context: your rules, your resident memory, the agent's own resident notes and an index of every other file (read on demand).
  • Saved automatically. A Stop hook uploads whatever the agent wrote during the turn.
  • End-to-end encrypted, no git. Files are zipped, padded and encrypted with AES-256-GCM on your machine before they leave it, exactly like the web app. Nothing needs a repository, a remote or a merge tool.
  • Agents never overwrite each other. Each tool on each machine writes only its own folder; edits to the same file on two machines are both kept.

How your memory is laid out

The CLI mirrors your vault to ~/ownmem/memories (change it with ownmem login --dir). These are the same folders you see in the web app's memory panel:

PathWho writes itLoaded at session start
shared/queen/rules.mdyou onlyyes, first, highest priority
shared/resident.mdyou, or Distill in the web appyes
shared/… (topics, index.md)you, or Distillno, read on demand
devices/<agent-id>/resident.mdthat agentyes, for that agent
devices/<agent-id>/…that agent onlyno, read on demand

An agent id looks like claude-macbook-a7k2: tool, machine, four random characters. Apps connected over MCP get the same kind of folder through their client identity (for example devices/chatgpt-web/), so Distill treats every agent alike. When sources disagree, the agent is told to follow shared/queen/ first, then shared/, then device notes. To turn what agents learned into shared memory, run Distill in the web app: it proposes merging device notes into shared/ and you accept each file.

Write your rules yourself: create shared/queen/rules.md in the web app or in ~/ownmem/memories/shared/queen/rules.md and run ownmem sync. Keep resident.md files short (about 30 lines); everything else belongs in topic files.

Install step by step

  1. Have a vault. Sign up at ownmem.ai/chat. If you signed in with Google, the first visit asks you to set a vault passphrase: that passphrase (not your Google password) is what the CLI needs.
  2. Install the CLI (Node.js 20 or newer):
    npm install -g https://github.com/ownmem-ai/cli/archive/refs/heads/main.tar.gz
  3. Log in:
    ownmem login
    Enter your email and vault passphrase. Keys are derived on your machine (Argon2id), the vault is downloaded and decrypted into ~/ownmem/memories.
  4. Connect your agents:
    ownmem install claude
    ownmem install codex
    This adds the hooks (~/.claude/settings.json, ~/.codex/hooks.json), a short standing-instructions block (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md) and the agent's folder. Codex asks you to review and trust the new hooks the next time it starts; choose Trust.
  5. Start a session. The agent sees an "ownmem memory (nest mode)" block. Ask it to remember something; it writes to its folder and the Stop hook syncs it. Open the web app and press sync to see the file.

On a second machine, repeat steps 2 to 4. Each machine and tool gets its own agent folder.

Commands

CommandWhat it does
ownmem syncMerge local edits with the cloud and upload (--quiet for scripts)
ownmem pullDownload and merge only
ownmem context --agent <id>Print the session bundle (what the hook adds)
ownmem statusAccount, folder, vault version, agents, where the key is kept
ownmem lock / ownmem unlockRemove the vault key from this machine / put it back (asks for the passphrase)
ownmem uninstall claude|codex|allRemove hooks and instructions; your memories stay
ownmem logoutLock and forget this machine's sync state; files on disk stay

Security

  • Your passphrase never leaves the terminal prompt and is never stored. The CLI derives the same keys as the web app: Argon2id (64 MiB, 3 passes) → a key that unwraps your vault key, and a separate sign-in key whose hash is all the server keeps.
  • The vault key is kept in your operating system's credential store (macOS Keychain, Windows Credential Manager, or the Secret Service / libsecret on Linux) so hooks can sync without asking. ownmem lock removes it. On a machine without a credential store you can opt in to a file readable only by your user (OWNMEM_SECRET_STORE=file); that is weaker, because any program running as you can read it.
  • The server stores ciphertext only. The local merge base is also kept encrypted. Your memory files themselves are plain Markdown on your disk, like any notes folder: protect the machine with disk encryption and a login password.
  • What an agent sees is up to the agent's provider. The session bundle and any files the agent opens are sent to that agent's model, as with anything in its context.

Conflicts and offline use

Sync works per file, like the web app: if only one side changed a file, that version wins; if both did, the cloud version stays at the path and yours is saved next to it as name.conflict-<device>-<time>.md, so nothing is lost. A deletion only wins over an unchanged file. Hooks never block your agent: offline, the session starts with the local copy and a note, and the next sync catches up.

Agents without hooks

Clients that only speak MCP (Claude Desktop, ChatGPT, Cursor and others) can load the same bundle through the remote MCP server: the memory_bootstrap tool returns your resident memory, rules and an index, and the agent prompt there (your own standing instructions) asks the agent to call it once at the start of every session. Each MCP connection writes only to its own folder, devices/<client identity>/.

Current limits

  • Claude Code and Codex CLI are supported by ownmem install; Gemini CLI, Cursor and Kimi are planned. Any other tool can use ownmem sync and ownmem context from its own hooks or scripts.
  • Text files only (.md, .txt, .json, .csv, .yaml, .org), up to 512 KB each, within your storage (limits).
  • One account per machine.

On this page

Create your free vault

2 MB encrypted storage + 30 free points. MCP is free.

Start free →