---
name: plan-todo
description: Write a delegation-ready plan and atomic task checklist in .selesai/tasks/.
disable-model-invocation: true
---

# Delegation-ready plan and todo

Produce two artifacts at the repository root:
- `.selesai/tasks/plan.md`: the authoritative PRD and handoff context.
- `.selesai/tasks/todo.md`: executable assignments referencing that context.

Plan only. Writing these files does not authorize implementation, delegation, live API calls, or editing user configuration.

## 1. Establish the handoff boundary

Inspect existing target files and the working tree before writing. For the requested change, locate behavior, callers, configuration, tests, packaging, and documentation. Verify source pointers against current files. Capture user agreements separately from proposals and unknowns; ask only about decisions that block a useful plan.

If the repository root is ambiguous, resolve it before choosing output paths. If existing artifacts describe different work, ask before replacing them. Preserve unrelated edits and untracked files.

**Done:** every affected subsystem has a verified reading lead, and every unresolved decision is labeled with its owner or next evidence-gathering action.

## 2. Write plan.md as the source of truth

Keep these sections, omitting sections that genuinely do not apply:

1. **Outcome and agreements:** problem, requested behavior, fixed names/contracts, scope, non-goals, and compatibility/removal policy.
2. **Current context:** behavior to preserve, exact source paths/symbols, relevant architecture, constraints, and work already present in the tree.
3. **Proposed design:** ownership boundaries, changed interfaces/data flow, risks, and explicit decisions still open. Do not promote a suggestion into a user agreement.
4. **Acceptance and validation:** observable success/failure conditions; exact known commands; checks requiring credentials, spending, permissions, or external evidence. Label unverified commands rather than inventing them.
5. **Handoff:** reading order, integration owner, shared-file rules, and evidence each worker must return.

Include enough context that an executor needs no chat history, but still must inspect authoritative source. Do not paste entire source files or repeat task-level instructions here.

**Done:** a fresh executor can identify the outcome, constraints, affected systems, and release gates without guessing; each factual claim has source evidence or an uncertainty label.

## 3. Write todo.md as atomic assignments

Give tasks stable IDs (`T01`, `T02`, …) and unchecked boxes. Each task records:

- **Action:** one independently checkable result, not a vague phase such as “implement the refactor.”
- **Scope:** owned files/modules and relevant reading leads.
- **Dependencies:** prerequisite IDs, or `none`.
- **Acceptance:** a binary, observable completion condition.
- **Validation:** command or inspection proving that condition.

Split tasks that combine separately verifiable results or unrelated ownership boundaries. Do not split a coherent edit into mechanical keystrokes. A discovery task must produce concrete findings needed by downstream tasks, not merely “understand the code.”

Organize dependency waves. Parallelize only disjoint ownership; assign shared manifests/configuration and final integration to one owner. A move/rename must land before tasks using the new paths. Keep implementation tasks blocked behind unresolved contract decisions.

Reference plan.md for shared requirements instead of copying them. Add this worker report contract once: task IDs, changed files, acceptance evidence, validation results, blockers, and downstream interface changes.

**Done:** every task has scope, prerequisites, acceptance, and validation; every plan acceptance condition is covered; no parallel assignments require concurrent edits to the same file.

## 4. Audit the pair and stop

Read both files as if the conversation were unavailable. Check paths, task IDs/dependencies, interface names, ownership conflicts, preservation of existing work, and consistency with user agreements. Remove duplicated requirements, speculative design presented as fact, stale context, and instructions that add no task-specific behavior.

Use proportional detail: enough to execute an assigned task, not a transcript or encyclopedic PRD. Keep rationale in plan.md and task mechanics in todo.md so each meaning has one authoritative home.

When relocating an existing pair from `tasks/`, compare destination contents first. Move only the requested files if the destination is absent or identical; otherwise ask before overwriting. Leave unrelated task documents untouched and update active references to the new paths.

**Done:** both artifacts exist at `.selesai/tasks/plan.md` and `.selesai/tasks/todo.md`, links/dependencies resolve, and each task can be assigned by ID with these two files. Report the paths and blockers; do not start implementation.
