# update_plan

URL: https://codepanel.ai/docs/mcp-server/update_plan

The CodePanel MCP tool that renames a saved plan, edits its goal, abandons it with a reason, or makes an abandoned plan active again.

`update_plan` changes a saved plan as a whole: its `title` or `goal`, or its life. You can abandon it, which needs a `reason` and abandons its active sub-plans too, or make an abandoned plan `active` again. It needs the `reviews:write` scope, and it works only where the deployment has plan tracking turned on.

## When to call it

- **When the plan's scope moved,** to rename it or restate its `goal`.
- **When the work is dropped.** Abandon the plan so the next session doesn't pick it up. The `reason` is the record of why.
- **When an abandoned plan is wanted after all,** with `status: "active"`.

To change a step, use [`update_plan_step`](/docs/mcp-server/update_plan_step). To finish a plan, finish its steps.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `planId` | string | yes | Plan id, from list_plans or create_plan |
| `title` | string, at most 200 characters | no |  |
| `goal` | string | no |  |
| `status` | `active` or `abandoned` | no |  |
| `reason` | string | no |  |
| `agent` | string | no | Your agent name, kept in the plan's history |

It writes: the server marks it `readOnlyHint: false` and `destructiveHint: true` (it can change what is already there), so a client that asks before writes asks here.

`status` accepts `active` or `abandoned`, not `completed`: a plan completes by itself when every step is `done` or `skipped`, and returns to `active` when a step is reopened or added.

Abandoning without a reason fails, and the plan stays as it was:

```text
CodePanel: Abandoning a plan needs a reason
```

### Sub-plans and reactivating

Abandoning a plan abandons every active sub-plan under it, with the same `reason`, each with its own `plan_status` entry in the history. Reactivating is narrower:

- A plan comes back without its sub-plans. Reactivate each one you still want.
- A sub-plan comes back only under an active parent: `Its parent plan is abandoned; set the parent active first`.
- A sub-plan whose parent step is now `done` or `skipped` stays abandoned until you reopen that step.

An abandoned plan takes no edits except in the call that makes it active. A `title` sent alone to an abandoned plan fails with `The plan is abandoned; set its status to active before changing it`.

A person can also abandon or reactivate a plan from the dashboard's **Plans** page. The history records that as the agent `owner (dashboard)`, and `get_plan` shows the new status the next time your agent reads it.

With plan tracking off on the deployment, the call fails with `CodePanel: Plan tracking is off on this deployment (PLAN_TRACKING)`.

## What it returns

The whole plan, as [`get_plan`](/docs/mcp-server/get_plan) returns it. A rename adds a `plan_edited` entry whose `to` is the field changed (`title`, `goal` or `title, goal`). An abandoned plan's `nextAction` is `done`, with the reason `the plan is abandoned`.

## Examples

These responses come from a test account on a local backend, trimmed to the first history entry and the first step.

### Rename a plan

```json title="Call"
{
  "planId": "xd7ffsskhwq6bg3ff59ptazsh98j7xjs",
  "title": "Fix login rate limiter",
  "agent": "claude-code",
  "reason": "covers both findings now"
}
```

```json title="Result (trimmed)"
{
  "createdAt": 1794614635238,
  "goal": "Make the login limit apply per client, not per X-Forwarded-For value",
  "history": [
    {
      "agent": "claude-code",
      "at": 1794614644068,
      "detail": null,
      "from": null,
      "id": "x571e9bfddctn0yny3wpxda65n8j76wh",
      "kind": "plan_edited",
      "reason": "covers both findings now",
      "step": null,
      "to": "title"
    }
  ],
  "nextAction": {
    "action": "start",
    "planId": "xd7ffsskhwq6bg3ff59ptazsh98j7xjs",
    "reason": "it is the next pending step",
    "step": "S3",
    "steps": []
  },
  "parentPlanId": null,
  "parentStep": null,
  "planId": "xd7ffsskhwq6bg3ff59ptazsh98j7xjs",
  "progress": {
    "blocked": 0,
    "done": 1,
    "inProgress": 0,
    "pending": 2,
    "skipped": 0,
    "total": 3
  },
  "repo": "codepanel-dev/web-app",
  "status": "active",
  "steps": [
    {
      "acceptance": "A test sends ten requests with different X-Forwarded-For values and the eleventh is refused",
      "completedAt": 1794614643860,
      "detail": "src/server/auth/rateLimit.ts:48",
      "evidence": "rateLimit.test.ts: 10 spoofed requests, 11th refused (commit 3f2a9c1)",
      "reason": null,
      "ref": "S1",
      "status": "done",
      "subplans": [],
      "title": "Key the limiter on the trusted hop",
      "updatedAt": 1794614643860
    }
  ],
  "title": "Fix login rate limiter",
  "updatedAt": 1794614644068
}
```

The title changed and the `reason` went into the history. Steps, progress and `nextAction` are as they were.

### Abandon without a reason

```json title="Call"
{
  "planId": "xd7ffsskhwq6bg3ff59ptazsh98j7xjs",
  "status": "abandoned",
  "agent": "claude-code"
}
```

```text title="Result (tool error)"
CodePanel: Abandoning a plan needs a reason
```

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | [`POST /plans/update`](/docs/api#post-plansupdate) with the same fields |
| Dashboard | The **Plans** page can abandon a plan, or make an abandoned one active again |

The CLI has no command for it.

## What the server tells your agent

The description your agent reads when it lists the tools:

> Edit a plan's title or goal, abandon it (needs a reason; its active sub-plans are abandoned with it) or make an abandoned plan active again (its sub-plans stay abandoned until you reactivate each; a sub-plan needs its parent active). Completion is automatic and cannot be set. Returns the plan: planId, status (active, completed, abandoned), progress, steps (ref like S3, status pending|in_progress|done|blocked|skipped, acceptance, evidence, reason, subplans), history (newest first, with deviations and reasons) and nextAction. Act on nextAction: start or continue its step (in its planId, which may be a sub-plan), unblock its steps, add_steps, or done.

## Related

- [`update_plan_step`](/docs/mcp-server/update_plan_step): change a step's status or text.
- [`create_plan`](/docs/mcp-server/create_plan): how sub-plans hang on a step.
- [`list_plans`](/docs/mcp-server/list_plans): find abandoned plans with `status: "abandoned"`.
- [Tracked plans](/docs/api#tracked-plans): the rules, in the HTTP API reference.
