---
title: "Configuration"
description: "Current runtime defaults, optional secrets, and what harness verification means."
---

> Documentation Index
> Fetch the complete documentation index at: https://tryshiba.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Configuration

Non-secret defaults are in `apps/backend/wrangler.jsonc` and `alchemy.run.ts`. For local Wrangler runs, copy `apps/backend/.dev.vars.example` to the ignored `apps/backend/.dev.vars`. The Alchemy bootstrap stores deployment configuration/secrets in root `.env` (gitignored, mode 0600); inspect `scripts/setup.mjs` and `alchemy.run.ts`. Neither file belongs in version control. `.dev.vars` is not uploaded as production configuration.

## Optional monitoring

Shiba sends nothing to a monitoring service unless you enable an adapter and
provide its destination. Each adapter works independently. The browser never
receives collector URLs, keys or DSNs: signed-in dashboards send only a fixed
event name to Shiba's same-origin `/api/observability` endpoint.

| Setting | Default | Purpose |
| --- | --- | --- |
| `SHIBA_ERROR_REPORTING` | `none` | Set `sentry` to report Worker, queue, email, scheduled-job and dashboard errors, and failed coding runs |
| `SENTRY_DSN` | unset | Worker secret: HTTPS Sentry DSN, including the project number; self-hosted path prefixes are supported |
| `SHIBA_ANALYTICS` | `none` | Set `posthog` to send anonymous dashboard-opened and coding-run outcome events |
| `POSTHOG_HOST` | unset | Explicit HTTPS PostHog collector origin; hosted and self-hosted collectors work |
| `POSTHOG_API_KEY` | unset | Worker secret: PostHog project ingestion key, not a personal API key |
| `SHIBA_OPEN_TELEMETRY` | `0` | Set `1` to export `shiba.lifecycle.events` counters and approval-gated run traces using OTLP/HTTP JSON |
| `OTEL_EXPORTER_OTLP_METRICS_ENDPOINT` | unset | Full HTTPS collector URL, including `/v1/metrics`; no query string or embedded credentials |
| `OTEL_EXPORTER_OTLP_TRACES_ENDPOINT` | unset | Full HTTPS collector URL, including `/v1/traces`; no query string or embedded credentials. Langfuse uses `/api/public/otel/v1/traces` |
| `OTEL_EXPORTER_OTLP_HEADERS` | unset | Optional Worker secret: comma-separated, URL-encoded header pairs, e.g. `Authorization=Bearer%20your-token` |

For Alchemy, set these in the ignored root `.env` or use `pnpm bootstrap`.
For Wrangler, set non-secret settings in `vars`, and bind the three secrets with
`wrangler secret put`. Local development uses `.dev.vars`. Run `pnpm env:load`,
`pnpm env:scan`, `pnpm check:deploy` and `pnpm check:dev-vars` after configuration
changes. Removing an adapter's opt-in disables it even when credentials remain.
Invalid or incomplete destinations fail closed; HTTP destinations are not used.

The event contract contains only source, fixed event name, schema version,
timestamp and the immutable Worker version ID when available. Sentry also gets
an intrinsic error class and a fixed description, **not** the exception message,
stack, cause, breadcrumbs or request data. No prompts, customer code, file paths,
repository names, URLs, user IDs, email addresses, cookies or headers are exported.
PostHog gets a new random identifier per event, with profiles and GeoIP disabled;
there is no autocapture, session replay, browser storage or cross-event identity.
This supports aggregate counts, not per-user funnels or retention reporting.

Run traces use one OTLP trace per approved run. The trace id is the run identity
encoded in the fixed-width hexadecimal form OTLP requires (`agent-tool:<uuid>`
uses that UUID directly); every span also carries the exact run id, approval id,
and approval input hash when present. Spans cover the run, its approval, the
sandbox delegate tool call, harness-reported model usage and tool events, and
external publication effects. Span attributes are limited to ids, hashes,
statuses, model or harness names, token counts and durations; prompts, task
content, file paths, repository names, diffs, logs, user identifiers, cookies
and headers are not exported.
Dashboard activity honors the browser's Do Not Track setting; error counters
remain independent of activity analytics.

Reporting is best-effort: each destination has a two-second timeout, redirects
are refused, and failures never fail the task or request. Worker background
deliveries use `waitUntil`; the dashboard limits itself to ten events per signed-in
mount and the ingress reuses the existing rate-limit binding with a separate key.
There is no durable telemetry queue or retry, source-map upload, or sandbox
console capture. Trace delivery is bounded in memory per run, fire-and-forget,
and collector failures never fail or block the approval, run, tool, model, or
publication path. The Sentry inbound automation
webhook is unchanged and is unrelated to this reporting adapter.

## Runtime settings

| Setting | Default / status | Purpose |
| --- | --- | --- |
| `GATEWAY_ID` | `default` | Account-owned AI Gateway selected through the Workers AI binding |
| `ORCHESTRATOR_MODEL` | `@cf/zai-org/glm-4.7-flash` | Parent planning via Workers AI |
| `CODING_MODEL` | `google/gemini-3.5-flash-lite` | OpenCode default coding model; also accepts `xai/<model>` for Grok |
| `CLAUDE_CODE_MODEL` | `anthropic/claude-sonnet-4-6` | Claude Code default model |
| `CODEX_MODEL` | `openai/gpt-5.3-codex` | Codex default model |
| `GROK_MODEL` | `xai/grok-4.6` | Grok default model; medium reasoning effort |
| `BUILTIN_MODEL` | `deepseek/deepseek-chat` | Shiba agent (`builtin`) default model; any supported API-key provider |
| `PI_MODEL` | `anthropic/claude-sonnet-4-6` | Pi default model |
| `TTS_PROVIDER` | `cloudflare` | Workers AI speech synthesis for `POST /api/voice/speak`; empty or `none` disables voice synthesis |
| `AGENT_HARNESS` | `opencode` | Deployment fallback; a task can select a harness explicitly |
| `SLACK_AGENT_HARNESS` | `AGENT_HARNESS`, then `claude-code` | Harness for Slack-originated runs (mentions, DMs, /shiba) |
| `SHIBA_CLAUDE_SUBSCRIPTION` | `0` in wrangler defaults | Set `1` to enable the deprecated `claude-subscription` harness — may violate Anthropic terms; prefer API Claude Code or explicitly paired local Claude Code ([model auth](/docs/model-auth/)) |
| `MODEL_CREDENTIAL_KEY` | unset | 64 hex chars; enables per-user encrypted ChatGPT connection credentials (Settings → Models) |
| `SHIBA_SINGLE_USER` | unset | Set `1` to allow legacy `CODEX_SUBSCRIPTION_AUTH_JSON` Worker-secret fallback for codex-subscription |
| `CLAUDE_SUBSCRIPTION_MODEL` | `anthropic-subscription/claude-sonnet-4-6` | `claude-subscription` default model |
| `SHIBA_CODEX_SUBSCRIPTION` | unset | Set `1` to enable `codex-subscription`; a valid `MODEL_CREDENTIAL_KEY` also enables this harness for per-user connections (below) |
| `CODEX_SUBSCRIPTION_MODEL` | `openai-subscription/gpt-5.3-codex` | `codex-subscription` default model |
| `SHIBA_ANTIGRAVITY_SUBSCRIPTION` | unset | Set `1` to enable the opt-in `antigravity-subscription` harness (below) |
| `ANTIGRAVITY_SUBSCRIPTION_MODEL` | `google-subscription/gemini-3-pro` | `antigravity-subscription` default model |
| `SHIBA_CURSOR_SUBSCRIPTION` | unset | Set `1` to open the opt-in `cursor-subscription` connect lane (below) |
| `CURSOR_SUBSCRIPTION_MODEL` | `cursor-subscription/auto` | `cursor-subscription` model override |
| `SHIBA_LOCAL_RUNTIME` | unset | Set `1` to enable the opt-in `local` runtime (below) — dashboards can queue runs that execute on an operator machine |
| `AGENT_MAILBOX` | `dev@tryshiba.dev` | Agent mailbox identity — the address the MCP `latest_verification` tool scans by default for OTP codes and magic sign-in links |
| `LOCAL_ADAPTER_TOKEN` | unset | Bearer token the operator daemon presents on `/api/local/*`; required for the surface to answer (dark otherwise) |
| `ROLE_MODEL_MAP` | unset | JSON map pinning a harness+model per delegation role, e.g. `{"fixer":{"harness":"opencode","model":"opencode-go/deepseek-v3.2"}}` |
| `ROLE_MODEL__ORCHESTRATOR` / `__EXPLORER` / `__FIXER` / `__REVIEWER` / `__DESIGNER` | unset | Per-role pin as `"harness/model"` or bare `"harness"` — consulted when the map has no entry for that role |
| `RUNTIME` | `sandbox` | Runtime adapter; current default is Cloudflare Sandbox |
| `INSTANCE_TYPE` | `standard-3` | Configured Cloudflare container size |
| `SHIBA_ELEVATED_CONCURRENCY` | unset | Raises the orchestrator policy cap from five to ten active runs; deployment container capacity is a separate limit |
| `SHIBA_DAILY_CONTAINER_BUDGET_USD` | unset | Blocks new starts at a configured harness-reported usage threshold, not a full invoice cap |
| `REQUIRE_ACCESS` | Wrangler default unset; live Alchemy stages set `1` | Enable the Access identity lane at the Worker boundary; built-in Better Auth is a separate configured lane. Without either identity system, only loopback development hosts bypass authentication |
| `BETTER_AUTH_URL` | unset | Canonical public dashboard URL (e.g. `https://app.tryshiba.dev`) for Better Auth cookie scope and origin checks; unset falls back to each request's own origin |

Model identifiers are defaults, not availability guarantees. Choose a currently available model for your account. Harness selection is implemented in `apps/backend/src/harness/` and has unit coverage; local OpenCode execution and successful model inference are separate claims (see dated [verification](/docs/readiness/)).

## Harnesses and credentials

The current source registry and Dockerfile include `opencode`, `claude-code`, `codex`, `grok`, and `pi`, alongside ACP adapters and other configured runtime paths. Devin is not a registered harness or installed image binary. OpenCode and Pi support Google, Anthropic, OpenAI, and xAI model providers; Pi runs headlessly with `--mode json` and its provider-specific API key env vars, while `grok` runs the Grok CLI with `--single` and streaming-json pinned to `api.x.ai` via `GROK_MODELS_BASE_URL`. Provider selection, dummy keys, and provider-host egress are implemented and unit-tested. The image also includes a pinned Cursor CLI; binary presence alone does not establish an available account, approved execution route, or live compatibility. The dated `docs/verification/verification.md` records OpenCode as the only harness exercised in the local end-to-end container run; that run's provider request returned 401. It records no cloud end-to-end run and no successful inference. Do not present unit tests or image binary checks as live harness acceptance.

OpenCode, Claude Code, Codex, and Pi provider traffic uses the account-owned AI Gateway path; configure provider credentials there. `AI_GATEWAY_TOKEN` is an optional Worker secret for gateway authentication. Keep keys out of repository files, logs, and task text.

### Claude subscription (deprecated opt-in)

`SHIBA_CLAUDE_SUBSCRIPTION` ships **`0` by default**. Setting it to `1` registers `claude-subscription`, which stores a `claude setup-token` at the Worker egress boundary — Anthropic does not permit third-party apps to collect or relay Claude.ai subscription tokens ([legal guidance](https://code.claude.com/docs/en/legal-and-compliance)). Use **API Claude Code or explicitly paired local Claude Code** instead. Native cloud `claude-login` is unavailable: there is no provisioned per-user credential volume, and native credentials must not enter the sandbox. See [Model authentication](/docs/model-auth/).

### ChatGPT subscription (per user, OSS self-host)

Set `MODEL_CREDENTIAL_KEY`, register an `openai-subscription` connection, and have each user complete **Sign in with ChatGPT** under **Settings → Models** (paste the `127.0.0.1` callback URL). Standard SIWC runs use `codex app-server` with `ACCESS_TOKEN=shiba-egress-placeholder`. The real access token is attached by Worker egress for the signed-in user, and refresh stays in the `ChatGptAuth` Durable Object. Neither real tokens nor `auth.json` enter that run container. Details: [Model authentication](/docs/model-auth/).

### Codex subscription (opt-in)

`codex-subscription` uses the user's connected ChatGPT plan rather than the AI Gateway provider-key path. For the standard SIWC route, configure per-user connection storage and complete Sign in with ChatGPT. The harness starts `codex app-server`, supplies only a placeholder in the sandbox, and sends plan inference through `api.openai.com` to the Worker `codexPlan` egress handler. The handler resolves credentials for the initiating user; it does not put tokens in the egress parameters or mount `auth.json` into the run.

Legacy operator authentication endpoints and `SHIBA_SINGLE_USER` credential storage are not evidence that the current SIWC harness mounts credentials or refreshes them in a container. Prefer the documented per-user sign-in route. A separate device-auth branch is default-off behind `SHIBA_CODEX_DEVICE_AUTH=1`; a computed per-user volume path is not proof of a provisioned credential mount or a working deployment. See [Model authentication](/docs/model-auth/) for its limits. Your own plan terms apply.

### Antigravity subscription (opt-in)

**Security limitation:** Antigravity still stores OAuth tokens in a container profile, not Worker-side custody. Repository processes running as the same user can read that file; directory permissions do not isolate them. Do not enable this harness for untrusted repositories. Task-run egress excludes `oauth2.googleapis.com` and `accounts.google.com`; OAuth exchange is confined to the separate sign-in sandbox, and token refresh during a task is blocked rather than silently broadening egress. Removing these hosts mitigates direct OAuth access but does not eliminate token theft or exfiltration through remaining allowed services. Full remediation requires Worker-side token custody and scoped egress-time injection.

Setting `SHIBA_ANTIGRAVITY_SUBSCRIPTION=1` registers `antigravity-subscription`, which drives the pinned `agy` ACP server against the operator's own Google subscription. There is no secret to store — the credential never touches the Worker. Connect an account by posting to `/api/auth/antigravity-subscription/begin` (optionally `{"account": "<name>"}`): shiba boots a dedicated auth sandbox, prepares the isolated profile (`0700` dirs, `auth.type=oauth-personal`, ambient Google credentials stripped from the launch environment), starts `agy` there, and returns the Google sign-in URL it prints. Sign in as the operator's own account; the browser lands on a `http://127.0.0.1:…/` redirect that fails in the browser — copy that URL verbatim and POST it to `/api/antigravity/callback` as `{"url": "<pasted>", "account": "<name>"}`. Shiba validates it is the pending flow's exact listener (same origin, same state, exactly one code-or-error) and forwards it into the container unmodified — no proxies, no redirects, no logging of the URL. Finish with `/verify`; signing in is not proof, the capability probe (token materialized in the profile) is. Clear via `/clear` destroys the auth sandbox. Your own plan terms apply.

### Cursor subscription (opt-in)

Setting `SHIBA_CURSOR_SUBSCRIPTION=1` opens the `cursor-subscription` connect lane, which connects the operator's own Cursor account instead of relying on a container-held `CURSOR_API_KEY`. To connect an account, create a Cursor Agent API key in cursor.com settings and store it as a Worker secret — `CURSOR_SUBSCRIPTION_TOKEN`, or `CURSOR_SUBSCRIPTION_TOKEN_<ACCOUNT>` for a named account — then drive the lifecycle under `/api/auth/cursor-subscription` (begin, verify, clear). The token is a deployment secret: it stays outside the sandbox, is attached only at the egress boundary on the two hosts the CLI calls (`api2.cursor.sh`, `repo2.cursor.sh`), and appears in no log, command line, or UI response. Verification exercises the key on the same wire runs use — the `api2.cursor.sh` credential exchange the CLI itself performs; a 401/403 marks the credential rejected. Signing out stops in-flight subscription runs and refuses new ones. Your own Cursor plan terms apply.

Subscription credentials are not the default provider-key path — API credentials via AI Gateway are. The `claude-subscription` opt-in above is the deliberate exception: it exists for the single-tenant operator driving their own credential, and stays dark unless they set the flag. Check the provider's current terms before enabling it. The assistant/model used to edit this repository is independent of these application settings.

### Local runtime (opt-in)

Setting `SHIBA_LOCAL_RUNTIME=1` and provisioning the `LOCAL_ADAPTER_TOKEN` secret registers a third `RuntimeAdapter` name, `local`, alongside `sandbox`. A run with `runtime: "local"` still mints the same approval card and still computes its verdict with `harness.verify` — the gate does not relax because the work is local. What changes is where step 5 executes: instead of booting a sandbox, the Worker posts a schema-checked envelope to the `LocalDispatch` DO and an operator-side daemon claims it over an authenticated outbound connection.

The daemon is `scripts/shiba-local-daemon.mjs` — a single dependency-free Node ≥20 script. On the operator machine (macOS or Linux):

```sh
export SHIBA_WORKER_URL=https://<your-worker>.workers.dev
export LOCAL_ADAPTER_TOKEN=<same secret the Worker knows>
node scripts/shiba-local-daemon.mjs            # poll loop; --once for a single cycle
```

The agent CLIs (`opencode`, `claude`, `codex`) must be on the daemon's `PATH` and authenticated in the operator's own terminal — `claude auth login`, `codex login`, Google sign-in happen locally; no credential ever transits the Worker, egress, or a container. Runs materialize under `~/.shiba-local/runs/<sandboxId>/` (`work/` for the clone, `home/` for `HOME`); provider config bodies reference `${OPENCODE_API_KEY}`-style placeholders resolved from the operator's environment, and the dummy key is stripped entirely. Process leases under `leases/run/<id>.lease` keep a second daemon from double-claiming; dead workspaces are reaped at startup.

Intake is provably dashboard-only: `runtime: "local"` is refused at intake on every chat surface (Slack, email, MCP, automations) because only the authenticated `/api/runs` handler stamps the `X-Shiba-Intake: dashboard` voucher `queueSlackRun` requires. Harnesses opt in via `supportedRuntimes` — `opencode`, `claude-code`, `codex` declare `["sandbox", "local"]`; every other harness refuses local dispatch. Git publish stays Worker-side: the daemon returns receipts plus the diff, and the existing publish path opens the PR. Cancelling an approved-but-unclaimed run is supported (`POST /cancel` settles it); a daemon that dies mid-run is recoverable — stale claims are reaped after 45 minutes.

## Optional secrets

| Name | Purpose |
| --- | --- |
| `GITHUB_TOKEN` | Worker-side GitHub access for private clone and optional PR publishing; public diff-only runs can omit it |
| `GITHUB_WEBHOOK_SECRET` | HMAC verification for GitHub webhook automations |
| `GITHUB_PROJECT_TOKEN`, `GITHUB_PROJECT_NUMBER` | Optional Projects v2 board sync — a PAT with `project` scope and the board number; published PRs are added to the board and moved to "In review" |
| `AI_GATEWAY_TOKEN` | Optional gateway authorization credential |
| `SLACK_BOT_TOKEN`, `SLACK_SIGNING_SECRET`, `SLACK_APPROVERS` | Optional Slack integration and approver allowlist. The token and signing secret must come from the real installed Slack app; setup status reports only that local values are present, not live Slack access |
| `SLACK_CHANNEL_REPOS` | Optional channel-to-repository mapping |
| `TRIGGER_TOKEN` | Bearer token for `POST /api/trigger` (e.g. iPhone Apple Shortcuts); unset disables the route |
| `TYPESAFE_API_KEY` | Optional TypeSafe integration |
| `BETTER_AUTH_SECRET` | Turns on the built-in dashboard login: email+password accounts and signed-cookie sessions served at `/api/auth/*`, stored in the `AGENT_AUDIT` D1 database. The library requires >=32 characters. Generate with `openssl rand -base64 48`. Unset (or shorter) keeps the lane dark and the gate falls back to Access / fail-closed. Sign-up defaults to one bootstrap deployment account. Further enrollment requires a current invitation, verified email delivery, and the restricted-member API policy; invited accounts do not become deployment operators. Access remains a separately configured identity lane |
| `BETTER_AUTH_BOOTSTRAP_TOKEN` | Setup token the first sign-up must send (`x-shiba-bootstrap-token`). On a public hostname, sign-up stays locked until this token is set; `BETTER_AUTH_OWNER_EMAIL` adds an email restriction. Loopback dev can create the first account without either |
| `BETTER_AUTH_OWNER_EMAIL` | Allowlisted email for the bootstrap account, compared case-insensitively; this is separate from authorized invitation enrollment |

Local example:

```sh
cp apps/backend/.dev.vars.example apps/backend/.dev.vars
# Edit locally; never commit secrets.
```

For the Alchemy deployment path, use `pnpm run bootstrap` to collect secrets in `.env`. Do not use `wrangler secret put` as though it configures the Alchemy deployment: its source of truth is `.env`. See [Deployment](/docs/deployment/).

Source: https://tryshiba.dev/docs/configuration/index.mdx
