# Source audit: todo-write

Decision: copy-after-audit, active compatibility wrapper. The current `todo-context` extension ports the core OMP `todo_write` mutation semantics and a compact `/todo` command subset into a local `miloc-pi` compatibility surface that is loaded by default.

OMP source evidence:
- `/tmp/oh-my-pi-review/packages/coding-agent/src/tools/todo-write.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/modes/controllers/todo-command-controller.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/slash-commands/helpers/todo.ts`
- `/tmp/oh-my-pi-review/packages/coding-agent/src/prompts/tools/todo-write.md`
- `/tmp/oh-my-pi-review/packages/coding-agent/test/tools/todo-write.test.ts`
- `/tmp/oh-my-pi-review/docs/tools/todo_write.md`
- `/tmp/oh-my-pi-review/LICENSE`

License note: OMP checkout is MIT-licensed. Local `todo_write` ports core mutation/result semantics and a small session-entry restore layer from the listed source evidence while leaving full UI behavior unported.

Ported contract:
- Primary tool name is `todo_write`.
- Slash command `/todo` supports show, `copy` as Markdown print, `append`, `start`, `done`, `drop`, `rm`, and `edit` through the Pi editor API.
- `/todo edit` round-trips OMP-style Markdown checklist markers and blockquote notes.
- Supported ops are `init`, `start`, `done`, `drop`, `rm`, `append`, and `note`.
- Result details expose OMP-style `phases[]` with `name`, `tasks[]`, and task statuses `pending`, `in_progress`, `completed`, and `abandoned`.
- `done`, `drop`, and `rm` support task, phase, or all-task targeting.
- Bad references return `isError=true` with accumulated errors while preserving already-applied mutations.
- Task-like ids such as `task-1` return the OMP-style hint that tasks are referenced by content, not by IDs.
- `details.completedTasks[]` records newly completed tasks in the current batch.
- Latest phases are written to Pi entries with type `todo_write`, and the next call restores from the latest matching entry before falling back to process memory.

Known gaps:
- Local storage is session-entry backed but not a full OMP session transcript integration.
- Local UI does not include OMP sticky todo panel, tree renderer, completion animation, reminder hooks, clipboard copy, or filesystem import/export.
- Full OMP sticky todo panel, reminder hooks, clipboard copy, filesystem import/export, and richer renderer remain unported enhancements.
