Kemory

Registre officiel IA et agents

Persistent memory for AI agents: connects MCP clients to your Kemory memory vault

Installation

Ajoutez ceci à la configuration MCP de votre client (Claude Desktop : claude_desktop_config.json ; Cursor : .cursor/mcp.json ; VS Code et les autres utilisent la même forme « mcpServers »).

NPM package kemory
Claude Code
claude mcp add kemory -e 'KEMORY_API_KEY=<your kemory_api_key>' -- npx -y kemory@0.19.0 mcp serve
Configuration JSON (Claude Desktop, Cursor, VS Code)
{
    "mcpServers": {
        "kemory": {
            "command": "npx",
            "args": [
                "-y",
                "kemory@0.19.0",
                "mcp",
                "serve"
            ],
            "env": {
                "KEMORY_API_KEY": "<your kemory_api_key>"
            }
        }
    }
}

Variables d'environnement

  • KEMORY_API_KEY secret Kemory API key; when unset, mcp serve uses the sign-in from `kemory login`

Documentation

Tirée du README du projet sur GitHub, actualisée chaque semaine. Les liens ouvrent GitHub.

Sommaire
  1. kemory
  2. Quick start
  3. Install
  4. Commands
  5. MCP clients
  6. Exit codes
  7. Configuration
  8. Hooks
  9. What the CLI sends
  10. Uninstall
  11. Building from source
  12. License

kemory

The command-line client for Kemory, a persistent memory vault for AI agents. It signs you in, connects MCP clients such as Claude Code, Codex, Cursor and VS Code to your vault, and runs the MCP bridge they use.

Quick start

You need a Kemory account; sign up at kemory.sekondbrain.ai.

  1. Connect your AI clients. Nothing to install first:

     npx -y kemory connect   # Node.js 18+
     uvx kemory connect   # or with uv

    Your browser opens to sign in. kemory then lists the AI clients on this machine, [ready] or [connected], and asks once: connect every ready client, choose some, or cancel. Claude Code and Grok Build get the Kemory plugin; Codex, Copilot CLI, Cursor, Gemini CLI, OpenCode and VS Code an MCP entry plus automatic memory; the others an MCP entry. Then the connection is checked. A summary lists what is left to do, such as which clients to restart.

  2. Restart the clients it lists. Warp picks the change up without a restart.
  3. Check the setup end to end at any time with kemory doctor.

--dry-run shows what would change without changing anything. In scripts, name the clients instead: --host all, or --host claude-code, --host codex and so on (MCP clients lists them); kemory then asks nothing.

Install

brew install sekondbrainailabs/s9n/kemory
npm install -g kemory
uv tool install kemory

Builds exist for macOS (Apple silicon and Intel), Linux (arm64 and x64) and Windows (x64). They are attached to each GitHub release with checksums and build provenance (gh attestation verify <file> --repo SeKondBrainAILabs/kemory-cli). kemory upgrade tells you whether a newer release exists and how to update the copy you installed.

Commands

CommandWhat it does
kemory loginSign in through your browser (OAuth device flow), or --local with an API key
kemory logoutRemove the cached sign-in for the selected environment
kemory whoamiShow your account, active organisation and teams
kemory mcp serveThe stdio MCP bridge an MCP client launches
kemory hook session-start, hook captureWhat a coding agent's hooks run: load your Kemory context when a session starts, save the session when it ends (Hooks)
kemory connectSign in if needed, wire an MCP client and check the connection
kemory connect copilot-cloudGive GitHub Copilot's cloud agent automatic memory in the current repository (Copilot cloud agent)
kemory mcp installWrite the kemory entry into MCP clients (--host all for every installed one)
kemory doctorCheck sign-in, network, API and MCP clients; --fix wires or cleans them
kemory orgs, kemory useList your organisations and switch the active one
kemory remember, recall, ls, show, forgetStore, search, read and delete memories
kemory askAsk your vault a question and get an answer with its evidence
kemory namespaces, kemory exportList namespaces, export the whole vault as JSON
kemory statsRecall usage and its token cost; stats memories for what is never recalled or rated down
kemory keysCreate, rotate, approve, revoke, delete and list API keys for agents
kemory upgrade, telemetry, completionCheck for a newer CLI, set your analytics preference, shell completion

Every command accepts --output json for scripts and agents (stdout then carries only the JSON payload), --quiet, --no-color and --env <name>.

MCP clients

kemory connect --host <name> and kemory mcp install --host <name> connect one client, and --host all connects every client installed on this machine.

For Claude Code and Grok Build they install the Kemory plugin through the client's own claude or grok command. Its hooks save each session to Kemory, and in Claude Code also load your memory when a session starts. Without that command, or for an environment other than prod, they write the MCP entry instead.

For Codex they also add hooks to ~/.codex/hooks.json that load your memory when a session starts and save the session as it goes (Hooks). Codex runs a new hook only after you approve it, so open Codex once and approve them with /hooks. Your other hooks in that file are left as they are.

For Cursor they add the same hooks to ~/.cursor/hooks.json, and for Gemini CLI to the hooks in ~/.gemini/settings.json. Both run them without asking, and your other hooks are left as they are.

For VS Code and the Copilot CLI they write ~/.copilot/hooks/kemory.json, which both run (in VS Code through the chat.useHooks setting, on by default). kemory owns that file and rewrites it on every connect.

For OpenCode they add the opencode-kemory plugin to the plugin list in opencode.json, which OpenCode installs from npm. It does the same: it adds your memory to the system prompt when a session starts and saves your prompts as the session goes. Connected to an environment other than the default, they write the plugin as ~/.config/opencode/plugins/kemory.js instead, which connecting again replaces, so keep your own plugins in other files.

For every other client they write an MCP entry. The entry only starts kemory mcp serve; no token or key is written into the client's config, and everything else in the file is left as it was.

--hostClientConfig file (macOS and Linux)
claude-codeClaude Code~/.claude.json
claude-desktopClaude Desktop~/Library/Application Support/Claude/claude_desktop_config.json
codexOpenAI Codex~/.codex/config.toml, plus memory hooks in ~/.codex/hooks.json (or under $CODEX_HOME)
cursorCursor~/.cursor/mcp.json, plus memory hooks in ~/.cursor/hooks.json
vscodeVS Code (Copilot agent mode)~/Library/Application Support/Code/User/mcp.json, ~/.config/Code/User/mcp.json, plus memory hooks in ~/.copilot/hooks/kemory.json
copilot-cliGitHub Copilot CLI~/.copilot/mcp-config.json (or under $COPILOT_HOME), plus memory hooks in ~/.copilot/hooks/kemory.json
copilot-jetbrainsGitHub Copilot in JetBrains IDEs~/.config/github-copilot/intellij/mcp.json (%LOCALAPPDATA%\github-copilot\intellij\mcp.json on Windows)
junieJunie, in JetBrains IDEs and the Junie CLI~/.junie/mcp/mcp.json
gemini-cliGemini CLI~/.gemini/settings.json, with the memory hooks in the same file
antigravityGoogle Antigravity~/.gemini/config/mcp_config.json
windsurfWindsurf / Devin Desktop~/.config/devin/mcp_config.json, or ~/.codeium/windsurf/mcp_config.json for older installs
clineClinethe VS Code extension's cline_mcp_settings.json, or ~/.cline/data/settings/cline_mcp_settings.json
kiroKiro~/.kiro/settings/mcp.json
grokGrok CLI~/.grok/config.toml
continueContinue (discontinued in 2026; kept working where it is still installed)~/.continue/mcpServers/kemory.json
droidFactory Droid~/.factory/mcp.json, plus memory hooks in ~/.factory/hooks.json (or the hooks in ~/.factory/settings.json when you keep yours there)
zedZed~/.config/zed/settings.json (%APPDATA%\Zed\settings.json on Windows), under context_servers; your comments in the file are kept
warpWarp~/.warp/.mcp.json
opencodeOpenCode~/.config/opencode/opencode.json, plus opencode-kemory in its plugin list

On Windows the files under Library/Application Support and .config live in %APPDATA% instead, except OpenCode's, which stay in ~\.config\opencode. Grok also reads ~/.claude.json, so the claude-code entry reaches it too.

One connection per client

Each client should reach Kemory one way. Two ways give it every Kemory tool twice, which costs context in every session.

ClientConnect it with
claude.ai, Claude Desktop and Claude mobileThe claude.ai connector, added from the Kemory dashboard
Claude Code and Grok BuildThe Kemory plugin, which kemory connect installs
Everything else in the table abovekemory connect --host <name>

connect and mcp install write nothing for a client that already has Kemory: Claude Code or Grok Build with the Kemory plugin enabled, or Claude Desktop when your account has a claude.ai connector in use. kemory doctor reports a kemory entry that duplicates either one, and kemory doctor --fix removes it.

Claude Desktop rewrites its config file from memory while it runs, which drops an entry added or removed in the meantime. When its config has to change while it is open, connect, mcp install and doctor --fix offer to quit it, make the change and open it again (doctor --fix --yes does so without asking). Run from the terminal inside the Claude app, which would close with it, they offer to open Terminal and continue there instead (macOS).

Copilot cloud agent

GitHub Copilot's cloud agent works in a sandbox where no one signs in, so it reaches Kemory with an API key. Run kemory connect copilot-cloud in the repository it works on, with gh signed in. It:

  1. writes .github/hooks/kemory.json, the hooks that load your memory when a session starts and save the session (commit and push it);
  2. creates an API key for the repository, or a new one on a re-run, and stores it as the repository's Agents secrets KEMORY_API_KEY (for the hooks) and COPILOT_MCP_KEMORY_API_KEY (for the MCP server);
  3. prints the MCP configuration to paste in the repository's Settings → Copilot → MCP servers, and the Kemory host to add to Settings → Copilot → Internet access, so the hooks can reach it.

Without gh it prints the key once, to add as both secrets yourself. The hooks also take KEMORY_API_KEY anywhere else no one signs in.

Exit codes

Scripts and agents can act on why a command failed:

CodeMeaning
0Success
1Failure that fits no category below
2Invalid invocation
3Not signed in, or the sign-in was rejected — run kemory login
4Kemory could not be reached; nothing ran on the server
5Signed in but not allowed (403)
6Not found (404)
7Conflict with existing state (409)
8Rate limited (429)
9Kemory is up but temporarily unavailable (503)

Configuration

VariableEffect
KEMORY_ENVEnvironment to use: prod (default), india, local, or one from the environments file
KEMORY_URLUse this Kemory API host instead of the environment's
KEMORY_OIDC_ISSUER, KEMORY_CLI_CLIENT_IDIdentity provider and client for self-hosted Kemory
KEMORY_API_KEYmcp serve authenticates with this key instead of your sign-in
KEMORY_HTTP_TIMEOUTSeconds mcp serve waits for Kemory (default 120)
KEMORY_OUTPUTtext or json, like --output
NO_COLORDisable colour
KEMORY_ACCESSIBLE=1Plain numbered prompts instead of the arrow-key picker, for screen readers
KEMORY_HEADLESS=1Never try to open a browser

Sign-ins are stored per environment in ~/.kemory/credentials-<env>. Extra environments can be defined in ~/.kemory/environments.json (or the file named by KEMORY_ENVIRONMENTS_FILE):

{"myenv": {"issuer": "https://idp.example.com/realms/x", "kemory_url": "https://kemory.example.com", "dashboard_url": "https://app.example.com", "server_name": "kemory-myenv"}}

Hooks

Coding agents with hooks can give a session your Kemory context when it starts and save it when it ends. kemory connect sets this up where it can; these are the commands the hooks call.

CommandHook eventDoes
kemory hook session-start --agent <agent>session startPrints your namespace summaries from Kemory, led by a short instruction on using it, in the shape the agent injects. --agent is claude-code, codex, copilot, gemini-cli, cursor, opencode, or text for plain output.
kemory hook capture --agent <agent>after each turn, before compaction, session endReads the transcript the agent's payload names (or --transcript) and saves your prompts that are not stored yet as one memory. After a turn it waits until there are 3 new prompts; at compaction and session end it saves whatever is pending. Prints nothing.

Neither can hold up the agent: any error is silent, the exit status is always 0, and each gives up after KEMORY_HOOK_TIMEOUT seconds (default 2). KEMORY_HOOK_DEBUG=1 prints why a hook did nothing.

Capture sends only your own prompts, never the agent's replies or tool output: at most the last 12 new prompts and 8000 characters per memory, with credential-shaped text (API keys, tokens, passwords, private keys) replaced by [REDACTED]. They are stored in the user:sessions namespace, visible only to you. It records what it has stored in ~/.kemory/.captured/<session>, the same file the Kemory plugin uses, so a session is never stored twice.

VariableEffect
KEMORY_CONTEXT=0Turn off session-start context
KEMORY_CONTEXT_DEPTH, KEMORY_CONTEXT_MAX_CHARS, KEMORY_CONTEXT_NAMESPACESSummary depth (default l3), character budget (default 4000), namespaces to include (comma-separated; default all)
KEMORY_AUTO_CAPTURE=0Turn off capture
KEMORY_CAPTURE_NAMESPACE, KEMORY_CAPTURE_VISIBILITYWhere captures go (default user:sessions, user-private)
KEMORY_CAPTURE_MAX_TURNS, KEMORY_CAPTURE_MIN_NEW_TURNSPrompts per memory (default 12), new prompts a per-turn capture waits for (default 3)

What the CLI sends

Commands talk to the selected environment's Kemory API, and login and token refreshes to its sign-in server (accounts.sekondbrain.ai for prod). Each API request carries your access token, the active organisation, the CLI version, OS and architecture (X-Kemory-Client), and the name of the command being run (X-Kemory-Command, never its arguments). Kemory uses the last two for product analytics; kemory telemetry off turns that off for your account. kemory doctor and kemory upgrade also read the public release list on GitHub to compare versions.

How SeKondBrain handles your account and vault data is set out in the Privacy Policy.

Uninstall

  1. Remove the kemory entries from your MCP clients' config files (the MCP clients table names each file); for Continue, delete ~/.continue/mcpServers/kemory.json.
  2. Run kemory logout, or delete ~/.kemory/ to drop every saved sign-in.
  3. Uninstall the CLI the way you installed it: brew uninstall kemory, npm uninstall -g kemory or uv tool uninstall kemory.

Building from source

make build   # produces ./kemory
make check   # what CI runs: tests, lint, vulnerability scan, hygiene check

See CONTRIBUTING.md for how to work on the CLI and SECURITY.md for how it handles credentials and how to report a vulnerability. Questions and bugs go to GitHub issues.

License

MIT

Questions fréquentes

Qu'est-ce que Kemory ?

Persistent memory for AI agents: connects MCP clients to your Kemory memory vault

Comment installer Kemory ?

Il s'exécute sur votre machine. Dans Claude Code : claude mcp add kemory -e 'KEMORY_API_KEY=<your kemory_api_key>' -- npx -y kemory@0.19.0 mcp serve. Pour les autres clients, collez la configuration JSON de cette page dans leurs réglages MCP.

Faut-il une clé API pour Kemory ?

Oui. Il attend KEMORY_API_KEY, à renseigner dans sa configuration.

Kemory est-il open source ?

Oui. Son code est sur GitHub sous licence MIT.

Qui maintient Kemory ?

Il est publié par SeKondBrainAILabs. AI.tn le référence sans le maintenir ni le recommander.

Issu du registre MCP officiel. Être listé n'est pas une recommandation : vérifiez le code et les permissions d'un serveur avant de lui donner accès à vos données.