| name | session-next |
| description | Implement the next task from the project's task sequence (backlog). Reads SEQUENCE.md, picks the next open entry that has a linked breakdown, executes it, and marks it done. Use when the user wants to make progress on the backlog without naming a specific task. Triggers on "/session-next" or when user says "implement the next task", "do the next task", "what's next — just do it", or "work the backlog". |
Session Next
Pick up and execute the next ready task from the sequence backlog.
Announce: "Using session-next to implement the next task from the sequence."
Non-Negotiables
- Only execute entries with a valid linked breakdown. An entry marked
(needs breakdown) or with a dangling link is not ready. Skip it and offer /session-groom.
- Mark
[x] on completion. Always update the entry in SEQUENCE.md. For a per-task breakdown, also set **Status**: [x] in the file. (A phase-file anchor has no per-task **Status** line — /session-delegation marks the phase tasks [x]; you just close the entry.) Do not batch — a backlog reader must see live state.
- Respect order and priority. Pick the topmost open entry; among equals, prefer lower P-number (P1 before P3). Don't cherry-pick the easy one.
- Hand off multi-task breakdowns. If the link points to a
session-task-planning phase file, dispatch via /session-delegation — do not try to do a whole phase as one task.
- One task per invocation unless told otherwise. Finish, report, and suggest the next. Don't silently churn through the whole backlog.
Path Resolution
- Read
.session-flow.json for paths.sequence, paths.tasks, paths.todo.
- If missing, detect
{todo}/SEQUENCE.md and {todo}/tasks/.
- If no sequence file exists, say so and suggest
/session-add-task or /session-gatekeeper to populate it (or /session-init if the project isn't set up).
Workflow
Step 1: Select the next entry
Read SEQUENCE.md. From top to bottom, find the first entry that is:
[ ] (open), and
- has a link to a breakdown (per-task file or phase-file anchor).
Among otherwise-equal candidates, prefer the lowest P-number. If the topmost open entries are all (needs breakdown), report that and offer to run /session-groom to prepare them.
Step 2: Open the breakdown
- Per-task file (
todo/tasks/NNNN-slug.md): read it. It contains Files, Instructions, Accept, Test.
- Phase-file anchor (
todo/...#TASK-ID): this is multi-task work → go to Step 4.
Step 3: Execute a per-task breakdown
Run the bite-sized prompt directly:
- Read all referenced files first.
- Write a test for the acceptance criteria (TDD).
- Implement until the test passes.
- Run the breakdown's exact Test command.
- Commit the change with a descriptive message.
Step 4: Hand off multi-task work
If the entry links to a phase file, invoke /session-delegation against that file. Delegation runs the dependency graph and marks each task [x]. The sequence entry is done only when the linked phase (or anchored task) is complete.
Step 5: Close out
- Mark the entry
[x] in SEQUENCE.md.
- Set
**Status**: [x] in the breakdown file (for per-task files).
- Report: what was implemented, files changed, test result.
- Suggest the next entry (or note the backlog is clear / needs grooming).
Anti-Patterns
Doing un-broken-down work:
- BAD: Improvising an implementation for a
(needs breakdown) one-liner
- GOOD: Skip it, run
/session-groom to research and break it down first
Not updating state:
- BAD: Implement the task, leave the entry
[ ]
- GOOD: Mark
[x] in SEQUENCE.md and the breakdown immediately
Cherry-picking:
- BAD: Jump to an easy P3 while a ready P1 sits at the top
- GOOD: Take the topmost ready entry, lowest P-number first
Swallowing a phase:
- BAD: Try to implement a whole multi-task phase file in one go
- GOOD: Hand off to
/session-delegation
Workflow Integration
SEQUENCE.md (backlog)
|
v
session-next ---> per-task breakdown ---> implement + commit ---> mark [x]
|
+--> phase-file anchor ---> session-delegation ---> mark [x] when phase done
session-next is the consumer end of the sequence layer: /session-add-task and /session-gatekeeper fill the backlog, /session-groom keeps it ready, and session-next works it down. After a task lands, consider /session-post-implementation to polish.