CodePanel
create_rule

create_rule

The CodePanel MCP tool that creates an autopilot rule for CI failures, blocking reviews, stalled PRs, Dependabot, labels, schedules, or incoming webhooks.

On this page›

create_rule makes an autopilot rule: when something happens on a repository, start a task. It needs the tasks:write scope, since a rule is standing permission to queue tasks.

A trigger is one of:

Trigger Starts a task when Setting
ci_failed A check fails on the repository's default branch none
pr_ci_failed A check fails on a same-repo pull request branch none
review_blocked A CodePanel review posts blocking findings none
pr_stalled A pull request has open CodePanel findings and no push since its review idleMinutes, 15 to 10080, default 90
dependabot_pr Dependabot opens a pull request none
issue_labeled An issue is given a label label, default agent
schedule A five-field cron in UTC fires, once per repository it watches schedule, at most 4 times an hour
webhook An authenticated HTTP POST arrives at the rule's webhook URL none (returns one-time webhookSecret)

Every other field has a default: the trigger's own name and prompt, every connected repository, auto for the worker, local for host (or cloud to run on CodePanel Cloud), and caps of $2 a task, $10 a day and 2 tasks at once.

Webhook trust model: Anyone holding a webhook rule's bearer token can start tasks on its watched repositories with untrusted payload data (including autonomous cloud runs bounded by taskUsd, dayUsd, maxConcurrent, and the per-rule rate limit). Treat the bearer token like a write credential and call rotate_rule_secret immediately if it is exposed.

When to call it

  • When the owner wants work started on its own, such as fixing main when CI fails or answering findings a pull request has left sitting.

Inputs

Input Type Required Description
trigger ci_failed or pr_ci_failed or review_blocked or pr_stalled or dependabot_pr or issue_labeled or schedule or webhook yes
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: or team:
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.

A prompt may use only the placeholders its trigger fills: {{repo}} and {{rule}} always; {{branch}}, {{sha}}, {{check}} and {{log_url}} for ci_failed; {{pr}}, {{branch}}, {{sha}}, {{check}} and {{log_url}} for pr_ci_failed; {{sha}}, {{pr}}, {{pr_title}}, {{pr_url}}, {{findings}} and {{refs}} for review_blocked; {{sha}}, {{pr}}, {{pr_title}}, {{pr_url}} and {{findings}} for pr_stalled; {{branch}}, {{pr}}, {{pr_title}} and {{pr_url}} for dependabot_pr; {{issue}}, {{issue_title}}, {{issue_url}} and {{label}} for issue_labeled; {{event_id}}, {{source}}, {{title}}, {{severity}}, {{url}} and {{payload}} for webhook. Any other is refused with the list.

What it returns

{ rule, webhookSecret, webhookUrl }, where rule is as list_rules shows it, and webhookSecret / webhookUrl are populated once for webhook rules (null for other triggers). A repository, agent or team that is not the account's is not_found; a setting out of bounds, an unknown placeholder, a bad cron or a 51st rule is precondition, with the message naming what to change.

The same step without MCP

Surface Form
HTTP API POST /autopilot/rules with the tasks:write scope
CLI codepanel rules create <trigger> [--repo a/b] [--prompt …]
Desktop app Autopilot, New rule

What the server tells your agent

The description your agent reads when it lists the tools:

Use it when the owner wants work started on its own: when CI fails on the default branch (ci_failed), a CodePanel review posts blocking findings (review_blocked), a pull request's CodePanel findings sit with no push (pr_stalled), Dependabot opens a pull request (dependabot_pr), an issue is labelled (issue_labeled), on a schedule (schedule), or when an incoming signed webhook fires (webhook). Pass trigger (ci_failed, pr_ci_failed, review_blocked, pr_stalled, dependabot_pr, issue_labeled, schedule, webhook) and optional host (local or cloud); every other field has a default. Each event starts at most one task. Needs the tasks:write scope. Returns { rule, webhookSecret, webhookUrl } (webhookSecret is returned once for webhook rules); delete_rule undoes it, update_rule with enabled false turns it off.

Last updated