Session Buddy
Summary: Session-Buddy is a session-lifecycle and memory MCP server for Claude Code that also exposes Python code-quality analysis tools.
Session lifecycle: Initialize, checkpoint, inspect, and end sessions via MCP tools, with automatic Git repo detection, handoff context, and cleanup on disconnect.
Memory & search: Store reflections and conversation context in local DuckDB; search by text, concept, file, project, or time, with optional semantic search via llama-server/Ollama.
Cross-project intelligence: Use project groups and dependency relationships to include related repos and rank results by project context.
Learning & skills: Deterministically capture learnings at checkpoints/session end, and list/get signed skill and agent metadata catalogs.
Quality & operations: Integrate with Crackerjack, plus health checks, Prometheus metrics, WebSocket monitoring, and analytics commands.
Code analysis (MCP tools): Run
analyze_codefor complexity, dead code, clones, and coupling;check_complexityfor cyclomatic complexity;check_couplingfor CBO metrics;detect_clonesvia APTED/LSH;find_dead_codevia CFG analysis; andget_health_scorefor a 0–100 grade with category scores.Discovery & probes: Baseline tools such as
discover_tools,get_liveness,get_readiness, andhealth_check_all, plus HTTP/health,/healthz, and/metrics.Configuration: Layer repo YAML, Oneiric XDG files, and
SESSION_BUDDY_*env vars, with selectable tool profiles (minimal, standard, full).
Provides automatic session lifecycle management for Git repositories, including automated initialization, quality checkpoints, and session cleanup with learning capture.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Session Buddy checkpoint the current session and analyze workflow efficiency"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Session-Buddy
Session-Buddy is a session-lifecycle and memory MCP server for Claude Code and other MCP clients. It manages session startup, checkpoints, cleanup, searchable reflections, cross-project context, and quality signals through a local DuckDB-backed service.
Quick Links
Related MCP server: Central Brain
Quality Checks
Crackerjack is the canonical quality gate for repository changes. Use the focused checks while iterating and the full gate before handoff:
crackerjack lint
crackerjack typecheck
crackerjack security
crackerjack run --run-testsCapabilities
Session lifecycle
Initialize, checkpoint, inspect, and end sessions through MCP tools.
Detect Git repositories and perform lifecycle setup and cleanup automatically.
Create handoff context and capture learnings during checkpoints and session end.
Keep pre-compaction hooks and session state available to Claude Code.
For non-Git projects, the same lifecycle can be invoked explicitly through the MCP tools.
Memory and search
Store reflections and conversation context in DuckDB.
Search by text, concept, file, project, or time-oriented queries.
Reuse context across sessions and related repositories.
Use local text search without an embedding service; semantic search can use a configured HTTP provider such as llama-server or Ollama and degrades gracefully when no provider is available.
Cross-project intelligence
Project groups and dependency relationships let searches include related repositories and rank results using project context. This is useful for multi-repository services, monorepos, and coordinated development work.
Quality and operational signals
Session-Buddy integrates with Crackerjack to record quality results, test patterns, failure resolutions, and workflow context. It also exposes health, Prometheus metrics, WebSocket monitoring, analytics commands, and signed skill/agent metadata for MCP clients.
Learning and skills
Session-Buddy captures reflections during checkpoints and session cleanup using deterministic extraction and content-hash deduplication. Captured knowledge can then be retrieved through the memory and search tools.
The server also publishes signed capability metadata for MCP clients:
Skills:
session_buddy_list_skills,session_buddy_get_skillAgents:
session_buddy_list_agents,session_buddy_get_agent
These catalogs describe available capabilities; they do not perform autonomous self-modification. See Insights Capture for the capture and retrieval details.
Automatic Session Management
When the MCP server is connected from a Git repository, Session-Buddy can
initialize the session on connection and perform cleanup on disconnect. The
start, checkpoint, status, and end tools remain available for explicit
control, and non-Git projects use that explicit workflow by default.
Lifecycle at a glance
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
MCP Surface
The MCP server exposes a profile-gated tool surface through
SESSION_BUDDY_TOOL_PROFILE:
minimal— session lifecycle, basic search, hooks, health, baseline probes, and published agent metadata.standard— the daily-development surface, including conversation, extraction, knowledge graph, Crackerjack, monitoring, cross-repository, skills, and agent tools.full— all registered tool groups; this is the default when the variable is unset or invalid.
The active profile is defined in
session_buddy/mcp/tools/profiles.py.
The complete reference is in
docs/user/MCP_TOOLS_REFERENCE.md.
Always-available baseline tools include:
Tool | Purpose |
| List registered tools, optionally filtered by name substring |
| Return service, version, and uptime information |
| Probe configured dependencies |
| Return a dependency health summary |
Core session and memory tools include start, checkpoint, status, end,
store_reflection, quick_search, search_summary, search_by_file, and
search_by_concept.
The signed catalogs expose server-published capabilities through:
session_buddy_list_skillsandsession_buddy_get_skillsession_buddy_list_agentsandsession_buddy_get_agent
The HTTP service also provides /health, /healthz, and /metrics on the
main service port.
Integration with Crackerjack
Crackerjack is Session-Buddy's quality and CI/CD integration point. Session- Buddy can retain quality results, test outcomes, failure patterns, and useful resolutions as session context so later checkpoints and sessions can retrieve them.
Typical local validation is:
crackerjack run --run-testsSee Crackerjack Integration for the MCP tools and integration details.
Quick Start
Prerequisites
Python 3.14+
uv or pip
An MCP client that supports streamable HTTP
Install and start
git clone https://github.com/lesleslie/session-buddy.git
cd session-buddy
uv sync
# Start the streamable HTTP MCP service on 127.0.0.1:8678
uv run session-buddy server startUseful lifecycle and diagnostics commands:
uv run session-buddy server status
uv run session-buddy server health
uv run session-buddy health
uv run session-buddy doctorConnect an MCP client
The service endpoint is http://127.0.0.1:8678/mcp. Add an HTTP entry to the
client configuration:
{
"mcpServers": {
"session-buddy": {
"type": "http",
"url": "http://127.0.0.1:8678/mcp"
}
}
}Core text search works without an embedding service. Semantic search uses a configured HTTP embedding provider such as llama-server or Ollama when one is available.
Usage
After the MCP client connects, use the session prompts and tools directly:
/session-buddy:start
/session-buddy:checkpoint
/session-buddy:quick_search
/session-buddy:store_reflection
/session-buddy:endThe primary MCP tools are start, checkpoint, status, end,
quick_search, search_summary, search_by_file, search_by_concept, and
store_reflection. Claude Code shortcuts such as /start, /checkpoint, and
/end may be generated under ~/.claude/commands/ after initialization.
Configuration
Session-Buddy uses Oneiric's layered settings model together with the repository's flat YAML compatibility layer. The project files are:
settings/session-buddy.yaml— committed defaultssettings/local.yaml— gitignored checkout-local overridessettings/lite.yamlandsettings/standard.yaml— mode-specific defaults
Oneiric also checks user-level files:
${XDG_CONFIG_HOME:-~/.config}/session-buddy/config.yaml${XDG_CONFIG_HOME:-~/.config}/session-buddy/local.yaml
Environment variables use the SESSION_BUDDY_ prefix. Nested settings use
double underscores, for example:
SESSION_BUDDY_LOG_LEVEL=DEBUG
SESSION_BUDDY__DATABASE_PATH=/tmp/session-buddy.duckdb
SESSION_BUDDY_TOOL_PROFILE=standardRuntime data defaults to ~/.claude/data/reflection.duckdb, logs to
~/.claude/logs/, and Oneiric snapshots to .oneiric_cache/ in the configured
cache location.
Core session and text-search workflows do not require an external service. Embedding providers, LLM providers, and ecosystem integrations are optional and configured through the same settings and environment layers.
Memory System
Session-Buddy stores conversation context and reflections in a local DuckDB database by default. Text search, project filtering, time-aware retrieval, and reflection statistics are available locally. Semantic search is optional and uses a configured HTTP embedding provider when enabled. See Configuration for the default paths and overrides.
Session Workflow
Start or connect the MCP server.
Run
/session-buddy:startwhen explicit initialization is needed.Use
/session-buddy:checkpointduring longer work sessions.Search prior work with
/session-buddy:quick_searchor/session-buddy:search_summary.Store important conclusions with
/session-buddy:store_reflection.Run
/session-buddy:endwhen the session is complete.
Bodai Integration
When deployed inside the Bodai ecosystem, Session-Buddy works as the session-lifecycle and knowledge-capture layer for the Bodai components: Mahavishnu orchestration, Akosha cross-system analytics, Crackerjack quality signals, and the oneiric configuration and adapter patterns shared across components. The standalone install is unaffected — Bodai adds no special-case overrides; consumers connect through the same MCP tools and DuckDB-backed store they would in any other Claude Code environment.
Documentation
Troubleshooting
Check the service and dependency probes first:
uv run session-buddy server status
uv run session-buddy health --json
uv run session-buddy doctor --jsonIf the MCP client cannot connect, confirm that the service is listening on
127.0.0.1:8678 and that the client URL ends in /mcp. Use
SESSION_BUDDY_LOG_LEVEL=DEBUG for more detailed logging.
For memory or embedding issues, start with text search and then verify the
configured embedding provider and its endpoint. For configuration problems,
check the project YAML files, the Oneiric XDG files, and the effective
SESSION_BUDDY_* environment variables.
License
BSD 3-Clause License. See LICENSE.
Acknowledgements
Session-Buddy is built on open-source foundations including FastMCP, Oneiric, mcp-common, DuckDB, Typer, and Prometheus client.
Available Tools
6 toolsanalyze_codeBDestructive
Comprehensive Python code quality analysis with complexity, dead code, clone detection, and coupling metrics
Inputs: path (required), analyses, recursive.
check_complexityBDestructive
Analyze cyclomatic complexity of Python functions
Inputs: path (required), max_complexity, min_complexity, show_details.
check_couplingADestructive
Analyze class coupling (CBO - Coupling Between Objects) metrics
Inputs: path (required).
detect_clonesBDestructive
Detect code clones using APTED tree edit distance and LSH acceleration
Inputs: path (required), group_clones, min_lines, similarity_threshold.
find_dead_codeBDestructive
Find unreachable code using Control Flow Graph (CFG) analysis
Inputs: path (required), min_severity.
get_health_scoreBDestructive
Get overall code health score (0-100) with grade and category scores
Inputs: path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
The tools have overlapping purposes that could cause confusion, particularly between analyze_code and the more specific tools like check_complexity and check_coupling. While descriptions clarify their focus, an agent might struggle to choose between analyze_code (which includes complexity and coupling) and the dedicated tools, leading to potential misselection.
All tool names follow a consistent verb_noun pattern (e.g., analyze_code, check_complexity, detect_clones), using snake_case throughout. This predictability makes it easy for agents to parse and understand the naming conventions without confusion.
With 6 tools, the count is well-scoped for a code analysis server, covering key aspects like complexity, coupling, clones, and dead code. Each tool appears to earn its place without feeling excessive or insufficient for the domain.
The tool set provides good coverage for code quality analysis, including metrics, clone detection, and dead code. A minor gap exists in areas like code style or security analysis, but agents can likely work around this with the available tools for core workflows.
Maintenance
Related MCP Connectors
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Capture coding-agent sessions and resume them in any other agent: Claude Code, Codex, Cursor, more.
Shared work memory for Claude Code, Codex, Cursor and chat, scoped to each repository.
Persistent context for Claude. Your AI always knows your projects and next actions across sessions.
Related MCP Servers
- AlicenseAqualityDmaintenanceProvides Claude Code with programmatic session awareness to track context usage, session history, and task progress. It enables intelligent context reset recommendations and automatic synchronization of project planning documentation.5MIT
- AlicenseNot gradedqualityDmaintenanceProvides persistent memory for Claude Code, automatically extracting and surfacing relevant context from past sessions to avoid re-explaining issues and decisions.MIT
- AlicenseCqualityDmaintenanceProvides long-term memory and lossless context management for Claude Code, enabling automatic context compression, cross-session memory sharing, and semantic search across all history.10MIT
- FlicenseNot gradedqualityCmaintenanceProvides persistent local memory of Claude Code sessions with TODO management and searchable activity logs via MCP tools.-