Skip to main content

MCP server for Claude session management and conversation memory

Project description

Session Buddy

A Session Management MCP Server for Claude Code

Code style: crackerjack Python: 3.13+ Coverage Static Badge

A dedicated MCP server that provides comprehensive session management functionality for Claude Code sessions across any project.

Features

  • 🚀 Session Initialization: Complete setup with UV dependency management, project analysis, and automation tools
  • 🔍 Quality Checkpoints: Mid-session quality monitoring with workflow analysis and optimization recommendations
  • 🏁 Session Cleanup: Comprehensive cleanup with learning capture and handoff file creation
  • 📊 Status Monitoring: Real-time session status and project context analysis
  • ⚡ Auto-Generated Shortcuts: Automatically creates /start, /checkpoint, and /end Claude Code slash commands

🚀 Automatic Session Management (NEW!)

For Git Repositories:

  • Automatic initialization when Claude Code connects
  • Automatic cleanup when session ends (quit, crash, or network failure)
  • Intelligent auto-compaction during checkpoints
  • Zero manual intervention required

For Non-Git Projects:

  • 📝 Use /start for manual initialization
  • 📝 Use /end for manual cleanup
  • 📝 Full session management features available on-demand

The server automatically detects git repositories and provides seamless session lifecycle management with crash resilience and network failure recovery. Non-git projects retain manual control for flexible workflow management.

Available MCP Tools

This server provides 79+ specialized tools organized into 11 functional categories. For a complete list of tools, see the MCP Tools Reference.

Core Session Management:

  • start - Comprehensive session initialization with project analysis and memory setup
  • checkpoint - Mid-session quality assessment with workflow analysis
  • end - Complete session cleanup with learning capture
  • status - Current session overview with health checks
  • permissions - Manage trusted operations to reduce permission prompts

Memory & Conversation Search:

  • reflect_on_past - Semantic search through past conversations using local AI embeddings
  • store_reflection - Store insights with tagging and embeddings
  • quick_search - Fast overview search with count and top results
  • get_more_results - Pagination support for large result sets

Knowledge Graph (DuckPGQ):

All tools use local processing for privacy, with DuckDB vector storage (FLOAT[384] embeddings) and ONNX-based semantic search requiring no external API calls.

🚀 Integration with Crackerjack

Session-mgmt includes deep integration with Crackerjack, the AI-driven Python development platform:

Key Features:

  • 📊 Quality Metrics Tracking: Automatically captures and tracks quality scores over time
  • 🧪 Test Result Monitoring: Learns from test patterns, failures, and successful fixes
  • 🔍 Error Pattern Recognition: Remembers how specific errors were resolved and suggests solutions

Example Workflow:

  1. 🚀 Session-mgmt start - Sets up your session with accumulated context from previous work
  2. 🔧 Crackerjack runs quality checks and applies AI agent fixes to resolve issues
  3. 💾 Session-mgmt captures successful patterns and error resolutions
  4. 🧠 Next session starts with all accumulated knowledge

For detailed information on Crackerjack integration, see Crackerjack Integration Guide.

Installation

From Source

# Clone the repository
git clone https://github.com/lesleslie/session-buddy.git
cd session-buddy

# Install with all dependencies (development + testing)
uv sync --group dev

# Or install minimal production dependencies only
uv sync

# Or use pip (for production only)
pip install session-buddy

MCP Configuration

Add to your project's .mcp.json file:

{
  "mcpServers": {
    "session-mgmt": {
      "command": "python",
      "args": ["-m", "session_buddy.server"],
      "cwd": "/path/to/session-buddy",
      "env": {
        "PYTHONPATH": "/path/to/session-buddy"
      }
    }
  }
}

Alternative: Use Script Entry Point

If installed with pip/uv, you can use the script entry point:

{
  "mcpServers": {
    "session-mgmt": {
      "command": "session-buddy",
      "args": [],
      "env": {}
    }
  }
}

Dependencies: Requires Python 3.13+. For a complete list of dependencies, see pyproject.toml. Recent changes include pinning FastAPI to <0.121.0 to prevent circular import bugs and removing sitecustomize.py for improved startup reliability.

Usage

Once configured, the following slash commands become available in Claude Code:

Primary Session Commands:

  • /session-buddy:start - Full session initialization
  • /session-buddy:checkpoint - Quality monitoring checkpoint with scoring
  • /session-buddy:end - Complete session cleanup with learning capture
  • /session-buddy:status - Current status overview with health checks

Auto-Generated Shortcuts: After running /session-buddy:start once, these shortcuts are automatically created:

  • /start/session-buddy:start
  • /checkpoint [name]/session-buddy:checkpoint
  • /end/session-buddy:end

These shortcuts are created in ~/.claude/commands/ and work across all projects

Memory & Search Commands:

  • /session-buddy:reflect_on_past - Search past conversations with semantic similarity
  • /session-buddy:store_reflection - Store important insights with tagging
  • /session-buddy:quick_search - Fast search with overview results
  • /session-buddy:permissions - Manage trusted operations

For running the server directly in development mode:

python -m session_buddy.server
# or
session-buddy

Memory System

Built-in Conversation Memory:

  • Local Storage: DuckDB database at ~/.claude/data/reflection.duckdb
  • Embeddings: Local ONNX models for semantic search (no external API needed)
  • Privacy: Everything runs locally with no external dependencies
  • Cross-Project: Conversations tagged by project context for organized retrieval

Search Capabilities:

  • Semantic Search: Vector similarity matching with customizable thresholds
  • Time Decay: Recent conversations prioritized in results
  • Filtering: Search by project context or across all projects

Data Storage

This server manages its data locally in the user's home directory:

  • Memory Storage: ~/.claude/data/reflection.duckdb
  • Session Logs: ~/.claude/logs/
  • Configuration: Uses pyproject.toml and environment variables

Recommended Session Workflow

  1. Initialize Session: /session-buddy:start - Sets up project context, dependencies, and memory system
  2. Monitor Progress: /session-buddy:checkpoint (every 30-45 minutes) - Quality scoring and optimization
  3. Search Past Work: /session-buddy:reflect_on_past - Find relevant past conversations and solutions
  4. Store Important Insights: /session-buddy:store_reflection - Capture key learnings for future sessions
  5. End Session: /session-buddy:end - Final assessment, learning capture, and cleanup

Benefits

Comprehensive Coverage

  • Session Quality: Real-time monitoring and optimization
  • Memory Persistence: Cross-session conversation retention
  • Project Structure: Context-aware development workflows

Reduced Friction

  • Single Command Setup: One /session-buddy:start sets up everything
  • Local Dependencies: No external API calls or services required
  • Intelligent Permissions: Reduces repeated permission prompts
  • Automated Workflows: Structured processes for common tasks

Enhanced Productivity

  • Quality Scoring: Guides session effectiveness
  • Built-in Memory: Enables building on past work automatically
  • Project Templates: Accelerates development setup
  • Knowledge Persistence: Maintains context across sessions

Documentation

Complete documentation is available in the docs/ directory:

Troubleshooting

Common Issues:

  • Memory/embedding issues: Ensure all dependencies are installed with uv sync
  • Path errors: Verify cwd and PYTHONPATH are set correctly in .mcp.json
  • Permission issues: Use /session-buddy:permissions to trust operations

Debug Mode:

# Run with verbose logging
PYTHONPATH=/path/to/session-buddy python -m session_buddy.server --debug

For more detailed troubleshooting guidance, see Configuration Guide or Quick Start Guide.

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

session_buddy-0.10.4.tar.gz (1.6 MB view details)

Uploaded Source

Built Distribution

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

session_buddy-0.10.4-py3-none-any.whl (410.9 kB view details)

Uploaded Python 3

File details

Details for the file session_buddy-0.10.4.tar.gz.

File metadata

  • Download URL: session_buddy-0.10.4.tar.gz
  • Upload date:
  • Size: 1.6 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for session_buddy-0.10.4.tar.gz
Algorithm Hash digest
SHA256 c66a4ebbdf8b8467d7c328fac47c7ee4eb5fbad1c9a6d22d4cca44531f0d7d03
MD5 c23eb51df43e1ec6e32a2ed4b1a1974b
BLAKE2b-256 10f61c69a15a5939be8b379f002b55059c98a09aee259eedef05727a02879af1

See more details on using hashes here.

File details

Details for the file session_buddy-0.10.4-py3-none-any.whl.

File metadata

  • Download URL: session_buddy-0.10.4-py3-none-any.whl
  • Upload date:
  • Size: 410.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.18 {"installer":{"name":"uv","version":"0.9.18","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for session_buddy-0.10.4-py3-none-any.whl
Algorithm Hash digest
SHA256 bf91cecd09bd20e03de8424a76f142fcc0f4aca3a3677d2ac72a5b70983b29e8
MD5 582ea550bbe752f1f5a5de7ed0407150
BLAKE2b-256 fb7d8ebce00b8eb31a852c551667c299eafd03501feae1d761a7f29fedf8cf80

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