什么是 Afterpaths?
用于总结与检索 coding sessions,从发现中提炼规则,并对 coding agents 做基准评测。
README
Afterpaths
Smarter with every session, automatically.
Extract rules from what worked. Track what didn't. Find the best models for your stack.
You're running Claude Code, Cursor and Codex, but which model actually works best for your stack? What approaches lead to breakthroughs vs. expensive dead ends? How do you stop your agents from making the same mistakes?
Afterpaths gives you a single view across all your AI coding tools: compare what's working, capture discoveries as rules, and guide your agent team away from costly diversions.

What you're seeing:
ap audit— Overview of your sessions, models used, and rule statusap show 5 --raw— Raw session transcript (the messy JSONL data, made readable)ap show 5— LLM-generated summary extracting discoveries, dead ends, and decisionshead .claude/rules/gotchas.md— Rules automatically extracted and ready for Claude's next session
The Problem
You're managing multiple agents - retaining critical context and learning from sessions is painful:
- Repeated mistakes — Your agents hit the same gotchas. Three weeks later, same dead end, same wasted tokens.
- No cross-tool visibility — Is Opus actually better than Sonnet for your codebase? Is Cursor outperforming Claude Code? You're guessing.
- Rules are tedious — After a costly diversion, the last thing you want is to write a CLAUDE.md rule. So you don't. And the knowledge evaporates.
- Sessions vanish — Session content is obscurely logged and hard to extract. Then it's often auto-deleted after 30 days. That breakthrough architecture decision? Context gone.
Afterpaths captures sessions across tools, surfaces what's working, and generates rules automatically—so your agents learn from every session, and you retain all your rich session context.
How It Works
Your Sessions Afterpaths
─────────────── ────────────────────────────────────
Claude Code ──► ap log ──► Browse sessions across IDEs
Cursor ap stats ──► Analytics: tokens, activity, errors
Codex ap summarize──► Session summaries (what happened)
ap rules ──► Rule files (what to remember)
ap search ──► Find past discussions & discoveries
│
▼
.claude/rules/ · .cursor/rules/
│
▼
Your next session is smarter
Quick Start
pip install afterpaths
# Navigate to your project (rules are project-specific)
cd ~/code/your-project
# Run audit to see what you have
ap audit
The audit shows your sessions across all tools, model performance, and whether you have rules set up. No API key needed.
From there, the recommended flow:
# 1. Browse sessions and find significant work
ap log
# 2. Summarize important sessions (requires API key)
export ANTHROPIC_API_KEY="sk-ant-..."
ap summarize 1
# 3. Extract rules from summaries → .claude/rules/
ap rules
# 4. Search across past sessions
ap search "database schema"
ap search "auth" --deep # also search raw transcripts
# 5. Track ongoing performance
ap stats
ap stats --daily
Tip:
apis the short alias forafterpaths. Both work identically.
All commands support --json for structured output (e.g., ap log --json, ap show 1 --json, ap search "query" --json).
See docs/commands.md for the full command reference and recipes.
From Session to Rules
Real example: A bug causing 76 missing sessions became a rule that prevents the same mistake.
While building afterpaths, sessions for a project weren't showing up. The path (let's call it) /Users/Code/foo_bar was being decoded as /Users/Code/foo/bar. After investigation, we discovered Claude Code uses lossy path encoding—both / and _ become -.
The summary captured the discovery:
## Discoveries
- **Claude Code's path encoding is lossy**: Project paths in `~/.claude/projects/`
are encoded by replacing `/` with `-`, but underscores are ALSO converted to
hyphens. Three different paths encode identically:
- `/Users/Code/foo_bar` → `-Users-Code-foo-bar`
- `/Users/Code/foo-bar` → `-Users-Code-foo-bar`
- `/Users/Code/foo/bar` → `-Users-Code-foo-bar`
ap rules extracted it into .claude/rules/gotchas.md:
- **Claude Code lossy path encoding**: Claude Code encodes project paths by
replacing both `/` and `_` with `-`, making them indistinguishable when
decoding. When decoding, try underscore variants alongside hyphen variants
at each greedy step, preferring longer segments (single directories) over
nested paths.
_Source: 91b1ffbc_
Next time Claude works on path decoding in this codebase, it already knows about the lossy encoding—no need to rediscover it.
Why Afterpaths
| Without | With Afterpaths |
|---|---|
| Discover gotcha, forget to document it | ap summarize captures it with full context |
| Hit the same issue 3 weeks later | Rule in .claude/rules/ prevents it |
| No idea what's working | ap stats shows tokens, sessions, error rates |
| Sessions scattered across IDEs | ap log unified view across Claude + Cursor |
| Learnings siloed per tool | Rules sync to .claude/rules/ and .cursor/rules/ |
What Gets Extracted
| Category | What it captures | Example |
|---|---|---|
| Dead Ends | Approaches that failed | "Don't use X because Y" |
| Decisions | Architectural choices | "We chose Redis over Postgres because..." |
| Gotchas | Non-obvious warnings | "Watch out for X when doing Y" |
| Patterns | Techniques that worked | "For X, use pattern Y" |
Each rule includes source session references so you can trace back to the original context.
Supported Tools
| Tool | Status | Location |
|---|---|---|
| Claude Code | ✅ Ready | ~/.claude/projects/*.jsonl |
| Cursor | ✅ Ready | ~/Library/Application Support/Cursor/User/workspaceStorage/ |
| Codex CLI | ✅ Ready | ~/.codex/ |
MCP Server
Afterpaths includes an MCP server that puts session history directly into your agent's tool list. Instead of relying on agents to discover the CLI, the MCP server makes session search, summaries, and rules available as native tools.
# Install with MCP support
pip install afterpaths[mcp]
# Add to Claude Code
claude mcp add afterpaths -- afterpaths-mcp
# Or run directly
python -m afterpaths.mcp_server
Tools exposed:
| Tool | Description |
|---|---|
afterpaths_list_sessions | List recent sessions for context recovery |
afterpaths_show_session | Read session summaries and transcripts |
afterpaths_summarize | Generate summaries for sessions |
afterpaths_search | Search across past sessions |
afterpaths_get_rules | Get extracted rules (dead ends, decisions, etc.) |
Once configured, agents can ask "have we seen this before?" or "what were the dead ends?" and get answers from your session history.
Privacy
- All local — Summaries and rules stay in your project
- Your API key — Uses your Anthropic/OpenAI key
- Read-only — Never modifies your source code
- Gitignored —
.afterpaths/excluded by default
Storage
your-project/
├── .afterpaths/ # Summaries (gitignored)
│ ├── summaries/
│ └── meta.json
├── .claude/
│ └── rules/ # Generated rules (commit these!)
│ ├── dead-ends.md
│ ├── gotchas.md
│ └── patterns.md
└── src/
Roadmap
- Claude Code session parsing
- Cursor session support
- Session analytics (tokens, errors, daily trends)
- LLM summarization
- Automatic rule extraction
- Multi-target export (Claude, Cursor)
- Codex CLI support
- Cross-session search (
ap search) - JSON output (
--jsonflag) - MCP server for agent integration
- Semantic search across sessions
- Benchmarking and productivity insights
License
MIT
Manage your AI coding agents. Learn what works. Stop repeating mistakes.
<!-- mcp-name: io.github.burnssa/afterpaths -->常见问题
Afterpaths 是什么?
用于总结与检索 coding sessions,从发现中提炼规则,并对 coding agents 做基准评测。
相关 Skills
Claude接口
by anthropics
面向接入 Claude API、Anthropic SDK 或 Agent SDK 的开发场景,自动识别项目语言并给出对应示例与默认配置,快速搭建 LLM 应用。
✎ 想把Claude能力接进应用或智能体,用claude-api上手快、兼容Anthropic与Agent SDK,集成路径清晰又省心
RAG架构师
by alirezarezvani
聚焦生产级RAG系统设计与优化,覆盖文档切块、检索链路、索引构建、召回评估等关键环节,适合搭建可扩展、高准确率的知识库问答与检索增强应用。
✎ 面向RAG落地,把知识库、向量检索和生成链路系统串联起来,做架构设计时更清晰,也更少踩坑。
计算机视觉
by alirezarezvani
聚焦目标检测、图像分割与视觉系统落地,覆盖 YOLO、DETR、Mask R-CNN、SAM 等方案,适合定制数据集训练、推理优化及 ONNX/TensorRT 部署。
✎ 把目标检测、图像分割到推理部署串成完整工程链路,主流框架与 YOLO、DETR、SAM 等方案都覆盖,落地视觉 AI 会省心很多。
相关 MCP Server
顺序思维
编辑精选by Anthropic
Sequential Thinking 是让 AI 通过动态思维链解决复杂问题的参考服务器。
✎ 这个服务器展示了如何让 Claude 像人类一样逐步推理,适合开发者学习 MCP 的思维链实现。但注意它只是个参考示例,别指望直接用在生产环境里。
知识图谱记忆
编辑精选by Anthropic
Memory 是一个基于本地知识图谱的持久化记忆系统,让 AI 记住长期上下文。
✎ 帮 AI 和智能体补上“记不住”的短板,用本地知识图谱沉淀长期上下文,连续对话更聪明,数据也更可控。
PraisonAI
编辑精选by mervinpraison
PraisonAI 是一个支持自反思和多 LLM 的低代码 AI 智能体框架。
✎ 如果你需要快速搭建一个能 24/7 运行的 AI 智能体团队来处理复杂任务(比如自动研究或代码生成),PraisonAI 的低代码设计和多平台集成(如 Telegram)让它上手极快。但作为非官方项目,它的生态成熟度可能不如 LangChain 等主流框架,适合愿意尝鲜的开发者。