Claude Self-Reflect

May 7, 2026 · View on GitHub

Claude Self-Reflect

npm downloads MIT Release Claude Code MCP Rust Local First stars

Claude forgets everything. This fixes that.

Single 44MB binary. No databases. No containers. No API keys required.

Install | How It Works | MCP Tools | FAQ

v8.0 — Complete Rust Rewrite The entire Python/Docker/Qdrant stack has been replaced with a single Rust binary. Sub-millisecond search, 93ms startup, 273 tests, zero external dependencies. Release notes | Announcement

CSR Demo — Setup, Search, and Hooks

Table of Contents


The Forgetting Problem

The Forgetting Problem

Claude starts fresh every session. Solutions you found, architectures you designed, bugs you debugged — all gone.

Context retention drops below 20% after 10 sessions. CSR fixes this with a single binary that gives Claude perfect memory.

No special syntax. No commands. Install once, and past context appears automatically when you need it.


Explore the full documentation →


One Binary. 44MB.

Architecture — One Binary, 44MB

Everything runs locally in a single process. No Docker, no database server, no API keys required.

  • SQLite — storage for chunks, embeddings, enrichment state
  • HNSW — sub-millisecond vector search (<1ms p95)
  • FastEmbed — 384-dim local embeddings
  • AST — code-aware search across 6 languages

6 hooks fire across the session lifecycle. 12 MCP tools for explicit search.


Explore the full documentation →


The Pipeline

The Pipeline — 3 layers, 9.3x improvement

Three layers progressively improve search quality from raw chunks to AI-enriched narratives — 9.3x improvement.

Higher quality context. Better decisions. Fewer tokens.


Explore the full documentation →


Install

curl -fsSL https://raw.githubusercontent.com/ramakay/claude-self-reflect/main/scripts/install.sh | sh

One command. Downloads the binary, runs setup, registers MCP server, installs 6 hooks. Restart Claude Code.

PlatformSupport
macOS (Apple Silicon)Prebuilt binary
Linux x86_64 / WSLPrebuilt binary
Linux ARM64Prebuilt binary
macOS (Intel)Build from source
Alternative: npm
npm install -g claude-self-reflect
Build from source
git clone https://github.com/ramakay/claude-self-reflect.git
cd claude-self-reflect/csr-engine
cargo build --release
cp target/release/csr-engine ~/.local/bin/
csr-engine setup
What You'll Ask — after install, just ask Claude naturally
  • "How did we solve re-renders on this component?"
  • "What did we tell Joe about that commit?"
  • "What were our frustrations with this approach?"
  • "Where did we put the auth middleware config?"

No special syntax. No commands. CSR finds relevant past context and injects it automatically.

Performance — sub-millisecond search, 93ms startup
MetricValue
Cached startup93ms
Search latency (p95)<1ms
Binary size44MB
Import speed~20 conversations/sec
Embedding0.73ms/text (batch)
MCP Tools — 12 annotated tools available to Claude

All tools include MCP tool annotations so Claude Code understands their safety characteristics.

ToolDescriptionSafety
csr_reflect_on_pastSemantic search across past conversationsread-only
store_reflectionStore insights for future retrievalwrites
csr_quick_checkFast existence check (count + top match)read-only
search_by_recencyTime-constrained search ("last week")read-only
get_recent_work"What did we work on?" with session groupingread-only
get_timelineActivity timeline with statisticsread-only
csr_search_by_fileFind conversations that touched a fileread-only
csr_search_by_conceptTheme-based search ("security", "testing")read-only
csr_search_insightsAggregated patterns from search resultsread-only
csr_get_morePaginate through additional resultsread-only
get_full_conversationRetrieve complete JSONL conversationread-only
get_session_learningsIteration-level memory for Ralph loopsread-only
Hooks — 6 session lifecycle hooks
HookWhat it does
SessionStartSurfaces relevant past context at conversation start
UserPromptSubmitPredicts and injects context before Claude responds
PostToolUseTracks file edits with session-scoped dedup
StopStores iteration learnings, detects stuck patterns
PreCompactBacks up state before context compaction
SessionEndStores session narrative for future retrieval

All hooks use catch-all error handling. They never block Claude Code.

AI Narratives — optional 9.3x quality boost

Transform raw conversations into rich, searchable narratives. Requires an Anthropic API key.

csr-engine daemon
MetricWithoutWith AI Narratives
Search quality0.0740.691 (9.3x)
Token compression100%18% (82% reduction)
Cost per conversation-~$0.012 (Batch API)
CLI Reference
csr-engine                     Start MCP server (default)
csr-engine setup               One-shot setup: import + MCP + hooks
csr-engine status              System status (JSON)
csr-engine status --compact    One-line statusline output
csr-engine daemon              Background enrichment daemon
csr-engine hook install --apply Install Claude Code hooks
csr-engine eval                Quick eval (5 tests)
csr-engine eval --full         Full eval (20 tests)
csr-engine quality <file>      AST-based code quality analysis
Upgrading from v7.x

v8.0 replaces the Python/Docker stack with a single Rust binary.

docker compose down 2>/dev/null
curl -fsSL https://raw.githubusercontent.com/ramakay/claude-self-reflect/main/scripts/install.sh | sh

Your conversation data (~/.claude/projects/) is untouched. The new engine re-imports from the same JSONL files.

Troubleshooting
SymptomFix
No search resultsRun csr-engine setup
MCP tools not availableRun csr-engine setup, restart Claude Code
"spawn ENOENT" in MCPEnsure csr-engine is in PATH
Slow first startupNormal (~14s for index rebuild, subsequent: ~93ms)

Full guide: Documentation

Uninstall
claude mcp remove claude-self-reflect
rm -rf ~/.claude-self-reflect/
rm ~/.local/bin/csr-engine
npm uninstall -g claude-self-reflect  # if installed via npm
Contributors (v1–v7)

Documentation | npm | Issues | MIT License