# update_rule

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

The CodePanel MCP tool that changes an autopilot rule or turns it on or off in one call, answering with the rule before and after.

`update_rule` changes an autopilot rule, or turns it on or off in one call. It needs the `tasks:write` scope.

Pass `ruleId` and the fields to change; the rest stay. The trigger cannot change: make a new rule for another one. Turning a rule on clears its failure streak and why it was off.

## When to call it

- **To stop a rule now**: `enabled: false`. It keeps its settings and starts nothing until turned on again.
- **To change its caps, prompt, repositories or worker.**
- **To undo a change**: send the `before` values the last call returned.

## Inputs

| Input | Type | Required | Description |
| --- | --- | --- | --- |
| `ruleId` | string | yes | Id of a rule, from list_rules |
| `name` | string | no | Up to 80 characters; the trigger's default when left out |
| `repos` | array of strings or null | no | owner/name of each repository it watches (up to 25); null for every one |
| `label` | string | no | issue_labeled: the label that starts it (default agent) |
| `idleMinutes` | integer | no | pr_stalled: minutes with open findings and no push since the review (15 to 10080, default 90) |
| `schedule` | string | no | schedule: five-field cron in UTC, at most 4 times an hour, such as 0 2 * * * |
| `prompt` | string | no | The task's prompt, up to 4,000 characters, with {{placeholders}} the event fills ({{repo}}, {{rule}}, and per trigger {{branch}}, {{sha}}, {{check}}, {{log_url}}, {{pr}}, {{pr_title}}, {{pr_url}}, {{findings}}, {{refs}}, {{issue}}, {{issue_title}}, {{issue_url}}, {{label}}, {{event_id}}, {{source}}, {{title}}, {{severity}}, {{url}}, {{payload}}); the trigger's default when left out |
| `worker` | string | no | auto (the repository's team, else the default team, else the first agent), agent:<id> or team:<id> |
| `host` | `local` or `cloud` | no | Where its tasks run: local (default) or cloud |
| `taskUsd` | number | no | USD one task may spend: 0.1 to 50, default 2 |
| `dayUsd` | number | no | USD its tasks may spend in a UTC day: 0.1 to 500, default 10 |
| `maxConcurrent` | integer | no | Its tasks running at once: 1 to 10, default 2 |
| `enabled` | boolean | no | false keeps it but starts nothing; default true |

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.

## What it returns

`{ before, after }`, each as [`list_rules`](/docs/mcp-server/list_rules) shows a rule. Refusals are as for [`create_rule`](/docs/mcp-server/create_rule); a refused call changes nothing.

## The same step without MCP

| Surface | Form |
| --- | --- |
| HTTP API | `POST /autopilot/rules/update` with the `tasks:write` scope |
| CLI | `codepanel rules update <ruleId> [--task-usd …]`, `codepanel rules enable\|disable <ruleId>` |
| Desktop app | Autopilot, a rule's toggle or Edit |

## What the server tells your agent

The description your agent reads when it lists the tools:

> Use it to change a rule or to turn it on or off (enabled). Pass ruleId and the fields to change; the rest stay, and the trigger cannot change (create a new rule). Turning a rule on clears its failure streak. Needs the tasks:write scope. Returns { before, after }: a second call with the values from before undoes it.

## Related

- [`list_rules`](/docs/mcp-server/list_rules): ids and current values.
- [MCP server](/docs/mcp-server): install, sign-in and every other tool.
