[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6ES33Q7NDYSK62GJ6ACEKP9":3,"skill-same:01M6ES33Q7NDYSK62GJ6ACEKP9":82},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":28,"publishedAt":48,"linkOnly":49,"markdownContent":50,"markdownBody":51,"frontMatter":52,"refName":53,"commitSha":54,"skillDirectory":55,"forksCount":56,"repositoryHtmlUrl":57,"repositoryHomepageUrl":58,"ownerHtmlUrl":59,"ownerBlogUrl":6,"ownerDescription":60,"updatedAt":61,"install":62,"resources":75},"01M6ES33Q7NDYSK62GJ6ACEKP9","cass",null,"Coding Agent Session Search - unified CLI\u002FTUI 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.","ComeOnOliver\u002Fskillshub","ComeOnOliver","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F43215937?v=4","01M6E5JNFECJAAVFE0W7SMWWD2","Haoran Shu","01M6E5JNNDQS7AJZDYFQ8TPZCK",67,"MIT","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcass\u002FSKILL.md",[18,23],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},"01JBSEEDCAT000000000000023","Skill与智能体开发","SCENARIO","使用场景",{"categoryNo":24,"categoryName":25,"taxonomyType":26,"taxonomyTypeDesc":27},"01JBSEEDCAT000000000000030","开发工程师","PROFESSION","适用职业",[5,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47],"factory","with","aider","local","robot","session search","session","cursor","pi","cli","history","coding","search","chatgpt","code","ai agent","codex","coding agent","gemini","2026-11-10 10:12:30",false,"---\nname: cass\ndescription: \"Coding Agent Session Search - unified CLI\u002FTUI 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.\"\n---\n\n# CASS - Coding Agent Session Search\n\nUnified, high-performance CLI\u002FTUI 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).\n\n## CRITICAL: Robot Mode Required for AI Agents\n\n**NEVER run bare `cass`** - it launches an interactive TUI that blocks your session!\n\n```bash\n# WRONG - blocks terminal\ncass\n\n# CORRECT - JSON output for agents\ncass search \"query\" --robot\ncass search \"query\" --json  # alias\n```\n\n**Always use `--robot` or `--json` flags for machine-readable output.**\n\n---\n\n## Quick Reference for AI Agents\n\n### Pre-Flight Check\n\n```bash\n# Health check (exit 0=healthy, 1=unhealthy, \u003C50ms)\ncass health\n\n# If unhealthy, rebuild index\ncass index --full\n```\n\n### Essential Commands\n\n```bash\n# Search with JSON output\ncass search \"authentication error\" --robot --limit 5\n\n# Search with metadata (elapsed_ms, cache stats, freshness)\ncass search \"error\" --robot --robot-meta\n\n# Minimal payload (path, line, agent only)\ncass search \"bug\" --robot --fields minimal\n\n# View source at specific line\ncass view \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 --json\n\n# Expand context around a line\ncass expand \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 -C 5 --json\n\n# Capabilities discovery\ncass capabilities --json\n\n# Full API schema\ncass introspect --json\n\n# LLM-optimized documentation\ncass robot-docs guide\ncass robot-docs commands\ncass robot-docs schemas\ncass robot-docs examples\ncass robot-docs exit-codes\n```\n\n---\n\n## Why Use CASS\n\n### Cross-Agent Knowledge Transfer\n\nYour coding agents create scattered knowledge:\n- Claude Code sessions in `~\u002F.claude\u002Fprojects`\n- Codex sessions in `~\u002F.codex\u002Fsessions`\n- Cursor state in SQLite databases\n- Aider history in markdown files\n\nCASS **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.\n\n### Use Cases\n\n```bash\n# \"I solved this before...\"\ncass search \"TypeError: Cannot read property\" --robot --days 30\n\n# Cross-agent learning (what has ANY agent said about X?)\ncass search \"authentication\" --robot --workspace \u002Fpath\u002Fto\u002Fproject\n\n# Agent-to-agent handoff\ncass search \"database migration\" --robot --fields summary\n\n# Daily review\ncass timeline --today --json\n```\n\n---\n\n## Command Reference\n\n### Indexing\n\n```bash\n# Full rebuild of DB and search index\ncass index --full\n\n# Incremental update (since last scan)\ncass index\n\n# Watch mode: auto-reindex on file changes\ncass index --watch\n\n# Force rebuild even if schema unchanged\ncass index --full --force-rebuild\n\n# Safe retries with idempotency key (24h TTL)\ncass index --full --idempotency-key \"build-$(date +%Y%m%d)\"\n\n# JSON output with stats\ncass index --full --json\n```\n\n### Search\n\n```bash\n# Basic search (JSON output required for agents!)\ncass search \"query\" --robot\n\n# With filters\ncass search \"error\" --robot --agent claude --days 7\ncass search \"bug\" --robot --workspace \u002Fpath\u002Fto\u002Fproject\ncass search \"panic\" --robot --today\n\n# Time filters\ncass search \"auth\" --robot --since 2024-01-01 --until 2024-01-31\ncass search \"test\" --robot --yesterday\ncass search \"fix\" --robot --week\n\n# Wildcards\ncass search \"auth*\" --robot          # prefix: authentication, authorize\ncass search \"*tion\" --robot          # suffix: authentication, exception\ncass search \"*config*\" --robot       # substring: misconfigured\n\n# Token budget management (critical for LLMs!)\ncass search \"error\" --robot --fields minimal              # path, line, agent only\ncass search \"error\" --robot --fields summary              # adds title, score\ncass search \"error\" --robot --max-content-length 500      # truncate fields\ncass search \"error\" --robot --max-tokens 2000             # soft budget (~4 chars\u002Ftoken)\ncass search \"error\" --robot --limit 5                     # cap results\n\n# Pagination (cursor-based)\ncass search \"TODO\" --robot --robot-meta --limit 20\n# Use _meta.next_cursor from response:\ncass search \"TODO\" --robot --robot-meta --limit 20 --cursor \"eyJ...\"\n\n# Match highlighting\ncass search \"authentication error\" --robot --highlight\n\n# Query analysis\u002Fdebugging\ncass search \"auth*\" --robot --explain    # parsed query, cost estimates\ncass search \"auth error\" --robot --dry-run  # validate without executing\n\n# Aggregations (server-side counts)\ncass search \"error\" --robot --aggregate agent,workspace,date\n\n# Request correlation\ncass search \"bug\" --robot --request-id \"req-12345\"\n\n# Source filtering (for multi-machine setups)\ncass search \"auth\" --robot --source laptop\ncass search \"error\" --robot --source remote\n\n# Traceability (for debugging agent pipelines)\ncass search \"error\" --robot --trace-file \u002Ftmp\u002Fcass-trace.json\n```\n\n### Session Analysis\n\n```bash\n# Export conversation to markdown\u002FHTML\u002FJSON\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format markdown -o conversation.md\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format html -o conversation.html\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format json --include-tools\n\n# Expand context around a line (from search result)\ncass expand \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 -C 5 --json\n# Shows 5 messages before and after line 42\n\n# View source at line\ncass view \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 --json\n\n# Activity timeline\ncass timeline --today --json --group-by hour\ncass timeline --days 7 --json --agent claude\ncass timeline --since 7d --json\n\n# Find related sessions for a file\ncass context \u002Fpath\u002Fto\u002Fsource.ts --json\n```\n\n### Status & Diagnostics\n\n```bash\n# Quick health (\u003C50ms)\ncass health\ncass health --json\n\n# Full status snapshot\ncass status --json\ncass state --json  # alias\n\n# Statistics\ncass stats --json\ncass stats --by-source  # for multi-machine\n\n# Full diagnostics\ncass diag --verbose\n```\n\n---\n\n## Aggregation & Analytics\n\nAggregate search results server-side to get counts and distributions without transferring full result data:\n\n```bash\n# Count results by agent\ncass search \"error\" --robot --aggregate agent\n# → { \"aggregations\": { \"agent\": { \"buckets\": [{\"key\": \"claude_code\", \"count\": 45}, ...] } } }\n\n# Multi-field aggregation\ncass search \"bug\" --robot --aggregate agent,workspace,date\n\n# Combine with filters\ncass search \"TODO\" --agent claude --robot --aggregate workspace\n```\n\n| Aggregation Field | Description |\n|-------------------|-------------|\n| `agent` | Group by agent type (claude_code, codex, cursor, etc.) |\n| `workspace` | Group by workspace\u002Fproject path |\n| `date` | Group by date (YYYY-MM-DD) |\n| `match_type` | Group by match quality (exact, prefix, fuzzy) |\n\nTop 10 buckets returned per field, with `other_count` for remaining items.\n\n---\n\n## Remote Sources (Multi-Machine Search)\n\nSearch across sessions from multiple machines via SSH\u002Frsync.\n\n### Setup Wizard (Recommended)\n\n```bash\ncass sources setup\n```\n\nThe wizard:\n1. Discovers SSH hosts from `~\u002F.ssh\u002Fconfig`\n2. Probes each for agent data and cass installation\n3. Optionally installs cass on remotes\n4. Indexes sessions on remotes\n5. Configures `sources.toml`\n6. Syncs data locally\n\n```bash\ncass sources setup --hosts css,csd,yto  # Specific hosts only\ncass sources setup --dry-run             # Preview without changes\ncass sources setup --resume              # Resume interrupted setup\n```\n\n### Manual Setup\n\n```bash\n# Add a remote machine\ncass sources add user@laptop.local --preset macos-defaults\ncass sources add dev@workstation --path ~\u002F.claude\u002Fprojects --path ~\u002F.codex\u002Fsessions\n\n# List sources\ncass sources list --json\n\n# Sync sessions\ncass sources sync\ncass sources sync --source laptop --verbose\n\n# Check connectivity\ncass sources doctor\ncass sources doctor --source laptop --json\n\n# Path mappings (rewrite remote paths to local)\ncass sources mappings list laptop\ncass sources mappings add laptop --from \u002Fhome\u002Fuser\u002Fprojects --to \u002FUsers\u002Fme\u002Fprojects\ncass sources mappings test laptop \u002Fhome\u002Fuser\u002Fprojects\u002Fmyapp\u002Fsrc\u002Fmain.rs\n\n# Remove source\ncass sources remove laptop --purge -y\n```\n\nConfiguration stored in `~\u002F.config\u002Fcass\u002Fsources.toml` (Linux) or `~\u002FLibrary\u002FApplication Support\u002Fcass\u002Fsources.toml` (macOS).\n\n---\n\n## Robot Mode Deep Dive\n\n### Self-Documenting API\n\nCASS teaches agents how to use itself:\n\n```bash\n# Quick capability check\ncass capabilities --json\n# Returns: features, connectors, limits\n\n# Full API schema\ncass introspect --json\n# Returns: all commands, arguments, response shapes\n\n# Topic-based docs (LLM-optimized)\ncass robot-docs commands   # all commands and flags\ncass robot-docs schemas    # response JSON schemas\ncass robot-docs examples   # copy-paste invocations\ncass robot-docs exit-codes # error handling\ncass robot-docs guide      # quick-start walkthrough\ncass robot-docs contracts  # API versioning\ncass robot-docs sources    # remote sources guide\n```\n\n### Forgiving Syntax (Agent-Friendly)\n\nCASS auto-corrects common mistakes:\n\n| What you type | What CASS understands |\n|---------------|----------------------|\n| `cass serach \"error\"` | `cass search \"error\"` (typo corrected) |\n| `cass -robot -limit=5` | `cass --robot --limit=5` (single-dash fixed) |\n| `cass --Robot --LIMIT 5` | `cass --robot --limit 5` (case normalized) |\n| `cass find \"auth\"` | `cass search \"auth\"` (alias resolved) |\n| `cass --limt 5` | `cass --limit 5` (Levenshtein \u003C=2) |\n\n**Command Aliases:**\n- `find`, `query`, `q`, `lookup`, `grep` → `search`\n- `ls`, `list`, `info`, `summary` → `stats`\n- `st`, `state` → `status`\n- `reindex`, `idx`, `rebuild` → `index`\n- `show`, `get`, `read` → `view`\n- `docs`, `help-robot`, `robotdocs` → `robot-docs`\n\n### Output Formats\n\n```bash\n# Pretty-printed JSON (default)\ncass search \"error\" --robot\n\n# Streaming JSONL (header + one hit per line)\ncass search \"error\" --robot-format jsonl\n\n# Compact single-line JSON\ncass search \"error\" --robot-format compact\n\n# With performance metadata\ncass search \"error\" --robot --robot-meta\n```\n\n**Design principle:** stdout = JSON only; diagnostics go to stderr.\n\n### Token Budget Management\n\nLLMs have context limits. Control output size:\n\n| Flag | Effect |\n|------|--------|\n| `--fields minimal` | Only `source_path`, `line_number`, `agent` |\n| `--fields summary` | Adds `title`, `score` |\n| `--fields score,title,snippet` | Custom field selection |\n| `--max-content-length 500` | Truncate long fields (UTF-8 safe) |\n| `--max-tokens 2000` | Soft budget (~4 chars\u002Ftoken) |\n| `--limit 5` | Cap number of results |\n\nTruncated fields include `*_truncated: true` indicator.\n\n---\n\n## Structured Error Handling\n\nErrors are JSON with actionable hints:\n\n```json\n{\n  \"error\": {\n    \"code\": 3,\n    \"kind\": \"index_missing\",\n    \"message\": \"Search index not found\",\n    \"hint\": \"Run 'cass index --full' to build the index\",\n    \"retryable\": false\n  }\n}\n```\n\n### Exit Codes\n\n| Code | Meaning | Action |\n|------|---------|--------|\n| 0 | Success | Parse stdout |\n| 1 | Health check failed | Run `cass index --full` |\n| 2 | Usage error | Fix syntax (hint provided) |\n| 3 | Index\u002FDB missing | Run `cass index --full` |\n| 4 | Network error | Check connectivity |\n| 5 | Data corruption | Run `cass index --full --force-rebuild` |\n| 6 | Incompatible version | Update cass |\n| 7 | Lock\u002Fbusy | Retry later |\n| 8 | Partial result | Increase `--timeout` |\n| 9 | Unknown error | Check `retryable` flag |\n\n---\n\n## Search Modes\n\nThree search modes, selectable with `--mode` flag:\n\n| Mode | Algorithm | Best For |\n|------|-----------|----------|\n| **lexical** (default) | BM25 full-text | Exact term matching, code searches |\n| **semantic** | Vector similarity | Conceptual queries, \"find similar\" |\n| **hybrid** | Reciprocal Rank Fusion | Balanced precision and recall |\n\n```bash\ncass search \"authentication\" --mode lexical --robot\ncass search \"how to handle user login\" --mode semantic --robot\ncass search \"auth error handling\" --mode hybrid --robot\n```\n\n**Hybrid** combines lexical and semantic using RRF:\n```\nRRF_score = Σ 1 \u002F (60 + rank_i)\n```\n\n---\n\n## Pipeline Mode (Chained Search)\n\nChain searches by piping session paths:\n\n```bash\n# Find sessions mentioning \"auth\", then search within those for \"token\"\ncass search \"authentication\" --robot-format sessions | \\\n  cass search \"refresh token\" --sessions-from - --robot\n\n# Build a filtered corpus from today's work\ncass search --today --robot-format sessions > today_sessions.txt\ncass search \"bug fix\" --sessions-from today_sessions.txt --robot\n```\n\nUse cases:\n- **Drill-down**: Broad search → narrow within results\n- **Cross-reference**: Find sessions with term A, then find term B within them\n- **Corpus building**: Save session lists for repeated searches\n\n---\n\n## Query Language\n\n### Basic Queries\n\n| Query | Matches |\n|-------|---------|\n| `error` | Messages containing \"error\" (case-insensitive) |\n| `python error` | Both \"python\" AND \"error\" |\n| `\"authentication failed\"` | Exact phrase |\n\n### Boolean Operators\n\n| Operator | Example | Meaning |\n|----------|---------|---------|\n| `AND` | `python AND error` | Both terms required (default) |\n| `OR` | `error OR warning` | Either term matches |\n| `NOT` | `error NOT test` | First term, excluding second |\n| `-` | `error -test` | Shorthand for NOT |\n\n```bash\n# Complex boolean query\ncass search \"authentication AND (error OR failure) NOT test\" --robot\n\n# Exclude test files\ncass search \"bug fix -test -spec\" --robot\n\n# Either error type\ncass search \"TypeError OR ValueError\" --robot\n```\n\n### Wildcard Patterns\n\n| Pattern | Type | Performance |\n|---------|------|-------------|\n| `auth*` | Prefix | Fast (edge n-grams) |\n| `*tion` | Suffix | Slower (regex) |\n| `*config*` | Substring | Slowest (regex) |\n\n### Match Types\n\nResults include `match_type`:\n\n| Type | Meaning | Score Boost |\n|------|---------|-------------|\n| `exact` | Verbatim match | Highest |\n| `prefix` | Via prefix expansion | High |\n| `suffix` | Via suffix pattern | Medium |\n| `substring` | Via substring pattern | Lower |\n| `fuzzy` | Auto-fallback (sparse results) | Lowest |\n\n### Auto-Fuzzy Fallback\n\nWhen exact query returns \u003C3 results, CASS automatically retries with wildcards:\n- `auth` → `*auth*`\n- Results flagged with `wildcard_fallback: true`\n\n### Flexible Time Input\n\nCASS accepts a wide variety of time\u002Fdate formats:\n\n| Format | Examples |\n|--------|----------|\n| **Relative** | `-7d`, `-24h`, `-30m`, `-1w` |\n| **Keywords** | `now`, `today`, `yesterday` |\n| **ISO 8601** | `2024-11-25`, `2024-11-25T14:30:00Z` |\n| **US Dates** | `11\u002F25\u002F2024`, `11-25-2024` |\n| **Unix Timestamp** | `1732579200` (seconds or milliseconds) |\n\n---\n\n## Ranking Modes\n\nCycle with `F12` in TUI or use `--ranking` flag:\n\n| Mode | Formula | Best For |\n|------|---------|----------|\n| **Recent Heavy** | `relevance*0.3 + recency*0.7` | \"What was I working on?\" |\n| **Balanced** | `relevance*0.5 + recency*0.5` | General search |\n| **Relevance** | `relevance*0.8 + recency*0.2` | \"Best explanation of X\" |\n| **Match Quality** | Penalizes fuzzy matches | Precise technical searches |\n| **Date Newest** | Pure chronological | Recent activity |\n| **Date Oldest** | Reverse chronological | \"When did I first...\" |\n\n### Score Components\n\n- **Text Relevance (BM25)**: Term frequency, inverse document frequency, length normalization\n- **Recency**: Exponential decay (today ~1.0, last week ~0.7, last month ~0.3)\n- **Match Exactness**: Exact phrase=1.0, Prefix=0.9, Suffix=0.8, Substring=0.6, Fuzzy=0.4\n\n### Blended Scoring Formula\n\n```\nFinal_Score = BM25_Score × Match_Quality + α × Recency_Factor\n```\n\n| Mode | α Value | Effect |\n|------|---------|--------|\n| Recent Heavy | 1.0 | Recency dominates |\n| Balanced | 0.4 | Moderate recency boost |\n| Relevance Heavy | 0.1 | BM25 dominates |\n| Match Quality | 0.0 | Pure text matching |\n\n---\n\n## Supported Agents (11 Connectors)\n\n| Agent | Location | Format |\n|-------|----------|--------|\n| **Claude Code** | `~\u002F.claude\u002Fprojects` | JSONL |\n| **Codex** | `~\u002F.codex\u002Fsessions` | JSONL (Rollout) |\n| **Gemini CLI** | `~\u002F.gemini\u002Ftmp` | JSON |\n| **Cline** | VS Code global storage | Task directories |\n| **OpenCode** | `.opencode` directories | SQLite |\n| **Amp** | `~\u002F.local\u002Fshare\u002Famp` + VS Code | Mixed |\n| **Cursor** | `~\u002FLibrary\u002FApplication Support\u002FCursor` | SQLite (state.vscdb) |\n| **ChatGPT** | `~\u002FLibrary\u002FApplication Support\u002Fcom.openai.chat` | JSON (v1 unencrypted) |\n| **Aider** | `~\u002F.aider.chat.history.md` + per-project | Markdown |\n| **Pi-Agent** | `~\u002F.pi\u002Fagent\u002Fsessions` | JSONL with thinking |\n| **Factory (Droid)** | `~\u002F.factory\u002Fsessions` | JSONL by workspace |\n\n**Note:** ChatGPT v2\u002Fv3 are AES-256-GCM encrypted (keychain access required). Legacy v1 unencrypted conversations are indexed automatically.\n\n---\n\n## TUI Features (for Humans)\n\nLaunch with `cass` (no flags):\n\n### Keyboard Shortcuts\n\n**Navigation:**\n- `Up\u002FDown`: Move selection\n- `Left\u002FRight`: Switch panes\n- `Tab\u002FShift+Tab`: Cycle focus\n- `Enter`: Open in `$EDITOR`\n- `Space`: Full-screen detail view\n- `Home\u002FEnd`: Jump to first\u002Flast result\n- `PageUp\u002FPageDown`: Scroll by page\n\n**Filtering:**\n- `F3`: Agent filter\n- `F4`: Workspace filter\n- `F5\u002FF6`: Time filters (from\u002Fto)\n- `Shift+F3`: Scope to current result's agent\n- `Shift+F4`: Clear workspace filter\n- `Shift+F5`: Cycle presets (24h\u002F7d\u002F30d\u002Fall)\n- `Ctrl+Del`: Clear all filters\n\n**Modes:**\n- `F2`: Toggle theme (6 presets)\n- `F7`: Context window size (S\u002FM\u002FL\u002FXL)\n- `F9`: Match mode (prefix\u002Fstandard)\n- `F12`: Ranking mode\n- `Ctrl+B`: Toggle border style\n\n**Selection & Actions:**\n- `m`: Toggle selection\n- `Ctrl+A`: Select all\n- `A`: Bulk actions menu\n- `Ctrl+Enter`: Add to queue\n- `Ctrl+O`: Open all queued\n- `y`: Copy path\u002Fcontent\n- `Ctrl+Y`: Copy all selected\n- `\u002F`: Find in detail pane\n- `n\u002FN`: Next\u002Fprev match\n\n**Views & Palette:**\n- `Ctrl+P`: Command palette\n- `1-9`: Load saved view\n- `Shift+1-9`: Save view to slot\n\n**Source Filtering (multi-machine):**\n- `F11`: Cycle source filter (all\u002Flocal\u002Fremote)\n- `Shift+F11`: Source selection menu\n\n**Global:**\n- `Ctrl+C`: Quit\n- `F1` or `?`: Toggle help\n- `Ctrl+Shift+R`: Force re-index\n- `Ctrl+Shift+Del`: Reset all TUI state\n\n### Detail Pane Tabs\n\n| Tab | Content | Switch With |\n|-----|---------|-------------|\n| **Messages** | Full conversation with markdown | `[` \u002F `]` |\n| **Snippets** | Keyword-extracted summaries | `[` \u002F `]` |\n| **Raw** | Unformatted JSON\u002Ftext | `[` \u002F `]` |\n\n### Context Window Sizing\n\n| Size | Characters | Use Case |\n|------|------------|----------|\n| **Small** | ~200 | Quick scanning |\n| **Medium** | ~400 | Default balanced view |\n| **Large** | ~800 | Longer passages |\n| **XLarge** | ~1600 | Full context, code review |\n\n**Peek Mode** (`Ctrl+Space`): Temporarily expand to XL without changing default.\n\n---\n\n## Theme Presets\n\nCycle through 6 built-in themes with `F2`:\n\n| Theme | Description | Best For |\n|-------|-------------|----------|\n| **Dark** | Tokyo Night-inspired deep blues | Low-light environments |\n| **Light** | High-contrast light background | Bright environments |\n| **Catppuccin** | Warm pastels, reduced eye strain | All-day coding |\n| **Dracula** | Purple-accented dark theme | Popular developer theme |\n| **Nord** | Arctic-inspired cool tones | Calm, focused work |\n| **High Contrast** | Maximum readability | Accessibility needs |\n\nAll themes validated against WCAG contrast requirements (4.5:1 minimum for text).\n\n### Role-Aware Message Styling\n\n| Role | Visual Treatment |\n|------|------------------|\n| **User** | Blue-tinted background, bold |\n| **Assistant** | Green-tinted background |\n| **System** | Gray\u002Fmuted background |\n| **Tool** | Orange-tinted background |\n\n---\n\n## Saved Views\n\nSave filter configurations to 9 slots for instant recall.\n\n**What Gets Saved:**\n- Active filters (agent, workspace, time range)\n- Current ranking mode\n- The search query\n\n**Keyboard:**\n- `Shift+1` through `Shift+9`: Save current view\n- `1` through `9`: Load view from slot\n\n**Via Command Palette:** `Ctrl+P` → \"Save\u002FLoad view\"\n\nViews persist in `tui_state.json` across sessions.\n\n---\n\n## Density Modes\n\nControl lines per search result. Cycle with `Shift+D`:\n\n| Mode | Lines | Best For |\n|------|-------|----------|\n| **Compact** | 3 | Maximum results visible |\n| **Cozy** | 5 | Balanced view (default) |\n| **Spacious** | 8 | Detailed preview |\n\n---\n\n## Bookmark System\n\nSave important results with notes and tags:\n\nIn TUI: Press `b` to bookmark, add notes and tags.\n\n**Bookmark Structure:**\n- `title`: Short description\n- `source_path`, `line_number`, `agent`, `workspace`\n- `note`: Your annotations\n- `tags`: Comma-separated labels\n- `snippet`: Extracted content\n\nStorage: `~\u002F.local\u002Fshare\u002Fcoding-agent-search\u002Fbookmarks.db` (SQLite)\n\n---\n\n## Optional Semantic Search\n\nLocal-only semantic search using MiniLM (no cloud):\n\n**Required files** (place in data directory):\n- `model.onnx`\n- `tokenizer.json`\n- `config.json`\n- `special_tokens_map.json`\n- `tokenizer_config.json`\n\nVector index stored as `vector_index\u002Findex-minilm-384.cvvi`.\n\nCASS does NOT auto-download models; you must manually install them.\n\n**Hash Embedder Fallback:** When MiniLM not installed, CASS uses a hash-based embedder for approximate semantic similarity.\n\n---\n\n## Watch Mode\n\nReal-time index updates:\n\n```bash\ncass index --watch\n```\n\n- **Debounce:** 2 seconds (wait for burst to settle)\n- **Max wait:** 5 seconds (force flush during continuous activity)\n- **Incremental:** Only re-scans modified files\n\nTUI automatically starts watch mode in background.\n\n---\n\n## Deduplication Strategy\n\nCASS uses multi-layer deduplication:\n\n1. **Message Hash**: SHA-256 of `(role + content + timestamp)` - identical messages stored once\n2. **Conversation Fingerprint**: Hash of first N message hashes - detects duplicate files\n3. **Search-Time Dedup**: Results deduplicated by content similarity\n\n**Noise Filtering:**\n- Empty messages and pure whitespace\n- System prompts (unless searching for them)\n- Repeated tool acknowledgments\n\n---\n\n## Performance Characteristics\n\n| Operation | Latency |\n|-----------|---------|\n| Prefix search (cached) | 2-8ms |\n| Prefix search (cold) | 40-60ms |\n| Substring search | 80-200ms |\n| Full reindex | 5-30s |\n| Incremental reindex | 50-500ms |\n| Health check | \u003C50ms |\n\n**Memory:** 70-140MB typical (50K messages)\n**Disk:** ~600 bytes\u002Fmessage (including n-gram overhead)\n\n---\n\n## Response Shapes\n\n**Search Response:**\n```json\n{\n  \"query\": \"error\",\n  \"limit\": 10,\n  \"count\": 5,\n  \"total_matches\": 42,\n  \"hits\": [\n    {\n      \"source_path\": \"\u002Fpath\u002Fto\u002Fsession.jsonl\",\n      \"line_number\": 123,\n      \"agent\": \"claude_code\",\n      \"workspace\": \"\u002Fprojects\u002Fmyapp\",\n      \"title\": \"Authentication debugging\",\n      \"snippet\": \"The error occurs when...\",\n      \"score\": 0.85,\n      \"match_type\": \"exact\",\n      \"created_at\": \"2024-01-15T10:30:00Z\"\n    }\n  ],\n  \"_meta\": {\n    \"elapsed_ms\": 12,\n    \"cache_hit\": true,\n    \"wildcard_fallback\": false,\n    \"next_cursor\": \"eyJ...\",\n    \"index_freshness\": { \"stale\": false, \"age_seconds\": 120 }\n  }\n}\n```\n\n**Aggregation Response:**\n```json\n{\n  \"aggregations\": {\n    \"agent\": {\n      \"buckets\": [\n        {\"key\": \"claude_code\", \"count\": 120},\n        {\"key\": \"codex\", \"count\": 85}\n      ],\n      \"other_count\": 15\n    }\n  }\n}\n```\n\n---\n\n## Environment Variables\n\n| Variable | Purpose |\n|----------|---------|\n| `CASS_DATA_DIR` | Override data directory |\n| `CHATGPT_ENCRYPTION_KEY` | Base64 key for encrypted ChatGPT |\n| `PI_CODING_AGENT_DIR` | Override Pi-Agent sessions path |\n| `CASS_CACHE_SHARD_CAP` | Per-shard cache entries (default 256) |\n| `CASS_CACHE_TOTAL_CAP` | Total cached hits (default 2048) |\n| `CASS_DEBUG_CACHE_METRICS` | Enable cache debug logging |\n| `CODING_AGENT_SEARCH_NO_UPDATE_PROMPT` | Skip update checks |\n\n---\n\n## Shell Completions\n\n```bash\ncass completions bash > ~\u002F.local\u002Fshare\u002Fbash-completion\u002Fcompletions\u002Fcass\ncass completions zsh > \"${fpath[1]}\u002F_cass\"\ncass completions fish > ~\u002F.config\u002Ffish\u002Fcompletions\u002Fcass.fish\ncass completions powershell >> $PROFILE\n```\n\n---\n\n## API Contract & Versioning\n\n```bash\ncass api-version --json\n# → { \"version\": \"0.4.0\", \"contract_version\": \"1\", \"breaking_changes\": [] }\n\ncass introspect --json\n# → Full schema: all commands, arguments, response types\n```\n\n**Guaranteed Stable:**\n- Exit codes and their meanings\n- JSON response structure for `--robot` output\n- Flag names and behaviors\n- `_meta` block format\n\n---\n\n## Integration with CASS Memory (cm)\n\nCASS provides **episodic memory** (raw sessions). CM extracts **procedural memory** (rules and playbooks):\n\n```bash\n# 1. CASS indexes raw sessions\ncass index --full\n\n# 2. Search for relevant past experience\ncass search \"authentication timeout\" --robot --limit 10\n\n# 3. CM reflects on sessions to extract rules\ncm reflect\n```\n\n---\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| \"missing index\" | `cass index --full` |\n| Stale warning | Rerun index or enable watch |\n| Empty results | Check `cass stats --json`, verify connectors detected |\n| JSON parsing errors | Use `--robot-format compact` |\n| Watch not triggering | Check `watch_state.json`, verify file event support |\n| Reset TUI state | `cass tui --reset-state` or `Ctrl+Shift+Del` |\n\n---\n\n## Installation\n\n```bash\n# One-liner install\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcoding_agent_session_search\u002Fmain\u002Finstall.sh \\\n  | bash -s -- --easy-mode --verify\n\n# Windows\nirm https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcoding_agent_session_search\u002Fmain\u002Finstall.ps1 | iex\n```\n\n---\n\n## Integration with Flywheel\n\n| Tool | Integration |\n|------|-------------|\n| **CM** | CASS provides episodic memory, CM extracts procedural memory |\n| **NTM** | Robot mode flags for searching past sessions |\n| **Agent Mail** | Search threads across agent history |\n| **BV** | Cross-reference beads with past solutions |\n","# CASS - Coding Agent Session Search\n\nUnified, high-performance CLI\u002FTUI 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).\n\n## CRITICAL: Robot Mode Required for AI Agents\n\n**NEVER run bare `cass`** - it launches an interactive TUI that blocks your session!\n\n```bash\n# WRONG - blocks terminal\ncass\n\n# CORRECT - JSON output for agents\ncass search \"query\" --robot\ncass search \"query\" --json  # alias\n```\n\n**Always use `--robot` or `--json` flags for machine-readable output.**\n\n---\n\n## Quick Reference for AI Agents\n\n### Pre-Flight Check\n\n```bash\n# Health check (exit 0=healthy, 1=unhealthy, \u003C50ms)\ncass health\n\n# If unhealthy, rebuild index\ncass index --full\n```\n\n### Essential Commands\n\n```bash\n# Search with JSON output\ncass search \"authentication error\" --robot --limit 5\n\n# Search with metadata (elapsed_ms, cache stats, freshness)\ncass search \"error\" --robot --robot-meta\n\n# Minimal payload (path, line, agent only)\ncass search \"bug\" --robot --fields minimal\n\n# View source at specific line\ncass view \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 --json\n\n# Expand context around a line\ncass expand \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 -C 5 --json\n\n# Capabilities discovery\ncass capabilities --json\n\n# Full API schema\ncass introspect --json\n\n# LLM-optimized documentation\ncass robot-docs guide\ncass robot-docs commands\ncass robot-docs schemas\ncass robot-docs examples\ncass robot-docs exit-codes\n```\n\n---\n\n## Why Use CASS\n\n### Cross-Agent Knowledge Transfer\n\nYour coding agents create scattered knowledge:\n- Claude Code sessions in `~\u002F.claude\u002Fprojects`\n- Codex sessions in `~\u002F.codex\u002Fsessions`\n- Cursor state in SQLite databases\n- Aider history in markdown files\n\nCASS **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.\n\n### Use Cases\n\n```bash\n# \"I solved this before...\"\ncass search \"TypeError: Cannot read property\" --robot --days 30\n\n# Cross-agent learning (what has ANY agent said about X?)\ncass search \"authentication\" --robot --workspace \u002Fpath\u002Fto\u002Fproject\n\n# Agent-to-agent handoff\ncass search \"database migration\" --robot --fields summary\n\n# Daily review\ncass timeline --today --json\n```\n\n---\n\n## Command Reference\n\n### Indexing\n\n```bash\n# Full rebuild of DB and search index\ncass index --full\n\n# Incremental update (since last scan)\ncass index\n\n# Watch mode: auto-reindex on file changes\ncass index --watch\n\n# Force rebuild even if schema unchanged\ncass index --full --force-rebuild\n\n# Safe retries with idempotency key (24h TTL)\ncass index --full --idempotency-key \"build-$(date +%Y%m%d)\"\n\n# JSON output with stats\ncass index --full --json\n```\n\n### Search\n\n```bash\n# Basic search (JSON output required for agents!)\ncass search \"query\" --robot\n\n# With filters\ncass search \"error\" --robot --agent claude --days 7\ncass search \"bug\" --robot --workspace \u002Fpath\u002Fto\u002Fproject\ncass search \"panic\" --robot --today\n\n# Time filters\ncass search \"auth\" --robot --since 2024-01-01 --until 2024-01-31\ncass search \"test\" --robot --yesterday\ncass search \"fix\" --robot --week\n\n# Wildcards\ncass search \"auth*\" --robot          # prefix: authentication, authorize\ncass search \"*tion\" --robot          # suffix: authentication, exception\ncass search \"*config*\" --robot       # substring: misconfigured\n\n# Token budget management (critical for LLMs!)\ncass search \"error\" --robot --fields minimal              # path, line, agent only\ncass search \"error\" --robot --fields summary              # adds title, score\ncass search \"error\" --robot --max-content-length 500      # truncate fields\ncass search \"error\" --robot --max-tokens 2000             # soft budget (~4 chars\u002Ftoken)\ncass search \"error\" --robot --limit 5                     # cap results\n\n# Pagination (cursor-based)\ncass search \"TODO\" --robot --robot-meta --limit 20\n# Use _meta.next_cursor from response:\ncass search \"TODO\" --robot --robot-meta --limit 20 --cursor \"eyJ...\"\n\n# Match highlighting\ncass search \"authentication error\" --robot --highlight\n\n# Query analysis\u002Fdebugging\ncass search \"auth*\" --robot --explain    # parsed query, cost estimates\ncass search \"auth error\" --robot --dry-run  # validate without executing\n\n# Aggregations (server-side counts)\ncass search \"error\" --robot --aggregate agent,workspace,date\n\n# Request correlation\ncass search \"bug\" --robot --request-id \"req-12345\"\n\n# Source filtering (for multi-machine setups)\ncass search \"auth\" --robot --source laptop\ncass search \"error\" --robot --source remote\n\n# Traceability (for debugging agent pipelines)\ncass search \"error\" --robot --trace-file \u002Ftmp\u002Fcass-trace.json\n```\n\n### Session Analysis\n\n```bash\n# Export conversation to markdown\u002FHTML\u002FJSON\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format markdown -o conversation.md\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format html -o conversation.html\ncass export \u002Fpath\u002Fto\u002Fsession.jsonl --format json --include-tools\n\n# Expand context around a line (from search result)\ncass expand \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 -C 5 --json\n# Shows 5 messages before and after line 42\n\n# View source at line\ncass view \u002Fpath\u002Fto\u002Fsession.jsonl -n 42 --json\n\n# Activity timeline\ncass timeline --today --json --group-by hour\ncass timeline --days 7 --json --agent claude\ncass timeline --since 7d --json\n\n# Find related sessions for a file\ncass context \u002Fpath\u002Fto\u002Fsource.ts --json\n```\n\n### Status & Diagnostics\n\n```bash\n# Quick health (\u003C50ms)\ncass health\ncass health --json\n\n# Full status snapshot\ncass status --json\ncass state --json  # alias\n\n# Statistics\ncass stats --json\ncass stats --by-source  # for multi-machine\n\n# Full diagnostics\ncass diag --verbose\n```\n\n---\n\n## Aggregation & Analytics\n\nAggregate search results server-side to get counts and distributions without transferring full result data:\n\n```bash\n# Count results by agent\ncass search \"error\" --robot --aggregate agent\n# → { \"aggregations\": { \"agent\": { \"buckets\": [{\"key\": \"claude_code\", \"count\": 45}, ...] } } }\n\n# Multi-field aggregation\ncass search \"bug\" --robot --aggregate agent,workspace,date\n\n# Combine with filters\ncass search \"TODO\" --agent claude --robot --aggregate workspace\n```\n\n| Aggregation Field | Description |\n|-------------------|-------------|\n| `agent` | Group by agent type (claude_code, codex, cursor, etc.) |\n| `workspace` | Group by workspace\u002Fproject path |\n| `date` | Group by date (YYYY-MM-DD) |\n| `match_type` | Group by match quality (exact, prefix, fuzzy) |\n\nTop 10 buckets returned per field, with `other_count` for remaining items.\n\n---\n\n## Remote Sources (Multi-Machine Search)\n\nSearch across sessions from multiple machines via SSH\u002Frsync.\n\n### Setup Wizard (Recommended)\n\n```bash\ncass sources setup\n```\n\nThe wizard:\n1. Discovers SSH hosts from `~\u002F.ssh\u002Fconfig`\n2. Probes each for agent data and cass installation\n3. Optionally installs cass on remotes\n4. Indexes sessions on remotes\n5. Configures `sources.toml`\n6. Syncs data locally\n\n```bash\ncass sources setup --hosts css,csd,yto  # Specific hosts only\ncass sources setup --dry-run             # Preview without changes\ncass sources setup --resume              # Resume interrupted setup\n```\n\n### Manual Setup\n\n```bash\n# Add a remote machine\ncass sources add user@laptop.local --preset macos-defaults\ncass sources add dev@workstation --path ~\u002F.claude\u002Fprojects --path ~\u002F.codex\u002Fsessions\n\n# List sources\ncass sources list --json\n\n# Sync sessions\ncass sources sync\ncass sources sync --source laptop --verbose\n\n# Check connectivity\ncass sources doctor\ncass sources doctor --source laptop --json\n\n# Path mappings (rewrite remote paths to local)\ncass sources mappings list laptop\ncass sources mappings add laptop --from \u002Fhome\u002Fuser\u002Fprojects --to \u002FUsers\u002Fme\u002Fprojects\ncass sources mappings test laptop \u002Fhome\u002Fuser\u002Fprojects\u002Fmyapp\u002Fsrc\u002Fmain.rs\n\n# Remove source\ncass sources remove laptop --purge -y\n```\n\nConfiguration stored in `~\u002F.config\u002Fcass\u002Fsources.toml` (Linux) or `~\u002FLibrary\u002FApplication Support\u002Fcass\u002Fsources.toml` (macOS).\n\n---\n\n## Robot Mode Deep Dive\n\n### Self-Documenting API\n\nCASS teaches agents how to use itself:\n\n```bash\n# Quick capability check\ncass capabilities --json\n# Returns: features, connectors, limits\n\n# Full API schema\ncass introspect --json\n# Returns: all commands, arguments, response shapes\n\n# Topic-based docs (LLM-optimized)\ncass robot-docs commands   # all commands and flags\ncass robot-docs schemas    # response JSON schemas\ncass robot-docs examples   # copy-paste invocations\ncass robot-docs exit-codes # error handling\ncass robot-docs guide      # quick-start walkthrough\ncass robot-docs contracts  # API versioning\ncass robot-docs sources    # remote sources guide\n```\n\n### Forgiving Syntax (Agent-Friendly)\n\nCASS auto-corrects common mistakes:\n\n| What you type | What CASS understands |\n|---------------|----------------------|\n| `cass serach \"error\"` | `cass search \"error\"` (typo corrected) |\n| `cass -robot -limit=5` | `cass --robot --limit=5` (single-dash fixed) |\n| `cass --Robot --LIMIT 5` | `cass --robot --limit 5` (case normalized) |\n| `cass find \"auth\"` | `cass search \"auth\"` (alias resolved) |\n| `cass --limt 5` | `cass --limit 5` (Levenshtein \u003C=2) |\n\n**Command Aliases:**\n- `find`, `query`, `q`, `lookup`, `grep` → `search`\n- `ls`, `list`, `info`, `summary` → `stats`\n- `st`, `state` → `status`\n- `reindex`, `idx`, `rebuild` → `index`\n- `show`, `get`, `read` → `view`\n- `docs`, `help-robot`, `robotdocs` → `robot-docs`\n\n### Output Formats\n\n```bash\n# Pretty-printed JSON (default)\ncass search \"error\" --robot\n\n# Streaming JSONL (header + one hit per line)\ncass search \"error\" --robot-format jsonl\n\n# Compact single-line JSON\ncass search \"error\" --robot-format compact\n\n# With performance metadata\ncass search \"error\" --robot --robot-meta\n```\n\n**Design principle:** stdout = JSON only; diagnostics go to stderr.\n\n### Token Budget Management\n\nLLMs have context limits. Control output size:\n\n| Flag | Effect |\n|------|--------|\n| `--fields minimal` | Only `source_path`, `line_number`, `agent` |\n| `--fields summary` | Adds `title`, `score` |\n| `--fields score,title,snippet` | Custom field selection |\n| `--max-content-length 500` | Truncate long fields (UTF-8 safe) |\n| `--max-tokens 2000` | Soft budget (~4 chars\u002Ftoken) |\n| `--limit 5` | Cap number of results |\n\nTruncated fields include `*_truncated: true` indicator.\n\n---\n\n## Structured Error Handling\n\nErrors are JSON with actionable hints:\n\n```json\n{\n  \"error\": {\n    \"code\": 3,\n    \"kind\": \"index_missing\",\n    \"message\": \"Search index not found\",\n    \"hint\": \"Run 'cass index --full' to build the index\",\n    \"retryable\": false\n  }\n}\n```\n\n### Exit Codes\n\n| Code | Meaning | Action |\n|------|---------|--------|\n| 0 | Success | Parse stdout |\n| 1 | Health check failed | Run `cass index --full` |\n| 2 | Usage error | Fix syntax (hint provided) |\n| 3 | Index\u002FDB missing | Run `cass index --full` |\n| 4 | Network error | Check connectivity |\n| 5 | Data corruption | Run `cass index --full --force-rebuild` |\n| 6 | Incompatible version | Update cass |\n| 7 | Lock\u002Fbusy | Retry later |\n| 8 | Partial result | Increase `--timeout` |\n| 9 | Unknown error | Check `retryable` flag |\n\n---\n\n## Search Modes\n\nThree search modes, selectable with `--mode` flag:\n\n| Mode | Algorithm | Best For |\n|------|-----------|----------|\n| **lexical** (default) | BM25 full-text | Exact term matching, code searches |\n| **semantic** | Vector similarity | Conceptual queries, \"find similar\" |\n| **hybrid** | Reciprocal Rank Fusion | Balanced precision and recall |\n\n```bash\ncass search \"authentication\" --mode lexical --robot\ncass search \"how to handle user login\" --mode semantic --robot\ncass search \"auth error handling\" --mode hybrid --robot\n```\n\n**Hybrid** combines lexical and semantic using RRF:\n```\nRRF_score = Σ 1 \u002F (60 + rank_i)\n```\n\n---\n\n## Pipeline Mode (Chained Search)\n\nChain searches by piping session paths:\n\n```bash\n# Find sessions mentioning \"auth\", then search within those for \"token\"\ncass search \"authentication\" --robot-format sessions | \\\n  cass search \"refresh token\" --sessions-from - --robot\n\n# Build a filtered corpus from today's work\ncass search --today --robot-format sessions > today_sessions.txt\ncass search \"bug fix\" --sessions-from today_sessions.txt --robot\n```\n\nUse cases:\n- **Drill-down**: Broad search → narrow within results\n- **Cross-reference**: Find sessions with term A, then find term B within them\n- **Corpus building**: Save session lists for repeated searches\n\n---\n\n## Query Language\n\n### Basic Queries\n\n| Query | Matches |\n|-------|---------|\n| `error` | Messages containing \"error\" (case-insensitive) |\n| `python error` | Both \"python\" AND \"error\" |\n| `\"authentication failed\"` | Exact phrase |\n\n### Boolean Operators\n\n| Operator | Example | Meaning |\n|----------|---------|---------|\n| `AND` | `python AND error` | Both terms required (default) |\n| `OR` | `error OR warning` | Either term matches |\n| `NOT` | `error NOT test` | First term, excluding second |\n| `-` | `error -test` | Shorthand for NOT |\n\n```bash\n# Complex boolean query\ncass search \"authentication AND (error OR failure) NOT test\" --robot\n\n# Exclude test files\ncass search \"bug fix -test -spec\" --robot\n\n# Either error type\ncass search \"TypeError OR ValueError\" --robot\n```\n\n### Wildcard Patterns\n\n| Pattern | Type | Performance |\n|---------|------|-------------|\n| `auth*` | Prefix | Fast (edge n-grams) |\n| `*tion` | Suffix | Slower (regex) |\n| `*config*` | Substring | Slowest (regex) |\n\n### Match Types\n\nResults include `match_type`:\n\n| Type | Meaning | Score Boost |\n|------|---------|-------------|\n| `exact` | Verbatim match | Highest |\n| `prefix` | Via prefix expansion | High |\n| `suffix` | Via suffix pattern | Medium |\n| `substring` | Via substring pattern | Lower |\n| `fuzzy` | Auto-fallback (sparse results) | Lowest |\n\n### Auto-Fuzzy Fallback\n\nWhen exact query returns \u003C3 results, CASS automatically retries with wildcards:\n- `auth` → `*auth*`\n- Results flagged with `wildcard_fallback: true`\n\n### Flexible Time Input\n\nCASS accepts a wide variety of time\u002Fdate formats:\n\n| Format | Examples |\n|--------|----------|\n| **Relative** | `-7d`, `-24h`, `-30m`, `-1w` |\n| **Keywords** | `now`, `today`, `yesterday` |\n| **ISO 8601** | `2024-11-25`, `2024-11-25T14:30:00Z` |\n| **US Dates** | `11\u002F25\u002F2024`, `11-25-2024` |\n| **Unix Timestamp** | `1732579200` (seconds or milliseconds) |\n\n---\n\n## Ranking Modes\n\nCycle with `F12` in TUI or use `--ranking` flag:\n\n| Mode | Formula | Best For |\n|------|---------|----------|\n| **Recent Heavy** | `relevance*0.3 + recency*0.7` | \"What was I working on?\" |\n| **Balanced** | `relevance*0.5 + recency*0.5` | General search |\n| **Relevance** | `relevance*0.8 + recency*0.2` | \"Best explanation of X\" |\n| **Match Quality** | Penalizes fuzzy matches | Precise technical searches |\n| **Date Newest** | Pure chronological | Recent activity |\n| **Date Oldest** | Reverse chronological | \"When did I first...\" |\n\n### Score Components\n\n- **Text Relevance (BM25)**: Term frequency, inverse document frequency, length normalization\n- **Recency**: Exponential decay (today ~1.0, last week ~0.7, last month ~0.3)\n- **Match Exactness**: Exact phrase=1.0, Prefix=0.9, Suffix=0.8, Substring=0.6, Fuzzy=0.4\n\n### Blended Scoring Formula\n\n```\nFinal_Score = BM25_Score × Match_Quality + α × Recency_Factor\n```\n\n| Mode | α Value | Effect |\n|------|---------|--------|\n| Recent Heavy | 1.0 | Recency dominates |\n| Balanced | 0.4 | Moderate recency boost |\n| Relevance Heavy | 0.1 | BM25 dominates |\n| Match Quality | 0.0 | Pure text matching |\n\n---\n\n## Supported Agents (11 Connectors)\n\n| Agent | Location | Format |\n|-------|----------|--------|\n| **Claude Code** | `~\u002F.claude\u002Fprojects` | JSONL |\n| **Codex** | `~\u002F.codex\u002Fsessions` | JSONL (Rollout) |\n| **Gemini CLI** | `~\u002F.gemini\u002Ftmp` | JSON |\n| **Cline** | VS Code global storage | Task directories |\n| **OpenCode** | `.opencode` directories | SQLite |\n| **Amp** | `~\u002F.local\u002Fshare\u002Famp` + VS Code | Mixed |\n| **Cursor** | `~\u002FLibrary\u002FApplication Support\u002FCursor` | SQLite (state.vscdb) |\n| **ChatGPT** | `~\u002FLibrary\u002FApplication Support\u002Fcom.openai.chat` | JSON (v1 unencrypted) |\n| **Aider** | `~\u002F.aider.chat.history.md` + per-project | Markdown |\n| **Pi-Agent** | `~\u002F.pi\u002Fagent\u002Fsessions` | JSONL with thinking |\n| **Factory (Droid)** | `~\u002F.factory\u002Fsessions` | JSONL by workspace |\n\n**Note:** ChatGPT v2\u002Fv3 are AES-256-GCM encrypted (keychain access required). Legacy v1 unencrypted conversations are indexed automatically.\n\n---\n\n## TUI Features (for Humans)\n\nLaunch with `cass` (no flags):\n\n### Keyboard Shortcuts\n\n**Navigation:**\n- `Up\u002FDown`: Move selection\n- `Left\u002FRight`: Switch panes\n- `Tab\u002FShift+Tab`: Cycle focus\n- `Enter`: Open in `$EDITOR`\n- `Space`: Full-screen detail view\n- `Home\u002FEnd`: Jump to first\u002Flast result\n- `PageUp\u002FPageDown`: Scroll by page\n\n**Filtering:**\n- `F3`: Agent filter\n- `F4`: Workspace filter\n- `F5\u002FF6`: Time filters (from\u002Fto)\n- `Shift+F3`: Scope to current result's agent\n- `Shift+F4`: Clear workspace filter\n- `Shift+F5`: Cycle presets (24h\u002F7d\u002F30d\u002Fall)\n- `Ctrl+Del`: Clear all filters\n\n**Modes:**\n- `F2`: Toggle theme (6 presets)\n- `F7`: Context window size (S\u002FM\u002FL\u002FXL)\n- `F9`: Match mode (prefix\u002Fstandard)\n- `F12`: Ranking mode\n- `Ctrl+B`: Toggle border style\n\n**Selection & Actions:**\n- `m`: Toggle selection\n- `Ctrl+A`: Select all\n- `A`: Bulk actions menu\n- `Ctrl+Enter`: Add to queue\n- `Ctrl+O`: Open all queued\n- `y`: Copy path\u002Fcontent\n- `Ctrl+Y`: Copy all selected\n- `\u002F`: Find in detail pane\n- `n\u002FN`: Next\u002Fprev match\n\n**Views & Palette:**\n- `Ctrl+P`: Command palette\n- `1-9`: Load saved view\n- `Shift+1-9`: Save view to slot\n\n**Source Filtering (multi-machine):**\n- `F11`: Cycle source filter (all\u002Flocal\u002Fremote)\n- `Shift+F11`: Source selection menu\n\n**Global:**\n- `Ctrl+C`: Quit\n- `F1` or `?`: Toggle help\n- `Ctrl+Shift+R`: Force re-index\n- `Ctrl+Shift+Del`: Reset all TUI state\n\n### Detail Pane Tabs\n\n| Tab | Content | Switch With |\n|-----|---------|-------------|\n| **Messages** | Full conversation with markdown | `[` \u002F `]` |\n| **Snippets** | Keyword-extracted summaries | `[` \u002F `]` |\n| **Raw** | Unformatted JSON\u002Ftext | `[` \u002F `]` |\n\n### Context Window Sizing\n\n| Size | Characters | Use Case |\n|------|------------|----------|\n| **Small** | ~200 | Quick scanning |\n| **Medium** | ~400 | Default balanced view |\n| **Large** | ~800 | Longer passages |\n| **XLarge** | ~1600 | Full context, code review |\n\n**Peek Mode** (`Ctrl+Space`): Temporarily expand to XL without changing default.\n\n---\n\n## Theme Presets\n\nCycle through 6 built-in themes with `F2`:\n\n| Theme | Description | Best For |\n|-------|-------------|----------|\n| **Dark** | Tokyo Night-inspired deep blues | Low-light environments |\n| **Light** | High-contrast light background | Bright environments |\n| **Catppuccin** | Warm pastels, reduced eye strain | All-day coding |\n| **Dracula** | Purple-accented dark theme | Popular developer theme |\n| **Nord** | Arctic-inspired cool tones | Calm, focused work |\n| **High Contrast** | Maximum readability | Accessibility needs |\n\nAll themes validated against WCAG contrast requirements (4.5:1 minimum for text).\n\n### Role-Aware Message Styling\n\n| Role | Visual Treatment |\n|------|------------------|\n| **User** | Blue-tinted background, bold |\n| **Assistant** | Green-tinted background |\n| **System** | Gray\u002Fmuted background |\n| **Tool** | Orange-tinted background |\n\n---\n\n## Saved Views\n\nSave filter configurations to 9 slots for instant recall.\n\n**What Gets Saved:**\n- Active filters (agent, workspace, time range)\n- Current ranking mode\n- The search query\n\n**Keyboard:**\n- `Shift+1` through `Shift+9`: Save current view\n- `1` through `9`: Load view from slot\n\n**Via Command Palette:** `Ctrl+P` → \"Save\u002FLoad view\"\n\nViews persist in `tui_state.json` across sessions.\n\n---\n\n## Density Modes\n\nControl lines per search result. Cycle with `Shift+D`:\n\n| Mode | Lines | Best For |\n|------|-------|----------|\n| **Compact** | 3 | Maximum results visible |\n| **Cozy** | 5 | Balanced view (default) |\n| **Spacious** | 8 | Detailed preview |\n\n---\n\n## Bookmark System\n\nSave important results with notes and tags:\n\nIn TUI: Press `b` to bookmark, add notes and tags.\n\n**Bookmark Structure:**\n- `title`: Short description\n- `source_path`, `line_number`, `agent`, `workspace`\n- `note`: Your annotations\n- `tags`: Comma-separated labels\n- `snippet`: Extracted content\n\nStorage: `~\u002F.local\u002Fshare\u002Fcoding-agent-search\u002Fbookmarks.db` (SQLite)\n\n---\n\n## Optional Semantic Search\n\nLocal-only semantic search using MiniLM (no cloud):\n\n**Required files** (place in data directory):\n- `model.onnx`\n- `tokenizer.json`\n- `config.json`\n- `special_tokens_map.json`\n- `tokenizer_config.json`\n\nVector index stored as `vector_index\u002Findex-minilm-384.cvvi`.\n\nCASS does NOT auto-download models; you must manually install them.\n\n**Hash Embedder Fallback:** When MiniLM not installed, CASS uses a hash-based embedder for approximate semantic similarity.\n\n---\n\n## Watch Mode\n\nReal-time index updates:\n\n```bash\ncass index --watch\n```\n\n- **Debounce:** 2 seconds (wait for burst to settle)\n- **Max wait:** 5 seconds (force flush during continuous activity)\n- **Incremental:** Only re-scans modified files\n\nTUI automatically starts watch mode in background.\n\n---\n\n## Deduplication Strategy\n\nCASS uses multi-layer deduplication:\n\n1. **Message Hash**: SHA-256 of `(role + content + timestamp)` - identical messages stored once\n2. **Conversation Fingerprint**: Hash of first N message hashes - detects duplicate files\n3. **Search-Time Dedup**: Results deduplicated by content similarity\n\n**Noise Filtering:**\n- Empty messages and pure whitespace\n- System prompts (unless searching for them)\n- Repeated tool acknowledgments\n\n---\n\n## Performance Characteristics\n\n| Operation | Latency |\n|-----------|---------|\n| Prefix search (cached) | 2-8ms |\n| Prefix search (cold) | 40-60ms |\n| Substring search | 80-200ms |\n| Full reindex | 5-30s |\n| Incremental reindex | 50-500ms |\n| Health check | \u003C50ms |\n\n**Memory:** 70-140MB typical (50K messages)\n**Disk:** ~600 bytes\u002Fmessage (including n-gram overhead)\n\n---\n\n## Response Shapes\n\n**Search Response:**\n```json\n{\n  \"query\": \"error\",\n  \"limit\": 10,\n  \"count\": 5,\n  \"total_matches\": 42,\n  \"hits\": [\n    {\n      \"source_path\": \"\u002Fpath\u002Fto\u002Fsession.jsonl\",\n      \"line_number\": 123,\n      \"agent\": \"claude_code\",\n      \"workspace\": \"\u002Fprojects\u002Fmyapp\",\n      \"title\": \"Authentication debugging\",\n      \"snippet\": \"The error occurs when...\",\n      \"score\": 0.85,\n      \"match_type\": \"exact\",\n      \"created_at\": \"2024-01-15T10:30:00Z\"\n    }\n  ],\n  \"_meta\": {\n    \"elapsed_ms\": 12,\n    \"cache_hit\": true,\n    \"wildcard_fallback\": false,\n    \"next_cursor\": \"eyJ...\",\n    \"index_freshness\": { \"stale\": false, \"age_seconds\": 120 }\n  }\n}\n```\n\n**Aggregation Response:**\n```json\n{\n  \"aggregations\": {\n    \"agent\": {\n      \"buckets\": [\n        {\"key\": \"claude_code\", \"count\": 120},\n        {\"key\": \"codex\", \"count\": 85}\n      ],\n      \"other_count\": 15\n    }\n  }\n}\n```\n\n---\n\n## Environment Variables\n\n| Variable | Purpose |\n|----------|---------|\n| `CASS_DATA_DIR` | Override data directory |\n| `CHATGPT_ENCRYPTION_KEY` | Base64 key for encrypted ChatGPT |\n| `PI_CODING_AGENT_DIR` | Override Pi-Agent sessions path |\n| `CASS_CACHE_SHARD_CAP` | Per-shard cache entries (default 256) |\n| `CASS_CACHE_TOTAL_CAP` | Total cached hits (default 2048) |\n| `CASS_DEBUG_CACHE_METRICS` | Enable cache debug logging |\n| `CODING_AGENT_SEARCH_NO_UPDATE_PROMPT` | Skip update checks |\n\n---\n\n## Shell Completions\n\n```bash\ncass completions bash > ~\u002F.local\u002Fshare\u002Fbash-completion\u002Fcompletions\u002Fcass\ncass completions zsh > \"${fpath[1]}\u002F_cass\"\ncass completions fish > ~\u002F.config\u002Ffish\u002Fcompletions\u002Fcass.fish\ncass completions powershell >> $PROFILE\n```\n\n---\n\n## API Contract & Versioning\n\n```bash\ncass api-version --json\n# → { \"version\": \"0.4.0\", \"contract_version\": \"1\", \"breaking_changes\": [] }\n\ncass introspect --json\n# → Full schema: all commands, arguments, response types\n```\n\n**Guaranteed Stable:**\n- Exit codes and their meanings\n- JSON response structure for `--robot` output\n- Flag names and behaviors\n- `_meta` block format\n\n---\n\n## Integration with CASS Memory (cm)\n\nCASS provides **episodic memory** (raw sessions). CM extracts **procedural memory** (rules and playbooks):\n\n```bash\n# 1. CASS indexes raw sessions\ncass index --full\n\n# 2. Search for relevant past experience\ncass search \"authentication timeout\" --robot --limit 10\n\n# 3. CM reflects on sessions to extract rules\ncm reflect\n```\n\n---\n\n## Troubleshooting\n\n| Issue | Solution |\n|-------|----------|\n| \"missing index\" | `cass index --full` |\n| Stale warning | Rerun index or enable watch |\n| Empty results | Check `cass stats --json`, verify connectors detected |\n| JSON parsing errors | Use `--robot-format compact` |\n| Watch not triggering | Check `watch_state.json`, verify file event support |\n| Reset TUI state | `cass tui --reset-state` or `Ctrl+Shift+Del` |\n\n---\n\n## Installation\n\n```bash\n# One-liner install\ncurl -fsSL https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcoding_agent_session_search\u002Fmain\u002Finstall.sh \\\n  | bash -s -- --easy-mode --verify\n\n# Windows\nirm https:\u002F\u002Fraw.githubusercontent.com\u002FDicklesworthstone\u002Fcoding_agent_session_search\u002Fmain\u002Finstall.ps1 | iex\n```\n\n---\n\n## Integration with Flywheel\n\n| Tool | Integration |\n|------|-------------|\n| **CM** | CASS provides episodic memory, CM extracts procedural memory |\n| **NTM** | Robot mode flags for searching past sessions |\n| **Agent Mail** | Search threads across agent history |\n| **BV** | Cross-reference beads with past solutions |\n",{"name":5,"description":7},"main","def8531e65114c0fca8fb8551c1871ee0eed705c","skills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcass",24,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub","https:\u002F\u002Fskillshub.wtf","https:\u002F\u002Fgithub.com\u002FComeOnOliver","AI & Blockchain Engineer\r\n","2026-06-24 22:07:19",{"source":8,"skillName":5,"commands":63,"prompt":73,"zipAvailable":74},[64,67,70],{"tool":65,"command":66},"npx","npx skills add ComeOnOliver\u002Fskillshub --skill cass",{"tool":68,"command":69},"bunx","bunx skills add ComeOnOliver\u002Fskillshub --skill cass",{"tool":71,"command":72},"pnpm","pnpm dlx skills add ComeOnOliver\u002Fskillshub --skill cass","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcass\u002FSKILL.md",true,[76],{"path":77,"resourceType":78,"resourceTypeDesc":79,"sizeBytes":80,"sourceHtmlUrl":81},"skill-report.json","REFERENCE","参考文档",9100,"https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Faiskillstore\u002Fmarketplace\u002Fdicklesworthstone\u002Fcass\u002Fskill-report.json",[83,93,103,112,118,125],{"skillNo":84,"name":85,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":86,"categories":87,"keywords":89,"publishedAt":48},"01M6FKJN13GMG4KY57J3QD8GY5","model-hierarchy-skill","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzscole\u002Fmodel-hierarchy-skill\u002Fmodel-hierarchy-skill\u002FSKILL.md",[88],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[90,91,92],"model","model hierarchy","model hierarchy skill",{"skillNo":94,"name":95,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":99,"publishedAt":48},"01M6FKJJJ6GCAMR4PPPRD12M5X","zoom-mcp","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-mcp\u002FSKILL.md",[98],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[100,101,102],"MCP","zoom","zoom mcp",{"skillNo":104,"name":105,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":106,"categories":107,"keywords":108,"publishedAt":48},"01M6FKJE3KYT3KPEZMEEHYKA6K","zoom-apps-sdk","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fzoom-apps-sdk\u002FSKILL.md",[],[109,110,111,101],"sdk","zoom apps sdk","apps",{"skillNo":113,"name":114,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":115,"categories":116,"keywords":117,"publishedAt":48},"01M6FKJ9EDH9Q5VWDF8HAJRSP0","windows","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwindows\u002FSKILL.md",[],[114],{"skillNo":119,"name":120,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":121,"categories":122,"keywords":124,"publishedAt":48},"01M6FKJ666BEEFC3AE9GJ72Q93","whiteboard","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwhiteboard\u002FSKILL.md",[123],{"categoryNo":19,"categoryName":20,"taxonomyType":21,"taxonomyTypeDesc":22},[120],{"skillNo":126,"name":127,"nameZh":6,"description":6,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":128,"categories":129,"keywords":130,"publishedAt":48},"01M6FKJ21WFCDGTJQ2Q91T9DVW","websockets","https:\u002F\u002Fgithub.com\u002FComeOnOliver\u002Fskillshub\u002Fblob\u002Fmain\u002Fskills\u002Fzoom\u002Fskills\u002Fwebsockets\u002FSKILL.md",[],[127]]