Claude-skill-registry cass
Coding Agent Session Search - unified CLI/TUI to index and search local coding agent history from Claude Code, Codex, Gemini, Cursor, Aider, ChatGPT, Pi-Agent, Factory, and more. Purpose-built for AI agent consumption with robot mode.
git clone https://github.com/majiayu000/claude-skill-registry
T=$(mktemp -d) && git clone --depth=1 https://github.com/majiayu000/claude-skill-registry "$T" && mkdir -p ~/.claude/skills && cp -r "$T/skills/data/cass" ~/.claude/skills/majiayu000-claude-skill-registry-cass && rm -rf "$T"
skills/data/cass/SKILL.mdCASS - Coding Agent Session Search
Unified, high-performance CLI/TUI to index and search your local coding agent history. Aggregates sessions from 11 agents: Codex, Claude Code, Gemini CLI, Cline, OpenCode, Amp, Cursor, ChatGPT, Aider, Pi-Agent, and Factory (Droid).
CRITICAL: Robot Mode Required for AI Agents
NEVER run bare
- it launches an interactive TUI that blocks your session!cass
# WRONG - blocks terminal cass # CORRECT - JSON output for agents cass search "query" --robot cass search "query" --json # alias
Always use
or --robot
flags for machine-readable output.--json
Quick Reference for AI Agents
Pre-Flight Check
# Health check (exit 0=healthy, 1=unhealthy, <50ms) cass health # If unhealthy, rebuild index cass index --full
Essential Commands
# Search with JSON output cass search "authentication error" --robot --limit 5 # Search with metadata (elapsed_ms, cache stats, freshness) cass search "error" --robot --robot-meta # Minimal payload (path, line, agent only) cass search "bug" --robot --fields minimal # View source at specific line cass view /path/to/session.jsonl -n 42 --json # Expand context around a line cass expand /path/to/session.jsonl -n 42 -C 5 --json # Capabilities discovery cass capabilities --json # Full API schema cass introspect --json # LLM-optimized documentation cass robot-docs guide cass robot-docs commands cass robot-docs schemas cass robot-docs examples cass robot-docs exit-codes
Why Use CASS
Cross-Agent Knowledge Transfer
Your coding agents create scattered knowledge:
- Claude Code sessions in
~/.claude/projects - Codex sessions in
~/.codex/sessions - Cursor state in SQLite databases
- Aider history in markdown files
CASS unifies all of this into a single searchable index. When you're stuck on a problem, search across ALL your past agent sessions to find relevant solutions.
Use Cases
# "I solved this before..." cass search "TypeError: Cannot read property" --robot --days 30 # Cross-agent learning (what has ANY agent said about X?) cass search "authentication" --robot --workspace /path/to/project # Agent-to-agent handoff cass search "database migration" --robot --fields summary # Daily review cass timeline --today --json
Command Reference
Indexing
# Full rebuild of DB and search index cass index --full # Incremental update (since last scan) cass index # Watch mode: auto-reindex on file changes cass index --watch # Force rebuild even if schema unchanged cass index --full --force-rebuild # Safe retries with idempotency key cass index --full --idempotency-key "build-$(date +%Y%m%d)" # JSON output with stats cass index --full --json
Search
# Basic search (JSON output required for agents!) cass search "query" --robot # With filters cass search "error" --robot --agent claude --days 7 cass search "bug" --robot --workspace /path/to/project cass search "panic" --robot --today # Time filters cass search "auth" --robot --since 2024-01-01 --until 2024-01-31 cass search "test" --robot --yesterday cass search "fix" --robot --week # Wildcards cass search "auth*" --robot # prefix: authentication, authorize cass search "*tion" --robot # suffix: authentication, exception cass search "*config*" --robot # substring: misconfigured # Token budget management (critical for LLMs!) cass search "error" --robot --fields minimal # path, line, agent only cass search "error" --robot --fields summary # adds title, score cass search "error" --robot --max-content-length 500 # truncate fields cass search "error" --robot --max-tokens 2000 # soft budget (~4 chars/token) cass search "error" --robot --limit 5 # cap results # Pagination (cursor-based) cass search "TODO" --robot --robot-meta --limit 20 # Use _meta.next_cursor from response: cass search "TODO" --robot --robot-meta --limit 20 --cursor "eyJ..." # Match highlighting cass search "authentication error" --robot --highlight # Query analysis/debugging cass search "auth*" --robot --explain # parsed query, cost estimates cass search "auth error" --robot --dry-run # validate without executing # Aggregations cass search "error" --robot --aggregate agent,workspace,date # Request correlation cass search "bug" --robot --request-id "req-12345" # Source filtering (for multi-machine setups) cass search "auth" --robot --source laptop cass search "error" --robot --source remote
Session Analysis
# Export conversation to markdown/HTML/JSON cass export /path/to/session.jsonl --format markdown -o conversation.md cass export /path/to/session.jsonl --format html -o conversation.html cass export /path/to/session.jsonl --format json --include-tools # Expand context around a line (from search result) cass expand /path/to/session.jsonl -n 42 -C 5 --json # Shows 5 messages before and after line 42 # View source at line cass view /path/to/session.jsonl -n 42 --json # Activity timeline cass timeline --today --json --group-by hour cass timeline --days 7 --json --agent claude cass timeline --since 7d --json # Find related sessions for a file cass context /path/to/source.ts --json
Status & Diagnostics
# Quick health (<50ms) cass health cass health --json # Full status snapshot cass status --json cass state --json # alias # Statistics cass stats --json cass stats --by-source # for multi-machine # Full diagnostics cass diag --verbose
Remote Sources (Multi-Machine Search)
Search across sessions from multiple machines via SSH/rsync:
# Add a remote machine cass sources add user@laptop.local --preset macos-defaults cass sources add dev@workstation --path ~/.claude/projects --path ~/.codex/sessions # List sources cass sources list --json # Sync sessions cass sources sync cass sources sync --source laptop --verbose # Check connectivity cass sources doctor cass sources doctor --source laptop --json # Path mappings (rewrite remote paths to local) cass sources mappings list laptop cass sources mappings add laptop --from /home/user/projects --to /Users/me/projects cass sources mappings test laptop /home/user/projects/myapp/src/main.rs # Remove source cass sources remove laptop --purge -y
Configuration stored in
~/.config/cass/sources.toml (Linux) or ~/Library/Application Support/cass/sources.toml (macOS).
Shell Completions
cass completions bash > ~/.local/share/bash-completion/completions/cass cass completions zsh > "${fpath[1]}/_cass" cass completions fish > ~/.config/fish/completions/cass.fish cass completions powershell >> $PROFILE
Robot Mode Deep Dive
Self-Documenting API
CASS teaches agents how to use itself:
# Quick capability check cass capabilities --json # Returns: features, connectors, limits # Full API schema cass introspect --json # Returns: all commands, arguments, response shapes # Topic-based docs (LLM-optimized) cass robot-docs commands # all commands and flags cass robot-docs schemas # response JSON schemas cass robot-docs examples # copy-paste invocations cass robot-docs exit-codes # error handling cass robot-docs guide # quick-start walkthrough
Forgiving Syntax (Agent-Friendly)
CASS auto-corrects common mistakes:
| What you type | What CASS understands |
|---|---|
| (typo corrected) |
| (single-dash fixed) |
| (case normalized) |
| (alias resolved) |
| (Levenshtein <=2) |
Command Aliases:
,find
,query
,q
,lookup
->grepsearch
,ls
,list
,info
->summarystats
,st
->statestatus
,reindex
,idx
->rebuildindex
,show
,get
->readview
,docs
,help-robot
->robotdocsrobot-docs
Output Formats
# Pretty-printed JSON (default) cass search "error" --robot # Streaming JSONL (header + one hit per line) cass search "error" --robot-format jsonl # Compact single-line JSON cass search "error" --robot-format compact # With performance metadata cass search "error" --robot --robot-meta
Design principle: stdout = JSON only; diagnostics go to stderr.
Token Budget Management
LLMs have context limits. Control output size:
| Flag | Effect |
|---|---|
| Only , , |
| Adds , |
| Custom field selection |
| Truncate long fields (UTF-8 safe) |
| Soft budget (~4 chars/token) |
| Cap number of results |
Truncated fields include
*_truncated: true indicator.
Structured Error Handling
Errors are JSON with actionable hints:
{ "error": { "code": 3, "kind": "index_missing", "message": "Search index not found", "hint": "Run 'cass index --full' to build the index", "retryable": false } }
Exit Codes
| Code | Meaning | Action |
|---|---|---|
| 0 | Success | Parse stdout |
| 1 | Health check failed | Run |
| 2 | Usage error | Fix syntax (hint provided) |
| 3 | Index/DB missing | Run |
| 4 | Network error | Check connectivity |
| 5 | Data corruption | Run |
| 6 | Incompatible version | Update cass |
| 7 | Lock/busy | Retry later |
| 8 | Partial result | Increase |
| 9 | Unknown error | Check flag |
Response Shapes
Search Response:
{ "query": "error", "limit": 10, "offset": 0, "count": 5, "total_matches": 42, "hits": [ { "source_path": "/path/to/session.jsonl", "line_number": 123, "agent": "claude_code", "workspace": "/projects/myapp", "title": "Authentication debugging", "snippet": "The error occurs when...", "score": 0.85, "match_type": "exact", "created_at": "2024-01-15T10:30:00Z" } ], "_meta": { "elapsed_ms": 12, "cache_hit": true, "wildcard_fallback": false, "next_cursor": "eyJ...", "index_freshness": { "stale": false, "age_seconds": 120 } } }
Status Response:
{ "healthy": true, "recommended_action": null, "index": { "exists": true, "fresh": true, "age_seconds": 120 }, "database": { "conversations": 500, "messages": 10000 }, "pending": { "sessions": 0, "watch_active": true } }
Query Language
Basic Queries
| Query | Matches |
|---|---|
| Messages containing "error" (case-insensitive) |
| Both "python" AND "error" |
| Exact phrase |
Wildcard Patterns
| Pattern | Type | Performance |
|---|---|---|
| Prefix | Fast (edge n-grams) |
| Suffix | Slower (regex) |
| Substring | Slowest (regex) |
Match Types
Results include
match_type:
| Type | Meaning | Score Boost |
|---|---|---|
| Verbatim match | Highest |
| Via prefix expansion | High |
| Via suffix pattern | Medium |
| Via substring pattern | Lower |
| Auto-fallback (sparse results) | Lowest |
Auto-Fuzzy Fallback
When exact query returns <3 results, CASS automatically retries with wildcards:
->auth*auth*- Results flagged with
wildcard_fallback: true
Supported Agents (11 Connectors)
| Agent | Location | Format |
|---|---|---|
| Claude Code | | JSONL |
| Codex | | JSONL (Rollout) |
| Gemini CLI | | JSON |
| Cline | VS Code global storage | Task directories |
| OpenCode | directories | SQLite |
| Amp | + VS Code | Mixed |
| Cursor | | SQLite (state.vscdb) |
| ChatGPT | | JSON (v1 unencrypted) |
| Aider | + per-project | Markdown |
| Pi-Agent | | JSONL with thinking |
| Factory (Droid) | | JSONL by workspace |
Note: ChatGPT v2/v3 are AES-256-GCM encrypted (keychain access required). Legacy v1 unencrypted conversations are indexed automatically.
TUI Features (for Humans)
Launch with
cass (no flags):
Keyboard Shortcuts
Navigation:
: Move selectionUp/Down
: Switch panesLeft/Right
: Cycle focusTab/Shift+Tab
: Open inEnter$EDITOR
: Full-screen detail viewSpace
Filtering:
: Agent filterF3
: Workspace filterF4
: Time filtersF5/F6
: Cycle presets (24h/7d/30d/all)Shift+F5
: Clear all filtersCtrl+Del
Modes:
: Toggle dark/light themeF2
: Context window size (S/M/L/XL)F7
: Match mode (prefix/standard)F9
: Ranking mode (recent/balanced/relevance/quality/newest/oldest)F12
: Toggle border styleCtrl+B
Actions:
: Toggle selectionm
: Select allCtrl+A
: Add to queueCtrl+Enter
: Open all queuedCtrl+O
: Copy path/contenty
: Find in detail pane/
: Next/prev matchn/N
: Command paletteCtrl+P
: Load saved view1-9
: Save view to slotShift+1-9
Source Filtering (multi-machine):
: Cycle source filter (all/local/remote)F11
: Source selection menuShift+F11
Ranking Modes
Cycle with
F12 in TUI or use --ranking flag:
| Mode | Formula | Best For |
|---|---|---|
| Recent Heavy | | "What was I working on?" |
| Balanced | | General search |
| Relevance | | "Best explanation of X" |
| Match Quality | Penalizes fuzzy matches | Precise technical searches |
| Date Newest | Pure chronological | Recent activity |
| Date Oldest | Reverse chronological | "When did I first..." |
Optional Semantic Search
Local-only semantic search using MiniLM (no cloud):
Required files (place in data directory):
model.onnxtokenizer.jsonconfig.jsonspecial_tokens_map.jsontokenizer_config.json
Vector index stored as
vector_index/index-minilm-384.cvvi.
CASS does NOT auto-download models; you must manually install them.
Bookmarks
Save important results for later:
# Bookmarks stored in SQLite: ~/.local/share/coding-agent-search/bookmarks.db
In TUI: Press
b to bookmark, add notes and tags.
Bookmark structure:
: Short descriptiontitle
,source_path
,line_number
,agentworkspace
: Your annotationsnote
: Comma-separated labelstags
: Extracted contentsnippet
Watch Mode
Real-time index updates:
cass index --watch
- Debounce: 2 seconds (wait for burst to settle)
- Max wait: 5 seconds (force flush during continuous activity)
- Incremental: Only re-scans modified files
TUI automatically starts watch mode in background.
Performance Characteristics
| Operation | Latency |
|---|---|
| Prefix search (cached) | 2-8ms |
| Prefix search (cold) | 40-60ms |
| Substring search | 80-200ms |
| Full reindex | 5-30s |
| Incremental reindex | 50-500ms |
| Health check | <50ms |
Memory: 70-140MB typical (50K messages) Disk: ~600 bytes/message (including n-gram overhead)
Environment Variables
| Variable | Purpose |
|---|---|
| Override data directory |
| Base64 key for encrypted ChatGPT |
| Override Pi-Agent sessions path |
| Per-shard cache entries (default 256) |
| Total cached hits (default 2048) |
| Enable cache debug logging |
| Skip update checks |
Integration with CASS Memory (cm)
CASS provides episodic memory (raw sessions). CM extracts procedural memory (rules and playbooks):
# 1. CASS indexes raw sessions cass index --full # 2. Search for relevant past experience cass search "authentication timeout" --robot --limit 10 # 3. CM reflects on sessions to extract rules cm reflect
Troubleshooting
| Issue | Solution |
|---|---|
| "missing index" | |
| Stale warning | Rerun index or enable watch |
| Empty results | Check , verify connectors detected |
| JSON parsing errors | Use |
| Watch not triggering | Check , verify file event support |
| Reset TUI state | or |
Ready-to-Paste AGENTS.md Blurb
## cass - Coding Agent Session Search Search all your agent histories (Claude, Codex, Cursor, Gemini, Aider, etc.) from a unified index. **NEVER run bare `cass`** - it launches an interactive TUI. Always use `--robot` or `--json`. ### Quick Start cass health # Pre-flight check cass search "auth error" --robot --limit 5 # Search cass view /path/session.jsonl -n 42 --json # View result cass expand /path/session.jsonl -n 42 -C 3 --json # Context ### Key Flags | Flag | Purpose | |------|---------| | --robot / --json | Machine-readable output (required!) | | --fields minimal | Reduce payload size | | --limit N | Cap results | | --agent NAME | Filter by agent | | --days N | Recent N days | stdout = JSON only, stderr = diagnostics. Exit 0 = success.
Installation
# One-liner install curl -fsSL https://raw.githubusercontent.com/Dicklesworthstone/coding_agent_session_search/main/install.sh \ | bash -s -- --easy-mode --verify # Windows irm https://raw.githubusercontent.com/Dicklesworthstone/coding_agent_session_search/main/install.ps1 | iex