Get Started

shmem runs on your machine and stores memories locally — there is no account. Installing locally is the fastest way to feel what it does: one command wires in automatic capture and imports your existing agent history, so you can ask "what did I work on yesterday?" right away. Later, shmem login signs you in to an account, which puts the same memory on your other machines and in the Claude app, and lets you share it with teammates. (Already have an account? Jump to signing in.)

Install

By installing and using shmem you agree to the Self-Hosted Software Terms of Use.

Installed with Homebrew? Homebrew is deprecated. Check shmem --version. On v0.2.25 or earlier, run brew uninstall shmem before the one-liner below, because those versions refuse to be replaced. On v0.2.26 or later, see Migrating from Homebrew.

One-liner (macOS, Linux, Windows/WSL; amd64 + arm64):

curl -fsSL https://shmem.secondmoment.ai/docs/install.sh | sh

It detects your OS and architecture, installs shmem and shmem-mcp to ~/.local/bin (or /usr/local/bin with sudo if needed), then runs shmem install, which sets everything up without asking any questions:

Welcome to shmem, long-term memory for you and your agents.

  ✓ memory created at ~/.shmem
  ✓ Claude Code found: installed capture hooks, memory tools (MCP) and a recall note in CLAUDE.md
  ✓ Codex found: installed capture hooks, memory tools (MCP) and a recall note in AGENTS.md
    From now on, their sessions are saved to memory automatically.
  · importing past sessions
      Claude Code sessions (214) … 5210 memories (4s)
      Codex CLI rollouts (12) … 380 memories
  ✓ imported 226 past sessions
  ✓ answers via Anthropic (ANTHROPIC_API_KEY)

Setup is done. Everything is on this machine; there is no account.

  shmem ask "what was I working on last week?"
      it already remembers your imported sessions
  shmem login
      to use this memory on your other machines or share it with teammates

What shmem install does, in order:

  1. Creates the memory store at ~/.shmem (or $SHMEM_ROOT).
  2. Wires every agent it detects — Claude Code, Codex, Antigravity, OpenCode — with capture hooks (OpenCode: a capture plugin), shmem's memory tools as a user-level MCP server, and a short note telling the agent how to recall. Config locations honor each agent's own override: CLAUDE_CONFIG_DIR, CODEX_HOME, and XDG_CONFIG_HOME (OpenCode).
  3. Imports past sessions from Claude Code, Codex, Cursor, Cline, and OpenCode. No LLM calls — it's parse-and-insert. A ChatGPT export or GitHub history it finds is pointed at, not imported (shmem import --from chatgpt, shmem import --from github).
  4. Finds an LLM to answer questions — see LLM provider options.

You don't need to run it again after installing another agent. Claude Code, Codex, Antigravity or OpenCode installed afterwards is connected, and its past sessions imported (unless install ran with --no-import), the next time shmem runs: any shmem command, or within a day through another connected agent's hooks. An agent that was already present and left unwired (for example by --for) stays as you left it. If install found no LLM, one you set up later is picked up the next time you ask; to switch from one it did find, edit SHMEM_QA_PROVIDER in ~/.shmem/.env or run shmem install --provider <name>. History from Cursor or Cline installed later isn't imported automatically: shmem import --from cursor (or cline). Re-running shmem install is safe; it's idempotent. Flags: --for <host> wires one agent only (claude-code, codex-cli, antigravity, opencode), --provider <name> skips LLM detection, --no-import skips importing. To install the binaries without running setup, set SHMEM_NO_SETUP=1.

Manual tarball (for version pinning or air-gapped installs). Tarballs are published to GitHub releases:

# Replace OS/ARCH with one of: darwin_amd64, darwin_arm64, linux_amd64, linux_arm64, windows_amd64
# Replace X.Y.Z with the version from https://github.com/second-moment-ai/homebrew-tap/releases
curl -fsSL "https://github.com/second-moment-ai/homebrew-tap/releases/download/vX.Y.Z/shmem_X.Y.Z_OS_ARCH.tar.gz" \
  | tar xz -C /tmp
sudo install -m 0755 /tmp/shmem /tmp/shmem-mcp /usr/local/bin/
shmem install

Verify:

shmem --version
shmem status --json     # installed, configured_hosts, qa_provider, fact_count

Updating

shmem upgrade                     # self-update to latest (no brew required)
shmem upgrade --check             # show what would be installed, don't act
shmem upgrade --version v0.2.13   # pin a specific version

shmem upgrade fetches the latest release and replaces the running binaries in place. Works the same on every platform shmem supports. The once-per-day update-check nag points at this command directly.

Agents already connected to shmem don't need a restart: on macOS and Linux, each running shmem-mcp switches to the new binary at its next request, keeping the agent's session.

Migrating from Homebrew

Homebrew support is deprecated. If you installed via brew install second-moment-ai/tap/shmem:

shmem upgrade             # replaces the brew-managed binary in place
brew uninstall shmem      # let brew stop tracking it

After that, shmem upgrade handles all future updates automatically.

On v0.2.25 or earlier, shmem upgrade refuses to touch a brew-managed binary rather than replacing it, so the two commands above won't work. Check with shmem --version; if you're below v0.2.26, uninstall first and reinstall from the script:

brew uninstall shmem
curl -fsSL https://shmem.secondmoment.ai/docs/install.sh | sh

AI agents: if you landed here because a user asked you to install shmem, the agent install guide at /install/ is structured specifically for you: run the one-liner above, relay its output, then verify with shmem ask.


Quickstart

Local (start here)

Installing locally gives you the "it already knows my work" moment immediately — setup configures capture and imports your existing agent history in one step.

  1. Install and set up (the one-liner above):
    curl -fsSL https://shmem.secondmoment.ai/docs/install.sh | sh
    
  2. Ask:
    shmem ask "what was I working on last week?"
    

New sessions in every wired agent are captured from here on. When you want this memory on another machine, or shared with teammates, the next step is shmem login.

Sign in when you need to

You've got shmem working locally. Sign in to a hosted account when you want to:

  1. Use one memory across machines — laptop, desktop, cloud dev box, all in sync.
  2. Use it in the Claude app — the shmem connector answers from the same account.
  3. Share memory with your team — teammates' agents draw on the same context.
shmem login

It opens your browser to sign in, then asks which of this machine's projects sync with your account: all, none, or the ones you pick. The others stay on this machine only. Hosted access is invite-only for now: request access, then sign in with that email. See Signing in for new machines, SSH, and other servers.

Optional: per-repo projects with shmem init

shmem install wires your agents at the user level, so every session is captured wherever it runs, and shmem ask searches all of your memory. Facts captured live are tagged with the default project; imported history is tagged with a project derived from where it happened (one per Claude Code project, Cursor workspace, or Codex working directory).

If you want a repo to have its own project tag — to scope shmem ask --here, or to share one repo's memory — run shmem init inside it:

shmem init              # project named after the directory
shmem init my-app       # or name it

It writes .shmem/project and nothing else: no hooks, agent docs or MCP config in the repo, since shmem install already set those up for your user. Commit the file and teammates' sessions in the repo land in the same project. On a machine where shmem isn't set up yet, init runs shmem install first.

Scoping note: shmem stores everything in a single unified database at ~/.shmem/db/. Project is a tag on each fact, not a separate database. When you run shmem ask "..." from inside a project directory (one with a .shmem/project marker in the cwd walkup), it scopes to that project automatically, plus any shared spaces you've joined, what teammates wrote into projects you've shared, and memory saved with no project, such as what the Claude app saves; if that has no matches it auto-broadens to all projects and notes that on stderr. From a directory without a marker, shmem ask searches every project. Overrides: --project NAME (any tag, explicit), --global (search every project), --mine (only your facts), SHMEM_DEFAULT_SCOPE=global env var (restore the pre-default-project behavior across all calls). See Projects for the full model.

Verify

shmem admin status
shmem ask "What have I been working on recently?"

Manual setup

If you're not using Claude Code, or prefer to configure by hand:

  1. ~/.shmem/.env — API key for your LLM provider
  2. Hooks or MCP config, depending on your client — call shmem hook user-message / shmem hook response from UserPromptSubmit / Stop events, or register shmem-mcp as an MCP server
  3. CLAUDE.md (or equivalent) — instructions teaching your agent when to use ask_memory and recall_memory

See the Reference page for the full CLI, MCP tool, environment variable, and transport details.

Next steps