---
name: carbon-auto
description: Run a bounded, durable CARBON validation loop over a current change, feature, local app, or URL. Use when the user asks for continuous testing, an auto loop, repeated validation while code changes, test-fix-retest, or autonomous regression checking. The loop proposes fixes but never mutates code, spends money, publishes, schedules, or performs destructive actions without the required scoped approval.
---

# CARBON Auto

Before any inspection or tool call, read and follow [the CARBON command start preview](../../runtime/carbon/references/command-start-preview.md). Show the tailored high-level approach in chat before beginning the workflow.

Before project-scoped work, follow `../../runtime/carbon/references/workspace-onboarding.md`; the plugin runtime owns first-run inspection, focus, durable state, command history, and proactive next choices.

At the start, call `carbon_set_preferences` with no arguments and apply the returned local execution preferences.

Carry the returned global `executionContext` into every cycle: honor its reusable prompt, read its context documents, and use the configured username. Never serialize or reveal the password. Wrap only the approved executable runner with `carbon-runtime context exec -- <runner command>`.

Continuously reduce uncertainty with bounded CARBON cycles. This is an
agent-driven loop, not an unbounded daemon.

## Establish the contract

1. Name the target, current change, affected behavior, environment, and release
   question.
2. Default to 5 cycles, 60 minutes, or 2 consecutive clean cycles—whichever
   stops first. Honor tighter user limits.
3. Start with CARBON Quick. Let the current diff and risk model select breadth
   for a localized surface, depth for a high-impact identity/data/security/AI
   boundary, or balanced coverage when both are needed. Expand only when
   observed evidence warrants it.
4. Define stop conditions for blockers, repeated infrastructure failures,
   unsafe actions, and diminishing new evidence.
5. Initialize durable loop state:

```bash
../../bin/carbon-runtime auto init --root <repo> --target <target> --max-cycles 5 --max-minutes 60 --stop-after-clean 2
../../bin/carbon-runtime auto start --loop-dir <loop-dir>
```

## Run each cycle

1. Inspect the current diff and adjacent contracts.
2. Use `$carbon` in Quick Test mode. Persist the plan and observations
   under `.carbon/runs/`. Before starting the cycle's executable run, call
   `carbon_open_execution_plan` and automatically open its live page beside
   chat. In Codex, navigate to `codexBrowserUrl` and show `codexChatLink`; in
   Claude, attach the HTML artifact and show `claudeChatLink`. Include the
   estimate, then let the same page follow durable run state in real time.
3. For every page/state exercised in the cycle, register its complete safe
   evidence bundle with `carbon_evidence.py page`; then run
   `carbon_evidence.py analyze` so screenshots, console, network, DOM/a11y,
   performance, data, traces, and general cross-artifact signals appear in the
   durable report. Record unsupported or sensitive channels as gaps.
4. Exercise the run's generated product-user perspectives and attach their
   qualitative ratings, positives, friction, and recommendation to the exact
   page evidence. Execute each planned breadth/depth exploratory charter and
   persist its observations and next probe. Do not convert persona opinion into
   a deterministic pass or failure without a grounded oracle.
5. Record the cycle with `carbon_auto.py cycle`, including the CARBON run
   directory and finding count.
6. For failures, preserve the reproduction and show a scoped fix proposal.
   Change nothing until the user gives scoped user approval for that mutation.
7. After an approved repair, re-run the original reproduction first, then the
   smallest adjacent regression set.
8. Stop when the state file reports `completed`, a safety boundary is reached,
   or the user stops the loop.

The script tracks loop state; the coding agent's local browser and normal test
tools perform the actual checks. Never claim background monitoring after the
agent session ends.

## Execution boundary

Execution stays local and needs no CARBON service key. If a required local
controller or environment is unavailable, preserve the work as blocked or
`NOT ASSESSED`; never substitute another backend silently.

## Return the result

Report cycles completed, observed failures fixed or remaining, CARBON evidence
paths, coverage gaps, the stop reason, and residual uncertainty. A clean loop
means the selected checks found no failure; it is not proof of correctness.

## Required HTML result

Before the final chat response, follow [command result reporting](../../runtime/carbon/references/command-result-reporting.md). Generate the branded single-file command page, open it beside chat, and end with the current host's **Open the CARBON report** link.
