@oxy-hq/cli 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -10,16 +10,23 @@
10
10
  #
11
11
  # Every key is optional. Unknown keys, at any level, are ignored without a
12
12
  # warning by the runtime and by both validators, so spell them exactly.
13
+ #
14
+ # This file uses only keys the default (react) runtime honours. It ignores
15
+ # `states:` tuning other than `solving`'s model and thinking, `validation:`,
16
+ # `semantic_engine:` and automation files in `context:` (SKILL.md, "Runtime").
13
17
 
14
- # -- Global instructions -----------------------------------------------------
15
- # Added to the system prompt of every LLM state. Put the persona, business
16
- # conventions and the views/topics to prefer here; per-state additions go
17
- # under `states:` and are appended, not substituted.
18
+ # -- Instructions --------------------------------------------------------------
19
+ # The agent's system prompt. Put the persona, business conventions, term
20
+ # definitions and the views/topics to prefer here: it is the only place the
21
+ # default runtime reads guidance from (per-state `instructions` are ignored).
18
22
  instructions: |
19
23
  You are a revenue analytics assistant for Acme Corp.
20
24
  Report currency in USD and dates as ISO 8601.
21
25
  "Customer" means the `customers` view, not `users` (which counts seats).
26
+ "Last quarter" means the most recent completed fiscal quarter.
27
+ "MRR" is the `monthly_recurring_revenue` measure on the `revenue` view.
22
28
  Prefer measures from the semantic model over hand-written aggregations.
29
+ When you write SQL, prefer CTEs over subqueries and alias every aggregate.
23
30
 
24
31
  # IANA timezone for "today", "yesterday", "last week". Falls back to the
25
32
  # `timezone:` in config.yml, then UTC. An invalid name fails the run.
@@ -28,115 +35,51 @@ timezone: America/New_York
28
35
  # -- Connections ---------------------------------------------------------------
29
36
  # Names from config.yml `databases:`. The agent can query these PLUS every
30
37
  # database its context files reference (a view's `datasource`, a verified
31
- # query's `database:`, an automation task's `database:`). There is no fallback
32
- # to every database in config.yml: with none at all the run fails with
33
- # "no databases configured".
38
+ # query's `database:`). There is no fallback to every database in config.yml:
39
+ # with none at all the run fails with "no databases configured".
34
40
  databases:
35
41
  - warehouse
36
42
 
37
43
  # -- Context -------------------------------------------------------------------
38
- # Globs relative to THIS file's directory, bucketed by file name:
44
+ # Globs relative to the WORKSPACE ROOT (not this file's directory, if it sits
45
+ # in a subfolder), bucketed by file name:
39
46
  # *.view.yml, *.topic.yml semantic catalog
40
- # *.sql with a /* oxy: ... */ header verified query: found by the
41
- # search_automations tool, run verbatim
42
- # *.sql without that header SQL style examples for `solving`
43
- # *.md notes for `clarifying`/`interpreting`
44
- # *.automation.yml, *.procedure.yml automations the agent may pick and run
45
- # Anything else is ignored.
47
+ # *.sql with a /* oxy: ... */ header verified query, listed in the prompt
48
+ # and run verbatim when chosen
49
+ # *.sql without that header example SQL the agent can search/read
50
+ # *.md notes the agent can search/read
51
+ # Don't list automations (*.automation.yml, *.procedure.yml): the default
52
+ # runtime cannot run one as an answer and leaves them out. Anything else is
53
+ # ignored.
46
54
  context:
47
55
  - ./semantics/**/*.view.yml
48
56
  - ./semantics/**/*.topic.yml
49
57
  - ./verified_queries/*.sql
50
58
  - ./docs/glossary.md
51
- - ./automations/*.automation.yml
52
59
 
53
60
  # -- Model ---------------------------------------------------------------------
54
61
  # `ref` must equal a `name:` under config.yml `models:`; vendor, API key (a
55
62
  # workspace secret in the cloud) and base URL come from that entry. With
56
63
  # neither `ref` nor `model`, the first model in config.yml is used.
57
- # `model` fields here and under `states:` are provider model IDs, not
58
- # config.yml names.
64
+ # `model` fields here are provider model IDs, not config.yml names.
59
65
  llm:
60
66
  ref: claude
61
67
  # Leave max_tokens unset unless you need a hard cap: unset, it is sized from
62
- # the thinking setting. A value you set is used as-is.
68
+ # the thinking setting. A value you set is used as-is. Applied on Anthropic
69
+ # models only; ignored on OpenAI and OpenAI-compatible ones.
63
70
  # max_tokens: 8192
64
71
  #
65
- # Replaces the model AND the thinking setting in every state while the user
66
- # has "extended thinking" switched on. Without this block the toggle does
67
- # nothing.
72
+ # Replaces the model AND the thinking setting while the user has "extended
73
+ # thinking" switched on. Without this block the toggle does nothing.
68
74
  extended_thinking:
69
75
  model: claude-opus-4-8
70
76
  thinking:
71
77
  effort: high
72
78
 
73
79
  # -- Thinking --------------------------------------------------------------------
74
- # A global value REPLACES every state's built-in default (solving: adaptive,
75
- # all others: disabled), so prefer setting it per state below.
76
- # Forms: adaptive | disabled | effort:<level> | {effort: <level>} |
77
- # {budget_tokens: N} (Claude 4.6 and earlier; converted on newer models)
80
+ # Unset, the agent thinks adaptively. Forms: adaptive | disabled |
81
+ # effort:<level> | {effort: <level>} |
82
+ # {budget_tokens: N} (Claude 4.6 and earlier; converted on newer models)
78
83
  # Levels: low | medium | high | xhigh | max. Never `false`.
79
- # thinking: adaptive
80
-
81
- # -- Per-state overrides ---------------------------------------------------------
82
- # Honoured keys: clarifying, specifying, solving, interpreting. (`executing`
83
- # has no LLM; any other key is ignored silently.)
84
- # Fields: instructions, thinking, model (same provider as `llm:`), and
85
- # max_retries = tool-call rounds per visit before the run pauses to ask the
86
- # user whether to continue (clarifying has a fixed limit and ignores it).
87
- states:
88
- clarifying:
89
- instructions: |
90
- "Last quarter" means the most recent completed fiscal quarter.
91
- "MRR" is the `monthly_recurring_revenue` measure on the `revenue` view.
92
- model: claude-haiku-4-5
93
- specifying:
94
- max_retries: 8
95
- solving:
96
- # Runs only when the semantic model could not compile the question, so
97
- # never put guidance every answer needs here.
98
- instructions: Prefer CTEs over subqueries; alias every aggregate.
99
- thinking:
100
- effort: high
101
- max_retries: 4
102
- interpreting:
103
- thinking: disabled
104
-
105
- # -- Result checks (optional) ----------------------------------------------------
106
- # Omit the whole section to run the 15 default checks with default thresholds.
107
- # When present it REPLACES that set: only the rules listed here (and not
108
- # `enabled: false`) run, and a stage with no list is not checked at all.
109
- # This is the full default set with two thresholds tuned.
110
- validation:
111
- rules:
112
- specified:
113
- - name: metric_resolves
114
- - name: join_key_exists
115
- - name: filter_unambiguous
116
- solvable:
117
- - name: sql_syntax
118
- - name: tables_exist_in_catalog
119
- - name: spec_tables_present
120
- - name: column_refs_valid
121
- - name: timeseries_order_by_check
122
- solved:
123
- - name: non_empty
124
- - name: truncation_warning
125
- - name: no_nan_inf
126
- - name: outlier_detection
127
- threshold_sigma: 4.0
128
- min_rows: 6
129
- - name: null_ratio_check
130
- threshold: 0.3
131
- - name: duplicate_row_check
132
- - name: freshness_check
133
-
134
- # -- External semantic engine (optional) -----------------------------------------
135
- # Routes queries through Cube or Looker before Oxy's own semantic model. The
136
- # engine is pinged when a run starts; unreachable fails the run. ${VAR} is read
137
- # from the server's environment and a missing variable fails the run.
138
- #
139
- # semantic_engine:
140
- # vendor: cube # cube | looker
141
- # base_url: https://cube.example.com
142
- # api_token: "${CUBE_API_TOKEN}" # Looker: client_id + client_secret instead
84
+ thinking:
85
+ effort: medium
@@ -134,10 +134,18 @@ provisioned under.
134
134
  `sp_placement` (campaigns by placement: `top_of_search`, `rest_of_search`,
135
135
  `product_pages`, `off_amazon`), and `sp_advertised_product` (spend,
136
136
  clicks and attributed sales per advertised SKU, merged on date, campaign,
137
- ad group and SKU; airway 0.1.66 or later), all daily. List the ones you
138
- need under `resources:`: each is its own report, and a report can take
139
- 30 minutes or more to build. The source only requests and
140
- downloads reports; it never changes a bid, budget or campaign.
137
+ ad group and SKU; airway 0.1.66 or later), and `sp_targeting` (keyword
138
+ and product targets with their bid and top-of-search impression share;
139
+ 0.1.67 or later), all daily reports. From 0.1.67 there are also eight
140
+ daily snapshots of the entity lists: `sp_campaigns`, `sp_ad_groups`,
141
+ `sp_keywords`, `sp_targets`, `sp_negative_keywords`,
142
+ `sp_negative_targets`, `sp_campaign_negative_keywords` and
143
+ `sp_product_ads`, merged on `snapshot_date` and the entity's id. One run
144
+ dates all eight the same, so join them on an equal `snapshot_date`. List
145
+ the ones you need under `resources:`: each report is its own request, and
146
+ a report can take 30 minutes or more to build. The source only reads (it
147
+ requests and downloads reports and lists entities); it never changes a
148
+ bid, budget or campaign.
141
149
  - **Required:** `client_id`, `profile_id` (the advertiser profile, digits
142
150
  only; a number or a string), and `default_start` (`YYYY-MM-DD`). A config
143
151
  without `default_start` is refused. Amazon keeps about 90 days of these
@@ -36,7 +36,7 @@ The canonical extension is **`.automation.yml`**.
36
36
  `.automation.yml` target already exists, or a `.procedure.yml` beside a
37
37
  `.workflow.yml` of the same name, is reported and skipped (still exit 0), so
38
38
  read its warnings and resolve those by hand. The Rust
39
- `oxy migrate-automations` only prints this command now.
39
+ `oxy migrate-automations` is gone; use this command.
40
40
 
41
41
  **Write new files as `.automation.yml`.** Do not copy the extension from a
42
42
  neighbouring file in the workspace you are editing — that is how the legacy name
@@ -82,8 +82,8 @@ Routes follow the same split: `/automations/:id` is canonical;
82
82
 
83
83
  `oxyc run <file> --workspace <id>` (`npm i -g @oxy-hq/cli`) takes a `.sql` file,
84
84
  an `.automation.yml`, or a `.procedure.yml` — nothing else. It runs **on the
85
- deployment**, never on this machine. The Rust `oxy run` is gone: it now prints
86
- the `oxyc` command and exits `2`.
85
+ deployment**, never on this machine. The Rust `oxy run` is gone; use
86
+ `oxyc run`.
87
87
 
88
88
  - **An automation runs what is deployed, not your edit.** The server runs the
89
89
  definition it has compiled for the workspace's served revision, on the worker
@@ -247,6 +247,29 @@ async function completeChecklist(ctx, runId: string, storeGuid: string) {
247
247
  }
248
248
  ```
249
249
 
250
+ **Records in Airhouse, with their history (`oltpChanges`).** Declare tables
251
+ at the app level, beside `migrations`:
252
+
253
+ ```jsonc
254
+ "oltpChanges": { "tables": { "leases": {}, "landlords": { "exclude": ["contact_email"] } } }
255
+ ```
256
+
257
+ Every committed change to a declared table lands in the workspace's Airhouse
258
+ as `oltp_<writer>.<table>__changes` (`_op`, `_changed_at`, `_actor`, `_seq`
259
+ beside the row's columns), with the current state in the view
260
+ `oltp_<writer>.<table>`; `jsonb` and arrays land as JSON text. Your app code
261
+ does not change: capture runs in the same transaction as the write.
262
+
263
+ - A declared table needs a primary key. `exclude` columns never leave
264
+ Postgres, and nothing in Airhouse is purged, so personal data and free
265
+ text belong in `exclude`.
266
+ - Only ever add columns to a captured table. A rename or retype holds that
267
+ table until staff resync it.
268
+ - Only production ships, and only once staff turn `oltp_changes` on for the
269
+ org. The cadence is near real time unless staff pace the org
270
+ (`oxyc oltp changes interval`); staff also have `sync` (a pass now),
271
+ `status` (lag and holds) and `resync`.
272
+
250
273
  ## Asking another app
251
274
 
252
275
  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](references/app-calls.md).
@@ -401,7 +424,7 @@ await ctx.oxygen.sourceUploads.report({ file, fileName, pipeline: "ubereats_tran
401
424
  with `reachOf`).
402
425
 
403
426
  **The dock.** Wrap the app in `<OxyShell>` (every `create-oxy-app` template
404
- does) so it shows Oxygen's rail: Home and the viewer's apps, each drawn as its
427
+ does) so it shows Oxygen's rail and top bar: Home and the viewer's apps, each drawn as its
405
428
  grey mark, opening in this tab and warmed on hover. From SDK 2.34.0 the shell has no
406
429
  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
407
430
  own header. From SDK 2.33.0 the viewer opens and closes the rail from its
@@ -429,7 +452,8 @@ own mode. Run `expect(formatSdkUiCopies(checkSdkUiCopies("src"))).toBe("")` ther
429
452
  variant kept on purpose says why in the file that defines it, `// oxy-ui-local: <Name> -- <why>`
430
453
  (the reason is required). A local that only holds a component (`const Glyph = app.glyph`)
431
454
  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
432
- defect in a shared piece is fixed in the SDK, so every app gets it.
455
+ defect in a shared piece is fixed in the SDK, so every app gets it. Every `create-oxy-app`
456
+ template starts this way, and its `pnpm test` runs both checks.
433
457
 
434
458
  SDK 2.31 adds, each opt-in: `Panel`'s fold (`foldable`, `open`, `defaultOpen`), `header`,
435
459
  optional `title`, landmark (`as`, `label`, `headingLevel`) and `density="compact"`;
@@ -449,6 +473,11 @@ tile across); `AlertStrip`'s per-alert `hint` and `check` tone (the theme's `--s
449
473
  kept a local PanelTable, Subnav, StatGrid, KPI row, AlertStrip or Sparkline for one of these
450
474
  imports the SDK's and deletes its copy.
451
475
 
476
+ SDK 2.35 adds: `ParentTabs` (top bar included) puts the `data-*` props it is given on its root
477
+ `<nav>` (`data-placement` stays its own), and `Panel` puts them on its root. An app that kept a
478
+ local ParentTabs or Panel for a `data-testid` or a guided tour's `data-tour` marker imports the
479
+ SDK's and deletes its copy.
480
+
452
481
  What the pieces settle, so an app doesn't override them (decisions 81–93):
453
482
 
454
483
  - `SidePanel` keeps its overlay shadow; drop any `shadow-none` (81).
@@ -842,6 +871,32 @@ first and refuse on a blocker: `staging_never_served`, `required_secrets_unset`
842
871
  `oxyc publish --promote` still works and warns that it is deprecated: it shows
843
872
  nobody the plan.
844
873
 
874
+ **An org can hold Promote on a build's checks** (Oxy turns this on per org).
875
+ The plan then lists each check of the build, the required ones marked, and
876
+ three more blockers can refuse a promote to production:
877
+
878
+ - `checks_not_passed`: a required check failed, could not run, or never ran.
879
+ By default the required ones are: its `"check": true` functions pass, it
880
+ loads on desk and phone, it follows the design system, and every screen
881
+ opens. Fix what the check found and publish again; `oxyc checks show <app>
882
+ --build <id>` prints each finding.
883
+ - `checks_running`: a required check has no verdict yet. `oxyc checks show
884
+ <app> --build <id> --wait`, then promote again.
885
+ - `changes_not_seen`: the app is set to need a person to look at the screens
886
+ that changed. They mark them seen on the app's Builds page.
887
+
888
+ To promote past a failed check, an owner or admin of the app's org passes
889
+ `--override-checks "<why>"` (10 characters or more; it is audited, and it
890
+ clears those three blockers only). A publish token, a CI token and a service
891
+ account cannot. **As an agent, never pass `--override-checks` on your own**:
892
+ report the failed check and let a person decide. A rollback is never held by
893
+ the checks.
894
+
895
+ After a promote that is checked, `oxyc promote` waits up to 5 minutes while
896
+ the platform opens every screen on production, and **exits `9` if that found
897
+ something the move broke** (production has moved; `oxyc rollback <app>
898
+ --app-env production` moves it back). `--no-wait` skips the wait.
899
+
845
900
  - **Identity**, for each half, is `--app` / `--org`, then `OXY_APP` /
846
901
  `OXY_ORG`, then the manifest's `slug` + `orgSlug`, then an
847
902
  `apps/<org>/<app>/` working directory. `--org` takes a slug or a UUID; pass
@@ -1088,6 +1143,71 @@ Staff only (needs `develop_apps` + `manage_apps`) — or a sandbox agent token
1088
1143
  such staff approved; a publish token is refused on every sandbox operation,
1089
1144
  so CI cannot use one.
1090
1145
 
1146
+ **What the checks found on staging's build.** Every build that reaches
1147
+ staging is checked: it builds and validates, its `"check": true` functions
1148
+ pass, it loads on desk and phone, it follows the design system. The platform
1149
+ starts a GitHub Actions run that does it and keeps the results on the build.
1150
+ The page is opened as a reader: a `/fn` call or any other write it makes while
1151
+ it mounts does not go through and shows as a warning, so the first screen has
1152
+ to mount without one. **It is also given nothing from another host**: a font,
1153
+ a script, an image or a tag another origin serves is not loaded while the
1154
+ build is checked, and no WebSocket is opened (each a warning). So ship fonts
1155
+ and libraries in the app's own bundle, and load anything optional from
1156
+ elsewhere so that its absence throws nothing: an app that cannot mount
1157
+ without a script from a CDN fails the check, and the failure names what was
1158
+ not sent. `oxyc checks show <app> --env dev` prints the
1159
+ results: who ran them, then one line per check with the findings (`file:line
1160
+ message`) under any that failed; `--build <id>` reads another build, `--wait`
1161
+ polls until none is running, and `--json` gives the server's body. Exit `9`
1162
+ means they failed, `0` passed, running or none run. If it says the runner did
1163
+ not answer, run the checks again from the app's Builds page. It needs a
1164
+ person's login: a sandbox agent token is refused, here and on `oxyc checks run
1165
+ --build`, which is the command that run executes. Whether a promote waits on
1166
+ them is the org's setting (above): `oxyc promote <app> --dry-run` says which
1167
+ checks are required.
1168
+
1169
+ **Every screen, and what changed.** Where the org holds Promote on the checks,
1170
+ two more run on staging's build. **Every screen opens**: each screen at desk
1171
+ (1440x900) and phone (390x844) width has to render and throw nothing. **What
1172
+ changed**: each screen is pictured on staging and on production and the two
1173
+ are compared, so a person sees which screens differ before promoting (it
1174
+ informs, and never fails a build). The same reader opens them, so every
1175
+ screen has to render **without a write, without a `/fn` call, and without
1176
+ anything from another host**. `useQuery`
1177
+ and `useSemanticQuery` go through; a screen that loads its data through an Oxy
1178
+ Function sees that call refused (a warning, not a failure), so it must still
1179
+ render and throw nothing: an empty or error state is enough.
1180
+
1181
+ - **Which screens.** Declare them in `oxy-app.json`: `"checks": { "screens":
1182
+ ["", "stores", "reorder/plans"] }`, app-relative paths, `""` for the root.
1183
+ With none declared, the checker reads the ready root page's `<a href>`
1184
+ links to other screens of the app (at most 30) and **clicks nothing**: a
1185
+ screen reached only by a button or a tab is not found, so declare its path.
1186
+ **An app that picks its screen by a query declares the query**:
1187
+ `"?module=waste"`, `"stores?tab=open"`. Without it the checker opens such
1188
+ an app's root and nothing else, because a link's query is dropped when the
1189
+ screens are read off the root page. A screen that exists only as a hash
1190
+ route (`#/plans`) cannot be declared and is not opened: the checker drops
1191
+ the hash.
1192
+ - **Keep `checks.screens` in step with the router, in the same change.** When
1193
+ you add, rename or remove a route, open the app's route table and rewrite
1194
+ the list from it: every static path, the root first, then the order of the
1195
+ navigation, at most 30. Do it without being asked: a screen missing from
1196
+ the list is a screen no check opens, and nothing fails to tell anyone.
1197
+ Leave out a route that only redirects, and say in your summary which
1198
+ routes you left out and why.
1199
+ - **A screen that needs data to exist** (a detail page for one record) should
1200
+ be declared with a path that exists on staging and on production, or left
1201
+ out. Never invent a record id: ask the person for one that exists in both,
1202
+ or leave the route out and say so.
1203
+ - **What the list misses is reported.** The checker reads the links of every
1204
+ screen it opens, and `oxyc checks show <app>` prints, under **Every screen
1205
+ opens**, `! 3 linked screens not opened: /plans, …` (the app's Builds page
1206
+ says the same; `--json` has them as `detail.screens_unlisted`). Declare the
1207
+ ones that matter and publish again.
1208
+ - **`oxyc checks show <app> --environment production`** prints the check that
1209
+ ran on production after a promote.
1210
+
1091
1211
  **An agent runs this loop on its own sandbox agent token**, never a person's
1092
1212
  login, with `--token-env OXY_TOKEN` on every command — up to the page:
1093
1213
  `checks run --browser` and `oxyc proxy --app <org>/<app> --app-env dev-x` let
@@ -41,8 +41,10 @@ Reference docs (field tables, CI usage):
41
41
  automation files are gone too. A `.test.yml` file is the only entry point.
42
42
  - **Only the final answer text is judged.** The judge sees the question, `expected`, and the
43
43
  agent's answer. It doesn't see the SQL, the tool calls, or the rows.
44
- - **`tool:` on a case is accepted but not enforced.** It has no effect on pass/fail. Don't
45
- rely on it to assert that the agent used a particular path.
44
+ - **Behaviour is checked separately, by an `expect:` block** (see "Behaviour checks" below):
45
+ whether the agent asked a clarifying question, drew a chart, hit a pre-aggregation, which
46
+ source its answer's query came from, and which tools it called. These are read from the
47
+ run's events, not judged. `tool: <name>` on a case is shorthand for `expect.tools: [<name>]`.
46
48
 
47
49
  ## The `.test.yml` format
48
50
 
@@ -65,13 +67,14 @@ cases:
65
67
  Rules the parser enforces:
66
68
 
67
69
  - **Unknown keys are rejected at every level** (file, `settings`, each case). A typo such as
68
- `judge-model:` or `expect:` makes the file fail to parse. Run it by path and
70
+ `judge-model:` or `expects:` makes the file fail to parse. Run it by path and
69
71
  `oxyc evals run` exits `6` with `Failed to deserialize test config …`. **Run with no file
70
72
  and a broken file is skipped silently.** It just isn't in the run, with no error. A file
71
73
  that isn't valid YAML, or has no `cases:` list, isn't compiled at all, so by path it answers
72
74
  exit `5` (not in the served revision), as if it had never been pushed. After pushing a test
73
75
  file, run it by path once.
74
- - **`prompt` and `expected` are required strings.** Everything else is optional.
76
+ - **`prompt` is required, and so is `expected`** unless the case has an `expect:` block (or
77
+ `tool:`): such a case can be graded on its behaviour alone. Everything else is optional.
75
78
  - **`target`** is resolved from the project root (the directory holding `config.yml`). If you
76
79
  omit it, it's inferred from the filename, in the same directory: `sales.agentic.test.yml`
77
80
  targets `sales.agentic.yml` beside it. Tests kept in a separate `tests/` folder must set
@@ -82,6 +85,40 @@ Rules the parser enforces:
82
85
  be resolved from project config`). Google/Gemini models can't be used. Prefer a judge from a
83
86
  different model family than the agent's, to avoid self-preference bias.
84
87
 
88
+ ### Behaviour checks (`expect:`)
89
+
90
+ An optional per-case block. Every field is optional; a case fails when any field it sets is
91
+ unmet, and the record names each unmet one in `unmet_expectations` (and at the end of `cot`).
92
+
93
+ ```yaml
94
+ cases:
95
+ - name: ambiguous-region
96
+ prompt: What were sales in the region?
97
+ expect:
98
+ asks_user: true # the run must stop on a clarifying question
99
+ - name: weekly-revenue-chart
100
+ prompt: Chart weekly revenue for November 2025
101
+ expected: A weekly revenue series for November 2025
102
+ expect:
103
+ chart: true # a chart was drawn (a plain table does not count)
104
+ preagg: true # a successful query was served from a pre-aggregation
105
+ query_source: semantic # the answer's query: semantic | llm | vendor | verified_sql
106
+ tools: [query] # tools that must be called, by the runtime's own names
107
+ ```
108
+
109
+ - **A case with `expect:` and no `expected` is not judged.** It passes on its expectations
110
+ alone.
111
+ - **`asks_user: true`** makes a clarifying question a graded outcome: the question becomes the
112
+ record's `actual_output`, the answer text is not judged, and the case passes. A run that
113
+ answers instead fails. Without it, a question is still a run error.
114
+ - **Evals run an agent on react by default**, as chats do. An agent react cannot serve (no
115
+ database, `semantic_only` with no views, a database with no read-only connection) runs on
116
+ the older FSM runtime instead, and `runtime: fsm` in the `.agentic.yml` pins it there;
117
+ each record's `runtime` (`react` or `fsm`) says which one ran. Tool names differ between the
118
+ two, so prefer the flags to `tools:` when a case must hold for both.
119
+ - What the run did is in every agentic record's `observed` object, met or not; check it when
120
+ writing an expectation.
121
+
85
122
  Naming and placement: `<agent-stem>.<topic>.test.yml` (for example
86
123
  `sales.performance.test.yml`) in the folder the project already uses for tests. With no file,
87
124
  `oxyc evals run` runs every `*.test.yml` the workspace compiled, except under hidden
@@ -105,7 +142,8 @@ Naming and placement: `<agent-stem>.<topic>.test.yml` (for example
105
142
  - **Make prompts specific enough to answer without a follow-up question.** Tests run
106
143
  headless. If the agent stops to ask the user something, the run ends as an **error**
107
144
  (`agentic pipeline asked a clarifying question: …`), which counts as a FAIL. An ambiguous
108
- prompt shows up as a run error, not as a wrong answer.
145
+ prompt shows up as a run error, not as a wrong answer. The exception is a case written to
146
+ test exactly that, with `expect: {asks_user: true}`.
109
147
  - **Test one thing per case.** "Revenue by region and the top product in each" is two cases.
110
148
  - **Name every case** (`name:`), with a short stable slug.
111
149
 
@@ -190,7 +228,9 @@ oxyc evals wait <run-id> --workspace <id> --json
190
228
  actual answers are only in the results document.
191
229
  - `--regrade <results.json>` grades a results file's recorded answers again, without running
192
230
  the agent. It needs the test file the results came from, and can't be combined with
193
- `--case` or `--tag`.
231
+ `--case` or `--tag`. Each run is held to the `expect:` checks of the test-file case with
232
+ the same prompt, read from the test file as it is now; a recorded clarifying question its
233
+ case no longer expects is a run error, as on a fresh run.
194
234
  - `--min-accuracy` compares **per-file** scores. `--threshold-mode average` (the default)
195
235
  checks the mean across files, and `all` checks every file. It doesn't check individual
196
236
  cases.
@@ -285,7 +325,9 @@ oxyc agentic run <path/to/agent.agentic.yml> -q "<the case's prompt>" --json --w
285
325
  ```
286
326
 
287
327
  This runs the deployed agent, as the evals do, and streams the run's events as JSON lines. Look at
288
- `query_executed`: its `query`, its `rows`, and its `source`. `source` is `semantic` (compiled
328
+ `query_executed`: its `query`, its `rows`, its `row_count` and its `source`. `rows` is only a
329
+ preview (a react run sends the first 10; `row_count` is the full count), so judge a result's
330
+ size by `row_count`, not by counting `rows`. `source` is `semantic` (compiled
289
331
  by the semantic model), `llm` (SQL the model wrote), `verified_sql` (a Verified Query), or
290
332
  `vendor`. Also look at `analytics_validation_failed`, the checks that bounced the agent. If
291
333
  the project exports traces to Oxy's observability, the run's trace shows the same steps.
@@ -298,7 +340,7 @@ the project exports traces to Oxy's observability, the run's trace shows the sam
298
340
  | B. Missing or unfindable measure | `source: llm` where a measure should have answered, or arithmetic done in the answer | a measure, or its name and description |
299
341
  | C. Instructions vague or misdirecting | wrong interpretation, varying definitions across runs | `instructions:` or a `.md` context doc |
300
342
  | D. Canonical answer exists as SQL | the same question keeps producing different SQL | a Verified Query |
301
- | E. Validation rejects a correct result | `analytics_validation_failed` loops, `max iterations exceeded` | `validation:` |
343
+ | E. Validation rejects a correct result (`runtime: fsm` only) | `analytics_validation_failed` loops, `max iterations exceeded` | `validation:` |
302
344
  | F. Judge false negative | `cot` agrees with the expected answer, `choice` is FAIL | report it. Don't touch the agent |
303
345
  | G. Prompt underspecified | clarifying-question errors, different readings across runs | report it, and propose a sharper prompt |
304
346
  | H. Data unavailable | no view or table holds it | report it. Don't fake support |
@@ -313,7 +355,7 @@ Symptoms, evidence, and a worked fix for each:
313
355
  catalog search matches a measure's **name**, its **description** and its **view name**. It
314
356
  doesn't read `synonyms:`, so the words users ask with belong in the description. A view
315
357
  that no `context:` glob matches doesn't exist as far as the agent is concerned.
316
- 2. **Context** (`context:` globs, relative to the agent file):
358
+ 2. **Context** (`context:` globs, relative to the workspace root):
317
359
  - **`.md` docs** go into the prompts for clarifying the question and writing the answer.
318
360
  Use them for business definitions: the fiscal calendar, what "active customer" means,
319
361
  which of two similar measures to use.
@@ -321,11 +363,11 @@ Symptoms, evidence, and a worked fix for each:
321
363
  carries a `description:`. When the agent's search matches its file name or description,
322
364
  the SQL runs verbatim, with no SQL generation. A `.sql` file **without** that block is
323
365
  only a style example for SQL generation, and is never run as an answer.
324
- 3. **Instructions:** top-level `instructions:` reaches every LLM call. `states.<state>.
325
- instructions:` reaches one stage: `clarifying`, `specifying`, `solving` or `interpreting`.
366
+ 3. **Instructions:** top-level `instructions:` reaches every LLM call. The default (react)
367
+ runtime ignores `states.<state>.instructions:`, so put every rule at the top level.
326
368
  Write general rules ("revenue means net of refunds", "rank by units unless asked
327
369
  otherwise"). Never put the expected answer, or a number from it, into instructions.
328
- 4. **Validation:** the `validation:` block **replaces** the 15 default rules rather than
370
+ 4. **Validation** (`runtime: fsm` only; react ignores it): the `validation:` block **replaces** the 15 default rules rather than
329
371
  adjusting them. To switch off or retune one rule, list every rule that should still run.
330
372
  An empty `validation: {}` disables them all.
331
373
 
@@ -8,8 +8,8 @@ Diagnose before editing. For every failing or flaky case, collect:
8
8
  It runs the deployed (pushed) agent, as `oxyc evals run` does. Run it two or three times if the case is flaky. Read `query_executed.source` and `query`, and any
9
9
  `analytics_validation_failed` events.
10
10
  3. The files the agent actually loads: the `context:` globs in its `.agentic.yml`, resolved
11
- relative to that file's directory. A view, doc or SQL file outside those globs doesn't
12
- exist for this agent.
11
+ relative to the workspace root (not that file's directory). A view, doc or SQL file
12
+ outside those globs doesn't exist for this agent.
13
13
 
14
14
  Then name one category below. If two apply, fix the earlier one first. Most failures are
15
15
  **A** or **B**.
@@ -96,25 +96,19 @@ convention.
96
96
 
97
97
  - **A definition or a business fact** goes in a `.md` doc matched by `context:`. Docs are
98
98
  injected into the prompts that clarify the question and write the answer.
99
- - **A rule for every step** goes in top-level `instructions:`.
100
- - **A rule for one stage** goes in `states.<state>.instructions`, for one of `clarifying`
101
- (reading the question), `specifying` (choosing measures and filters), `solving` (writing
102
- SQL) or `interpreting` (writing the answer).
99
+ - **A rule** goes in top-level `instructions:`. The default (react) runtime reads guidance
100
+ from there only and ignores `states.<state>.instructions`, so don't put it per stage.
103
101
 
104
102
  ```yaml
105
103
  instructions: |
106
104
  "Revenue" means net revenue (after refunds and discounts) unless the user says gross.
107
- states:
108
- clarifying:
109
- instructions: |
110
- Read "last quarter" as the most recent completed fiscal quarter; the fiscal year starts
111
- on 1 February.
112
- interpreting:
113
- instructions: State the period and every filter applied in the answer's first sentence.
105
+ Read "last quarter" as the most recent completed fiscal quarter; the fiscal year starts
106
+ on 1 February.
107
+ State the period and every filter applied in the answer's first sentence.
114
108
 
115
109
  context:
116
- - ../semantics/**/*.view.yml
117
- - ../semantics/**/*.topic.yml
110
+ - ./semantics/**/*.view.yml
111
+ - ./semantics/**/*.topic.yml
118
112
  - ./docs/*.md
119
113
  ```
120
114
 
@@ -154,7 +148,8 @@ that end in `max iterations exceeded`, or answers that drift away from the right
154
148
  retry. Common causes: `non_empty`, when "none" is a correct answer; `outlier_detection` on
155
149
  naturally spiky data; and `freshness_check` on a source that loads late.
156
150
 
157
- **Fix:** retune the rule. The `validation:` block **replaces** the default set, so list every
151
+ **Fix:** this applies to `runtime: fsm` agents only; the default (react) runtime runs no
152
+ validation rules and ignores `validation:`. On the FSM, retune the rule. The `validation:` block **replaces** the default set, so list every
158
153
  rule that should still run. A stage you leave out isn't checked at all, and a misspelled rule
159
154
  name stops the agent from loading. The 15 defaults:
160
155
 
@@ -51,7 +51,7 @@ set:
51
51
  ]
52
52
  ```
53
53
 
54
- What is **not** in it: the SQL, the tool calls, the rows the agent saw. Records for an
54
+ What is **not** in it: the SQL, the tool calls' inputs and outputs, the rows the agent saw. Records for an
55
55
  `.agentic.yml` target carry no `references` array. Diagnose the path with the commands under
56
56
  "Seeing what the agent did" below.
57
57
 
@@ -66,7 +66,9 @@ What is **not** in it: the SQL, the tool calls, the rows the agent saw. Records
66
66
  | `choice` | The parsed verdict. Compare it with `cot` to spot judge parse problems. |
67
67
  | `score` | `choice` as a number. |
68
68
  | `duration_ms`, `*_tokens` | Cost and latency of the agent run, not of the judge. Zero on errored runs. |
69
- | `errors` | The error text of every run that never answered, in run order. |
69
+ | `observed` | What the run did, read off its events: `tools` (every call's name, in order), `query_sources` (each successful query's source), `answer_source`, `preagg`, `charts`, and `asked_user` (the clarifying question it stopped on). Absent on errored runs. |
70
+ | `unmet_expectations` | The case's `expect:` checks the run failed, each named. Absent when all were met or none were set. |
71
+ | `errors` | The error text of every run that never answered, in run order. A clarifying question its case expects (`asks_user: true`) is not an error; any other is. |
70
72
  | `stats.answered` vs `total_attempted` | The answer rate. A gap means runs ended in errors. |
71
73
 
72
74
  ## Ordering
@@ -139,7 +141,9 @@ diagnosis:
139
141
  | `semantic_shortcut_attempted` / `semantic_shortcut_resolved` | whether the semantic model answered directly |
140
142
  | `spec_resolved` | the tables, joins and assumptions the agent settled on |
141
143
  | `query_generated` | SQL the model wrote |
142
- | `query_executed` | `query`, `row_count`, `rows` (a preview), `error`, and `source`: `semantic`, `llm`, `verified_sql` or `vendor` |
144
+ | `query_executed` | `query`, `row_count` (the full count), `rows` (a preview: a react run sends the first 10), `error`, and `source`: `semantic`, `llm`, `verified_sql` or `vendor` |
145
+ | `result_table` | a react run only: the answer's result, its first 50 `rows`, `columns`, `column_kinds`, and `row_count` |
146
+ | `result_chart` | a react run only: a chart the agent drew, `kind`, `x`, `y`, `series`, and its own `rows` as `[x, series?, y…]` |
143
147
  | `analytics_validation_failed` | `state`, `reason`: a check that sent the agent back to retry |
144
148
 
145
149
  Run it two or three times for a flaky case. Different `source` values or different SQL across
@@ -95,8 +95,8 @@ resolves relative dates against today in its `timezone:` (UTC when unset).
95
95
  missing, so you can't tell which half broke.
96
96
  - **Propose a rewrite** when the runs answer different, reasonable readings of the prompt
97
97
  (net or gross, calendar or fiscal year), or when the agent stops to ask a clarifying
98
- question. That ends the run as an error. Show the user the readings you saw, and let them
99
- choose.
98
+ question. That ends the run as an error (unless the case sets `expect: {asks_user: true}`,
99
+ to test that the agent asks). Show the user the readings you saw, and let them choose.
100
100
  - **Flag, don't draft,** when no view or table holds the data. That's a gap in the agent, not
101
101
  something a test can fix.
102
102
 
@@ -317,7 +317,7 @@ pre_aggregations:
317
317
  (`inherits_from:`, `{{ globals.* }}`), a malformed `{{variables.x}}`. Run it
318
318
  on every file you touch. It does **not** look inside `pre_aggregations:` or
319
319
  `refresh_key:`; mistakes there surface only when the model is loaded for a
320
- query. (`oxy validate` is a stub now that prints this command.)
320
+ query. (The Rust `oxy validate` is gone; use this command.)
321
321
  - Bare **`oxyc validate`** (every file) checks views and topics wherever they
322
322
  are, as the compiler finds them — not only under `semantics/`. It exits `9`
323
323
  when anything fails.
@@ -328,7 +328,7 @@ pre_aggregations:
328
328
  to `.databases/`, which is the place to read real column names from. The
329
329
  server introspects the warehouse from the DEPLOYED `config.yml` and `oxyc`
330
330
  writes the files into the checkout (`-o` to replace existing ones). The old
331
- `oxy sync` only prints this command now.
331
+ `oxy sync` is gone; use this command.
332
332
  - `inherits_from:` and `{{ globals.* }}` were removed from views; a file using
333
333
  either is refused at load. Inline the values.
334
334