execute
Orchestrate the source without placing implementation in primary context. Maximize dependency-safe parallelism while preserving authority, gates, repairs, and finalization.
Inputs
$ARGUMENTS: optional feature/artifact/plan path,--origin plan|fix|delegate,--preflight-plan <xs|light|standard|comprehensive>, wave hints,--orchestrated, and orchestrated-only--finalization-owner parent. Default owner:self. Callers provide origin; unknown staysunknownrather than inferred.- Optional
--review-profile final-only, valid only with--orchestrated --finalization-owner parent; it defers intermediate review and requires the orchestrating caller to invokeSkill(spectre-code_review)exactly once on the final candidate. The caller owns sequencing, never semantic review. Default: risk-routed review. structured: execute index + resolvabletasks.json; malformed structured input escalates, never becomes a plan.plan-direct: any other explicit readable plan, or a plan whose header recordsExecution Mode: direct; it alone owns requirements; never rewrite, approve, or route it throughspectre-create_tasks.- No path: structured mode at
{FEATURE_ROOT}/specs/execute.mdwhen it exists; else plan-direct at a{FEATURE_ROOT}/specs/plan.mdrecordingExecution Mode: direct; else escalate. - The
--preflight-plan <depth>with an explicit readable plan enters preflight before normal mode resolution, run start, task dispatch, or product-code mutation. A marked plan recordingExecution Mode: directis rejected before review. Without the marker, preserve current structured and plan-direct selection, including ordinary plan-direct immutability.
Working Set
- Reuse a managed
FEATURE_ROOTonly when explicit/current-thread evidence ties it to this work (physical directory wins; never branch/recency/lifecycle/scans); distinct work ignores ambient roots. Otherwise, including on collision, standalone MUST first load and followSkill(spectre-feature-root)through DONE; orchestrated calls escalate. Keep writes beneath it and pass it unchanged. - A
--origin fixapproved bug-report source adopts its containingBUG_ROOTdirectly, before feature-root resolution. - Keep the invocation checkout.
- Structured detail precedence: declared
Tasks JSON→ adjacenttasks.json→ sibling.tasks.json; else escalate. Read the index whole and task detail by targeted slices. - Structured and plan-direct modes read
references/telemetry.md, start/resume one local event run with explicit caller origin, and follow its primary/worker task authority contract; that local store is the sole lifecycle/progress authority and source plans/tasks remain immutable. Terminal summaries retain origin, actual execution shape, category, elapsed time, and aggregate primary/worker token measurements only; unavailable is explicit. Plan-direct emits workstream-granularity events. Telemetry failure degrades observation, never delivery authority. SCOPE_DOCS: structured manifest paths or scope/UX/research paths cited by the plan.- On first plan-direct use/resume, read
references/plan-direct.md. On the first verification failure, review finding, E2E gap, or proof failure, readreferences/repair-policy.md. - Maintain a compact local verification ledger by HEAD, stable check id, changed/dependency surface, result, attribution, and disposition; it controls final reruns. Never persist raw output or per-wave evidence/checkpoint/report files.
Outputs + DONE
- Commit logical implementation batches and canonical artifacts only. Task/plan definitions stay immutable; Execute evidence, markers, checkpoints, run state, and plan-direct execution state stay local and uncommitted.
self: one final comprehensive review, then proof artifacts ending in aggregatePASS.parent:IMPLEMENTATION_READY+ACCEPTANCE_PENDINGmanifest; no final review, proof, test guide, or acceptance claim. With--review-profile final-only, every phase recordsfinal-onlyand the parent receivesFINAL_REVIEW_PENDING.- DONE: selected work/adaptations
done|skipped; current affected verification; each completed phase routedfinal-onlyor reviewed once for recorded compounding risk under the selected profile; every finding dispositioned; no safe authorized work or stale/uncovered final surface; self-owned final review + end-only proof when applicable; no primary-authored planned work; and structured telemetry complete or honestlydegraded.
Method / guardrails
- Aligned-draft preflight. When
--preflight-plan <depth>accompanies a readable plan, resolve its root and rejectExecution Mode: directbefore review. Skip only when pair metadata and closed review reports prove generation from this marked plan: current plan bytes/hash agree and pairgenerated_atfollows that review. An older, unrelated, or unprovable pair stopsNEEDS_AUTHORITYbefore review, task regeneration, or structured resume. Otherwise resolve Scope/draft/depth and invokeSkill(spectre-plan_review) --auto-apply scope-safe --orchestratedexactly once under its unchanged child contract. A Scope change, unresolved Blocker/High, explicit-design contradiction, or unavailable authority stops preflight before task generation; a scope-safe result proceeds without a second user gate. Closed reports/hashes finalizespecs/plan.md. Identify independent work, dependency edges, shared contracts, and conflicts; pass a transientmaximize safe parallelismbrief toSkill(spectre-create_tasks) --depth <marker depth> --orchestrated. No automatic task review. Select its validatedtasks.json/execute.mdpair and continue structured. Before a pair exists, reuse only child artifacts meeting their hash/schema rules; otherwise redo preflight. - Resolve and resume. Persistent execution authority: before implementation on initial entry and every continuation/resume, including after compaction, reload this contract with the original source arguments and continue the same durable run; never implement from memory or substitute another workflow. Rebuild the frontier from the store, never from the source:
run startwith the original--sourcereturns the samerunId, thenrun status --run-id <id> --jsonreports it. Trust onlycompletedandskipped; every other value is redo-or-verify. AnINVALID_TASK_TRANSITIONrejection means the log is ahead of your read—re-read, never force the event. Load only source/required state. Structured mode initializes telemetry/boundaries. A direct-marked plan (Execution Mode: direct) must carry its seven spine sections or escalate tospectre-plan; legacy unmarked plans start without a quality/completeness gate. Preserve source order absent dependency evidence; detail only the ready frontier. - Batch and dispatch. Dispatch when dependencies are accepted; waves are hints, phases review boundaries, and only unaccepted dependencies block. Batch at most three sequential parents or bounded plan-direct workstreams. Every source-owned workstream, including single/sequential work, goes to
@spectre_dev. The primary only orchestrates, verifies, accepts, and records state; it never implements planned work. Forrisk, request Claudeclaude-opus-5or Codexgpt-5.6-sol; otherwise use defaults. Give exact assignment/scope/prior context, never whole tasks/unrelated ids; include the named threatened invariant and shared contract slice. Structured dispatch includes exact<workflow_telemetry>. RequireSkill(spectre-tdd), focused checks, commits, compressed insights, E2EComplete|Gap|Adaptation. - Gate accepted batches. Before any reviewer, the primary independently runs affected lint/typecheck/build and native focused non-harness tests selected from the returned diff and demonstrated dependency/consumer boundaries; gate completed batches while other assignments remain in flight, and let early parents ride the next covering gate. Never run a repository baseline/root suite, full app harness, benchmark, or broad qualification here. Record stable check ids/result against current HEAD without raw output or new evidence files. Attribute failures and follow
references/repair-policy.md; implementation reports are leads only. - Record and adapt. Record accepted child/parent completion only in local workflow state, then emit primary-owned completion against the passing gate; a worker submission is never acceptance. Never mutate source task/plan artifacts for lifecycle state. Add/split/skip/reorder only source-required derivative work in local state; amend the canonical task graph only when the definition itself was wrong before execution. New derivative tasks join the same run when first assigned.
- Route intermediate review by compounding risk or final-only profile. With
--review-profile final-only, record each verified completed phase asfinal-onlywithout loading review routing or dispatching a reviewer. Otherwise a phase may be reviewed only after all source-owned tasks/workstreams and adaptations aredone|skippedunder current affected verification; completion alone is not a trigger. On first phase completion, readreferences/review-routing.md.- Inputs: triggered phase diff/commits/files, risk, scope, and verbatim requirement/AC slices—no dev rationale, pending phases, or unrelated files.
- Check the named risk, Defined → Connected → Reachable, E2E completeness, security/correctness, dead/orphaned outputs, duplicate sources, and old active paths.
- Return
CLEANor evidence-backed CRITICAL/HIGH withfile:line, invariant, observable scenario, evidence chain, and smallest fix in-thread. Persist only the local route/dispositions, never an intermediate review report. Follow the repair policy: one consolidated pass, affected verification, and no repair re-review.
- Repeat until the selected completion projection is satisfied.
Finalization
Compute coverage from the local ledger. Run only stale or uncovered checks; never blanket-rerun cumulative verification or a root suite. Expensive harness/performance/full qualification runs only for the final relevant candidate, unless a source task explicitly produces a prerequisite or product-consumed qualification artifact that blocks downstream work. Cache it by candidate definition hash = relevant inputs + scenario/config + command; permit one run per hash, and rerun only after those inputs change or a diagnosed infrastructure failure invalidates the run.
parent: require wave gates/review dispositions. Return diff/base, commits/files, test roots, coverage, review route, repair ledger, requirement slices, findings, andACCEPTANCE_PENDING; addFINAL_REVIEW_PENDINGfor final-only, requiring one opposite-runtime-firstSkill(spectre-code_review)before proof.self: invokeSkill(spectre-code_review)exactly once, high effort, over cumulative diff + requirements/scope without implementer rationale. Structured mode passes completed requirement/AC slices; plan-direct passesPLAN_SOURCEplus relevantEXECUTION_STATEevidence as routing only. It owns delivery/reachability, scope-creep, dead-computation, old-path, and single-source audits; never also invokespectre-validate. Record its result as a review gate. Give attributable CRITICAL/HIGH one consolidated repair pass, affected verification, and honest dispositions—never a validation reviewer.- After review dispositions are recorded, invoke
Skill(spectre-prove)once over final requirements, passing fresh inspected primary evidence bound to the candidate hash so it runs only uncovered journeys, and record its result as a proof gate. Non-PASS follows the repair policy; do not terminalize until aggregatePASSor every remainder isNEEDS_AUTHORITY. Proof is always the last acceptance gate. Formatting, lint, artifact, rebase, or commit-only changes do not trigger reproof. Finish structured runs with the truthful terminal event. - After that authoritative terminal status, follow the telemetry reference to emit one non-authoritative
plan.execution_outcome; Plan/Execute artifact joins use SHA-256 hashes of raw artifact file bytes, and join failure only degrades telemetry.
Handoff
Return counts, coverage, review route/status, dispositions, owner/proof status, findings/artifacts, and RUN_ID + telemetry status. Parent-owned runs return IMPLEMENTATION_READY/ACCEPTANCE_PENDING plus applicable FINAL_REVIEW_PENDING, without user-facing next steps. Otherwise recommend spectre-fix for high findings, spectre-test for a concrete coverage gap, else spectre-ship.
Escalate-If
- Structured index/task detail is missing or malformed →
spectre-create_tasks; unreadable plan or genuine authority/safety impasse →NEEDS_AUTHORITYagainst that plan. - Marked preflight lacks an explicit readable plan or valid depth; it records
Execution Mode: direct; a resolved pair is older, unrelated, or unprovable against the marked plan; Scope changes; a correctness Blocker/High remains unresolved; an explicit-design contradiction or unavailable authority appears; or the generated pair does not validate →NEEDS_AUTHORITYbefore review, task regeneration, or structured delivery as applicable. - Invalid parent ownership;
--review-profile final-onlywithout an orchestrated caller that explicitly owns the one finalSkill(spectre-code_review)invocation; unsafe/unrelated prompt slice; conflicting acceptance; unavailable authority/capability; required scope change; or unauthorized destructive action. - Never escalate solely for check failure, unavailable/red baseline, review/proof finding, diff growth, or related-file changes; continue independent work and terminalize only when every remaining non-PASS row is
NEEDS_AUTHORITY.