@juicesharp/rpiv-todo 1.20.0 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,128 +1,122 @@
1
- # rpiv-todo
1
+ # @juicesharp/rpiv-todo
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@juicesharp/rpiv-todo.svg)](https://www.npmjs.com/package/@juicesharp/rpiv-todo)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
2
5
 
3
6
  <div align="center">
4
7
  <a href="https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-todo">
5
- <picture>
6
- <img src="https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-todo/docs/cover.png" alt="rpiv-todo cover" width="50%">
7
- </picture>
8
+ <img src="https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-todo/docs/cover.png" alt="rpiv-todo — a persistent todo overlay for Pi Agent, showing a task panel with completed, in-progress, and pending rows" width="50%">
8
9
  </a>
9
10
  </div>
10
11
 
11
- Give the model a todo list it can keep across long sessions. `rpiv-todo` adds the `todo` tool, the `/todos` slash command, and a live overlay above the editor to [Pi Agent](https://github.com/badlogic/pi-mono) - tasks survive `/reload` and conversation compaction, so the model picks up where it left off.
12
-
13
- ![Todo overlay widget above the Pi editor](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-todo/docs/overlay.jpg)
14
-
15
- ## Features
16
-
17
- - **Live overlay above the editor** - see the model's plan at all times; completed items stay visible until the next agent response starts, then fall away; auto-hides when empty.
18
- - **Survives `/reload` and compaction** - tasks replay from the conversation branch, not disk.
19
- - **Status states** - pending, in_progress, completed, plus a deleted tombstone for audit.
20
- - **Dependency tracking** - `blockedBy` with cycle detection, so the model can sequence work.
21
- - **Smart truncation** - 12-line collapse threshold; completed tasks drop first, pending tasks stay visible last.
12
+ Give the model a task list you can see. `rpiv-todo` adds a `todo` tool, a
13
+ `/todos` command, and a live panel above the editor to
14
+ [Pi Agent](https://github.com/badlogic/pi-mono), so you always know what the
15
+ agent is doing now, what it finished, and what is queued. The list is rebuilt
16
+ from the conversation itself, so it survives `/reload` and compaction — useful
17
+ on long research → design → implement sessions.
22
18
 
23
19
  ## Install
24
20
 
25
- ```bash
21
+ ```sh
26
22
  pi install npm:@juicesharp/rpiv-todo
27
23
  ```
28
24
 
29
- Then restart your Pi session.
25
+ Restart your Pi session.
30
26
 
31
- ### Optional: localization
27
+ ## Quick start
32
28
 
33
- `rpiv-todo` works standalone - install only this package and you get the full English UI. Install `@juicesharp/rpiv-i18n` alongside it to flip the overlay heading, `/todos` section headers, and status words to your active locale:
29
+ Run `/todos` after the restart to confirm the extension is loaded. On a fresh
30
+ session it prints:
34
31
 
35
- ```bash
36
- pi install npm:@juicesharp/rpiv-i18n
37
32
  ```
38
-
39
- With the SDK present, locale resolves from `--locale <code>` → `~/.config/rpiv-i18n/locale.json` → `LANG` / `LC_ALL` → English. The `/languages` interactive picker and `pi --locale <code>` startup flag are also enabled. Without the SDK, the extension stays online and renders English at every call site - no warning, no crash. Users who installed via `pi install npm:@juicesharp/rpiv-pi` + `/rpiv-setup` get the SDK automatically.
40
-
41
- ## Tool
42
-
43
- - **`todo`** - create / update / list / get / delete / clear tasks. 4-state
44
- machine (pending → in_progress → completed, plus deleted tombstone).
45
- Supports `blockedBy` dependency tracking with cycle detection. Tasks persist
46
- via branch replay - survive session compact and `/reload`.
47
-
48
- ### Schema
49
-
50
- ```ts
51
- todo({
52
- action: "create" | "update" | "list" | "get" | "delete" | "clear",
53
-
54
- // create-only
55
- subject?: string, // required for create
56
- blockedBy?: number[], // initial dependency ids
57
-
58
- // create + update
59
- description?: string,
60
- activeForm?: string, // present-continuous label shown while in_progress
61
- owner?: string,
62
- metadata?: Record<string, unknown>, // pass null per key to delete that key on update
63
-
64
- // update-only
65
- addBlockedBy?: number[], // additive merge into blockedBy
66
- removeBlockedBy?: number[], // additive removal from blockedBy
67
-
68
- // update / get / delete
69
- id?: number, // task id
70
-
71
- // update (target) or list (filter)
72
- status?: "pending" | "in_progress" | "completed" | "deleted",
73
-
74
- // list-only
75
- includeDeleted?: boolean, // default false - hides tombstones
76
- })
33
+ No todos yet. Ask the agent to add some!
77
34
  ```
78
35
 
79
- Valid status transitions: `pending ⇄ in_progress`, either → `completed`, any → `deleted` (terminal). `delete` keeps the task as a tombstone so historic `blockedBy` references still resolve.
80
-
81
- Returns:
82
-
83
- ```ts
36
+ Then ask for something with several steps — "add a repository layer with tests,
37
+ and track it as todos". The model calls `todo` and the panel appears above your
38
+ input box, updating as work moves:
39
+
40
+ ![Todo overlay panel: a Todos (2/7) heading above two struck-through completed rows, one in-progress row with its activity label, and four pending rows](https://raw.githubusercontent.com/juicesharp/rpiv-mono/main/packages/rpiv-todo/docs/overlay.jpg)
41
+
42
+ Press `ctrl+shift+t` to collapse the panel to its heading plus a one-line hint,
43
+ and again to expand it. Run `/todos` at any time to print the full list grouped
44
+ by status.
45
+
46
+ ## What you get
47
+
48
+ - **The plan stays on screen.** A panel above the editor shows every task with a
49
+ status glyph, the label of whatever is in progress, and a `Todos (done/total)`
50
+ heading — you never have to ask the agent where it is.
51
+ - **Tasks survive `/reload` and compaction.** Each tool call carries the full
52
+ post-mutation snapshot, and the list is replayed from the session branch. No
53
+ disk writes, nothing to lose.
54
+ - **Finished work gets out of the way.** Completed rows stay visible for the rest
55
+ of the turn, then drop at the start of the next one; the panel disappears
56
+ entirely when the list empties.
57
+ - **The overlay never eats your terminal.** Past the row budget it drops
58
+ completed tasks first, truncates unfinished ones last, and tells you what it
59
+ hid with `+3 more (2 completed, 1 pending)`.
60
+ - **The agent can sequence work, not just list it.** `blockedBy` dependencies are
61
+ validated before anything is written — dangling ids, deleted dependencies,
62
+ self-blocks, and cycles are all rejected.
63
+ - **Parallel sessions stay separate.** Task state is keyed by session, so a
64
+ detached or child session can neither read nor overwrite the foreground list.
65
+ - **Localized UI, no setup required.** Nine locales ship with the package and
66
+ activate when [`@juicesharp/rpiv-i18n`](https://www.npmjs.com/package/@juicesharp/rpiv-i18n)
67
+ is installed; without it, everything falls back to English.
68
+
69
+ ## Configuration
70
+
71
+ Optional. Create `~/.config/rpiv-todo/config.json` (or
72
+ `$XDG_CONFIG_HOME/rpiv-todo/config.json` if you set that variable):
73
+
74
+ ```json
84
75
  {
85
- content: [{ type: "text", text: string }], // human-readable summary of the op
86
- details: { // full snapshot - replay reads this back
87
- action: TaskAction,
88
- params: Record<string, unknown>,
89
- tasks: Array<{
90
- id: number,
91
- subject: string,
92
- description?: string,
93
- activeForm?: string,
94
- status: "pending" | "in_progress" | "completed" | "deleted",
95
- blockedBy?: number[],
96
- owner?: string,
97
- metadata?: Record<string, unknown>,
98
- }>,
99
- nextId: number,
100
- error?: string, // present only on validation/transition failures
101
- }
76
+ "maxWidgetLines": 8,
77
+ "collapseKey": "alt+t"
102
78
  }
103
79
  ```
104
80
 
105
- ## Commands
106
-
107
- - **`/todos`** - print the current todo list grouped by status.
108
-
109
- ## Overlay
110
-
111
- The aboveEditor widget auto-renders whenever any overlay-visible tasks exist.
112
- Completed tasks stay visible after completion until the next agent response
113
- starts, then disappear from later overlay renders. 12-line collapse
114
- threshold; completed tasks still drop first on overflow, pending tasks
115
- truncate last. Auto-hides when the list is empty.
116
-
117
- ## Localization
118
-
119
- `rpiv-todo` localizes its TUI chrome (overlay heading, `/todos` section headers, status words) through `@juicesharp/rpiv-i18n` when the SDK is installed. Bundled locales: `de`, `en`, `es`, `fr`, `pt`, `pt-BR`, `ru`, `uk`. LLM-facing output (tool response envelope, reducer errors, schema descriptions) stays English by design.
120
-
121
- The SDK is a soft optional peer - `rpiv-todo` loads it via dynamic import at module init. If the SDK isn't installed, every render call site returns its inline English fallback and the extension stays online with English UI; no warning, no crash. See the Install section for adding the SDK after the fact. To contribute or override translations, see the `@juicesharp/rpiv-i18n` README "Contributing translations" section.
81
+ | Setting | What it does | Default |
82
+ | --- | --- | --- |
83
+ | `maxWidgetLines` | Content rows the overlay may use, heading included. Minimum `3`. Applies on the next repaint. | `12` |
84
+ | `collapseKey` | Key that collapses and expands the panel, in Pi keybinding form (`alt+o`, `ctrl+shift+t`). Set `"off"` to register no shortcut. Needs `/reload` to rebind. | `"ctrl+shift+t"` |
85
+ | `guidance` | Replaces the built-in instructions the extension gives the model about when and how to use the todo list. Needs `/reload`. | _(built-ins)_ |
86
+
87
+ A missing or malformed file falls back to these defaults. `rpiv-todo` only reads
88
+ this file — it never writes one. Full semantics:
89
+ [Configuration](https://github.com/juicesharp/rpiv-mono/blob/main/packages/rpiv-todo/docs/configuration.md).
90
+
91
+ ## Reference
92
+
93
+ - [`todo` tool reference](https://github.com/juicesharp/rpiv-mono/blob/main/packages/rpiv-todo/docs/tool-schema.md)
94
+ — every `todo` parameter, the status machine, the response envelope, and the
95
+ exact error strings.
96
+ - [Configuration](https://github.com/juicesharp/rpiv-mono/blob/main/packages/rpiv-todo/docs/configuration.md)
97
+ — config file resolution, option validation rules, and the accepted keybinding
98
+ grammar.
99
+ - [Overlay and `/todos`](https://github.com/juicesharp/rpiv-mono/blob/main/packages/rpiv-todo/docs/overlay.md)
100
+ — overlay lifecycle, glyphs, overflow behavior, `/todos` output, and
101
+ localization.
102
+
103
+ ## Requirements
104
+
105
+ - A Pi Agent host. No API key, no model selection, no native dependencies.
106
+ - An interactive session for the panel and `/todos`. Headless runs still get the
107
+ `todo` tool; nothing is rendered.
108
+ - [`@juicesharp/rpiv-i18n`](https://www.npmjs.com/package/@juicesharp/rpiv-i18n)
109
+ is an optional peer — install it for a localized UI, skip it for English.
110
+
111
+ ## Related
112
+
113
+ - [`@juicesharp/rpiv-i18n`](https://www.npmjs.com/package/@juicesharp/rpiv-i18n)
114
+ ([source](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-i18n))
115
+ — localizes this extension's UI chrome and adds a `/languages` picker.
116
+ - [`@juicesharp/rpiv-pi`](https://www.npmjs.com/package/@juicesharp/rpiv-pi)
117
+ ([source](https://github.com/juicesharp/rpiv-mono/tree/main/packages/rpiv-pi))
118
+ — the umbrella package that installs this extension alongside its siblings.
122
119
 
123
120
  ## License
124
121
 
125
- [![npm version](https://img.shields.io/npm/v/@juicesharp/rpiv-todo.svg)](https://www.npmjs.com/package/@juicesharp/rpiv-todo)
126
- [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
127
-
128
- MIT
122
+ MIT — see [LICENSE](https://github.com/juicesharp/rpiv-mono/blob/main/packages/rpiv-todo/LICENSE).
package/config.ts CHANGED
@@ -1,14 +1,101 @@
1
1
  import type { GuidanceFields } from "@juicesharp/rpiv-config";
2
- import { configPath, loadJsonConfig, validateGuidanceFields } from "@juicesharp/rpiv-config";
3
-
4
- const CONFIG_PATH = configPath("rpiv-todo");
2
+ import { loadJsonConfigWithLegacyFallback, validateGuidanceFields } from "@juicesharp/rpiv-config";
5
3
 
6
4
  interface TodoConfig {
7
5
  guidance?: GuidanceFields;
6
+ maxWidgetLines?: number;
7
+ /**
8
+ * Key spec for the overlay collapse/expand shortcut, in the same format as
9
+ * pi-coding-agent keybinding ids (`modifier+key`, e.g. `ctrl+shift+t`, `alt+o`).
10
+ * Defaults to `"ctrl+shift+t"`. Pass `"off"` to disable the collapse shortcut
11
+ * entirely. Validation happens in `resolveCollapseKey`, not at load.
12
+ */
13
+ collapseKey?: string;
8
14
  }
9
15
 
16
+ /** Default content-row budget when the config is missing/invalid — the prior
17
+ * hardcoded value, preserved as the fallback. */
18
+ export const DEFAULT_MAX_WIDGET_LINES = 12;
19
+
20
+ /** Key spec for the overlay collapse/expand shortcut, e.g. `"ctrl+shift+t"` or `"alt+o"`. */
21
+ export type CollapseKeySpec = string;
22
+
23
+ /** Default collapse/expand key when `collapseKey` is missing/empty/blank/invalid. */
24
+ export const DEFAULT_COLLAPSE_KEY: CollapseKeySpec = "ctrl+shift+t";
25
+
26
+ /** Sentinel value for `collapseKey` that disables the collapse shortcut entirely. */
27
+ export const COLLAPSE_KEY_OFF: CollapseKeySpec = "off";
28
+
10
29
  export function loadConfig(): TodoConfig {
11
- return loadJsonConfig<TodoConfig>(CONFIG_PATH);
30
+ return loadJsonConfigWithLegacyFallback<TodoConfig>("rpiv-todo");
31
+ }
32
+
33
+ /** Content-row budget for the overlay, read fresh on every call (per-render —
34
+ * no `/reload`). Mirrors warp's getHeartbeatMs minus its `=== 0` disabled
35
+ * sentinel: a non-number or a value below the floor of 3 falls back to the
36
+ * default; no ceiling. */
37
+ export function getMaxWidgetLines(): number {
38
+ const config = loadConfig();
39
+ const lines = config.maxWidgetLines;
40
+ if (typeof lines !== "number" || lines < 3) return DEFAULT_MAX_WIDGET_LINES;
41
+ return lines;
42
+ }
43
+
44
+ // Named keys accepted by pi-tui's `matchesKey` (keys.js switch on the parsed base key).
45
+ // parseKeyId lowercases the id before matching, so lowercase spellings are canonical.
46
+ const SPECIAL_KEYS = new Set([
47
+ "escape",
48
+ "esc",
49
+ "enter",
50
+ "return",
51
+ "tab",
52
+ "space",
53
+ "backspace",
54
+ "delete",
55
+ "insert",
56
+ "clear",
57
+ "home",
58
+ "end",
59
+ "pageup",
60
+ "pagedown",
61
+ "up",
62
+ "down",
63
+ "left",
64
+ "right",
65
+ ...Array.from({ length: 12 }, (_, i) => `f${i + 1}`),
66
+ ]);
67
+
68
+ const MODIFIERS = new Set(["ctrl", "shift", "alt", "super"]);
69
+
70
+ /** Validate a collapse-key spec against pi-tui's KeyId grammar (verbatim port from
71
+ * rpiv-ask-user-question). Exported for unit tests. */
72
+ export function isValidCollapseKeySpec(spec: string): boolean {
73
+ // Mirror pi-tui's KeyId grammar strictly: zero or more distinct modifiers, then a
74
+ // base key that is a single printable character or a named special key. A loose
75
+ // check is not enough — pi-tui's `parseKeyId` takes the LAST `+`-part as the key
76
+ // and ignores unknown parts, so a typo like `ctr+]` would silently match every
77
+ // bare `]` keypress (and the raw terminal listener would consume them globally).
78
+ if (!spec) return false;
79
+ if (spec.startsWith("+") || spec.endsWith("+") || spec.includes("++")) return false;
80
+ const parts = spec.split("+");
81
+ const base = parts[parts.length - 1] ?? "";
82
+ const modifiers = parts.slice(0, -1);
83
+ if (modifiers.length !== new Set(modifiers).size) return false;
84
+ if (!modifiers.every((m) => MODIFIERS.has(m))) return false;
85
+ return base.length === 1 ? /[a-z0-9_\-!@#$%^&*()|~`'":;,./<>?[\]{}=\\]/.test(base) : SPECIAL_KEYS.has(base);
86
+ }
87
+
88
+ /** Resolve the collapse/expand key from config, read fresh on every call
89
+ * (per-render / per-registration — no `/reload`); mirrors getMaxWidgetLines().
90
+ * Returns DEFAULT_COLLAPSE_KEY when the field is missing/non-string/empty/blank/
91
+ * invalid, COLLAPSE_KEY_OFF when set to the sentinel, or the lowercased validated
92
+ * spec. */
93
+ export function resolveCollapseKey(): CollapseKeySpec {
94
+ const config = loadConfig();
95
+ const raw = typeof config.collapseKey === "string" ? config.collapseKey.trim().toLowerCase() : undefined;
96
+ if (raw === undefined || raw === "") return DEFAULT_COLLAPSE_KEY;
97
+ if (raw === COLLAPSE_KEY_OFF) return COLLAPSE_KEY_OFF;
98
+ return isValidCollapseKeySpec(raw) ? raw : DEFAULT_COLLAPSE_KEY;
12
99
  }
13
100
 
14
101
  export { validateGuidanceFields };
@@ -0,0 +1,108 @@
1
+ # Configuration reference
2
+
3
+ Every option
4
+ [`@juicesharp/rpiv-todo`](https://www.npmjs.com/package/@juicesharp/rpiv-todo)
5
+ reads, where the file lives, and exactly what happens when a value is wrong.
6
+
7
+ ## Where the file lives
8
+
9
+ The config file is optional. It is resolved in this order:
10
+
11
+ 1. `$XDG_CONFIG_HOME/rpiv-todo/config.json` — used when `XDG_CONFIG_HOME` is set
12
+ to an absolute path. A bare `~` or a leading `~/` is expanded first; a `~user`
13
+ form is not expanded and therefore falls through.
14
+ 2. `~/.config/rpiv-todo/config.json` — used when `XDG_CONFIG_HOME` is unset,
15
+ empty, whitespace-only, or relative.
16
+ 3. If the XDG file does not exist, the legacy `~/.config/rpiv-todo/config.json`
17
+ is read anyway, so a pre-XDG file is still found after you set
18
+ `XDG_CONFIG_HOME`. This fallback is one-way: if the XDG file exists but is
19
+ malformed, you get a warning and defaults — it does **not** quietly read the
20
+ legacy file instead.
21
+
22
+ Both files missing means every default applies. Malformed JSON prints a
23
+ `rpiv-config: invalid JSON at …` warning and is treated as `{}`. A JSON array or
24
+ a non-object value (`null`, a string, a number, a boolean) is silently treated as
25
+ `{}` — no warning.
26
+
27
+ `rpiv-todo` never writes this file — you create and edit it yourself, and the
28
+ extension only reads it.
29
+
30
+ ## Example
31
+
32
+ ```json
33
+ {
34
+ "maxWidgetLines": 8,
35
+ "collapseKey": "alt+t",
36
+ "guidance": {
37
+ "promptSnippet": "Use the `todo` tool to track multi-step work before starting it.",
38
+ "promptGuidelines": [
39
+ "Create one task per discrete step.",
40
+ "Mark a task in_progress while working on it; completed when done."
41
+ ]
42
+ }
43
+ }
44
+ ```
45
+
46
+ ## `maxWidgetLines`
47
+
48
+ **Default `12`.** The content-row budget for the overlay — the heading row and,
49
+ on overflow, the `+N more` summary row both count against it. Only the trailing
50
+ blank spacer sits outside the budget, so `12` renders up to 13 terminal rows.
51
+
52
+ - Floor of `3`. A number below `3` falls back to the default.
53
+ - A non-number falls back to the default.
54
+ - No ceiling.
55
+ - Read fresh on every render, so a change takes effect on the next repaint —
56
+ no `/reload`.
57
+
58
+ ## `collapseKey`
59
+
60
+ **Default `"ctrl+shift+t"`.** The shortcut that collapses and expands the
61
+ overlay.
62
+
63
+ The value is trimmed and lowercased, then matched against Pi's keybinding
64
+ grammar: zero or more distinct modifiers joined by `+`, then a base key.
65
+
66
+ | Part | Accepted |
67
+ | --- | --- |
68
+ | Modifiers | `ctrl`, `shift`, `alt`, `super` — each at most once |
69
+ | Base key | one printable character (`a`, `7`, `]`, `/`, …) |
70
+ | Base key | a named key: `escape`, `esc`, `enter`, `return`, `tab`, `space`, `backspace`, `delete`, `insert`, `clear`, `home`, `end`, `pageup`, `pagedown`, `up`, `down`, `left`, `right`, `f1`–`f12` |
71
+
72
+ Examples: `alt+o`, `ctrl+shift+t`, `super+alt+f5`.
73
+
74
+ - A missing, empty, blank, non-string, or ungrammatical value falls back to the
75
+ default. The grammar is checked strictly on purpose: Pi takes the last `+`-part
76
+ as the base key and ignores unknown parts, so a typo like `ctr+]` would
77
+ otherwise capture every bare `]` keypress globally.
78
+ - `"off"` disables the feature — no shortcut is registered at all.
79
+ - The binding is resolved **once at extension load**. After editing this value,
80
+ run `/reload` to rebind; until you do, the old key stays active even though the
81
+ collapsed panel's hint text (which is resolved per render) already shows the
82
+ new one.
83
+
84
+ ## Guidance
85
+
86
+ `guidance.promptSnippet` (string) and `guidance.promptGuidelines` (array of
87
+ strings) replace the prompt copy the `todo` tool advertises to the model. Both
88
+ are absent by default, in which case the built-in snippet and the seven built-in
89
+ guideline bullets are used.
90
+
91
+ - `promptSnippet` must be a non-empty string; an empty string or a wrong type
92
+ falls back to the default.
93
+ - `promptGuidelines` must be a non-empty array of non-empty strings. A non-array,
94
+ or an array containing an empty string, falls back to the default — the array
95
+ is all-or-nothing, not merged item by item.
96
+ - Both are read at extension load, so `/reload` after editing them.
97
+
98
+ ## Environment variables
99
+
100
+ | Variable | Effect |
101
+ | --- | --- |
102
+ | `XDG_CONFIG_HOME` | Relocates the config directory, as described above. |
103
+ | `HOME` | Anchors `~/.config` when `XDG_CONFIG_HOME` does not apply. |
104
+
105
+ `rpiv-todo` reads no environment variables of its own. If you have
106
+ [`@juicesharp/rpiv-i18n`](https://www.npmjs.com/package/@juicesharp/rpiv-i18n)
107
+ installed, that package has its own locale configuration and its own env-var
108
+ chain — see its README.
@@ -0,0 +1,127 @@
1
+ # Overlay and `/todos` display
2
+
3
+ How
4
+ [`@juicesharp/rpiv-todo`](https://www.npmjs.com/package/@juicesharp/rpiv-todo)
5
+ renders the task list — when the overlay appears, what each glyph means, how
6
+ overflow is trimmed, and which strings localize.
7
+
8
+ ## When the overlay exists
9
+
10
+ The widget is mounted above the Pi editor under the key `rpiv-todos`.
11
+
12
+ | Stage | Condition |
13
+ | --- | --- |
14
+ | Created | At the first session start that has a UI. A headless session never creates it. |
15
+ | Registered | Only while at least one overlay-visible task exists. The widget unregisters itself when the list empties, and re-registers when a task reappears. |
16
+ | Bound | Only the foreground session's overlay is refreshed. A detached or child session has its own task state and never rebinds or repaints the foreground panel. |
17
+ | Disposed | On the foreground session's shutdown. A child session shutting down leaves the overlay alone. |
18
+
19
+ Task state is partitioned by session id, so parallel sessions cannot read or
20
+ overwrite each other's lists. Nothing is written to disk: on session start,
21
+ compaction, and session-tree changes, the list is rebuilt by walking the branch
22
+ and taking the last `todo` tool result's snapshot, which replaces the whole list
23
+ (last-write-wins).
24
+
25
+ ## Anatomy of a row
26
+
27
+ ```
28
+ ● Todos (2/5)
29
+ ├─ ✓ Create DemoTodo domain entity
30
+ ├─ ✓ Create IDemoTodoRepository interface
31
+ ├─ ◐ Create DemoTodoRepository (creating the repository)
32
+ ├─ ○ Register DI bindings
33
+ └─ ○ Add integration tests
34
+ ```
35
+
36
+ - **Heading** — `● Todos (done/total)` in the accent color while any task is
37
+ `pending` or `in_progress`; `○ Todos (done/total)` dimmed once everything is
38
+ completed.
39
+ - **Glyphs** — `○` pending, `◐` in_progress, `✓` completed, `✗` deleted.
40
+ Completed and deleted subjects render dim and struck through.
41
+ - **activeForm** — appended dim in parentheses, only while the task is
42
+ `in_progress`.
43
+ - **Dependencies** — appended as `⛓ #1,#2` when the task has a `blockedBy` set.
44
+ - **`#id` prefix** — shown on every row only when at least one visible task
45
+ carries a `blockedBy`. Without a `⛓ #N` anywhere, the per-row ids have nothing
46
+ to point at, so they are omitted.
47
+ - **Prefixes** — `├─` on each row, `└─` on the last one. A blank spacer line is
48
+ always appended below the panel so it is not flush against the input box.
49
+
50
+ Rows longer than the terminal width are truncated with `…`.
51
+
52
+ ## Overflow
53
+
54
+ The content-row budget is `maxWidgetLines` (default `12`), and the heading counts
55
+ against it. When there are more tasks than fit:
56
+
57
+ 1. one row is reserved for the summary line;
58
+ 2. completed tasks are dropped first, newest first — the oldest completed rows
59
+ are the last completed rows to go;
60
+ 3. if the unfinished tasks alone still overflow, the tail of that list is
61
+ truncated;
62
+ 4. the last row becomes `+N more (X completed, Y pending)`.
63
+
64
+ Unfinished work is therefore the last thing to disappear. See
65
+ [configuration.md](./configuration.md#maxwidgetlines) for the budget's floor and
66
+ reload semantics.
67
+
68
+ ## Completed tasks fading out
69
+
70
+ A completed task stays on screen for the remainder of the turn in which it was
71
+ completed. At the start of the next agent turn, every completed row that has
72
+ already been displayed is hidden from later renders. Reloading or compacting the
73
+ session resets that tracking, so a fresh session shows the full list again.
74
+
75
+ ## Collapsing
76
+
77
+ Press `ctrl+shift+t` to collapse the panel to two lines — the heading plus a dim
78
+ `└─ ctrl+shift+t to expand` hint — and again to expand it. The hint always shows
79
+ the currently configured key.
80
+
81
+ Rebind or disable the shortcut with the `collapseKey` option; see
82
+ [configuration.md](./configuration.md#collapsekey). If the shortcut is set to
83
+ `"off"` while the panel is collapsed, the hint becomes a static `collapsed`
84
+ label rather than advertising an unbindable key.
85
+
86
+ ## `/todos`
87
+
88
+ `/todos` prints the whole list grouped by status, independent of the overlay's
89
+ row budget and auto-hiding:
90
+
91
+ ```
92
+ 2/7 completed · 1 in progress · 4 pending
93
+ ── Pending ──
94
+ ○ #4 Register DI bindings
95
+ ○ #5 Add integration tests ⛓ #4
96
+ ○ #6 Wire up the HTTP endpoint
97
+ ○ #7 Update the API docs
98
+ ── In Progress ──
99
+ ◐ #3 Create DemoTodoRepository (creating the repository)
100
+ ── Completed ──
101
+ ✓ #1 Create DemoTodo domain entity
102
+ ✓ #2 Create IDemoTodoRepository interface
103
+ ```
104
+
105
+ The header omits any count that is zero. Sections appear only when they have
106
+ tasks. Tombstoned tasks are never listed.
107
+
108
+ - With no tasks: `No todos yet. Ask the agent to add some!`
109
+ - In a non-interactive session: `/todos requires interactive mode`
110
+
111
+ ## Localization
112
+
113
+ The overlay heading, the `+N more` summary, the collapse hint, the `/todos`
114
+ section headers, and the status words all localize through
115
+ [`@juicesharp/rpiv-i18n`](https://www.npmjs.com/package/@juicesharp/rpiv-i18n)
116
+ when that package is installed. Bundled locales: `de`, `en`, `es`, `fr`, `pt`,
117
+ `pt-BR`, `ru`, `uk`, `zh`.
118
+
119
+ LLM-facing output — the tool response envelope, reducer error messages, and the
120
+ schema descriptions — stays English by design.
121
+
122
+ The SDK is a soft optional peer, loaded through a dynamic import at module init.
123
+ When it is absent, every call site returns its inline English literal and the
124
+ extension stays online: no warning, no crash. Install it at any time with
125
+ `pi install npm:@juicesharp/rpiv-i18n` and restart the session. To add or
126
+ override a translation, drop a `locales/<code>.json` file mirroring `en.json` —
127
+ see the `@juicesharp/rpiv-i18n` README's "Contributing translations" section.