ratchet apply
Implement a single existing change headlessly. apply runs exactly one agent for
a forced apply transition through the change-scoped engine core
(runChangeStep), with no batch manifest in sight. Run state is kept
change-locally under .ratchet/changes/<change>/.run/.
Synopsis
ratchet apply <change> [options]
<change> is required: the name of an existing change under
.ratchet/changes/<change>/.
Options
| Option | Argument | Description |
|---|---|---|
--force | Bypass the missing-plan precondition. The change-exists check still holds. | |
-m, --message | <guidance> | Extra guidance for the agent. Repeatable; joined into one "Additional guidance:" block. |
--agent | <agent> | Override the coding agent for this step. |
--locus | <locus> | Where the agent runs: local, docker, or remote. |
--image | <image> | Container image for --locus docker. |
--json | Output the structured step result as JSON. |
Preconditions
Read from on-disk change state before any settings resolution or spawn:
- The change must exist. A non-existent change
(
.ratchet/changes/<change>/absent) fails with an actionable error and no spawn. This check is never bypassed by--force. - The change must have a
plan.md. A change with no plan fails asking the user to runratchet proposefirst, with no spawn.--forcebypasses this check only.
Behavior
- Enforce the preconditions above.
- Resolve settings standalone (
flag → project config → default) viaresolveChangeStepSettings. An invalid--agent/--locus/--imagefails before any agent is spawned. A malformedagent[:model]spec (empty agent or model part, e.g.claude:,:fable; whitespace-padded likeclaude: opus,claude :m," claude"; or a model part starting with-likeclaude:-flag) is rejected with an actionable error naming the offending value before any spawn — the same shared schema (AgentSettingSchema→parseAgentSpec) the load and write paths use, so the flag path can never diverge from what the loader accepts. - Build a
ChangeStepContextwithbatchundefined,transition: 'apply', the joined-mguidance, and the change-local journal, then run once viaengine.runChangeStep.computeNextTransitionis never consulted. - Render the structured
StepResultas text, or as JSON with--json. The outcome journal entry is written under.ratchet/changes/<change>/.run/, so ablockedorawaiting-approvalstep stays resumable.
Run state
Run state is written under .ratchet/changes/<change>/.run/ — never under
.ratchet/batches/. See Run-state locus.
Help group
apply is listed under the Workflow: heading in ratchet --help, after
propose and before verify. See Workflow help group.