Put your coding subscription to work where it matters. Give routine exploration to a smaller model, reserve deeper reasoning for difficult problems, and pace work against your actual quota resets—all from OpenCode.
OpenCode Usage Harness adds task routing, context controls, and usage visibility to your coding workflow. The goal is more useful, verified work from the capacity you already pay for—using ChatGPT/Codex, Claude, or both with the compatible subscription integration. Stronger models and additional review belong where they improve the result; unused quota alone is no reason to manufacture work.
Start with quota visibility, then enable the agent workflow. Interested in combining several subscriptions? Explore the pool planner and architecture and the native and multi-pool workflow before helping build the next integrations.
The standalone toolkit's install/update commands switch its tool release only;
they do not activate an OpenCode runtime. For a recovery runtime candidate, use
the separate stage → provenance → activate procedure.
Publishing or installing the toolkit does not make native runtime patches live.
| For your workflow | What the harness provides |
|---|---|
| Choose the right level of reasoning | Specialist roles for exploration, implementation, debugging, architecture, and review, mapped to models and efforts you select from your actual catalog. |
| See whether capacity is running out or going unused | Independent OpenAI/Codex and Claude quota views, reset times, pacing, and model-scoped limits where exposed; missing data stays unknown. |
| Combine model strengths with quota pacing | Task-specific, evidence-backed preferences among approved model/effort peers; independent quota balancing, sticky continuations and optional cross-family review. |
| Keep large files from crowding the main agent's context | A 350-line broad-read threshold, focused worker summaries, targeted reads, and reasoned one-use exceptions. |
| Keep delegated work connected to the task | A stable integration lead uses an existing capable builder's admitted child and paths to deliver an end-to-end slice through existing gates; the root retains intent, closure and separate-review dispatch. |
| Understand what your agents accomplished | Workload metrics for usage, observed execution time, retries and reported acceptance, with overlap and unknowns called out. |
| Keep subscription-only inference explicit | Provider-specific subscription OAuth and financial admission: Codex account/credit checks, Claude usage-credits-disabled verification by default, and no automatic API-key/provider fallback. An operator may explicitly select the documented Anthropic app-managed-credit mode. |
| Adopt changes incrementally | An isolated toolkit installer, versioned updates, integrity checks, and code rollback. |
A typical workflow is: check quota → inspect only the relevant code → let one admitted capable builder lead an executable end-to-end slice → route independent, meaningful implementation and verification chunks → repair or escalate when the evidence warrants it. Before evaluating the slice, establish its acceptance command, input/output contract and check prerequisites. The router delegates before editing, then uses light evidence-based supervision: it batches bookkeeping at transitions and does not create repeated status-only turns, idle wakes or retries. A separate scout is useful when discovery is needed, not a required extra agent for every task. The full workflow requires the compatible agent integration; installing the standalone tools does not activate it automatically.
Passive worker status exposes bounded native tool names, timings and exit/timeout metadata, plus visible-text age when observed. Activity reuses the existing lazy scan through the latest valid context observation; it does not eagerly load old payloads across every archived chat. Older activity outside that window is unknown. It distinguishes active execution, current self-reported dependencies, an idle worker awaiting result inspection, and a collected result awaiting its parent's decision. Dependency reports expire on intent/admission changes, but their source execution generation is unproven and delayed reports may arrive. They never determine the handoff phase or delay collection; cross-root readiness is not inferred. Silence is not a stall, and a completed tool is not accepted task completion. This activity projection adds no worker wakes or paid status-only turns; existing recovery notifications retain their no-resume behavior. Workrelay's separate read surface can expose the same kind of safe tool metadata from its requested message page; inspect the existing child rather than judging only its idle parent.
The integration assignment template includes runtime/browser prerequisites, stage-specific failure diagnostics, and a publication checkpoint: name a frozen verified increment and its existing owner, or the concrete remaining blocker. Unrelated unfinished features should not delay an independently publishable change; all existing review, hooks, authorization and spending safeguards still apply.
Recovery status distinguishes a running compaction, successful compaction awaiting
same-child continuation, and failed compaction awaiting recovery. When the runtime
supports native idle waits, a requested compaction keeps the existing parent
dispatch call open for up to three minutes, then returns the matching outcome for
normal same-child admission. Timeout or unavailable observation stays pending;
the wait never starts child work, wakes an idle coordinator or bypasses a gate.
Manual-compaction advice uses the actual model catalog and the model attached to
the last completed input. The usable window is the smaller of an explicit input
limit and context capacity minus the maximum output allowance. Pressure starts at
min(absolute threshold, 80% of that window); a large window is available
headroom, not a target to fill, so an 872k window no longer defers pressure to
~698k tokens. The absolute threshold defaults to 120,000 tokens
(HARNESS_COMPACTION_TOKENS, else configure.py --compaction-tokens N). Smaller
windows still trigger at 80%. Unknown or inconsistent model/limit evidence uses
the absolute threshold and reports why. This does not promise a particular quota
saving; quota is account-wide and shared with agents outside this harness.
A running managed child that reaches the trigger is compacted mid-run at the next native step boundary (never mid-stream or during a tool call), with
its brief, intent reference, check results and checkpoint preserved; see
USAGE-CONTROLS.md.
Native automatic compaction is unchanged. Status exposes the budget, usage
ratio and evidence basis for both the router and its workers; reading status never initiates compaction or inference.
Recoverable Codex
quota-telemetry failures keep admission closed and retain generation-bound parent notifications;
notification delivery never resumes inference. See the
staged recovery release and activation procedure for
compatibility, artifact verification and live-install limitations.
The behavior below describes the current development branch and its compatible V2 agent integration, not everything in the v0.1.0 toolkit release.
The public profile uses four user-supplied tiers: FAST, BALANCED, STRONG and
MAXIMUM. Each maps to an actual openai/<model-id>#<variant> or
anthropic/<model-id>#<variant> reference discovered
in your account's catalog. The variant selects the reasoning effort supported by
that model. The harness does not assume particular model names, a universal effort
ladder, or that API prices describe subscription consumption.
The generated profile in configure.py maps roles as follows:
| Agent | Configured tier | Intended work and capabilities |
|---|---|---|
harness-router |
STRONG | Own the goal, choose workers, integrate evidence; no shell or edits (read-only repo_identity for cwd/branch/HEAD). |
harness-coordinator |
BALANCED | Coordinate multiple sustained lanes through terminal workers; no shell or edits. |
harness-scout |
FAST | Focused repository exploration and summaries; no shell, edits or delegation. |
harness-quick-builder |
FAST | Mechanical fixes, small localized changes and straightforward tests. |
harness-builder |
BALANCED | Ordinary implementation and feature work. |
harness-deep-debugger |
STRONG | Ambiguous failures and difficult debugging. |
harness-architect |
STRONG | Design and consequential analysis; no shell or edits. |
harness-reviewer |
STRONG | Correctness, regression and risk review; no shell or edits. |
harness-verifier |
STRONG | Execute assigned checks and report results; direct edits are limited to .artifacts/* and nested artifact directories, with secret exclusions. No delegation. Native path permissions, write ownership and command approvals still apply. |
harness-maximum |
MAXIMUM | Exceptional problems where the expected quality improvement justifies the capacity. |
Only the router and coordinator delegate; other roles are terminal workers.
Shell-capable roles still obey native command permissions. Assign executable checks
using operation:verify and harness-verifier, preserving an explicitly requested
OpenAI or Claude model. Verification implies shell capability and reserves write
ownership, including for test-generated files; it is not a read-only sandbox.
Static review stays with harness-reviewer. A preflight
TASK_DISPATCH_CAPABILITY_MISMATCH means a new assignment selected an incapable
role. The parent corrects that assignment while preserving the requested model
and scope; the normal permission, ownership and financial checks still run. This
diagnostic neither clears a prior denial nor permits replacing an existing worker.
Selection is task → role → configured model and effort. The parent is instructed to choose the smallest capable worker, accounting for complexity, risk, prior verification and quota pressure. One bounded task normally goes directly from the router to one worker. A coordinator or independent review is justified by the task, not added automatically. Passing, sufficient verification is a reason to stop; uncertainty alone is not a reason to escalate.
By default, every role sharing a tier also shares its configured reasoning variant.
Since 0.3.0, new dispatches can map routing complexity to a same-model effort variant (see Token-saving strategies); there is no measured price ranking.
At an explicit continuationEffort: "reassess" request, a completed, idle,
ordinary normal-risk builder implementation may move from #high to #medium
only when the current catalog advertises the same provider and base model at
#medium. The routing record reports the request, outcome, reason, and catalog
provenance. It never changes a running, failed, denied, cross-family-review, or
explicitly/manual-model-overridden worker; unavailable medium variants retain the
admitted route with an explicit reason. Customize role references explicitly when
different efforts are appropriate. The
public generator selects STRONG for the router; it does not dynamically demote the
primary router. An existing private profile may have different role assignments.
Every admitted worker dispatch, including a continuation, passes the effective
model reference to OpenCode so an old child does not silently retain an obsolete
model. An explicit dispatch model override persists for that work key;
resetModel: true clears override metadata while retaining an admitted route. A UI model change observed
after a known harness selection is also preserved. Legacy children have no override
provenance: their next dispatch adopts the configured role unless an explicit
model is supplied. This does not change inference already running. Since 0.3.0 a warm or running
child keeps its current model on a non-explicit continuation (see
Token-saving strategies). Dispatch status
shows configured, selected and previously observed models; completed-response
telemetry is the evidence for what actually ran.
The generated profile leaves OpenCode's stock build, plan, general, and
explore agents enabled. A fresh native chat can use the same server and native
model selection with the stock tool contracts; it does not enter managed task
ownership. Native calls bypass harness routing, large-file mediation and optional
result compression, while the subscription financial guard and native permission
checks still apply. A native call cannot adopt a managed child or run beside a
known managed writer; continue that work through its recorded harness owner.
Use task_dispatch for durable harness work: it records ownership, routing,
review evidence and continuations. The built-in agents can still be useful for a
small independent task or a fresh native chat when that durable contract is not
needed.
Configured harness agents are shown with harness- names, such as
harness-router and harness-builder. Historical unprefixed IDs remain hidden
compatibility aliases so existing sessions can resume with their exact stored
agent identity; new handoffs should use the visible prefixed names.
One subscription is enough. Use OpenAI only, Claude only, or both:
| Your subscriptions | Tier mappings | Enabled providers |
|---|---|---|
| ChatGPT/Codex only | All four tiers use discovered openai/...#variant references |
OpenAI only |
| Claude only | All four tiers use discovered anthropic/...#variant references |
Anthropic only |
| Both | Mix tier references, or opt into approved role candidates | Only providers named by tiers and enabled candidates |
The generator derives provider access from your mappings; it does not require OpenAI for a Claude-only profile. You may map several tiers to the same model. Native agents, context controls, verification and same-family review work with a single pool. Cross-family review is an optional preference and never requires a second subscription. Runtime quota tools query only providers in the enabled model catalog, so a Claude-only setup does not invoke Codex CLI or read its auth.
To enable quota-aware choice among role candidates, pass an explicitly reviewed policy to
configure.py --routing-policy; only enabled policies and enabled candidates expand provider access. The policy is
written beside the generated profile. It does not authenticate Claude or make
Claude eligible by catalog visibility alone. Each role's candidates must be
actual catalog model/effort references, and Anthropic still requires the guarded
Claude Code OAuth artifact and extra usage disabled. See
native and multi-pool routing and
Claude subscription setup.
Admission reads independent provider windows and the selected OAuth identity.
Selection happens for a fresh admission; continuations stay sticky to the
admitted model, and an explicit manual model override wins. A depleted or
unavailable pool is not retried through another provider. reviewOf requests a
meaningful independent peer review only when the policy has a healthy capable
peer; the harness never creates an automatic review.
An operator may configure a dual-pool trial with an Opus medium capable builder as the stable lead and a Sol high reviewer at meaningful milestones. This is a manual, evidence-seeking arrangement, not a generated default or a claim that either model is superior. A one-pool installation keeps the same lead-and-review pattern with its available models.
harness-router is the default primary agent in generated harness profiles. Its
own model stays configured; delegated tasks use the enabled peer-selection policy.
Selecting native Build/Plan intentionally bypasses harness orchestration. External
bridges must explicitly enter through the harness; installing the router does not
make every client use it.
The router decides whether review is useful before the dispatcher chooses a
model. Skip extra review for trivial passing work. Prefer one bounded cross-family
review for security, concurrency/state, substantial architecture, weak coverage or
repeated failed repairs. Give the reviewer requirements, the diff and validation
evidence; reconcile actionable findings and perform targeted repairs. Additional
review needs a concrete unresolved risk. Spare quota alone is not a review trigger.
Managed reviews identify the implementation worker with routing.reviewOfChildID;
the dispatcher resolves its model rather than trusting a model-name claim.
A successful same-worker compaction does not erase a collected implementation
result: review can use its retained, natively revalidated source-generation receipt
while the idle author awaits continuation. Compaction itself is never task
completion. Active authors, failed or mismatched compactions, missing receipts,
and later implementation generations still require their own completion evidence.
Approved operator pauses have a separate maintenance recovery procedure: interrupted and resumed execution must retain its exact bridge evidence rather than borrowing an older answer or rerunning work.
Use reviewIndependence: "preferred" normally and "required" for an explicit
user requirement. Legacy reviewOf strings remain unverified hints.
Same-family review remains valid when a suitable independent pool is unavailable;
an explicit requirement for cross-family review must be reported as unavailable
rather than silently substituted. A single-subscription installation remains valid.
Selection combines task fit → suitable model/effort peers → independent quota
pace. An optional routing.taskType classifies exploration, mechanical changes,
implementation, debugging, architecture, testing, review or general work. Older
callers infer a task type from the harness role. Tool capabilities remain separate:
a file-only reviewer still cannot execute a requested test.
Each exact candidate reference can declare a task-specific preferred or
acceptable band. Only preferred rules marked supported with an evidence
reference affect the quality preference; missing or provisional rules remain
neutral. A reference records an operator-reviewed claim, not automatic proof.
The shipped example and the initial live policy keep unproven pairs acceptable
and provisional rather than inventing a winner for a provider family.
| Work | How fit and quota combine |
|---|---|
| Routine, normal risk | Quota pace chooses among approved adequate peers. |
| Standard, normal risk | A healthy supported-preferred candidate wins over acceptable peers; pressure or unavailability can justify an acceptable healthy peer for new work. |
| Complex or high risk | Declared supported-preferred candidates set the fit floor. Spare quota cannot silently substitute an acceptable model. If selection cannot meet the floor, the router reports ROUTING_TASK_FIT_UNAVAILABLE; an exact preferred configured model may still go through normal financial admission. |
| Meaningful independent review | Prefer another family within the eligible fit/health group, without automatically creating a review. |
| Explicit model or admitted continuation | Manual selection or recorded affinity wins within any explicitly required review-independence constraint; financial and native permission gates still apply. |
With an enabled routing policy, new managed assignments must include routing
complexity and risk; omission returns ROUTING_ASSESSMENT_REQUIRED before admission.
Existing admitted children retain their identity and route, and native Build/Plan
keep their stock contracts. Unknown policy fields, invalid reserves and unresolved
profile references are rejected.
The local fit policy is retained when quota reads fail. Invalid policy raises a sanitized error instead of falling through silently. Routing status records the task type, effective band, evidence status and decision explanation without copying private evidence references. See policy configuration and examples.
Candidate behavior-profile guidance remains useful alongside these rules. Judge strengths per model version, reasoning effort and task type using accepted results, repairs, confirmed review findings, user corrections, elapsed time and actual quota observations. The harness does not automatically promote a preference or learn a brand ranking from self-reported success; evidence-based policy updates remain explicit. A single-family setup uses the same rules and needs no second subscription.
In a managed OpenCode session, ask the agent to call subscription_quota.
It reports separate openai and anthropic pools for enabled catalog providers,
including available windows, utilization, reset timestamps, pacing and relevant
financial/scoped-limit metadata. Reading quota performs no model inference.
A missing, stale or failed read is unknown, not zero usage or extra capacity. A fresh Claude account session window explicitly reporting zero usage, no reset timestamp and no lock is marked unstarted; it does not veto an otherwise valid weekly allowance. Its reset and pacing remain unknown. Positive usage, expired resets, scoped-limit ambiguity and financial checks retain their existing protections.
| OpenAI / ChatGPT Codex | Anthropic / Claude | |
|---|---|---|
| Evidence source | Authenticated Codex CLI app-server, account/rateLimits/read; admission verifies the OpenCode and CLI account match. |
Usage endpoint for the selected Claude Code OAuth connection inside OpenCode; no API key or other account is substituted. |
| Windows | Uses the durations and resets actually returned; does not assume a five-hour or weekly window exists. | Reads session, account-wide weekly and model-scoped limits when present. Reported durations take precedence; recognized five-hour/seven-day windows without durations are marked duration_source: inferred. |
| Scoped capacity | Preserves reported Codex buckets in the CLI output; the shared pool view currently treats normalized Codex windows as account scope. | Preserves model/family scope, locks and weekly-share metadata when provided. A model-scoped allowance is a constraint within the subscription, not a second pool to add to the total. |
| Financial evidence | Credit-risk metadata plus separate account/financial verification. | Usage credits (extra_usage.is_enabled) must be explicitly disabled, unless an operator installs the exact local app-managed-credit acknowledgement described in Claude connection setup. |
| Access outside OpenCode | codex-quota provides human-readable or JSON output, refresh and admission checks. |
The standalone subscription-quota.mjs has no selected OpenCode OAuth context. It reports the plugin's newest cached Claude snapshot (state/quota-cache) with its age and a STALE marker after 2 minutes, or unknown [adapter_unavailable] when no cache exists; use the in-session tool for live Claude data. |
Recent short-window consumption is also exposed as an advisory burn rate and approximate exhaustion time, using fresh samples from the same selected credential and reset window. It adds no polling, admission gates or worker budgets. Claude supplies the private identity needed for this history; the current Codex adapter reports this new trend as unknown (its existing window pacing still works). See short-window pacing for freshness and identity limits.
The explicit codex_quota tool remains Codex-only. The shared tool and automatic
routing query only enabled subscription providers; a Claude-only profile does not
need a Codex login or CLI. A local /quota shortcut can call the shared tool, but
the public profile generator does not install that slash command automatically.
Financial admission is separate from this advisory view. OpenAI checks matching
OAuth identity, current Codex admission and the configured financial attestation
(no purchased-credit balance, automatic top-up or reload). Claude checks selected
subscription OAuth and disabled usage credits. Claude shares usage telemetry across
routing and admission, and rejects confirmed applicable exhaustion. On a transient
lookup failure, admission may use an existing verification of disabled usage credits
for less than 24 hours from its original successful read. Quota telemetry is still
fresh for only 60 seconds and stale telemetry remains unsuitable for routing. Expired financial evidence,
authentication failures, and enabled or unknown usage credits still block admission.
The only exception is an explicit private app_managed_credits policy for an
operator-managed Anthropic app cap; it keeps OAuth/provider validation but lets
the provider app enforce spending, without local balance accounting or a fallback
after a provider limit.
The provider remains the final included-quota hard stop; no Codex-style subprocess
is required for Claude.
Neither path admits API-key billing or automatically retries with another provider.
Account-side changes and concurrent usage mean these controls are not a billing
guarantee; see security boundaries.
For a window with utilization, a usable duration and a future reset, the shared
view calculates window_start = reset - duration, elapsed fraction clamped to
0–1, and pace_delta = used_percent - elapsed_fraction × 100. Claude's inferred
durations remain labeled as estimates; missing reset/usage data cannot establish
pace. Account-wide pace and model-scoped constraints are kept distinct.
At meaningful dispatch boundaries, the parent supplies task complexity and risk. Codex retains its short-lived file cache and cross-process lock. Claude uses a 60-second shared private cache and coalesces concurrent lookups across processes. Transient failures trigger a cooldown (respecting Retry-After, with bounded exponential backoff when needed), not repeated requests from each worker. Quota estimates older than two minutes remain unsuitable for candidate selection. The separate 24-hour Claude financial-verification limit never moves forward on a cache hit or failed lookup; stale quota does not mean unused capacity. A changed Claude setting can remain unobserved until the next successful usage read, so keep usage credits disabled in the account as well. See Claude telemetry caching.
If a usable account window for the role’s provider is more than ten percentage
points ahead of pace, or has at most 10% remaining, an explicitly routine,
normal-risk harness-builder or harness-deep-debugger dispatch can use the configured
harness-quick-builder model and variant within the same provider. This is a specific
role substitution, not a general one-rung search across all tiers. The worker keeps
its original role, permissions and ownership.
With an enabled candidate policy, fresh work can instead choose among explicitly approved model/effort peers using account and matching model-scoped pressure. Within the task-fit rules above, the selector compares each provider’s own windows; quota percentages are never added together. It favors healthy, approved capability peers, considers the limiting applicable weekly window and its reset, and applies a configurable reserve (2% by default). More useful work can go to the pool further behind pace or closer to losing unused capacity, without changing the task’s required tier. This is an admission-time choice, not a retry after another provider rejects work. Candidates that require scoped quota are ineligible when that evidence is missing. A weekly meter above 90% can still be used near reset when it is on pace and above the reserve; short-window pressure remains a constraint. Concurrent sessions can consume quota after a read; there are no atomic quota reservations.
High-risk work, explicit overrides and other roles are not automatically demoted. Absent routing classification or usable telemetry retains configured selection; the independent financial guard still blocks inference when admission cannot be established. Behind-pace capacity does not automatically promote a model, launch a review or generate work. The parent may choose stronger reasoning or useful extra verification when justified. The objective is useful prepaid capacity, not token burn or a guaranteed 97–100% utilization target.
These controls work together; some are automatic middleware, some are dispatch rules, and others are instructions for the agent. They apply to harness roles using either model family; native agents retain the bypass described above. None establishes a hard spending ceiling or a promised percentage saving.
| Optimization | Behavior and limits |
|---|---|
| Short instructions and focused handoffs | Revisioned task intent carries the goal, authorization and checks; workers use that injected intent until a revision, compaction, or specific evidence gap requires a refresh. Handoffs add bounded objectives, changed files, current checks and unresolved findings, linking retained evidence instead of repeating logs. Status is recorded at decision or recovery boundaries, and exact tool-schema names and required fields avoid repeated malformed calls. |
| Integration assignments on demand | task_dispatch_template({kind:"integration"}) returns a compact producer/consumer contract, necessary serializer/schema/test scope, one executable integration check, and the next owner/evidence handoff. Fill existing intent and dispatch fields; integrate before another intermediate freeze. Retrieving it creates no work or new gate. |
| Large-file read control | The guard blocks broad reads over the 350-line threshold while allowing targeted ranges. Files up to 25% over it (437 lines) and within 48 KiB are returned whole in one read, since paging a near-miss costs more than reading it; blocked reads explain how to target a range instead of paging. A focused smaller worker can return a summary; terminal workers cannot recursively delegate. An eligible writer can request a reasoned one-use direct-read exception. Agents are told not to page through a whole file to evade the guard; ordinary permissions still apply. |
| Recoverable tool-result compression | Automatic V2 middleware compacts eligible JSON and search listings, caps large recognized grep/glob previews with explicit omission counts and exact saved originals, collapses exact repeated test/build lines, and shortens unchanged Git diff context. Every JSON row/value and every diff change remains represented. It adds no inference call. |
| Exact originals on demand | A profitable projection is published only after its exact original is stored privately. Retrieval uses bounded native reads under existing permissions. Source reads, edits, patches, unknown tools and nested CodeMode fallback text are not rewritten. Malformed, oversized or unprofitable results pass through. A snapshot is not proof of current file contents. |
| Stable history and cache diagnostics | Tool compression happens once on new results, without repeatedly rewriting history. Passive cache monitoring observes instruction/tool/early-message changes and reported cache-token counters. It does not alter cache headers, guarantee cache hits or perform inference. |
| Selective conversation compaction | Status exposes the last completed valid context observation, including cache reads/writes; streaming placeholders stay unknown instead of becoming zero. Under real pressure it recommends collecting the current result and then compacting the same idle child before further substantial work. It identifies the responsible parent and blockers, never starts work from status, preserves ownership, and refreshes intent after the matching compaction outcome. Compaction may consume subscription capacity; completed final reports need no compaction. |
| Scoped Git publication | Authorized publication of a frozen commit uses publish with an explicit commit OID, checkout and hook/output scopes. Admission discovers and reserves the actual checkout and shared Git metadata, so omitting .git cannot evade its owner. It can proceed alongside disjoint worktrees; overlapping owners still block. Unknown hook effects require broader ownership. Deployment remains checkout-exclusive. Native approvals, hooks and publication gates still apply; this is coordination, not a shell sandbox. |
| Same-worker resumption | Stable task/work keys and ownership reuse the existing child instead of launching replacements. Collection status identifies structural blockers and the responsible parent without resuming work. Admitted writer paths persist through ordinary operation changes and implicit same-key continuation; publication requires explicit paths each time; a read-only worker becoming a writer must name paths, and empty paths are rejected. Revision and assigned-check bindings help prevent stale scope from carrying forward. |
| Bounded work and cumulative review | A cooperative reminder after ten minutes or 30 prepared model steps reports progress and scope; it does not cancel tools or direct a worker to return. The worker continues authorized useful implementation and targeted verification until the objective is verified, a real blocker appears, or the approach changes. Before idle continuation, status explicitly reports nextDispatch.workReview.requiredWhenIdle from the lane and root-task counters so the router can include its evidence-backed reassessment upfront. The existing limits remain 120 steps/six continuations per lane or 240 steps/12 continuations per root task. Totals survive handoffs; this is not a new human approval gate. |
| Repeated-work detection | Two continuations without new reported progress produce a convergence advisory. Changed wording, timestamps or artifact churn alone do not count as progress. Evidence remains self-reported and must be checked; the advisory is not an automatic stop or extra review call. |
| Recovered provider results | A real later success can be collected after a narrow transient provider failure only when the native retry decision and recovery boundary are retained on that exact admitted generation. Authentication, quota, permission, cancellation and model/intent boundaries remain blocking. Historical errors stay in the receipt; collection never retries inference. |
| Handoff timing | Parent status exposes a bounded 16-generation timeline for admission, native acceptance, exact background completion, collection and accepted continuation. It separates collection delay from continuation delay; missing clocks remain unknown. Observation never starts workers or changes approval, routing or quota rules. |
| Verification reuse and retained diagnostics | Instructions favor targeted checks, reuse of unaffected passing evidence and follow-up reviews of changed findings. Substantial checks retain stdout, stderr, exit status and revision in private receipts, with bounded previews and disk-space checks. Necessary tests still run; avoiding quota is not a reason to skip requested validation. |
| Actionable worker recovery | Revised intent still requires parent authorization. Status identifies the existing child and current revision for an explicit rebind; no automatic inference or replacement worker. Human-action checkpoints use status=blocked, progressState=needs_user_action, and concrete blocker evidence. |
| Git workflow discipline | Instructions prohibit precautionary hook bypasses and require explicit authorization to disable checks. When shared Git state overlaps, agents discover the actual shared metadata directory, include it and the target checkout in writePaths, and coordinate that narrow commonGit scope serially. This guidance does not create an automatic or blanket hold, and native command approvals still apply. Isolated launchers can preserve GitHub CLI's existing configuration directory without copying credentials or forwarding API tokens. |
| Useful human/device attempts | Optional verification records retain readiness, expected signal, result references and expiry so agents inspect prior evidence before asking for another live test. They do not verify a physical device themselves or turn expiry into an automatic retry. |
| Background completion and health visibility | Sustained implementation, coordination and deployment default to native background work; completion resumes the parent. Guidance discourages polling and duplicate workers. At decision or recovery boundaries, a bounded status summary keeps the owner oriented; full status is used only for a specific evidence gap. Read-only health checks prioritize pending native forms/permissions over the running flag and keep unavailable evidence unknown. Status distinguishes historical outcomes from current execution; idle is not accepted completion. These tools do not automatically reply, retry or restart services. |
| Generation-bound review readiness | An explicit task_dispatch_collect records an exact background generation's terminal native evidence without another inference call. Review rechecks that evidence instead of accepting an old successful answer or an idle flag. Legacy unbound work is not silently certified. |
| Stopped-generation reconciliation | The recorded parent can use task_dispatch_reconcile_terminal to archive exact failed/interrupted generations or successful generations superseded by a correction, and release only that inactive owner's write reservation. settled is distinct from completed; old evidence never satisfies the corrected task, clears a denial, or resumes inference. See terminal reconciliation. |
| Parent cancellation of own children | A router or coordinator can call `task_dispatch_cancel {taskId, workKey |
| Root progress reminders | Managed root routers receive a concise progress reminder on an existing request after ten minutes without visible text during the current native execution. No timer creates work, changes models, interrupts a tool, or forces a handoff; unavailable timestamps remain unknown. |
Compression only considers results from 4,096 characters up to 1 MiB and requires at least 512 characters and 15% savings, including retrieval instructions. The private original store is bounded; once full, new results pass through instead of evicting evidence. These are character reductions, not measured subscription-token savings. Provider-hosted tools and background completion results are not covered by this local compression hook.
For operational details, see routing, review thresholds and compaction, compression and retrieval, diff previews, compression diagnostics, cache monitoring, convergence and live attempts, and execution, receipts and outcome telemetry.
Use harness-metrics to compare completed work, reported acceptance, retries,
observed execution time, input/output/cache tokens, compression characters and
cache-drift observations. Compare those with actual quota deltas during ordinary
work. Other Codex clients or Claude clients may consume the same provider’s
account-wide allowance. Cache counters and token accounting vary by provider;
missing counters are not zero, cached tokens are not assumed free, and API token
prices do not measure subscription consumption. Retained
receipts and tests support acceptance; metric counts alone do not prove correctness
or savings.
The generated profile allows only providers named by its tier mappings and enabled routing candidates. OpenAI and Anthropic subscription admission are independent; see Claude connection setup. OAuth/account checks and provider-specific financial admission remain separate from optimization. Quota pressure never authorizes purchased credits, API-key inference or an automatic paid/provider fallback. Compression and context diagnostics are model-family-neutral middleware; that does not enable additional subscription providers automatically.
Version 0.3.0 adds four token-saving strategies. All four are on by default. They are configured in one optional file, <state>/config/token-saving.json, which is hot-reloaded when its mtime or size changes. Each also has an environment kill switch, read when the server starts: HARNESS_TOKEN_SAVING=off turns off all four. An invalid section falls back to its defaults and is logged once. Decisions are written to <state>/telemetry/token-saving.jsonl.
{
"cacheKeep": { "enabled": true, "warmMs": 300000, "parentWarmMs": 3600000, "rerouteAfterCompaction": true },
"parentCacheTtl": { "enabled": true, "ttlSeconds": 3600, "roles": ["router", "coordinator"] },
"observationMasking": { "enabled": true, "triggerTokens": 80000, "minBatchTokens": 30000, "keepRecentTurns": 8, "minResultChars": 1200 },
"effort": { "enabled": true, "roles": { "scout": "low", "quick-builder": "low" },
"tiers": { "STRONG": "high", "MAXIMUM": "high" },
"complexity": { "routine": "low", "complex": "high" } }
}Caveat: subscription accounting. Max plans count usage limits, not dollars. Anthropic does not document how cache reads and 1h cache writes count against Max usage limits (Claude Code prompt caching). Users report that cache reads count heavily against Max quota (issue summary). The working assumption is that a cache hit is cheaper than a miss but not free, and that fewer context tokens per turn help either way. API prices are only a guide, and Batch API pricing does not apply to an OAuth subscription. Check each change against observed quota deltas (
subscription_quota), not against these docs alone.
What it does: Each model has its own prompt cache. Switching a model re-reads the whole prefix uncached (Claude Code prompt caching; Anthropic prompt caching). A continuation of a child that is running, or whose last completed response is younger than warmMs (5 min, or parentWarmMs = 1 h for roles with the 1h TTL), therefore keeps its current model. This applies to tier demotion, quota pacing and policy re-selection. The suppressed switch is recorded as routing.source = "cache_keep" with routing.cacheKeep {kept, suppressed, reason, ageMs}, and logged as model_switch_suppressed.
Model changes still apply to:
- new dispatches;
- a continuation right after a completed same-child compaction (
routing.postCompactionReroute), because compaction rewrites the prefix anyway; - an explicit
model, aresetModel: true, or a required cross-family review.
Effort-only changes, such as the existing continuationEffort: "reassess", keep the cache and are unaffected.
Configure: cacheKeep.*. Turn it off with HARNESS_CACHE_KEEP=off.
What it does: Parents often sit idle for 5 to 60 minutes while their workers run. With the default 5-minute TTL, every wake-up rewrites the parent's whole context.
The OpenCode 2.0.30 context hook cannot set the request cache policy. However, the runtime lowers LLM.CacheHint{ttlSeconds >= 3600} to cache_control: {type: "ephemeral", ttl: "1h"}, and its session.http.request plugin hook receives the final Anthropic request body. For primary requests from roles in parentCacheTtl.roles, the harness rewrites the cache breakpoints the runtime already placed to ttl: "1h". It keeps the same positions and the same count, so it never adds a fifth breakpoint. Workers, compaction requests and titles keep the 5-minute default. A 1h write costs 2x base input, against 1.25x for a 5m write, and reads cost 0.1x (Anthropic prompt caching). It pays off only when the parent resumes within the hour. Claude Code itself uses a 1h TTL on subscription main threads and 5m for subagents (Claude Code prompt caching).
Fail safe: If the hook API is missing, the body is not JSON, or the Claude subscription adapter already transformed the request (its hook must run after this one), the request is sent unchanged and the reason is logged once (parent_cache_ttl_unsupported). Successful rewrites are logged once per session (parent_cache_ttl_applied).
When the circuit breaker trips: a 400 response that mentions the TTL or cache_control right after a rewrite trips the breaker (parent_cache_ttl_disabled). Since 0.3.1 the breaker is shared by every plugin instance in the server and persisted in <state>/token-saving/ttl-breaker.json for 24 hours, so a restart or hot reload does not send another request the provider rejected. While it is tripped:
- router and coordinator requests are sent with the runtime's default 5-minute TTL (no rewrite);
- strategy 1 uses the 5-minute
warmMswindow for parents instead ofparentWarmMs, because a 1h cache no longer exists; - one
parent_cache_ttl_fallbackevent (reason,ttl: "5m",warmMs,until) is logged per trip and process.
After 24 hours the 1h TTL is tried again. To retry sooner, delete ttl-breaker.json. The file is read on every request, so no restart is needed.
Configure: parentCacheTtl.*. ttlSeconds: 300 or HARNESS_PARENT_CACHE_TTL=off turns it off.
What it does: Once the prepared context of a harness session is estimated (at about 4 characters per token) above triggerTokens, old tool results are replaced in batches. A result is replaced only if it comes before the last keepRecentTurns assistant turns and is at least minResultChars long. The placeholder reads:
[harness cleared old tool result: <tool> call <args digest>; N chars. Original: native read <path> offset=1 limit=3 …]
Tool calls are never changed. Control records (task_*, check_*, large_file_*, review_verdict and others) and error, image and media results stay verbatim.
Each original is saved first, in the same chunked format, under <state>/tool-output-store/masked/. A result that already points at a compression original reuses that original. A result whose original cannot be saved is not masked.
A batch is applied only when it frees at least minBatchTokens. The masked set is persisted per session in <state>/observation-masking/ and re-applied byte-identically on every later request, so the cached prefix changes only once per batch. cache-drift records the batch as an expected masking_boundary reset. Native agents are not masked.
Evidence:
- Anthropic's tool-result clearing (
clear_tool_uses) cut tokens by 84% in a 100-turn evaluation (context management, context editing docs). - Simple observation masking matched LLM summarization's solve rate at about 52% lower cost (JetBrains Research, arXiv 2508.21433).
- Clearing on every turn would break the cache each time (write-up), which is why masking works in large batches.
Telemetry (0.3.1): each batch logs observation_mask_batch with session, agent, results (results masked), charsRemoved, tokensRemoved (estimated at 4 chars per token; tokensCleared is the same value under its 0.3.0 name), tokensBefore (the estimate that triggered it) and the thresholds in effect (triggerTokens, minBatchTokens, keepRecentTurns). When masking stops for a session it logs observation_mask_stopped once per session: reason: "id_cap" means the session has 5000 masked results, and reason: "store_cap" means the store reached 256 MiB.
Pruning (0.3.1): whole sessions are evicted, meaning the state file plus all of the session's originals, so a placeholder in a live context never loses its original. Pruning runs at startup, at most every 6 hours, and early (at most once per 10 minutes) when the store is full. It evicts:
- sessions idle for more than 7 days (the state file mtime is refreshed while a session is in use);
- originals with no session state that are older than 7 days;
- abandoned
.pending-*directories; - when the store is above 75% of the cap, the least recently active sessions that have been idle for at least 6 hours, until the store is below 50%.
Each prune that removes anything logs observation_mask_pruned (sessions, originals, freedBytes, remainingBytes, reasons). A session evicted while it is idle gets its results back unmasked if it resumes, and may be masked again later.
Reading the savings: run harness-token-saving-report.mjs from the release bin/ (--state DIR, --date YYYY-MM-DD, --days N, --json). It prints per local day:
- masking batches, results, estimated tokens and chars removed, sessions, stops by reason, and prunes;
- 1h-TTL
applied(once per session and process), breaker trips, fallbacks and unsupported reasons; claude_auth_recoveryoutcomes.
harness-daily-rollup.mjs includes the same day summary under tokenSaving. tokensRemoved is the size of the context removed from each later request in that session until compaction, not a one-off saving. The per-request saving is roughly tokensRemoved × remaining turns, minus the one cache rewrite per batch.
Risk: A model may redo work it can no longer see. Watch re-reads and native_original_retrievals. Reading an original uses ordinary native read permissions: the store is outside the workspace, so the read may ask for permission.
Configure: observationMasking.*. Turn it off with HARNESS_OBSERVATION_MASKING=off.
What it does: On a new dispatch that uses the role's configured model (or a pacing demotion of it), the harness picks the reasoning variant on the same model:
- by role: scout and quick-builder use
low; - otherwise by tier: STRONG and MAXIMUM use
high; - otherwise by
routing.complexity:routineuseslowandcomplexuseshigh.standardkeeps the configured effort.
The variant changes only when the current catalog lists it for that model. Complexity never lowers effort for risk: "high" work. The variant is not changed for:
- explicit models;
- routing-policy candidates;
- required reviews;
- strict task-fit floors;
- continuations.
The decision is recorded in routing.effortMap {from, to, basis, applied, reason}. Anthropic calls effort "your primary control for token usage" (effort docs; Claude blog on effort in Claude Code). On the 5.5 models, changing effort keeps the cache and changing the model does not (Claude Code prompt caching).
Configure: effort.roles, effort.tiers and effort.complexity (values: minimal, low, medium, high, xhigh, max). Turn it off with HARNESS_EFFORT_MAP=off.
Use the existing telemetry over comparable work, before and after, and compare it with subscription_quota deltas:
- K: Count
model_switch_suppressedintelemetry/token-saving.jsonlandcache_keeprouting sources intask_dispatch_status. Inharness-metrics --days Nper root, cache-read should rise and cache-write should fall on continuations; theroute_changedreasons in its cache observation should drop. - B:
parent_cache_ttl_appliedandparent_cache_ttl_unsupportedevents, andparent_cache_ttl_disabled/parent_cache_ttl_fallbackwhen the breaker trips. For router and coordinator sessions (harness-metrics --session <root>), compare cache-write and cache-read on the first step after an idle gap of 5 to 60 minutes. A hit shows up as a large cache-read and a small cache-write. The extra cost of 1h writes shows up as larger cache-write totals on parents that never resume. - A:
observation_mask_batchevents (tokensBefore,tokensRemoved,charsRemoved; totals per day fromharness-token-saving-report.mjs),observation_mask_stopped/observation_mask_pruned,masking_boundarycounts in the cache observation, uncached-input and cache-read totals per root, and the number of compactions. Watchnative_original_retrievalsand repeated reads of the same files as signs of loss. - C:
routing.effortMapin dispatch status, thereasoningandoutputtoken totals per role inharness-metrics, plus acceptance, review and recheck failure rates, to catch quality regressions on work classified asroutine.
This is an experimental project extracted from a working private installation. The standalone installer and utilities are independently usable. The current source includes ChatGPT/Codex OAuth admission, a separately installed and reviewed Claude Code OAuth adapter, and opt-in dual-pool routing. Claude-only and Codex-only profiles are also supported by the generator and offline tests. The Claude adapter is third-party and uses an internal usage endpoint; its availability and subscription eligibility are not guaranteed. Review Claude setup and limitations.
The original public runtime reference is OpenCode 2.0.18 plus the required-plugin patch. The later managed 2.0.30 recovery patch has a separate hash-pinned baseline and activation procedure; these are not interchangeable patches or certification of stock OpenCode.
A fresh end-to-end public installation, stock/newer OpenCode versions, and Windows are not yet certified. OpenChamber installation and remote pairing are not included. Read compatibility before changing your agent setup.
The harness does not promise a percentage saving or a hard billing guarantee. Provider-side subscription eligibility and spend controls still matter. See security and limitations. This project is independent of OpenAI, Anthropic, OpenCode, OpenChamber, Spotify, or Headroom.
The longer-term goal is to put Codex, Claude, and other eligible subscriptions to work in parallel, choosing tasks and model/effort combinations for each pool's capabilities and remaining allowance.
The current development branch includes a provider-neutral offline planner that models independent pools, shared quota groups and per-window pacing without counting two routes to one allowance as extra capacity. Separately, the opt-in live router selects approved OpenAI/Claude role candidates from their quota views. There are no global concurrency reservations and no guarantee that a pool will be exhausted or that routing will save money. Live multi-provider routing remains opt-in; each adapter must verify subscription access, quota identity and financial controls first.
See the native and multi-pool workflow and the architecture and runnable fixture example. This planning foundation is scheduled for 0.2.0 and is not in the v0.1.0 release.
The 0.4.0 hard-deny classifier (hardDenyCheck) parses the command; it is a guard against plausible accidents, not a sandbox. Known gaps, accepted for 0.4.0:
- Programs that do their work from a script file (
python3 tool.py,npm run x, a Makefile) are not inspected; only inline code (-c,-e, heredoc) is. - Inline code that builds a command or path at runtime from pieces (string concatenation,
base64decoding,chr()), or that reads secrets without printing them obviously, can evade the literal checks. - Git aliases are resolved from the current repository's config only when the shell's directory is known;
include.pathfiles and system config written outside the command are not followed. - Symlinks are resolved at check time; a link swapped between the check and the run is not seen. Commands that change directory in loops or functions are judged by the union of directories, or denied when unknown.
- Secret-variable names are recognised by name parts (
TOKEN,KEY,SECRET,PAT,PASSWORD,*_URLof databases); a secret in an innocently named variable is not. - Remote commands are judged only for deletes of
/, top-level directories or the remote home (ssh host "rm -rf /srv/x"is allowed). - Tools that print credentials through their own subcommands (
docker compose config,docker inspect,aws configure get,gcloud auth print-access-token,heroku config,pass show,ps eww,tmux show-environment) and interpreter forms likefrom os import environ as e; print(e)are not recognised. git reset --soft HEAD~N/git reset HEAD~N,git checkout --orphan,git stash clearin the project, and other forges/tools (git lfs push --force,git subtree push,hub,jj) are allowed. Trash tools (trash,gio trash),crontab -randdocker system pruneare allowed.env -Cinside the project,$PWDafter an inexactcd, and a pre-existing git alias defined in aninclude.pathfile are judged lexically.>>,tee -aand other appends outside the project are allowed (they do not delete);rsyncwithout--deleteinto an outside directory is allowed.
The next milestones are:
- Make the first installation repeatable. Validate a fresh public setup end to end, automate compatible runtime builds, and document verified platform coverage.
- Connect the planner to safe parallel execution. Add atomic reservations, crash recovery, task idempotency, and ownership checks before runtime dispatch across pools. Advisory slot counts alone are insufficient.
- Add subscription adapters one at a time. Verify supported authentication, model/effort discovery, quota telemetry, and no metered fallback for each provider. Claude already has an opt-in OAuth/financial adapter, quota monitoring and candidate-based pacing/routing in the development branch. Harden that integration against endpoint changes; additional providers remain candidates.
- Validate usage improvements in ordinary work. Compare accepted results, cumulative work, effective models, compaction outcomes and actual quota deltas. Model-step thresholds are reassessment points, not hard spending limits.
- Measure useful outcomes across pools. Attribute task results, retries, elapsed time, and quota changes without equating token counts to subscription dollars. Evaluate independent-provider review where it adds value.
- Improve distribution and remote setup. Add signed releases, compatible binaries where practical, and documented OpenChamber setup and pairing.
For users: try the released quota tools first, check compatibility, and report installation or workflow gaps with a sanitized reproduction. For contributors: pick a bounded milestone above and propose how to validate it. The changelog separates released functionality from development work; these milestones are not promises of a release date.
Help make subscription-aware coding practical across more setups. Useful contributions include first-install reports, regression tests, clearer onboarding, provider adapter designs, and fixes for task routing or context handling.
- Open an issue with the problem, expected behavior, and a small sanitized reproduction. Discuss new adapters or runtime changes before building a large integration.
- Make a focused change with fixture-based tests. Keep credentials, account data, chat histories, and runtime state out of the repository.
- Run the offline checks below and open a pull request explaining the behavior change, validation, and remaining limitations.
Read CONTRIBUTING.md for test and release requirements and SECURITY.md for the current safety boundaries. Automated tests should not consume a real subscription or incur inference charges.
Requirements: macOS or Linux, Python 3.10+, Git; Node 22.12+ to run plugin tests. No npm dependencies are needed for the offline tests. Inference additionally needs a compatible guarded OpenCode build and authentication for each enabled provider: Codex CLI plus ChatGPT OAuth for OpenAI, or the separately installed reviewed Claude Code OAuth adapter for Anthropic. Claude-only profiles do not require Codex CLI. Installing the toolkit does not install either auth integration.
Download the source for the release you intend to install from this repository's Releases page, or check out its version tag. Review it, then run from the repository directory:
python3 -m unittest discover -s tests -p 'test_*.py'
node --test tests/*.test.mjs
python3 scripts/audit_public.py
python3 install.py install --source "$PWD"Default installation: ~/.local/share/opencode-usage-harness. The installer prints the installed version; it never edits shell startup files or starts a service. Add its bin directory yourself if desired:
export PATH="$HOME/.local/share/opencode-usage-harness/bin:$PATH"
harness-manage status
codex-quota --json # OpenAI/Codex onlyThe codex-quota command above is for OpenAI users; Claude-only users should skip
it and use subscription_quota after enabling the Claude session integration.
codex-quota reads the existing Codex CLI login through codex app-server --stdio; it does not make an inference call. It preserves the distinction between missing telemetry and exhausted quota. Use HARNESS_CODEX_BIN for an absolute executable path when Codex is not on PATH.
For metrics, explicitly identify the compatible OpenCode database:
export HARNESS_OPENCODE_DB="/absolute/path/to/opencode.db"
harness-metrics --days 7
harness-metrics --days 7 --jsonPreserve expensive check output privately with harness-check --label tests --revision REV -- python3 -m pytest. Each run keeps separate stdout, stderr and an exit-status receipt. Optional harness-check --preview RECEIPT --stream stderr returns a bounded page with exact repeated lines compacted; see durable diagnostics.
Progress guidance separates active execution from verified outcomes. When small work expands, agents revisit the next useful result; follow-up reviews carry existing findings forward and focus on affected changes. Checkpoint reminders are injected on existing primary model requests; they are cooperative guidance, not hard timeouts, new approval gates, or timer-driven model calls.
The database is opened read-only. The public repository includes no database. Historical permission-blocked minutes are unknown, and artifact freshness is not independently verified by the metrics tool. Completed checks are self-reported evidence, not proof of real-world correctness. Tokens are not subscription-dollar prices. For deduplicated completion counts and token totals across legacy logs and the new ledger, see completion telemetry.
Read COMPATIBILITY.md and SETUP.md. The installer does not silently modify an existing OpenCode profile, choose account-specific model IDs, authenticate, buy credits, or install remote services.
The generated public profile asks approval for unknown shell commands, pushes, deployments, and destructive actions. Reasoned one-use large-file grants do not require a separate confirmation. Existing file permissions still apply. For broader permissions, use configure.py --shell-policy permissive: it allows all shell commands except a dangerous-command ask list. The default is allowlist. A raw-command guard asks for redirects to secret-looking paths and for redirects the 2.0.30 shell parser drops; see shell permissions.
Full-auto projects (configure.py --full-auto-project DIR) allow shell, path and edit asks inside the project, but still ask for force pushes, history rewrites, deletes outside the project, disk writes and secret-looking paths. There are two narrow exceptions to the secret-path ask, both full-auto only: the value of docker's --env-file option (docker loads it into the containers), and, since 0.3.2, read-only access to exactly /opt/wncscanner-docker/.env over ssh garage-server with cat, less, grep, stat or readlink (the operator's standing rule, which also covers systemctl cat/status wncscanner-stack). Writes, copies or redirects of that file, other secret files in the same command, other hosts and local reads still ask, and any change to the wncscanner-stack service (systemctl restart|stop|enable|edit|..., writes to its unit file) now asks on every host. No OpenCode "always" pattern is saved for this. See shell permissions for the exact conditions. Since 0.3.3 full-auto also asks for sudo and any system service change, and --full-auto-no-deploy DIR makes every push, publish and deploy ask in that project (set for yrdsale). Read-only tools may look outside the project except at credential paths and other projects' uncommitted files, and a foreground parent is released 30 s after a child's ask so it keeps working while a human answers. Since 0.3.4 full-auto reads and read-only shell ask for browser profile data (Cookies, Login Data, Chrome profile directories), /home/box/work/agent-profiles and the harness install itself, except state/check-receipts, the harness code and OpenCode shell output; source files named like secrets (credentials.py, *Credentials.test.tsx) are no longer treated as secrets.
Since 0.4.0 auto-approve is the default for every project, listed or not, including pushes and deploys; --full-auto-no-deploy is a no-op. The guard never asks. It hard-denies at once, with a resumable-blocker message, only force pushes and history rewrites, deletes outside the project or /tmp (and raw disk writes), and reads or exfiltration of secrets (the garage-server .env read-only exemption stays). Any ask that still stays pending is auto-denied after 15 minutes (HARNESS_ASK_TIMEOUT_MS). See shell permissions, "0.4.0".
For an explicitly authorized repository relocation, an operator can issue an expiring external-write grant to an existing worker. It is bound to the workspace, task, owner, intent revision, checks and destination. The dispatcher revalidates it on continuations and coordinates harness-managed destination ownership across workspaces; ordinary requests cannot grant themselves access by naming an absolute path. Native permissions still apply. This permits scoped destination work—it does not relocate sessions, copy files or approve publication automatically.
See external write grants for scoped cross-workspace migration, exact bindings, and the requirement to keep native/direct destination writers idle.
Obtain and review the new release source in a separate checkout/directory. Run tests, then:
harness-manage update --source /absolute/path/to/new-release
harness-manage status
# If needed:
harness-manage rollbackTo carry a built Claude OAuth adapter inside the release, add --vendor-claude-auth DIR to stage, install or update (0.4.1; see CLAUDE-SUBSCRIPTION.md). harness-manage deploy --dry-run runs the same release verification as a real deploy (MAINTENANCE-RECOVERY.md).
Updates use the new source's VERSION; changed content cannot replace an already-installed version. Files are staged, hashed, and activated through an atomic current symlink. previous retains a rollback target. State, OAuth credentials, project files, and active services are not updated or restarted. Source manifests detect local corruption; they are not cryptographic publisher signatures. Obtain releases from a trusted repository and verify release checksums.
Agent profiles refer to the release from which they were generated. Updating toolkit code alone does not switch active plugin paths. At a planned idle point, back up state, regenerate/review the profile with the new release's configure.py --replace, and explicitly restart the compatible service. Rollback of code does not roll back profile or state: restore the corresponding profile backup too. Do not downgrade a database schema blindly.
| Setting | Meaning |
|---|---|
HARNESS_STATE_DIR |
Mutable state; default ~/.local/state/opencode-usage-harness |
HARNESS_OPENCODE_DB |
Required explicit compatible OpenCode SQLite database |
HARNESS_CODEX_BIN |
Optional Codex CLI executable; OpenAI only |
HARNESS_PYTHON |
Optional Python executable for plugin helpers |
CODEX_HOME |
Optional Codex configuration directory; OpenAI only |
Claude quota access resolves the selected OpenCode OAuth connection; it has no parallel API-key environment setting.
Release code and state are separate. Never commit auth files, financial attestations, telemetry, chat histories, or state backups. See security and limitations, contributing, and changelog.
The large-file context control was inspired by Spotify’s “Portal by Spotify cut my Claude Code token usage by 90%” and the Shunt plugin in spotify/portal-ai-plugins.
Credit to Spotify for the approach of blocking broad reads of files over a 350-line threshold and delegating focused analysis to a smaller worker that returns a compact summary, while allowing targeted reads. This harness applies that approach to OpenCode with its own routing and quota controls. Spotify’s reported savings describe its experiments; they are not measured results for this project. No Spotify affiliation or endorsement is implied.
Headroom inspired our recoverable tool-result compression: the V2 harness now automatically compacts eligible new JSON, search listings, and repeated test/build output before they enter model context. Conservative diff previews retain all changes while shortening unchanged context; diagnostics explain skipped results, and passive cache monitoring detects prepared-context changes without rewriting requests. Every JSON row/value remains represented; exact originals are retained privately and can be read in bounded chunks through OpenCode's normal read tool. Nested CodeMode values, source reads, errors, permissions, and existing conversation history stay intact. No extra inference or proxy is required. We independently implemented these ideas after examining Headroom's log compressor and compression store. See automatic compression and retrieval, including limits and the local snapshot security boundary. Existing bounded check-log previews remain available.
Harness reviewers and other harness agents can use large_file_json when native
line reads truncate a minified JSON file. It returns exact text in bounded,
SHA-256-bound character pages, preserving large numbers, duplicate keys and
escaped strings. Continue with next and expectedSha256 until complete is
true; a partial page is not a complete review. Native read permissions still
apply. The helper adds no shell capability, model calls or provider-specific
behavior. See JSON reading for limits and examples.
MIT. The OpenCode compatibility patch retains upstream attribution in NOTICE and compat/LICENSE.opencode.
Keep the default router and the native escape available while collecting ordinary
work. Use harness-metrics --help to select the relevant root chats and time
window, then compare direct-worker/native and routed tasks of similar scope.
Track user-accepted outcomes, corrections, elapsed time and validation evidence
alongside uncached input, cache reads and output. A reported completion is not
user acceptance, and token shares are not subscription quota shares. Do not
launch synthetic work just to evaluate routing. The provisional task-fit policy
stays neutral until reviewed task evidence supports a preference.
Anthropic usage-check failures now retain a sanitized reason (HTTP status, timeout, network failure or invalid response) and bounded retry-after seconds when available. Concurrent checks share the selected OAuth credential's private cache. Transient failures may reuse disabled-overage verification only until the original successful verification is 24 hours old; failures themselves never grant admission. Auth failures, known exhaustion and expired financial evidence remain blocking. This does not retry inference or switch accounts/providers. A stored expired OAuth token tested outside the runtime is not proof that runtime refresh is broken.
Private runtime releases can be staged from public source with explicit,
hash-checked local adapters using scripts/stage_private_release.py. Source,
installed and verified-live are separate states. Configuration, policy, instructions
and launchers must be included in the verification manifest; see
release procedure. Historical telemetry directories
remain retained; reports covering the migration must account for both locations.
The example multi-pool policy selects Sonnet 5.5 medium for ordinary new builder assignments, alongside the OpenAI medium-effort peer. High-effort roles remain available for concrete complexity or risk. Validate model variants against your own catalog. Existing worker routes and explicit overrides are preserved; this policy change does not downgrade an admitted worker.
Compression reports distinguish deliberately protected tools from unsupported
formats and report observed skipped characters. savings_status=no_observed_savings
is a valid result: small outputs and source reads do not justify forced compression.
Prepared character reductions are not measured subscription-credit savings.