{"id":45991064,"url":"https://github.com/phiat/claude-esp","last_synced_at":"2026-05-03T01:12:12.456Z","repository":{"id":340842065,"uuid":"1130796119","full_name":"phiat/claude-esp","owner":"phiat","description":"Stream Claude Code's hidden output (thinking, tool calls, subagents) to a separate terminal in real-time","archived":false,"fork":false,"pushed_at":"2026-03-24T12:56:26.000Z","size":447,"stargazers_count":83,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-03-29T17:26:02.720Z","etag":null,"topics":["agents","claude","go","tui"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phiat.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-01-09T02:59:42.000Z","updated_at":"2026-03-28T08:54:19.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/phiat/claude-esp","commit_stats":null,"previous_names":["phiat/claude-esp"],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/phiat/claude-esp","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiat%2Fclaude-esp","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiat%2Fclaude-esp/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiat%2Fclaude-esp/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiat%2Fclaude-esp/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phiat","download_url":"https://codeload.github.com/phiat/claude-esp/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phiat%2Fclaude-esp/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31291347,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-01T13:12:26.723Z","status":"ssl_error","status_checked_at":"2026-04-01T13:12:25.102Z","response_time":53,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["agents","claude","go","tui"],"created_at":"2026-02-28T20:28:35.438Z","updated_at":"2026-05-03T01:12:12.451Z","avatar_url":"https://github.com/phiat.png","language":"Go","funding_links":[],"categories":["Alternative Clients 📱","Code \u0026 Developer Tools","替代客户端 📱"],"sub_categories":["General","通用"],"readme":"# claude-esp\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/phiat/claude-esp.svg)](https://pkg.go.dev/github.com/phiat/claude-esp)\n\nStream Claude Code's hidden output (thinking, tool calls, subagents) to a separate terminal in real-time.\n\n![claude-esp screenshot](docs/screenshot.png)\n\nLooking for the Rust port? See: [claude-esp-rs](https://github.com/phiat/claude-esp-rs)\n\n## The Problem\n\nWhen using Claude Code interactively, tool outputs and thinking are collapsed by default and require pressing `Ctrl+O` to toggle visibility. This tool lets you watch all that output in a **separate terminal** with a nice TUI, without interrupting your main Claude Code session.\n\n## Features\n\n- **Multi-session support** - Watch all active Claude sessions simultaneously\n- **Hierarchical tree view** - Sessions with nested Main/Agent nodes\n- **Real-time streaming** - See thinking, tool calls, and outputs as they happen\n- **Subagent tracking** - Automatically discovers and displays subagent activity\n- **Session events** - Compaction boundaries, hook output, post-edit LSP diagnostics, and PR-link events surfaced inline\n- **Agent type labels** - Shows agent types (Explore, code-reviewer, etc.) from `.meta.json`\n- **Token usage tracking** - Cumulative input/output token counts in the header bar\n- **Per-agent context size** - Each Main/subagent row shows current context as a percentage of the model's max context window (`Main 18%`, `Explore 9%`). Denominator is the model's *max window* (1M for opus-4-7 / sonnet-4-6, 200k for haiku-4-5), **not** the auto-compact threshold\n- **Tool execution duration** - Shows how long each tool call took\n- **Background task visibility** - See background tasks (⏳/✓) under spawning agent\n- **Filtering** - Toggle visibility of thinking, tools, outputs per session/agent\n- **Auto-scroll** - Follows new output, or scroll freely through history\n\n## Requirements\n\n- Go 1.23 or later\n\n## Installation\n\n```bash\n# Install directly via go install\ngo install github.com/phiat/claude-esp@latest\n\n# Or clone and build from source\ngit clone https://github.com/phiat/claude-esp.git\ncd claude-esp\ngo build -o claude-esp .\n\n# Optional: install to PATH\ncp claude-esp ~/.local/bin/\n```\n\n### Pre-built binaries\n\nDownload pre-built binaries from the [Releases](https://github.com/phiat/claude-esp/releases) page. Available for Linux (amd64, arm64), macOS (amd64, arm64), and Windows (amd64).\n\n## Usage\n\n```bash\n# In your main terminal: run Claude Code as normal\nclaude\n\n# In a second terminal/tmux pane: run the watcher\nclaude-esp\n```\n\n### Options\n\n| Option     | Description                                   |\n| ---------- | --------------------------------------------- |\n| `-s \u003cID\u003e`  | Watch a specific session by ID                |\n| `-n`       | Start from newest (skip history, live only)   |\n| `-l`       | List recent sessions                          |\n| `-a`       | List active sessions                          |\n| `-p \u003cms\u003e`  | Poll interval in ms (fallback mode only, default 500) |\n| `-w \u003cdur\u003e` | Active window duration (default `5m`, e.g. `30s`, `2m`) |\n| `-m \u003cN\u003e`   | Max sessions to show in tree (default 0 = unlimited) |\n| `-c \u003cdur\u003e` | Auto-collapse sessions inactive ≥ dur (default 0 = disabled, e.g. `2m`) |\n| `-D`       | Debug: surface raw `type:subtype` for every JSONL line type the parser would otherwise drop |\n| `-v`       | Show version                                  |\n| `-h`       | Show help                                     |\n\n### Environment Variables\n\n| Variable      | Description                                         |\n| ------------- | --------------------------------------------------- |\n| `CLAUDE_HOME` | Override Claude config directory (default: `~/.claude`) |\n\n### Examples\n\n```bash\n# Watch all active sessions\nclaude-esp\n\n# Skip history, only show new output\nclaude-esp -n\n\n# List active sessions\nclaude-esp -a\n\n# Watch a specific session\nclaude-esp -s 0b773376\n\n# Faster poll interval (200ms)\nclaude-esp -p 200\n\n# List recent sessions\nclaude-esp -l\n```\n\n## Keybindings\n\n| Key       | Action                                    |\n| --------- | ----------------------------------------- |\n| `t`       | Toggle thinking visibility                |\n| `i`       | Toggle tool input visibility              |\n| `o`       | Toggle tool output visibility             |\n| `x`       | Toggle text/response visibility           |\n| `a`       | Toggle auto-scroll                        |\n| `h`       | Hide/show tree pane                       |\n| `A`       | Toggle auto-discovery of new sessions     |\n| `tab`     | Switch focus between tree and stream      |\n| `j/k/↑/↓` | Navigate tree or scroll stream            |\n| `space`   | On session: collapse/expand (pins on manual expand) · On agent: toggle visibility |\n| `s`       | Solo selected session/agent (toggle)      |\n| `enter`   | Load background task output (when selected)|\n| `g/G`     | Go to top/bottom of stream                |\n| `q`       | Quit                                      |\n\n## Auto-Collapse\n\nRun with `-c 2m` to automatically collapse sessions that have been idle for 2\nminutes. Collapsed sessions show `▸` instead of `▾` in the tree and display the\ncount of hidden subagents (e.g. `📂▸ my-session (+2)`). Children of collapsed\nsessions are also filtered out of the stream pane — the whole point is to stop\nsleeping sessions from dominating your view.\n\nPress `space` on a collapsed session to expand it manually. Manual expansion\n**pins** the session — it won't auto-collapse again until it wakes up (receives\nnew activity) and then goes idle once more. Press `s` to solo a session; if\nit's collapsed, Solo force-expands and pins it so you can see its output.\n\n## How It Works\n\nClaude Code stores conversation transcripts as JSONL files in:\n\n```\n~/.claude/projects/\u003cproject-path\u003e/\u003csession-id\u003e.jsonl\n```\n\nSubagents are stored in:\n\n```\n~/.claude/projects/\u003cproject-path\u003e/\u003csession-id\u003e/subagents/agent-\u003cid\u003e.jsonl\n```\n\nBackground task outputs are stored in:\n\n```\n~/.claude/projects/\u003cproject-path\u003e/\u003csession-id\u003e/tool-results/toolu_*.txt\n```\n\nThe watcher:\n\n1. Discovers active sessions (modified in last 5 minutes)\n2. Uses OS-native filesystem notifications ([fsnotify](https://github.com/fsnotify/fsnotify)) to detect file changes in real-time (inotify on Linux, kqueue/FSEvents on macOS)\n3. Falls back to polling (configurable with `-p`) on filesystems that don't support notifications (NFS, some cross-FS WSL2 setups)\n4. Debounces rapid writes (50ms window) to efficiently handle burst output\n5. Parses JSON lines and extracts thinking/tool_use/tool_result\n6. Discovers background tasks and correlates them with spawning agents\n7. Renders them in a TUI with tree navigation and filtering\n\n## tmux Setup\n\nRecommended tmux layout:\n\n```bash\n# Create a new tmux session with two panes\ntmux new-session -s claude \\; \\\n  split-window -h \\; \\\n  send-keys 'claude-esp' C-m \\; \\\n  select-pane -L \\; \\\n  send-keys 'claude' C-m\n```\n\nOr add to your `.tmux.conf`:\n\n```\nbind-key C-c new-window -n claude \\; \\\n  send-keys 'claude' C-m \\; \\\n  split-window -h \\; \\\n  send-keys 'claude-esp' C-m \\; \\\n  select-pane -L\n```\n\nThen press `prefix + Ctrl+C` to open a Claude Code workspace.\n\n## Project Structure\n\n```\nclaude-esp/\n├── main.go                 # CLI entry point\n├── internal/\n│   ├── parser/\n│   │   └── parser.go       # JSONL parsing\n│   ├── watcher/\n│   │   └── watcher.go      # File monitoring\n│   └── tui/\n│       ├── model.go        # Bubbletea main model\n│       ├── tree.go         # Session/agent tree view\n│       ├── stream.go       # Stacked output stream\n│       └── styles.go       # Lipgloss styling\n```\n\n## Development\n\nBuilt with [Bubbletea](https://github.com/charmbracelet/bubbletea) and [Lipgloss](https://github.com/charmbracelet/lipgloss). Issue tracking was done with [beads](https://github.com/steveyegge/beads).\n\n```bash\n# Run tests\ngo test ./...\n\n# Build\ngo build -o claude-esp .\n\n# Build with version injection\ngo build -ldflags \"-X main.version=0.4.0\" -o claude-esp .\n```\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphiat%2Fclaude-esp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphiat%2Fclaude-esp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphiat%2Fclaude-esp/lists"}