# @wayofmono/pi-todo

Session-scoped todo list with 4 statuses and 3 priorities for [Pi Coding Agent](https://github.com/earendil-works/pi).

## Install

```sh
pi install npm:@wayofmono/pi-todo
```

Restart your Pi session.

## Quick Start

Run `/todos` after restart to open the interactive todo panel. On a fresh session it shows:

```
No todos.
```

Then ask the agent to create todos: *"Add a repository layer with tests, track it as todos"*. The model calls the `todo` tool and the panel appears above the editor.

## Features

- **4 statuses**: `pending`, `in_progress`, `completed`, `cancelled`
- **3 priorities**: `high`, `medium`, `low`
- **Survives `/reload` and compaction** — state rebuilt from session branch
- **Interactive panel** — press `Ctrl+C` or `Escape` to close
- **Single in-progress enforcement** — model auto-resets previous in-progress

## Commands

| Command | Description |
|---------|-------------|
| `/todos` | Open interactive todo panel |

## Tool: `todo`

| Action | Parameters | Description |
|--------|------------|-------------|
| `list` | — | List all todos |
| `add` | `content`, `priority?` | Add new todo |
| `update` | `index`, `status?`, `priority?`, `content?` | Update todo |
| `remove` | `index` | Remove todo |
| `clear` | — | Clear all todos |
| `replace` | `todos[]` | Replace entire list |

### Status values
- `pending` (○) — default
- `in_progress` (►) — auto-clears other in_progress
- `completed` (✓) — done
- `cancelled` (✗) — abandoned

### Priority values
- `high` (HIGH)
- `medium` (med) — default
- `low` (low)

## Example Usage

```typescript
// Add a todo
await todo({ action: "add", content: "Write tests", priority: "high" })

// Mark in progress
await todo({ action: "update", index: 0, status: "in_progress" })

// Complete it
await todo({ action: "update", index: 0, status: "completed" })
```

## How It Works

State is stored in session entries (tool results). On `session_start` and `session_tree`, the extension replays the branch and reconstructs the todo list from the latest `todo` tool result. No disk writes — survives `/reload` and compaction automatically.

## License

MIT