Skip to main content

Session Buddy

Code style: crackerjack Runtime: oneiric Framework: FastMCP uv Python: 3.13+

A session management MCP server for Claude Code.

A dedicated MCP server that manages session lifecycle, searchable memory, and cross-project intelligence for Claude Code sessions.

Bodai Ecosystem Role

Session Buddy is the builder of the Bodai ecosystem — it persists, indexes, and recovers the conversation context that flows through Mahavishnu, Crackerjack, and the other components. Its knowledge graph captures cross-session decisions, agent recommendations, and session archaeology.

Standalone, Session Buddy is a session management MCP server for Claude Code — useful for any developer who wants searchable memory across multiple coding sessions. See bodai/docs for the full integration picture.

Quality & CI

Crackerjack is the standard quality-control and CI/CD gate for Session Buddy. Use the same Crackerjack workflow locally that the project expects in CI.

What Makes Session Buddy Unique?

Session Buddy focuses on three things that set it apart from a simple session log:

Automatic Knowledge Capture

Session Buddy can extract structured insights from conversation patterns and make them searchable in later sessions. That reduces manual note-taking and turns normal development work into reusable project memory.

Cross-Project Intelligence

Session Buddy can surface relevant knowledge across related repos, services, or packages, which is especially useful for monorepos, microservices, and tightly coupled project families.

Privacy-First Architecture

  • Local processing by default
  • Local embedding support
  • No required external API dependency for core workflows
  • Fast search and retrieval oriented toward interactive use

Features

Advanced Analytics & Integration

Session Buddy extends core session management with real-time monitoring, analytics, and cross-session learning.

Real-Time Monitoring

  • WebSocket Server - Live dashboard streaming at 1-second intervals

    • Top 10 most active skills displayed in real-time
    • Performance anomaly detection with Z-score analysis
    • Client subscriptions (all skills or specific skill monitoring)
  • Prometheus Metrics - Monitoring export

    • 5 metric types: Counters, Histograms, Gauges
    • HTTP endpoint on port 9090 for scraping
    • Thread-safe updates for concurrent access

Advanced Analytics

  • Predictive Models - ML-based skill success prediction

    • RandomForest classifier with 7 features
    • 30-day historical training window
    • Feature importance analysis
  • A/B Testing Framework - Experiment with recommendation strategies

    • Deterministic user assignment (SHA-256 hashing)
    • Statistical significance testing (t-test, p < 0.05)
    • Automated winner determination
  • Time-Series Analysis - Trend detection and forecasting

    • Linear regression trend detection
    • Hourly aggregation for dashboards
    • Anomaly detection using Z-scores

Cross-Session Learning

  • Collaborative Filtering - Learn from similar users

    • Jaccard similarity for user matching
    • Personalized recommendations
    • SHA-256 privacy hashing for user IDs
  • Community Baselines - Global skill effectiveness

    • Cross-user aggregation
    • Percentile rankings
    • User vs global comparisons

Tool Integration

  • Crackerjack Integration - Quality gate tracking

    • Phase mapping to workflow stages
    • Automatic failure recommendations
    • ASCII workflow visualizations
  • IDE Plugin Protocol - Context-aware recommendations

    • Code pattern detection (tests, imports, async)
    • Language-specific skill patterns
    • Keyboard shortcut management
  • CI/CD Tracking - Pipeline analytics

    • Stage-by-stage monitoring
    • Bottleneck identification (< 80% success)
    • JSON export for dashboards

Skills Taxonomy

  • Categories - Organized skill domains

    • Code Quality, Testing, Documentation, Deployment, etc.
    • 6 predefined categories
    • Multi-modal skill types (code → diagnostics, testing → test_results)
  • Dependencies - Co-occurrence patterns

    • Lift score calculation
    • Relationship mapping
    • Workflow-aware recommendations

Performance:

  • Real-time metrics: < 100ms
  • Anomaly detection: < 200ms
  • Collaborative filtering: < 200ms
  • MCP tools: < 50ms

Core Session Management

  • Session Initialization: Setup with UV dependency management, project analysis, and automation tools
  • Quality Checkpoints: Mid-session quality monitoring with workflow analysis and optimization recommendations
  • Session Cleanup: 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

Intelligence Features

Session Buddy includes local knowledge-capture and sharing features that help work carry across sessions and repos:

Automatic Insights Capture & Injection

What It Does:

  • Automatically extracts educational insights from your conversations using deterministic pattern matching
  • Stores insights with semantic embeddings for later retrieval
  • Prevents duplicate capture through SHA-256 content hashing
  • Makes insights available across sessions via semantic search

How It Works:

When you use explanatory mode (like this session!), Session Buddy automatically captures insights marked with the ★ Insight ───── delimiter:

Some explanation text.

`★ Insight ─────────────────────────────────────`
Always use async/await for database operations to prevent blocking the event loop
`─────────────────────────────────────────────────`

More text here.

Multi-Point Capture Strategy:

  • Checkpoint Capture: Extracts insights during mid-session quality checkpoints
  • Session End Capture: Additional extraction when session ends
  • Deduplication: SHA-256 hashing prevents storing duplicate insights
  • Session-Level Tracking: Maintains hash set across entire session

Benefits:

  • ✅ Automatic Capture: Works automatically with explanatory mode
  • ✅ No Hallucination: Rule-based extraction (not AI-generated)
  • ✅ Conservative Capture: Better to miss an insight than invent one
  • ✅ Measured Performance: <50ms extraction, <20ms semantic search
  • ✅ Privacy-First: All processing done locally, no external APIs

Documentation: See docs/features/INSIGHTS_CAPTURE.md for complete details


Global Intelligence & Pattern Sharing

What It Does:

  • Share knowledge across related projects automatically
  • Track project dependencies (uses, extends, references, shares_code)
  • Search across all projects with dependency-aware ranking
  • Coordinate microservices, monorepo modules, or related repositories

How It Works:

Create groups of related projects and define their relationships:

# Create project group
group = ProjectGroup(
    name="microservices-app",
    projects=["auth-service", "user-service", "api-gateway"],
    description="Authentication and user management microservices",
)

# Define dependencies
deps = [
    ProjectDependency(
        source_project="user-service",
        target_project="auth-service",
        dependency_type="uses",
        description="User service depends on auth service for validation",
    ),
    ProjectDependency(
        source_project="api-gateway",
        target_project="user-service",
        dependency_type="extends",
        description="Gateway extends user service with rate limiting",
    ),
]

Cross-Project Search:

  • Search across related projects automatically
  • Results ranked by dependency relationships
  • Understand how solutions propagate across your codebase

Benefits:

  • ✅ Knowledge Reuse: Solutions found in one project help with related projects
  • ✅ Dependency Awareness: Understand how changes ripple across projects
  • ✅ Coordinated Development: Work effectively across multiple codebases
  • ✅ Semantic Understanding: Find patterns even when projects use different terminology

Use Cases:

  • Microservices: Coordinate related services with shared patterns
  • Monorepos: Manage multiple packages/modules in one repository
  • Multi-Repo: Track patterns across separate but related repositories

Automatic Session Management

For Git Repositories:

  • ✅ Automatic initialization when Claude Code connects
  • ✅ Automatic cleanup when session ends (quit, crash, or network failure)
  • ✅ Automatic compaction during checkpoints
  • ✅ Automatic in supported workflows

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 manages the session lifecycle with crash resilience and network failure recovery. Non-git projects retain manual control for flexible workflow management.

Session Lifecycle Visualization

stateDiagram-v2
    [*] --> GitRepo: Claude Code Connects
    [*] --> ManualInit: Non-Git Project

    GitRepo --> AutoStart: Auto-detect Git
    AutoStart: Initialize Session
    AutoStart --> Working: Development

    ManualInit --> ManualStart: User runs /start
    ManualStart: Initialize Session
    ManualStart --> Working: Development

    state Working {
        [*] --> Active
        Active --> Checkpoint: /checkpoint
        Checkpoint --> Active: Continue Work
        Active --> Monitoring: Track Quality
        Monitoring --> Active
    }

    Working --> AutoEnd: Disconnect/Quit
    Working --> ManualEnd: User runs /end

    AutoEnd: Auto Cleanup
    AutoEnd --> [*]: Session Handoff

    ManualEnd: Manual Cleanup
    ManualEnd --> [*]: Session Handoff

    note right of AutoStart
        Automatic Features:
        - UV sync
        - Project analysis
        - Setup .claude/
        - Create shortcuts
    end note

    note right of AutoEnd
        Crash Resilient:
        - Any disconnect
        - Network failure
        - System crash
        All handled gracefully
    end note

Git Repository Auto-Management Flow

Available MCP Tools

This server provides 199 MCP tools across 31 tool groups (verified 2026-08-19 via SESSION_BUDDY_TOOL_PROFILE=full). The actual count is gated by SESSION_BUDDY_TOOL_PROFILE (minimal/standard/full). For a complete list of tools, see the MCP Tools Reference.

Bodai Baseline Tools

Session-Buddy conforms to the Bodai core MCP baseline (shared with mahavishnu, akosha, dhara, crackerjack). The following tools are registered on every profile:

Tool Purpose
discover_tools(query) List registered tools, optionally filtered by name substring
get_liveness() Returns {status, service, version, uptime_seconds} envelope
get_readiness() Readiness probe over configured dependencies
health_check_all() Dependency health summary

ping is preserved as a deprecated alias delegating to get_liveness and logs a WARN-level DeprecationWarning on every invocation. It will be removed in the next release; existing callers (Akosha's run_fitness_analysis, Mahavishnu's session_buddy_tools.py, Crackerjack's otel_ingester.py) should migrate to get_liveness.

Removed in 2026-08-12 audit: The following tools were documented but not wired into the default server_optimized.py entrypoint (which loads register_session_tools, register_memory_tools, register_fingerprint_tools, register_category_tools, register_code_graph_tools, register_prompt_tools). They remain available through the alternative session_buddy.mcp.server profile-driven entrypoint when SESSION_BUDDY_TOOL_PROFILE=full is set, but the canonical Phase 4 / Intelligence sections below were misleading because the default startup does not register them.


Core Session Management

  • start - 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
  • store_reflection - Store insights with tagging and embeddings
  • quick_search - Fast overview search with count and top results
  • search_summary - Aggregated insights without individual result details
  • get_more_results - Pagination support for large result sets
  • search_by_file - Find conversations tied to a specific file
  • search_by_concept - Semantic search by concept with optional file context

Knowledge Graph (DuckPGQ)

  • Entity and relationship management for project knowledge
  • SQL/PGQ graph queries for complex relationship analysis
  • See Oneiric Migration Guide

All tools use local processing for privacy, with DuckDB vector storage (FLOAT[384] embeddings) and HTTP embedding via llama-server (preferred) or Ollama with graceful degradation; 384-dim vectors from all-MiniLM-L6-v2 or nomic-embed-text.

Integration with Crackerjack

Session Buddy 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 Buddy 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 Buddy 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-buddy": {
      "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-buddy": {
      "command": "session-buddy",
      "args": [],
      "env": {}
    }
  }
}

Dependencies: Requires Python 3.13+. For a complete list of dependencies, see pyproject.toml.

This downloads the Xenova/all-MiniLM-L6-v2 model (~100MB) which includes:

  • Pre-converted ONNX model (no PyTorch needed!)
  • 384-dimensional embeddings for semantic similarity
  • Fast CPU inference with ONNX Runtime

Note: Text search is highly effective and recommended for most use cases. Semantic search provides enhanced conceptual matching by understanding meaning beyond keywords.

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:quick_search - Fast search with overview results
  • /session-buddy:search_summary - Aggregated insights without full result lists
  • /session-buddy:get_more_results - Paginate search results
  • /session-buddy:search_by_file - Find results tied to a specific file
  • /session-buddy:search_by_concept - Semantic search by concept
  • /session-buddy:search_code - Search code-related conversations
  • /session-buddy:search_errors - Search error and failure discussions
  • /session-buddy:search_temporal - Search using time expressions
  • /session-buddy:store_reflection - Store important insights with tagging
  • /session-buddy:reflection_stats - Stats about the reflection database

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
  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:quick_search or /session-buddy:search_summary - 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

Why Teams Use It

Intelligence & Knowledge Sharing

  • Automatic Insights Capture: Extracts educational insights from conversations without manual effort
  • Semantic Pattern Discovery: Find related insights across sessions using vector embeddings
  • Cross-Project Learning: Share knowledge between related projects automatically
  • Dependency Awareness: Understand how solutions propagate across your codebase
  • Team Knowledge Base: Collaborative filtering and voting for best practices
  • No Hallucination: Rule-based extraction ensures only high-quality insights are captured

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
  • Permission Memory: 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:

Intelligence Features

  • Intelligence Features Quick Start ⭐ Start Here - 5-minute practical guide

    • Automatic insights capture (how to use ★ Insight ───── delimiters)
    • Cross-project intelligence (group related projects)
    • Team collaboration (shared knowledge with voting)
    • Advanced search techniques (semantic, faceted, temporal)
    • Configuration and troubleshooting
  • Insights Capture & Deduplication ⭐ Deep Dive

    • Automatic extraction of educational insights from conversations
    • Multi-point capture strategy (checkpoint + session end)
    • SHA-256 deduplication to prevent duplicate insights
    • Semantic search with wildcard support
    • Complete test coverage (62/62 tests passing)
    • Architecture and implementation details

User Documentation

Developer Documentation

Feature Guides

Reference

  • Reference - MCP schemas and command references

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: Remove ~/.claude/sessions/trusted_permissions.json to reset trusted 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.

Release files for session-buddy 0.24.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for session-buddy 0.24.0
File Size Uploaded
session_buddy-0.24.0.tar.gz 5.2 MB Details

Built distribution (wheel)

Table of built distributions (wheels) for session-buddy 0.24.0
File Interpreter ABI Platform
session_buddy-0.24.0-py3-none-any.whl Python 3 none any Details

Total release size: 6.2 MB

Release files / session_buddy-0.24.0.tar.gz

Download URL session_buddy-0.24.0.tar.gz
Size 5.2 MB
Tags Source
SHA-256 checksum
How to use checksums
3e05a277358426eb1baf99036567f8b349583723fccc721eff29b501f8dc05cb
BLAKE2b-256 checksum
How to use checksums
def0624fba305246be5c09f7542e84914d29f6d559362f564203201a9d4ee4bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

Release files / session_buddy-0.24.0-py3-none-any.whl

Download URL session_buddy-0.24.0-py3-none-any.whl
Size 1.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
5aff63c2e7b05827224bedf54c038afdf548c19ae5f2b609092c6a96b0d10183
BLAKE2b-256 checksum
How to use checksums
6013c4f8e91aa18c25af4db4c3ed367951a5872fbb787d3e7f9be752ce4959af
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via uv/0.12.5 {"installer":{"name":"uv","version":"0.12.5","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}

Release history Release notifications | RSS feed

0.28.0

2 release files

0.27.1

2 release files

0.27.0

2 release files

0.26.4

2 release files

0.26.3

2 release files

0.26.2

2 release files

0.26.1

2 release files

0.26.0

2 release files

0.25.2

2 release files

0.25.1

2 release files

0.25.0

2 release files

0.24.1

2 release files

This release

0.24.0 This release

2 release files

0.23.0

2 release files

0.22.1

2 release files

0.22.0

2 release files

0.21.0

2 release files

0.20.0

2 release files

0.19.7

2 release files

0.19.6

2 release files

0.19.5

2 release files

0.19.4

2 release files

0.19.3

2 release files

0.19.2

2 release files

0.19.1

2 release files

0.19.0

2 release files

0.18.0

2 release files

0.17.0

2 release files

0.16.3

2 release files

0.16.2

2 release files

0.16.1

2 release files

0.16.0

2 release files

0.14.6

2 release files

0.14.5

2 release files

0.14.4

2 release files

0.14.3

2 release files

0.14.2

2 release files

0.14.1

2 release files

0.14.0

2 release files

0.13.0

2 release files

0.12.0

2 release files

0.11.1

2 release files

0.11.0

2 release files

0.10.4

2 release files

0.10.3

2 release files

0.10.2

2 release files

0.10.1

2 release files

0.10.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page