gk ai compose apply-plan
Apply a previously-saved plan JSON
Synopsis
Apply a plan that was saved earlier with “gk ai compose plan –plan-file”. Rewrites the repository into the planned commits. The file path is the required positional argument. This command spends no AI tokens and does not re-plan.
The plan is bound to the exact changes it was built from. If the working tree moved since planning, this fails with “changed since the AI analysis” instead of committing the wrong content — re-plan rather than retrying.
The plan does not store an absolute repository path. Run this command from the same repository used for planning, or repeat that command’s –workdir. Workdir sources and ranges that include workdir layers require HEAD to match the saved snapshot. Branch sources and ranges without workdir layers validate their saved source branch and diff instead, so unrelated HEAD movement is allowed; source or content drift is not.
Accepts either the object written by “plan –plan-file” or an
{“applyPlan”: {…}} wrapper. With –output json the result is
{commitShas, undoId}; keep the undoId so the run can be reversed with
“gk ai compose undo
gk ai compose apply-plan <file> [flags]
Examples
gk ai compose apply-plan /tmp/plan.json --workdir /path/to/repo
gk ai compose apply-plan /tmp/plan.json --workdir /path/to/repo --output json
Options
-h, --help help for apply-plan
Options inherited from parent commands
--no-telemetry Disable telemetry (OTel spans, Sentry) for this invocation
--output string Output format: text or json (default "text")
--session string (Optional) Isolate auth and cache under a named session
--workdir string Path to the git repository to operate on (default: current directory)
SEE ALSO
- gk ai compose - Plan and create clean, atomic commits from your working tree changes using AI