|
2 | 2 |
|
3 | 3 | Interactive terminal UI for browsing, searching, and surgically editing Claude Code session JSONL files. |
4 | 4 |
|
5 | | -Claude Code persists conversations as JSONL under `~/.claude/projects/<slug>/<uuid>.jsonl`. Built-ins only support rewind, clear, and compact. `cc-session` lets you: |
6 | | - |
7 | | -- Browse and search every session across all projects. |
8 | | -- Open any session and view messages with role, text, token count, timestamp. |
9 | | -- Delete individual messages, ranges, from-top, or from-bottom. |
10 | | -- Auto-pair tool_use and tool_result blocks so you never orphan one half. |
11 | | -- Save atomically with a `.bak` backup — and refuse to save when Claude Code holds the file open. |
| 5 | +Claude Code persists conversations as JSONL under `~/.claude/projects/<slug>/<uuid>.jsonl`. Built-ins only support rewind, clear, and compact. `cc-session` fixes that. |
| 6 | + |
| 7 | +## Features |
| 8 | + |
| 9 | +- **Session browser** — every session across every project, sorted by recency, with project, title, modified time, size, and full UUID. |
| 10 | +- **Fuzzy search** — same engine as fzf/Helix (`nucleo-matcher`), searches project + title, ranks by score. |
| 11 | +- **Message viewer** — shows only real user/assistant text by default; system messages, tool blocks, attachments, and harness wrappers (`<bash-input>`, `<system-reminder>`, etc.) are hidden but preserved on disk. |
| 12 | +- **Edit a session** — open any session and surgically edit it. |
| 13 | +- **Delete individual messages** — pick one and drop it. |
| 14 | +- **Delete ranges, from-top, from-bottom** — bulk trim by range, prefix, or suffix. |
| 15 | +- **Turn-level auto-pair** — deleting a user message also deletes its assistant response (and vice versa). Marking any message in a turn deletes the whole turn cleanly. |
| 16 | +- **tool_use ↔ tool_result safety** — tool calls always travel with their results, so resume never breaks. |
| 17 | +- **Token counts per message** — tiktoken `cl100k_base`, with `usage` metadata as fallback when present. |
| 18 | +- **Atomic save with `.bak` backup** — write `.tmp`, fsync, rename. Backup written every save. |
| 19 | +- **Concurrent-open detection** — `lsof` check refuses to save while Claude Code holds the file. Override with `--force`. |
| 20 | +- **LLM-friendly non-interactive CLI** — `list`, `search`, `show`, `info`, `delete` subcommands with `--json` output. Other agents (Claude Code, Codex, scripts) can drive every action a human can. |
| 21 | +- **Cross-platform** — macOS and Linux. Windows lsof equivalent deferred. |
12 | 22 |
|
13 | 23 | ## Install |
14 | 24 |
|
@@ -59,12 +69,12 @@ cc-session --version |
59 | 69 | Every operation is also available as a subcommand with structured output, so other agents (Claude Code, Codex, scripts, CI) can drive the editor without a human at the terminal. |
60 | 70 |
|
61 | 71 | ```sh |
62 | | -cc-session list --json [--project <slug>] [--limit N] |
63 | | -cc-session show <id-or-path> [--json] [--full] [--include-hidden] |
64 | | -cc-session info <id-or-path> [--json] |
| 72 | +cc-session list [--json] [--project <slug>] [--limit N] |
| 73 | +cc-session search <query> [--json] [--limit N] |
| 74 | +cc-session show <id-or-path> [--json] [--full] [--include-hidden] |
| 75 | +cc-session info <id-or-path> [--json] |
65 | 76 | cc-session delete <id-or-path> --indices 3,5,7 [--from-top N] [--from-bottom N] [--range lo..hi] [--dry-run] [--force] [--json] |
66 | 77 | ``` |
67 | | - |
68 | 78 | `<id-or-path>` accepts a full path, a session UUID, or a unique substring of one. Indices are 0-based positions in the raw JSONL (use `cc-session show --json` to map text → index). Auto-pair always extends the delete set to keep `tool_use`/`tool_result` blocks together; `paired_added` in the output reports what was added. |
69 | 79 |
|
70 | 80 | ### Example LLM workflow |
|
0 commit comments