/oxy:oxy-custom-appsfrom oxy
Use when building, debugging, reviewing, shipping, or verifying an Oxy custom-app bundle (a code-first React/Vite app served by Oxy at /customer-apps/<org>/<slug>/), including writing Oxy Functions, driving them from the UI, and checking a published app in the browser with the Playwright MCP server (no CI checks a published bundle). Covers the oxy-app.json contract, @oxy-hq/sdk and @oxy-hq/vite-plugin, where app data goes (ctx.airhouse, ctx.oltp, ctx.storage), pitfalls, performance guardrails, load speed and usage tracking (service worker, Activity tab, useTrackEvent), the self-serve oxyc publish ship flow, dev-<handle> sandboxes and workspace previews, how an AI agent gets its own short-lived credential (oxyc tokens create --sandbox-agent or --agent, never the engineer's oxyc login), and reading a deployment's live data with oxyc api and oxyc proxy (the oxy binary has no HTTP-API commands; every one of them is oxyc).
Ships in oxy. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them.
Custom-app bundles are arbitrary JS apps served by Oxy at
https://<env>/customer-apps/<org>/<slug>/. Oxy is a data gateway:
serves static assets, gates cookie auth, and proxies queries. The
bundle is opaque above the data plane — no per-app server config.
This file is the contract. The detail lives in references/ — see
Read next for which file answers what.
Two small packages remove the footguns — default to them rather than wiring a bundle by hand:
@oxy-hq/sdk — the data layer (useQuery, useSemanticQuery,
useAgentRun, <OxyChat>); see rule 2 and the @oxy-hq/sdk README.@oxy-hq/vite-plugin (oxyApp() in vite.config.ts) — bakes the asset
base path from the manifest, copies oxy-app.json into out/, proxies
/api in dev, and injects the window.__OXY_APP__ shim. Dropping it
re-introduces the #1 bug — asset 404s → blank dashboard (rule 3).Scaffold both with pnpm create @oxy-hq/oxy-app my-app (templates vite — the
default — functions, dashboard, single-store; -t functions adds Oxy
Functions). The platform is kit-agnostic (any bundle with a correct base path
works), but hand-rolling means owning the base-path + dev-proxy wiring yourself.
oxy-app.json (project root, not public/) is identity only.
Schema:
{
"$schema": "https://unpkg.com/@oxy-hq/sdk/schema/oxy-app.schema.json",
"schemaVersion": 2,
"slug": "url-slug",
"orgSlug": "your-org",
"name": "Display Name"
}
Required: schemaVersion (must be 2), slug (1–63 lowercase
letters, digits and single hyphens — it becomes the served path and
the OLTP schema name).
Strongly recommended: orgSlug (lets @oxy-hq/vite-plugin derive
the asset base path automatically, so plain pnpm build produces
a bundle ready to drop into the linked org with no env var, and lets
pnpm dev and oxyc publish find the app without --org / OXY_ORG;
create-oxy-app --org <slug> writes it).
Optional: name (display), description, icon, art, status
(launcher card), projectId (dev-time hint), build (what oxyc publish runs — install, command, outDir; the plugin reads
outDir too), functions, env, storage, notifications, widgets, …
One contract. The file is validated against the JSON Schema
@oxy-hq/sdk ships (schema/oxy-app.schema.json, generated from the
SDK's OxyAppManifest type; $schema gives your editor completion)
by oxyc validate, oxyc publish, the Vite plugin and the SDK's own
loader — the same check, the same words. A wrong type, a bad name or
a missing required field is refused; a field the schema does not know
is a warning (the platform ignores what it does not read — so a
typo'd timeoutSecond is said, not silently dropped). Every field and
what the server does with it: OxyAppManifest in
@oxy-hq/sdk/manifest, which also exports the schema, isValidSlug
/ isValidFunctionName and validateOxyAppManifest for a tool of
your own.
At serve time, oxy injects the authoritative org + project from
the admin row via window.__OXY_APP__ — the manifest's orgSlug
and projectId are advisory hints only, never enforcement.
Do not invent products, writers, or from:-blocks. Those
don't exist in v2 and the schema rejects them.
File location: <root>/oxy-app.json, sibling to
vite.config.ts. The vite-plugin reads it from there, and so does
oxyc publish (only from the directory it runs in); legacy bundles
that kept it under public/ get neither the plugin's base-path
derivation nor the publish's slug / orgSlug.
All data flows through SDK hooks → oxy HTTP endpoints. The surface is intentionally small:
| Hook / component | Endpoint | When |
|---|---|---|
useQuery({sql}) | POST /api/projects/:id/query | Raw SQL, 10k row cap |
useSemanticQuery({topic, …}) | POST /api/projects/:id/semantic-query | Reference topics/measures by name |
useAgentRun({agentId}) | POST /api/projects/:id/agents/:id/asks + SSE | Streaming chat / Q&A |
useAskAgent() | POST /api/projects/:id/agents/:id/asks with wait_seconds | One-call answer (≤45 s) for a button or a batch; status: "running" when the wait runs out |
useProcedureRun({procedureId}) | POST /api/projects/:id/procedures/:id/runs ⚠️ beta | Long-running batch |
useFunction(name) | POST /customer-apps/<org>/<slug>/fn/<name> + SSE | Invoke a server-side Oxy Function (see below) |
<OxyChat agentId="…"/> | wraps useAgentRun | Drop-in chat UI |
<OxyAnswer {...run}/> | renders any run | Drop-in answer renderer |
import { OxyChat, useQuery } from "@oxy-hq/sdk";
const { rows } = useQuery({
sql: "SELECT col FROM t WHERE x = {{ params.x | sqlquote }}",
}, { params: { x: someState } });
// ...
<OxyChat agentId="analytics" />
To try an agent from a terminal the same way: oxyc ask <workspace-id> <agent> "<question>" --json (one request, answer on stdout; --thread <id> to reply
to a clarifying question).
See the @oxy-hq/sdk README for the full reference, including
OxyApiError parsing and beta-surface caveats.
Server-side work → Oxy Functions, not the browser. useQuery &
friends run in the client; for work the browser shouldn't do
(warehouse writes, ELT kick-offs, external API calls, secret-bearing
logic) ship a TypeScript handler under functions/ and invoke it
with useFunction(name).invoke(body?). Declare it in oxy-app.json:
{ "schemaVersion": 2, "slug": "my-app",
"functions": { "daily-rollup": { "route": true, "timeoutSeconds": 30 } } }
// functions/daily-rollup.ts — runs on Oxy's isolate runtime
export default async (req, ctx) => {
const { rows } = await ctx.query("SELECT … FROM …"); // data-plane ctx
return Response.json({ rows });
};
ctx bridges to the data plane: ctx.query / ctx.queryStream,
ctx.semantic.query, ctx.warehouse.query,
ctx.warehouse.{insert,exec,upsert} (to Airhouse, or to a customer
warehouse the function names in customerWarehouseWrites), ctx.airway.run,
ctx.fetch (SSRF-allowlisted), ctx.env, ctx.user, ctx.log.
ctx.math runs the workspace's decision models (decisions/*.decision.yml)
that the app lists in oxy-app.json's top-level "decisions": { "<name>": { "levers": [...] } } block (levers = the parameters whose live values
only this app may write; a lever has one owner per environment, so a
publish or promote claiming one another app owns is refused). A decision
belongs to no app: its module ships on its own with oxyc decision publish <file>.decision.yml (lands on the decision's staging) and oxyc decision promote <name>; a run refuses a build made from a different version of
the file than the workspace compiled. ctx.math.optimize(name, { budgets?, detail? })
and ctx.math.simulate(name, { mode: "evaluate", candidates }) or
{ mode: "backtest", window: { start, end } } resolve at once to
{ runId } (a run outlives the function's time cap), and
ctx.math.run(runId) reads it back; ctx.math.latestRun(name, { mode }) reads
the newest finished run of a mode (or null), for a scheduled job that started
it on an earlier tick; ctx.math.detail(runId, { candidate?, entity?, field?, limit? }) reads what the run kept per entity (an evaluate started with
detail: true), such as each entity's action. ctx.math.liveParameters(name) reads the
per-entity live values and hand overrides the platform keeps for the
decision (a run folds them in), and ctx.math.setLiveParameters(name, { values?, overrides?, remove? }) writes or clears this app's own levers' rows,
from production only. It also needs "decisions": { "enabled": true } on the function's own oxy-app.json entry, in staging and sandboxes
too; without it every call throws DecisionsCapabilityMissing.
What the app STORES picks its surface by shape — facts through
ctx.airhouse, records through ctx.oltp, files through
ctx.storage — and customer warehouses are read-only. See
Where data goes below before writing anything.
oxyc publish bundles functions/*.ts with
esbuild — no separate backend to stand up. Author-facing types:
OxyFunctionContext / OxyFunctionRequest from @oxy-hq/sdk; a worked
example ships in the functions template (pnpm create @oxy-hq/oxy-app my-app -t functions).
OXY_APP_BASE_PATH must match the path the bundle is linked
under. @oxy-hq/vite-plugin resolves it from (in order):
OXY_APP_BASE_PATH env → orgSlug + slug in oxy-app.json →
/. oxyc publish sets that env to /customer-apps/<org>/<slug>/
for the build automatically, and the vite-plugin derives the same
from the manifest for pnpm dev / pnpm build. Mismatch → asset
404s → blank dashboard.
| The data | Store | In a function | In oxy-app.json |
|---|---|---|---|
| Facts — something happened and won't change: an order, a completed checklist, a delivery, a reading | The workspace's Airhouse, in your schema app_<writer> | ctx.airhouse.append(table, rows) · ctx.airhouse.query(sql) · ctx.airhouse.exec(sql) | function: "airhouse": { "enabled": true } · app: "airhouseMigrations": { "dir": "airhouse-migrations" } |
| Records your app edits — bookings, assignments, templates, counts | The org's OLTP Postgres, in your schema app_<writer> | ctx.oltp.query/exec(sql, params) · ctx.oltp.tx(async (tx) => …) | function: "oltp": { "enabled": true } · app: "migrations": { "dir": "migrations" } |
| Files — photos, PDFs, exports | Your app's storage silo | ctx.storage | function: "storage": { "read": true, "write": true } |
| The customer's warehouse — ClickHouse, Snowflake, BigQuery, their Postgres | Theirs | ctx.query · ctx.warehouse.query(db, sql) | read-only: a write is refused unless the function declares "customerWarehouseWrites": { "<db>": "<why>" } |
Three questions, in order: Is it bytes? → storage (keep the key in a record or fact). Does it change after it's written? No → a fact; yes → a record; both when you need history (the record says what is true now, the fact says what changed). Is it already in the customer's warehouse? → read it there.
<writer> is your slug with - → _ (my-app → app_my_app); a slug
with _ can't back a schema. Both stores are written as the app, whoever
invoked the function, so a scheduled run writes like a click.
A store has to exist before your schema can. The org's OLTP Postgres is bought
and provisioned for the account, not created by publishing, so on a new or
part-provisioned account ctx.oltp fails for a reason that is nothing to do with your
code — and the same is true of a secret that was set in staging but never in
production. You cannot provision it yourself. What to ask for by name: Oxy staff run
oxyc bootstrap verify <org>, which reports every account-level step as landed,
missing or unreadable and names the command that fixes each one. Quote the phase it
reports (oltp, secrets, airhouse) and you will get a straight answer instead of
a round trip.
Facts, in practice. Airhouse is DuckLake: no PRIMARY KEY, UNIQUE,
indexes or foreign keys — publish refuses a migration carrying one. So:
recorded_at. A retried
function appends twice; readers keep one row per id:
QUALIFY row_number() OVER (PARTITION BY completion_id ORDER BY recorded_at DESC) = 1.voided, amended), not an UPDATE.app_<writer>.<table> in migrations and in exec/query
(ctx.airhouse.schema has the name). append takes the bare table name.append,
never into exec SQL. exec runs no DDL — tables come from migrations.Records, in practice. Bound parameters ($1, $2) always. Several
statements that must land together go in one ctx.oltp.tx. The store is
provisioned per org by an operator; until then calls fail naming that step.
Where ctx.env comes from. The app's own secrets (its Secrets panel,
oxyc env secret set), plus any shared secret an admin has shared with the
app in Settings → Organization → Secrets — read under the secret's own name, so one
SLACK_BOT_TOKEN can serve every app that needs it and rotates once. The app's
own value of a key wins over a shared one. Nothing else of the workspace is
visible, and the manifest cannot ask for more: declaring a key in env only
makes it show as missing until someone sets or shares it. ctx.secrets.set
refuses a key the run read from a shared workspace secret; rotate it in Settings.
A function that calls Oxygen's own org routes (kiosks at
/api/orgs/{org}/frontline/devices, members, apps) holds an organization's
service-account token in a secret, never a person's: oxyc tokens create --org-service-account <org>/<account> --role admin --set-app-secret <org>/<app> --key <KEY> --env <env>. An owner or admin of the org approves it in the
browser, and the token goes into the app's secret without being printed. Legacy
oxy_… API keys authenticate nothing.
Not a store: ctx.secrets holds credentials you rotate. A cursor, a
counter or a JSON blob is a record. oxyc validate warns about it, about
keys in Airhouse migrations, and lists every customer-warehouse write exception.
// A checklist is finished: the record changes, and a fact is appended.
async function completeChecklist(ctx, runId: string, storeGuid: string) {
await ctx.oltp.tx(async (tx) => {
await tx.exec("UPDATE checklist_runs SET status = 'done', completed_at = now() WHERE id = $1", [runId]);
await tx.exec("DELETE FROM open_reminders WHERE run_id = $1", [runId]);
});
await ctx.airhouse.append("checklist_completions", [
{ completion_id: runId, store_guid: storeGuid, completed_by: ctx.user.id, recorded_at: new Date().toISOString() },
]);
}
Records in Airhouse, with their history (oltpChanges). Declare tables
at the app level, beside migrations:
"oltpChanges": { "tables": { "leases": {}, "landlords": { "exclude": ["contact_email"] } } }
Every committed change to a declared table lands in the workspace's Airhouse
as oltp_<writer>.<table>__changes (_op, _changed_at, _actor, _seq
beside the row's columns), with the current state in the view
oltp_<writer>.<table>; jsonb and arrays land as JSON text. Your app code
does not change: capture runs in the same transaction as the write.
exclude columns never leave
Postgres, and nothing in Airhouse is purged, so personal data and free
text belong in exclude.oltp_changes on for the
org. The cadence is near real time unless staff pace the org
(oxyc oltp changes interval); staff also have sync (a pass now),
status (lag and holds) and resync.To use another app's data or rule, call its function (ctx.apps.call) instead of copying its tables; both manifests declare it. See references/app-calls.md.
A function can run when an Airhouse table changes, with no one calling it:
"functions": {
"on-lines-changed": {
"route": false,
"on": { "table": "pokehouse:bookkeeping.platform_report_lines" }
}
}
The table is <database>:<schema>.<table>; leave the database out for your own
app_<writer> schema. It fires once per snapshot that inserted into or
deleted from the table, so a pipeline that writes the table fires it, as does
ctx.airhouse. Wrap the handler in onEvent from @oxy-hq/sdk/events and
narrow with isTableChange(event):
export default onEvent(async (event, ctx) => {
if (!isTableChange(event)) return;
const { snapshotId, inserted, deleted, updated, rows } = event.data; // row-image counts (`updated` counts pre/post-image pairs), rows when small
const page = rows ?? (await ctx.tables.changes(event)); // { inserted, deleted, hasMore }
// Re-derive what you keep from the table.
});
inserted double counts. Treat an
event as "this table changed, re-derive", not as a delta, unless the table is
append-only. Delivery is at least once.rows is there up to 1,000 rows and 64 KB; past that, call
ctx.tables.changes(event, { limit, offset }) (10,000 a side a call, hasMore).
It answers only for the event that started this run.EventLoop error. A loop through two tables is caught by a
circuit breaker that pauses a subscription over 150 deliveries in 5 minutes and
pages; oxyc events resync <org>/<app> <function> resumes it (and skips what
changed meanwhile).airhouseMigrations file that does so to a table a production function watches
is refused at publish. Adding a column is fine. resync clears broken and
behind_horizon (the next snapshot expired); --backfill runs the handler once
with event.data.backfill === true.app_<writer>__<env>
copy when it has the table, else production's, read-only. A non-production watch
records nothing until the environment's events switch is on (then it starts
from now). Airhouse caches snapshot reads up to a minute, so an event can lag
a write by that much.
oxyc events ls shows each watch's cursor, lag and state.createTestEvents().tableChange({ table, snapshotId, inserted, deleted }) and createTestContext(manifest, { tableChanges: { [event.id]: { inserted: [...] } } }).Name people; the platform reaches them. Don't build a recipient table, a "sent" log or a Slack webhook helper:
await ctx.notify({
to: { role: "Store Manager", location: storeId }, // or { userId } · { team }
kind: "list_overdue", // declared in oxy-app.json
title: "Opening list is 30 minutes late",
link: `/lists/${listId}`, // a path inside the app
email: true, // optional; slack: true too
idempotencyKey: `overdue:${occurrenceId}`, // retry-safe
});
oxy-app.json: "notify": { "kinds": { "list_overdue": {} } } on the function
({ "critical": true } for a kind people must not mute). Everyone lands in
their Oxygen inbox — frontline crew too, who have no email — and is pushed,
emailed or Slacked where they can be. slack: true DMs each person's own Slack
account (found by their email once the org has connected Slack), so an app
never holds a Slack token or maps users to Slack ids. Needs the org's OLTP
store. Use
ctx.email.send only for addresses outside the org (a vendor, an
accountant), and give it an idempotencyKey in a scheduled function.
Describe your kinds once, at the top level of oxy-app.json. It is the tree
people mute in (a whole app, a category, or one kind) and the one a phone groups
by, so declare it with the first ctx.notify, not later:
"notifications": {
"categories": {
"operations": { "label": "Store operations" },
"operations/food-safety": { "label": "Food safety" }
},
"kinds": {
"list_overdue": { "category": "operations", "label": "Overdue lists", "level": "time_sensitive" },
"temp_alarm": { "category": "operations/food-safety", "label": "Temperature alarm", "level": "critical",
"actions": [{ "id": "ack", "label": "Acknowledge", "function": "ack-alarm" }] }
}
}
a-z0-9, _, -); a declared
path's parents need no entry. A kind with none is in general.passive, active (default), time_sensitive, critical. Only
critical ignores mutes; a function's "critical": true still makes it so.function (one this app
declares), a tap calls it as the person with { notificationId, action, link }
and marks it read; without, it opens the link.ctx.notify({ …, thread: `store:${storeId}` }) (≤ 128
characters) folds a run of notifications about one thing into the newest.notify.kinds still decides what it may send; a kind it sends
that the catalogue leaves out gets the defaults. oxyc validate, the Vite
plugin (pnpm dev / pnpm build) and oxyc publish refuse a malformed or
unknown category, a bad level, more than 3 actions, an action naming an
undeclared function, a misspelt field and any oxy. kind — every problem at
once; a catalogue kind no function sends is a warning.Acting in Oxygen itself: ctx.oxygen, never a stored key. A function that
needs the platform (the org's kiosk devices, a source upload) asks for it under
"oxygen" in its manifest entry and calls ctx.oxygen.*:
"tablets": { "route": true, "oxygen": { "frontline": { "devices": "manage" } } },
"webhook": { "oxygen": { "sourceUploads": { "pipelines": ["ubereats_transactions"] } } }
const link = await ctx.oxygen.frontline.devices.create({ name, locationId, returnTo });
await ctx.oxygen.sourceUploads.report({ file, fileName, pipeline: "ubereats_transactions", workflowId });
/<org>/oxygen-access/<appId>. Until then the call
throws AppAccessNotApproved: show the user that, never a stack trace. Publishing never
waits for the approval.EnvironmentRefused elsewhere). Any trigger may call it; the
audit row records the app, the function, the trigger and the person when there is one.tablets does
with reachOf).The dock. Wrap the app in <OxyShell> (every create-oxy-app template
does) so it shows Oxygen's rail and top bar: Home and the viewer's apps, each drawn as its
grey mark, opening in this tab and warmed on hover. From SDK 2.34.0 the shell has no
Chat entry and no Ask (no top-bar button, no ⌘K), as Oxygen's own chrome has none. Pass hideTopBar if the app draws its
own header. From SDK 2.33.0 the viewer opens and closes the rail from its
toggle, and the app's column narrows by 176px while it is open: lay screens out
to shrink (min-width: 0 on flex children), never for a fixed width. Link to another app with a plain <a href>, never target="_blank";
moving between apps is meant to feel like one product.
Look. The design standard for every custom app is the oxygen reference app
(oxy-hq/reference-app; on SDK 2.31.0 from reference-app@35c2bf5, oxy-hq/reference-app#20).
Import @oxy-hq/sdk/theme.css (SDK ≥ 2.29) above your own CSS to get it: its palette, square
corners, frame and control lines, the system face and 44px touch targets, which the shell and
the phone kit read too. Its selectors weigh nothing, so your own token declarations still win;
adopting it means deleting them, and deleting any --oxy-shell-* or !important rules aimed
at the shell or kit. Without the import, nothing about the app's look changes.
The desk UI comes from the SDK, never copied (SDK ≥ 2.30). The reference app's
components, patterns and recipes ship in @oxy-hq/sdk/ui with @oxy-hq/sdk/ui.css, imported
after theme.css and shell.css: import { SidePanel, LoadError, DefaultTabs, ui } from "@oxy-hq/sdk/ui". A Tailwind app imports @oxy-hq/sdk/tailwind.css before
@import "tailwindcss" so its utilities read the theme. Money, percent, dates and CSV come from
@oxy-hq/sdk/format, which runs in a Function too. Run checkThemeCss() from
@oxy-hq/sdk/testing in the app's tests: it fails on CSS that restates an SDK token or keys its
own mode. Run expect(formatSdkUiCopies(checkSdkUiCopies("src"))).toBe("") there too (SDK ≥
2.31): it reports each component in src/ named like an SDK piece, with the import to use. A
variant kept on purpose says why in the file that defines it, // oxy-ui-local: <Name> -- <why>
(the reason is required). A local that only holds a component (const Glyph = app.glyph)
defines nothing and passes from SDK 2.31.1; 2.31.0 reported it, so rename it there. A piece the SDK lacks is built in the app from the ui recipes; a
defect in a shared piece is fixed in the SDK, so every app gets it. Every create-oxy-app
template starts this way, and its pnpm test runs both checks.
SDK 2.31 adds, each opt-in: Panel's fold (foldable, open, defaultOpen), header,
optional title, landmark (as, label, headingLevel) and density="compact";
Sparkline's one series (sparkPoints), width / height, fluid, area, color, x and
readout; StatusDot wordHidden; DefaultTabs' disabled, stretch and per-tab hint;
HoverHint focusable; Stat's tipMark and valueAt; MetricCell's quiet step;
TryAgainButton; useModalFocus(ref, open, { auto: true }); topBarFrom sm / lg / 2xl;
useOxyMode() in @oxy-hq/sdk/shell. An app that kept its own panel fold, KPI tile, dot-only
status or Try again for want of one imports the SDK's and deletes its copy.
SDK 2.32 adds, each opt-in: PanelTable's phoneCard (each row a card on a phone: title,
status and chevron on one line, subtitle, every figure, a column's phoneWide across) and
rowProps (per-row data-*, title, tabIndex and handlers); Subnav's showHeadings and
header; StatGrid phonePairs and PhoneKpiStrip oddLastAcross (two to a row, an odd last
tile across); AlertStrip's per-alert hint and check tone (the theme's --status-check);
Sparkline's domain, band, reference (with from), baseline and endTone. An app that
kept a local PanelTable, Subnav, StatGrid, KPI row, AlertStrip or Sparkline for one of these
imports the SDK's and deletes its copy.
SDK 2.35 adds: ParentTabs (top bar included) puts the data-* props it is given on its root
<nav> (data-placement stays its own), and Panel puts them on its root. An app that kept a
local ParentTabs or Panel for a data-testid or a guided tour's data-tour marker imports the
SDK's and deletes its copy.
What the pieces settle, so an app doesn't override them (decisions 81–93):
SidePanel keeps its overlay shadow; drop any shadow-none (81).HoverHint puts them (84).LoadError size; drop overrides of it (85).Stat with a tip shows its ⓘ on the desk, a Tab stop; tipMark={false} only where the
tip restates what the screen already says (89). On a phone inside OxyShell it is the kit's
tap ⓘ after the label with no TapHintFrame from the app (SDK ≥ 2.31.1).Stat boxed in a StatGrid; a critical one keeps its error edge (90).LoadingBar with the read count, Loading for a single read; never a
sweeping bar (91).TrendChart labels hold 12px on screen at any width (92).MetricCell's quiet (the warning tint at 400) and warning (600),
error above them (93).Six rules of the design system go beyond the reference:
--scrim, and --scrim-blur, 8px; 0px under
reduced transparency). A modal <dialog> gets the blur from the theme on its own; give
its ::backdrop the colour var(--scrim). On any other scrim (a fixed div, a Radix or
shadcn overlay) put the class oxy-scrim and remove its own bg-*.topBarExtra) is the reference's secondary
(btnCompactSecondary: the --btn-surface fill, --border-subtle edge, full ink,
--btn-surface-hover on hover).--padding-sm-x, 12px), so it lines up with the tiles below rather than
sitting on the box's edge; the SDK's AlertStrip draws it so.SidePanel) runs from the top of the window to the bottom
(fixed, top: 0, bottom: 0), over the top bar rather than under it, as Store Ops'
sheet does. While it is open the whole window behind it, the top bar included, is
scrimmed and blurred as above and inert; focus moves into it, Esc or a click on the scrim
closes it, and focus returns to the row that opened it. On a phone it stays a
full-screen view with no scrim.PhoneTabBar draws it in the theme's
--link, which holds 4.5:1 for the label and 3:1 for the icon on the bar. It is the only
selection drawn in blue: desk navigation, tabs and segmented controls keep the design
system's monochrome selection. Leave that colour to the kit (give a tab icon no colour
of its own, so it follows the slot), and a bottom bar the app draws itself follows the
same rule.StatusDot wordHidden shows the dot alone and keeps the word for assistive tech.Light and dark. With the theme, the app has both modes and shows the signed-in
person's, the one Oxygen home shows: OxyShell applies it and puts one Light / Dark /
System switch at the bottom of the rail (the nav sheet's bottom on a phone), and a change
there changes Oxygen too. Write every colour from the theme's tokens so both modes work;
never set .dark on <html> yourself. A screen that must not move, such as a store's
shared tablet, pins one: <OxyShell modePin="light">, useOxyModePin("light"), or
<html data-oxy-mode-pin="light"> for the whole app. A crew sign-in has no mode and no
switch. On a staging or sandbox host the switch works for that preview only: it is kept on
that origin and never changes the person's real mode. The shell keeps
<meta name="theme-color"> on the mode's ground, so the app needs no hook of its own for it.
--chart-1…5 are the reference's sequential blue ramp; series that are categories take
--chart-cat-*. On a touch screen the shell's own chrome answers taps within 44px; a store's
enrolled tablet turns that off with useOxyTouchTargets(false) (or
<OxyShell touchTargets={false}>).
Motion. shell.css loads @oxy-hq/sdk/motion.css (SDK ≥ 2.24), Oxygen's
own motion language, so shadcn dialogs, menus and tooltips already open and
close like Oxygen's. Time your own transitions with its tokens
(var(--oxy-duration-fast), var(--oxy-ease-out); the templates map them into
Tailwind's @theme) rather than inventing durations, keep them short (most
are 120–240 ms), and give every slide or zoom a motion-reduce: counterpart.
import { OxyShell } from "@oxy-hq/sdk/shell";
import "@oxy-hq/sdk/theme.css";
import "@oxy-hq/sdk/shell.css";
<OxyAppProvider>
<OxyShell hideTopBar>
<App />
</OxyShell>
</OxyAppProvider>
A pushState before the person has touched the page (a default redirect,
filters written to the query string on mount) is turned into a replace by the
platform, so Back still leaves the app; write such URL syncs as replaces anyway. An app that pushes on
purpose before any interaction (a dialog route opened on load and closed with
history.back(), a kiosk's Back trap) adds
<meta name="oxy-history" content="native"> to its index.html, and its pushes
are left alone.
PhoneSheet and the shell's drawer hold their own entries this way and need nothing
from the app.
The app is its own page, outside Oxygen's shell, so show the inbox in the app — people who live in it (crew on a kiosk) never see Oxygen's bell:
import { NotificationsBell } from "@oxy-hq/sdk";
<NotificationsBell onNavigate={(link) => navigate(link)} /> // in the header
It lists this app's notifications (scope="all" for the whole inbox), each
with its category under the title, critical and time_sensitive ones marked,
and threads folded; a tap
hands the link you passed to ctx.notify to onNavigate (without it, the
page loads that path under the app's base). It renders nothing where there is
no inbox (signed out, an older server, pnpm dev). useNotifications() gives
{ items, unread, markRead, markAllRead, refresh, … } to draw your own, and
takes { category, kind, thread } to narrow it. Theme
it with --oxy-notifications-* CSS variables. Push sign-up and mutes stay in
Oxygen's Settings → Notifications — don't build them. In tests,
createTestInbox({ manifest }) from @oxy-hq/sdk/testing is a fake inbox to pass as
<OxyAppProvider fetcher={inbox.fetcher}>.
A widget puts what needs doing in your app on the Oxygen home, with the button that does it ("19 stores ready to post" and Post 19 ready). It is data, not a page: a function of yours returns a small JSON view and the home draws it. The function runs as the person looking, so app access and rate limits apply.
"widgets": {
"close": {
"title": "Month-end close", // ≤ 40 characters
"function": "close-widget", // declared under functions; returns the view
"size": "wide", // default size: "regular" (default), "wide" or "full"
"sizes": ["regular", "wide", "full"], // sizes a layout may pick; default [size]; must include size
"params": { "type": "object", "required": ["store"], "properties": { // settings per copy
"store": { "type": "string", "title": "Store", "description": "A store slug" } } },
"actions": {
"post-ready": { "function": "post-ready-jes", "confirm": true } // destructive: true for red
}
}
}
At most 6 widgets per app and 3 actions per widget; ids are lowercase
letters, digits, - and _. params is a flat JSON Schema: up to 8 properties, each
string, integer, number or boolean with optional title, description, default,
enum, minimum/maximum (numbers), minLength/maxLength (strings), plus required;
no nesting, no $ref. oxyc validate and oxyc publish refuse an unknown key, a bad id,
a bad size/sizes (widget_size_invalid), a bad params (widget_params_invalid) and an
undeclared function.
The function is called with { widget, size, params } (WidgetInput; size is how wide
it is drawn, so say more when wide or full; params are this copy's settings with
defaults filled in, {} if it declares none) and returns a WidgetView:
import type { WidgetInput, WidgetView } from "@oxy-hq/sdk";
export default async (req, ctx) => {
const { widget, size, params } = JSON.parse(req.body || "{}") as WidgetInput; // params.store
const view: WidgetView = {
headline: "19 stores ready to post", // required, ≤ 80; none = "nothing to show"
detail: "September · 61 of 84 posted", // ≤ 120
level: "attention", // ok | info | attention | critical
progress: { done: 61, total: 84 },
metric: { value: "$48,210", label: "Posted", delta: "+12%", trend: "up", spark: [31, 35, 41, 48] },
rows: [{ title: "Valencia", detail: "Not mapped", state: "blocked" }], // ≤ 8
buttons: [{ // ≤ 2, each naming a declared action
action: "post-ready", label: "Post 19 ready", input: { period: "2026-09" },
key: "2026-09", confirm: "Post 19 journal entries to QuickBooks?"
}],
link: "/?month=2026-09", badge: 19, // "Open" (app-relative: / or ?), and a count
refresh_after: 300, // read again after N seconds (60–86400)
};
return Response.json(view);
};
A widget's kind is what its view carries: metric makes a KPI card (value ≤ 24,
label ≤ 40, delta ≤ 24, trend up/down/flat, spark ≤ 30 points), progress a
progress card, rows with buttons a to-do. Text and lists past their limits are cut, and a
non-app-relative link or a button naming an undeclared action is dropped.
level decides the room a card gets. Widgets live in the home's Today area (a rail
beside the apps on a wide screen, under them on a phone), one column wide. An ok or info
view with no button folds to one line (its headline) in an "All clear" list after every card
that needs someone; attention and critical keep the full card. So say all-is-well in the
headline alone, and raise the level when the rows matter. progress is always a ring beside
the headline holding done/total, so don't repeat the count in detail. A regular card
shows three rows, wide and full all of them: size is how much a card shows, not its width.
Pressing a button calls the action's function with { widget, action, input } and
an Idempotency-Key built from widget, action and the button's key (none: a hash of
input), so a double click or stale card replays the first answer. Give every button
a key that names the thing done ("2026-09"), not a timestamp. The action's return
decides the card: { view } re-renders, { message } shows a line, anything else
re-reads the widget; a throw or non-2xx leaves it as it was, with the reason shown.
Widgets show in production only, on the apps-first home. One that should not run on every home load declares
cache: { ttlSeconds } on its function.
The org's home is one layout document, written by an org owner or admin (not by an
app): the widget groups of Today in order, and the widgets as <app>/<widget> at a size
from that widget's sizes. The apps always come first and are always drawn; apps and
insights entries are accepted but place nothing, and leaving insights out hides it. No coordinates; an edit is a list move. widgets sections may repeat,
each a group with an optional title (≤ 40); others goes on the first only. An item
may add params, a title and an id, so one widget can appear as several copies
(one per store), each with its own id.
Who a widget is for. A group or an item may add for:
{ "people": ["[email protected]"], "teams": ["Office"] } (emails, and org team names; at
least one list non-empty, at most 50 each, matched case-insensitively). Only those people
see it. It only narrows: app access applies first, and an item's for narrows its
group's. Use it when someone may open the app but its widget is noise to them ("show
Bookkeeping's cards only to Scott and Dylan"), rather than changing who can open the app.
Widgets the layout does not list stay everyone's. Each person can also hide a widget or
turn Today off on their own home; a layout cannot undo that.
{ "version": 1, "sections": [
{ "kind": "apps" },
{ "kind": "widgets", "items": [ { "widget": "warehouse/receiving", "hidden": true } ],
"others": "show" },
{ "kind": "widgets", "title": "Back office",
"for": { "people": ["[email protected]", "[email protected]"] },
"items": [ { "widget": "bookkeeping/close", "size": "full" } ] },
{ "kind": "widgets", "title": "Stores", "items": [
{ "widget": "store-ops/today", "id": "mission", "title": "Mission St",
"params": { "store": "mission" } } ] },
{ "kind": "insights" } ] }
Get, edit, preview, then apply:
oxyc home show --org acme # what a person sees: widgets, sizes, headlines
oxyc home get --org acme > layout.json # { revision, layout }: edit the layout
oxyc home apply --org acme -f layout.json --dry-run # resulting home as text, nothing saved
oxyc home apply --org acme -f layout.json # save (sends the file's revision)
A refused layout (exit 6) lists every problem as path: message (fix); fix them all.
Exit 8 means someone saved since your get: home get again and redo the edit
(--force overwrites). oxyc home reset restores the default. A widget not listed
still shows after the first group's items unless others is "hide", except one with a
required setting and no default: it needs an entry that sets params.
People open these apps on their phones. A desktop layout squeezed into one column
is not a phone layout: tables scroll sideways, tabs get cut, the answer sits under a
map. Give each screen people use on a phone a phone view built from the phone
kit in @oxy-hq/sdk/shell, beside the desktop component, from the same hooks:
const phone = usePhoneLayout();
return phone ? <OrdersPhone {...data} /> : <OrdersDesktop {...data} />;
The desktop layout stays exactly as it is. On the phone: a PhoneTabBar for
sections, the answer first (PhoneKpiStrip, "needs you" PhoneRows), table rows
as PhoneCards (never a sideways-scrolling table), details in a PhoneSheet,
maps as their own tab, PhoneHint instead of hover tooltips. The mapping from each
desktop part, the type and touch floor, and how to check it at 390×844 and 844×390:
references/phone-layout.md.
CORS errors are usually wrong-URL errors in disguise. The SDK's
base URL must be ${OXY_URL}/api, not OXY_URL bare. The API
router (which carries CORS headers) lives under /api/*. Hitting
/<projectId>/... lands in the static fallback and the missing
headers look like a CORS failure.
Cookie auth requires credentials: "include". The SDK's
useQuery sets this. If you fetch directly, set it yourself or the
oxy_session cookie won't be forwarded.
projectId in the manifest is advisory, not enforcement. The
SDK uses it to construct the query URL. Authorization is the user's
cookie → user → org_member of the project's org, decided
server-side. A bundle that ships a stolen projectId can't read
data the user can't already read.
Cloud mode is the target. Don't branch on local vs. cloud; don't
rely on the nil UUID 00000000-... as a default project; don't
assume OXY_STATE_DIR is writable.
Two more that read as bugs — useTrackEvent("oxy-…") is refused (400,
the prefix is reserved), and a hovered-but-never-opened app records no view —
are in references/performance-and-usage.md.
oxyc fn dev <name> runs one handler from your source in-process, in seconds,
with no publish. It bundles the handler with the same esbuild call oxyc publish
uses, then invokes it on createTestContext seeded from oxy-app.json: the
function's capabilities, ctx.env from the env file, and its destinations. It
prints the response, then the host ops the handler made.
oxyc fn dev notify --input '{"name":"Ada"}' # a literal, @file, or - for stdin
oxyc fn dev notify --input @sample.json --env-file .env.dev --watch
oxyc fn dev report --read-through --env dev # reads hit that deployment; writes stay stubbed
oxy-app.json). --env-file
defaults to .env; ctx.env holds that file's keys and nothing from your
shell. A required secret the file lacks is a warning.--watch re-runs when a file in the app changes, reading the manifest,
env file and @file input afresh. A broken edit prints its error and waits
for the next save. Exit with Ctrl-C.0 for a 2xx Response; 1 when the handler throws or
answers non-2xx (as fn call); 2 for a function the manifest does not
declare, or a missing env file.Buffer, TextEncoder and process exist where the isolate lacks them; and
every warehouse, semantic, storage, fetch and email call is a stub in memory,
so (without --read-through) nothing reaches a deployment. The context does refuse what the manifest
does not grant, in the host's words. A ctx.warehouse destination's engine is
assumed (a customerWarehouseWrites entry is a customer Postgres, any other
is Airhouse), because the workspace config is not read.--read-through reads real data, and only reads. It sends ctx.query,
ctx.warehouse.query and ctx.semantic.query to the deployment --env <name|url>
(or --target) names, through the app's own POST /api/projects/{project}/query
and /semantic-query, with your oxyc login bearer or OXY_TOKEN (the way
oxyc api authenticates). What you may read is the server's decision. The
project is --project / OXY_PROJECT, else looked up from oxy-app.json
slug + orgSlug. Every other call (warehouse writes, ctx.tx, ctx.oltp,
ctx.airhouse, storage, fetch, email, notify, and ctx.queryStream) stays a
stub in memory and never leaves your machine. Each call in the report is marked
real or stubbed. --env defaults to production, so name a dev environment
when you can. A sandbox agent token is refused: use a person's login.
ctx.semantic.query row keys are view__member in the isolate but the route
strips the prefix, so read-through puts it back from your spec; a key it could
not map unambiguously stays as the route named it, so confirm that one with
fn call on a sandbox. Still not the isolate.oxyc fn call, or oxyc checks run. For a committed regression test use
createTestContext from @oxy-hq/sdk/testing in vitest, as the functions
template does.Declare an Input (and Output) type in the function's entry file, or cast the
body (JSON.parse(req.body) as Body) and annotate the handler's return type.
oxyc publish turns them into the function's inputSchema / outputSchema in
the uploaded manifest. The staff console shows them as a field table, and Run now
checks its input against inputSchema before sending it. JSDoc becomes the field
description, and @minimum, @maxLength, @pattern, @format and
@asType integer become constraints.
Record, Date, relative type imports. A generic, intersection or tuple is a
publish warning naming the line, and that function ships without a schema.oxy-app.json wins, and null turns generation off.
It must use the JSON Schema 2020-12 subset OxyAppJsonSchema lists (no
$ref) and stay under 16 KiB, or the publish is refused (oxyc validate says
so first).These commands are a person's, or an agent's on a token that person
approved. oxyc login is the engineer's own browser login, and a publish to
a channel or a promote is refused under a sandbox agent token. As an agent,
iterate in your own sandbox
(references/sandbox-agent-loop.md). Ship
only when your engineer asked you to, on an agent token they approved
(oxyc tokens create --agent, plus --standing for staff access): it
publishes and promotes as them. With no browser on your machine, see
Headless and cloud sessions: a token approved
there never carries staff access.
Ship with oxyc publish (npm i -g @oxy-hq/cli) — no CI step, no S3 sync,
no folder picker. From the app directory:
oxyc login --env production # once; browser flow, caches a token,
# and prints whether you're an app-admin
oxyc validate # schema, data-placement and function checks first
oxyc publish --env production # build → bundle functions → tar → upload (draft = staging)
oxyc promote <org>/<app> --env production --dry-run # the plan: changes, migrations, blockers
oxyc promote <org>/<app> --env production # staging's build → production (asks first)
oxyc rollback <org>/<app> --env production --app-env production # back to the build before
Production only ever serves a build staging has served, and every way of
moving it — oxyc promote, oxyc rollback, the console's Promote draft
and Roll back to…, a promoting publish — applies the build's pending migrations before it moves
(a failure leaves the old build live). promote and rollback print the plan
first and refuse on a blocker: staging_never_served, required_secrets_unset
(set the key in production first), schedule_removal_unconfirmed (pass
--remove-schedule <function>). Off a terminal pass --yes.
oxyc publish --promote still works and warns that it is deprecated: it shows
nobody the plan.
An org can hold Promote on a build's checks (Oxy turns this on per org). The plan then lists each check of the build, the required ones marked, and three more blockers can refuse a promote to production:
checks_not_passed: a required check failed, could not run, or never ran.
By default the required ones are: its "check": true functions pass, it
loads on desk and phone, it follows the design system, and every screen
opens. Fix what the check found and publish again; oxyc checks show <app> --build <id> prints each finding.checks_running: a required check has no verdict yet. oxyc checks show <app> --build <id> --wait, then promote again.changes_not_seen: the app is set to need a person to look at the screens
that changed. They mark them seen on the app's Builds page.To promote past a failed check, an owner or admin of the app's org passes
--override-checks "<why>" (10 characters or more; it is audited, and it
clears those three blockers only). A publish token, a CI token and a service
account cannot. As an agent, never pass --override-checks on your own:
report the failed check and let a person decide. A rollback is never held by
the checks.
After a promote that is checked, oxyc promote waits up to 5 minutes while
the platform opens every screen on production, and exits 9 if that found
something the move broke (production has moved; oxyc rollback <app> --app-env production moves it back). --no-wait skips the wait.
--app / --org, then OXY_APP /
OXY_ORG, then the manifest's slug + orgSlug, then an
apps/<org>/<app>/ working directory. --org takes a slug or a UUID; pass
the slug whenever oxyc runs the build, because the asset base path is
baked from what you pass. With no org from any of those, the build stops
with missing org: the app's base path needs it (exit 2): add
"orgSlug" to oxy-app.json (create-oxy-app --org <slug> writes it)
or --org <org-slug>, and --app <slug> when the directory has no
manifest. The server upserts the app row — there is no separate create
step.oxyc publish then
lists the org's workspaces, and when there is exactly one (a freshly
provisioned org) publishes into it and says which. With several it prints
them with their uuids beside the flag to pass — --project <workspace-uuid> (or OXY_PROJECT), which also supplies the org. Drop
the flag after the first publish — it's auto-resolved from then on.
Trusted publishing (CI) only ever publishes a registered app.@oxy-hq/sdk or
@oxy-hq/vite-plugin is more than one minor behind the versions this
oxyc was built with gets one warning naming the pnpm add — the
manifest contract and the function runtime move with them.--env targets: local → a local Oxy web-app Vite dev server :5173
(it serves /cli-auth and proxies /api to oxy on :3000), dev →
aip.dev.oxy.tech, staging → aip.staging.oxy.tech, production (the
default) → app.oxygen-hq.com. A value with a ., / or : is read as a
URL.ctx.* call whose
capability the manifest lacks, a global the isolate does not have
(Buffer, TextEncoder, process, …), a write outside destinations. A finding fails
the publish (exit 1); --allow-function-lint publishes past a false
positive.--dir out skips the build and uploads a prebuilt directory (declared
functions are still bundled into it); --build-only builds and bundles
without a credential or an upload; --prebuilt (with --dir) uploads a
directory whose functions are already bundled. Server warnings print on
stderr; --json prints the result..env.local / .env are loaded from the app directory and its parents
(never overriding what is already set), so a stray OXY_PROJECT there
retargets a publish.OXY_TOKEN, then oxyc login's cache — or, in a GitHub
Actions job with id-token: write, the job's OIDC identity.
oxyc init-ci writes a workflow that publishes with no stored secret, and
has an org owner or admin approve its service account and trust policy once.
In a Claude Code remote session it asks and exits (--no-wait is the default
there): relay the link it prints — add --approver <their email> so they are
pushed it — end the turn, and run oxyc init-ci --force once they have
approved. A run that finds both in place asks nobody.oxyc apps show <org>/<app> prints the live build, the
commit it was built from, a newer draft if there is one, and its health;
oxyc apps builds <org>/<app> is the history. oxyc apps drift <org>/<app>
lists the commits in your checkout that touch the app after the live build's
commit — unknown there means it could not compare, not that nothing changed.app.acme.com) serves production only:
oxyc apps domains add <org>/<app> app.acme.com prints a CNAME and a TXT
record for the customer to create, then oxyc apps domains verify …. Build
nothing differently — the bundle keeps its /customer-apps/<org>/<app>/ base
and its same-origin /api calls work on the domain. A visitor signs in once
through the Oxygen login; on that domain the session reaches only the app's
workspace, so a call to another workspace there is refused by design.The build is not the check: after a publish, drive the page (references/verifying-in-the-browser.md).
A Claude Code cloud session (claude.ai/code), a CI runner or any machine with no browser can mint a token, iterate in a sandbox and publish. A person approves once, from any device.
The cloud environment. Its owner sets this once in the environment's
settings. Under Network access → Custom, allow app.oxygen-hq.com and
*.oxy.tech, and keep the default package-manager list ticked so npm can
install oxyc. Optionally add OXY_APPROVER=<their email> under
environment variables, so each approval request is pushed to them.
The repo's SessionStart hook, .claude/hooks/oxyc-cloud-session.sh,
with its entry in .claude/settings.json. In a cloud session it installs
oxyc and routes it through the session's proxy. It also makes a minted
token reach every later command, which an export in one shell call cannot
do. What it prints at session start says what is missing.
oxyc new or oxyc adopt made has both files.oxyc update --apply adds the script but
only reports the settings entry, because the team may have their own
settings. Add the entry by hand:
{ "hooks": { "SessionStart": [ { "matcher": "", "hooks": [ { "type": "command",
"command": "\"${CLAUDE_PROJECT_DIR:-.}/.claude/hooks/oxyc-cloud-session.sh\"",
"timeout": 120 } ] } ] } }
template/.claude/ directory of the
installed @oxy-hq/cli package.The credential. Run this in the background, because the approval can outlast a two-minute shell limit:
mkdir -p ~/.config/oxy && (umask 077; oxyc tokens create --agent --no-browser \
--env production >~/.config/oxy/agent-token.env)
Give your engineer the URL and the code it prints on stderr. The token goes
to that file and never into your context. The hook loads the file before
every later command. To iterate in a sandbox, mint
--sandbox-agent --app <org>/<app> into the same file instead. A token
lasts 8 hours by default (--hours, up to 168). On exit 4, mint again.
Or a network secret, which nobody approves per session. The
environment's owner adds one in its settings: Allowed websites
app.oxygen-hq.com (and *.oxy.tech), header Authorization, prefix
Bearer, and a personal access token or service account token as the
value. They also set OXY_TOKEN=from-proxy in its environment variables.
The proxy then adds the token to each request after it leaves the VM, so it
is never in a file, a variable or your context, and oxyc sends none.
The hook checks it with oxyc whoami and says if it is not attached. On
exit 4, report it: the secret's hosts, header or token are wrong, and
only the owner can fix them. Do not mint a token over it unasked. A sandbox
still needs an --sandbox-agent token minted into the file, which replaces
the sentinel.
Ship with the commands above, each with --token-env OXY_TOKEN.
promote and rollback need --yes, because there is no terminal to ask.
Sharing the setup with a team. The repo already shares what it can: the hook and its settings entry reach every teammate who clones it. The cloud environment cannot be shared that way. Claude Code has no file that defines an environment's network access, variables or secrets. The way to share one is an organization environment, which only an Owner of the team's Claude organization creates (claude.ai admin settings → Cloud environments). Members can read its variables but not its secrets, and one secret value serves everyone who uses it. So set it up in two layers:
app.oxygen-hq.com, *.oxy.tech and the default package managers, and its
setup script runs npm install -g @oxy-hq/cli. Teammates pick it, and each
session gets its credential from step 3: the person approves their own
token, which ends in hours and is recorded as theirs.oxy_pat_…,
from Settings → Organization → API tokens → Personal access tokens), and
OXY_TOKEN=from-proxy. What
they do is still recorded as them.Two things to avoid:
oxyc whoami says the
credential is "a browser session", the secret holds a session token, which
expires much sooner than a personal access token. Replace it.A token approved by device code never carries staff or partner access.
--standing --no-browser is a usage error (exit 2). The token from step 3
reaches only what the approver's org memberships do. That is enough when they
belong to the app's org. Staff shipping a customer's app have three ways:
OXY_CI_PUBLISH=on. Without it, the publish job is skipped and the run
still shows green.
gh workflow run publish.yaml -f ref=<branch> publishes that ref as
production's draft, which is staging. A push to main publishes to dev
instead.oxyc promote <org>/<app> --dry-run, then
oxyc promote <org>/<app>, and sees the plan before it ships.-f promote=true. It rebuilds the ref and puts it live with no
plan, the deprecated promoting publish.oxyc tokens create --agent --standing --hours <n>. They put
the value in the cloud environment as a network secret, with
OXY_TOKEN=from-proxy (step 3). As a plain OXY_TOKEN variable instead,
anyone who uses that environment can read it. Either way, keep --hours
short and revoke the token when the task is done.oxyc promote --from dev-<handle> command.Without the hook, start each command with . ~/.config/oxy/agent-token.env &&.
If a command fails with fetch failed (exit 7) while HTTPS_PROXY is set,
oxyc is too old to use the proxy. Update it, or set NODE_USE_ENV_PROXY=1.
A sandbox (dev-<handle>, 1-12 lowercase letters/digits/hyphens, no leading,
trailing or double hyphen) is a named, short-lived environment of one app: its
own build pointer, storage silo, secrets and Airhouse sibling schema. By
default reads hit production and writes are isolated or held (recorded, not
performed: a held write's note in invocations held names what would make it
land). Each part can be isolated further: see Branch it below.
A sandbox's schedules are off by default (staging's too): staff turn them
on per environment with oxyc env schedules <app> dev-x --on, and a scheduled
fire is not activity. To test a scheduled function without that, run it once
as its cron would — oxyc fn run <app> <fn> --app-env dev-x --as-schedule (no
input, system identity). Webhooks reach a sandbox on their own route,
/api/webhooks/apps-env/dev-x/<org>/<app>/<fn>, verified with the sandbox's
own secretVar value — set it with env secret set; staging's does not count.
It starts with no build, costs nothing idle, and is gone after 7 idle days or
an explicit delete — safe to use for every iteration that would otherwise
touch staging. Limit: 20 per app, counting ones still being deleted.
oxyc env create acme/store dev-x --env dev --json # starts with no build
oxyc publish --env dev --app-env dev-x --json # build + publish to it
oxyc env secret set acme/store KEY --app-env dev-x --env dev --value-env VAR # optional: its own secret
oxyc fn call acme/store submit-order --app-env dev-x --env dev --data '{}' --json # call it
oxyc checks run acme/store --app-env dev-x --env dev --json # run its checks
oxyc fn run acme/store nightly-sync --app-env dev-x --as-schedule --env dev --json # a scheduled function, once
oxyc invocations list acme/store --app-env dev-x --env dev --json # what ran; a row's id is `id`
oxyc invocations held acme/store <invocation-id> --env dev --json # what it held, not wrote
oxyc logs acme/store --app-env dev-x --env dev --json # its function logs
oxyc logs acme/store --app-env dev-x --env dev --follow --timeout 300 --json # live, as printed
oxyc env delete acme/store dev-x --env dev --yes --wait --json # done; tears its homes down
Branch it: isolate exactly the parts you are testing. A sandbox is a
branch of the app, with a parent (--from, for the build), a fork point
(--at, for production's data) and a mode per plane of app state. The defaults
keep the behaviour above. Turn on isolation only for what you are testing:
oxyc env create acme/store dev-x --from staging --preset full --env dev --json # most isolation in one flag
oxyc env update acme/store dev-x --plane oltp=branch --env dev # its own copy of production's rows
oxyc env update acme/store dev-x --fetch-host api.stripe.com --env dev # real writes to a provider sandbox
oxyc env outbox acme/store dev-x --env dev --json # what messages=capture kept
oxyc env reset acme/store dev-x --plane storage,secrets,messages --env dev # start those planes over
Which mode tests what, every plane and its modes, the full preset, reset,
expiry, the caps and each refusal with its fix are in
references/environment-branches.md. Read
it before setting any plane. Three rules hold whatever you choose: production
has no planes; oltp=branch|empty and airhouse=branch|snapshot are
sandbox-only; ctx.airway.run is refused outside production.
(--data has no short form — don't write -d.)
Iterate from publish as the code changes — each publish is a new build, and
the sandbox always serves the newest. A sandbox build reaches production
only through staging: a person runs oxyc promote <app> --from dev-<handle>
(the build you verified becomes staging's), checks it there, then oxyc promote <app>.
Staff only (needs develop_apps + manage_apps) — or a sandbox agent token
such staff approved; a publish token is refused on every sandbox operation,
so CI cannot use one.
What the checks found on staging's build. Every build that reaches
staging is checked: it builds and validates, its "check": true functions
pass, it loads on desk and phone, it follows the design system. The platform
starts a GitHub Actions run that does it and keeps the results on the build.
The page is opened as a reader: a /fn call or any other write it makes while
it mounts does not go through and shows as a warning, so the first screen has
to mount without one. It is also given nothing from another host: a font,
a script, an image or a tag another origin serves is not loaded while the
build is checked, and no WebSocket is opened (each a warning). So ship fonts
and libraries in the app's own bundle, and load anything optional from
elsewhere so that its absence throws nothing: an app that cannot mount
without a script from a CDN fails the check, and the failure names what was
not sent. oxyc checks show <app> --env dev prints the
results: who ran them, then one line per check with the findings (file:line message) under any that failed; --build <id> reads another build, --wait
polls until none is running, and --json gives the server's body. Exit 9
means they failed, 0 passed, running or none run. If it says the runner did
not answer, run the checks again from the app's Builds page. It needs a
person's login: a sandbox agent token is refused, here and on oxyc checks run --build, which is the command that run executes. Whether a promote waits on
them is the org's setting (above): oxyc promote <app> --dry-run says which
checks are required.
Every screen, and what changed. Where the org holds Promote on the checks,
two more run on staging's build. Every screen opens: each screen at desk
(1440x900) and phone (390x844) width has to render and throw nothing. What
changed: each screen is pictured on staging and on production and the two
are compared, so a person sees which screens differ before promoting (it
informs, and never fails a build). The same reader opens them, so every
screen has to render without a write, without a /fn call, and without
anything from another host. useQuery
and useSemanticQuery go through; a screen that loads its data through an Oxy
Function sees that call refused (a warning, not a failure), so it must still
render and throw nothing: an empty or error state is enough.
oxy-app.json: "checks": { "screens": ["", "stores", "reorder/plans"] }, app-relative paths, "" for the root.
With none declared, the checker reads the ready root page's <a href>
links to other screens of the app (at most 30) and clicks nothing: a
screen reached only by a button or a tab is not found, so declare its path.
An app that picks its screen by a query declares the query:
"?module=waste", "stores?tab=open". Without it the checker opens such
an app's root and nothing else, because a link's query is dropped when the
screens are read off the root page. A screen that exists only as a hash
route (#/plans) cannot be declared and is not opened: the checker drops
the hash.checks.screens in step with the router, in the same change. When
you add, rename or remove a route, open the app's route table and rewrite
the list from it: every static path, the root first, then the order of the
navigation, at most 30. Do it without being asked: a screen missing from
the list is a screen no check opens, and nothing fails to tell anyone.
Leave out a route that only redirects, and say in your summary which
routes you left out and why.oxyc checks show <app> prints, under Every screen
opens, ! 3 linked screens not opened: /plans, … (the app's Builds page
says the same; --json has them as detail.screens_unlisted). Declare the
ones that matter and publish again.oxyc checks show <app> --environment production prints the check that
ran on production after a promote.An agent runs this loop on its own sandbox agent token, never a person's
login, with --token-env OXY_TOKEN on every command — up to the page:
checks run --browser and oxyc proxy --app <org>/<app> --app-env dev-x let
it check what a person sees in its own sandbox. The loop at a glance, the
mint, exit codes, rules and what to hand back are in
references/sandbox-agent-loop.md. Read it
before an agent runs any oxyc command against a deployment.
A sandbox isolates the app, not the workspace. The semantic model,
automations and Airway pipelines it reads are main's. To try a workspace
branch, open a workspace preview (staff only, oxyc preview …), or publish to
the sandbox with --semantic-branch <branch>, or set the planes above — see
references/sandbox-agent-loop.md.
| File | Read it when |
|---|---|
| references/environment-branches.md | You want a sandbox to isolate more than the defaults: its own copy of production's OLTP rows, an Airhouse overlay or snapshot, captured email, empty secrets or storage, real writes to a provider sandbox, a semantic branch, or preview automation runs. Which mode tests what, reset, expiry and every refusal. |
| references/sandbox-agent-loop.md | You are an AI agent about to touch a deployment: the loop at a glance, minting the sandbox agent token, checking the sandbox's page, exit codes, rules, what to hand back, when you cannot get a token, the MCP tools, workspace previews. |
| references/verifying-in-the-browser.md | You changed something a person sees (src/**, or a function a card calls) and need to prove it on the published page. |
| references/reading-data.md | You need a deployment's live data while building: an agent's own --agent token, oxyc api / routes / schema, and oxyc proxy for pnpm dev against cloud data. |
| references/performance-and-usage.md | You write an Oxy Function, a bulk action, caching or idempotency keys — or need to know what Oxy does for load speed and usage tracking, and the opt-outs. |
| references/app-calls.md | One app needs another app's data or rule: callable, calls, ctx.apps.call / send, ctx.caller, AppCallError, the same-environment rule, limits and testing. |
| references/phone-layout.md | A screen people open on a phone: when to build a phone view, the usePhoneLayout() pattern, what each desktop part becomes, and how to check it. |
| references/minimal-starter.md | You are writing an app by hand instead of scaffolding it, or need the smallest correct layout. |
references/app-calls.md (opens in a new tab)references/environment-branches.md (opens in a new tab)references/minimal-starter.md (opens in a new tab)references/performance-and-usage.md (opens in a new tab)references/phone-layout.md (opens in a new tab)references/reading-data.md (opens in a new tab)references/sandbox-agent-loop.md (opens in a new tab)references/verifying-in-the-browser.md (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Other plugins' skills for the same job
npx claudepluginhub oxy-hq/skills --plugin oxy9 skills in this plugin
/oxy-agentsUse when creating, editing, reviewing or debugging an Oxy agent, a `.agentic.yml` file that answers questions from the semantic model by clarifying, specifying, solving (SQL), executing and interpreting. Triggers include "create an analytics agent", "my agent picks the wrong metric", "my solving instructions are ignored", "react ignores config keys", "ignored_keys", "the agent never uses my verified query", "the agent can't see a database", "which tools can a state call", "set thinking, effort, budget_tokens or extended thinking", "per-state model or max_retries", "validation rules", "Cube or Looker semantic_engine", "analytics vs app-builder agent", "`.agent.yml` or `.agentic.yml`", and validating, running (`oxyc agentic run`) or testing (`oxyc evals run`) an agent. Not for writing the semantic model itself (views, topics) or automations./oxy-airway-pipelinesUse when writing, reviewing, or debugging an Oxy Airway ELT pipeline (`.airway.yml`) — sources, the `kind` values Oxy actually wires, credentials, reset, rewind and retry — or when one misbehaves: "unsupported source kind", a pipeline that parses then fails at run time, credentials that do not resolve, a *pipeline* run landing `completed_with_errors` (an *automation* run with that status is `oxy-automations`), a schema that will not change, missing history after a backfill, or duplicate rows. Carries the traps the published pipeline reference does not./oxy-automationsUse when writing, debugging, or reviewing an Oxy automation (a `.automation.yml` / legacy `.procedure.yml` workflow — tasks, loops, variables, schedules) in a customer workspace, or when an automation *run* misbehaves: an `http_request` task that works locally and fails in cloud, a file that is silently not an automation, a task that validates but fails with "unknown task type", SQL that receives JSON instead of a table, or an automation run landing `completed_with_errors`. Covers the file-naming trap, task-type gotchas, running SQL and automations on a deployment with `oxyc run`, and where the authoritative reference lives./oxy-cliUse when you need data out of an Oxy deployment — querying a customer's warehouse or semantic layer, reading threads/runs/apps/orgs, checking why an endpoint 4xxs, or reproducing a customer-reported bug against real data. Also when you need to know which endpoints exist or what body one takes, and (staff) when standing a new customer account up or checking which of its steps have landed. Triggers on "query the customer's data", "what does this API return", "debug this in production/dev", "which endpoint", "check the thread/run/app", "oxyc", "oxy api", "stand up a new customer", "new account setup", "oxyc bootstrap"./oxy-data-architectureUse when deciding where an aggregate gets materialised — writing an `execute_sql` rollup, chaining one after an `airway` ingest step, choosing rollup vs semantic `pre_aggregations`, or whether raw rows must be retained — and on the symptoms: a dashboard that aggregates at query time, a load that wrote every row yet failed, preagg that cannot bucket to 15 minutes or join two views, or no "bronze"/"silver"/"gold" in the schema. Pipeline internals: `oxy-airway-pipelines`; view syntax: `oxy-semantic-modeling`./oxy-evalsUse when writing, running, or acting on evals for an Oxy agent — `.test.yml` files that run an `.agentic.yml` agent and score its answers with an LLM judge — and when the agent's answers are wrong. Triggers: "add a test", "write a test case", "write evals", "test this agent", "evaluate my agent", "bootstrap an eval suite", "fill in expected answers", "run the tests"; and the repair side: "tests are failing", "this test is flaky", "the agent's answer is wrong", "the answer should be X but the agent says Y", "debug this eval", "make this test pass", or pasted `oxyc evals run --output-json` output (or an older `oxy test --output-json` file) or a prompt/response pair to diagnose. Drafts expected answers from observed runs, then diagnoses failures and repairs the agent's semantic model, context and instructions — never the test.