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

Give your AI coding assistant perfect recall. Claude Cache automatically learns from every successful solution and provides instant access to your accumulated knowledge directly within Claude Code.

Why Claude Cache?

Every developer loses hours re-solving problems they've already fixed. Claude Cache acts as your AI's intelligent memory system:

  • ๐Ÿ”„ Never Repeat Yourself: Automatically captures successful solutions and patterns
  • ๐Ÿ” Find Instantly: Semantic search understands context and meaning, not just keywords
  • โšก Zero Context Switching: Access everything directly in Claude Code via native MCP tools
  • ๐Ÿ—๏ธ Cross-Project Intelligence: Patterns learned in one project become available everywhere
  • ๐Ÿ“š Documentation Memory: Index and instantly search any documentation you work with

Real-World Impact

# Monday: Spend 2 hours debugging JWT refresh tokens
# Save the solution when it works

# Friday: Hit the same issue again
/mcp__cache__query "JWT refresh failing"
# โ†’ Instantly get your exact solution with full context

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 Setup

1. Installation

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

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

# Basic CLI tools
pip install claude-cache

2. Start Background Learning

# Recommended: Simple background process
cache background

# Alternative: Full system
cache run

# One-time: Process existing logs
cache process

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 creates an intelligent layer between you and your AI:

  1. ๐ŸŽฏ Automatic Learning: Detects successful patterns through natural language ("that worked!") and execution monitoring
  2. ๐Ÿง  Smart Retrieval: Three-tier search system with semantic understanding, TF-IDF fallback, and pattern matching
  3. ๐Ÿ”’ Privacy First: All data stored locally in ~/.claude/knowledge/ - works completely offline

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 Examples

Authentication Debugging

# Monday: Spend 2 hours debugging JWT refresh tokens
# Save the solution automatically when it works

# Friday: Hit the same issue
/mcp__cache__query "JWT refresh failing"
# โ†’ Instantly get your exact solution with context

API Pattern Reuse

# Project A: Build a perfect rate limiter
# Claude Cache automatically captures the pattern

# Project B: Need rate limiting
/mcp__cache__suggest "API middleware"
# โ†’ Get your rate limiter pattern with implementation details

Team Knowledge Sharing

# Senior dev solves complex database optimization
/mcp__cache__learn "Optimized query with indexes"

# Junior dev hits performance issue
/mcp__cache__query "slow database query"
# โ†’ Finds senior dev's solution with explanation

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/
โ”œโ”€โ”€ Knowledge Base (SQLite)
โ”‚   โ”œโ”€โ”€ Success Patterns
โ”‚   โ”œโ”€โ”€ Error Resolutions
โ”‚   โ”œโ”€โ”€ Documentation
โ”‚   โ””โ”€โ”€ Cross-Project Index
โ”œโ”€โ”€ Vector Search Engine
โ”‚   โ”œโ”€โ”€ Semantic Embeddings (optional)
โ”‚   โ””โ”€โ”€ TF-IDF Fallback
โ”œโ”€โ”€ MCP Server
โ”‚   โ””โ”€โ”€ Native Claude Code Tools
โ””โ”€โ”€ Auto-Learning System
    โ”œโ”€โ”€ Intent Detection
    โ”œโ”€โ”€ Execution Monitor
    โ””โ”€โ”€ Pattern Extractor

Contributing

We welcome contributions! Areas of interest:

  • Additional MCP tools
  • Better pattern extraction algorithms
  • Support for more development environments
  • Team collaboration features

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.


Transform your coding workflow. Install Claude Cache today and give your AI the perfect memory it deserves.

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.7.0.tar.gz (136.1 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.7.0-py3-none-any.whl (109.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: claude_cache-0.7.0.tar.gz
  • Upload date:
  • Size: 136.1 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.7.0.tar.gz
Algorithm Hash digest
SHA256 04c050807fc5120a51049d6d5a485182d3beae8646848aba03f6448c56375fd7
MD5 12c1daf69e6517de2e07628f0a1f0b3f
BLAKE2b-256 8976274c93845174cd60742808b59259db92cb5127062ebfbb0a4e81944c1457

See more details on using hashes here.

File details

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

File metadata

  • Download URL: claude_cache-0.7.0-py3-none-any.whl
  • Upload date:
  • Size: 109.2 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.7.0-py3-none-any.whl
Algorithm Hash digest
SHA256 16ec542a3809805a83dd500eb4446a92037ce6c1f618ed6feaf7d8d1fc6e4ae1
MD5 8fb8701d175665afdeba5d5561061547
BLAKE2b-256 f4b91ef1897c295663139a610d163394b65f46db3243babd2a470b21c664d3e4

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