Skip to content

Execution Workflows

Wave-based execution, atomic commits, lifecycle CRUD on tasks. Every commit produced here obeys ADR-0004 — one unit, one commit, no exceptions.

np:execute-phase

The default execution entry point. Reads the task graph from every <NN>-<MM>-PLAN.md in the phase, computes execution waves, and emits one executor-spawn payload per task per wave.

For each task the orchestrator spawns np-executor (tier=sonnet) with:

  • the task file (tasks/<task-id>.md or the inline <task> block),
  • the parent PLAN.md,
  • a <files_to_read> block enumerating dependent context.

The executor runs the workflow described in Concepts → Phase Lifecycle — checkpoint transitions, scoped edits, verify, atomic commit via np-tools.cjs commit-task.

bash
np:execute-phase 5

np:execute-plan

Single-plan variant. Same orchestration, scoped to one <NN>-<MM>-PLAN.md. Useful when a phase has multiple plans and you want to ship them out of order or one at a time.

np:autonomous

In-session auto-advance loop. Sets workflow.auto_advance = true, then loops np:next → spawn the next workflow → wait for completion → repeat. Cleared on exit or abort.

This is not a daemon (ADR-0001). It is a foreground loop running inside the host CLI's session — closing the CLI ends the loop. Cross-session auto-advance is explicitly out of scope.

np:verify-work

Post-execution verification. Spawns np-verifier (tier=sonnet), which reads ROADMAP.md success_criteria + every plan's PLAN.md + the union of files_modified across task frontmatter + the per-phase task commits.

Output is <NN>-VERIFICATION.md with one entry per SC, classified as Pass / Fail / Defer / Needs-User-Confirm. Presence of this file flips np:next from rule-4 to rule-5 for the phase.

bash
np:verify-work 5

np:add-tests

Persists the Pass-classified UAT cases from <NN>-VERIFICATION.md into node:test files. Sentinel-preserving: existing tests are not overwritten, only appended to.

np:commit-task

Atomic per-task git commit. Routes through lib/git.cjs:

  1. assertCommittablePaths(files_modified) — hard-fails when all declared paths are gitignored (D-25), warns on partial (D-26).
  2. git add -- <files_modified> (no -A, no .).
  3. git commit -m "task(<task-id>): <title>".
  4. Deletes the task's checkpoint on success.

Never invoked directly by the user — the executor calls it. But if you ever need to manually finalize a task, this is the only safe way.

np:checkpoint

Per-task crash-safety pointer CRUD. Subcommands:

  • start <task-id> — write initial checkpoint with pending status.
  • transition <task-id> <new-status>pendingin-progressverifyingpre-commit.
  • touch <task-id> — heartbeat update.
  • show <task-id> — print the checkpoint JSON.

The executor uses transition exclusively. Direct Read/Write on the JSON is forbidden — the wrapper enforces invariants.

np:pause-work

Stamps STATE.session.stopped_at and writes STATE.resume_file for an explicit handoff. Use this when stepping away mid-task — np:resume-work will pick up cleanly later.

np:resume-work

Classifies the current session state as one of:

  • resume — explicit pause, resume_file present, continue from there.
  • orphan — checkpoints exist but no pause was logged, agent likely crashed.
  • clean — no checkpoints, nothing in flight, start fresh.

Use after re-opening the host CLI on a project that was mid-execution.

np:undo

Revert all task commits of a phase or plan via git revert — no history rewrite. Operates on the granularity you give it (phase, plan, or single task) and produces a chain of revert commits.

bash
np:undo --phase 5
np:undo --plan 05-02

np:undo-task

Single-task variant. Reverts exactly one task's commit and resets the task status to pending so it can be re-executed.

np:reset-slice

Restores the working-tree files of the in-flight task back to the last commit and clears STATE.current_task. No commit is produced — this is for "I want to start this task over" rather than "I want to undo a finished task". The reverse direction of np:commit-task.

np:skip / np:park / np:unpark

Lightweight task lifecycle CRUD:

  • np:skip <task-id> — mark status: skipped. Use for tasks made obsolete mid-phase.
  • np:park <task-id> — mark status: parked. Use for tasks that are blocked on something external.
  • np:unpark <task-id> — return a parked task to pending.

All three update task frontmatter and emit a metric entry. None of them produce a git commit on their own.