Get the FREE Ultimate OpenClaw Setup Guide →

afterpaths

Make your AI coding agents smarter with every session

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio burnssa-afterpaths python -m afterpaths.mcp_server \
  --env OPENAI_API_KEY="OpenAI API key (if using OpenAI models for summarization or rules generation)" \
  --env ANTHROPIC_API_KEY="Anthropic API key (if using Anthropic models for summarization or rules generation)"

How to use

Afterpaths provides an MCP server that exposes your session history and automatically generated rules as native tools for your agent ecosystem. The server is Python-based and serves endpoints that let agents list recent sessions, read session details, generate summaries, search across transcripts, and retrieve extracted rules. Use the exposed tools to help your agents recover context, summarize past work, and understand dead ends so your team can avoid repeating costly detours. Typical usage involves running the server locally within your project and pointing your agent’s tool list to the Afterpaths MCP commands.

Once the MCP server is running, you can invoke these tools within your agent framework:

  • afterpaths_list_sessions: Retrieve a list of recent sessions for context recovery.
  • afterpaths_show_session: Read a specific session’s summary and transcript for deeper inspection.
  • afterpaths_summarize: Generate or refresh a summary for a given session (requires an API key for the LLM backend).
  • afterpaths_search: Search across past sessions and transcripts for relevant discussions or discoveries.
  • afterpaths_get_rules: Retrieve extracted rules (dead ends, decisions, gotchas, patterns) ready to integrate into your agent workflow.

This MCP server keeps everything local to your project (summaries, rules, and session data are stored under your project directory, typically in .afterpaths and related folders). Integrations with Claude Code, Cursor, or Codex CLI can leverage these tools to improve context retention and learning across sessions.

How to install

Prerequisites:

  • Python 3.8+ installed on your system
  • pip available

Step-by-step installation:

  1. Create or activate a Python environment for the project (optional but recommended)

    python -m venv .venv source .venv/bin/activate # macOS/Linux ..venv\Scripts\activate # Windows

  2. Install Afterpaths with MCP support

    pip install afterpaths[mcp]

  3. Run the MCP server directly (no extra setup required)

    python -m afterpaths.mcp_server

    The server will start and expose the available MCP commands for your agent framework.

  4. Optional: add the server to Claude Code or your agent orchestration

    claude mcp add afterpaths -- afterpaths-mcp

Notes:

  • If you need to customize where data is stored, configure the project directory so that .afterpaths and related folders are gitignored as described in the README.
  • Ensure API keys for large language models (Anthropic, OpenAI, etc.) are available in your environment if you plan to run summarize or rule extraction flows.

Additional notes

Tips and considerations:

  • Environment variables: Set ANTHROPIC_API_KEY and/or OPENAI_API_KEY as needed for summarize and rule extraction features. These keys are used by the MCP tools to generate summaries and discovered rules.
  • Local-first storage: All summaries and rules are kept locally within your project (e.g., .afterpaths/ and .claude/rules/). This keeps your data private and versionable if you commit rules manually.
  • Project scope: Rules and summaries are typically project-specific. Run the MCP server from the root of the project to ensure correct scoping.
  • CLI usage: All Afterpaths MCP commands support --json for structured output, which is useful for programmatic integration with agents.
  • Troubleshooting: If sessions aren’t showing up, verify that your sessions are being generated by your tools (Claude Code, Cursor, Codex CLI) and that the storage paths align with Afterpaths expectations (e.g., ~/.claude/projects/*.jsonl for Claude, etc.).

Related MCP Servers

Sponsor this space

Reach thousands of developers