The Problem

Claude Code sessions are stateless. Every new session starts with no memory of prior work — architecture decisions, conventions, or what was done last week. This plugin gives Claude persistent memory across sessions by storing conversation turns and codebase context in Supermemory, then injecting relevant memories at session start.

What This Does

A Claude Code plugin that captures conversation turns via hooks, indexes codebases on demand, and injects recalled context into each session. The plugin/ directory holds the Claude-side hooks (context-hook.cjs, observation-hook.cjs, prompt-hook.cjs, summary-hook.cjs, add-memory.cjs, search-memory.cjs); src/ holds the shared library — src/lib/supermemory-client.js for API calls, src/lib/settings.js for configuration, src/lib/transcript-formatter.js for parsing captured transcripts.

How It Is Wired

Execution starts in plugin/scripts/add-memory.cjs (execute) and src/add-memory.js (main). main reaches 54 functions and immediately calls loadSettings, which reads ~/.supermemory-claude/settings.json via fs.readFileSync — one hop from entry to the filesystem. From there, calls flow through src/lib/supermemory-client.js, where post (13 callers) and parse (21 callers) carry the widest blast radius; change parse and 21 call sites break. The module graph shows no circular dependencies across 22 modules and 23 edges. src/lib/settings.js is the hub (6 importers), so it is the natural place to change behavior globally. File-by-file: plugin/scripts/*.cjs are thin wrappers routing hook events into src/; src/lib/auth.js owns credential storage (load/save/clear); src/lib/container-tag.js computes project identity via sha256 and getGitRoot; src/lib/compress.js and src/lib/format-context.js handle memory compression and context shaping, both flagged for high branching density.

How To Use It

git clone https://github.com/moses-y/claude-supermemory
cd claude-supermemory
npm install

# Add the plugin marketplace
/plugin marketplace add supermemoryai/claude-supermemory
/plugin install claude-supermemory

# Set your API key
export SUPERMEMORY_CC_API_KEY="sm_..."

Requires a Supermemory Pro subscription. Optional config lives in ~/.supermemory-claude/settings.json (skipTools, captureTools, maxProfileItems, debug). The /claude-supermemory:index command triggers codebase indexing.

Real-World Use

A team working across multiple sessions on the same codebase: session one establishes conventions ("prefer TypeScript, use Bun"). The observation hook captures those turns. Session two starts, context-hook.cjs fetches and injects them as <supermemory-context> blocks, and the agent resumes with that knowledge without re-asking.

Code Health & Issues

Static analysis found 4 medium findings: duplicated 6-line blocks across src/add-memory.js, src/search-memory.js, src/observation-hook.js, src/prompt-hook.js (extract shared helpers); high branching density in src/lib/format-context.js, src/lib/transcript-formatter.js, src/lib/compress.js (31 branch points over 102 lines in one case). SDLC gaps: no test suite across 22 source files (High), no LICENSE file (High), GitHub Actions workflow lacks least-privilege token permissions, Dependabot, dependency scanning, persist-credentials: false, and job timeouts (Medium/Low).

The Bottom Line

A functional plugin with a clean module structure — no cycles, sensible separation between hooks and library code. The missing test suite and license are real blockers for production use; the duplicated logic is manageable. Suitable for teams already on Supermemory Pro who want persistent context without building the integration themselves.