Skip to main content

Synopsis

npx @refrainai/cli fix-runbook -- \
  --runbook <path> \
  --report <path> \
  [options]
Reads an execution report (generated by --self-heal or --report), extracts AI repair suggestions, and interactively applies them to the runbook YAML.

Required arguments

ArgumentDescription
--runbook <path>Path to the runbook YAML file to patch
--report <path>Path to the execution report (Markdown)

Optional arguments

AI model

ArgumentDefaultDescription
--model <id>claude-sonnet-4-6AI model ID
--model-provider <provider>anthropicAI provider
--model-base-url <url>-Base URL for OpenAI-compatible endpoints
--model-review <id>-Override model for fix suggestion generation

Advanced

ArgumentDefaultDescription
--locale <code>enUI language: en or ja

How it works

1

Extract suggestions

AI reads the report and extracts actionable repair suggestions.
2

Review each suggestion

For each suggestion, you can choose to apply, skip, or abort.
3

Generate patches

AI generates YAML patches and shows a diff preview.
4

Confirm and write

After confirmation, the patched runbook is written to disk.

Examples

Basic usage

First, run a self-heal execution to generate a report:
npx @refrainai/cli execute -- \
  --runbook ./login-flow.yaml \
  --self-heal \
  --report
Then apply the repair suggestions:
npx @refrainai/cli fix-runbook -- \
  --runbook ./login-flow.yaml \
  --report ./login-flow-report.md

With a specific model

npx @refrainai/cli fix-runbook -- \
  --runbook ./login-flow.yaml \
  --report ./report.md \
  --model-review "claude-sonnet-4-6"

Environment variables

VariableDescription
AI_MODEL_IDDefault for --model
AI_MODEL_PROVIDERDefault for --model-provider
REFRAIN_LOCALEDefault for --locale (en or ja)