Paths: File paths (
references/,../ln-*) are relative to this skill directory.
Type: L2 Coordinator Category: 4XX Execution
Story Execution Orchestrator
Runtime-backed coordinator for Story execution. Owns task ordering, worktree lifecycle, task/group checkpoints, and the final Story transition to To Review.
Inputs
| Input | Required | Source | Description |
|---|---|---|---|
storyId | Yes | args, git branch, kanban, user | Story to process |
--rework-focus | No | ln-1000 | Comma-separated blocking categories from prior quality gate FAIL |
Resolution: Story Resolution Chain.
Status filter: Todo, In Progress, To Rework, To Review
Purpose & Scope
- Load Story and task metadata once per loop
- Execute in order:
To Review -> To Rework -> Todo - Launch
Todoparallel groups only when explicitly marked - Force immediate review after every executor/rework step
- Persist resumable runtime state in
.hex-skills/story-execution/runtime/ - Move Story only to
To Review; never toDone
Runtime Contract
MANDATORY READ: Load references/environment_state_contract.md, references/storage_mode_detection.md, references/input_resolution_pattern.md
MANDATORY READ: Load references/coordinator_runtime_contract.md, references/story_execution_runtime_contract.md, references/coordinator_summary_contract.md, references/loop_health_contract.md
MANDATORY READ: Load references/git_worktree_fallback.md — use the Story execution row
Runtime CLI:
node references/scripts/story-execution-runtime/cli.mjs start --story {storyId} --manifest-file .hex-skills/story-execution/manifest.json
node references/scripts/story-execution-runtime/cli.mjs status
node references/scripts/story-execution-runtime/cli.mjs checkpoint --phase PHASE_3_SELECT_WORK --payload '{...}'
node references/scripts/story-execution-runtime/cli.mjs record-worker --task-id {taskId} --payload '{...}'
node references/scripts/story-execution-runtime/cli.mjs record-group --group-id {groupId} --payload '{...}'
node references/scripts/story-execution-runtime/cli.mjs record-stage-summary --story {storyId} --payload '{...}'
node references/scripts/story-execution-runtime/cli.mjs record-loop-health --scope task --scope-id {taskId} --payload '{...}'
node references/scripts/story-execution-runtime/cli.mjs advance --to PHASE_4_TASK_EXECUTION
Workflow
Phase 0: Config
- Resolve
storyId. - Detect
task_providerfrom task-management config. - Build execution manifest:
story_idtask_providerproject_root- planned
worktree_dir - branch name
parallel_group_policystatus_transition_policy
- Start runtime and checkpoint
PHASE_0_CONFIG.
Phase 1: Discovery
- Resolve Story title and current Story status.
- Load child task metadata only:
- Use the configured tracker provider's
listTasksByStory(storyId)operation (transport perreferences/provider_file.md, references/provider_github.md, references/provider_linear.md).
- Use the configured tracker provider's
- Build
processable_countsfor:to_reviewto_reworktodo
- Checkpoint
PHASE_1_DISCOVERY.
Phase 2: Worktree Setup
- Detect current branch.
- If already inside
feature/*, treat current directory as active worktree. - Otherwise create
.hex-skills/worktrees/story-{identifier}and branchfeature/{identifier}-{slug}per worktree fallback guide. - Checkpoint
PHASE_2_WORKTREE_SETUPwith:worktree_readyworktree_dirbranch
- Advance only after
worktree_ready=true.
Phase 3: Select Work
Selection order is deterministic:
- Any
To Reviewtask first, sequentially - Then any
To Reworktask, sequentially - Then
Todotasks:- tasks with
**Parallel Group:** {N}may run as one group - tasks without a group are single-task sequential units
- tasks with
Checkpoint PHASE_3_SELECT_WORK with:
current_task_idorcurrent_group_id- fresh
processable_counts
If all processable counts are zero, skip execution and advance to PHASE_7_STORY_TO_REVIEW.
When rework_focus is provided:
- Tasks whose title or AC keywords match any
blocking_categoriesentry are selected first within the same priority tier. - This does not override the To Review > To Rework > Todo ordering — it reorders within each tier.
Phase 4: Task Execution
Used for:
To Review->ln-402To Rework->ln-403, then immediateln-402- single
Todotest task ->ln-404, then immediateln-402 - single
Todoimpl/refactor task ->ln-401, then immediateln-402
Flow:
- Compute executor
childRunId = {parent_run_id}--{worker}--{taskId}. - Compute executor artifact path
.hex-skills/runtime-artifacts/runs/{parent_run_id}/task-status/{taskId}--{worker}.json. - Materialize executor manifest at
.hex-skills/story-execution/{worker}--{taskId}_manifest.json. - Start
task-worker-runtimeand checkpoint executorchild_runmetadata before invocation. - Execute the worker through Agent or Skill with
--run-idand--summary-artifact-path. - Read the executor summary artifact from
.hex-skills/runtime-artifacts/runs/{parent_run_id}/task-status/{taskId}--{worker}.json. - Record task loop health before retrying the same task/worker/error:
- Action: compare current worker output with previous task loop health.
- Key point: retry only when new artifact, new
ln-402summary, task status delta,files_changeddelta, or scenario improvement exists. - Why: repeated identical worker failures create retry storms without adding evidence.
- Evidence:
record-loop-health --scope task --scope-id {taskId}result. - Exception: if
pause.pause=true, stop and surfacepaused_reason. - Automation/guard: story-execution runtime pauses after same-error/no-progress threshold.
- When review is required, repeat the same runtime-backed sequence for
ln-402. - Read the latest
ln-402review summary artifact for the same task from.hex-skills/runtime-artifacts/runs/{parent_run_id}/task-status/{taskId}--ln-402.json. - Record worker artifacts with
record-worker. - Checkpoint
PHASE_4_TASK_EXECUTION. - Advance to
PHASE_6_VERIFY_STATUSES.
Phase 5: Group Execution
Used only for Todo groups with more than one task.
- For each task, compute worker-specific child
runId, artifact path, and manifest path. - Start one
task-worker-runtimeper executor and checkpoint all child metadata before spawning Agents. - Spawn all group executors in parallel via Agent tool.
- Wait for all executors to finish.
- Read each executor summary artifact.
- Start one
ln-402runtime per task, review each task sequentially, and read the latest review artifact for every task. - Record each worker artifact with
record-worker, then record the group summary withrecord-group. - Checkpoint
PHASE_5_GROUP_EXECUTION. - Advance to
PHASE_6_VERIFY_STATUSES.
Phase 6: Verify Statuses
- Re-read task metadata from source of truth.
- Refresh
processable_counts. - Validate that every task touched in this run has a latest
ln-402machine-readable summary. - If any worker leaves an unexpected transition, pause runtime.
- If any task hits
To Reworkfor the third consecutive time, pause runtime with escalation reason. - Checkpoint
PHASE_6_VERIFY_STATUSES. - If processable work remains -> advance back to
PHASE_3_SELECT_WORK. - If no processable work remains -> advance to
PHASE_6B_SCENARIO_VALIDATION.
Scenario Validation
Runs once when all tasks are Done. Delegates to an external agent to trace the user scenario end-to-end against implemented code. The executor has completion bias after shepherding tasks through implementation — an external agent has no investment in the story being done.
- Load the Story ACs and the traceability table (from
.hex-skills/task-planning/{identifier}_traceability.md). If the traceability artifact is missing, reconstru