# Explicit execution contract (#55)

Supersedes the tool-name cooldown in PR #58. No tool, changed output, or unfinished goal implicitly authorizes another run. Each execution ends with an explicit ready/wait/complete/pause/blocked decision. Missing decisions receive at most one repair run, subject to allowance, then pause.

Automatic continuation is on by default, using the explicit scheduler in every mode. maxAutonomousRuns is an optional nonnegative safe integer in global/project settings: zero disables automatic runs; a positive number sets a run allowance. An absent project value inherits the global value; absent at both scopes means no run-count limit. Agents may configure settings. Persist consumed runs across messages, reloads, focus changes and settings edits, including uncapped execution; only goal creation or explicit user /goal-resume renews the period. The optional limit covers extension-generated kickoff, continuation, polling, event wake, repair and network recovery. It does not cap host tool loops or model turns started independently by another extension. Because agents may increase the ceiling, this is a configurable scheduling limit, not a hard spending cap. Existing token budgets still apply.

update_goal retains lifecycle forms and adds mutually exclusive continuation.ready(next_action) and continuation.wait(reason, deadline, optional polling interval_seconds/max_checks). Returned wait_id must be reused for subsequent checks; re-declaration cannot reset counters or deadline. Scheduling declarations persist before reporting success and terminate the execution segment. Additional model work invalidates a prior decision.

Persist ownership/generation, decisions, waits, counters and dispatch identity. Authorize atomically before every extension wake. Reject stale/duplicate messages; an ambiguous claimed dispatch after a crash requires resume. Follow real agent_start through agent_settled, including custom-message entry, queued messages, retries and compaction.

Waiting spends no model turns until a signal or explicit bounded check. Deadline/check/allowance exhaustion pauses without another model call. Restore owning-session waits without catch-up; require explicit resume for another session. Pause/complete/clear/focus/user takeover invalidate delivery. Waiting does not accrue active time. Closed sessions do not execute timers.

An outstanding wait deadline applies to every extension dispatch, including network recovery and missing-disposition repair after a polling check. Recheck the deadline immediately before claiming a dispatch, even if readiness or recovery was scheduled before expiry. User steering: do not change README.md in this review follow-up; preserve the README already present on PR #58 before the review fixes.

Document pi-goal:wake {goalId, waitToken}: matching signals authorize a wake; stale/duplicate signals do nothing. Register before starting a producer, or retain its result until registration. Ordinary third-party follow-ups remain host work and invalidate pending scheduling; their model spending is outside this gate.

Show next action/wait reason, timing/check counts, and consumed runs with an explicit unlimited, disabled or numeric allowance in dashboard, status and get_goal. /goal-resume means continue now and renew; it works without a configured limit and is refused when the effective setting is zero. Uncapped execution still requires ready/wait decisions, permits only one missing-disposition repair, and retains finite waits, deadlines and stale-dispatch protection. It may continue indefinitely when the agent keeps declaring ready. Latest user authorization: merge PR #58 and release patch 0.31.4; see specs/2026-09-14-patch-0-31-4.

Context constraint (latest user steering): automatic scheduling is on by default; the run limit is optional. Keep the disabled-mode prompt short and include scheduling guidance whenever automatic continuation is enabled, including when no limit is configured. Measure and publish overhead; avoid duplicate schema examples in the prompt. Do not change README.md.
