Skip to main content

Perfect memory for Claude - Never solve the same coding problem twice

Project description

Claude Cache ๐Ÿง 

                              claude
 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•— โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•—  โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•โ•โ•
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•‘     โ–ˆโ–ˆโ•”โ•โ•โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ•”โ•โ•โ•
โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ•šโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—โ–ˆโ–ˆโ•‘  โ–ˆโ–ˆโ•‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ•—
 โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ• โ•šโ•โ•โ•โ•โ•โ•โ•šโ•โ•  โ•šโ•โ•โ•šโ•โ•โ•โ•โ•โ•โ•

PyPI version Python Support License: MIT

Your personal coding intelligence that learns from both successes AND failures. Claude Cache captures your complete problem-solving journey - what works, what doesn't, and the path between them.

๐Ÿง  Learning from Everything, Storing What Matters

Claude Cache revolutionizes how AI coding assistants remember. Unlike traditional tools that only save working code, we capture your complete learning journey:

โœ… Success Patterns - What Works

  • Elegant solutions that worked first time
  • Proven approaches you can trust
  • Best practices from your actual experience

๐Ÿšซ Anti-Patterns - What Doesn't Work

  • Failed approaches to avoid
  • Dead ends that waste time
  • Context-specific pitfalls you've discovered

๐Ÿ—บ๏ธ Journey Patterns - The Path to Solution

  • Complete problem-solving sequences
  • Key insights that unlock breakthroughs
  • The "why" behind the solution

Why This Changes Everything

Consider this real scenario:

Monday: You spend 2 hours debugging an authentication loop
  - Try localStorage fix (fails)
  - Check cookies (fails)
  - Debug state management (fails)
  - Finally realize it's a useEffect issue (success!)

Friday: You hit the same auth loop issue

Without Claude Cache: You might try localStorage again, wasting time on approaches that didn't work.

With Claude Cache:

  • โš ๏ธ Immediately warns: "Don't check localStorage - that failed before"
  • โœ… Suggests: "This is likely a useEffect issue - here's what worked"
  • ๐Ÿ—บ๏ธ Shows the journey: "Last time this took 4 attempts, skip to solution #4"

๐ŸŽฏ Pattern Classification System

Every pattern is classified by quality and type:

Type Symbol Description Example
Gold ๐Ÿ† Worked first time, elegant "useEffect with cleanup solved it immediately"
Silver ๐Ÿฅˆ Worked after 2-3 attempts "Third approach with useMemo worked"
Bronze ๐Ÿฅ‰ Eventually worked "Finally solved after trying 5 approaches"
Anti-Pattern ๐Ÿšซ Confirmed failure "localStorage doesn't work for auth tokens"
Journey ๐Ÿ—บ๏ธ Complete problemโ†’solution path "Auth fix: tried A, B failed โ†’ C worked because..."
Caution โš ๏ธ Works but has tradeoffs "Quick fix but needs refactoring"

Native Claude Code Tools

Type / in Claude Code to access these powerful tools:

/mcp__cache__query

Search your entire knowledge base instantly

Example: /mcp__cache__query "authentication JWT"
Returns: Your previous JWT implementations with context

/mcp__cache__learn

Save successful solutions for future use

Example: /mcp__cache__learn
  solution: "Fixed CORS with proxy middleware"
  tags: "cors,api,middleware"

/mcp__cache__suggest

Get proactive recommendations based on current context

Example: /mcp__cache__suggest "working on API endpoints"
Returns: Relevant patterns from your knowledge base

/mcp__cache__stats

Monitor your growing knowledge base

Shows: Total patterns, projects, search capabilities

/mcp__cache__browse

Index documentation for instant access

Example: /mcp__cache__browse "https://docs.example.com"
Result: Documentation indexed and searchable

๐Ÿš€ Quick Start (2 Minutes)

1. Install Claude Cache

# Full install with MCP integration (Recommended)
pip install "claude-cache[mcp]"

# Enhanced with ML-powered semantic search
pip install "claude-cache[enhanced]"

# Basic CLI tools only
pip install claude-cache

2. First Run - Watch the Magic

cache start

You'll see:

โœ“ Knowledge base initialized at ~/.claude/knowledge/cache.db
Processing 47 existing log files...
  Processing: YourProject/session1.jsonl
  Processing: YourApp/session2.jsonl
  ...
โœ“ Learned 23 patterns from your history
Starting real-time monitoring...

What's happening?

  • Claude Cache found all your past Claude Code sessions
  • It's analyzing your historical coding patterns
  • Learning from your successes AND failures
  • Building your personal knowledge base

3. Use It Immediately

# Query your knowledge
cache query "authentication"

# Get contextual suggestions
cache suggest

# See what you've learned
cache stats

3. Claude Code Integration (Optional)

Add to your .claude.json:

{
  "mcpServers": {
    "cache": {
      "type": "stdio",
      "command": "cache-mcp"
    }
  }
}

Start MCP server separately:

cache-mcp

Restart Claude Code and type / to see your new tools!

4. Test It's Working

# Check status
cache stats

# Search existing patterns
cache query "authentication"

# Get suggestions
cache suggest --context "working on APIs"

๐Ÿ”ฌ How It Works

Claude Cache uses dual-path learning to build comprehensive intelligence:

1. Historical Analysis (First Run)

  • Processes all your existing Claude Code sessions
  • Extracts patterns from past successes and failures
  • Builds initial knowledge base from your history
  • Takes 30 seconds to 10 minutes depending on history size

2. Real-Time Monitoring (Continuous)

  • Watches your coding sessions in real-time
  • Captures successful solutions ("perfect!", "works!")
  • Learns from failures (errors, "broken", "failed")
  • Records complete problemโ†’solution journeys
  • Zero lag - runs silently in background

3. Intelligent Retrieval

  • Semantic Search: ML-powered understanding of meaning
  • Pattern Matching: Finds similar problems across projects
  • Context Awareness: Right solution for your specific stack
  • Journey Replay: Shows the path that worked before

4. Privacy First Design

  • 100% Local: All data stays on your machine
  • No Cloud: Never uploads or shares your patterns
  • No Telemetry: We don't track what you're learning
  • You Own It: SQLite database you fully control

๐Ÿ“Š What Gets Captured?

โœ… Automatically Captured:

  • Solutions that work (you say "thanks", "perfect", "works")
  • Approaches that fail (errors occur, you say "broken", "failed")
  • Complete problemโ†’solution journeys
  • Patterns that repeat across projects
  • High-confidence solutions (80%+ success rate)
  • Consistent failures (repeatedly don't work)

โŒ Not Captured:

  • Every single edit or keystroke
  • Low-confidence patterns
  • Project-specific hacks
  • Trial-and-error noise
  • One-off solutions

Perfect For

  • Solo Developers: Build a personal knowledge base of solutions
  • Development Teams: Share successful patterns and best practices
  • Learning: Capture and revisit complex problem-solving approaches
  • Productivity: Eliminate repetitive problem-solving across projects

๐Ÿ’ก Real-World Impact

After using Claude Cache for a month, developers typically have:

  • 50-100 high-quality patterns per project
  • 30-50 anti-patterns preventing repeated mistakes
  • 20-30 journey patterns showing problem-solving paths
  • 90%+ relevance rate when patterns are suggested
  • 50% reduction in time spent on familiar problems

Example Output

$ cache query "auth redirect"

๐Ÿ” Found 3 relevant patterns:

1. โœ… Success Pattern (React)
   "useEffect cleanup prevents auth redirect loops"
   Project: YourApp | Confidence: 92%

2. ๐Ÿšซ Anti-Pattern
   "Don't store auth tokens in localStorage"
   Failed in: YourApp, AnotherApp | Alternative: Use httpOnly cookies

3. ๐Ÿ—บ๏ธ Journey Pattern
   "Auth loop fix: localStorage โŒ โ†’ cookies โŒ โ†’ useEffect โœ…"
   Time saved next time: ~45 minutes

Performance

  • Speed: <100ms query response for 10K+ patterns
  • Accuracy: 60-90% relevance in semantic matching
  • Storage: Efficient SQLite with optional vector embeddings
  • Privacy: Zero external API calls, completely local

Terminal Usage

Claude Cache offers multiple ways to run in terminal:

๐Ÿš€ Quick Start (Recommended)

# Start background learning system
cache background

# Search patterns
cache query "authentication patterns"

# Get suggestions
cache suggest --context "working on APIs"

# View statistics
cache stats

โš™๏ธ Advanced Options

# Full system with terminal interface
cache run

# Process existing logs only (one-time)
cache process

# Foreground mode (for testing)
cache start --watch

# Include MCP server
cache run --with-mcp

๐Ÿ”„ Background Process Methods

# Using nohup (survives terminal closure)
nohup cache start --watch > cache.log 2>&1 &

# Using screen (detachable sessions)
screen -S claude-cache -d -m cache start --watch

# Using tmux (session management)
tmux new-session -d -s claude-cache 'cache start --watch'

๐Ÿ’พ Manual Learning

# Save successful solutions
cache learn "JWT middleware with validation" --tags "auth,jwt,security"

# Index documentation
cache browse https://docs.example.com
cache scan-docs .  # Scan current repository

# Export/import knowledge
cache export backup.json
cache import backup.json

๐Ÿ› ๏ธ Process Control

# Check what's running
ps aux | grep cache

# Stop background processes
pkill -f 'cache start'

# View logs
tail -f /tmp/claude-cache.log

๐Ÿ“š Complete guide: See docs/TERMINAL_SETUP.md for detailed setup options.

๐Ÿ—๏ธ Architecture

Claude Cache/
โ”œโ”€โ”€ ๐Ÿง  Dual-Path Learning Engine
โ”‚   โ”œโ”€โ”€ Success Pattern Detector
โ”‚   โ”œโ”€โ”€ Anti-Pattern Analyzer
โ”‚   โ”œโ”€โ”€ Journey Pattern Tracker
โ”‚   โ””โ”€โ”€ Pattern Classification System
โ”œโ”€โ”€ ๐Ÿ’พ Knowledge Base (SQLite)
โ”‚   โ”œโ”€โ”€ Success Patterns (Gold/Silver/Bronze)
โ”‚   โ”œโ”€โ”€ Anti-Patterns (What Not to Do)
โ”‚   โ”œโ”€โ”€ Journey Patterns (Problemโ†’Solution)
โ”‚   โ”œโ”€โ”€ Cross-Project Intelligence
โ”‚   โ””โ”€โ”€ Documentation Index
โ”œโ”€โ”€ ๐Ÿ” Intelligent Search
โ”‚   โ”œโ”€โ”€ Semantic Understanding (ML)
โ”‚   โ”œโ”€โ”€ Context-Aware Matching
โ”‚   โ””โ”€โ”€ Pattern Similarity Analysis
โ”œโ”€โ”€ ๐Ÿ”Œ MCP Integration
โ”‚   โ””โ”€โ”€ Native Claude Code Tools
โ””โ”€โ”€ ๐Ÿ“Š Quality Control
    โ”œโ”€โ”€ Confidence Scoring
    โ”œโ”€โ”€ Pattern Validation
    โ””โ”€โ”€ Continuous Evolution

๐Ÿ“š Documentation

Contributing

We welcome contributions! Areas of interest:

  • Additional pattern detection algorithms
  • Better journey pattern analysis
  • Support for more development environments
  • Team collaboration features
  • Language-specific pattern recognition

See CONTRIBUTING.md for guidelines.

License

MIT License - see LICENSE for details.

Acknowledgments

Built with love for the developer community. Special thanks to all early adopters and contributors who helped shape Claude Cache into what it is today.


๐ŸŽฏ The Ultimate Goal

Claude Cache aims to be your external coding brain - remembering not just what worked, but understanding:

  • Why it worked
  • When it works
  • What doesn't work
  • How you got there

Every developer's journey is unique. Claude Cache ensures that journey makes you smarter with every line of code you write.


Ready to never repeat the same mistake twice? Install Claude Cache today and build your personal coding intelligence.

"The best developers aren't those who never fail, but those who learn from every failure and success alike."

Claude Cache is an independent tool for enhancing Claude Code, not an official Anthropic product.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

claude_cache-0.8.1.tar.gz (178.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

claude_cache-0.8.1-py3-none-any.whl (127.6 kB view details)

Uploaded Python 3

File details

Details for the file claude_cache-0.8.1.tar.gz.

File metadata

  • Download URL: claude_cache-0.8.1.tar.gz
  • Upload date:
  • Size: 178.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for claude_cache-0.8.1.tar.gz
Algorithm Hash digest
SHA256 3e42cb9c910d54cada814f6f5394699c2fafbb6611e56fe8a139cd0dba3a7511
MD5 bbc74e6dfbd94db35a79fd330827ee6d
BLAKE2b-256 aeb60fa1ff0f6bb819bf754cee7041427ee47609bc0972823db21f566e59c667

See more details on using hashes here.

File details

Details for the file claude_cache-0.8.1-py3-none-any.whl.

File metadata

  • Download URL: claude_cache-0.8.1-py3-none-any.whl
  • Upload date:
  • Size: 127.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.18

File hashes

Hashes for claude_cache-0.8.1-py3-none-any.whl
Algorithm Hash digest
SHA256 348f7f32e0818ba8f8b963e5d04ce25991182e267027a7663577068bcf4c53cd
MD5 05bb7b0f788556c3c8a4e1af763c662d
BLAKE2b-256 6eeb05729d59be84b5ca15032f08d27deba6dc66d168fa7f3f66928d93a97c90

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page