Session Buddy
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.
Quick Links
- What Makes Session Buddy Unique?
- Features
- Automatic Session Management
- Integration with Crackerjack
- Development
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/endClaude 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
/startfor manual initialization - 📝 Use
/endfor 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.pyentrypoint (which loadsregister_session_tools,register_memory_tools,register_fingerprint_tools,register_category_tools,register_code_graph_tools,register_prompt_tools). They remain available through the alternativesession_buddy.mcp.serverprofile-driven entrypoint whenSESSION_BUDDY_TOOL_PROFILE=fullis 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 setupcheckpoint- Mid-session quality assessment with workflow analysisend- Complete session cleanup with learning capturestatus- Current session overview with health checks
Memory & Conversation Search
store_reflection- Store insights with tagging and embeddingsquick_search- Fast overview search with count and top resultssearch_summary- Aggregated insights without individual result detailsget_more_results- Pagination support for large result setssearch_by_file- Find conversations tied to a specific filesearch_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:
- 🚀 Session Buddy
start- Sets up your session with accumulated context from previous work - 🔧 Crackerjack runs quality checks and applies AI agent fixes to resolve issues
- 💾 Session Buddy captures successful patterns and error resolutions
- 🧠 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
Recommended Session Workflow
- Initialize Session:
/session-buddy:start- Sets up project context, dependencies, and memory system - Monitor Progress:
/session-buddy:checkpoint(every 30-45 minutes) - Quality scoring and optimization - Search Past Work:
/session-buddy:quick_searchor/session-buddy:search_summary- Find relevant past conversations and solutions - Store Important Insights:
/session-buddy:store_reflection- Capture key learnings for future sessions - 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:startsets 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
- Automatic insights capture (how to use
-
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
- User Documentation - Quick start, configuration, and deployment guides
- Quick Start Guide - Get started in 5 minutes
- Configuration Guide - Advanced configuration options
- MCP Tools Reference - Complete tool documentation
Developer Documentation
- Developer Documentation - Architecture, testing, and integration guides
- Oneiric Migration Guide - Database migration
- Architecture Overview - System design and patterns
Feature Guides
- Feature Guides - In-depth documentation of specific features
- Token Optimization - Context window management
- Selective Auto-Store - Reflection storage policy
- Auto Lifecycle - Automatic session management
Reference
- Reference - MCP schemas and command references
Troubleshooting
Common Issues:
- Memory/embedding issues: Ensure all dependencies are installed with
uv sync - Path errors: Verify
cwdandPYTHONPATHare set correctly in.mcp.json - Permission issues: Remove
~/.claude/sessions/trusted_permissions.jsonto 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.
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file session_buddy-0.23.0.tar.gz.
File metadata
- Download URL: session_buddy-0.23.0.tar.gz
- Upload date:
- Size: 5.2 MB
- Tags: Source
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
70d8d3730c9878679d55828495ecae2e1826771d0de0e953008a2cc43850a22c
|
|
| MD5 |
195ed5d095dc052c252f333a89e84044
|
|
| BLAKE2b-256 |
2f1cc35485334139ccb2ea735f89442b613b9e781b491b838fa38809ce90932f
|
File details
Details for the file session_buddy-0.23.0-py3-none-any.whl.
File metadata
- Download URL: session_buddy-0.23.0-py3-none-any.whl
- Upload date:
- Size: 1.0 MB
- Tags: Python 3
- Uploaded using 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}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
44476afa36aa4616da54d1ac457b17ccd2667b495f62430610ecffab81421eac
|
|
| MD5 |
7facfeee1b6cec72ac6a2bacaba40fcc
|
|
| BLAKE2b-256 |
2e1ca3419f95e8293be666755587c545b21d7080e9f748bc94e5313b19a668f2
|