@datagrok/grokky 1.0.4 → 1.1.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.
- package/.claude/skills/deploy-grokky/SKILL.md +193 -0
- package/.grokignore +2 -0
- package/.turbo/turbo-build.log +24 -0
- package/.vscode/settings.json +16 -0
- package/CHANGELOG.md +151 -8
- package/CLAUDE.md +284 -0
- package/CREDITS.md +173 -0
- package/LICENSE.md +16 -0
- package/README.md +24 -0
- package/bdd/bdd.config.json +1 -0
- package/bdd/bindings/elements.ts +9 -0
- package/bdd/bindings/steps.ts +787 -0
- package/bdd/features/ai-panel/platform-work.feature +63 -0
- package/bdd/features/ai-panel/session.feature +69 -0
- package/bdd/features/ai-panel/table-work.feature +99 -0
- package/bdd/generated/ai-panel/platform-work.test.ts +103 -0
- package/bdd/generated/ai-panel/session.test.ts +100 -0
- package/bdd/generated/ai-panel/table-work.test.ts +150 -0
- package/bdd/package.json +1 -0
- package/bdd/tsconfig.json +13 -0
- package/css/ai.css +637 -49
- package/dist/package-test.js +4 -1707
- package/dist/package-test.js.map +1 -1
- package/dist/package.js +742 -92317
- package/dist/package.js.map +1 -1
- package/dockerfiles/claude-runtime/.dockerignore +1 -0
- package/{.eslintrc.json → dockerfiles/claude-runtime/.eslintrc.json} +7 -16
- package/dockerfiles/claude-runtime/Dockerfile +73 -13
- package/dockerfiles/claude-runtime/agent/grokky_agent/__init__.py +0 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/__main__.py +80 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/browser_tools.py +180 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/config.py +26 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/formats.py +155 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/guard.py +87 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.py +212 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.yaml +45 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/__init__.py +8 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/plugin.yaml +3 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/protocol.py +174 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/__init__.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/anthropic.py +21 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/azure.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/base.py +127 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/bedrock.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/custom.py +40 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/databricks.py +54 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openai_platform.py +41 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openrouter.py +46 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/session.py +471 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/skills.py +44 -0
- package/dockerfiles/claude-runtime/agent/grokky_agent/structured.py +40 -0
- package/dockerfiles/claude-runtime/container.json +2 -2
- package/dockerfiles/claude-runtime/entrypoint.sh +20 -0
- package/dockerfiles/claude-runtime/package-lock.json +1721 -306
- package/dockerfiles/claude-runtime/package.json +20 -5
- package/dockerfiles/claude-runtime/plugin/.claude-plugin/plugin.json +5 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-calc-column/SKILL.md +92 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-data/SKILL.md +250 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-toolkit/SKILL.md +395 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-df-and-columns/SKILL.md +454 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-entities/SKILL.md +38 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-exec/SKILL.md +209 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-filtering/SKILL.md +185 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-grid-customization/SKILL.md +270 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-projects/SKILL.md +100 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-selection/SKILL.md +344 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-undo/SKILL.md +78 -0
- package/dockerfiles/claude-runtime/plugin/skills/datagrok-viewers/SKILL.md +303 -0
- package/dockerfiles/claude-runtime/pyproject.toml +18 -0
- package/dockerfiles/claude-runtime/src/agent/pool.ts +411 -0
- package/dockerfiles/claude-runtime/src/agent/turn.ts +153 -0
- package/dockerfiles/claude-runtime/src/constants.ts +20 -0
- package/dockerfiles/claude-runtime/src/credentials.ts +45 -0
- package/dockerfiles/claude-runtime/src/grounding.ts +104 -0
- package/dockerfiles/claude-runtime/src/help-index.ts +118 -0
- package/dockerfiles/claude-runtime/src/privileges.ts +8 -0
- package/dockerfiles/claude-runtime/src/prompts.ts +211 -0
- package/dockerfiles/claude-runtime/src/server.ts +134 -234
- package/dockerfiles/claude-runtime/src/session.ts +328 -0
- package/dockerfiles/claude-runtime/src/shared-api-client.ts +112 -0
- package/dockerfiles/claude-runtime/src/stream-filter.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/home-files.ts +80 -0
- package/dockerfiles/claude-runtime/src/sync/orchestrator.ts +214 -0
- package/dockerfiles/claude-runtime/src/sync/packages.ts +145 -0
- package/dockerfiles/claude-runtime/src/sync/shared-connections.ts +87 -0
- package/dockerfiles/claude-runtime/src/sync/workspace.ts +68 -0
- package/dockerfiles/claude-runtime/src/tasks.ts +124 -0
- package/dockerfiles/claude-runtime/src/tool-summary.ts +66 -0
- package/dockerfiles/claude-runtime/src/types.ts +142 -23
- package/dockerfiles/claude-runtime/src/user/installed-packages.ts +17 -0
- package/dockerfiles/claude-runtime/src/user/staged-workspace.ts +80 -0
- package/dockerfiles/claude-runtime/src/user/user-dir.ts +108 -0
- package/dockerfiles/claude-runtime/src/verify.ts +136 -0
- package/dockerfiles/claude-runtime/src/watchdog.ts +115 -0
- package/dockerfiles/claude-runtime/test/credentials.test.js +43 -0
- package/dockerfiles/claude-runtime/test/grounding.test.js +191 -0
- package/dockerfiles/claude-runtime/test/help-index.test.js +115 -0
- package/dockerfiles/claude-runtime/test/plugin-skills.test.js +57 -0
- package/dockerfiles/claude-runtime/test/prompts.test.js +62 -0
- package/dockerfiles/claude-runtime/test/reaper.test.js +60 -0
- package/dockerfiles/claude-runtime/test/stream-filter.test.js +132 -0
- package/dockerfiles/claude-runtime/test/tasks.test.js +74 -0
- package/dockerfiles/claude-runtime/test/user-dir.test.js +71 -0
- package/dockerfiles/claude-runtime/test/verify.test.js +187 -0
- package/dockerfiles/claude-runtime/test/watchdog.test.js +43 -0
- package/dockerfiles/mcp-server/.eslintrc.json +39 -0
- package/dockerfiles/mcp-server/Dockerfile +10 -2
- package/dockerfiles/mcp-server/package-lock.json +1743 -98
- package/dockerfiles/mcp-server/package.json +27 -5
- package/dockerfiles/mcp-server/src/api-client.ts +123 -66
- package/dockerfiles/mcp-server/src/format.ts +51 -0
- package/dockerfiles/mcp-server/src/index.ts +44 -113
- package/dockerfiles/mcp-server/src/ops.ts +325 -0
- package/dockerfiles/mcp-server/src/shared-api-client.ts +81 -0
- package/dockerfiles/mcp-server/test/format.test.js +62 -0
- package/dockerfiles/mcp-server/test/ops.test.js +84 -0
- package/dockerfiles/mcp-server/test/shared-api-client.test.js +35 -0
- package/dockerfiles/queue/Dockerfile +2 -0
- package/dockerfiles/queue/container.json +7 -0
- package/docs/AUDIT-2026-08-03.md +1064 -0
- package/docs/BENCHMARK.md +292 -0
- package/docs/CLAUDE_CODE_FLOW.md +746 -0
- package/docs/EXAMPLES.md +82 -0
- package/docs/FEATURES.md +71 -0
- package/docs/IMPLEMENTATION.md +128 -0
- package/docs/LATENCY.md +170 -0
- package/docs/VISION.md +36 -0
- package/files/benchmark/suite.yaml +404 -0
- package/files/scripts/process-cro-results.md +14 -0
- package/files/suggestions.yaml +344 -0
- package/package.json +39 -97
- package/src/ai/ai-window.ts +157 -0
- package/src/ai/benchmark/benchmark.ts +737 -0
- package/src/ai/db-view-functions.ts +56 -0
- package/src/ai/engine.ts +98 -0
- package/src/ai/gemma-engine.ts +81 -0
- package/src/ai/panel.ts +1385 -0
- package/src/ai/prompt-suggestions.ts +209 -0
- package/src/ai/search/combined-search.ts +244 -0
- package/src/{llm-utils → ai/search}/query-matching.ts +46 -167
- package/src/{llm-utils → ai}/storage.ts +0 -1
- package/src/ai/table-tools.ts +145 -0
- package/src/ai/ui.ts +720 -0
- package/src/ai/usage-limiter.ts +105 -0
- package/src/ai/view-tools.ts +352 -0
- package/src/claude/ai-feature.ts +16 -0
- package/src/claude/exec-blocks.ts +176 -0
- package/src/claude/queue-task.ts +84 -0
- package/src/claude/runtime-client.ts +310 -0
- package/src/claude/turn-log.ts +114 -0
- package/src/claude/undoable.ts +105 -0
- package/src/{llm-utils → db}/db-index-tools.ts +24 -32
- package/src/db/sql-tools.ts +336 -0
- package/src/depr/LLM-client.ts +251 -0
- package/src/depr/ai-panel.ts +174 -0
- package/src/depr/chatgpt-assistant.ts +257 -0
- package/src/depr/creds.ts +30 -0
- package/src/depr/deepwikiclient.ts +118 -0
- package/src/depr/indexes/dg-repository-index.ts +266 -0
- package/src/depr/interfaces.ts +170 -0
- package/src/depr/is-help-request.ts +39 -0
- package/src/depr/prompt-engine.ts +52 -0
- package/src/depr/rendering-tools.ts +103 -0
- package/src/depr/script-tools.ts +785 -0
- package/src/depr/tableview-tools.ts +746 -0
- package/src/depr/viewers-ai.ts +67 -0
- package/src/package-api.ts +87 -28
- package/src/package-test.ts +1 -0
- package/src/package.g.ts +98 -48
- package/src/package.ts +211 -157
- package/src/polyfills.ts +12 -0
- package/src/utils.ts +128 -0
- package/tsconfig.json +8 -70
- package/webpack.config.js +3 -49
- package/.eslintignore +0 -2
- package/src/ai-panel.ts +0 -174
- package/src/claude-code/claude-panel.ts +0 -34
- package/src/claude-code/claude-runtime-client.ts +0 -148
- package/src/llm-utils/LLM-client.ts +0 -251
- package/src/llm-utils/combined-search.ts +0 -162
- package/src/llm-utils/creds.ts +0 -30
- package/src/llm-utils/deepwikiclient.ts +0 -118
- package/src/llm-utils/indexes/dg-repository-index.ts +0 -266
- package/src/llm-utils/panel.ts +0 -866
- package/src/llm-utils/script-tools.ts +0 -784
- package/src/llm-utils/sql-tools.ts +0 -840
- package/src/llm-utils/tableview-tools.ts +0 -704
- package/src/llm-utils/ui.ts +0 -315
- package/src/prompt-engine/chatgpt-assistant.ts +0 -257
- package/src/prompt-engine/interfaces.ts +0 -170
- package/src/prompt-engine/prompt-engine.ts +0 -52
- package/src/prompt-engine/rendering-tools.ts +0 -103
- package/src/prompts/is-help-request.ts +0 -26
- package/src/viewers-ai.ts +0 -67
- /package/src/{llm-utils → db}/indexes/biologics-index.ts +0 -0
- /package/src/{llm-utils → db}/indexes/chembl-index.ts +0 -0
- /package/src/{llm-utils → db}/query-meta-utils.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-chat-completions-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-responses-provider.ts +0 -0
- /package/src/{llm-utils/depr → depr}/AI-API-providers/types.ts +0 -0
- /package/src/{llm-utils/depr → depr}/depr.ts +0 -0
- /package/src/{llm-utils/depr → depr}/embeddings.ts +0 -0
- /package/src/{llm-utils/depr → depr}/sql-utils.ts +0 -0
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
# Grokky benchmark harness — measuring latency & accuracy
|
|
2
|
+
|
|
3
|
+
A repeatable way to put **numbers** on every latency lever in [LATENCY.md](./LATENCY.md) before and
|
|
4
|
+
after you change it, so improvements can be proven to the team instead of asserted.
|
|
5
|
+
|
|
6
|
+
Companion to LATENCY.md: that doc says *what* to speed up and "instrument first". This is the
|
|
7
|
+
instrument.
|
|
8
|
+
|
|
9
|
+
## What it measures
|
|
10
|
+
|
|
11
|
+
Each benchmark run drives a fixed suite of prompts through the **real runtime pipeline** — the same
|
|
12
|
+
path the panel uses (`buildWorkspaceContext()` prepend, `viewFunctionTools()` declared, real
|
|
13
|
+
`datagrok-exec`/`datagrok_verify` tool round-trips) — so the numbers reflect true user-perceived
|
|
14
|
+
turns, not a synthetic shortcut.
|
|
15
|
+
|
|
16
|
+
Per turn it records:
|
|
17
|
+
|
|
18
|
+
| Metric | Source | Lever it exposes |
|
|
19
|
+
|---|---|---|
|
|
20
|
+
| **TTFT** (ms) | browser: send → first streamed token | effort / thinking / model / cache |
|
|
21
|
+
| **Total** (ms) | browser: send → `final` | everything |
|
|
22
|
+
| **Tool round-trips** | count of `tool_activity` events | forced verify / grounding round trips |
|
|
23
|
+
| **Input / output / cache-read tokens** | the agent's usage of every model call, summed on `final` | context diet, prompt-cache stability |
|
|
24
|
+
| **Cost (USD)** | each call priced from Hermes' price list for the provider; null where it has none | context diet, model choice |
|
|
25
|
+
| **num_turns**, api duration | the agent's model calls and their time | round-trip count, server-side time |
|
|
26
|
+
| **Tool names**, in call order | `tool_activity.name` | *which path* a turn took — the sharpest cheap-vs-strong discriminator |
|
|
27
|
+
| **Unverified rate** | `final.unverified` | how often the model could not confirm its own action |
|
|
28
|
+
| **Workspace-context chars**, **tool-def count** | browser, per turn | context diet (client-visible) |
|
|
29
|
+
|
|
30
|
+
**Accuracy** is hybrid (chosen to keep authoring effort low):
|
|
31
|
+
- **Deterministic** — most viewer/analysis/codegen prompts carry a JS `assert` checked against the
|
|
32
|
+
live workspace after the turn. Reproducible, zero judge cost.
|
|
33
|
+
- **LLM-judge** — free-text answers (Help Q&A, "what's the average…") are graded by a call on the
|
|
34
|
+
runtime's model against a short `rubric`, returning
|
|
35
|
+
pass/score/reason. Every rep that produced text is judged and the verdict is the majority, with a
|
|
36
|
+
score floor — judging one rep while timing three let the same defect flip pass/fail between runs.
|
|
37
|
+
|
|
38
|
+
### Assertion policy — assert what was asked for
|
|
39
|
+
|
|
40
|
+
An **existence** check (*a scatter plot exists*) passes on a half-correct answer. When every prompt
|
|
41
|
+
passes at rate 1.0, the accuracy axis carries no information and any comparison between
|
|
42
|
+
configurations is meaningless. So asserts **bind the specifics**: which columns a viewer is on,
|
|
43
|
+
the exact number of rows selected, that a formula column really holds the requested formula.
|
|
44
|
+
|
|
45
|
+
- `v.props.<name>` reads a viewer's **live** look including defaults, so it is safe to read even
|
|
46
|
+
when the property was never set explicitly.
|
|
47
|
+
- Prefer **self-referential** ground truth — recompute the expected value from `t` rather than
|
|
48
|
+
hardcoding a count — so the suite survives a demo-file refresh.
|
|
49
|
+
- **Missing numerics are not `null`.** For a numeric column, `col.toList()[i]` gives `undefined`
|
|
50
|
+
and `col.get(i)` gives a `2.6789344063684636e-34` sentinel. So `v !== null` counts missing rows
|
|
51
|
+
as present and `v === null` never matches one — this silently shifted two counts by exactly the
|
|
52
|
+
number of missing rows and **failed correct model answers**. Use `col.isNone(i)`. A threshold
|
|
53
|
+
comparison (`v > 50`) already excludes `undefined`, so a `v !== null &&` guard next to one is
|
|
54
|
+
dead code that merely looks like it handles missing values. `lint-suite.mjs` flags both.
|
|
55
|
+
- **Verify hardcoded constants before trusting them.** A rubric demanding the answer `1274` where
|
|
56
|
+
the true count was `878` marked a correct answer wrong for three runs. Check with
|
|
57
|
+
`dev/harness/introspect.mjs` and prefer recomputing from `t`.
|
|
58
|
+
- A turn that fails every rep now scores as **failed**, not "unscored". Leaving it null dropped it
|
|
59
|
+
from the denominator, which is how a 19-prompt run once reported "16/18".
|
|
60
|
+
- A failing prompt reports **what the model actually left behind** (viewer types with their bound
|
|
61
|
+
columns, added/removed columns, row/filter/selection counts, grid-hidden columns), so deciding
|
|
62
|
+
"wrong assert or wrong model?" is reading the report rather than re-running the prompt.
|
|
63
|
+
- An assert that *throws* is reported separately as a harness bug, not silently counted as a model
|
|
64
|
+
failure.
|
|
65
|
+
|
|
66
|
+
## Handling noise (so the numbers are credible)
|
|
67
|
+
|
|
68
|
+
- **Repetitions** — every prompt runs `reps` times (default **3**); the report shows the **median**
|
|
69
|
+
(plus mean/min/max/p90/stddev in the JSON). A single LLM turn is too noisy to publish.
|
|
70
|
+
- **Warm-up** — one throwaway turn runs first and is discarded, priming the static-prefix prompt
|
|
71
|
+
cache and the container. Measured reps then reflect steady state.
|
|
72
|
+
- **Caching is measured, not hidden** — `cache-read tokens` is reported; when a context-diet or
|
|
73
|
+
cache-stability lever lands, you should see cache-read rise and input tokens fall.
|
|
74
|
+
- **Isolation** — each rep opens a **fresh** demo table (a clone) and closes it (plus anything the
|
|
75
|
+
assistant opened) afterward, so viewers/columns from one rep can't leak into the next rep's assert.
|
|
76
|
+
|
|
77
|
+
## How to run
|
|
78
|
+
|
|
79
|
+
### Headless (preferred) — `dev/harness/run-benchmark.mjs`
|
|
80
|
+
|
|
81
|
+
Drives a real browser with Playwright, logging in with the dev key from `~/.grok/config.yaml`
|
|
82
|
+
exactly the way `grok test` does, and writes the report into `files/benchmarks/` so results land in
|
|
83
|
+
the repo rather than a Downloads folder. A benchmark **cannot** use the browserless T2 driver: its
|
|
84
|
+
asserts read live `DG` objects (viewers, filters, grid state) that only exist in a tab.
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
cd dev/harness
|
|
88
|
+
node run-benchmark.mjs --label sonnet-baseline --reps 3
|
|
89
|
+
node run-benchmark.mjs --label smoke --reps 1 --only trivial,visualization
|
|
90
|
+
node run-benchmark.mjs --compare sonnet-clean,haiku-probe
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
`--host` picks a server alias (default `localhost`), `--headed` shows the browser.
|
|
94
|
+
|
|
95
|
+
### From the browser
|
|
96
|
+
|
|
97
|
+
```
|
|
98
|
+
Grokky:runBenchmark("baseline") // reps defaults to 3
|
|
99
|
+
Grokky:runBenchmark("smoke", 1, "trivial,help") // run part of the suite
|
|
100
|
+
Grokky:compareBenchmarks("sonnet,haiku") // 2+ comma-separated labels
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
- Every turn runs on the runtime's configured model (its `model` credential). To compare models, run one
|
|
104
|
+
arm per model, each labelled after it, changing the credential between arms.
|
|
105
|
+
- **`only`** narrows the suite to comma-separated categories, difficulties, or prompt
|
|
106
|
+
substrings. A full arm is 44 × reps turns at ~20 s each, so validating a suite change or probing
|
|
107
|
+
one tier should never cost a full run. Partial runs are stamped as such in the report and must
|
|
108
|
+
not be compared against full arms.
|
|
109
|
+
- **`compareBenchmarks`** is N-way, not pairwise, so more than two configurations can be read
|
|
110
|
+
together. The first label is the reference. It reports accuracy **per difficulty tier** and per
|
|
111
|
+
prompt shows turn time *with* the pass mark — a faster arm that quietly stopped passing a prompt
|
|
112
|
+
is the failure mode a latency-only table is blind to.
|
|
113
|
+
|
|
114
|
+
Reports are written to `System:AppData/Grokky/benchmarks/` (JSON + Markdown) and downloaded.
|
|
115
|
+
|
|
116
|
+
The three results below, and the context probe's numbers, were measured on the Claude Agent SDK runtime,
|
|
117
|
+
before the move to Hermes; rerun the arms before comparing anything with them.
|
|
118
|
+
|
|
119
|
+
## Second result: the context diet, end to end
|
|
120
|
+
|
|
121
|
+
`benchmark-sonnet-clean` (before) vs `benchmark-diet-full` + `benchmark-diet-fixup` (after), on
|
|
122
|
+
the 44 prompts the two arms share:
|
|
123
|
+
|
|
124
|
+
| | before | after |
|
|
125
|
+
|---|---:|---:|
|
|
126
|
+
| Accuracy (44 shared) | 39/44 | **39/44** — parity |
|
|
127
|
+
| Median turn | 26.6 s | **17.9 s** (−33%) |
|
|
128
|
+
| Median TTFT | 17.9 s | **14.4 s** (−20%) |
|
|
129
|
+
| Median cache-read/turn | 92,009 | **55,781** (−39%) |
|
|
130
|
+
| Prefix (probe, tok/call) | 27,977 | **17,637** (−37%) |
|
|
131
|
+
| `entities` (new, 8 prompts) | — | **8/8** |
|
|
132
|
+
|
|
133
|
+
A third of the wall clock came off with no accuracy cost, and the five remaining failures are the
|
|
134
|
+
*same kinds* the baseline had — the box plot and the piperidine filter fail in both arms.
|
|
135
|
+
|
|
136
|
+
**Read the run log before trusting a red cell.** The first pass of this arm scored 41/52, and four
|
|
137
|
+
of the eleven failures were `judge failed: Claude Code process terminated by SIGKILL` — the judge
|
|
138
|
+
container was being recreated underneath the run while a publish churned images. The prompts
|
|
139
|
+
themselves were fine; rerunning the affected slice (`--only`) scored 7/9 and moved the arm to
|
|
140
|
+
47/52. Never publish, rebuild an image, or recreate a container while an arm is in flight.
|
|
141
|
+
|
|
142
|
+
## Third result: the grounding gate's Stop-block never changed an answer
|
|
143
|
+
|
|
144
|
+
The question (raised by the context probe's "full mode costs a second API call" finding): does the
|
|
145
|
+
`GroundingGate`'s post-answer Stop-block actually protect help accuracy, or is it a tax? A/B on the
|
|
146
|
+
dev runtime (T2 driver, `files/benchmarks/grounding-ab-raw.txt`): 4 help prompts + 2 contextual
|
|
147
|
+
data prompts × 3 reps × {gate on, gate off} via the new per-turn `gates` override.
|
|
148
|
+
|
|
149
|
+
| | gated | ungated |
|
|
150
|
+
|---|---:|---:|
|
|
151
|
+
| help median turn | 64.8 s | 57.4 s |
|
|
152
|
+
| help docs-reads per turn | the model reads the docs **in both arms** (3–21 reads) | same |
|
|
153
|
+
| data-question turn | 7.6 s / **2 calls** | 3.5 s / 1 call |
|
|
154
|
+
| blocks that *changed* an answer | **0 of 14** | — |
|
|
155
|
+
|
|
156
|
+
Every single Stop-block across the sample ended in `NO_REVISION`. The system prompt's grounding
|
|
157
|
+
rule does the real work — the model opens `help/INDEX.md` and reads pages whether or not the gate
|
|
158
|
+
exists — while the block doubled the cost of trivial contextual answers and flashed "Revising…"
|
|
159
|
+
at users.
|
|
160
|
+
|
|
161
|
+
**Consequences (all landed):** small talk never arms the gate; a `Skill` invocation counts as
|
|
162
|
+
grounding (the prompt names skills a source of truth, yet skill-grounded answers were paying a
|
|
163
|
+
block); and the block itself is now **content-aware** — it fires only when the visible answer
|
|
164
|
+
makes platform *UI-instruction* claims (`makesPlatformClaims` in grounding.ts: click/menu/dialog/
|
|
165
|
+
"go to"-style text) without a source opened this turn. That is the one case the gate was built
|
|
166
|
+
for: an ungrounded answer that looks authoritative. A data answer ("5,850 rows and 11 columns")
|
|
167
|
+
ends the turn in one API call. Measured post-change: data question 2 calls → 1, 7.6 s → 3.6 s,
|
|
168
|
+
gate still armed.
|
|
169
|
+
|
|
170
|
+
## First result: model tier is not the latency lever
|
|
171
|
+
|
|
172
|
+
The first thing this instrument was built to answer was whether a cheap-model-first dispatcher
|
|
173
|
+
(route to Haiku, escalate to Sonnet when it struggles) would cut latency. Two full arms
|
|
174
|
+
(`benchmark-sonnet-clean`, `benchmark-haiku-probe`, in `files/benchmarks/`) said no:
|
|
175
|
+
|
|
176
|
+
| | Sonnet | Haiku |
|
|
177
|
+
|---|---|---|
|
|
178
|
+
| Accuracy | **39/44 (89%)** | 27/44 (61%) |
|
|
179
|
+
| Median turn | **26.9 s** | 39.6 s — *47% slower* |
|
|
180
|
+
| Cost | $5.42 | $2.09 (only **1.8×** cheaper per *passed* prompt) |
|
|
181
|
+
| trivial tier | 10.8 s / **1** tool round-trip | 43.1 s / **8** round-trips |
|
|
182
|
+
| visualization | 13.9 s / 2 round-trips | 83.8 s / **20** round-trips |
|
|
183
|
+
|
|
184
|
+
The cheap tier is the *slow* one here. Every tool round-trip is a browser round-trip, and Haiku
|
|
185
|
+
explores the API where Sonnet knows it — so it is 4-6× slower on exactly the easy prompts a
|
|
186
|
+
dispatcher would route to it. Escalation would make it worse: pay Haiku's flailing, then Sonnet's
|
|
187
|
+
work. The router was built, measured, and removed.
|
|
188
|
+
|
|
189
|
+
Where the time actually goes:
|
|
190
|
+
|
|
191
|
+
```
|
|
192
|
+
sonnet: TTFT 17.9s of 26.6s total (67%), median 2 round-trips
|
|
193
|
+
haiku: TTFT 7.7s of 39.0s total (20%), median 6 round-trips
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
**Two-thirds of a Sonnet turn is spent before the first token.** That points the latency work at
|
|
197
|
+
TTFT (context diet, prompt-cache stability, thinking budget) and at eliminating round-trips — not
|
|
198
|
+
at model choice. Re-check that conclusion with an arm per model when models change; it is a property of
|
|
199
|
+
this architecture, not a permanent law.
|
|
200
|
+
|
|
201
|
+
## Context probe — attributing the prompt prefix
|
|
202
|
+
|
|
203
|
+
`dev/harness/context-probe.mjs` answers a different question from the suite: not "how good/fast is
|
|
204
|
+
a turn" but **"what is the model re-reading before it can emit a token"**. It runs the same trivial
|
|
205
|
+
prompt under configurations that switch one contributor on at a time (MCP server, view tools,
|
|
206
|
+
Datagrok prompt + plugin) and reports the prefix each one adds.
|
|
207
|
+
|
|
208
|
+
```bash
|
|
209
|
+
cd dev/harness
|
|
210
|
+
node context-probe.mjs --label before # full ablation
|
|
211
|
+
node context-probe.mjs --label after --only base,mcp,full # re-check one contributor
|
|
212
|
+
node context-probe.mjs --mcp http://localhost:33003/mcp # against `node dev/mcp.mjs up`
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
Two measurement rules make the numbers trustworthy, and both were wrong in the first version:
|
|
216
|
+
|
|
217
|
+
- **Prefix = input + cacheRead + cacheCreation.** Reading `cacheRead` alone measures how the cache
|
|
218
|
+
happened to break, not how much context there was.
|
|
219
|
+
- **Divide by `numTurns`.** SDK usage on the `result` message is *cumulative over every API call the
|
|
220
|
+
turn made*. Before normalizing, enabling thinking looked like a 2× context regression when it was
|
|
221
|
+
really a second API call — a completely different problem with a completely different fix.
|
|
222
|
+
|
|
223
|
+
Ablation (`context-probe-*.md`), Sonnet, per API call — with the diet each finding produced:
|
|
224
|
+
|
|
225
|
+
| Contributor | before | after | lever |
|
|
226
|
+
|---|---:|---:|---|
|
|
227
|
+
| SDK floor — built-in tools, CLAUDE.md, base prompt | 17,493 | **9,921** | `tools:` restricts the *declared* built-ins; `allowedTools` only pre-approves them, so Task/TodoWrite/NotebookEdit/plan-mode schemas shipped unused — 7,572 tok/call |
|
|
228
|
+
| Datagrok system prompt + inlined skills + plugin | +6,363 | ≈ | CRLF frontmatter leak fixed; body is deliberate content |
|
|
229
|
+
| datagrok MCP server | +3,847 | **+1,061** | 34 tools → 5 domain tools dispatching on `op` |
|
|
230
|
+
| view meta-tools (3) | +274 | +274 | already the meta-tool pattern — the model to copy |
|
|
231
|
+
| **production total** | **27,977** | **17,637** | **−37%** |
|
|
232
|
+
|
|
233
|
+
The findings worth carrying forward:
|
|
234
|
+
|
|
235
|
+
1. **Declared ≠ allowed.** The biggest single cut was not Datagrok's own surface at all but the
|
|
236
|
+
SDK's default built-in tool set, which `allowedTools` does not remove from the prompt.
|
|
237
|
+
2. **Tool defs were never the main course.** All 34 MCP tools cost less than the plugin and prompt
|
|
238
|
+
block, and the three view meta-tools cost 274 tokens. Consolidating to five domain tools was
|
|
239
|
+
still worth it (−2,786 tok/call, 72% of that block).
|
|
240
|
+
3. **Full mode costs a second API call** on any turn that neither grounded nor acted: the
|
|
241
|
+
`GroundingGate` blocks the Stop and the model burns a whole call replying `NO_REVISION`.
|
|
242
|
+
Small talk is now exempt (measured on "hello": 2 calls → 1, 9.3 s → 6.0 s, no "Revising…"
|
|
243
|
+
flash), but the block still fires on real ungrounded answers — that part is an accuracy
|
|
244
|
+
feature and needs an A/B on the `help` category, not a unilateral removal.
|
|
245
|
+
|
|
246
|
+
## The suite
|
|
247
|
+
|
|
248
|
+
`files/benchmark/suite.yaml` — 52 prompts across `help`, `visualization`, `analysis`, `codegen`,
|
|
249
|
+
`multitool`, `query`, `entities`. Fields: `category`, `prompt`, optional `difficulty`, `table`,
|
|
250
|
+
`assert`, `rubric`. Edit freely — it's plain YAML, no rebuild needed for suite-only changes (it's a
|
|
251
|
+
static package file; re-publish to pick it up).
|
|
252
|
+
|
|
253
|
+
**`entities`** covers the server-side MCP surface (the five domain tools). It exists because the
|
|
254
|
+
suite previously had none: the 34-tool → 5-tool consolidation could have broken every server-side
|
|
255
|
+
operation and the arm would still have reported 39/44. These prompts carry no `table`, their asserts
|
|
256
|
+
read the **server** through `grok.dapi` rather than the view, and anything they create they delete in
|
|
257
|
+
the assert itself — an arm runs each prompt `reps` times and must not litter the instance.
|
|
258
|
+
|
|
259
|
+
**Assert scope:** `grok, DG, view, t, before, opened, openedViews, tools`, where `before` is
|
|
260
|
+
`{cols, rowCount, viewers, tableViews}` (note `viewers` counts the grid, so a fresh view is 1),
|
|
261
|
+
`openedViews` are the TableViews the turn opened, and `tools` are the bare tool names it called in
|
|
262
|
+
order. `await` is allowed. Asserts run after a short settle delay, because a Filters-panel filter
|
|
263
|
+
applies asynchronously — without it every `t.filter` assertion is a race.
|
|
264
|
+
|
|
265
|
+
**`table:`** resolves to `System:DemoFiles/<table>.csv`, so nested paths are written `chem/SPGI`.
|
|
266
|
+
`randomWalk` is special-cased to `grok.data.demo.randomWalk()` (its columns are literally `#0`,
|
|
267
|
+
`#1`, `#2` — a useful name-quoting stress test).
|
|
268
|
+
|
|
269
|
+
**`difficulty:`** (`trivial` | `standard` | `hard`, default `standard`) drives a per-difficulty
|
|
270
|
+
rollup in the report. The tiers exist to make model-routing questions answerable: a cheap tier
|
|
271
|
+
reveals where configurations differ; a blended number hides it.
|
|
272
|
+
Hard prompts deliberately target documented traps — clearing a filter vs a selection uses opposite
|
|
273
|
+
polarity; `grid.sortByColumns =` is a read-only getter whose assignment silently no-ops; a
|
|
274
|
+
substructure filter given raw SMILES instead of a molblock matches zero rows — so a model that
|
|
275
|
+
skips the skill produces a *detectably wrong* state rather than a plausible one.
|
|
276
|
+
|
|
277
|
+
**Lint before you run.** A run costs ~20 minutes and real quota, so validate first:
|
|
278
|
+
```bash
|
|
279
|
+
cd dev/harness && node lint-suite.mjs
|
|
280
|
+
```
|
|
281
|
+
It parses the YAML, compiles every assert exactly the way the harness does, and flags assertions
|
|
282
|
+
too weak to carry the accuracy axis. It is also part of `node dev/check.mjs`.
|
|
283
|
+
|
|
284
|
+
## Caveats / scope
|
|
285
|
+
|
|
286
|
+
- The runner sends prompts headlessly; **AskUserQuestion** can't be answered, so any prompt that
|
|
287
|
+
triggers it ends the turn with the question unanswered and won't score well — keep suite prompts specific.
|
|
288
|
+
- Server-side config (effort, thinking budget, model default) is **not** visible to the browser, so
|
|
289
|
+
it isn't auto-captured — the run **label** is how you denote which config produced it. Client-visible
|
|
290
|
+
config (tool-def count, workspace-context size, model the browser sends) *is* recorded.
|
|
291
|
+
- `total` includes network + runtime queue + model; it is wall-clock as the user feels it, not pure
|
|
292
|
+
model time (`duration_api_ms` in the JSON isolates the server-side portion).
|