Claude Code integration

Give Claude Code a memory it can never forget.

@remnic/plugin-claude-code plugs Remnic directly into Claude Code via four lifecycle hooks. Every session starts with your project context. Every prompt recalls relevant memories. Every edit teaches Remnic something new. The agent never has to choose to remember — memory is structural.

What you get

Session-start recall

The SessionStart hook queries Remnic with the project name and injects the result as additionalContext before Claude sees the first message.

Per-prompt recall

Every user message fires UserPromptSubmit. Remnic runs a minimal-mode recall (20s timeout) with the prompt as the query and injects the top matches inline.

Incremental observe

The Stop hook runs after each assistant turn. It sends only the new messages to /engram/v1/observe in the background. Never blocks Claude.

Session-end flush

When the session exits, SessionEnd flushes anything the Stop cursor didn't capture and cleans up. Nothing is lost.

One-command install

# 1. Install Remnic if you haven't already
npm install -g @remnic/cli && remnic daemon install

# 2. Install the Claude Code connector
remnic connectors install claude-code

The connector installs the plugin to Claude Code's plugin directory, wires up the four hooks, generates a dedicated auth token, configures MCP at http://localhost:4318/mcp, and runs a health check. Restart Claude Code to pick up the new hooks.

Manual install? The hook scripts and the full ~/.claude/settings.json block live in the integration guide.

Slash commands

CommandDescription
/engram:remember <text>Store a memory explicitly ("I prefer tabs over spaces").
/engram:recall <query>Search memories ("what do I know about auth?").
/engram:search <query>Full-text search across all memories.
/engram:entitiesList tracked entities — people, projects, tools.
/engram:statusShow Remnic connection status and memory stats.

Slash commands still use the legacy /engram:* names during the v1.x compatibility window — the product, CLI, and packages are all remnic.

Cross-project memory in action

The killer benefit is that memories from one project surface in another without you doing anything:

  1. You fix a tricky Zod optional().nullable() bug in Project A.
  2. Remnic extracts: "Zod optional fields must use .optional().nullable(), not just .optional()".
  3. Later, in Project B, you start writing a Zod schema.
  4. The UserPromptSubmit hook recalls the memory. Claude sees it in additionalContext before you ask.
  5. The bug never happens again.

Troubleshooting

No memories appearing in additionalContext

Check ~/.claude/logs/engram-session-recall.log and ~/.claude/logs/engram-user-prompt-recall.log. Prompts shorter than 4 words are skipped. Confirm the daemon is up with remnic daemon status.

Per-turn recall feels slow

UserPromptSubmit uses minimal mode with a 20s timeout. If it's still too slow, raise the PROMPT_WORD_COUNT threshold in the hook script or reduce topK from 8 to 4.

Token not found

If Claude Code is launched from the Dock or Spotlight rather than a terminal, it doesn't inherit shell variables. Either add the export to ~/.zprofile or run launchctl setenv OPENCLAW_ENGRAM_ACCESS_TOKEN "your-token".