Loading articleโฆ
Loading 4weirdโฆ
Loading 4weirdโฆ
Loading articleโฆ
DocsHeal loops
Docs ยท desktop ยท opencode
Heal loops bugtest โ fix โ re-test until the suite is clean or a budget trips โ iteration count, token cap, or spend cap, whichever hits first. Coin quotes follow the house rule (100 coins = $1, 75/25 split); MCP-mediated payment is a queued future where only stubs exist today.
The loop
Export writes the BUGFIX-<game>-<stamp>.md/json report; Fix hands it to OpenCode so it edits code itself and shows the diff; Heal repeats test โ fix โ re-test until clean or the iteration budget is spent. Swarm agents reach the same loop via the opencode.export / opencode.heal tools.
opencode run -f file, the desktop Fix button, or the opencode.heal tool) so it edits code and shows the git diff.Budgets
Iteration caps alone cannot price a loop โ one round can burn far more tokens than the next. The heal budget tracks input/output tokens, prices them, and stops on max tokens or max spend (USD), with per-iteration ledger lines. Integer-token accounting, fail-open clamps, never exceeds budget.
maxTokens
Hard cap on input + output tokens across all rounds. Trips before max iterations in a heavy run.
maxSpendUSD
Hard cap on priced spend. A run with maxSpendUSD set tiny stops on spend, not on round count.
Per-iteration ledger
Every round logs its token usage so the stop reason is auditable after the verdict.
Coin quotes
Heal-loop cost estimates are read-only quotes in integer coins: 100 coins = $1.00, provider keeps 75% as on-site credits, platform keeps 25% for infrastructure. Quotes never write to any ledger โ settlement stays a later lane.
Example: a 400-coin ($4.00) job โ 300 coins provider credits, 100 coins platform. You only ever see the gross 400. All credits are on-site only (cloud compute, game credits, other on-site services); never cash-out, never withdrawable.
MCP pay
Driving bugtest + fix remotely (terminal exec, heal start/status, opencode fix tools over MCP) and paying for it in coins is the queued future: where only stubs exist today, this page describes intent, not a live payment path. Nothing here debits a wallet.