Skip to content

Latest commit

 

History

History
680 lines (578 loc) · 101 KB

ENVIRONMENT.md

File metadata and controls

680 lines (578 loc) · 101 KB

Environment Variables

This document lists all environment variables used in the Kilo Code cloud monorepo.

Core / System

  • NODE_ENV - Node environment (development, production, test); used by virtually every package. [SERVER]
  • CI - Set to true in CI environments; detected by Next.js, Playwright, Vitest, and various tooling to alter behavior (non-interactive, skip prompts, etc.). [SERVER]
  • PORT - Port for local dev servers. Next.js defaults to 3000; used by packages/web-shared/src/lib/constants.ts and various test servers. [SERVER]
  • HOME - User home directory; used by child processes spawned by services (OpenClaw resolves ~/.openclaw, Expo devcert for mkcert certs). [SYSTEM]
  • PATH - System executable search path; modified by tooling (OpenClaw, tsx, etc.) to locate CLIs. [SYSTEM]
  • TMUX - Set when running inside a tmux session; used by dev/local/tmux.ts to detect tmux environment. [SYSTEM]
  • GITHUB_ACTIONS - Set to true by GitHub Actions CI; detected by tooling (Rye log groups, Playwright, Vitest) to enable GitHub Actions-specific output/reporting. [SERVER]
  • NEXT_RUNTIME - Set by Next.js to 'node', 'edge', or 'browser'; used in apps/web/src/instrumentation.ts and apps/ai-gateway/src/instrumentation.ts to select appropriate Sentry instrumentation. [SERVER]
  • DOTENV_CONFIG_QUIET - Set by dotenv to suppress load output; set to 'true' in dev/seed/lib/preflight.ts:9 during seeding. [SERVER]

App (apps/web)

Manage shared web env var additions and rotations with pnpm web:env set <VARIABLE>. The helper coordinates tracked root and apps/web dotenv defaults, the kilocode-app and kilocode-ai-gateway Vercel deployments, and 1Password storage for sensitive Production values. pnpm web:env copy fills a new project from an existing one. See DEVELOPMENT.md for the full workflow.

Admin MFA step-up

  • ADMIN_STEP_UP_ENABLED - Binary kill switch for session-bound MFA step-up. the literal string true enforces step-up (any other value, including TRUE, is off) on admin tRPC procedures, specialized admin procedures, adminOnly REST routes, and the admin layout; unset or any other value disables it and leaves admin behavior unchanged. Admin enrollment freshness and other independent security fixes apply regardless. [SERVER]

Code review health monitor

CODE_REVIEW_HEALTH_SECRET is a dedicated server-only monitor credential. [SECRET] The monitor must send Authorization: Bearer <configured value>. An unset or empty value disables access. Each running instance shares its cached health response across authorized callers for 60 seconds; simultaneous refreshes share one evaluation.

Apply packages/db/src/migrations/0307_review_window_index.sql before deploying the application. For initial deployment or rotation, the owner runs pnpm web:env set CODE_REVIEW_HEALTH_SECRET, supplies a newly generated secret, and coordinates the application deployment with the external monitor's header update. Verify the monitor after the deployment and header update. Only one configured secret is accepted; deployment and monitor configuration must agree. Keep credentials out of tracked defaults. For local monitor development, generate a separate value with openssl rand -base64 32 and set it in the local environment; ordinary local startup does not require this credential.

Cloud agent dispatch health monitor

CLOUD_AGENT_DISPATCH_HEALTH_SECRET is a dedicated server-only monitor credential for GET /api/cloud-agent/dispatch-health. [SECRET] The monitor must send Authorization: Bearer <configured value>. An unset or empty value disables access, and the endpoint accepts no other credential, including request parameters.

For initial deployment or rotation, the owner runs pnpm web:env set CLOUD_AGENT_DISPATCH_HEALTH_SECRET, supplies a newly generated secret, and coordinates the application deployment with the external monitor's header update. Verify the monitor after the deployment and header update. Only one configured secret is accepted; deployment and monitor configuration must agree. Keep credentials out of tracked defaults. For local monitor development, generate a separate value with openssl rand -base64 32 and set it in the local environment; ordinary local startup does not require this credential.

Model health monitor

MODELS_HEALTH_SECRET is a dedicated server-only credential for GET /api/models/up. [SECRET] The caller must send Authorization: Bearer <configured value>; an unset or empty value answers 401 with { "healthy": false }, and the endpoint accepts no other credential, including request parameters. Every response carries Cache-Control: no-store.

For initial deployment or rotation, the owner runs pnpm web:env set MODELS_HEALTH_SECRET, supplies a newly generated secret, and coordinates the application deployment with the external monitor's header update. Order the cutover so no poll lands on an unroutable credential: set the secret first, then add the Authorization: Bearer header to the external monitor, then deploy the application. Verify the monitor after the deployment and header update. Only one configured secret is accepted; deployment and monitor configuration must agree.

Keep the credential out of tracked defaults. For local monitor development, generate a separate value with openssl rand -base64 32 and set it in the local environment; ordinary local startup does not require this credential.

Uptime probe

UPTIME_PROBE_SECRET is a dedicated server-only credential for GET /api/up. [SECRET] The caller must send Authorization: Bearer <configured value>; an unset or empty value answers 401 with { "database": false, "recentAIActivity": false }, and the endpoint accepts no other credential, including request parameters. Every response, including the 401, carries Cache-Control: no-store. Each running instance shares one evaluation of the probe across authorized callers for 60 seconds, and simultaneous requests share one evaluation, so the endpoint performs at most one database read per instance per minute whatever the caller's request rate.

Order the cutover so no poll lands on an unauthenticated endpoint: first run pnpm web:env set UPTIME_PROBE_SECRET and supply a newly generated value, then add the Authorization: Bearer header to the external monitor, then deploy the application. Verify the monitor after the deployment. Only one configured secret is accepted; deployment and monitor configuration must agree.

Keep the credential out of tracked defaults. For local probing, generate a separate value with openssl rand -base64 32 and set it in the local environment; ordinary local startup does not require this credential.

Configuration & Constant URLs

  • APP_URL_OVERRIDE - Optional base application URL override in any environment; used in packages/web-shared/src/lib/constants.ts and next.config.mjs. When unset, Vercel's staging target uses https://staging-app.kilo.ai, production uses https://app.kilo.ai, and local development uses PORT. [SERVER]
  • AI_GATEWAY_URL - Optional origin of the apps/ai-gateway app that apps/web rewrites its AI gateway routes to; read at build time in apps/web/ai-gateway-rewrites.mjs. When unset, Vercel's production target uses https://ai-gateway.kilo.ai, its staging target uses https://staging-ai-gateway.kilo.ai, other Vercel targets fail the build, and outside Vercel it defaults to http://localhost:<3010 + KILO_PORT_OFFSET>. apps/web has no gateway routes of its own. pnpm dev:start sets it to the local ai-gateway app. [SERVER]
  • KILOCLAW_INSTANCE_URL_TEMPLATE - URL template for KiloClaw instances; used in packages/web-shared/src/lib/config.server.ts. [SERVER]
  • NEXTAUTH_URL - Base URL for NextAuth.js; used across many auth-related files. [SERVER]
  • NEXTAUTH_SECRET - Secret key for NextAuth.js session encryption and five-minute, audience-bound user assertions verified by internal Workers such as user data export. [SECRET]
  • SESSION_SYNC_SECRET - Signs short-lived grants for the native session sync service. Keep it separate from user credentials and NEXTAUTH_SECRET. [SECRET]
  • PAGES_AUTH_SECRET - What the Pages deployment at pages.kiloapps.io presents when it trades a sign-in code, or a Pages-audience token minted at /api/auth/resource-token, at /api/pages-auth/exchange. The exchange answers with the person's account id, name and organizations, plus their primary email address when a sign-in method verified it. At least 32 characters. While it is unset, the pages audience cannot sign anyone in. [SECRET]
  • PAGES_DEV_AUTH_SECRET - The same for pages-dev.kiloapps.io, for both the code and the token trade. Keep it different from PAGES_AUTH_SECRET. [SECRET]
  • DEBUG_SHOW_DEV_UI - Enables dev-only UI elements (debug panels, admin buttons); checked in packages/web-shared/src/lib/constants.ts and apps/web/src/app/(app)/profile/page.tsx. [SERVER]
  • TRPC_TIMING_LOGGING - Enables tRPC timing logs in development; checked in packages/web-shared/src/lib/trpc/init.ts. [SERVER]
  • TRPC_TIMING_SAMPLE_RATE - Sample rate (0-1) for non-mobile request timing lines; mobile clients are always logged. Defaults to 0.01 when unset or malformed; read in packages/web-shared/src/lib/observability/request-timing.ts. [SERVER]
  • USAGE_RECORD_COMPLETION_SAMPLE_RATE - Production success sample rate (0-1) for shared gateway/HTTP writer usage_record_completion logs; defaults to 1 (100%) when unset, blank, malformed or out of range. 0 disables recorded/duplicate completion logs; 1 logs every success. Not-recorded/errors and nonproduction completions always log. Set consistently on gateway and HTTP writer apps and redeploy to change it; read in packages/web-shared/src/lib/ai-gateway/usage-record-diagnostics.ts. [SERVER]
  • JEST_MAX_WORKERS - Limits max worker threads for Jest; read in apps/web/jest.config.ts. [SERVER]
  • JEST_SILENT - When false, shows verbose Jest output; read in apps/web/jest.config.ts and apps/web/.env.test. [SERVER]
  • JEST_WORKER_ID - Set by Jest to identify the current worker thread; used by db connection pooling and libraries to handle worker-specific state. [SERVER]
  • IS_SCRIPT - Set to 'true' by apps/web/src/scripts/index.ts to indicate a script-mode run (bypasses web server logic). Used by Drizzle in packages/db/src/database-url.ts. [SERVER]
  • SECURITY_AGENT_AUDIT_RELIABLE_COVERAGE_START - Earliest ISO timestamp from which Security Agent Audit Report event coverage is reliable. [SERVER]

Analytics & Monitoring

  • NEXT_PUBLIC_POSTHOG_KEY - PostHog public project key for client analytics and server feature evaluation. Configure the same project for the web app and AI gateway. The web app has a tracked public default in apps/web/.env; verify runtime configuration in both deployments before rollout. [PUBLIC]
  • NEXT_PUBLIC_POSTHOG_DEBUG - Enables PostHog debug logging; checked in apps/web/src/components/PostHogProvider.tsx and apps/web/src/lib/stytch.ts. [PUBLIC]
  • POSTHOG_PERSONAL_API_KEY - PostHog personal API key used by user-deletion PostHog cleanup. [SECRET]
  • POSTHOG_ENVIRONMENT_ID - PostHog project/environment ID used by user-deletion PostHog cleanup. [SERVER]
  • POSTHOG_HOST - Optional PostHog API host override for user-deletion cleanup; defaults to https://us.posthog.com. [SERVER]
  • PYLON_API_KEY - Pylon REST API key used by user-deletion contact and reply cleanup. [SECRET]
  • PYLON_HOST - Optional Pylon API host override for local user-deletion cleanup; defaults to https://api.usepylon.com. [SERVER]
  • PYLON_FINAL_EMAIL_AUTHOR_USER_ID - Optional Pylon staff user id used to match an already-posted deletion reply. [SERVER]
  • CUSTOMERIO_TRACK_BASE - Optional Customer.io Track API base override for local user-deletion cleanup; defaults to https://track.customer.io. [SERVER]
  • SUBSTACK_PUBLICATION_URL - Substack publication origin used by user-deletion subscriber cleanup; defaults to https://blog.kilo.ai. Must be blog.kilo.ai or a *.substack.com host. The Substack admin search URL is hardcoded to https://kilocode.substack.com/publish/subscribers, not this publication. [SERVER]
  • SENTRY_ORG - Sentry organization slug for source map uploads; used in apps/web/next.config.mjs and apps/ai-gateway/next.config.mjs. [SECRET]
  • SENTRY_PROJECT - Sentry project slug for source map uploads; used in apps/web/next.config.mjs and apps/ai-gateway/next.config.mjs. [SECRET]
  • SENTRY_AUTH_TOKEN - Sentry auth token for source map uploads; used in apps/web/next.config.mjs, apps/ai-gateway/next.config.mjs, and Cloud Agent deployment CI. Cloud Agent uploads target kilo-code/kilo-cloud-agent; the token must never enter sandbox environments or image build arguments. [SECRET]
  • NEXT_PUBLIC_SENTRY_DSN - Sentry DSN for server and Edge runtime error reporting; used in apps/web/sentry.edge.config.ts and packages/web-shared/src/lib/observability/sentry-server.ts. [PUBLIC]

Marketing Tags

  • NEXT_PUBLIC_GTM_ID - Google Tag Manager container ID; rendered in apps/web/src/app/layout.tsx and exposed via apps/web/src/app/api/marketing-tags/gtm/route.ts. [PUBLIC]
  • NEXT_PUBLIC_IMPACT_UTT_ID - Impact.com UTT (Universal Tracking Token) ID; rendered in apps/web/src/app/layout.tsx and exposed via apps/web/src/app/api/marketing-tags/impact/route.ts. [PUBLIC]

Vercel & Build Info

  • VERCEL_ENV - Vercel environment (development, preview, production); used in apps/web/next.config.mjs, packages/web-shared/src/lib/constants.ts, and apps/web/.env.test. [SERVER]
  • VERCEL_TARGET_ENV - Vercel system or custom deployment environment (development, preview, production, staging, etc.); used in apps/web/src/app/layout.tsx to identify staging UI and in apps/web/ai-gateway-rewrites.mjs to pick the AI gateway origin. [SERVER]
  • VERCEL_URL - Auto-injected by Vercel; current deployment URL. Used in apps/web/src/lib/buildInfo.ts. [SERVER]
  • VERCEL_GIT_COMMIT_SHA - Auto-injected by Vercel; Git commit SHA of the current deployment. Used in apps/web/src/lib/buildInfo.ts. [SERVER]
  • NEXT_PUBLIC_VERCEL_URL - Client-exposed Vercel deployment URL from build info. [PUBLIC]
  • NEXT_PUBLIC_VERCEL_GIT_COMMIT_REF - Client-exposed Git branch/ref from build info. [PUBLIC]
  • NEXT_PUBLIC_VERCEL_GIT_COMMIT_SHA - Client-exposed Git commit SHA from build info. [PUBLIC]
  • NEXT_PUBLIC_VERCEL_GIT_REPO_OWNER - Client-exposed Git repo owner from build info. [PUBLIC]
  • NEXT_PUBLIC_VERCEL_GIT_REPO_SLUG - Client-exposed Git repo slug from build info. [PUBLIC]
  • GITHUB_SHA - GitHub Actions commit SHA; used in apps/web/src/lib/buildInfo.ts during CI builds. [SERVER]

Security & Auth

  • NEXT_PUBLIC_TURNSTILE_SITE_KEY - Cloudflare Turnstile public site key; used in apps/web/src/components/auth/sign-in/TurnstileView.tsx. [PUBLIC]
  • TURNSTILE_SECRET_KEY - Cloudflare Turnstile secret key; used in test files. [SECRET]
  • EMAIL_SIGNUPS_ENABLED - Set to exact true to allow new accounts via email (web magic link and mobile email code). Unset or any other value refuses them. Existing users keep email sign-in either way, and OAuth, passkey, and SSO sign-ups are unaffected. Jest's global setup (apps/web/src/tests/setup/globalSetup.ts) defaults it to true; keep it out of tracked dotenv files so pnpm web:env set can set it. Takes effect on redeploy. [SERVER]
  • NEXT_PUBLIC_STYTCH_PROJECT_ENV - Stytch public project environment identifier; used in apps/web/src/components/auth/StytchClient.tsx. [PUBLIC]
  • NEXT_PUBLIC_STYTCH_PUBLIC_TOKEN - Stytch public token for client SDKs; used in apps/web/src/components/auth/StytchClient.tsx. [PUBLIC]
  • STYTCH_PROJECT_ID - Stytch project ID for secret-side SDK calls. [SECRET]
  • STYTCH_PROJECT_SECRET - Stytch project secret. [SECRET]
  • STYTCH_PUBLIC_TOKEN - Stytch legacy public token alias used in some test fixtures. [PUBLIC]
  • INTERNAL_API_SECRET - Shared secret for internal API calls between services; used in apps/web/src/lib/kiloclaw/cli-runs.test.ts, kiloclaw-router.test.ts, dev seed scripts, and other service routers. [SECRET]
  • BOT_TOKEN_MINT_SECRET - Dedicated bearer secret for POST /api/internal/bot-token, which mints one-hour tokens for bot-internal-* users. It authenticates only the mint and is never a Kilo credential; unset or empty disables the endpoint. Separate from INTERNAL_API_SECRET. [SECRET]
  • SUPPORT_ACCESS_ENABLED - Enables enforced explicit support-organization access. Only the exact string true enables it; unset, empty, false, or any other value is OFF. OFF keeps today's platform-admin owner shortcut; ON requires an active scoped grant for admins who are not members of the organization. Set it for the kilocode-app project with pnpm web:env set SUPPORT_ACCESS_ENABLED; the value takes effect on redeploy. [SERVER]

Usage-accounting transport is selected from deployment labels alone: staging with VERCEL_TARGET_ENV=staging and VERCEL_ENV not production, or production with both VERCEL_ENV and VERCEL_TARGET_ENV exactly production. There is no per-region, per-payer or exposure switch, and no historical queue rollout variable is read. Eligibility is therefore not a runtime setting: stopping new production queue selection requires reverting this source change and redeploying the gateway, while already accepted work continues draining. Every production function region that runs the gateway queues; deployments whose labels match neither branch keep direct accounting. Selected events await one finalized event publication within the accounting lifetime. HTTP 202 skips the direct usage write and returns a queued identity, not a committed row; spend-watched Bouncer events are delivered by the writer after its outbox commits, with cron retry on failure. Missing or unparseable publisher configuration publishes nothing, so each selected event is written through the direct accounting path (including the SFO primary-region handoff), logs publisher_not_configured with its usage ID, and raises at most one Sentry error per instance per minute. A lifetime registration failure (no request scope or waitUntil) also publishes nothing and uses the same direct fallback. Any other unavailable publication or unexpected rejection logs the finalized usage ID and a failure category and returns a null accounting result without a direct write, because the queue may already hold the event. Apart from those two fallbacks, no gateway billing writer is called on acceptance or failure. Failed accounting retains best-effort Bouncer reporting, which does not persist billing. Events not accepted by the queue have no durable recovery in this path and may be lost; a timeout may also hide an accepted event that the consumer later records. Cloudflare HTTP publication opts into up to four attempts for transient failures, with up to twenty seconds for the first confirmation and five seconds for each later one, within a 40-second overall elapsed budget. Retry waits use exponential full jitter from zero up to (excluding) 500 ms, 1,000 ms, then 2,000 ms; sleeps and attempt timeouts are clipped to remaining budget, with no new attempt after exhaustion. Runtime scheduling can delay deadline observation. Non-retry calls remain one two-second attempt. Publication occurs only for selected queue-only accounting. The obsolete background shadow publisher has been removed; historical shadow events already accepted by the queue must still be reconciled and drained before enabling a processing consumer. This code does not remove queued messages. Ambiguous retries may enqueue duplicates with the same usage ID; the writer deduplicates billing. Publisher logs carry duplicate_possible: true once any attempt timed out, lost its response or received a 5xx. Requires an independently verified processing consumer and authenticated writer; selection does not establish readiness or a durable production publication guarantee. [SERVER]

  • USAGE_INGEST_URL - Optional complete usage-ingest HTTP endpoint (for example, ending in /usage) for the gateway usage publisher helper. No default; a missing URL or secret, or a URL that is not an absolute https URL (plain http is accepted only for a loopback host, as in local fixtures; scheme-less values such as localhost:3000/usage are rejected), makes the helper report publisher_not_configured without a network call. Accepts only HTTP 202. Selected queue-only Cloudflare HTTP publication makes at most four attempts on timeout, transport failure, HTTP 408/429 or 5xx, reusing the same serialized event and ID. Missing/malformed configuration and other HTTP outcomes are not retried. Redirects are terminal 3xx outcomes and are never followed. The first confirmation allows up to twenty seconds and later ones up to five seconds, with full-jitter retry caps of 500/1,000/2,000 ms within a 40-second elapsed budget. Four full attempts plus the maximum waits take under 38.5 seconds, so the budget only shortens or skips a later attempt when runtime scheduling delays the loop. Timeouts and waits are clipped to remaining budget; runtime scheduling can delay deadline observation. Non-retry HTTP calls retain one two-second attempt. This budget excludes subsequent Bouncer reporting. Exhaustion returns failure without direct billing. For isolated local tests, use http://127.0.0.1:<fixture-port>/usage with the real usage-ingest Worker and a local queue. Configuring it alone does not activate gateway publication. [SERVER]
  • USAGE_QUEUE_TRANSPORT - Removed. The staging Vercel Queues prototype is retired: new gateway builds have no Vercel publisher, queue callback or queue/v2beta trigger, and the gateway no longer reads this variable. A leftover staging value, including vercel, is ignored, so eligible staging accounting publishes through Cloudflare. Already deployed staging builds that still contain the prototype keep their own consumer and the writer's queue_vercel caller label; whether their queue still holds messages is not verified by source. Leave the hosted variable, queue and writer credentials in place until an operator confirms those deployments no longer have work to drain. A developer checkout that ran a staging gateway build before the retirement may still hold the untracked generated callback apps/ai-gateway/src/app/api/v1/internal/queues/usage/route.ts, which imports the deleted @kilocode/usage-queue/vercel/callback and breaks the next gateway build. Check that file once: delete it only if it is that generated callback, then rebuild. Do not delete any other route, and do not use wildcards. [SERVER]
  • USAGE_WRITER_URL - Complete LLM usage-writer endpoint (/api/internal/usage/record) used by the Cloudflare usage-ingest consumer in production and staging, and by older staging kilocode-ai-gateway deployments that still contain the retired Vercel Queues consumer. Configure it in each consuming runtime to target the corresponding Frankfurt-only kilocode-app writer. The Cloudflare consumer derives the sibling Exa and Enkrypt writer endpoints by replacing that path suffix. No default. [SERVER]
  • USAGE_WRITER_SECRET - Writer authentication secret used by the Cloudflare usage-ingest consumer in production and staging and by older staging kilocode-ai-gateway deployments that still contain the retired Vercel Queues consumer; must match the target kilocode-app writer's INTERNAL_API_SECRET. That retired publisher and consumer also used it with a queue-specific HMAC purpose to authenticate the complete usage envelope before writer I/O. No additional signing credential is required. [SECRET]
  • USAGE_WRITER_PROTECTION_BYPASS - Optional target-writer deployment-protection automation bypass, read by the Cloudflare usage-ingest consumer in production and staging and by older staging kilocode-ai-gateway deployments that still contain the retired Vercel Queues consumer. When configured, sent as x-vercel-protection-bypass; needed only when the target writer deployment is protected. [SECRET]
  • SCIM_PROTECTION_BYPASS - Optional Vercel automation bypass for the scim-sync Worker, sent as x-vercel-protection-bypass. Needed only under --env staging, because staging-app.kilo.ai has Deployment Protection enabled and its edge answers before Next.js runs; app.kilo.ai is unprotected and binds none. A plain Worker secret (wrangler secret put), not a Secrets Store binding, so production can omit it without failing the deploy. Generated by Vercel under the project's Protection Bypass for Automation. [SECRET]
  • USAGE_INGEST_PUBLISH_SECRET - Optional dedicated Bearer secret for the gateway usage publisher helper; must match the usage-ingest Worker's setting of the same name. Separate from INTERNAL_API_SECRET and user credentials. Use only a synthetic matching value in local fixtures. [SECRET]
  • ENKRYPT_USAGE_QUEUE_ENABLED - Removed. Enkrypt guardrail usage now always goes through the usage queue in every region, like queued LLM accounting; there is no rollout selector to turn it off at runtime. Every Enkrypt usage write is published once, in every region, as the bare Enkrypt usage record to the /enkrypt-usage path that replaces the documented /usage path of USAGE_INGEST_URL. It is authenticated with USAGE_INGEST_PUBLISH_SECRET and uses the same retries and budget as queued LLM accounting. HTTP 202 writes nothing directly. A missing secret, a USAGE_INGEST_URL of any other shape, or a missing request lifetime publishes nothing, and the write takes today's direct path (SFO handoff, then a local write; a local write in Frankfurt). Any failure after a send attempt logs [enkrypt-guardrail] usage queue publication failed; record dropped with the usage ID and reason, with no direct write, because the queue may already hold it. To stop new production queue selection, revert this source change and redeploy the gateway; already accepted work continues draining. Do not remove the USAGE_INGEST_URL/USAGE_INGEST_PUBLISH_SECRET variables or the Worker-side publisher secret while old code that still reads this selector could be running, and reinstate the selector only if rolling back to source that still reads it. [SERVER]
  • EXA_USAGE_QUEUE_FALLBACK_ENABLED - Removed. The usage queue is now always the durable fallback for Exa usage wherever USAGE_INGEST_URL and USAGE_INGEST_PUBLISH_SECRET form a valid publisher configuration; there is no rollout selector, so deploying this source enables the fallback in every such environment, including ones where the old selector was off. It matters only on the kilocode-app Vercel project (Frankfurt only), which serves /api/exa; kilocode-ai-gateway does not run that route. The direct Exa usage write stays first, and a successful direct write never publishes. The write is bounded against the invocation deadline, with a 45-second publication reserve taken only when the publisher configuration is valid; the writer receives the remaining budget as transaction-local lock, statement and idle-in-transaction timeouts. The route publishes the same record, with the same id and occurredAt, once inside the existing after() work after that direct write fails (stage record_write) or is skipped because the remaining budget cannot fit it (stage write_skipped); a cost-parse failure (stage cost_parse) publishes nothing. The route publishes to the /exa-usage path that replaces the documented /usage path of USAGE_INGEST_URL. It is authenticated with USAGE_INGEST_PUBLISH_SECRET and uses the same transient retries and budget as Enkrypt publication. The Exa writer deduplicates by id and occurredAt, so a direct write that had in fact committed is answered duplicate with no second debit. The direct write is never repeated after a publish attempt. So the Bearer secret never travels in clear text, USAGE_INGEST_URL must be https, except plain http to a loopback host for local fixtures. A missing secret, a plain-http non-loopback URL or a USAGE_INGEST_URL of any other shape publishes nothing and makes no request. HTTP 400 is terminal. The outcome is a bounded fallback field on the existing [exa] usage record failed; charge may be unrecorded line: not_configured, queued, rejected (HTTP 400) or publish_failed, with a categorical fallback_reason and, for an unexpected rejection, only the error's name. To stop new Exa queue publication, either remove kilocode-app's publisher configuration and redeploy, or revert this source change and redeploy with EXA_USAGE_QUEUE_FALLBACK_ENABLED absent or set to anything other than true, because the reverted source publishes whenever that value is true; already accepted work continues draining. [SERVER]
  • BOUNDED_INTERNAL_SERVICE_TOKENS_ENABLED - Set to exact true to enable modern, purpose-labelled internal assertions at the Phase 5.1 bounded Git broker, export, deletion, and Session Ingest callsites. Unset or any other value retains their existing legacy token formats. Enable only after compatible readers, including the dedicated GitHub disconnect audience, are deployed; generic human/control/runtime signers are not affected. [SERVER]
  • NATIVE_RESOURCE_TOKENS_ENABLED - Set to exact true to permit fresh native adoption of separate one-hour API/gateway access tokens only for clients explicitly requesting api-gateway-v1, provided SHARED_RESOURCE_TOKENS_ENABLED is also exact true. Default-off. Unsupported clients keep legacy responses. Turning this flag off affects subsequent native issuance/refreshes only; active modern device credentials can continue receiving bounded control tokens while their owned device session and current user pepper remain valid. [SERVER]
  • SHARED_RESOURCE_TOKENS_ENABLED - Master default-off readiness gate. Fresh modern producer issuance requires both this flag and its family flag below to be exact true; unset or any other value disables adoption. Native adoption separately requires NATIVE_RESOURCE_TOKENS_ENABLED and this master, independent of producer families; old CLI negotiation is unchanged. These flags do not revoke existing credentials. Valid modern device access credentials retain bounded control issuance after rollback, with current owned-session, pepper, and requested organization membership validation and a one-hour/parent-expiry cap. Chat likewise retains bounded three-audience issuance for validated modern devices; modern credentials never fall back to broad legacy tokens. Persisted modern workload renewal does not use adoption gates. Separately deployed readers/producers must be verified before activation. [SERVER]
  • CLOUD_AGENT_RESOURCE_TOKENS_ENABLED - Default-off family gate for Cloud Agent Next request control and workflow control tokens; requires the master and exact true. [SERVER]
  • CHAT_RESOURCE_TOKENS_ENABLED - Default-off family gate for fresh chat resource issuance; requires the master and exact true. Validated modern devices retain chat/event-service/notifications issuance after rollback, capped by one hour and parent expiry. [SERVER]
  • DELEGATED_RESOURCE_TOKENS_ENABLED - Default-off family gate for explicit API, gateway, and attribution delegation, including the organization user-token resource route, and for the five-minute Pages-audience (pages, pages-dev) tokens from POST /api/auth/resource-token, which organization credentials cannot mint; requires the master and exact true. Disabled explicit delegation remains unavailable. [SERVER]
  • WORKFLOW_GATEWAY_RESOURCE_TOKENS_ENABLED - Default-off family gate for server workflow gateway tokens; requires the master and exact true. [SERVER]
  • ORG_PERMISSION_POLICY_WRITES_ENABLED - Default-off web deployment gate for Enterprise organization permission policy writes. Set to exact true only after the web app and both Gateway regions have compatible group-policy readers, older operator-config writers are no longer serving, and web deployments that can write the retired client policy have been drained. Drain older web deployments that can return the retired policy before serving consumers that require the agent-permissions-only response. The organization must also be enabled for org_permission_policy. After enabling writes, retain compatible readers even if either gate is disabled. [SERVER]
  • INTERNAL_BOT_RESOURCE_TOKENS_ENABLED - Default-off family gate for internal bot tokens from POST /api/internal/bot-token; requires the master and exact true. [SERVER]
  • CALLBACK_TOKEN_SECRET - Secret for signing callback tokens. Required for local development. [SECRET]
  • INTERNAL_SECRET - Alias/fallback for INTERNAL_API_SECRET; used in KiloClaw E2E scripts (services/kiloclaw/e2e/). [SECRET]
  • Native (mobile) sign-in rate limits are Vercel Firewall rules configured in the project's firewall configuration, not environment variables. native-token-address counts token exchanges per caller address before the admission gate; native-token-user counts them per account after it. Both belong in that configuration, and apps/web/src/lib/auth/native-token-rate-limit.ts checks them through the shared firewall helper, which reports a rule that is not configured or an answer the firewall blocked at most once a minute. The address rule must answer: when it is absent, the exchange is refused before any provider call.
  • Sign-in code email rate limits are Vercel Firewall rules configured in the project's firewall configuration, not environment variables. magic-link-email counts sends per normalized address; sign-in-code-email-ip counts sends per caller address. apps/web/src/lib/auth/email-signin-eligibility.ts sends a magic link or sign-in code only when both rules answer that the caller may proceed; an unconfigured or unevaluable rule refuses the send and is reported to Sentry at most once a minute, so both rules are required configuration.
  • Native admission rate limiting is a Vercel Firewall rule configured in the project's firewall configuration, not an environment variable. native-admission-challenge counts challenge issuance per caller address at POST /api/auth/native/admission-challenge; it belongs in that configuration, because apps/web/src/lib/auth/native-admission.ts checks it through the shared helper and refuses the request when the rule is unconfigured or cannot be evaluated, reporting that answer to Sentry at most once a minute.

Social OAuth Clients

  • ANACONDA_CLIENT_ID - Anaconda OAuth app client ID. [PUBLIC]
  • ANACONDA_CLIENT_SECRET - Anaconda OAuth app client secret. [SECRET]
  • OPENAI_CLIENT_ID - OpenAI (Sign in with ChatGPT) OAuth client ID. Read only from the environment; the literal must never appear in source. [SECRET]
  • OPENAI_CLIENT_SECRET - OpenAI (Sign in with ChatGPT) OAuth client secret; server-side only, sent only in the token endpoint's HTTP Basic authorization header. [SECRET]
  • OPENAI_DISCOVERY_URL - Optional override for the OpenAI OpenID Connect discovery document; defaults to the production issuer's document. [SERVER]
  • OPENAI_TOKEN_ENDPOINT - Optional override for the OpenAI token endpoint; defaults to the production issuer's endpoint. [SERVER]
  • OPENAI_CHATGPT_API_URL - Optional override for the base URL that token-sharing requests use with a "Sign in with ChatGPT" connection; defaults to https://api.openai.com/v1. Set it wherever OPENAI_DISCOVERY_URL/OPENAI_TOKEN_ENDPOINT are overridden, so delegated inference stays in the same environment as the token issuer. [SERVER]
  • CLAUDE_SIGN_IN_CLIENT_ID - Client ID of the "Sign in with Claude" OAuth app in the Claude Console. Register <APP_URL>/api/auth/callback/claude as its redirect URI. The Claude provider is registered only when this value is set. Sign-in and account-link controls follow the configured provider list; email discovery excludes Claude when this value is absent. [SERVER]
  • CLAUDE_SIGN_IN_ASSERTION_AUDIENCE - The audience that the sign-in app's Client authentication tab shows; the aud of its client assertions. [SERVER]
  • CLAUDE_FEDERATION_ISSUER - The issuer URL of Kilo's federation issuer registered with Anthropic (inline JWKS); the iss of every Kilo-signed Claude JWT. [SERVER]
  • CLAUDE_FEDERATION_SUBJECT - The sub of every Kilo-signed Claude JWT; must match the subject pattern of the OAuth apps and the federation rule. [SERVER]
  • CLAUDE_FEDERATION_KEY_ID - The kid of the federation signing key, as registered in the inline JWKS. [SERVER]
  • CLAUDE_FEDERATION_PRIVATE_KEY - PKCS#8 PEM of Kilo's P-256 federation signing key; \n escapes are accepted. Anthropic holds only the public key. [SECRET]
  • CLAUDE_OIDC_ISSUER - Optional override for the Claude ID-token issuer and discovery base; defaults to https://identity.anthropic.com/users. Set it only for the local stub (pnpm dev:mock-anthropic). [SERVER]
  • CLAUDE_AUTH_BASE_URL - Optional override for the Claude authorization server; defaults to https://auth.claude.com. Set it only for the local stub. [SERVER]
  • CLAUDE_API_BASE_URL - Optional override for the Claude API; defaults to https://api.anthropic.com. Set it only for the local stub. [SERVER]
  • CLAUDE_BILLING_CLIENT_ID - Client ID of the Claude OAuth app for Linked billing with Claude Platform. It links customer organizations. Register <APP_URL>/claude/billing/callback as its redirect URI. [SERVER]
  • CLAUDE_BILLING_ASSERTION_AUDIENCE - The audience that the billing app's Client authentication tab shows. [SERVER]
  • CLAUDE_OPERATOR_FEDERATION_RULE_ID, CLAUDE_OPERATOR_ORGANIZATION_ID, CLAUDE_OPERATOR_SERVICE_ACCOUNT_ID - Identify the Kilo operator service account and the federation rule that maps Kilo-signed JWTs to it. Without them, a linked owner's requests fail with an explicit error instead of falling back to Kilo credits. [SERVER]
  • CLAUDE_OPERATOR_WORKSPACE_ID - Optional; needed only when the operator federation rule covers more than one workspace. [SERVER]
  • CLAUDE_OPERATOR_TOKEN_AUDIENCE - The audience the operator federation rule expects on the identity JWT Kilo signs. [SERVER]

Claude sign-in, account linking, and Linked billing with Claude Platform require their app and operator credentials. There is no separate release toggle: the provider is offered only when CLAUDE_SIGN_IN_CLIENT_ID is set. Anthropic's ID token need not carry email_verified; sign-in still refuses a token that states the address is unverified, and only a true claim auto-links an existing account by email. Explicit Claude account links require a matching pending link and a current browser session, including its revocation check. They bind the verified provider subject, not the provider email, and preserve the initiating browser session. An explicit link does not require an email-verification claim and cannot create an account or link accounts by email. Claude authentication refusals log a fixed reason and allowlisted claim names, never identity values or tokens. The submitted discovery email controls offered methods only; ordinary sign-in independently authorizes the verified provider email.

Customer-billed Claude requests require a current link check. Frankfurt reads the authoritative link directly. The US gateway delegates this check to the web application with INTERNAL_API_SECRET. A failed check returns a retryable error; it never selects another payer. Keep the internal secret consistent across both applications before enabling customer billing. Provider billing failures remain customer failures, including spend-limit refusals. A generic permission refusal does not disable the link. Only explicit profile refusals trigger that transition. Account erasure retries temporary remote cleanup failures before deleting the stored profile identifier.

  • GITHUB_CLIENT_ID - GitHub OAuth app client ID. [PUBLIC]
  • GITHUB_CLIENT_SECRET - GitHub OAuth app client secret. [SECRET]
  • GITHUB_APP_ID - GitHub App ID; used in integration adapter and tests. [SECRET]
  • GITHUB_APP_PRIVATE_KEY - GitHub App private key (PEM); used in integration adapter and tests. [SECRET]
  • GITHUB_APP_CLIENT_ID - GitHub OAuth Client ID for the app install/login flow; used in apps/web/src/lib/integrations/platforms/github/app-selector.ts. [PUBLIC]
  • GITHUB_LITE_APP_ID - Lighter/secondary GitHub App ID for select integrations. [SECRET]
  • GITHUB_LITE_APP_PRIVATE_KEY - Private key for the lite GitHub App. [SECRET]
  • GITHUB_LITE_APP_CLIENT_ID - OAuth Client ID for the lite GitHub App install/login flow. [PUBLIC]
  • GITHUB_APP_WEBHOOK_SECRET - Webhook signing secret of the standard GitHub App; apps/web/src/lib/integrations/platforms/github/app-selector.ts reads it for /api/webhooks/github, which refuses every delivery (401) while it is empty. [SECRET]
  • GITHUB_LITE_APP_WEBHOOK_SECRET - Webhook signing secret of the lite GitHub App; read for /api/webhooks/github-lite, which refuses every delivery (401) while it is empty. [SECRET]
  • GITHUB_MULTIPLE_INSTALLATION_ORGANIZATION_IDS - Comma-separated Kilo organization UUIDs allowed to connect multiple GitHub App installations. Unset or empty disables multiple installations for all organizations. [SERVER]
  • GITHUB_SHARED_INSTALLATION_ORGANIZATION_IDS - Comma-separated destination Kilo organization UUIDs allowed to create an association to a GitHub App installation already associated elsewhere. Unset or empty disables new shared associations without revoking existing ones. [SERVER]

Organizations already in GITHUB_SHARED_INSTALLATION_ORGANIZATION_IDS can create restricted secondary connections without another feature flag. The original connection retains workflow authority; secondaries support Slack and Cloud Agent only. Removing an organization from the allowlist prevents new admission without revoking active connections or promoting another owner. Do not roll Workers back to role-unaware authorization after admitting secondary connections.

Apply the role migrations and deploy the role-aware writers and consumers close together, including git-token-service before web/Cloud Agent consumers. The migration automatically classifies eligible existing associations. A rare in-flight legacy write after the backfill snapshot can remain unassigned and fail-closed; a later verified reconnect can recover an unambiguous legacy association without changing an existing role. This affects availability only and does not grant secondary access. No manual role repair is part of rollout. The broker authorization RPC must be available before consumers use pinned associations; a missing RPC intentionally fails closed, including for cached capabilities.

The connection-role migration preserves a sole eligible connection, prefers an unambiguous existing workflow binding, and otherwise uses the oldest eligible connection. Deduplication losers and unhealthy unbound legacy rows are excluded. Shared groups with conflicting workflow bindings, unbound eligible rows, or pending-request history without a unique workflow claimant remain unassigned and fail closed. Inspect them with the read-only pnpm --filter web script src/scripts/backfill-github-installations.ts --reportRoles=true --limit=100 report (paginate with --cursor=<last-integration-id>). Review unresolved historical rows separately; timestamps are not proof of historical ownership. Never recalculate roles during normal reconnect or disconnect.

  • GITHUB_CONNECTION_MANAGEMENT_ENABLED - Set to exact true to admit new existing-installation connection management and local disconnect. Unset or any other value keeps new management admission disabled without changing incumbent GitHub integration workflows. [SERVER]
    • Keep disabled for at least one OAuth state TTL (10 minutes) after deploying reservation-aware callbacks so purpose-less states issued by the previous version can complete.
    • During the migration-to-app promotion window, old pending-install callbacks may fail against the replaced pending indexes. Keep the window brief, monitor deploy health, and retry the GitHub connection after promotion completes.
  • GITHUB_ADMIN_STATS_TOKEN - Token for admin GitHub API stats lookups; used in apps/web/src/scripts/backfill-pr-author-github-ids.ts. [SECRET]
  • GH_TOKEN - Short alias used by GitHub CLI processes. [SECRET]
  • GITHUB_USER_TOKEN_SOURCE_METADATA_ENABLED - Enables App source/refresh metadata in git-token-service responses after tolerant web readers deploy. Defaults to disabled; provided-token responses always carry this metadata. [SERVER]
  • GIT_TOKEN - Dynamic git credential token (often a GitHub App installation token) scoped for git clone/push; consumed by the Cloud Agent Next wrapper in services/cloud-agent-next/wrapper/src/control-plane/prepare.ts. [SECRET]
  • GOOGLE_WORKSPACE_OAUTH_CLIENT_ID - Google Workspace OAuth client ID; used in tests and integration code. [PUBLIC]
  • GOOGLE_WORKSPACE_OAUTH_CLIENT_SECRET - Google Workspace OAuth client secret. [SECRET]
  • GOOGLE_WORKSPACE_OAUTH_REDIRECT_URI - Redirect URI for Google Workspace OAuth flow. [SERVER]
  • GOOGLE_CLIENT_ID - Primary Google OAuth client ID. [PUBLIC]
  • GOOGLE_CLIENT_SECRET - Primary Google OAuth client secret. [SECRET]
  • GOOGLE_SERVICE_ACCOUNT_EMAIL - Google service account email. [SECRET]
  • GOOGLE_WEB_RISK_API_KEY - API key for Google Web Risk API. [SECRET]
  • GOOGLE_SHEETS_SPREADSHEET_ID - ID of the Google Sheet used for specific app integrations. [SERVER]
  • GITLAB_CLIENT_ID - GitLab OAuth app client ID. [PUBLIC]
  • GITLAB_CLIENT_SECRET - GitLab OAuth app client secret. [SECRET]
  • BITBUCKET_OAUTH_CREDENTIAL_ACTIVE_KEY_ID - Active platform-credential envelope key ID. The legacy name is shared by Bitbucket and encrypted GitLab credentials. [SERVER]
  • BITBUCKET_OAUTH_CREDENTIAL_ACTIVE_PUBLIC_KEY - Base64-encoded active platform-credential RSA public key; available to web and git-token-service. The legacy name is shared by Bitbucket and GitLab. [SECRET]
  • BITBUCKET_OAUTH_CREDENTIAL_ACTIVE_PRIVATE_KEY - Base64-encoded active platform-credential RSA private key; available only to git-token-service. The legacy name is shared by Bitbucket and GitLab. [SECRET]
  • LINKEDIN_CLIENT_ID - LinkedIn OAuth app client ID. [PUBLIC]
  • LINKEDIN_CLIENT_SECRET - LinkedIn OAuth app client secret. [SECRET]
  • DISCORD_CLIENT_ID - Discord OAuth app client ID. [PUBLIC]
  • DISCORD_CLIENT_SECRET - Discord OAuth app client secret. [SECRET]
  • DISCORD_BOT_TOKEN - Discord bot token. [SECRET]
  • DISCORD_PUBLIC_KEY - Discord app public key (for interactions). [PUBLIC]
  • DISCORD_OAUTH_CLIENT_ID - Discord OAuth client ID for the bot/app. [PUBLIC]
  • DISCORD_OAUTH_CLIENT_SECRET - Discord OAuth client secret for the bot/app. [SECRET]
  • DISCORD_OAUTH_BOT_TOKEN - Discord bot OAuth token (separate from standard bot token). [SECRET]
  • DISCORD_SERVER_ID - ID of the primary Discord guild/server. [SERVER]
  • DOLTHUB_APP_CLIENT_ID - DoltHub OAuth app client ID. [PUBLIC]
  • DOLTHUB_APP_CLIENT_SECRET - DoltHub OAuth app client secret. [SECRET]
  • DOLTHUB_APP_DEV_CLIENT_ID - Dev-only DoltHub OAuth client ID; used in apps/web/.env.test. [PUBLIC]
  • DOLTHUB_APP_DEV_CLIENT_SECRET - Dev-only DoltHub OAuth client secret; used in apps/web/.env.test. [SECRET]

Billing & Stripe

  • STRIPE_SECRET_KEY - Stripe secret API key (sk_*). [SECRET]
  • NEXT_PUBLIC_STRIPE_PUBLISHABLE_KEY - Stripe publishable key for client-side 3DS and payment Element initialization. [PUBLIC]
  • STRIPE_TEAMS_SUBSCRIPTION_PRODUCT_ID - Stripe product ID for Teams subscription. [SERVER]
  • STRIPE_ENTERPRISE_SUBSCRIPTION_PRODUCT_ID - Stripe product ID for Enterprise subscription. [SERVER]
  • STRIPE_TEAMS_MONTHLY_PRICE_ID - Stripe price ID for Teams monthly plan (test). [SERVER]
  • STRIPE_TEAMS_ANNUAL_PRICE_ID - Stripe price ID for Teams annual plan (test). [SERVER]
  • STRIPE_ENTERPRISE_MONTHLY_PRICE_ID - Stripe price ID for Enterprise monthly plan (test). [SERVER]
  • STRIPE_ENTERPRISE_ANNUAL_PRICE_ID - Stripe price ID for Enterprise annual plan (test). [SERVER]
  • STRIPE_TOP_UP_PRICE_ID - Stripe price ID for credit top-up purchases. [SERVER]
  • STRIPE_KILO_PASS_TIER_19_MONTHLY_PRICE_ID - Stripe price ID for Kilo Pass $19/mo tier. [SERVER]
  • STRIPE_KILO_PASS_TIER_19_YEARLY_PRICE_ID - Stripe price ID for Kilo Pass $19/yr tier. [SERVER]
  • STRIPE_KILO_PASS_TIER_49_MONTHLY_PRICE_ID - Stripe price ID for Kilo Pass $49/mo tier. [SERVER]
  • STRIPE_KILO_PASS_TIER_49_YEARLY_PRICE_ID - Stripe price ID for Kilo Pass $49/yr tier. [SERVER]
  • STRIPE_KILO_PASS_TIER_199_MONTHLY_PRICE_ID - Stripe price ID for Kilo Pass $199/mo tier. [SERVER]
  • STRIPE_KILO_PASS_TIER_199_YEARLY_PRICE_ID - Stripe price ID for Kilo Pass $199/yr tier. [SERVER]
  • STRIPE_KILOCLAW_2026_03_19_STANDARD_INTRO_PRICE_ID - Legacy KiloClaw Standard intro price ID (pre-rollout). [SERVER]
  • STRIPE_KILOCLAW_2026_03_19_STANDARD_PRICE_ID - Legacy KiloClaw Standard recurring price ID (pre-rollout). [SERVER]
  • STRIPE_KILOCLAW_2026_03_19_COMMIT_PRICE_ID - Legacy KiloClaw Commit price ID (pre-rollout). [SERVER]
  • STRIPE_KILOCLAW_2026_05_10_STANDARD_PRICE_ID - Current KiloClaw Standard recurring price ID. [SERVER]
  • STRIPE_KILOCLAW_2026_05_10_COMMIT_PRICE_ID - Current KiloClaw Commit price ID. [SERVER]
  • STRIPE_KILOCLAW_EARLYBIRD_PRICE_ID - KiloClaw early-bird price ID (test-only). [SERVER]
  • STRIPE_KILOCLAW_EARLYBIRD_COUPON_ID - Coupon ID for KiloClaw early-bird pricing. [SERVER]
  • CHURNKEY_API_SECRET - Secret for Churnkey (cancellation flows). [SECRET]
  • NEXT_PUBLIC_CHURNKEY_APP_ID - Public app ID for Churnkey widget. [PUBLIC]

Apple / Google Play Credit-Pack Purchases

  • APPLE_APP_APPLE_ID - Apple App ID for credit-pack receipt and server-notification verification. [SECRET]
  • APPLE_IAP_ENVIRONMENT - Apple credit-pack IAP environment (Sandbox or Production). [SERVER]
  • APPLE_IAP_KEY_ID - Apple server API key identifier, retained for credit-pack consumption requests. [SECRET]
  • APPLE_IAP_ISSUER_ID - Apple server API issuer (team) ID, retained for credit-pack consumption requests. [SECRET]
  • APPLE_IAP_PRIVATE_KEY - Apple server API private key (PEM/ES256), retained for credit-pack consumption requests. [SECRET]
  • APPLE_ROOT_CERTIFICATES_PEM - Apple root CA certs (PEM) for validating credit-pack receipts and server notifications. [SERVER]
  • GOOGLE_PLAY_PUBLISHER_SERVICE_ACCOUNT_JSON - Android Publisher service account JSON for credit-pack purchase verification, consumption, and refund order lookup. Kilo Pass subscription API access is no longer used. [SECRET]
  • GOOGLE_PLAY_RTDN_PUSH_AUDIENCE - Expected OIDC audience for Play Real-time Developer Notification Pub/Sub push (the HTTPS URL of POST /api/kilo-pass/play/notifications). [SERVER]
  • GOOGLE_PLAY_RTDN_PUSH_SERVICE_ACCOUNT_EMAIL - Expected service-account email for the Play RTDN Pub/Sub push OIDC token; the token email claim must match it. [SERVER]
  • APPLE_APP_BUNDLE_ID - iOS app bundle ID for Apple App Attest and Sign In verification. [SERVER]
  • APPLE_JWKS_URL_OVERRIDE - Apple JWKS endpoint override for local verification runs; applies only outside production deployments. [SERVER]
  • NATIVE_APPLE_NONCE_REQUIRED_SINCE - ISO 8601 instant; the native Apple sign-in nonce requirement applies from this instant onward. Before it, requests are accepted without the field while the native-apple-signin-nonce-relaxed-path release toggle is enabled. Unset, invalid, or past ⇒ the requirement applies unconditionally. [SERVER]
  • NATIVE_APPLE_NONCE_TRANSITION_LOCAL - When true in a development environment outside Vercel, the transition window opens without the release toggle, for local verification runs without PostHog credentials. [SERVER]
  • NATIVE_ADMISSION_DEV_SENTINEL - When true, non-production accepts the fixed device-attestation sentinel from devices that cannot attest (simulator, emulator without Play Services). Ignored when NODE_ENV=production. The mobile build reads the same name. [SERVER]
  • GOOGLE_PLAY_INTEGRITY_PROJECT_NUMBER - Google Cloud project number for Play Integrity API. Also read by the mobile build, where it ships in the bundle; it is an identifier, not a secret. [SERVER]
  • GOOGLE_PLAY_INTEGRITY_SERVICE_ACCOUNT_KEY - Service account JSON key for Play Integrity API. [SECRET]
  • GOOGLE_PLAY_INTEGRITY_PACKAGE_NAME - Android package name (com.kilocode.kiloapp), verified against the Play Integrity verdict. [SERVER]
  • GOOGLE_PLAY_INTEGRITY_CERT_DIGESTS - Comma-separated SHA-256 digests of accepted Play signing certificates. Use the base64url encoding from certificateSha256Digest, not the hex fingerprint. [SERVER]

Ablation / Experimentation

  • ANALYZE - Next.js bundle analyzer switch; enables @next/bundle-analyzer in next.config.mjs. [SERVER]

Database

  • POSTGRES_URL - Primary Postgres connection string. [SECRET]
  • POSTGRES_REPLICA_US_URL - US read replica used by readDb in US Vercel regions (sfo1); see packages/web-shared/src/lib/drizzle.ts. When unset, readDb falls back to the primary, so it must be set on every project that runs in sfo1, including kilocode-ai-gateway. [SECRET]
  • POSTGRES_REPLICA_EU_URL, POSTGRES_REPLICA_EU_URL_2 - EU read replicas; in EU regions readDb picks one per request by hashing the client IP (per instance at random when there is no IP) and falls back to the primary when neither is set. [SECRET]
  • POSTGRES_REPLICAS_DISABLED - Comma-separated read replica names to switch off without deleting their URLs: us-west, eu-central-1, eu-central-2 (the names in replication health alerts). readDb skips them and falls back as if their URL were unset. The replication health check logs the disabled names and skips their probes. Disabling every replica is a health check error in production. An unknown name triggers a startup warning and a health check error. Set it on every project that reads replicas (kilocode-app and kilocode-ai-gateway) and redeploy; see packages/web-shared/src/lib/read-replicas.ts. [SERVER]
  • POSTGRES_SCRIPT_URL - Alternate Postgres URL used by one-off scripts/backfills in src/scripts/ and tests. [SECRET]
  • POSTGRES_URL_PRODUCTION - Production Postgres connection string override; used by packages/db/src/database-url.ts. [SECRET]
  • POSTGRES_CONNECT_TIMEOUT - Postgres connect timeout in ms (required; typical: 10000). [SERVER]
  • USE_PRODUCTION_DB - Forces use of the production DB URL in non-production contexts; used by packages/db/src/database-url.ts. [SERVER]
  • DATABASE_CA - CA certificate content (PEM) for TLS connections to Postgres; used by packages/db/src/database-url.ts in tests and scripts. When unset, the connection string's sslmode parameter decides: require/prefer/no-verify encrypt, verify-ca/verify-full also verify the server certificate against the system trust store, disable or no sslmode keeps TLS off for local development. [SERVER]
  • DATABASE_URL - Generic/alternate Postgres URL used by E2E tests and some services (cloud-agent-next, kiloclaw). [SECRET]
  • DATA_EXPORT_POSTGRES_URL - Connection string for the separate, read-only data export database, loaded out of band and read by apps/web/src/lib/data-export/db.ts. Optional: when unset, data export reads are disabled and the application still starts. [SECRET]
  • DATA_EXPORT_DATABASE_CA - Optional CA certificate content (PEM) for the data export database, for when it does not share the primary's CA. Falls back to DATABASE_CA; remote connections require TLS either way. [SERVER]

Redis & Queue

  • REDIS_URL - Redis connection URL; used by packages/web-shared/src/lib/redis.ts and bot state. [SECRET]
  • UPSTASH_REDIS_REST_URL - Shared Redis REST endpoint, including Discord message admission. Locally provided by redis-http. [SERVER]
  • UPSTASH_REDIS_REST_TOKEN - Redis REST credential used by the shared client. [SECRET]

Discord message admission requires the shared Redis REST service. Accepted message claims are scoped to the bot and message, expire after 15 minutes, and remain accepted through background processing completion or failure. The gateway uses eight forwarding slots, a 10-second request deadline, and primary-database ownership checks with bounded retries. Listener availability is retained while ownership reads recover. Capacity drops are counted in listener logs. Forwarding slots cover the HTTP request lifecycle; background bot execution has a separate lifecycle. HTTP recovery uses at most three attempts for temporary admission responses within the same slot and deadline.

Encryption & Secrets

  • BYOK_ENCRYPTION_KEY - Base64 encryption key for Bring-Your-Own-Key encryption of sensitive app data. [SECRET]
  • BYOK_KMS_SERVICE_URL - Base URL of the BYOK KMS envelope service. Required to create, update, or decrypt a BYOK key. [SERVER]
  • BYOK_KMS_SERVICE_TOKEN - Bearer token for the BYOK KMS service; required when BYOK_KMS_SERVICE_URL is set. [SECRET]
  • USER_DELETION_AUDIT_HMAC_KEY - Base64 32-byte HMAC key for user-deletion email hashes and audit subjects. [SECRET]
  • USER_DELETION_ENCRYPTION_KEY - Base64 32-byte AES key for user-deletion effect checkpoints and provider credentials. [SECRET]
  • BYTEPLUS_CODING_PLAN_ACCESS_KEY_ID - Server-only BytePlus access key ID for Coding Plan seat resolution and quota usage APIs. Optional at startup; install with pnpm web:env set BYTEPLUS_CODING_PLAN_ACCESS_KEY_ID. [SECRET]
  • BYTEPLUS_CODING_PLAN_SECRET_ACCESS_KEY - Server-only BytePlus secret access key for Coding Plan seat resolution and quota usage APIs. Optional at startup; install with pnpm web:env set BYTEPLUS_CODING_PLAN_SECRET_ACCESS_KEY. [SECRET]
  • CREDIT_CATEGORIES_ENCRYPTION_KEY - Legacy encryption key for credit category labels/values, retained during key rotation for deployments running older source. [SECRET]
  • CREDIT_CATEGORIES_ENCRYPTION_KEY_V2 - Active encryption key for credit category labels/values. Falls back to CREDIT_CATEGORIES_ENCRYPTION_KEY when unset. [SECRET]
  • AGENT_ENV_VARS_PUBLIC_KEY - RSA public key (base64) used to encrypt agent environment variables. [SERVER]
  • AGENT_ENV_VARS_PRIVATE_KEY - Legacy alias for the above — the actual private key used to decrypt agent env vars (kept server-side). [SECRET]

Internal Services

  • WEBHOOK_AGENT_URL - URL for the webhook agent worker. [SERVER]
  • MODEL_EVAL_INGEST_URL - URL for model evaluation ingest worker. [SERVER]
  • SESSION_INGEST_WORKER_URL - URL for the session ingest worker. [SERVER]
  • NOTIFICATIONS_WORKER_URL - URL for the push-notifications worker internal dispatch endpoint. [SERVER]
  • AUTO_ROUTING_DECISION_SECRET - HMAC secret the AI gateway uses to verify x-kilo-auto-decision custom router decisions signed by the auto-routing worker (ADR 0005). Must match the worker's AUTO_ROUTING_DECISION_SECRET Secrets Store binding. When unset, the gateway answers requests that carry the header with HTTP 503. [SECRET]
  • USER_DATA_EXPORT_WORKER_URL - Internal user data export Worker URL. Production: https://user-data-export.kilosessions.ai; local development is generated by dev:env. [SERVER]
  • NEXT_PUBLIC_SESSION_INGEST_WS_URL - WebSocket URL for session ingest from the browser. [PUBLIC]
  • NEXT_PUBLIC_SESSION_SYNC_URL - Optional development-only native remote preview relay URL, defaulting to http://localhost:8817 for the isolated local session-sync Worker. /native-remote, its credential endpoint, and its CSP connection permissions require NODE_ENV=development; production feature flags cannot enable the preview. This does not change the native CLI or session-sync service endpoints. [PUBLIC]
  • CODE_REVIEW_WORKER_URL - URL for the code review worker. [SERVER]
  • CODE_REVIEW_WORKER_AUTH_TOKEN - Auth token for the code review worker. [SECRET]
  • KILOCLAW_API_URL - Base URL for KiloClaw API; used heavily by apps/web/src/routers/kiloclaw-router.ts and tests. [SERVER]
  • CLOUD_AGENT_NEXT_API_URL - URL for the Cloud Agent Next API. [SERVER]
  • NEXT_PUBLIC_CLOUD_AGENT_NEXT_WS_URL - WebSocket URL for Cloud Agent Next from the browser. [PUBLIC]
  • CLOUD_AGENT_R2_ATTACHMENTS_BUCKET_NAME - R2 bucket for cloud agent file attachments. [SERVER]
  • O11Y_SERVICE_URL - URL for the observability (O11Y) service. [SERVER]
  • O11Y_KILO_GATEWAY_CLIENT_SECRET - Client secret for the O11Y Kilo Gateway. [SECRET]
  • BOUNCER_URL - Bouncer Worker URL. Defaults to https://bouncer.kiloapps.io in production. Every inference endpoint awaits one decide immediately before its provider request. [SERVER]
    • Decide has a 1,000 ms budget. Only a verdict with enforced: true rejects: rate_limited and spend_limited return 429 rate_limit_exceeded with retry-after and retry-after-ms, restricted returns 403 account_restricted. A timeout, error, non-2xx, unknown shape, or any other verdict sends the request. Verdict flags are logged server-side and never returned to the client.
    • Signup calls /api/v1/signup-decide only for new users, after account resolution and before Stripe customer creation. Existing sign-in and provider linking never consume signup quotas. The call uses INTERNAL_API_SECRET and a 3,000 ms budget.
    • Development skips admission. In other environments, signup requires a usable IP and a validated Bouncer verdict. Missing configuration, timeouts, transport errors, HTTP errors, invalid JSON, and unknown response shapes fail closed with SIGNUP-UNAVAILABLE.
    • An unavailable verdict creates no Stripe customer, user, or auth provider. Web signup shows a retry message. Native token exchange returns HTTP 503 and releases the email-code reservation so the same code can be retried.
    • A validated enforced signup_rate_limited response returns SIGNUP-RATE-LIMITED. Cloud accepts at most eight merged IP, domain, and JA4 flags, including signup:busy, signup:domain, and signup:ja4, and never exposes internal flags to the user.
    • A validated enforced signup_step_up response returns SIGNUP-STEP-UP with its methods (1 to 8 values of ^[a-z0-9-]{1,32}$). It creates no Stripe customer, user, or auth provider. Cloud shows only google and apple, in that order, and ignores other values. Web signup redirects to sign-in with error=SIGNUP-STEP-UP&methods=<comma-separated> and asks the user to continue with those methods; the copy never names a signal. Native token exchange returns HTTP 403 { error: "SIGNUP-STEP-UP", methods }; the mobile app names the allowed Apple or Google button when that button is on its screen, and otherwise points to its browser sign-in options.
    • Signup sends { operationId, ip, ja4?, method?, emailDomain? }. JA4 comes only from the original request's x-vercel-ja4-digest header, not the Cloud-to-Bouncer TLS fingerprint. It is trimmed, lowercased, and bounded to ^[a-z0-9_]{1,128}$; missing or invalid values are omitted whole, never truncated, and IP admission still runs. signupOperationId hashes the existing normalized email with SHA-256 and prefixes the digest with signup:.
    • method is the signup's auth provider ID. emailDomain is the registrable domain (tldts getDomain, private suffixes included) of the normalized email's host, or the full host when it has none, so subdomains of one domain share a counter. It is sent for every method; Bouncer counts it only for email signups. Each field is omitted whole when invalid. Without method, Bouncer applies its method-less policy, as for an old Cloud build.
    • With enforcement.signupStepUp on, Bouncer steps up a risky signup instead of rejecting it: it asks for Google or Apple, and admits Apple and WorkOS on a shared IP. Deploy Bouncer with enforcement.signupStepUp=false before this Cloud change, measure the shadow stepUp audit field, and only then let Igor turn it on.
    • The identity helper lives in packages/web-shared/src/lib/bouncer/signup.ts. Live admission and historical import must use the same helper.
    • Cloud validates the forwarded first-hop IP. Bouncer canonicalizes addresses and groups IPv6 by /64.
    • Bouncer defaults to 3 admissions per canonical IP per rolling 30 days. The shorter 24-hour limit is also 3.
    • JA4 defaults to 10 admissions per fingerprint per rolling 720 hours (30 days), independently of the IP limits. A shared TLS/HTTP fingerprint can cover unrelated people behind proxies or common clients: JA4 throttling risks false positives and must be evaluated separately from IP enforcement.
    • The Bouncer Exemptions tab accepts user IDs and IPs. Exempt requests bypass all Bouncer rules, not Cloud authentication or billing.
    • The Bouncer Bans tab bans an IP or an exact JA4 digest from signup. A ban returns an enforced signup_rate_limited verdict with one signup:banned flag and until: null. Cloud maps it to SIGNUP-RATE-LIMITED.
    • Signed-in decisions carry the actual actor's userId separately from the payer's accountId, including organization-paid requests.
    • IP exemptions cover signup and inference; IPv6 covers the whole /64. An exempt signup IP bypasses both IP and JA4 counters. Signup has no user ID before account creation; no JA4 exemption or user fingerprint field is added.
    • Admission and creation logs share the operation ID. They exclude raw email and distinguish completed creation, rejection, and Stripe or transaction failure.
    • Bouncer owns signup admission. Cloud keeps signup_ip as evidence and retains all authentication and identity guards.
    • Deploy Bouncer first with enforcement.signup=false and enforcement.signupJa4=false; all signup enforcement ships off. The existing enforcement.signup switch governs IP rejection, and enforcement.signupJa4 independently governs JA4 rejection. The global enforcement.enabled switch gates both; no production switch is changed by deployment.
    • Bouncer evaluates IP first and skips JA4 if IP rejects. It counts admissions, including failed creations: an IP admission remains counted if JA4 later rejects, just as it remains counted after a later Cloud transaction or Stripe failure. There are no refunds. Stable operation IDs deduplicate each bucket independently. Limits and window lengths are configurable in the Bouncer admin panel.
    • Historical import counts completed accounts for IP only; never reconstruct historical signup JA4 from usage or payment fingerprints. JA4 coverage starts with live signup reports.
    • If the IP is valid, missing or invalid JA4 does not skip IP admission. JA4 enforcement requires a valid fingerprint.
    • Deploy the first integration PR fully before this ownership cutover. Its existing Cloud limiter protects the historical import.
    • From this checked-out cutover branch, run pnpm --filter web script:run db import-signup-history with the production script environment.
    • The importer reads completed accounts from the last 30 days through a fixed time bound in 100-row pages. It changes no Cloud users.
    • Each page requires a full Bouncer acknowledgement. Duplicate admissions are safe. Missing or empty IPs match the old limiter's exclusions.
    • Invalid nonempty IPs, partial acknowledgement, HTTP errors, and saturation stop the import with a nonzero exit.
    • Run the importer again after all first-PR instances deploy. For an incremental catch-up, append the previous run's through timestamp.
    • After full acknowledgement and catch-up, only Igor enables IP signup enforcement and the global switch. Check shadow flags before independently enabling JA4 enforcement.
    • Verify allowed and rejected signups with live configuration before merging and deploying the ownership cutover PR.
    • After the cutover, Bouncer failure deliberately fails open. Revert the cutover PR to restore the old Cloud limiter.
    • Signed-in decide requests carry the payer's created_at, microdollars_used, and total_microdollars_acquired (the organization's for an org request); charge.attempted carries the payer's microdollars_used.
    • Usage reports have a 30-second transport budget and carry the request's charged costMicrodollars. Every inference endpoint reports its API kind, with the same request id as its decide.
    • When the decide verdict says spendWatch, the usage event enters the durable bouncer_usage_event_outbox in the usage-write transaction, is delivered immediately after commit, and is retried by the cron drainer (eight attempts; delivered rows kept 1 day, failed rows 7 days).
    • For a spend-watched signed-in request, the gateway calls /api/v1/release with the request id and account once the response has closed, on every path, so Bouncer frees the request's concurrency lease. Release is best-effort and idempotent.
    • Anonymous usage uses the client IP, without a payer. Signed-in usage excludes shared infrastructure addresses for server-side Kilo features.
    • Usage, decide, and request-initiated charge.attempted events carry the Vercel x-vercel-ja4-digest client fingerprint when the request has a valid one, lowercased and bounded to ^[a-z0-9_]{1,128}$; a missing or invalid header is omitted whole, never truncated. It describes the client TLS/HTTP characteristics of the peer that reached Kilo's edge (often shared proxy infrastructure), not a person or device, and is correlation evidence only — see https://vercel.com/docs/vercel-firewall/firewall-concepts.
    • Financial events enter the durable bouncer_credit_event_outbox before acknowledgment. The dispatcher sends /api/v2/credit-event with a 5-second transport budget.
    • Delivery retries use the same event ID and type. Eight failed attempts produce a visible terminal failure; terminal rows remain for 30 days.
    • Apple originalTransactionId identifies a subscription chain, not an Apple ID. Refund requests and declined requests use distinct event types.
    • Checkout calls /api/v1/charge-decide with stage: "checkout" before Stripe creates or reuses a Checkout session or updates a subscription: personal Kilo Pass and the KiloClaw upsell, KiloClaw subscription checkout, top-up, organization Kilo Pass, seat checkout, a seat-count increase, and personal or organization auto-top-up setup and payment-method change. Off-session background auto top-up is not gated. The call has a 1,500 ms budget.
    • Only an enforced charge verdict refuses the checkout: tRPC procedures return FORBIDDEN with "We could not start this payment. Contact support.", and the top-up route returns HTTP 403 with the same copy in { error }. Flags are logged server-side and never returned to a client. A timeout, error, non-2xx (including an older Bouncer's 404), or unknown shape fails open and the checkout proceeds.
    • After a declined charge commits to bouncer_credit_event_outbox, the webhook delivers that row immediately, then calls charge-decide with stage: "failure" and the charge id as requestId. An enforced verdict expires every open Checkout session of the declined charge's Stripe customer, in payment or subscription mode; a charge without a customer falls back to the open session behind its payment intent. A failed immediate delivery leaves the sessions alone and the cron drainer retries it. These steps are bounded and never fail the webhook; a redelivered second Stripe event for the same charge finds the row already delivered and changes nothing.
    • Bouncer enforces no charge block until enforcement.enabled is on and a reason is listed in enforcement.chargeBlockReasons, which ships empty; user and IP exemptions still apply.
    • Deploy Bouncer v2 before this cloud change. Bouncer retains v1 for the current cloud deployment; the new outbox sends only v2.
  • CRON_SECRET - Shared secret for authenticated cron endpoints; used in dev/discord-gateway-cron.ts and .env.test. If the root .env.local value is blank, pnpm dev:env fills it with a generated value and copies it to apps/web/.env.development.local. [SECRET]
  • dispatch-invite-email-outbox - Vercel cron path (/api/cron/dispatch-invite-email-outbox) that drains the organization invite-email outbox; reuses CRON_SECRET for auth. [SERVER]
  • dispatch-bouncer-credit-event-outbox - Vercel cron path (/api/cron/dispatch-bouncer-credit-event-outbox) that drains the Bouncer credit-event outbox every minute; reuses CRON_SECRET for auth. [SERVER]
  • dispatch-bouncer-usage-event-outbox - Vercel cron path (/api/cron/dispatch-bouncer-usage-event-outbox) that retries the Bouncer usage-event outbox every minute; reuses CRON_SECRET for auth. [SERVER]
  • expire-credits - Vercel cron path (/api/cron/expire-credits) that expires due personal and organization credit grants every 5 minutes; reuses CRON_SECRET for auth. It never triggers auto-top-up. [SERVER]
  • PAID_CREDIT_EXPIRATION_EFFECTIVE_AT - ISO-8601 instant when new paid credits start receiving a one-calendar-year expiry. Unset or invalid keeps every new purchase non-expiring. Terms are captured at checkout or term start, so pending purchases and annual terms paid earlier keep legacy terms. Apple in-app purchases never expire. Create the _1year_v2 Google Play credit products before setting it. [SERVER]
  • WORKOS_API_KEY - WorkOS API key for enterprise SSO, and for the scim-sync Worker's Events API polling, where it comes from the Cloudflare Secrets Store rather than a dotenv file. The Events API is scoped to whichever WorkOS environment issued the key, so the Worker binds one pair per environment: WORKOS_API_KEY/WORKOS_CLIENT_ID in production and WORKOS_API_KEY_STAGING/WORKOS_CLIENT_ID_STAGING under --env staging. That choice, not the Worker's ENVIRONMENT var, decides which directory stream a deployment consumes. [SECRET]
  • WORKOS_CLIENT_ID - WorkOS client ID for enterprise SSO. [PUBLIC]

The WorkOS Directory Sync (SCIM) write path is apps/web/src/app/api/internal/scim/, authenticated with INTERNAL_API_SECRET in the x-internal-api-key header and documented in services/scim-sync/README.md. The endpoints need no variable of their own: they are idempotent upserts keyed on WorkOS identifiers, and preferredRegion = 'fra1' puts them beside the PostgreSQL primary they write. DELETE /api/internal/scim/users/{externalId}/memberships is the one that is not an upsert — it revokes the directory memberships the bound account holds under the directory named in its required { directoryId } body, for a dsync.user.deleted or an update reporting the user inactive, and converges rather than conflicting on an unknown directory user. The body is what scopes it: an account may also hold a membership another tenant's administrator or invitation created, and that is not the emitting directory's to revoke. The calling side does need variables: the scim-sync Worker holds no database binding and reaches these endpoints over BACKEND_API_URL, https://app.kilo.ai in production and https://staging-app.kilo.ai under --env staging. It reads the shared secret as INTERNAL_API_SECRET from the Cloudflare Secrets Store, bound to the store entry INTERNAL_API_SECRET_PROD in production and INTERNAL_API_SECRET_STAGING under --env staging, so the value lives in the store rather than in the Worker's configuration.

AI Providers

  • OPENROUTER_API_KEY - Primary OpenRouter API key for model inference through the AI gateway; provider definition in packages/web-shared/src/lib/ai-gateway/providers/definitions/openrouter.ts pointing to https://openrouter.ai/api/v1. [SECRET]
  • OPENAI_API_KEY - OpenAI API key supplied as a managed BYOK credential when managed inference requests route through the Vercel AI Gateway and permit the OpenAI provider. [SECRET]
  • OPENAI_CHATGPT_API_KEY - Partner project key for the delegated "Sign in with ChatGPT" route (packages/web-shared/src/lib/ai-gateway/openai-chatgpt/routing.ts); sent as Authorization: Bearer alongside the user's OpenAI-On-Behalf-Of-Token. OpenAI requires this key to come from the project that owns the OAuth client (oaiapp_Abz1xcqSQAvvIwtxyemZbXBJ); a key from another project makes every delegated call fail with an opaque 400 Bad Request. The web app's metadata cache refresh cron also uses it to store the project's served-model list, so set it on the web project too. [SECRET]
  • MISTRAL_API_KEY - Mistral API key; used in apps/web/src/lib/embeddings/embedding-providers.ts for codestral-embed-2505 embeddings, in the FIM completions proxy at packages/web-shared/src/lib/ai-gateway/handlers/fim-completions.ts (routes Mistral Codestral vs. La Plateforme keys), and as a provider config in packages/web-shared/src/lib/config.server.ts. [SECRET]
  • INCEPTION_API_KEY - Inception Labs API key; used in packages/web-shared/src/lib/ai-gateway/handlers/fim-completions.ts and packages/web-shared/src/lib/ai-gateway/handlers/edit-completions.ts as a fill-in-the-middle (FIM) provider, with endpoint https://api.inceptionlabs.ai/v1/fim/completions. Defined in packages/web-shared/src/lib/config.server.ts. [SECRET]
  • AI_ATTRIBUTION_ADMIN_SECRET - Admin secret for the AI Attribution service (apps/web/src/lib/ai-attribution-service.ts); sent as X-Admin-Secret header. [SECRET]
  • ARTIFICIAL_ANALYSIS_API_KEY - API key for Artificial Analysis (apps/web/src/lib/model-stats/sync-artificial-analysis.ts); sent as x-api-key header for model benchmarking data sync. [SECRET]
  • ENKRYPT_API_KEY - Kilo-owned Enkrypt API key; sent only in the server-side apikey header. Used by Enkrypt score ingestion and by the opt-in organization input guardrail (enkrypt.input_guardrail in organization settings), which calls POST /guardrails/detect from the AI gateway chat endpoints. Required when Enkrypt ingestion is enabled or any organization enables the guardrail, but optional at application startup; when unset, guardrail-enabled organizations have every scanned request rejected as if Enkrypt were unavailable. Set it on kilocode-ai-gateway as well as the web app before enabling the guardrail. See Enkrypt operations for release gates, monitoring, and independent shutdown controls. [SECRET]
  • FAKE_LLM_URL - Local-only URL for the fake-llm service. Next.js uses it in development to list and route fake-deterministic through the real gateway (apps/web/.env.development.local.example, packages/web-shared/src/lib/ai-gateway/local-fake-llm.ts). The cloud-agent-next E2E driver uses the same var for /test/* side channels (test/e2e/client.ts, test/e2e/fake-llm-server.ts, test/e2e/README.md). Defaults to http://localhost:8811. Ignored on Vercel. [SERVER]

Vector DBs

  • QDRANT_HOST - Qdrant vector DB host. [SERVER]
  • QDRANT_API_KEY - Qdrant API key. [SECRET]
  • MILVUS_ADDRESS - Milvus vector DB address. [SERVER]
  • MILVUS_TOKEN - Milvus auth token. [SECRET]
  • CODE_INDEXING_ENABLED - Set to true to enable cloud managed code indexing. Disabled by default; unset, empty, or any other value keeps the feature off. [SERVER]

Email & Notifications

  • MAILGUN_API_KEY - Mailgun API key for transactional email. Used only when VERCEL_TARGET_ENV is production or staging. [SECRET]
  • MAILGUN_DOMAIN - Mailgun sending domain. Used only when VERCEL_TARGET_ENV is production or staging. [SERVER]
  • NEVERBOUNCE_API_KEY - NeverBounce API key for email verification. In staging, only the effective internal sink is verified. [SECRET]
  • STAGING_EMAIL_REDIRECT_TO - Required when VERCEL_TARGET_ENV=staging. Must contain exactly one valid address in the kilocode.ai domain; every staging message is redirected there with a staging subject prefix and safe Reply-To. [SERVER]
  • LOCAL_EMAIL_OPEN_BROWSER - Set to false to stop locally captured emails from opening in a browser tab. Defaults to opening each capture. Local development only. [SERVER]

When VERCEL_TARGET_ENV is absent in local development or a script process, transactional messages are captured as owner-only clickable HTML under dev/logs/emails/ instead of being sent. Automated tests (including IS_IN_AUTOMATED_TEST) and non-production Vercel targets suppress provider delivery and report successful no-op delivery. A production-mode process without VERCEL_TARGET_ENV fails delivery as a configuration error so retryable email markers are not consumed as successful sends.

Slack

  • SLACK_CLIENT_ID - Slack OAuth app client ID. [PUBLIC]
  • SLACK_CLIENT_SECRET - Slack OAuth app client secret. [SECRET]
  • SLACK_SIGNING_SECRET - Slack request signing secret for webhooks. [SECRET]
  • SLACK_ENCRYPTION_KEY - Encrypts the Slack bot token at rest (AES-256-GCM) in the Chat SDK state store. Generate with openssl rand -base64 32; must decode to exactly 32 bytes or apps/web fails at startup. [SECRET]
  • SLACK_CREDENTIAL_KEYSET_JSON - RSA keyset for encrypting Slack bot credentials at rest, as JSON or base64-encoded JSON: {"active":{"keyId":"...","publicKeyPem":"..."},"decrypt":[{"keyId":"...","privateKeyPem":"..."}]}. Web holds the private half because the Slack webhook decrypts in-process; the active key ID must also appear in decrypt with a private key. [SECRET]
  • SLACK_ADMIN_NOTIFICATIONS_WEBHOOK_URL - Slack incoming webhook used by server-side Admin UI code to send events, summaries, reminders, and actions. [SECRET]
  • SLACK_USER_FEEDBACK_WEBHOOK_URL - Slack incoming webhook for user feedback. [SERVER]

Feature Flags

  • ENKRYPT_SYNC_ENABLED - Enables daily Enkrypt ingestion and mapped-model catalog enrollment only when exactly true; defaults to disabled. Does not enable publication. Configure the API key and an external monitor for the read-only health endpoint before enabling. [SERVER]
  • ENKRYPT_PUBLICATION_ENABLED - Exposes stored Enkrypt scores through public model catalogs and model-statistics endpoints only when exactly true; defaults to disabled. Does not enable ingestion. Keep disabled until redistribution approval and the release gates in Enkrypt operations are satisfied. Disabling suppresses existing and cached scores after the updated deployment is serving traffic; previously delivered client responses cannot be recalled. [SERVER]
  • KILOCLAW_BILLING_ENFORCEMENT - Feature flag controlling KiloClaw billing enforcement. [SERVER]
  • BRIEFING_DEBUG - Enables verbose debug logging for the KiloClaw morning briefing plugin; checked in services/kiloclaw/plugins/kiloclaw-morning-briefing/src/index.ts. [SERVER]
  • KILOCLAW_GOOGLE_LEGACY_MIGRATION_FAILED - Set when the legacy Google migration flow fails in the KiloClaw controller. [SERVER]
  • KILOCLAW_GOOGLE_LEGACY_MIGRATION_REASON - Human-readable reason for legacy Google migration failure in the KiloClaw controller. [SERVER]
  • IMPACT_ADVOCATE_DEBUG_LOGGING - Enables verbose Impact Advocate debug logs. [SERVER]
  • IMPACT_REFERRAL_DEBUG - Enables verbose Impact referral debug logs. [SERVER]

Impact.com Affiliate/Advocate

  • IMPACT_ACCOUNT_SID - Impact.com account SID for API auth. [SECRET]
  • IMPACT_AUTH_TOKEN - Impact.com API auth token for affiliate/click events. [SECRET]
  • IMPACT_ADVOCATE_ACCOUNT_SID - Impact.com account SID for Advocate (referral) API. [SECRET]
  • IMPACT_ADVOCATE_AUTH_TOKEN - Impact.com Advocate API auth token. [SECRET]
  • IMPACT_ADVOCATE_KILO_PASS_PROGRAM_ID - Impact.com Advocate program ID for the Kilo Pass referral program. [SERVER]
  • IMPACT_ADVOCATE_KILO_PASS_WIDGET_ID - Impact.com Advocate widget ID for the Kilo Pass referral program. [SERVER]
  • IMPACT_ADVOCATE_TENANT_ALIAS - Impact.com Advocate tenant alias. [SERVER]
  • IMPACT_ADVOCATE_API_BASE_URL - Impact.com Advocate API base URL. Defaults to https://app.referralsaasquatch.com. [SERVER]
  • IMPACT_CAMPAIGN_ID - Impact.com campaign ID for event tracking. [SERVER]

Cloudflare Analytics

  • CLOUDFLARE_ACCOUNT_ID - Cloudflare account ID used as the GraphQL accountTag for Containers Analytics queries and admin dashboard deep links; used in packages/web-shared/src/lib/config.server.ts and apps/web/src/lib/cloudflare/container-usage-analytics.ts. [SERVER]
  • CLOUDFLARE_ANALYTICS_API_TOKEN - Cloudflare API token with Account Analytics: Read only, used by the web app to query containersUsageAdaptiveGroups for on-demand admin reconciliation; used in packages/web-shared/src/lib/config.server.ts and apps/web/src/lib/cloudflare/container-usage-analytics.ts. Optional at process start — missing values surface as actionable errors at point of use. [SECRET]

R2 / Object Storage

  • R2_ACCOUNT_ID - Cloudflare R2 account ID for CLI session storage. [SERVER]
  • R2_ACCESS_KEY_ID - R2 access key ID for CLI session storage. [SECRET]
  • R2_SECRET_ACCESS_KEY - R2 secret access key for CLI session storage. [SECRET]
  • R2_CLI_SESSIONS_BUCKET_NAME - R2 bucket name for CLI session blobs. [SERVER]
  • R2_API_REQUEST_LOG_BUCKET_NAME - R2 bucket for api_request_log_2 request and response bodies, stored as YYYY/MM/DD/<id>.json. [SERVER]
  • R2_API_REQUEST_LOG_ACCESS_KEY_ID - R2 access key ID used only for the API request log bucket; uses the R2_ACCOUNT_ID account. [SECRET]
  • R2_API_REQUEST_LOG_SECRET_ACCESS_KEY - R2 secret access key paired with R2_API_REQUEST_LOG_ACCESS_KEY_ID. [SECRET]
  • R2_AI_PROVIDER_METADATA_BUCKET_NAME - Optional R2 bucket for AI provider metadata; <microdollar_usage id>.json contains the version-1 gateway routing decision, optional vercel: { metadata }, and optional enkrypt (the organization's input guardrail settings and scan steps, without prompt text), and optional byok_failover_attempts (each upstream attempt's BYOK provider, status, error code, and duration when a failing BYOK key failed over to the next). [SERVER]
  • R2_AI_PROVIDER_METADATA_ACCESS_KEY_ID - Dedicated R2 access key ID for the AI provider metadata bucket; uses the R2_ACCOUNT_ID account. [SECRET]
  • R2_AI_PROVIDER_METADATA_SECRET_ACCESS_KEY - R2 secret access key paired with R2_AI_PROVIDER_METADATA_ACCESS_KEY_ID. [SECRET]

AI Gateway Secure Proxy (apps/ai-gateway-secure-proxy)

Set manually on the kilocode-ai-gateway-secure-proxy Vercel project; not managed by pnpm web:env.

  • KILO_AI_GATEWAY_SECURE_PROXY_SECRET - Shared secret the gateway sends as Authorization: Bearer <secret>; read in apps/ai-gateway-secure-proxy/src/lib/secure-proxy.ts. Admins store the same value as proxy_secret in secure_proxy custom LLM credentials. When unset, the proxy rejects every request. [SECRET]

Services

Notifications Worker

  • APNS_TEAM_ID - Apple Developer team ID for the token-based APNs key used to send Live Activity pushes. Set in services/notifications/wrangler.jsonc under vars. [SERVER]
  • APNS_KEY_ID - APNs key identifier (kid) for the Live Activity push key. Set beside APNS_TEAM_ID. [SERVER]
  • APNS_PRIVATE_KEY - PKCS#8 ES256 .p8 private key contents for APNs provider-token signing. Stored as one line: the PEM decoder strips every whitespace character, so the newlines are not needed. Store the key in the Secrets Store first, then add its secrets_store_secrets binding; a binding for a missing secret fails the deploy. [SECRET]
  • APNS_TOPIC - iOS app bundle id (com.kilocode.kiloapp); Live Activity pushes use <topic>.push-type.liveactivity. Already set in vars. [SERVER]
  • KILO_WEB_API_BASE_URL - Base origin of the web app, used to reach the internal glanceable-agents-snapshot route; https://app.kilo.ai in production. [SERVER]

Until all four values reach the worker it logs APNs Live Activity credentials missing and skips Live Activity pushes. Every other glanceable delivery, including the Expo aggregate push, keeps working.

The key is team-scoped for all topics and valid in both the sandbox and production APNs environments. A backup of the .p8 lives in the 1Password "Eng / Product" vault as "Apple AuthKey KRYMZL626P (.p8)"; Apple never serves it a second time.

KiloClaw Controller

  • KILOCODE_API_KEY - API key used by the KiloClaw controller for internal gateway identity. [SECRET]
  • FLY_MACHINE_ID - Fly.io machine ID; auto-injected by the Fly runtime, used in services/kiloclaw/controller/src/checkin.ts for machine identity. [SERVER]
  • KILOCLAW_MACHINE_CPU_KIND - CPU architecture label used in KiloClaw gateway health checks/tests. [SERVER]
  • KILOCLAW_RUNTIME_PROVIDER - Runtime provider identifier used in KiloClaw gateway tests (e.g. fly). [SERVER]
  • OPENCLAW_OAUTH_DIR - Directory path for OpenClaw OAuth credentials; managed by OpenClaw runtime. [SERVER]
  • OPENCLAW_STATE_DIR - Directory path for OpenClaw persistent state; managed by OpenClaw runtime. [SERVER]
  • GOG_KEYRING_PASSWORD - Password for the legacy Google keyring migration in KiloClaw controller. [SECRET]
  • KILOCLAW_PROVISION_LOCK_POOL_MAX - Max concurrency for KiloClaw provision locks; used in apps/web/src/lib/kiloclaw/provision-lock.ts. [SERVER]
  • OPENCLAW_GATEWAY_TOKEN - Token for authenticating with the OpenClaw gateway. Used by kiloclaw plugins (kilo-chat, morning-briefing) and OpenClaw internals. [SECRET]
  • KILOCLAW_KILO_CLI - Set by the KiloClaw controller route when the Kilo CLI is invoking a run; gates CLI-specific code paths in services/kiloclaw/controller/src/routes/kilo-cli-run.ts. [SERVER]
  • KILO_API_KEY - API key for the Kilo API; used by CLI run route and customizer plugin tests. [SECRET]

KiloClaw Plugins

  • KILOCLAW_CONTROLLER_URL - Base URL for the KiloClaw controller service; used across plugins (kilo-chat, morning-briefing) and tests. [SERVER]
  • KILOCLAW_SANDBOX_ID - Sandbox identifier for isolated KiloClaw execution environments; used by morning-briefing plugin. [SERVER]
  • KILOCLAW_USER_LOCATION - User location string used by the morning briefing plugin for timezone-aware scheduling. [SERVER]
  • KILOCLAW_USER_TIMEZONE - User timezone string used by the morning briefing plugin. [SERVER]
  • LINEAR_API_KEY - Linear API key for issue integration in the morning briefing plugin. [SECRET]
  • KILOCHAT_BASE_URL - Base URL for the KiloChat service. [SERVER]
  • KILO_API_URL - Kilo API base URL used by the customizer Exa web search plugin. [SERVER]
  • KILOCODE_API_BASE_URL - KiloCode API base URL for the customizer plugin. [SERVER]
  • KILOCODE_ORGANIZATION_ID - Organization ID for KiloCode API calls. [SERVER]
  • OPENCODE_CONFIG_CONTENT - JSON/Toml/YAML string containing OpenCode configuration injected into agent environments at runtime (used as an alternative to KILO_CONFIG_CONTENT). [SERVER]
  • KILO_CONFIG_CONTENT - JSON/Toml/YAML string containing Kilo configuration injected into agent environments at runtime (session config, skills, etc.); read by @kilocode/sdk. [SERVER]

Cloud Agent Services

Cloud Agent Sentry coverage is explicit, not blanket Durable Object instrumentation. It captures unexpected Worker HTTP/tRPC, queue and scheduled exceptions, control-plane wrapper startup/crash failures, and exceptions from the instrumented exports in services/cloud-agent-next/src/index.ts: SandboxSession, SandboxControl, SandboxContainers, StreamTicketNonceDO, and UserKiloFacade.

EnvironmentBuild and VercelSnapshotBuild are outside this rollout. Their build status, failure records and structured logs remain the investigation path; unexpected standalone RPC/alarm exceptions in those classes are not guaranteed to reach Sentry. Raw SandboxContainment and SandboxSmallContainment exports are also excluded: they retain the SDK container lifecycle, billing hooks and outbound-handler registration without Sentry wrapping. The control-plane wrapper's own crash reporting is independent of these exports. Abrupt OOM/SIGKILL failures and synthetic session failure events are not captured.

  • KILOCODE_TOKEN - Auth token for KiloCode/Session service identity; used by the Cloud Agent Next wrapper. [SECRET]
  • KILOCODE_TOKEN_FILE - Path to a file containing the KiloCode token (alternative to the env var). [SERVER]
  • KILO_SESSION_INGEST_URL - URL used by the Cloud Agent Next wrapper to ingest session data. [SERVER]
  • KILO_PLATFORM - Target platform identifier used by the Cloud Agent Next wrapper (darwin, linux, etc.). [SERVER]
  • WRAPPER_LOG_PATH - File path for the Cloud Agent Next wrapper's log output. [SERVER]
  • CLOUD_AGENT_SENTRY_DSN - Optional Worker-owned Sentry DSN for the kilo-code/kilo-cloud-agent project, used for Cloud Agent exceptions and wrapper crashes. Forwarded only at wrapper launch, never taken from agent profiles. Missing or invalid disables reporting. [SERVER]
  • CLOUD_AGENT_SENTRY_ENVIRONMENT - Cloud Agent Sentry environment label; defaults to production when absent. Invalid nonempty labels disable reporting. Configuration warnings name the variable once per process or Worker isolate, without its value. Use a separate label for nonproduction deployments. [SERVER]
  • KILO_BIN_PATH - Path or name of the kilo CLI binary; used by services/cloud-agent-next/scripts/update-default-slash-commands.mjs. [SERVER]
  • WORKSPACE_PATH - Filesystem path of the agent workspace. [SERVER]
  • SESSION_ID - Reserved session identifier for the cloud-agent-next runtime; reserved in RESERVED_ENV_VARS. [SERVER]
  • SANDBOX_SELECTION_IDS - Comma-separated user or org IDs allowed to choose a Cloud Agent sandbox size. Paid Cloud Agent billing enrollment and Vercel BYOC enrollment also enable selection without this allowlist. * includes personal accounts. Production wrangler.jsonc sets the allowlist, so a deploy overwrites the Cloudflare dashboard value. Wrangler dev and .dev.vars.example default to *. [SERVER]
  • WORKSPACE_SNAPSHOT_IDS - Comma-separated user or organization IDs enrolled in private registered Cloud Agent workspace tail capture and restore, independent of environment snapshots. Matching either enables the feature; * enrolls everyone, and empty or unset is off. Only native Cloudflare Containers dedicated to one registered workspace are eligible. Sibling sessions share one snapshot; standalone sessions are excluded. Capture uses aggregate workspace activity after one minute. Snapshots may contain workspace secrets. The production Wrangler default is *; the dev default is empty. [SERVER]
  • WORKSPACE_ARTIFACTS_BUCKET - Private R2 binding for synchronized workspace artifacts. Production uses cloud-agent-workspace-artifacts; dev uses cloud-agent-workspace-artifacts-dev. Objects are keyed <sandboxId>/<uuid> and are never served publicly. [SERVER]
  • WORKSPACE_ARTIFACTS_BUCKET_NAME - Name of the artifacts bucket used as the S3 bucket in presigned download URLs. Must match the WORKSPACE_ARTIFACTS_BUCKET binding. Presigned downloads reuse the attachments read-only S3 key (R2_ATTACHMENTS_READONLY_ACCESS_KEY_ID / R2_ATTACHMENTS_READONLY_SECRET_ACCESS_KEY); the operator must add the artifacts bucket to that token's read scope. [SERVER]
    • Do not ship lifecycle retention until there is durable artifact cleanup for pending runtime deletions and account erasure. Pending deletions can fail before the Sandbox DO queues cleanup, and account erasure bypasses that DO. Both paths can leave index rows and R2 objects behind. Once cleanup is in place, remove the old 15-day R2 expiration rule from both artifact buckets before deploying. Deployment does not change bucket rules. An upload-age rule deletes files from live workspaces and leaves their index entries behind.
  • PREVIEW_HOST_SUFFIX - Hostname suffix the Cloud Agent Next Worker dispatches preview hosts under; a preview host is p<port>-<workspace-uuid-hex>.<suffix>. Unset or empty disables preview dispatch and the /preview/open hop, and the web app hides the preview button (it reads availability from the Worker's getPreviewOptions). The web app needs no preview setting. Production wrangler.jsonc sets cloud-agent.kiloapps.ai. services/cloud-agent-next/.dev.vars.example sets localhost. [SERVER]
  • E2E_MODEL_VALIDATION_BASE_URL - E2E-only base URL for Cloud Agent Next model validation. Only the deployed e2e Worker config sets it (test/e2e/deploy/render-e2e-worker-config.mjs), to point validation at the fake-LLM catalogue. It is honoured only when its origin equals the origin of KILO_OPENROUTER_BASE; otherwise validation uses KILOCODE_BACKEND_BASE_URL. Unset in production. [SERVER]
  • BYOC_VERCEL_IDS - Comma-separated user or organization IDs enrolled in customer-paid Vercel compute. Empty is off; * enrolls both personal accounts and organizations. An enrolled owner fails closed when its ready credential is absent. [SERVER]
  • HOME - Reserved in RESERVED_ENV_VARS for cloud-agent-next session home management. [SYSTEM]

Auto Routing Worker

  • KILO_AI_GATEWAY_BASE_URL - Origin of the AI gateway that services/auto-routing asks which custom router gateway entries the organization model policy denies (/api/v1/internal/auto-routing/denied-models). A wrangler.jsonc var for production; pnpm dev:env writes the local gateway port to .dev.vars. [SERVER]
  • AUTO_ROUTING_DECISION_SECRET - HMAC secret that signs custom router decision IDs; the AI gateway verifies them with the same value. Production Secrets Store name AUTO_ROUTING_DECISION_SECRET_PROD; locally pnpm dev:env seeds it from .env.local. [SECRET]

Other Services

  • DOCKER_SOCKET - Path or URL for the Docker daemon socket; services/cloud-agent-next/scripts/dev.sh maps it to DOCKER_HOST for local Wrangler. [SERVER]
  • SECRET - Generic secret env var used in services/kiloclaw/src/auth/sandbox-id-adversarial.test.ts for sandbox auth tests. [SECRET]
  • SESSION_SHARE_JWT_SECRET_PROD - Secrets Store binding of services/session-ingest that signs and verifies public session share tokens. Only that Worker reads it, so pnpm dev:env generates a random local value (@dev-generate base64 32) and no .env.local key is needed. [SECRET]

Browser Extension (apps/extension)

  • VITE_POSTHOG_API_KEY - PostHog public project API key baked into extension builds; read in apps/extension/src/shared/analytics.ts; absent → analytics disabled. [PUBLIC]
  • VITE_KILO_API_BASE_URL - Selects the Kilo API base URL at build time; read in apps/extension/src/shared/auth.ts. [PUBLIC]
  • VITE_CLOUD_AGENT_WS_URL - WebSocket URL for Cloud Agent Next streaming from the extension; read in apps/extension/src/shared/cloud-agent-config.ts. Falls back to localhost during wxt serve and the production Cloud Agent endpoint otherwise. [PUBLIC]
  • VITE_SESSION_INGEST_WS_URL - WebSocket URL for session ingest from the extension; read in apps/extension/src/shared/cloud-agent-config.ts. Falls back to localhost during wxt serve and the production session ingest endpoint otherwise. [PUBLIC]

Mobile

  • API_BASE_URL - Base HTTPS URL for the mobile app's API (e.g. https://api.kilo.ai). Bundled into the binary. [PUBLIC]
  • WEB_BASE_URL - Base HTTPS URL for the mobile in-app web views (e.g. https://app.kilo.ai). Bundled into the binary. [PUBLIC]
  • CLOUD_AGENT_WS_URL - WebSocket URL for Cloud Agent Next streaming in the mobile app. Bundled into the binary. [PUBLIC]
  • SESSION_INGEST_WS_URL - WebSocket URL for session ingest from the mobile app. Bundled into the binary. [PUBLIC]
  • EXPO_PUBLIC_SESSION_SYNC_URL - Native remote preview relay URL for development bundles, inlined into the JS bundle. The preview requires __DEV__ and an explicit isolated Worker URL; pnpm dev:env:mobile writes the local session-sync Worker URL (http://<host>:8817), and pnpm dev:start session-sync starts that Worker. Release bundles ignore this setting and expose neither the Profile entry nor the /native-remote screen. [PUBLIC]
  • APPSFLYER_DEV_KEY - AppsFlyer development key for mobile attribution. Bundled into the binary (not secret — it's a device-level SDK key). [PUBLIC]
  • APPSFLYER_APP_ID - AppsFlyer app ID for mobile attribution tracking. [PUBLIC]
  • EVENT_SERVICE_URL - WebSocket URL for the event service from mobile. Bundled into the binary. [PUBLIC]
  • NOTIFICATIONS_URL - HTTP URL for the push-notifications backend from mobile. [PUBLIC]
  • POSTHOG_API_KEY - PostHog public project key for the mobile app's analytics and feature-flag evaluation, read as posthogApiKey in apps/mobile/src/lib/env-keys.js and required at startup by apps/mobile/src/lib/config.ts. Use the same PostHog project as the web app's NEXT_PUBLIC_POSTHOG_KEY: one person's flag then evaluates identically on both clients. [PUBLIC]
  • EXPO_PUBLIC_POSTHOG_DEV_HOST - Development-only PostHog API host for flag evaluation, such as a local mock. A development build contacts no PostHog project and resolves every flag to its default unless this is set; a release build ignores it. Read in apps/mobile/src/lib/analytics/posthog.ts, inlined into the bundle. [PUBLIC]
  • MOBILE_DEV_HOST - LAN host override for mobile dev (replaces localhost on physical devices); read in dev/local/mobile-env.ts. [SERVER]

Tests / Dev

  • IS_IN_AUTOMATED_TEST - Set to 1 to put the app in automated-test mode (e.g. skip Turnstile challenges). [SERVER]
  • CANDIDATE_TAG - Tag string used by scripts/test-rollout-bucket.mjs to test rollout bucket assignment. [SERVER]
  • PERCENT - Percentage value (0-100) used by scripts/test-rollout-bucket.mjs when testing rollout bucket logic. [SERVER]
  • SNOWFLAKE_MAX_POLL_ATTEMPTS - Max poll attempts for Snowflake job completion in services/kiloclaw-billing/src/snowflake.ts. [SERVER]
  • CF_AE_TOKEN - Cloudflare Account/Enterprise API token for the local dev CLI (dev/local/cli.ts). [SECRET]
  • KILO_PORT_OFFSET - Port offset for the local dev tmux dashboard; applied by dev/local/cli.ts and dev/local/services.ts to prevent port conflicts. [SERVER]
  • COMPOSE_PROJECT_NAME - Docker Compose project for the local infrastructure; written to dev/.env by dev/local/infra-env.ts so a worktree with a port offset owns its own containers and volumes. [SERVER]
  • KILO_POSTGRES_PORT, KILO_REDIS_PORT, KILO_REDIS_HTTP_PORT, KILO_GRAFANA_PORT - Host ports for the local infrastructure containers; written to dev/.env by dev/local/infra-env.ts, read by dev/docker-compose.yml. Default to 5432, 6379, 8079, and 4000. [SERVER]
  • CLOUDFLARE_HYPERDRIVE_LOCAL_CONNECTION_STRING_HYPERDRIVE - Overrides the localConnectionString each wrangler.jsonc commits, so a worktree's workers reach that worktree's database; set on every worker command by dev/local/services.ts. [SERVER]

E2E

  • DATABASE_URL - Postgres URL for E2E test runs across cloud-agent-next and kiloclaw E2E suites. [SECRET]
  • WORKER_URL - Base URL of the worker under test (Kiloclaw E2E). [SERVER]
  • E2E_GIT_URL - Git server URL for E2E tests (clones repos during runs). [SERVER]
  • E2E_MODEL - Model identifier string for E2E inference tests (e.g. a fake/small model name). [SERVER]
  • KILOCLAW_USER_LOCATION - User location parameter for lifecycle tests of the morning briefing plugin. [SERVER]
  • KILOCLAW_USER_TIMEZONE - User timezone parameter for lifecycle tests of the morning briefing plugin. [SERVER]