ccfolio
Enables searching and browsing past Claude Code conversations directly from within an active Claude session, with full-text search and cost tracking.
README
ccfolio
Index, search, and archive your Claude Code conversations. Tracks cost, exports to Obsidian, and lets you resume past sessions without losing context.
What It Does
Claude Code stores every conversation as JSONL files in ~/.claude/projects/. ccfolio indexes them into a local SQLite database and gives you:
- Full-text search across all conversations, including subagent content
- Cost tracking — daily, monthly, by model, by project
- Obsidian export with Dataview/Bases-compatible frontmatter
- Auto-generated titles from project context and first prompt keywords
- Session resume — hand off directly to
claude --resumeby index, slug, or ID prefix - MCP server — search past sessions from within an active Claude Code conversation
- Subagent linking — agent artifacts linked to parent sessions, not indexed as noise
Install
pip install ccfolio
# With MCP server support
pip install ccfolio[mcp]
Then run setup:
ccfolio config init
This sets your Obsidian vault path and configures the auto-sync hook.
Auto-Sync
Add this to your ~/.zshrc to auto-sync after every Claude Code session:
claude() {
command claude "$@"
ccfolio update --quiet
}
After that, ccfolio runs silently every time you exit a claude session.
Commands
Browse
ccfolio list # All sessions, newest first
ccfolio list --recent 20 # Last 20
ccfolio list --sort cost # Most expensive first
ccfolio list --sort messages # Most messages first
ccfolio list --favorites # Only favorites
ccfolio list --model opus # Filter by model
ccfolio list --after 2026-02-01 # After a date
Search
ccfolio search "tailscale"
ccfolio search "hypothesis engine"
ccfolio search "CLAUDE.md"
Searches user messages, assistant responses, summaries, file paths, and subagent content. Supports partial words — ccfolio search "folio" finds sessions containing "ccfolio".
# Find sessions that touched a specific file
ccfolio files "CLAUDE.md"
ccfolio files "fetch_daily.py"
View
ccfolio show #1 # By list index
ccfolio show giggly-pondering # By slug (partial match works)
ccfolio show 0c560d # By ID prefix
ccfolio show #1 --raw # Raw JSON record
Resume
ccfolio resume #1 # Resume most recent session
ccfolio resume giggly-pondering # Resume by slug
ccfolio resume #3 --fork # Fork into a new session
Resolves the session and hands off to claude --resume. Never loses context.
Cost
ccfolio cost # Daily breakdown
ccfolio cost --monthly # Monthly breakdown
ccfolio cost --model # By model
ccfolio cost --project # By project directory
ccfolio cost --after 2026-02-01 # Date range
Shows estimated API cost alongside your usage. Useful for understanding where tokens go even on a Max subscription.
Stats
ccfolio stats # Overview: sessions, messages, tokens, cost
ccfolio stats --tools # Tool usage breakdown
Organize
ccfolio fav #3 # Toggle favorite
ccfolio tag #3 infrastructure # Add tags
ccfolio untag #3 infrastructure # Remove tags
ccfolio rename #3 "My Title" # Set custom title
Export to Obsidian
ccfolio export #3 # Export single session
ccfolio export --all # Export all un-exported sessions
ccfolio export --all --force # Re-export everything
ccfolio export --all --redact-paths # Strip username from file paths
Exports happen automatically via ccfolio update. Manual export available for one-offs.
MCP Server
ccfolio can run as an MCP server, letting Claude search past sessions from within an active conversation.
Add to ~/.claude.json under your project path:
{
"projects": {
"/Users/yourname": {
"mcpServers": {
"ccfolio": {
"command": "/path/to/.venv/bin/ccfolio",
"args": ["mcp"]
}
}
}
}
}
Available tools: search_sessions, list_recent_sessions, find_sessions_for_file, get_session_details, get_cost_summary.
Session ID Shortcuts
You never need to type a full UUID:
| Format | Example |
|---|---|
Index from last list |
#1, #12 |
| Slug (partial) | giggly, giggly-pondering |
| ID prefix | 0c560d |
Obsidian Output
Exported sessions land in your configured vault path with frontmatter:
type: Claude-Session
session_id: "0c560d4a-..."
slug: giggly-pondering-gem
date: 2026-02-14
model: claude-opus-4-6
messages: 159
tool_calls: 50
cost_usd: 11.95
favorite: false
tags: [Claude-Session, Opus]
Tool calls render as collapsible callouts. File paths to vault notes become wikilinks. Sessions that used subagents get a linked Subagents section.
Auto-Titles
Sessions without a custom /rename title get automatic topic-based names during sync. ccfolio extracts topics from the project directory, most-touched file paths, and first prompt keywords.
Format: Topic1 + Topic2 + Topic3 (max 4 topics). No LLM calls, no API cost.
Requirements
- Python 3.10+
- Claude Code (
claudeCLI) - Obsidian (optional, for vault export)
Configuration
ccfolio config show # View current settings
ccfolio config init # Interactive setup
Config file: ~/.config/ccfolio/config.toml
Database: ~/.config/ccfolio/ccfolio.db
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
mcp-server-qdrant
这个仓库展示了如何为向量搜索引擎 Qdrant 创建一个 MCP (Managed Control Plane) 服务器的示例。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器