Claude Code
Plugin for Claude Code with lifecycle hooks. Reads Context Bundle or Working Memory at session start, searches when relevant, and saves insights at the right moment.
For your agent
Give this line to your agent. It should use the universal install skill first; this page remains the behavior and troubleshooting reference:
Read https://mem.nowledge.co/SKILL.md and follow the instructions to install or update Nowledge Mem for Claude Code. Verify with nmem status and the Context Bundle or Working Memory check, then summarize what changed.claude plugin marketplace add https://github.com/nowledge-co/community && claude plugin install nowledge-mem@nowledge-communityPlugin-Native
Claude Code supports plugins: install once for built-in autonomous behavior. No system prompts or MCP configuration needed.
Your agent searches what you know, saves what matters, without you asking.
Your first success state
Install the plugin, make sure nmem is available, start a new Claude Code session, and verify one real behavior: Context Bundle or Working Memory loads at session start, or /search / /save works without extra wiring.
Before You Start
- Nowledge Mem running locally (installation) or a reachable remote Mem server
- Claude Code installed
Setup
Install the plugin
# Add the Nowledge community marketplace
claude plugin marketplace add https://github.com/nowledge-co/community
# Install the Nowledge Mem plugin
claude plugin install nowledge-mem@nowledge-communityThe plugin requires nmem CLI:
# Option 1 -- uvx (no installation needed)
curl -LsSf https://astral.sh/uv/install.sh | sh
uvx --from nmem-cli nmem --version
# Option 2 -- pip
pip install nmem-cliIf the Nowledge Mem desktop app is on this machine, the safest path is Settings → Preferences → Developer Tools → Install CLI. For remote-only machines without the desktop app, use
uvxor install manually.
Use slash commands and skills
Slash commands:
/save: Save the current session to Nowledge Mem/sum: Distill insights from this conversation/search <query>: Search your knowledge base/status: Check server connection and status
Natural language: Say "Save this session" or "Distill this conversation" and Claude runs the right nmem command automatically.
Autonomous (skills): The plugin includes three skills that run on their own:
- Read Working Memory: loads Context Bundle when available, or your daily briefing fallback at session start and after context compaction
- Search Memory: searches when you reference past work
- Distill Memory: suggests distillation at breakthrough moments
On request: Save Thread: saves sessions when you ask ("save this session", "checkpoint this")
Update
claude plugin marketplace add https://github.com/nowledge-co/community
claude plugin marketplace update nowledge-community
claude plugin update nowledge-mem@nowledge-community
# Restart Claude Code to apply changesImport Older Sessions
Automatic capture starts after the plugin and hooks are installed. To bring older Claude Code sessions into Nowledge Mem, preview first:
nmem t sync --from claude-code --all-projects --limit 20Then import:
nmem t sync --from claude-code --all-projects --applyUse -p /path/to/project instead of --all-projects when you only want one project. The command reads local Claude Code session files on this machine and writes to the Mem server configured in nmem.
Customize Safely
Use Claude Code's own memory files, not the installed plugin directory:
CLAUDE.local.mdfor your personal tweaks that should survive updatesCLAUDE.mdfor repo-shared rules
Do not edit the installed Nowledge Mem plugin files directly. For the full host-by-host map, see Customize Integration Behavior.
Lifecycle Hooks
The plugin uses Claude Code hooks for automatic lifecycle management:
| Event | Trigger | Action |
|---|---|---|
SessionStart (startup/resume/clear) | New session, resume, or clear | Loads Context Bundle via nmem context, falls back to nmem wm read, then local file |
SessionStart (compact) | After context compaction | Re-loads Context Bundle or Working Memory + prompts Claude to checkpoint progress |
UserPromptSubmit | Every user message | Injects search/save syntax as context Claude can see |
PreCompact | Before manual or automatic compaction | Saves the exact Claude Code session before context is compressed |
Stop | Model finishes responding | Captures session to knowledge graph with a bounded retry window |
Context Bundle, or Working Memory on older CLIs, is refreshed after compaction. The PreCompact hook saves the full local transcript before Claude Code compresses it, and the Stop hook keeps normal turn-by-turn capture running even when Nowledge Mem runs on a different machine (remote mode). If Claude Code needs a moment to flush the transcript file after a response, the hook waits and retries instead of reporting a silent no-op save.
If the desktop app's Claude Code file watcher is also enabled, you can leave it on. The watcher and plugin hooks converge on the same claude-code-<sessionId> thread, so repeated saves update the existing thread instead of creating a second one.
Local vs Remote
The plugin works transparently in both modes:
- Local (Mem on same machine): Context Bundle or Working Memory is read through Mem. The plugin keeps
~/ai-now/memory.mdonly as the Default-space compatibility fallback when the API path is unavailable. Sessions are captured by the desktop app file watcher, the Stop hook, and the PreCompact hook before context compression. - Remote (Mem on different machine): configure this machine once:
nmem config client set url https://your-server
nmem config client set api-key your-keyThat writes the shared local client config used by nmem and the plugin. You can still use environment variables (NMEM_API_URL, NMEM_API_KEY) for temporary overrides. Priority: CLI flags > env vars > config file > defaults.
When the Stop or PreCompact hook runs nmem t save --from claude-code, Claude's session files are read locally on the machine running Claude Code, then uploaded to Mem as normalized thread messages. By default that means ~/.claude, but if you've moved Claude's config, CLAUDE_CONFIG_DIR is used automatically. The remote Mem server does not need direct access to that local folder.
Go Further
AGENTS.md: a complete memory-keeper agent example using the agents.md standard. Works with any AI coding agent.
Related
- Connectors overview: native connectors, reusable packages, MCP, and browser capture
- Claude Desktop · Codex · Alma · OpenClaw · Raycast · Other Chat AI
ChatGPT Web and Desktop
Connect ChatGPT to Nowledge Mem with the browser extension for capture, or Remote MCP over OAuth so ChatGPT Web and desktop can search your Mem directly.
Grok Build
Connect Grok Build, the coding agent, to Nowledge Mem with startup context, memory guidance, and automatic session capture.