docs(spec): add agents plan revert and agents plan resume commands #5655

Closed
HAL9000 wants to merge 1 commits from spec/add-plan-revert-resume-commands-5574 into master
+57
View File
@@ -343,6 +343,8 @@ The following standards are integrated into the architecture:
<span style="color: cyan; font-weight: 600;">agents</span> plan diff (<span style="color: magenta;"><span style="color: cyan;">--correction</span> <span style="color: #66cc66;">&lt;CORRECTION_ATTEMPT_ID&gt;</span>|<span style="color: #66cc66;">&lt;PLAN_ID&gt;</span></span>)
<span style="color: cyan; font-weight: 600;">agents</span> plan artifacts <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span>
<span style="color: cyan; font-weight: 600;">agents</span> plan prompt <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span> <span style="color: #66cc66;">&lt;GUIDANCE&gt;</span>
<span style="color: cyan; font-weight: 600;">agents</span> plan revert [<span style="color: cyan;">--to-phase</span> <span style="color: #66cc66;">&lt;PHASE&gt;</span>] [(<span style="color: magenta;"><span style="color: cyan;">--reason</span>|<span style="color: yellow;">-r</span></span>) <span style="color: #66cc66;">&lt;REASON&gt;</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span>
<span style="color: cyan; font-weight: 600;">agents</span> plan resume [<span style="color: cyan;">--dry-run</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span>
<span style="color: cyan; font-weight: 600;">agents</span> plan rollback [<span style="color: cyan;">--yes</span>|<span style="color: yellow;">-y</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span> <span style="color: #66cc66;">&lt;CHECKPOINT_ID&gt;</span>
<span style="color: cyan; font-weight: 600;">agents</span> plan errors <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span>
@@ -16037,6 +16039,61 @@ Provide additional guidance to a plan, typically when it is errored or awaiting
- "Guidance queued"
```
##### agents plan revert
<div class="highlight"><pre><code><span style="color: cyan; font-weight: 600;">agents</span> plan revert [<span style="color: cyan;">--to-phase</span> <span style="color: #66cc66;">&lt;PHASE&gt;</span>] [(<span style="color: magenta;"><span style="color: cyan;">--reason</span>|<span style="color: yellow;">-r</span></span>) <span style="color: #66cc66;">&lt;REASON&gt;</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span></code></pre></div>
**Purpose**
Revert a plan to a previous phase (typically Strategize) so it can be re-planned with different constraints. This is the recovery path for plans in the `constrained` terminal state — when a plan cannot complete due to conflicting invariants or constraints, it can be reverted to Strategize for re-planning.
**Arguments**
- `<PLAN_ID>`: The plan to revert.
- `--to-phase PHASE`: Target phase to revert to (default: `strategize`). Valid values: `strategize`.
- `--reason/-r REASON`: Optional human-readable reason for the reversion (recorded in the plan's audit trail).
**Behavior**
- Increments the plan's `reversion_count` field.
- Blocked when `reversion_count >= MAX_REVERSIONS` (prevents infinite reversion loops).
- Only non-terminal plans can be reverted.
**Examples**
```
$ agents plan revert 01HXM9A1C2Q7W3R5G8Z0P4Q1X9
$ agents plan revert 01HXM9A1C2Q7W3R5G8Z0P4Q1X9 --to-phase strategize --reason "constraints too strict"
```
---
##### agents plan resume
<div class="highlight"><pre><code><span style="color: cyan; font-weight: 600;">agents</span> plan resume [<span style="color: cyan;">--dry-run</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span></code></pre></div>
**Purpose**
Resume a plan from its last checkpoint. Shows a resume summary (phase, state, last completed step, next step, decision ID, checkpoint, sandbox ref) before executing. Use `--dry-run` to preview the resume point without changing state.
**Arguments**
- `<PLAN_ID>`: The plan to resume.
- `--dry-run`: Preview the resume point without changing plan state or executing.
**Behavior**
- Only non-terminal plans (not `applied`, `cancelled`, or `constrained`) can be resumed.
- Displays a resume summary showing where execution will continue from.
- Without `--dry-run`, immediately continues plan execution from the resume point.
**Examples**
```
$ agents plan resume 01HXM9A1C2Q7W3R5G8Z0P4Q1X9
$ agents plan resume 01HXM9A1C2Q7W3R5G8Z0P4Q1X9 --dry-run
```
---
##### agents plan rollback
<div class="highlight"><pre><code><span style="color: cyan; font-weight: 600;">agents</span> plan rollback [<span style="color: cyan;">--yes</span>|<span style="color: yellow;">-y</span>] <span style="color: #66cc66;">&lt;PLAN_ID&gt;</span> <span style="color: #66cc66;">&lt;CHECKPOINT_ID&gt;</span></code></pre></div>