Problem Statement
When a non-gated step fails, Spec Kit aborts the entire run.
There's no step-level hook for "if this step fails, prompt the
operator before tearing down."
For long pipelines (10+ steps with expensive AI calls), a single
transient failure (network blip, quota 429, downstream hiccup)
wastes the previous N steps' work.
Proposed Solution
A step-level lifecycle hook routing failures to a recovery gate:
- id: my-expensive-step
type: command
integration: claude
command: speckit.heavy-thing
on_failure:
gate: my-recovery-gate
# pseudo for engine
def execute_step(step):
try:
return _run_step(step)
except StepFailedError as e:
if step.on_failure and step.on_failure.gate:
verdict = invoke_gate(step.on_failure.gate, context={
"failed_step_id": step.id,
"error": str(e),
"exit_code": e.exit_code,
})
if verdict == "retry": return _run_step(step)
if verdict == "skip": return None
raise
Default (no on_failure: declared) is byte-equivalent to today.
Opt-in per step.
Component
Other
AI Agent (if applicable)
All agents
Acceptance Criteria
Additional Context
Want shape agreement ({ gate: ... } vs. { retry: 1 } vs.
{ switch: ... }) before opening a PR.
AI disclosure: drafted with Claude Opus, human-reviewed.
Problem Statement
When a non-gated step fails, Spec Kit aborts the entire run.
There's no step-level hook for "if this step fails, prompt the
operator before tearing down."
For long pipelines (10+ steps with expensive AI calls), a single
transient failure (network blip, quota 429, downstream hiccup)
wastes the previous N steps' work.
Proposed Solution
A step-level lifecycle hook routing failures to a recovery gate:
Default (no
on_failure:declared) is byte-equivalent to today.Opt-in per step.
Component
Other
AI Agent (if applicable)
All agents
Acceptance Criteria
on_failure:field on step config.on_failure.gateis set, the gate isinvoked with failure context.
retry,skip,aborthonoured; unknown verdictre-raises the failure.
undeclared, each verdict path.
Additional Context
Want shape agreement (
{ gate: ... }vs.{ retry: 1 }vs.{ switch: ... }) before opening a PR.AI disclosure: drafted with Claude Opus, human-reviewed.