| Crates.io | aiwatch |
| lib.rs | aiwatch |
| version | 0.2.0 |
| created_at | 2026-01-16 00:07:34.097784+00 |
| updated_at | 2026-01-17 16:27:16.764601+00 |
| description | A TUI tool for monitoring Claude Code and OpenCode AI agent activity in real-time |
| homepage | https://github.com/nyanko3141592/subagent-viewer |
| repository | https://github.com/nyanko3141592/subagent-viewer |
| max_upload_size | |
| id | 2047357 |
| size | 162,846 |
A TUI (Terminal UI) tool for monitoring Claude Code and OpenCode AI agent activity in real-time.
cargo install aiwatch
# Clone the repository
git clone https://github.com/nyanko3141592/subagent-viewer.git
cd subagent-viewer
# Build in release mode
cargo build --release
# Run directly
./target/release/aiwatch
cargo install --path .
Now you can run aiwatch from anywhere.
Run the viewer in a separate terminal while using Claude Code or OpenCode:
aiwatch
The viewer will automatically:
~/.claude/) and OpenCode (~/.local/share/opencode/) directoriesaiwatchq to quit when done ⏹ 1 入力待ち 2分 ⏸ 1 承認待ち ● 2 実行中
ProjectA ● | ProjectB ✓ | ProjectC ! <- Summary bar
┌─ ▼ SubagentViewer ● ──────────────────────────┐ <- Green border (active)
│ 🤖 🌿main 45% ✓2○3 │ <- Info line (compact)
│ ▶ Implementing feature X │ <- In-progress TODO (heading)
│ ├ 📋 Plan ✓ 25s Read Edit │ <- Completed agent (gray)
│ ├ 🔍 Explore ✓ 1m Grep Glob │ <- Tree structure
│ └ 🤖 Agent ● 2m Bash Read +2 │ <- Running agent (green)
│ ✓3 ○Add tests ○Update docs │ <- TODO summary (horizontal)
└───────────────────────────────────────────────┘
┌─ ▼ OtherProject ⏸ ────────────────────────────┐ <- Yellow (approval waiting)
│ 🤖 🌿main 50% ✓1○2 ⚠Bash待ち[2m] │ <- Waiting info in collapsed
│ ⚠ BASH待ち: git push origin [2m] │ <- Alert banner (yellow bg)
│ ▶ Deploy to production │
│ └ 🔍 Explore ● 30s Grep Glob │
└───────────────────────────────────────────────┘
┌─ ▶ IdleProject ! ─────────────────────────────┐ <- Red border (input waiting)
│ 🤖 5m 50% ⏹入力待ち[5m] │ <- Collapsed with wait info
└───────────────────────────────────────────────┘
j/k nav ⏎ toggle c[ ]cwd v[ ]compact q quit
Card display features:
Hybrid layout (agents + TODOs):
Multi-column layout (wide terminal):
┌─ ▼ ProjectA ● ─────┐ ┌─ ▼ ProjectB ✓ ─────┐ ┌─ ▶ ProjectC ⏸ ─────┐
│ 🤖 45% ✓2○3 │ │ 🤖 80% │ │ 🤖 50% ⚠Bash待ち │
│ ▶ Task in progress │ │ All done! │ └─────────────────────┘
│ └ 🔍 Explore ● 2m │ └─────────────────────┘
│ ✓2 ○Task1 ○Task2 │
└─────────────────────┘
| Key | Action |
|---|---|
j / ↓ |
Select next project |
k / ↑ |
Select previous project |
Enter / Space |
Toggle expand/collapse selected project |
e |
Toggle expand/collapse all projects |
c |
Toggle current directory filter |
v |
Toggle compact mode (summary only) |
d |
Scroll down 10 lines |
u |
Scroll up 10 lines |
g |
Go to top |
G |
Go to bottom |
r |
Refresh |
q |
Quit |
| Mouse scroll | Up/Down 3 lines |
The viewer monitors internal data from both Claude Code and OpenCode:
Claude Code (🤖):
~/.claude/projects/ - Session logs (JSONL files)~/.claude/todos/ - Todo lists per sessionOpenCode (🔓):
~/.local/share/opencode/storage/project/ - Project metadata~/.local/share/opencode/storage/session/ - Session metadata~/.local/share/opencode/storage/message/ - Message/token data~/.local/share/opencode/storage/todo/ - Todo listsIt parses tool_use events from session logs and displays them grouped by project.
| Color | Meaning | Details |
|---|---|---|
| Green | Active | Project had activity within the last 30 seconds |
| Red | Input Waiting | Project is waiting for user input (⏹ status) |
| Gray | Idle | No recent activity or other states |
| Icon | Meaning | Color | Details |
|---|---|---|---|
| ● | Active/Running | Green/Cyan | Project is actively running |
| ✓ | Completed | Green | Session completed successfully |
| ○ | Waiting | Yellow | Waiting for Bash/File approval |
| ! | Input Waiting | Red | Waiting for user input (highlighted) |
| ? | Unknown | Gray | Status could not be determined |
| Symbol | Meaning | Details |
|---|---|---|
| ▼ | Expanded | Project card is expanded, showing details |
| ▶ | Collapsed | Project card is collapsed, showing only header |
| 🤖 | Claude Code | This project is being monitored from Claude Code's session logs |
| 🔓 | OpenCode | This project is being monitored from OpenCode's storage |
| 🌿 | Git Branch | Shows the current git branch name for this project (e.g., 🌿main) |
| 📊 | Context Usage | Token usage display with percentage (e.g., 45k(22%)) |
| ✓ | Completed Todos | Number of completed todo items (e.g., ✓2) |
| ○ | Pending Todos | Number of pending/in-progress todo items (e.g., ○3) |
| Color | Threshold | Meaning |
|---|---|---|
| Red | > 150k tokens | Context window nearly full (75%+) |
| Yellow | > 100k tokens | Context usage moderate (50%+) |
| Gray | ≤ 100k tokens | Context usage safe (50% or less) |
Projects waiting for user input are highlighted with a red border and the ⏹ (stop) icon.
| State | Icon | Border Color | Description |
|---|---|---|---|
| Input Waiting | ⏹ | Red | Waiting for user input - requires attention |
| Bash Waiting | ⏸ | Yellow (gray border) | Waiting for Bash command approval |
| File Waiting | ⏸ | Yellow (gray border) | Waiting for file change approval |
| Running | ⟳ | Green/Cyan | Currently executing |
| Icon | Meaning | Color |
|---|---|---|
| ✓ | Completed | Green |
| ▶ | In progress | Yellow |
| ○ | Pending | Dark gray |
| Icon | Color | Meaning | When it appears |
|---|---|---|---|
| ✓ | Gray | Completed | Subagent finished successfully |
| ● | Green | Running | Subagent is currently executing tasks |
| ○ | Gray | Unknown | Subagent status could not be determined |
| Emoji | Agent Type | Description |
|---|---|---|
| 🔍 | Explore | Codebase exploration agent |
| 📝 | Plan | Planning/architecture agent |
| 💻 | Bash | Command execution agent |
| 🤖 | general-purpose | General purpose agent |
| ✨ | code-simplifier | Code simplification agent |
| 📚 | claude-code-guide | Documentation/guide agent |
| ⚙️ | statusline-setup | Configuration agent |
Each project is displayed as a bordered card with a hybrid layout:
Expanded Card (with approval waiting):
┌─ ▼ ProjectName ⏸ ─────────────┐ <- Title: expand icon + name + status
│ 🤖 🌿branch 45% ✓2○3 │ <- Info line: source, branch, context%, todos
│ ⚠ BASH待ち: git push [2m] │ <- Alert banner (yellow bg) - if waiting
│ ▶ Implementing feature X │ <- In-progress TODO as heading
│ ├ 📋 Plan ✓ 25s ... │ <- Agent: icon, name, status, duration, tools
│ └ 🔍 Explore ● 30s ... │ <- Tree structure with ├ └ connectors
│ ✓3 ○Add tests ○Update docs │ <- TODO summary (horizontal)
└───────────────────────────────┘
Collapsed Card:
┌─ ▶ ProjectName ● ─────────────┐ <- Collapsed indicator (▶)
│ 🤖 🌿main 45% ✓2○3 │ <- Compact info line
└───────────────────────────────┘
┌─ ▶ ProjectName ⏸ ─────────────┐ <- With waiting status
│ 🤖 🌿main 50% ⚠Bash待ち[2m] │ <- Shows waiting info inline
└───────────────────────────────┘
Agent Line Format:
├ 📋 Plan ✓ 25s Read Edit +2
│ │ │ │ │ │
│ │ │ │ │ └─ Extra tool count
│ │ │ │ └─ Tool names (max 3)
│ │ │ └─ Duration
│ │ └─ Status (✓=done, ●=running)
│ └─ Agent type with icon
└─ Tree connector (├ or └)
| Tool | Color | Description |
|---|---|---|
| Task | Magenta | Subagent/spawned agent tasks |
| Bash / Write / Edit | Yellow | Commands and file modifications |
| Other | Gray | All other tools (Read, Grep, etc.) |
| Symbol | Meaning |
|---|---|
| ↑↓ scroll | Shows that content is scrollable |
| [X/Y] | Current position indicator (X = current page, Y = total pages) |
The UI uses a unified 6-color palette for consistency:
| Color | Usage |
|---|---|
| Cyan (Primary) | Selection, headers, TODO section |
| Magenta (Secondary) | Agents, Task tools |
| Gray (Muted) | Inactive elements, tree lines |
| Green (Success) | Active, completed |
| Yellow (Warning) | Pending, Bash/Write/Edit tools |
| Red (Alert) | Input waiting, context critical |
~/.claude/projects/ or ~/.local/share/opencode/storage/ exists and contains dataQ: Does aiwatch modify any files? A: No, it only reads logs and data files from Claude Code/OpenCode directories.
Q: Can I use it with both Claude Code and OpenCode simultaneously? A: Yes, it monitors both and displays projects from either tool with appropriate icons (🤖 for Claude Code, 🔓 for OpenCode).
Q: What does the context usage percentage mean? A: It shows the token usage relative to Claude's 200k context window. Red indicates >150k, yellow indicates >100k.
Q: Why does it only show sessions from the last hour? A: To keep the display focused and performant. Only recent activity is typically relevant.
Q: How often does it refresh? A: Every 300ms automatically, plus immediately when files change (via file system watcher).
Contributions are welcome! Please feel free to submit a Pull Request.
MIT