Configuration
Settings File
Settings are managed in~/.claude-mem/settings.json. The file is auto-created with defaults on first run.
Core Settings
Gemini Provider Settings
See Gemini Provider for detailed configuration and rate-limit information.
OpenRouter Provider Settings
See OpenRouter Provider for detailed configuration, free model list, and usage guide.
Claude Gateway Settings
Gateway credentials live in~/.claude-mem/.env, not settings.json.
Use LiteLLM Gateway when you want
CLAUDE_MEM_PROVIDER=claude to route through LiteLLM while preserving the Claude Agent SDK worker path.
System Configuration
Model Configuration
Configure which Claude model compresses your observations (only applies whenCLAUDE_MEM_PROVIDER=claude).
Available Models
Picking via the Installer
npx claude-mem install prompts for the Claude model (when the Claude provider is selected) and persists the choice to ~/.claude-mem/settings.json.
Manual Configuration
Edit~/.claude-mem/settings.json:
Mode Configuration
Configure the active workflow mode and language.Settings
Examples
Spanish Code Mode:Files and Directories
Data Directory Structure
The data directory location depends on the environment:- Production (installed plugin):
~/.claude-mem/(always, regardless of CLAUDE_PLUGIN_ROOT) - Development: Can be overridden with
CLAUDE_MEM_DATA_DIR
Plugin Directory Structure
Plugin Configuration
Hooks Configuration
Hooks are registered inplugin/hooks/hooks.json. The current shape uses a single dispatcher (worker-service.cjs hook claude-code <event>) launched through bun-runner.js, plus a fast Setup-phase version-check.js. The events wired up are:
Setup→version-check.js(sub-100ms.install-versioncheck)SessionStart→ start the worker, thenhook claude-code context(context injection)UserPromptSubmit→hook claude-code session-initPreToolUse(matcherRead) →hook claude-code file-contextPostToolUse(matcher*) →hook claude-code observationStop→hook claude-code summarize
hooks.json entries are written by the installer; do not hand-edit them in the marketplace copy unless you know what you’re doing.
Search Configuration
Claude-Mem provides MCP search tools for querying your project history. No configuration required - MCP tools are automatically available in Claude Code sessions. Search operations are provided via:- MCP Server: 3 tools (search, timeline, get_observations) with progressive disclosure
- HTTP API: 10 endpoints on the worker service port (per-user, default
37700 + (uid % 100); see~/.claude-mem/settings.json) - Auto-Invocation: Claude recognizes natural language queries about past work
Worker Service Management
Worker service is managed by Bun as a background process. The worker auto-starts on first session and runs continuously in the background.Observation TV Remote Access
The worker binds to127.0.0.1 by default and has no request authentication — the loopback bind is its only defence. CLAUDE_MEM_TV_TOKEN adds a read-only broadcast surface so a second device on your LAN (a phone, an iPad, a spare monitor) can watch Observation TV and do nothing else.
Mint a token:
Booting with a non-loopback host and no token logs a
SECURITY warning; the worker still binds.
A local port-forward reopens the whole API. The guard exempts loopback by socket peer, so anything that arrives as loopback bypasses it entirely — including ssh -L <port>:127.0.0.1:<port> <box> from another device, or any local forwarding proxy. To the worker that traffic is indistinguishable from the operator’s own browser, so it gets the full API, GET /api/settings and its provider API keys included. This is the one concrete way “the device can do nothing else” stops being true: only forward the port to devices you would hand the machine to.
Docker and bridge networking. With CLAUDE_MEM_WORKER_HOST=0.0.0.0 inside a bridge-network container, requests from the host’s own browser arrive from the bridge gateway address, not 127.0.0.1. Once a token is set, that browser is treated as remote like any other device and must supply ?token= to open the TV — and the React viewer at / is denied outright, exactly as it is for any other remote device.
Open the TV on the second device at http://<lan-ip>:<port>/tv.html?token=<secret>.
The React viewer at / stops working remotely when a token is set. That is intended — the viewer needs the write and settings routes the guard denies. Loopback is never gated, so the viewer keeps working normally on the machine running the worker.
Treat the URL as the secret. The token rides in the query string for /stream because the browser’s EventSource API cannot set request headers. It is not written to the worker log (the request logger records req.path, which excludes the query string), but it will be in the browser’s history on the device you open it on. Authorization: Bearer <token> and X-Api-Key: <token> also work for anything that can set headers.
This is plain HTTP. The token stops an unauthenticated device from reading the stream; it does not encrypt it. Anyone who can sniff your LAN sees observation titles. For a home network that is the accepted tradeoff; for anything else, terminate TLS in front of the worker (out of scope here) — and still never a tunnel to the unmodified worker, which would publish GET /api/settings and its provider API keys to the open internet.
Use the exact paths. The allowlist is exact-match and case-sensitive: /tv.html, /tv, /stream, /api/observations and nothing else. A trailing slash or a different case — /tv/, /API/observations, /api/observations/by-file — returns 404 even with a valid token. That is deliberate fail-closed behavior, not a bug.
The TV’s ?project= and ?source= filters are client-side only. They are display filters, not access control — a token holder still receives every project’s observations.
Accepted risks, stated plainly:
GET /api/observationsreturns full observation bodies —narrative,facts,text,files_read,files_modified— for every project on the box, not just the four fields the TV renders. A token holder can page through the entire memory database withoffset./streamis unfiltered. It carries every observation for every project on the box, plus the project catalog and processing status. There is no per-client filtering.- No rate limiting. A token holder can hammer
GET /api/observationsfreely. - The token is readable on loopback via
GET /api/settings, exactly like your provider API keys are today. It is deliberately not writable throughPOST /api/settings(that route is unauthenticated), so it can only be set by someone with filesystem or environment access. /streamis not side-effect-free. Every new connection triggers aninitial_loadbroadcast to all connected clients, and the client list is unbounded. A token holder reconnecting in a loop can therefore disturb the operator’s own local viewer. This is pre-existing worker behavior; the token is what newly makes it reachable from the LAN.
Manual Configuration
Edit~/.claude-mem/settings.json:
Watching Off-LAN (cmem.ai Pro)
Everything above is the LAN path. Watching from outside your network — on cellular, at a coffee shop, from another house — is a cmem.ai Pro feature: openhttps://cmem.ai/tv in any browser while signed in to your account. It requires Cloud Sync to be enabled, because the hosted page reads titles your worker has already pushed to your sync hub.
No token, no open port, no inbound connection. This path needs neither CLAUDE_MEM_TV_TOKEN nor a non-loopback CLAUDE_MEM_WORKER_HOST — both belong to the LAN path and have no effect on it, so leave them at their defaults. The box never accepts an inbound connection for the hosted TV; the worker only ever dials out. No tunnel (cloudflared, ngrok, or anything like them) is needed, and none is recommended.
The hosted TV surface shows observation titles and nothing else. It never renders narratives, facts, file lists, snippets or prompt text.
That is not the same as “only titles leave your machine.” The hosted TV is a feature of cloud sync, and cloud sync uploads your observation narratives and your full prompt text to the sync hub under your cmem.ai account. The hosted page is titles-only; the upload standing behind it is not. Don’t enable cloud sync if that content must stay on your machine.
One rendering difference. An observation with no title still appears on the LAN TV, which falls back to the subtitle. It does not appear on the hosted phone TV — that surface receives titles only, so it has no subtitle to fall back to.
Folder Context Files
Claude-mem can automatically generateCLAUDE.md files in your project folders with activity timelines. This feature is disabled by default.
See Folder Context Files for full documentation on how this feature works, configuration options, and git integration recommendations.
Context Injection Configuration
Claude-Mem injects past observations into each new session, giving Claude awareness of recent work. You can configure exactly what gets injected using the Context Settings Modal.Context Settings Modal
Access the settings modal from the web viewer. The worker prints its URL on startup; the port comes fromCLAUDE_MEM_WORKER_PORT.
- Click the gear icon in the header
- Adjust settings in the right panel
- See changes reflected live in the Terminal Preview on the left
- Settings auto-save as you change them
Loading Settings
Control how many observations are injected:
Considerations:
- Higher values = More context but slower SessionStart and more tokens used
- Lower values = Faster SessionStart but less historical awareness
- Default of 50 observations from 10 sessions balances context richness with performance
Filter Settings
Control which observation types and concepts are included: Types (select any combination):bugfix- Bug fixes and error resolutionsfeature- New functionality additionsrefactor- Code restructuringdiscovery- Learnings about how code worksdecision- Architectural or design decisionschange- General code changes
how-it-works- System behavior explanationswhy-it-exists- Rationale for code/designwhat-changed- Change summariesproblem-solution- Problem/solution pairsgotcha- Edge cases and pitfallspattern- Recurring patternstrade-off- Design trade-offs
Display Settings
Control how observations appear in the context: Full Observations:
The most recent N observations (set by Count) show their full narrative or facts. Remaining observations show only title, type, and token counts in a compact table format.
Token Economics (toggles):
Token economics help you understand the value of cached observations vs. re-reading files.
Advanced Settings
Manual Configuration
Settings are stored in~/.claude-mem/settings.json:
Customization
Settings can be customized in~/.claude-mem/settings.json.
Custom Data Directory
Edit~/.claude-mem/settings.json:
Custom Worker Port
Edit~/.claude-mem/settings.json:
Custom Model
Edit~/.claude-mem/settings.json:
Custom Skip Tools
Control which tools are excluded from observations. Edit~/.claude-mem/settings.json:
ListMcpResourcesToolSlashCommandSkillTodoWriteAskUserQuestion
- Include TodoWrite: Remove from skip list to track task planning
- Include AskUserQuestion: Remove to capture decision-making conversations
- Skip additional tools: Add tool names to reduce observation noise
Advanced Configuration
Hook Timeouts
Hook timeouts are written intoplugin/hooks/hooks.json by the installer. The current defaults match the shape of the workload at each lifecycle stage:
- Setup (
version-check.js): 300s ceiling but normally < 100ms — only reads.install-version - SessionStart (worker-start + context): 60s
- UserPromptSubmit: 60s
- PreToolUse (file-context, Read matcher): 60s
- PostToolUse (observation): 120s
- Stop (summary): 120s
bun install) happens in npx claude-mem install / npx claude-mem repair outside the session lifecycle.
Worker Memory Limit
The worker service is managed by Bun and will automatically restart if it encounters issues. Memory usage is typically low (~100-200MB).Logging Verbosity
Enable debug logging:Configuration Best Practices
- Use defaults: Default configuration works for most use cases
- Override selectively: Only change what you need
- Document changes: Keep track of custom configurations
- Test after changes: Verify worker restarts successfully
- Monitor logs: Check worker logs after configuration changes
Troubleshooting Configuration
Configuration Not Applied
-
Restart worker after changes:
-
Verify environment variables:
-
Check worker logs:
Invalid Model Name
If you specify an invalid Claude model name, the worker logs a warning and uses the default. Valid Claude models forCLAUDE_MEM_MODEL:
claude-haiku-4-5-20251001(default)claude-sonnet-5claude-opus-4-8
Port Already in Use
The default worker port is37700 + (uid % 100), so different OS users on the same machine get different ports automatically. If you still hit a collision (e.g. running multiple profiles as the same UID), set a fixed port:
-
Set custom port:
-
Restart worker:
-
Verify new port:
Next Steps
- Architecture Overview - Understand the system
- Troubleshooting - Common issues
- Development - Building from source

