# pi-tmux-status

Show [pi](https://pi.dev) panel status (idle / working / asking) as colored icons in the tmux status bar.

## How it works

Each pi instance writes its current state to `/tmp/pi-tmux-{pane_id}.txt`. A companion shell script (auto-installed to `~/.config/tmux/pi-status.sh`) reads these files and renders colored icons next to each tmux window name.

## Icons

| Icon | Color | State | Meaning |
|------|-------|-------|---------|
| `○` | grey | **idle** | pi is waiting for user input |
| `●` | yellow (blinking) | **working** | pi is processing (LLM streaming / running tools) |
| `●` | red | **asking** | pi is waiting for user response (interactive tool or question) |

Only panes with a running pi instance show an icon. Panes without pi are hidden.

## Installation

```bash
pi install npm:pi-tmux-status
```

## Setup

Add these lines to `~/.tmux.conf`:

```tmux
set -g status-interval 1
set -g window-status-format         " #I:#W#(~/.config/tmux/pi-status.sh #{window_id}) "
set -g window-status-current-format " #I:#W*#(~/.config/tmux/pi-status.sh #{window_id}) "
```

Reload tmux:

```bash
tmux source-file ~/.tmux.conf
```

Reload pi (or restart):

```
/reload
```

The shell script is auto-generated by the extension on startup, so you don't need to create it manually.

## Requirements

- tmux 3.2+
- Running inside tmux (`$TMUX_PANE` must be set)
- A terminal that supports 256 colors and blinking text

## How states are detected

| State | Trigger |
|-------|---------|
| **idle** | `agent_end` fires and last assistant message has no question |
| **working** | `agent_start` fires (LLM is streaming or tools are executing) |
| **asking** | An interactive tool (e.g. `ask_user_question`) is executing, OR `agent_end` fires and the last assistant message contains a question (`?`) |

To add more interactive tools, edit the `INTERACTIVE_TOOLS` set in the extension source.

## License

MIT
