@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.
Files changed (203) hide show
  1. package/.claude/skills/deploy-grokky/SKILL.md +193 -0
  2. package/.grokignore +2 -0
  3. package/.turbo/turbo-build.log +24 -0
  4. package/.vscode/settings.json +16 -0
  5. package/CHANGELOG.md +151 -8
  6. package/CLAUDE.md +284 -0
  7. package/CREDITS.md +173 -0
  8. package/LICENSE.md +16 -0
  9. package/README.md +24 -0
  10. package/bdd/bdd.config.json +1 -0
  11. package/bdd/bindings/elements.ts +9 -0
  12. package/bdd/bindings/steps.ts +787 -0
  13. package/bdd/features/ai-panel/platform-work.feature +63 -0
  14. package/bdd/features/ai-panel/session.feature +69 -0
  15. package/bdd/features/ai-panel/table-work.feature +99 -0
  16. package/bdd/generated/ai-panel/platform-work.test.ts +103 -0
  17. package/bdd/generated/ai-panel/session.test.ts +100 -0
  18. package/bdd/generated/ai-panel/table-work.test.ts +150 -0
  19. package/bdd/package.json +1 -0
  20. package/bdd/tsconfig.json +13 -0
  21. package/css/ai.css +637 -49
  22. package/dist/package-test.js +4 -1707
  23. package/dist/package-test.js.map +1 -1
  24. package/dist/package.js +742 -92317
  25. package/dist/package.js.map +1 -1
  26. package/dockerfiles/claude-runtime/.dockerignore +1 -0
  27. package/{.eslintrc.json → dockerfiles/claude-runtime/.eslintrc.json} +7 -16
  28. package/dockerfiles/claude-runtime/Dockerfile +73 -13
  29. package/dockerfiles/claude-runtime/agent/grokky_agent/__init__.py +0 -0
  30. package/dockerfiles/claude-runtime/agent/grokky_agent/__main__.py +80 -0
  31. package/dockerfiles/claude-runtime/agent/grokky_agent/browser_tools.py +180 -0
  32. package/dockerfiles/claude-runtime/agent/grokky_agent/config.py +26 -0
  33. package/dockerfiles/claude-runtime/agent/grokky_agent/formats.py +155 -0
  34. package/dockerfiles/claude-runtime/agent/grokky_agent/guard.py +87 -0
  35. package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.py +212 -0
  36. package/dockerfiles/claude-runtime/agent/grokky_agent/hermes.yaml +45 -0
  37. package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/__init__.py +8 -0
  38. package/dockerfiles/claude-runtime/agent/grokky_agent/hermes_plugin/plugin.yaml +3 -0
  39. package/dockerfiles/claude-runtime/agent/grokky_agent/protocol.py +174 -0
  40. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/__init__.py +21 -0
  41. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/anthropic.py +21 -0
  42. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/azure.py +46 -0
  43. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/base.py +127 -0
  44. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/bedrock.py +46 -0
  45. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/custom.py +40 -0
  46. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/databricks.py +54 -0
  47. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openai_platform.py +41 -0
  48. package/dockerfiles/claude-runtime/agent/grokky_agent/providers/openrouter.py +46 -0
  49. package/dockerfiles/claude-runtime/agent/grokky_agent/session.py +471 -0
  50. package/dockerfiles/claude-runtime/agent/grokky_agent/skills.py +44 -0
  51. package/dockerfiles/claude-runtime/agent/grokky_agent/structured.py +40 -0
  52. package/dockerfiles/claude-runtime/container.json +2 -2
  53. package/dockerfiles/claude-runtime/entrypoint.sh +20 -0
  54. package/dockerfiles/claude-runtime/package-lock.json +1721 -306
  55. package/dockerfiles/claude-runtime/package.json +20 -5
  56. package/dockerfiles/claude-runtime/plugin/.claude-plugin/plugin.json +5 -0
  57. package/dockerfiles/claude-runtime/plugin/skills/datagrok-calc-column/SKILL.md +92 -0
  58. package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-data/SKILL.md +250 -0
  59. package/dockerfiles/claude-runtime/plugin/skills/datagrok-chem-toolkit/SKILL.md +395 -0
  60. package/dockerfiles/claude-runtime/plugin/skills/datagrok-df-and-columns/SKILL.md +454 -0
  61. package/dockerfiles/claude-runtime/plugin/skills/datagrok-entities/SKILL.md +38 -0
  62. package/dockerfiles/claude-runtime/plugin/skills/datagrok-exec/SKILL.md +209 -0
  63. package/dockerfiles/claude-runtime/plugin/skills/datagrok-filtering/SKILL.md +185 -0
  64. package/dockerfiles/claude-runtime/plugin/skills/datagrok-grid-customization/SKILL.md +270 -0
  65. package/dockerfiles/claude-runtime/plugin/skills/datagrok-projects/SKILL.md +100 -0
  66. package/dockerfiles/claude-runtime/plugin/skills/datagrok-selection/SKILL.md +344 -0
  67. package/dockerfiles/claude-runtime/plugin/skills/datagrok-undo/SKILL.md +78 -0
  68. package/dockerfiles/claude-runtime/plugin/skills/datagrok-viewers/SKILL.md +303 -0
  69. package/dockerfiles/claude-runtime/pyproject.toml +18 -0
  70. package/dockerfiles/claude-runtime/src/agent/pool.ts +411 -0
  71. package/dockerfiles/claude-runtime/src/agent/turn.ts +153 -0
  72. package/dockerfiles/claude-runtime/src/constants.ts +20 -0
  73. package/dockerfiles/claude-runtime/src/credentials.ts +45 -0
  74. package/dockerfiles/claude-runtime/src/grounding.ts +104 -0
  75. package/dockerfiles/claude-runtime/src/help-index.ts +118 -0
  76. package/dockerfiles/claude-runtime/src/privileges.ts +8 -0
  77. package/dockerfiles/claude-runtime/src/prompts.ts +211 -0
  78. package/dockerfiles/claude-runtime/src/server.ts +134 -234
  79. package/dockerfiles/claude-runtime/src/session.ts +328 -0
  80. package/dockerfiles/claude-runtime/src/shared-api-client.ts +112 -0
  81. package/dockerfiles/claude-runtime/src/stream-filter.ts +80 -0
  82. package/dockerfiles/claude-runtime/src/sync/home-files.ts +80 -0
  83. package/dockerfiles/claude-runtime/src/sync/orchestrator.ts +214 -0
  84. package/dockerfiles/claude-runtime/src/sync/packages.ts +145 -0
  85. package/dockerfiles/claude-runtime/src/sync/shared-connections.ts +87 -0
  86. package/dockerfiles/claude-runtime/src/sync/workspace.ts +68 -0
  87. package/dockerfiles/claude-runtime/src/tasks.ts +124 -0
  88. package/dockerfiles/claude-runtime/src/tool-summary.ts +66 -0
  89. package/dockerfiles/claude-runtime/src/types.ts +142 -23
  90. package/dockerfiles/claude-runtime/src/user/installed-packages.ts +17 -0
  91. package/dockerfiles/claude-runtime/src/user/staged-workspace.ts +80 -0
  92. package/dockerfiles/claude-runtime/src/user/user-dir.ts +108 -0
  93. package/dockerfiles/claude-runtime/src/verify.ts +136 -0
  94. package/dockerfiles/claude-runtime/src/watchdog.ts +115 -0
  95. package/dockerfiles/claude-runtime/test/credentials.test.js +43 -0
  96. package/dockerfiles/claude-runtime/test/grounding.test.js +191 -0
  97. package/dockerfiles/claude-runtime/test/help-index.test.js +115 -0
  98. package/dockerfiles/claude-runtime/test/plugin-skills.test.js +57 -0
  99. package/dockerfiles/claude-runtime/test/prompts.test.js +62 -0
  100. package/dockerfiles/claude-runtime/test/reaper.test.js +60 -0
  101. package/dockerfiles/claude-runtime/test/stream-filter.test.js +132 -0
  102. package/dockerfiles/claude-runtime/test/tasks.test.js +74 -0
  103. package/dockerfiles/claude-runtime/test/user-dir.test.js +71 -0
  104. package/dockerfiles/claude-runtime/test/verify.test.js +187 -0
  105. package/dockerfiles/claude-runtime/test/watchdog.test.js +43 -0
  106. package/dockerfiles/mcp-server/.eslintrc.json +39 -0
  107. package/dockerfiles/mcp-server/Dockerfile +10 -2
  108. package/dockerfiles/mcp-server/package-lock.json +1743 -98
  109. package/dockerfiles/mcp-server/package.json +27 -5
  110. package/dockerfiles/mcp-server/src/api-client.ts +123 -66
  111. package/dockerfiles/mcp-server/src/format.ts +51 -0
  112. package/dockerfiles/mcp-server/src/index.ts +44 -113
  113. package/dockerfiles/mcp-server/src/ops.ts +325 -0
  114. package/dockerfiles/mcp-server/src/shared-api-client.ts +81 -0
  115. package/dockerfiles/mcp-server/test/format.test.js +62 -0
  116. package/dockerfiles/mcp-server/test/ops.test.js +84 -0
  117. package/dockerfiles/mcp-server/test/shared-api-client.test.js +35 -0
  118. package/dockerfiles/queue/Dockerfile +2 -0
  119. package/dockerfiles/queue/container.json +7 -0
  120. package/docs/AUDIT-2026-08-03.md +1064 -0
  121. package/docs/BENCHMARK.md +292 -0
  122. package/docs/CLAUDE_CODE_FLOW.md +746 -0
  123. package/docs/EXAMPLES.md +82 -0
  124. package/docs/FEATURES.md +71 -0
  125. package/docs/IMPLEMENTATION.md +128 -0
  126. package/docs/LATENCY.md +170 -0
  127. package/docs/VISION.md +36 -0
  128. package/files/benchmark/suite.yaml +404 -0
  129. package/files/scripts/process-cro-results.md +14 -0
  130. package/files/suggestions.yaml +344 -0
  131. package/package.json +39 -97
  132. package/src/ai/ai-window.ts +157 -0
  133. package/src/ai/benchmark/benchmark.ts +737 -0
  134. package/src/ai/db-view-functions.ts +56 -0
  135. package/src/ai/engine.ts +98 -0
  136. package/src/ai/gemma-engine.ts +81 -0
  137. package/src/ai/panel.ts +1385 -0
  138. package/src/ai/prompt-suggestions.ts +209 -0
  139. package/src/ai/search/combined-search.ts +244 -0
  140. package/src/{llm-utils → ai/search}/query-matching.ts +46 -167
  141. package/src/{llm-utils → ai}/storage.ts +0 -1
  142. package/src/ai/table-tools.ts +145 -0
  143. package/src/ai/ui.ts +720 -0
  144. package/src/ai/usage-limiter.ts +105 -0
  145. package/src/ai/view-tools.ts +352 -0
  146. package/src/claude/ai-feature.ts +16 -0
  147. package/src/claude/exec-blocks.ts +176 -0
  148. package/src/claude/queue-task.ts +84 -0
  149. package/src/claude/runtime-client.ts +310 -0
  150. package/src/claude/turn-log.ts +114 -0
  151. package/src/claude/undoable.ts +105 -0
  152. package/src/{llm-utils → db}/db-index-tools.ts +24 -32
  153. package/src/db/sql-tools.ts +336 -0
  154. package/src/depr/LLM-client.ts +251 -0
  155. package/src/depr/ai-panel.ts +174 -0
  156. package/src/depr/chatgpt-assistant.ts +257 -0
  157. package/src/depr/creds.ts +30 -0
  158. package/src/depr/deepwikiclient.ts +118 -0
  159. package/src/depr/indexes/dg-repository-index.ts +266 -0
  160. package/src/depr/interfaces.ts +170 -0
  161. package/src/depr/is-help-request.ts +39 -0
  162. package/src/depr/prompt-engine.ts +52 -0
  163. package/src/depr/rendering-tools.ts +103 -0
  164. package/src/depr/script-tools.ts +785 -0
  165. package/src/depr/tableview-tools.ts +746 -0
  166. package/src/depr/viewers-ai.ts +67 -0
  167. package/src/package-api.ts +87 -28
  168. package/src/package-test.ts +1 -0
  169. package/src/package.g.ts +98 -48
  170. package/src/package.ts +211 -157
  171. package/src/polyfills.ts +12 -0
  172. package/src/utils.ts +128 -0
  173. package/tsconfig.json +8 -70
  174. package/webpack.config.js +3 -49
  175. package/.eslintignore +0 -2
  176. package/src/ai-panel.ts +0 -174
  177. package/src/claude-code/claude-panel.ts +0 -34
  178. package/src/claude-code/claude-runtime-client.ts +0 -148
  179. package/src/llm-utils/LLM-client.ts +0 -251
  180. package/src/llm-utils/combined-search.ts +0 -162
  181. package/src/llm-utils/creds.ts +0 -30
  182. package/src/llm-utils/deepwikiclient.ts +0 -118
  183. package/src/llm-utils/indexes/dg-repository-index.ts +0 -266
  184. package/src/llm-utils/panel.ts +0 -866
  185. package/src/llm-utils/script-tools.ts +0 -784
  186. package/src/llm-utils/sql-tools.ts +0 -840
  187. package/src/llm-utils/tableview-tools.ts +0 -704
  188. package/src/llm-utils/ui.ts +0 -315
  189. package/src/prompt-engine/chatgpt-assistant.ts +0 -257
  190. package/src/prompt-engine/interfaces.ts +0 -170
  191. package/src/prompt-engine/prompt-engine.ts +0 -52
  192. package/src/prompt-engine/rendering-tools.ts +0 -103
  193. package/src/prompts/is-help-request.ts +0 -26
  194. package/src/viewers-ai.ts +0 -67
  195. /package/src/{llm-utils → db}/indexes/biologics-index.ts +0 -0
  196. /package/src/{llm-utils → db}/indexes/chembl-index.ts +0 -0
  197. /package/src/{llm-utils → db}/query-meta-utils.ts +0 -0
  198. /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-chat-completions-provider.ts +0 -0
  199. /package/src/{llm-utils/depr → depr}/AI-API-providers/openai-responses-provider.ts +0 -0
  200. /package/src/{llm-utils/depr → depr}/AI-API-providers/types.ts +0 -0
  201. /package/src/{llm-utils/depr → depr}/depr.ts +0 -0
  202. /package/src/{llm-utils/depr → depr}/embeddings.ts +0 -0
  203. /package/src/{llm-utils/depr → depr}/sql-utils.ts +0 -0
@@ -0,0 +1,1064 @@
1
+ # Grokky — architecture and quality audit, 2026-08-03
2
+
3
+ Full review of the Grokky package: how it works, everything it is connected to, what is
4
+ wrong with it, what the platform does not give it, and what to do about it — measured
5
+ against current published practice for LLM agents. **No code was changed.** Every claim
6
+ below was re-checked against source after it was first raised; claims that did not survive
7
+ are listed in [Appendix A](#appendix-a--claims-that-did-not-survive) so they are not
8
+ re-litigated.
9
+
10
+ ---
11
+
12
+ ## 1. Method and confidence
13
+
14
+ Two passes. The first read every file in `src/`, `dockerfiles/`, `docs/`, `files/` and
15
+ `css/`, mapped the seams into Dart core and other packages, root-caused the three
16
+ user-reported failures, and researched current best practice on the web. The second pass
17
+ took every critical/high finding and tried to **refute** it against the code, and separately
18
+ tried to disprove each claimed platform-API gap by finding the API.
19
+
20
+ | | Raised | Survived |
21
+ |---|---|---|
22
+ | Findings | 250 | 61 confirmed, 24 partial, 11 duplicates, 1 refuted (of 97 adversarially re-checked; the rest are medium/low and carry first-pass confidence only) |
23
+ | Missing platform APIs | 83 | 38 real gaps, 12 partial, **12 already exist** (Grokky is reimplementing platform functionality) |
24
+ | Best practices researched | 29 | with sources, each scored against Grokky's actual code |
25
+
26
+ Severity is **user-facing**: `critical` = data loss, security, or a wrong answer the user
27
+ will act on; `high` = fails in realistic use; `medium` = degraded quality or a maintenance
28
+ trap; `low` = polish. Several first-pass severities were corrected downward during
29
+ verification — those corrections are kept.
30
+
31
+ ---
32
+
33
+ ## 2. Verdict
34
+
35
+ **Grokky's discovery and context architecture is genuinely ahead of published practice. Its
36
+ action, verification, and trust architecture is behind it. Both reported failure classes come
37
+ from the second.**
38
+
39
+ What is very good, and should be protected:
40
+
41
+ - **The four static view meta-tools** ([src/ai/view-tools.ts:245-286](../src/ai/view-tools.ts)) —
42
+ hundreds of per-view `DG.Func`s are never declared to the model; it searches them. The defs
43
+ are module constants so the prompt prefix stays byte-stable and cacheable. This is exactly
44
+ the progressive-disclosure pattern Anthropic published, arrived at independently.
45
+ - **The five op-dispatch MCP tools** ([dockerfiles/mcp-server/src/ops.ts](../dockerfiles/mcp-server/src/ops.ts)) —
46
+ 32 tools collapsed to 5, measured: 3,847 → 1,061 tokens/call, with no capability lost
47
+ because an op-less call returns the domain schema.
48
+ - **The act→verify gate** ([dockerfiles/claude-runtime/src/verify.ts](../dockerfiles/claude-runtime/src/verify.ts)) —
49
+ a `Stop` hook that refuses to let a turn end while an action is unproven is ahead of every
50
+ comparable product surveyed. The *idea* is right; the *implementation* is what failed.
51
+ - **The benchmark harness** ([src/ai/benchmark/benchmark.ts](../src/ai/benchmark/benchmark.ts),
52
+ [docs/BENCHMARK.md](BENCHMARK.md)) — real pipeline, TTFT/cost/tool-order/unverified-rate,
53
+ deterministic asserts plus a majority-vote judge. Better than most teams have.
54
+
55
+ What is structurally wrong:
56
+
57
+ 1. **The cheapest way for the model to do anything is to write JavaScript that the browser
58
+ `eval`s.** Everything downstream follows from this: verification must be model-authored
59
+ (nothing else knows what an arbitrary string intended), permissioning must be all-or-nothing
60
+ (there is no operation identity to gate on), audit is a truncated string in the user's own
61
+ IndexedDB, and undo is impossible. The platform learns nothing from each execution, so the
62
+ next user's identical request regenerates the same code with different bugs.
63
+ 2. **The model grades its own homework.** Both reported failures are the same bug seen from
64
+ two sides: a false negative (correct action, "Not verified") and a false positive (nothing
65
+ persisted, "Data Sync is ON"). A self-authored assertion proves the model's belief, not the
66
+ world.
67
+ 3. **The knowledge that teaches the model is not tested.** The skills contain a fabricated
68
+ function tag, a wrong enum that silently produces an all-null column, a project-save recipe
69
+ that *destroys* server-side data-sync configuration, and 74 fenced blocks teaching an
70
+ execution mechanism the browser no longer honors.
71
+ 4. **The security posture does not match the README.** `CLAUDE.md:19-21` says "safe, secure,
72
+ governed, monitored and measured". Verified: not governed (`canUseTool` allows everything),
73
+ not monitored (no server-side audit of executed code), not measured (quota hardcoded to
74
+ 1000/day for everyone, cost metrics computed and discarded).
75
+
76
+ Nothing here says the product direction is wrong. It says the scaffolding under a good idea
77
+ needs to be built before the surface area grows further.
78
+
79
+ ---
80
+
81
+ ## 3. How Grokky actually works
82
+
83
+ The package `CLAUDE.md` is broadly accurate but has drifted in specific, load-bearing ways
84
+ (see [§6.7](#67-documentation-drift)). This is the verified picture.
85
+
86
+ ```
87
+ Browser (this package) Datagrok server Containers (this package)
88
+ ┌──────────────────────────┐ ┌────────────┐ ┌───────────────────────┐
89
+ │ AIPanel (singleton) │ │ │ │ grokky-claude-runtime │
90
+ │ └ runPromptWithLifecycle│──WS /ws──────▶│ docker │────────▶│ Hono + agent-sdk │
91
+ │ grok.ai.processPrompt│ proxy │ proxy │ │ ├ session.ts (turns) │
92
+ │ UsageLimiter │ │ │ │ ├ verify.ts (gate) │
93
+ │ streamOnce │◀──chunk───────│ │◀────────│ ├ prompts.ts │
94
+ │ │◀──input_request│ │ │ ├ sync/ (skills, │
95
+ │ executeSingleBlock │───response────▶│ │ │ │ help, packages) │
96
+ │ new Function(grok,ui, │ │ │ │ └ plugin/skills/*.md │
97
+ │ DG,view,t) │ │ │ └───────────┬───────────┘
98
+ │ runVerification │ │ │ MCP │ HTTP
99
+ │ view-tools (4 meta-tools)│ │ │ ┌───────────▼───────────┐
100
+ │ ConversationStorage (IDB)│ │ REST API │◀────────│ grokky-mcp-server │
101
+ └──────────────────────────┘ └────────────┘ │ 5 op-dispatch tools │
102
+ └───────────────────────┘
103
+ ```
104
+
105
+ **One panel, one session.** `initAIWindow()` creates a single `AIPanel` mounted into
106
+ `grok.shell.windows.ai` (the Dart `xpAIPanel`). It survives view switches; every prompt gets
107
+ a fresh `buildWorkspaceContext()` snapshot instead. Ribbon icons on table/script/query views
108
+ toggle this one panel.
109
+
110
+ **A prompt's path** ([src/ai/ui.ts:244](../src/ai/ui.ts)): `!`/`!!` bash escape → `grok.ai.processPrompt()`
111
+ (the Dart sync interpreter gets first refusal; a claimed prompt never reaches the model) →
112
+ `UsageLimiter` → `streamOnce()` → WebSocket `user_message` carrying `grok.dapi.token`, the MCP
113
+ URL, and the four client tool defs.
114
+
115
+ **Actions come back as questions.** The runtime registers browser-executed tools
116
+ (`datagrok_exec`, `datagrok_verify`, `datagrok_show_entities`, and the four view tools) with
117
+ the SDK; when the model calls one, the runtime emits `input_request` to the browser, the
118
+ browser executes and replies `input_response`. **There is no fenced-block execution any more** —
119
+ `executeSingleBlock` has exactly three callers, and none of them parses the final markdown.
120
+
121
+ **Verification** ([verify.ts](../dockerfiles/claude-runtime/src/verify.ts)): a `PostToolUse` hook
122
+ marks the turn as owing proof after any `datagrok_exec` or non-read MCP call; a `Stop` hook
123
+ refuses to end the turn until a `datagrok_verify` returns `{passed: true}`, up to 3 blocks,
124
+ after which `final` carries `unverified: true` and the panel shows the red banner.
125
+
126
+ **Deployment asymmetry that matters.** `dockerfiles/*/src` compiles **inside the image**
127
+ (`Dockerfile`: `COPY src ./src` → `npx tsc` → `rm -rf src`). `grok publish` rebuilds only the
128
+ browser bundle. So any fix spanning both halves is only half-deployed until the image is
129
+ rebuilt — and **nothing in the protocol lets either side detect the skew**.
130
+
131
+ ---
132
+
133
+ ## 4. Connection map
134
+
135
+ Everything Grokky touches. Renaming anything in the left column breaks the right one silently.
136
+
137
+ ### 4.1 Dart core (client)
138
+
139
+ | Core surface | Grokky use | Both sides |
140
+ |---|---|---|
141
+ | `grok.ai.config.configured` | gates **all five** entry points | [ui.ts:169,238,620,645](../src/ai/ui.ts), [package.ts:128](../src/package.ts) ↔ `xamgle/lib/src/interop/grok_api.dart:1386` ← `grok_shared/.../admin_settings.dart:60` |
142
+ | `grok.ai.processPrompt` | sync interpreter gets first refusal | [ui.ts:276](../src/ai/ui.ts) ↔ `xamgle/lib/src/features/ai/prompt.dart:65` (its header comment names Grokky as the consumer) |
143
+ | `Widget.getFunctions()` / `.aiDescription` / `.children` | the entire view-tool surface | [view-tools.ts:24-93](../src/ai/view-tools.ts) ↔ `grok_api.dart:559-565`; `ViewBase extends Widget` so views participate |
144
+ | `JsViewHost` + `View_Get_JsView` | reaching JS-defined views' functions (Flow) | [view-tools.ts:123-150](../src/ai/view-tools.ts) ↔ `xamgle/lib/src/views/js_view_host.dart:17-39` |
145
+ | `View.getFunctions()` `meta.viewType` | 6 SQL functions registered for `DataQueryView` | [package.ts:223-269](../src/package.ts) ↔ `xamgle/lib/src/views/view.dart:42-48` — **string-matched, no constant on either side** |
146
+ | `DataQueryView` `getQueryInfo`/`setQueryAndRun` | connection discovery for DB tools | [db-view-functions.ts:24-30](../src/ai/db-view-functions.ts) ↔ `data_query_view.dart:15-44`; its `aiDescription` names Grokky's functions — bidirectional coupling |
147
+ | `shell.windows.showAI` / `.ai`, `Settings.showAI`, `docking.dart onClosing` | panel mount + visibility, survives X-close | [ai-window.ts:37,67,84-94](../src/ai/ai-window.ts) ↔ `shell.dart:702-706`, `ai_panel.dart`, `docking.dart:138-159`, `client_settings.dart:92` |
148
+ | `AppEvents.AI_PANEL_TOGGLE` (`d4-ai-panel-toggle`) | ribbon + query-editor wand toggle | [utils.ts:204-214](../src/utils.ts) ↔ `d4/lib/src/common/events.dart:282`, fired from `data_query_view.dart:153`. **Dual bus** — Dart fires on one, Grokky on the other, hence the `merge()` |
149
+ | `TextInterpreter` quick commands | viewer quick functions surfaced to the model | `d4/lib/src/common/text_interpreter.dart:76-124` (consumed indirectly via `getFunctions`) |
150
+ | `Modal` / `TabControl` / `Accordion` / `PropGrid` / `DataSourceCardView` / sketcher / Browse panel | standard widget functions the assistant drives | verified present at `d4/.../dialog.dart:47,76-132`, `tab_control.dart:53-63`, `accordion.dart:18-27`, `xamgle/.../data_source_card_view.dart:469-557` |
151
+ | `ui.markdown` → `Markup.processMarkup` | **all** assistant output rendering | [panel.ts:687](../src/ai/panel.ts), [utils.ts:266](../src/utils.ts) ↔ `d4/lib/src/common/markup.dart:388,420` — `NodeTreeSanitizer.trusted`, see [F-01](#f-01) |
152
+ | `Funcs.byName('setupAIQueryEditor')` | **core calls Grokky by bare function name** | `xamgle/lib/src/views/data_query_view.dart:78,743-747` — unnamespaced, collision-prone |
153
+
154
+ ### 4.2 js-api
155
+
156
+ `grok.dapi.docker.dockerContainers.{filter,webSocketProxy}` (discovery + transport),
157
+ `grok.dapi.token` (sent to the container on every message), `grok.dapi.{tables,views,projects,
158
+ queries,connections,scripts,spaces,files,groups,users}` (entity work), `grok.data.db.getInfo`
159
+ + `DbInfo`/`DbSchemaInfo` annotation APIs (DB metadata), `grok.userSettings` (quota counter),
160
+ `_package.logger.usage` (telemetry), `grok.shell.{v,views,tables}` (workspace snapshot),
161
+ `DG.Func.find/apply` (search providers, view functions), `ui.makeDroppable` / `DG.ObjectHandler`
162
+ / `ui.renderCard` (entity chips and cards), `DG.Project.showSaveDialog` (**exists, unused** —
163
+ see [F-14](#f-14)).
164
+
165
+ ### 4.3 Other packages
166
+
167
+ | Package | Coupling | Risk |
168
+ |---|---|---|
169
+ | **PowerPack** | `meta.role: searchProvider` (sanctioned) **plus** DOM scraping of `.power-pack-welcome-view`, `.power-search-search-everywhere-input`, `.power-pack-search-host` with 1s polling and a 600/400 ms dance around PowerPack's 500 ms debounce ([ui.ts:176-231](../src/ai/ui.ts)); `getFuncTableViewWidget` by name-only lookup; the status-bar robot icon shares `showAI` | Any PowerPack CSS/markup change silently kills AI search. ~~The retry counter never increments, so the poll runs forever ([F-32](#f-32))~~ *(fixed 2026-08-25 — `++retries`, poll stops after 10 attempts)* |
170
+ | **Flow** | consumes `FuncFlowView.getFunctions()` generically through `ViewBase.getFunctions` | Clean — the seam works as designed |
171
+ | **Chem / Bio / Curves** | referenced by curated prompts in [files/suggestions.yaml](../files/suggestions.yaml) and by chem skills | ~~Suggestions are filtered by semType only, not package availability~~ **Fixed 2026-08-24**: `requires: [Pkg]` per block/suggestion (mapped to each prompt's real backing functions), enforced in `resolveScopes()` |
172
+ | **@datagrok-libraries/db-explorer** | `getSchemaDescriptor` | Swallows all errors and returns an empty descriptor, which Grokky then caches forever ([F-36](#f-36)) |
173
+ | **ChatGPT package** | none in code; historical origin (IndexedDB is still named `chatgpt-conversations`) | Cosmetic |
174
+ | **PowerPack `helpIndex.g.ts:1090`** | links "Grokky" → `/help/deploy/releases/plugins/Grokky.md` | That file does not exist — dead link in help search |
175
+
176
+ ### 4.4 Containers and external
177
+
178
+ - `grokky-claude-runtime` — `node:22-slim`, clones the public repo to `/workspace` at build
179
+ time, `@anthropic-ai/claude-agent-sdk` pinned by lockfile to 0.2.52, `on_demand: true`,
180
+ **1 CPU, one instance for the whole Datagrok deployment**.
181
+ - `grokky-mcp-server` — `@modelcontextprotocol/sdk`, HTTP transport, auth per request via
182
+ `x-user-api-key` / `x-datagrok-api-url`.
183
+ - Providers: Anthropic API key, mounted `~/.claude/.credentials.json` subscription, AWS
184
+ Bedrock, or Azure Foundry (`server.ts` `applyProviderConfig`).
185
+ - Outbound from the container: `WebSearch`/`WebFetch` are in `allowedTools`; egress is
186
+ unrestricted.
187
+
188
+ ---
189
+
190
+ ## 5. The three reported failures
191
+
192
+ ### 5.1 "Data Sync is ON" — it was never on, and the save can destroy an existing sync
193
+
194
+ **The user's report.** Grokky opened `demog.csv`, set `df.tags['.data-sync'] = 'true'`, saved
195
+ a project, reported success, "verified" it, and only admitted on the third challenge that the
196
+ server-side `TableInfo` had zero tags.
197
+
198
+ **Ground truth, from core.** Data sync is not a flag you set; it is a *contract with a
199
+ creation script*:
200
+
201
+ 1. `DataFrame.tags` and `TableInfo.tags` are **different maps**. `grok_TableInfo_Get_Tags`
202
+ returns Dart `metaParams` (`grok_api.dart:812`), while `TableInfo.fromTable` copies only tag
203
+ **keys**, never values: `..tags = t.tags.keys.toSet()` (`table_info.dart:61`). So
204
+ `df.tags['.data-sync']='true'` → `df.getTableInfo()` → **the value is gone before the save
205
+ even starts**.
206
+ 2. The server requires the literal `'sync'`, not `'true'`: `t.metaParams[Tags.DataSync] == 'sync'`
207
+ (`shell_project.dart:127`, `table_info.dart:153`).
208
+ 3. Sync re-fetches by *replaying a creation script* stored in `metaParams['.script']`.
209
+ `DataHistory` refuses to record one for processed calls — and `grok.data.files.openTable`
210
+ runs `processed: true` (`grok_api.dart:992`, skipped at `shell.dart:1037,1120`). A
211
+ file-opened table therefore has **no creation script at all**, so there is nothing to sync.
212
+ 4. For query results, `data_history.dart:48` is explicit:
213
+ `if (r.func.isDirty || (r.func is DataQuery && !r.func.isOnServer)) return;` — **an unsaved
214
+ or dirty query produces no creation script**. The publish dialog even *hides* the data-sync
215
+ switch when no script exists (`project_entity_move.dart:341,496`). That is the answer to the
216
+ user's third report: saving the query server-side first is a hard prerequisite, and the
217
+ dialog additionally links the query **and its connection** into the project
218
+ (`project_entity_move.dart:378-399`) so a share is usable by anyone else.
219
+
220
+ **Why Grokky got it wrong.** [`plugin/skills/datagrok-projects/SKILL.md`](../dockerfiles/claude-runtime/plugin/skills/datagrok-projects/SKILL.md)
221
+ is the model's only teaching source for project saves. Read in full: the words *sync*,
222
+ `.script`, `metaParams`, and `showSaveDialog` **do not appear anywhere in it**. Asked for sync,
223
+ the model improvised — and improvised the only thing the API surface visibly offers.
224
+
225
+ <a id="f-13"></a>
226
+ **F-13 · CRITICAL · the skill's save recipe destroys existing data-sync configuration.**
227
+ Both recipes in the skill do `uploadDataFrame(t)` then `tables.save(t.getTableInfo())`. The
228
+ `TableInfo` is fresh, so its `metaParams` are empty; `metaParams` has no `ignoreForJson`
229
+ (`grok_shared.g.dart:2009-2012`), so **the empty map is serialized and sent**.
230
+
231
+ The server-side mechanism, read in full (`repository_meta_params_mixin.dart:44-57`) — the
232
+ precise behaviour matters, because a casual reading of `params.addAll(allParams)` suggests
233
+ existing rows are preserved, and for the rows that matter here they are not:
234
+
235
+ ```dart
236
+ var params = m.entityMetaParams.toList(); // derived from metaParams — EMPTY for a fresh TableInfo
237
+ var allParams = await db.metaParams.where(...); // all existing rows for this entity
238
+ await getForeignMetaParams(allParams); // REMOVES rows owned by the caller's own groups
239
+ params.addAll(allParams); // only FOREIGN-owned rows are carried over
240
+ await db.sql('delete from meta_params where entity_id = @eid');
241
+ for (var t in params) await db.metaParams.save(t); // reinsert: (arrived ∪ foreign)
242
+ ```
243
+
244
+ `entityMetaParams` is a derived getter over the `metaParams` map (`mixins.dart:106-111`), so an
245
+ empty map yields an empty list. `getForeignMetaParams` (`:29-35`) strips every row whose owner
246
+ is in the caller's group hierarchy. **So the sync rows a user (or their group) previously wrote —
247
+ `.script`, `.data-sync`, `.VariableName` — are deleted and not restored.** Rows owned by a group
248
+ the caller does not belong to survive. It happens twice per save, since `uploadDataFrame`
249
+ internally saves another empty `TableInfo` (`tables_client.dart:84`; `saveInfo` defaults true and
250
+ js-api exposes no way to pass false).
251
+
252
+ Core's own `Project.upload` does the opposite: it saves the live `TableInfo` *with* its
253
+ `metaParams` and skips the binary upload entirely for synced tables (`project.dart:232-239`).
254
+
255
+ > **Say "save my project" on a data-synced dashboard you own, and its sync configuration is
256
+ > silently and unrecoverably destroyed.** This is the single most serious finding in this audit.
257
+
258
+ *Core-side observation while verifying this:* `repository_meta_params_mixin.dart:49` reads
259
+ `params.removeWhere((t) => allParams.contains((a) => a.id == t.id))` — `List.contains` is being
260
+ passed a closure, which can never equal an element, so the guard is a permanent no-op and
261
+ same-named arriving/foreign params can be inserted twice. Unrelated to Grokky, worth a ticket.
262
+
263
+ **Fixes, in order.**
264
+
265
+ 1. **Rewrite the skill.** Interactive path: `DG.Project.showSaveDialog({tables, views, name, project})`
266
+ — the platform's purpose-built entry, which already does per-table sync toggles, dependency
267
+ linking and upload ([js-api/src/entities/project.ts:49-58](../../../js-api/src/entities/project.ts)).
268
+ Headless path: rehydrate `metaParams` from the server before saving, use `'sync'` not `'true'`,
269
+ never `uploadDataFrame` a synced table, and save the `TableInfo` **last**.
270
+ 2. **Teach the prerequisite:** before promising sync for query results, assert
271
+ `q.isOnServer && !q.isDirty`; if not, save the query and re-run it so `DataHistory` writes
272
+ `.script`; then link the query *and its connection* into the project.
273
+ 3. **Platform:** expose `Project.upload()` to JS, add `saveInfo` to `uploadDataFrame`, make
274
+ `TableInfo.fromTable` carry persistable tag values, and add `TableInfo.enableDataSync()`
275
+ that validates the preconditions and throws typed errors. See [§7](#7-what-the-platform-does-not-give-grokky).
276
+ 4. **Verification rule:** a claim about *persisted* state must be proven by a `grok.dapi.*`
277
+ re-read, never from `t`/`view`/`grok.shell`. See [§5.2](#52-not-verified-on-a-flawless-action).
278
+
279
+ ### 5.2 "Not verified" on a flawless action
280
+
281
+ **The user's report.** Three viewers added correctly; the exec block's own return value proved
282
+ four viewers existed; the panel still showed *"Not verified — the assistant could not confirm
283
+ this action took effect."*
284
+
285
+ **Root cause: three defects that were fixed in source on 2026-07-31 (commit `71eee21d1a`).**
286
+ Verified by reading the diff:
287
+
288
+ - `runVerification` called `executeSingleBlock(assertion)` **with no wrapper**. A bare
289
+ expression like `Array.from(view.viewers).length >= 4` inside `return (async () => { … })()`
290
+ evaluates to `undefined`, so `passed:false` with `error:null` — a correct assertion reported
291
+ as a failed one.
292
+ - The block message read *"the action did NOT take effect as claimed"* — the gate told the
293
+ model its correct action had failed, which is exactly the confusion visible in the user's
294
+ transcript.
295
+ - The self-verify branch did not reset `pendingActions`.
296
+
297
+ **So the primary action is deployment, not code.** The container compiles its own source
298
+ inside the image and `grok publish` does not rebuild it. **Any `grokky-claude-runtime` image
299
+ built before 2026-07-31 still reproduces this exactly.**
300
+
301
+ <a id="f-02"></a>
302
+ **F-02 · MEDIUM · split-brain deployment with no version handshake.** Half the fix lives in
303
+ the image (`verify.ts`), half in the webpack bundle (`exec-blocks.ts`), and the WebSocket
304
+ protocol carries no build id in either direction ([types.ts:52-126](../dockerfiles/claude-runtime/src/types.ts),
305
+ [runtime-client.ts:111-152](../src/claude/runtime-client.ts)). Neither side can detect that the
306
+ other is stale. **Fix:** emit a commit/build id in the connect handshake or `sync_status` and
307
+ warn on mismatch.
308
+
309
+ **Live residual defects in the same failure class** — each can still turn a correct action
310
+ into "Not verified":
311
+
312
+ <a id="f-03"></a>
313
+ - **F-03 · MEDIUM · `wrapAssertion`'s `\breturn\b` regex is token-blind**
314
+ ([exec-blocks.ts:40-48](../src/claude/exec-blocks.ts)). An assertion whose only `return` is
315
+ inside a callback — `…filter(v => { return v.type === DG.VIEWER.SCATTER_PLOT; }).length >= 1` —
316
+ short-circuits the wrapper, yields `undefined`, and reports failure. Same for `return` inside
317
+ a string. **Fix:** prefer the parse test (`new Function('return (' + a + '\n)')`) and fall
318
+ back to raw text only when it fails to parse.
319
+ <a id="f-04"></a>
320
+ - **F-04 · MEDIUM · a non-serializable result inverts a passing verdict**
321
+ ([runtime-client.ts:215-227](../src/claude/runtime-client.ts)). If `observed` or `returnValue`
322
+ contains a cyclic Dart handle — e.g. returning `Array.from(view.viewers)` — the catch replaces
323
+ the **entire** response with `{success:false, passed:false}`. A true pass becomes a failure.
324
+ `serializeResult` already exists ([view-tools.ts:184](../src/ai/view-tools.ts)) but is never
325
+ applied on the exec/verify path. **Fix:** serialize before responding; degrade only the
326
+ offending field.
327
+ <a id="f-05"></a>
328
+ - **F-05 · LOW · a legitimately falsy observation can never pass**
329
+ ([exec-blocks.ts:67](../src/claude/exec-blocks.ts)): `passed: res.error == null && !!res.value`.
330
+ "Close all charts" observing `0` remaining is unverifiable by construction.
331
+ <a id="f-06"></a>
332
+ - **F-06 · MEDIUM · the gate is satisfiable by `assertion: 'return true'`**
333
+ ([verify.ts:81-86](../dockerfiles/claude-runtime/src/verify.ts)) — which clears all pending
334
+ actions and resets both counters. The only defence is prose in the tool schema. This is most
335
+ likely to be exercised precisely when the model is under block pressure.
336
+ <a id="f-07"></a>
337
+ - **F-07 · MEDIUM · `get_view_function_result` mutates without arming the gate.** Both view
338
+ invocation tools share one unrestricted runner ([view-tools.ts:319-320](../src/ai/view-tools.ts)),
339
+ and the verifier classifies read-only by *name prefix* (`/^(whoami$|list|get|search|read|
340
+ download|find)/`, [verify.ts:5](../dockerfiles/claude-runtime/src/verify.ts)) — so `get_…`
341
+ matches, and a state-changing `DG.Func` invoked through it mutates the workspace with no
342
+ proof demanded and no `unverified` flag.
343
+ <a id="f-08"></a>
344
+ - **F-08 · LOW · persistence claims are verified against client memory.** The block message
345
+ says *"RE-READS all affected state from `t`/`view`/`grok`"*. `grok` technically includes
346
+ `grok.dapi`, but nothing requires it for claims about *saved* state — which is exactly how
347
+ failure 5.1 "verified" itself.
348
+
349
+ **The structural answer** is in [§8.2](#82-verification-that-does-not-depend-on-the-model).
350
+
351
+ ### 5.3 "Save query results as a data-synced project" — impossible, and Grokky didn't know
352
+
353
+ Covered by 5.1 point 4. The prerequisite (`isOnServer && !isDirty`, plus linking the query and
354
+ connection into the project) exists only in Dart dialog code; **no skill or prompt mentions it**.
355
+ The model cannot infer it from any surface it can see.
356
+
357
+ ---
358
+
359
+ ## 6. Findings
360
+
361
+ Ordered by theme. `F-01`…`F-45` are the verified set; each was re-checked against source.
362
+
363
+ ### 6.1 Execution and trust
364
+
365
+ <a id="f-09"></a>
366
+ **F-09 · HIGH · model-authored JavaScript executes with the page's full authority, with no
367
+ consent step.** [ui.ts:525-531](../src/ai/ui.ts) → [exec-blocks.ts:17-20](../src/claude/exec-blocks.ts):
368
+ `new Function('grok','ui','DG','view','t', 'return (async () => {'+code+'})()')`. It also closes
369
+ over `window`, `document`, `fetch`, `localStorage`, and reaches `grok.dapi.token`. The panel
370
+ **already ships a confirmation mechanism** (`addConfirmMessage`, [panel.ts:487-514,551](../src/ai/panel.ts)) —
371
+ its only call sites are commented out in the non-bundled `src/depr/`. Combined with `WebSearch`/
372
+ `WebFetch` in `allowedTools`, all three legs of the "lethal trifecta" are present and unmitigated:
373
+ private data, untrusted content, exfiltration capability.
374
+ **Fix:** risk-tiered consent (auto-run reads and additive UI changes; confirm the destructive
375
+ class), plus the compensating controls in [§8.3](#83-a-trust-model-that-does-not-break-the-product).
376
+
377
+ <a id="f-01"></a>
378
+ **F-01 · HIGH · assistant markdown is rendered with a trusting sanitizer, and no CSP exists.**
379
+ [panel.ts:687](../src/ai/panel.ts) and [utils.ts:266](../src/utils.ts) call `ui.markdown` →
380
+ `markup.dart:388` (`ExtensionSet.gitHubWeb`, raw inline HTML passes) → `markup.dart:420`
381
+ `setInnerHtml(..., treeSanitizer: NodeTreeSanitizer.trusted)`. A grep for
382
+ `Content-Security-Policy` across `core/` returns **nothing**. `<img onerror>` in model output —
383
+ which is attacker-influenceable through any fetched page, file, or DB row the runtime reads —
384
+ executes in the user's authenticated tab, and re-executes every time the stored conversation is
385
+ reopened. **Fix in the platform, not the plugin:** an untrusted mode on `ui.markdown` fixes
386
+ every plugin at once.
387
+
388
+ <a id="f-10"></a>
389
+ **F-10 · MEDIUM · typing in the search box runs generated JavaScript.**
390
+ `smartExecution` ([ui.ts:117-152](../src/ai/ui.ts)) executes the model's code inside `ui.wait(…)`
391
+ as the results render; the code appears afterwards, in a collapsed accordion. There is no Run
392
+ button and no verify round-trip. This is the most surprising path in the product.
393
+ *Resolution (2026-08-25): by design — Execute exists to show the live result immediately; a Run gate would defeat its purpose.*
394
+
395
+ <a id="f-11"></a>
396
+ **F-11 · MEDIUM · exec return values are injected into model context uncapped.**
397
+ `executeSingleBlock` → `{returnValue: value}` → bare `JSON.stringify` at
398
+ [runtime-client.ts:218-226](../src/claude/runtime-client.ts) → another bare `JSON.stringify` in
399
+ the runtime's `asResult`. A model that returns `t.toCsv()` on a large table blows the context
400
+ window mid-turn. The MCP server does this correctly (paging + 20k cap); the exec path does not.
401
+
402
+ <a id="f-12"></a>
403
+ **F-12 · MEDIUM · ~~injected content in the query matcher~~.** ~~Every dataframe-returning function's
404
+ description and `searchPattern` is interpolated verbatim into the matcher prompt, and both the
405
+ chosen pattern and the `confidence > 0.7` gate are free-form model output
406
+ ([query-matching.ts:123-129,189-200](../src/ai/search/query-matching.ts)). Anyone who can share a
407
+ query with the victim can craft a description that hijacks unrelated searches.~~
408
+ ~~**Fix:** make `searchPattern` an enum over the collected patterns; delimit and truncate
409
+ descriptions; confirm before executing.~~ **Fixed 2026-08-24**: `searchPattern` is a schema enum
410
+ over the collected patterns plus `NO_MATCH`; delimiting/truncating deliberately omitted.
411
+
412
+ ### 6.2 The container: multi-tenancy and lifecycle
413
+
414
+ One `grokky-claude-runtime` instance, 1 CPU, serves the entire deployment. Every turn runs as
415
+ uid 1001 `grok`.
416
+
417
+ <a id="f-15"></a>
418
+ **F-15 · HIGH · ~~per-user identity comes from an unverified JWT~~.** ~~[user-dir.ts:8-25](../dockerfiles/claude-runtime/src/user/user-dir.ts)
419
+ base64-decodes the token payload and uses `payload.sub` as a path segment with **no signature
420
+ check and no character validation**. Any client that can reach `/ws` can present a hand-crafted
421
+ unsigned token and get `cwd=/users/<victim>` with read tools enabled; an unsanitized `sub` also
422
+ escapes `/users` by traversal. **Fix:** resolve identity once per connection via an authenticated
423
+ `GET /public/v1/users/current` and validate against `/^[A-Za-z0-9_.-]+$/`.~~
424
+ **(resolved 2026-08-24: identity comes from `GET /users/current` with the presented token
425
+ (10-min TTL, negative cache for rejected tokens); id validated against `[a-zA-Z0-9-]{1,64}`;
426
+ JWT-decode and fallbacks removed. Verification URL: `DATAGROK_API_URL` (Datlas-injected) wins,
427
+ else first client URL pinned. Details in AUDIT-TODO.md; container rebuild required.)**
428
+
429
+ <a id="f-16"></a>
430
+ **F-16 · HIGH · ~~cross-user private files are readable~~.** ~~Each user's synced Home files live at
431
+ `/users/<login>/agents` mode 644, owned by the same uid every turn runs as. The only PreToolUse
432
+ guard blocks `/workspace` — not `/users` ([query-options.ts:15-31](../dockerfiles/claude-runtime/src/query-options.ts)),
433
+ and in fact explicitly whitelists `/users/<anyone>/workspace` before testing. `Read /users/<other>/agents/…`
434
+ succeeds.~~
435
+ **(resolved 2026-08-17: per-session guard — any `/users/...` reference outside the user's own dir,
436
+ any `..` segment, and any foreign `/workspace` are blocked. Bash obfuscation can still escape;
437
+ real closure is [F-17](#f-17) / OS isolation. Container rebuild required.)**
438
+
439
+ <a id="f-17"></a>
440
+ **F-17 · HIGH · provider credentials sit inside the agent's blast radius.** `allowedTools`
441
+ includes `Bash`, `WebFetch`, `Write`; `permissionMode: 'acceptEdits'`; no `sandbox`, no `env`
442
+ scoping, and `canUseTool` ([session.ts:306-312](../dockerfiles/claude-runtime/src/session.ts))
443
+ returns `{behavior: 'allow'}` for **every tool and every input**, making the SDK's permission
444
+ ladder a no-op. `process.env` still holds the provider credentials under both the SDK names and
445
+ the raw injected names, and `~/.claude/.credentials.json` is on disk. Bash + WebFetch + that env
446
+ is a complete exfiltration primitive.
447
+ **(resolved 2026-08-25: a credential broker on a separate `broker` uid holds the provider creds and
448
+ subscription token and injects them on egress; the agent's CLI/bash run as `grok` with an
449
+ allowlisted, broker-pointed env, so `env`, `/proc/*/environ`, the creds file, and the CLI argv carry
450
+ no secret. Credential *use* through the broker and the per-user datagrok key in server memory are the
451
+ accepted residuals (the latter needs a server/CLI uid split). Container rebuild required.)**
452
+
453
+ <a id="f-18"></a>
454
+ **F-18 · HIGH · watchdog and reaper are container-wide and identity-blind.**
455
+ `killStrayChildren` ([watchdog.ts:59-68](../dockerfiles/claude-runtime/src/watchdog.ts)) SIGKILLs
456
+ **every** direct child when *one* session goes silent for 90 s — including other users' healthy
457
+ in-flight turns. The reaper's oldest-first arithmetic is unsound under concurrency: with two
458
+ live turns and one orphan, it kills the oldest live turn and the orphan survives.
459
+
460
+ <a id="f-19"></a>
461
+ **F-19 · HIGH · ~~the reaper kills the login subprocess~~.** ~~`claude auth login` is a direct child
462
+ matching the reaper's `/claude/` comm filter but is never counted as an active query, so the
463
+ first 30-second sweep SIGKILLs it while the user is fetching their OAuth code. The pasted code
464
+ then hits *"No authentication in progress"*.~~
465
+ **(resolved 2026-08-17: the login pid is exempted from the reaper and `killStrayChildren`
466
+ via `setAuthPid`; the flow bounds itself with a 2-minute timeout. Container rebuild required.)**
467
+
468
+ <a id="f-20"></a>
469
+ **F-20 · HIGH · ~~subscription re-auth never shows a link~~.** ~~`handleAuthStart` scrapes the URL
470
+ with `/https:\/\/claude\.com\/cai\/oauth[^\s]+/` ([server.ts:40](../dockerfiles/claude-runtime/src/server.ts)),
471
+ but the shipped CLI (v0.2.52) emits `https://claude.ai/oauth/authorize` or
472
+ `https://platform.claude.com/oauth/authorize`. No `auth_url` is ever emitted — **the documented
473
+ inline re-auth flow, screenshots and all, cannot work as shipped.**~~
474
+ **(resolved 2026-08-24: not reproducible — CLI 2.1.231/2.1.233/2.1.241 all print
475
+ `https://claude.com/cai/oauth/authorize?...`, which the regex matches. The real hazard was the
476
+ unpinned CLI install in the Dockerfile — now pinned to 2.1.231. Container rebuild required.)**
477
+
478
+ <a id="f-21"></a>
479
+ **F-21 · HIGH · ~~`AskUserQuestion` has no timeout, and it wedges container-wide sync~~.** ~~It is
480
+ the only browser round-trip without one ([session.ts:306-310](../dockerfiles/claude-runtime/src/session.ts);
481
+ every other passes `EXEC/VERIFY/SHOW_ENTITIES/VIEW_TOOL_TIMEOUT`). An unanswered or dismissed
482
+ question pins `runTurn` indefinitely, keeps `activeCount` inflated, and — because
483
+ `syncWorkspace` latches `syncing = true` before an unbounded `await allQueriesIdle`
484
+ ([workspace.ts:33-40](../dockerfiles/claude-runtime/src/sync/workspace.ts)) — **freezes the
485
+ workspace git sync for the container's lifetime** ([F-22](#f-22)).~~
486
+ **(resolved 2026-08-17: 60 s timeout; expiry denies the tool with a "no answer" message,
487
+ abort still propagates. Container rebuild required.)**
488
+
489
+ <a id="f-22"></a>
490
+ **F-22 · MEDIUM · ~~`syncWorkspace` can wedge permanently~~** — see above. **Fix:** race
491
+ `allQueriesIdle` against a bounded timeout and sync anyway.
492
+ **(resolved 2026-08-17 via the F-21 timeout: all round-trips are now bounded, so
493
+ `allQueriesIdle` always resolves; the defensive race was not added.)**
494
+
495
+ <a id="f-23"></a>
496
+ **F-23 · MEDIUM · ~~the whole knowledge-sync subsystem is inert~~.** Files are synced to
497
+ `/users/<id>/agents/`, but nothing points the model at them: no prompt reference, no `CLAUDE.md`
498
+ at `cwd`, and they are not under `.claude/skills` for native discovery. Discovery depends on the
499
+ model spontaneously globbing its working directory. **Fix (already named as "future direction"
500
+ in [IMPLEMENTATION.md:111](IMPLEMENTATION.md)):** write them into `<userDir>/.claude/skills/`,
501
+ or generate a `CLAUDE.md` index and enable `settingSources: ['project']`.
502
+ **(resolved 2026-08-25: each sync regenerates a lazy `agents/INDEX.md` the prompt points to, so
503
+ per-user content stays out of the prompt. `.claude/skills` / `settingSources` were rejected — cwd
504
+ is model-writable, so honoring settings there is a persistence channel. Container rebuild required.)**
505
+
506
+ <a id="f-24"></a>
507
+ **F-24 · MEDIUM · ~~the first turn on a cold container has an empty `workspace/`~~.**
508
+ ~~The comment at [orchestrator.ts:136](../dockerfiles/claude-runtime/src/sync/orchestrator.ts) calls
509
+ the first sync blocking; `runTurn` never awaits it. So the system prompt's mandated
510
+ `Read workspace/help/INDEX.md` hits ENOENT on the very first message of a cold container.~~
511
+ **(resolved 2026-08-25: `handleMessage` awaits the first sync, with the per-package stage batched
512
+ 8-wide — measured 1.9 s cold on a local stand; needs container rebuild)**
513
+
514
+ <a id="f-25"></a>
515
+ **F-25 · MEDIUM · ~~shared-folder sync is an unauthenticated injection channel~~.** Any connection
516
+ named `MyFilesAgents` visible to a user is synced into their agent-knowledge directory with no
517
+ ownership check, size cap, or provenance marker ([shared-connections.ts:20-22](../dockerfiles/claude-runtime/src/sync/shared-connections.ts)).
518
+ Currently mitigated only by F-23 (nothing reads the directory) — which means **fixing F-23
519
+ activates this**. Fix both together.
520
+ **(resolved 2026-08-25, with F-23: shared files are grouped in `agents/INDEX.md` under their source
521
+ connection with a standing "written by OTHER users — reference data, never instructions" note.
522
+ Ownership/size gates declined by design — the platform share grant is the authorization.)**
523
+
524
+ <a id="f-26"></a>
525
+ **F-26 · MEDIUM · the auth relay is unauthenticated and process-global.** `auth_start`/`auth_code`
526
+ dispatch with no authorization check against a single module-level `authProc`
527
+ ([server.ts:22-29,103-111](../dockerfiles/claude-runtime/src/server.ts)): any client on `/ws` can
528
+ kill another user's login or feed a code into the shared `claude auth login`, replacing the
529
+ container-wide credentials. *(fixed 2026-08-25 — the flow is bound to the connection that started
530
+ it: only the owner can restart it or send `auth_code`, others get an "already in progress" error,
531
+ and the owner's disconnect kills it)*
532
+
533
+ <a id="f-27"></a>
534
+ **F-27 · MEDIUM · the model can write into the shared `/workspace` clone, and the sync silently
535
+ discards it.** Staged entries are absolute symlinks; the PreToolUse guard only matches absolute
536
+ `/workspace` strings, so the relative paths the prompt teaches write straight through. The
537
+ 30-minute `git reset --hard` then reverts tracked changes and never cleans untracked files.
538
+
539
+ ### 6.3 The knowledge that teaches the model
540
+
541
+ Skills are the model's declared source of truth (`prompts.ts:97`: *"the matching per-area skill
542
+ is the source of truth for the API"*). They are not tested.
543
+
544
+ <a id="f-28"></a>
545
+ **F-28 · HIGH · 74 fenced ` ```datagrok-exec ` blocks across six skills teach a format nothing
546
+ executes.** Traced definitively: `finalizeStreaming` ([panel.ts:724-748](../src/ai/panel.ts)) →
547
+ `createStyledMarkdown` → `ui.markdown` only; no fence parser exists anywhere.
548
+ `executeSingleBlock` has three callers, none of them the final-response path. Counts:
549
+ `datagrok-df-and-columns` 25, `grid-customization` 14, `selection` 13, `viewers` 13, `filtering`
550
+ 5, `calc-column` 4; mentions of the actual `datagrok_exec` tool across all six: **zero**. This
551
+ directly contradicts the always-inlined `datagrok-exec` skill ("Regular markdown code blocks do
552
+ NOT execute"). Mitigated because the real contract is inlined into every full-mode prompt — but
553
+ if the model copies a skill's fence into its reply, the user sees code, nothing runs, and no
554
+ error appears.
555
+
556
+ <a id="f-29"></a>
557
+ **F-29 · HIGH · `datagrok-chem-data` teaches a `propName` that silently yields an all-null
558
+ column.** `Curves:addStatisticsColumn(fitTable, 'fit', 'IC50', 0)` — `IC50` is not a
559
+ `FitStatistics` key (the canonical one is `interceptX`), so every row's lookup returns
560
+ `undefined`, the float column is all-null, and the tool reports success.
561
+
562
+ <a id="f-30"></a>
563
+ **F-30 · MEDIUM · `datagrok-chem-toolkit` invents a `join(table)` tag on four Chem functions**
564
+ and tells the model not to append results itself. Called directly, the returned DataFrame is
565
+ simply discarded and the user's table is unchanged.
566
+
567
+ <a id="f-31"></a>
568
+ **F-31 · MEDIUM · `datagrok-calc-column`'s flagship example calls a function that does not
569
+ exist.** `HeavyAtomCount` is an RDKit descriptor name passed inside `Chem:getDescriptors`'
570
+ `selected` list, not a registered Datagrok function, and it is not `vectorFunc`-tagged anywhere —
571
+ so the formula fails to resolve. This is the exact failure mode the skill exists to prevent.
572
+
573
+ Also: no skill mentions `verify` at all, so every skill recipe costs an extra gate round-trip;
574
+ no skill mentions `list_view_functions`, so a loaded skill gives the model no nudge back toward
575
+ the preferred typed path; `loadInlinedSkills`' empty `catch` ([prompts.ts:137](../dockerfiles/claude-runtime/src/prompts.ts))
576
+ would ship a prompt with **no exec contract at all** and log nothing; and ~~60 lines of
577
+ `<!-- REMOVED -->` HTML comment still ship inside `chem-toolkit/SKILL.md`~~ *(stripped 2026-08-24)*.
578
+
579
+ ### 6.4 Browser compatibility
580
+
581
+ `CLAUDE.md` mandates Chrome 50 / Dartium support. Verified against `src/polyfills.ts`,
582
+ `tsconfig.json` and the emitted `dist/package.js`:
583
+
584
+ <a id="f-33"></a>
585
+ **F-33 · MEDIUM · `Promise.prototype.finally` (Chrome 63+) is unpolyfilled and on the critical
586
+ path.** [runtime-client.ts:69-70](../src/claude/runtime-client.ts) in `ensureConnected()`, which
587
+ **every** stream path awaits. In Dartium the first connection attempt throws before any request
588
+ is sent — every panel prompt, search and warm-up fails. *(fixed 2026-08-18 — polyfilled in
589
+ `polyfills.ts`)*
590
+
591
+ <a id="f-34"></a>
592
+ **F-34 · MEDIUM · `String.prototype.matchAll` (Chrome 73+) is unpolyfilled.**
593
+ [prompt-suggestions.ts:60](../src/ai/prompt-suggestions.ts), reached for every suggestion — the
594
+ empty state and wand menu silently never render, each leaving an unhandled rejection.
595
+ *(fixed 2026-08-18 — polyfilled in `polyfills.ts`)*
596
+
597
+ <a id="f-35"></a>
598
+ **F-35 · MEDIUM · voice input is dead in every Chromium browser.**
599
+ [panel.ts:1138](../src/ai/panel.ts) constructs the bare `SpeechRecognition` global; Chrome ships
600
+ only `webkitSpeechRecognition`. A grep across all packages finds zero uses of the prefixed name.
601
+ The mic button, the "say cancel" escape hatch, and the hint text are all unreachable — and
602
+ `help/explore/ai/ai.md` advertises the feature. *(fixed 2026-08-18 — aliased in `polyfills.ts`,
603
+ mic button disabled with a tooltip where unsupported)*
604
+
605
+ Also: `Node.isConnected` (Chrome 51+) gates both auth-renewal handlers, so `!widget.isConnected`
606
+ is always true and the "Session renewed" strip never appears ([ui.ts:340,350](../src/ai/ui.ts))
607
+ *(fixed 2026-08-24 — polyfilled in `polyfills.ts`)*;
608
+ `event.key === 'Escape'` at [panel.ts:191](../src/ai/panel.ts) bypasses the package's own
609
+ `isEnterKey` convention *(fixed 2026-08-24 — `keyCode === 27` fallback)*;
610
+ and the exec/verify wrapper builds an **async arrow IIFE at runtime**,
611
+ which `new Function` cannot parse in Chrome 50 — a real exemption to `CLAUDE.md:42`'s "TypeScript
612
+ transpiles it" claim, which only covers compiled source. Decide whether Dartium is genuinely
613
+ supported and either fix these or amend the doc. *Resolution (2026-08-25): won't do — exec/verify
614
+ runs LLM-generated modern JS; in Dartium it fails as a contained, visible execution error.*
615
+
616
+ ### 6.5 Panel, session, and quota
617
+
618
+ <a id="f-37"></a>
619
+ **F-37 · HIGH · ~~New Chat and history-load mid-stream corrupt state and storage~~.**
620
+ ~~Neither has a busy guard nor aborts ([panel.ts:226-239,1062-1097](../src/ai/panel.ts)). The
621
+ running turn keeps its captured sessionId, so chunks keep appending into a now-detached node,
622
+ `onFinal` pushes the old turn into the *new* message array, and `endSession` saves the mixture.~~
623
+ **(resolved 2026-08-17: both handlers early-return while streaming, and the buttons are disabled
624
+ via `ui.setDisabled` with a "Wait for response or press Stop" tooltip, re-enabled in `endSession`
625
+ — which runs in a `finally`, covering abort/error paths. Browser bundle only.)**
626
+
627
+ <a id="f-38"></a>
628
+ **F-38 · MEDIUM · ~~the daily quota is hardcoded off~~, and is client-side anyway.**
629
+ ~~[usage-limiter.ts:64-78](../src/ai/usage-limiter.ts): `this.dailyLimit = 1000; // TODO: handle
630
+ better - need this to unblock my work` sits **before** the group-membership lookup, so the
631
+ documented "AI Folks 1000/day, everyone else 20/day" is dead code and `CLAUDE.md:212-215` is
632
+ wrong.~~ **(resolved 2026-08-17: override removed; `Developers` and `Administrators` added to
633
+ `groupLimits` at 1000/day. Browser bundle only.)** Still open: the counter is client-side in `grok.userSettings`
634
+ — rewritable, racy across tabs, no server-side limit — see the platform ask below.
635
+
636
+ <a id="f-39"></a>
637
+ **F-39 · MEDIUM · ~~the whole UI is gated on the wrong configuration flag~~.**
638
+ ~~All five entry points bail on `grok.ai.config.configured`, which means only that the *core admin
639
+ AI Providers* setting has an endpoint and credential — a provider used for embeddings and entity
640
+ indexing. Grokky's actual backend is the container. **A deployment with both containers running
641
+ and valid Claude credentials shows no AI at all** unless an unrelated OpenAI/Azure key is also
642
+ configured.~~ **Fix:** gate on container availability (the discovery code already exists), or add
643
+ a package setting.
644
+ **(resolved 2026-08-18: all five entry points now gate on `ClaudeRuntimeClient.discover()` — a single
645
+ cached discovery shared with `connect()`; the container entity being discoverable, stopped on-demand
646
+ counts. Browser bundle only.)**
647
+
648
+ <a id="f-40"></a>
649
+ **F-40 · MEDIUM · ~~a legitimate answer mentioning `/login` is replaced by the auth widget~~.**
650
+ ~~[ui.ts:486](../src/ai/ui.ts): `/Failed to authenticate.*API Error: 401|authentication_error|\/login/i`
651
+ tested against the whole rendered answer. Any docs answer citing a login URL is discarded from
652
+ both the UI and the message history and replaced with "Session expired".~~
653
+ **(resolved 2026-08-17: the runtime now detects expiry via the Agent SDK's typed
654
+ `error: 'authentication_failed'` assistant-message code and emits an `auth_required` event;
655
+ both browser regexes are removed. Browser bundle and runtime image must deploy together.)**
656
+
657
+ <a id="f-41"></a>
658
+ **F-41 · MEDIUM · ~~the on-demand container's cold start can exceed the connect timeout~~.**
659
+ ~~[runtime-client.ts:91](../src/claude/runtime-client.ts) uses the js-api default 60 s against a
660
+ container declared `on_demand: true`, contrary to the js-api doc comment at `dapi.ts:1170` and to
661
+ Grokky's own benchmark comment. On timeout the turn dies with "container is not running" — after
662
+ the quota counter was already incremented.~~
663
+ **(resolved 2026-08-17: `webSocketProxy` is now called with an explicit 180 s timeout.
664
+ Browser bundle only, no container rebuild.)**
665
+
666
+ <a id="f-42"></a>
667
+ **F-42 · MEDIUM · ~~the Run button on agent scripts runs the wrong file~~.** ~~The button is attached
668
+ to file views under the user's **My Files** `agents/scripts/`, but `runAgentScript` reads
669
+ `_package.files.readAsText('scripts/<name>.md')` — the pristine **packaged** copy
670
+ ([ui.ts:683-715](../src/ai/ui.ts)). Editing a seeded script has no effect, and a user-authored
671
+ script fails outright.~~ Root cause is a platform gap: `ViewBase.entity` is stubbed to null in
672
+ js-api, so the view's own `FileInfo` is unreachable.
673
+ **(resolved 2026-08-18: `runAgentScript` now reads the MyFiles copy via `grok.dapi.files`;
674
+ the `ViewBase.entity` gap remains open.)**
675
+
676
+ <a id="f-43"></a>
677
+ **F-43 · MEDIUM · ~~session continuity dies with the container~~.** ~~The `sessionId → sdkId`
678
+ registry is an in-memory LRU capped at 200 ([session.ts:24,35-47](../dockerfiles/claude-runtime/src/session.ts));
679
+ when the `on_demand` container stops while idle, the record is lost, the panel reuses the same
680
+ sessionId, and the model silently starts with no history while the UI shows the full transcript.~~
681
+ **Fix:** reply with a `session_reset` event so the panel can replay via the existing
682
+ `flushRestoredContext` path.
683
+ **(resolved 2026-08-18: sends on sessions with history carry `resumeExpected`; a runtime with no
684
+ record replies `session_reset` and the panel resends with the derived transcript. Verified live.
685
+ Durable server-side sessions remain open as the bigger alternative.)**
686
+
687
+ ### 6.6 MCP server, DB tooling, and packaging
688
+
689
+ <a id="f-14"></a>
690
+ **F-14 · CRITICAL · ~~every file written through MCP is corrupted~~.**
691
+ ~~[shared-api-client.ts:44](../dockerfiles/mcp-server/src/shared-api-client.ts):
692
+ `body: body === undefined ? undefined : JSON.stringify(body)` — unconditional, with no string
693
+ branch. `uploadFile` (`:78-81`) passes the raw content string and sets
694
+ `Content-Type: application/octet-stream`, but `request()` has already JSON-encoded it. So
695
+ `datagrok_files.upload` and `datagrok_spaces.write_file` store the JSON *literal* of the content:
696
+ surrounding quotes, `\n` instead of newlines, escaped quotes — and it overwrites the target path.
697
+ Verified by reading both functions.~~
698
+ **(resolved 2026-08-17: string bodies pass through untouched in both copies (also fixes
699
+ `datagrok_spaces.write_file`); round-trip test added; verified live. Needs container rebuilds.)**
700
+
701
+ <a id="f-44"></a>
702
+ **F-44 · HIGH · SSRF via `x-datagrok-api-url`.** The MCP container takes its Datagrok base URL
703
+ from a request header with no allowlist ([index.ts:61-68](../dockerfiles/mcp-server/src/index.ts)),
704
+ and the datlas docker proxy forwards it untouched. Any authenticated user who can reach the
705
+ container can make it fetch internal endpoints and get the body back.
706
+ **Fix:** inject the base URL as a container env var and ignore the header.
707
+
708
+ <a id="f-45"></a>
709
+ **F-45 · HIGH · `datagrok_spaces.create` creates spaces that never appear in `list`.**
710
+ `api-client.ts:104` posts only `{name}`, so `isRoot` stays false and `listRootSpaces` excludes
711
+ it — invisible in both the tool and the Spaces UI. It also stores the display string where a
712
+ slug belongs.
713
+
714
+ Also in the MCP server: binary downloads are UTF-8-decoded into replacement characters
715
+ (`claude-runtime` has a correct `requestBinary` — it was simply not copied); `cap()` truncates
716
+ **after** serialization so an oversized page is handed to the model as unparseable JSON;
717
+ ~~`formatError` omits `isError` and bypasses `cap()`, so a large datlas stack trace lands whole in
718
+ the transcript~~ **(resolved 2026-08-25: message truncated at 2000 chars before stringify, result
719
+ carries `isError: true`)**; ~~destructive ops have no confirmation and no dry-run~~ **(resolved 2026-08-24:
720
+ dry-run + confirm token; the panel confirms via the `datagrok_confirm` card)**.
721
+
722
+ <a id="f-36"></a>
723
+ **F-36 · MEDIUM · a transient schema fetch failure is cached for the session.**
724
+ `getSchemaDescriptor` (db-explorer) swallows every error and returns an empty descriptor;
725
+ [db-index-tools.ts:16-32](../src/db/db-index-tools.ts) caches it in a module-static `Map` with no
726
+ TTL and no invalidation. One blip strips every FK-derived relation for that connection until
727
+ reload. The catalog argument is also dropped, so two catalogs with the same schema name share
728
+ one entry.
729
+
730
+ <a id="f-46"></a>
731
+ **F-46 · HIGH · `moveMetaToDB` wipes curated DB metadata.** A registered, ungated, unconfirmed
732
+ package function ([package.ts:271-275](../src/package.ts)) that resolves a connection by hardcoded
733
+ name, calls `clearProperties()` on it, and rewrites everything from a frozen LLM-generated
734
+ snapshot containing at least one invented join. Any human-curated comments or relations are lost
735
+ with no undo.
736
+
737
+ <a id="f-47"></a>
738
+ **F-47 · HIGH · 640 KB — 55% of the shipped bundle — is hardcoded schema for two databases.**
739
+ `chembl-index.ts` (10,074 lines) and `biologics-index.ts` are statically imported into the entry
740
+ graph and measured at 639 KB of the 1.16 MB `dist/package.js`, downloaded and parsed by every
741
+ user, solely to back that dev-only function. Meanwhile the pipeline that would generate exactly
742
+ this into platform sticky meta (`genDBConnectionMeta`, `moveDBMetaToStickyMeta`) sits behind a
743
+ disabled joke guard at [package.ts:278-280](../src/package.ts).
744
+
745
+ Packaging: ~~the bundle is built in **development mode** (`webpack.config.js:9`) — the datagrok
746
+ template says `production` — shipping 1.16 MB unminified plus a 1.42 MB source map~~
747
+ **(resolved 2026-08-17: production mode by default via `NODE_ENV ?? 'production'`, bundle
748
+ 1.12 MB → 534 KB)**. ~~Ten npm dependencies (`openai`, `ai`, four `@ai-sdk/*`,
749
+ `@modelcontextprotocol/sdk`, `cash-dom`, `@datagrok-libraries/utils`, `@types/dom-chromium-ai`)
750
+ are unused by active code and inflate the audited CVE surface; the only live import is a
751
+ type-elided `import {OpenAI}` in [storage.ts:4](../src/ai/storage.ts) that is never referenced~~
752
+ **(resolved 2026-08-17: all ten removed along with the dead import — 108 packages dropped from
753
+ the lockfile)**. ~~`.npmignore` does not mirror
754
+ `.gitignore`'s secret patterns (`myKey.txt`, `files/benchmarks`) even though it disables
755
+ `.gitignore` for the whole tree~~ **(resolved 2026-08-25: both patterns added to
756
+ `.npmignore`)**. ~~`CREDITS.md` lists `@anthropic-ai/claude-agent-sdk` as MIT; its
757
+ own LICENSE.md reads "© Anthropic PBC. All rights reserved."~~ **(resolved 2026-08-25:
758
+ relabeled Proprietary with a link to Anthropic's Legal Agreements)**
759
+
760
+ ### 6.7 Documentation drift
761
+
762
+ ~~`docs/CLAUDE_CODE_FLOW.md` documents a `tool_result` message and an `onToolResult` subject that
763
+ **exist nowhere in the codebase**, names four panel classes (`TVAIPanel`, `DBAIPanel`,
764
+ `ScriptingAIPanel`, plus a fenced-block execution pipeline) that no longer exist, omits
765
+ `clientTools`/`gates`/`images`/`revision_start`/`metrics` — i.e. the entire view-function and
766
+ gate surface — and states `model: 'opus'` when the runtime hardcodes Sonnet, `node:20` when the
767
+ Dockerfile says node:22, and a Milvus sidecar that is gone~~ **(resolved 2026-08-24: rewritten
768
+ against the current code)**. `CLAUDE.md` describes fenced-block
769
+ parsing that was removed, the group quota that is dead code, and a per-context storage cap that
770
+ is actually global. `CHANGELOG.md` has ~60 `v.next` entries with no version bump since 1.0.4.
771
+ `help/explore/ai/ai.md` markets event-triggered agents, auto-narrative insight and automatic
772
+ troubleshooting — none of which have code — and tells users their data "stays inside your
773
+ deployment" when the default path sends every prompt (plus the full workspace context and any
774
+ open script's source) to Anthropic's API.
775
+
776
+ ### 6.8 Testing, CI, and product gaps
777
+
778
+ - **Zero tests.** `src/package-test.ts` exports an empty `tests` map, and `package.json` has no
779
+ `test` script — so `packages.yaml`'s `jq 'select(has("test"))'` filter means **CI never runs
780
+ any test for this package**, only a build. The container tests (20 in `claude-runtime`, 2 files
781
+ in `mcp-server`) are real but hand-construct every payload and are not wired into CI either.
782
+ - **Benchmark statistics are censored.** A timed-out rep is dropped from **both** the latency
783
+ medians and the accuracy denominator ([benchmark.ts:389-405](../src/ai/benchmark/benchmark.ts)) —
784
+ so an arm that times out more often reports a *lower* median and *higher* accuracy (2 timeouts
785
+ + 1 pass = 100%). `compareBenchmarks` compares arms over non-intersecting prompt sets with no
786
+ check. The "cold container" guard is dead code (`!e.metrics` can never be true).
787
+ - **Feedback is a placebo.** Thumbs up/down render and toast "Thanks for your feedback!"; the
788
+ sink is `function receiveFeedback(…) { /* not implemented yet */ }` ([panel.ts:1247](../src/ai/panel.ts)).
789
+ - **Cost is computed and discarded.** The runtime sends `inputTokens/outputTokens/
790
+ cacheReadTokens/costUsd/numTurns` on every `final`; the only consumer in the package is the
791
+ benchmark. The live panel never reads them.
792
+ - **No model choice.** `model: model ?? ClaudeModel.Sonnet` is a compile-time constant in the
793
+ image with no env var, container setting, or user preference — although the wire protocol
794
+ already carries a `model` field. *Resolution (2026-08-25): by design — the model tier is a
795
+ developer decision, not a user setting.*
796
+ - **Keyboard-inaccessible.** Every control (Send/Stop, New Chat, History, Copy, Mic, Wand,
797
+ thumbs, minimize, chip removal) is a click-wired `<i>` or `<div>` with no `role`, no
798
+ `tabindex`, and no Enter/Space handler. The package has zero `aria-*` attributes.
799
+ - **Uninvited first-run side effects.** `init()` writes `agents/README.md` plus seeded scripts
800
+ into **every** user's My Files, and opens the runtime WebSocket, on every login — defeating the
801
+ container's `on_demand` mode and doing both before the user has ever opened the panel.
802
+ *Resolution (2026-08-25): by design — seeding makes `agents/` discoverable and the warm
803
+ connection trades idle time for first-turn latency.*
804
+ - **No admin documentation.** `README.md` is one sentence; the help page has no setup section;
805
+ `ANTHROPIC_API_KEY` is mentioned exactly once, in a stale doc line.
806
+
807
+ ---
808
+
809
+ ## 7. What the platform does not give Grokky
810
+
811
+ 38 validated gaps. **First, the 12 that are not gaps** — capabilities Grokky reimplements
812
+ although the platform already has them:
813
+
814
+ | Already exists | Where | Grokky's workaround |
815
+ |---|---|---|
816
+ | `DG.Project.showSaveDialog` — per-table sync toggles, dependency linking, upload | `js-api/src/entities/project.ts:49-58` | the hand-rolled recipe that caused failure 5.1 |
817
+ | `grok.ai.searchEntities` (semantic entity search) | `js-api/src/ai.ts:79-89` | unused entirely |
818
+ | `View.id` — stable view handle | `js-api/src/views/view.ts:308` | positional refs |
819
+ | `ui.wait(getElement)` + `grok.dapi.getEntities(ids)` | `js-api/ui.ts:565`, `dapi.ts` | manual placeholder + DOM surgery in `exec-blocks.ts` |
820
+ | `Func.isVectorFunc` | `js-api/src/entities/func.ts:53` | a prose table in a skill |
821
+ | Per-viewer typed settings interfaces (`IScatterPlotSettings`…) | `js-api/src/interfaces/d4.ts` | string property names |
822
+ | `grok.shell.views` (all open views, not just tables) | `js-api/src/shell.ts:326` | assumed missing |
823
+ | `DG.Utils.download` | `js-api/src/utils.ts:230` | re-implemented as `downloadText` |
824
+ | `GET /public/v1/users/current` (container-callable whoami) | `datlas public_api.dart:50` | unverified JWT parsing (F-15) |
825
+ | `getSchema(e, schema, table, catalog)` — catalog-aware | `js-api/src/dapi.ts:655` | catalog dropped by the caller (F-36) |
826
+ | `requestBinary` in `claude-runtime` | `dockerfiles/claude-runtime/src/shared-api-client.ts:62-77` | not copied to mcp-server |
827
+ | Server-side per-user KV (`user_settings` routes) | `datlas user_settings.dart:12-32` | in-memory session map (F-43) |
828
+
829
+ **The real gaps, ranked by value to Grokky.** Each has a proposed signature and the layers it
830
+ touches.
831
+
832
+ ### Tier 1 — would have prevented a reported failure
833
+
834
+ | Gap | Proposal | Effort |
835
+ |---|---|---|
836
+ | **`TableInfo.enableDataSync({linkInto})`** — no programmatic way to enable sync with its prerequisites validated | Move `_findEntities` out of the Dart dialog into `grok_shared` as `CreationScript.resolveDependencies(script)`; add `TableInfo.enableDataSync()` that throws typed errors ("creation script missing", "query X must be saved first"), sets `metaParams[Tags.DataSync]='sync'` and links dependencies; interop + js-api | large |
837
+ | **`Project.upload()` exposed to JS** — the correct publish sequence exists only in Dart | `ra1('Project_Upload', (Project p) => p.upload())` next to `Project_ToMarkup`; `upload(): Promise<string>` in `entities/project.ts`, shaped like `open()`/`close()` | small |
838
+ | **`TableInfo.fromTable` drops tag values; `uploadDataFrame` has no `saveInfo`** — the mechanical cause of "the tag vanished" | In `table_info.dart:61` copy persistable tag values (`.script`, `.VariableName`, `.UrlParams`) into `metaParams`; widen the interop to accept `saveInfo` (the Dart client already has it) | small |
839
+ | **`tables.saveMeta(id, map)`** — merge-only metadata write; today only the full-entity save is reachable | `ra2('Dapi_TablesDataSource_SaveMeta', …)`; `saveMeta(id, meta)` on `TablesDataSource` | small |
840
+ | **Scoped mutation capture / change receipts** — nothing can answer "what changed while this ran" except model-authored assertions | `grok.events.onAnyEvent` (bind `AppEvents.eventBus.on()`), plus `captureChanges<T>(fn): Promise<{result, changes}>`. This is the foundation of §8.2 | medium |
841
+ | **`meta.readOnly` on `DG.Func`** — the verifier guesses from name prefixes (F-07) | `FuncOptions.ReadOnly` + `Func.isReadOnly` in Dart, `Func_Get_IsReadOnly` interop, getter in `entities/func.ts` | medium |
842
+
843
+ ### Tier 2 — removes a class of workaround
844
+
845
+ | Gap | Proposal | Effort |
846
+ |---|---|---|
847
+ | **Sanitizing renderer for untrusted content** (F-01) | `ui.markdown(text, {sanitize: true})` + `Markup.renderMarkdownSanitized` with a whitelist `NodeTreeSanitizer`. Fixes every plugin | medium |
848
+ | **Server-side AI quota and metering** (F-38) | `POST /ai/quota/consume {feature, model, tokens}` → `{allowed, remaining, resetsAt}` with an atomic DB increment; `ai_client.dart`; `grok.dapi.ai.quota.*`; admin usage view | large |
849
+ | **Short-lived, scope-limited delegated tokens** | `POST /public/v1/users/current/delegated-token {ttlSeconds, scopes, audience}`, modelled on `docker_service.dart:932`, so the container never holds the full session JWT | large |
850
+ | **`ViewBase.entity`** — stubbed null in js-api although Dart views carry it (F-42) | `View_Get_Entity`/`View_Set_Entity` interop + getter in `views/view.ts` | small |
851
+ | **Resilient, on-demand-aware docker WS proxy** (~~F-41~~ *(180 s timeout done 2026-08-17)*, F-43) | `isOnDemand(id)`; default timeout `onDemand ? 180000 : 60000`; `resilientWebSocketProxy(id, path, {maxRetries, backoffMs, heartbeatMs})` | medium |
852
+ | **Package-scoped container lookup** — names are hardcoded strings today | `Package.getDockerContainer(folder)` resolving `${kebab(name)}-${folder}` server-side; `proxyUrl`/`wsProxyUrl` helpers | small |
853
+ | **Docker image/version introspection** | expose `DockerContainer.image` so a client can detect the F-02 build skew | small |
854
+ | **`Func.validateArgs(parameters): string[]`** — LLM-supplied args hit `f.apply` raw and fail as opaque Dart exceptions | `FuncCall.validate()` + `Func.validateArgs()` checking required/nullable/choices before `apply` | small |
855
+ | **Stable `Widget.id` / `Widget.byId`** — refs cross a WebSocket, so positional index paths silently retarget | mirror `View.viewId`: `widgetId` uuid + `Widget_Get_Id`/`Widget_ById` interop | small |
856
+ | **`Column.get()`/`toList()` leak `FLOAT_NULL` and array holes instead of `null`** | fill explicitly in `column.dart:665-671`; add `Column_GetValue` interop. Already cost two wrong benchmark ground truths | small |
857
+ | **`DG.VIEW_TYPE` missing `SCRIPT_VIEW`/`DATA_QUERY_VIEW`** — Grokky hardcodes the literals | add the constants mirroring each Dart `static const String TYPE` | small |
858
+ | **Typed `grok.events.onFileEvent`** — Grokky reads `eventData.dart.files` raw, which minified dart2js can break | `setArgs` in `FileEventArgs` + typed observable | small |
859
+ | **`grid.sortByColumns` assignment silently no-ops**; **`GridColumn.isPinned` missing** | add setters (or throwing setters) and the getter — both are documented model footguns in the benchmark suite | small |
860
+ | **`grok.ai.config` cannot represent the runtime** (F-39) | widen `AIConfig` with the Anthropic variant; add a provider/capability registry (`grok.ai.providers`) and an `assistantRegistered` signal so the AI window is not offered when nothing fills it | medium |
861
+ | **DB metadata: per-schema relations, catalog-aware descriptors, invalidation events** | `DbSchemaInfo.getRelations()`, a `catalog` parameter throughout, `onDbSchemaChanged` + `clearSchemaCache()` | medium |
862
+ | **`/public/v1/functions` has no paging** although the service supports it | one-line route change adding `{?text,page,limit,order}` | small |
863
+ | **Enumeration of the live top menu** | `Menu.children/label/path` + `getPaths()` — replaces a hardcoded 40-entry table in a skill | small |
864
+ | **Generated typed client for the public REST API** | complete `public_api.yaml`, generate `@datagrok-libraries/public-api-client`, delete the two hand-written `shared-api-client.ts` copies that carry "keep in sync" comments | large |
865
+ | **Per-user containers and persistent scratch** (F-15, F-16) | `perUser: bool` in `container.json` with datlas routing per caller; per-user volumes with quota | large |
866
+
867
+ ---
868
+
869
+ ## 8. Measured against best practice
870
+
871
+ 29 practices researched across Anthropic engineering and SDK docs, the MCP specification, OWASP
872
+ LLM Top 10, and comparable products (Databricks Assistant/Genie, Hex Magic, Deepnote, Jupyter
873
+ AI, VS Code Copilot Chat, Cursor). Sources in [Appendix B](#appendix-b--sources).
874
+
875
+ ### 8.1 Where Grokky already leads
876
+
877
+ | Practice | Grokky |
878
+ |---|---|
879
+ | Small consolidated tool surface (<20) | 5 domain tools + 4 meta-tools + 3 browser tools ≈ 22, with the collapse **measured** in-repo |
880
+ | Byte-stable defs for prompt caching | `VIEW_TOOL_DEFS` is a module const; per-view functions never enter the tool list. Exemplary |
881
+ | Progressive disclosure / search-then-load | two layers: `list_view_functions` (≤10 ranked briefs) and op-less MCP calls returning the domain schema |
882
+ | Token-efficient tool responses | compact JSON, paging, 20k cap, *corrective* truncation messages — with the reasoning documented in the file header |
883
+ | Errors that enable self-correction | unknown-op errors list the available ops; missing params return the catalog. Near-exemplary |
884
+ | Skills as files with routing frontmatter | 12 skills as a local plugin, attached only for full-prompt turns, two inlined for byte stability |
885
+ | Poka-yoke argument design | the `view` parameter is injected at call time and hidden from the model entirely |
886
+ | Eval harness | drives the real pipeline; TTFT/cost/tool-order/unverified-rate; deterministic asserts + majority-vote judge |
887
+ | Act→verify gating | **ahead of every product surveyed** — no comparable product blocks turn-end on unverified actions |
888
+
889
+ ### 8.2 Where it lags: verification that does not depend on the model
890
+
891
+ Both reported failures come from the same root: the observer is the same model, in the same
892
+ substrate, as the actor. Anthropic's framing is that agents need *"ground truth from the
893
+ environment at each step"*. The fix is a **ledger**, not a better assertion.
894
+
895
+ - **Layer 0 — observation ledger (browser, zero model cooperation).** `executeSingleBlock`
896
+ already owns the moment around the action. Subscribe before, unsubscribe after, and return a
897
+ receipt. Everything needed already exists: `grok.functions.onBeforeRunAction`/`onAfterRunAction`
898
+ (a complete receipt for any registered function), `onViewerAdded`/`onViewAdded`/`onTableAdded`/
899
+ `onProjectSaved`/`onQueryFinished`/`onDialogShown`, `DataFrame.onDataChanged`/`onRowsFiltered`/
900
+ `onSelectionChanged`, plus a cheap pre/post snapshot of `rowCount`, column names, `filter.trueCount`,
901
+ viewer types.
902
+ - **Layer 1 — declared effect instead of authored assertion.** Change the exec contract from
903
+ "write JS returning something truthy" to "declare what you expect to change":
904
+ `{effect: 'viewer_added'|'column_added'|'rows_filtered'|'project_saved'|…, expect: {…}}`. The
905
+ harness matches the declaration against the ledger. **Failure 5.2 disappears** — four
906
+ `onViewerAdded` events are observed regardless of `return` statements — and so does the
907
+ "truthy = verified" contradiction that makes an observed `0` unverifiable.
908
+ - **Layer 2 — server truth for persistence claims.** Any effect in the persistence class must be
909
+ confirmed by an **independent re-read the harness performs**: `grok.dapi.tables.find(id)` and
910
+ assert `metaParams['.data-sync'] === 'sync'`. **Failure 5.1 disappears.**
911
+ - **Layer 3 — LLM assertions**, retained only for effects the ledger cannot see, with F-03…F-06
912
+ fixed.
913
+ - **Make receipts visible.** `verify.description` and `observed` are computed on every action and
914
+ thrown away; only the red banner renders. One line per action — *"Added scatter plot · observed
915
+ 4 viewers · verified"*, code collapsed — matches Copilot's `pastTenseMessage` and Genie's
916
+ trusted-asset labeling, and lets a user catch a wrong action before it compounds.
917
+
918
+ One mechanism, four payoffs: the ledger is the verification signal, the audit record, the undo
919
+ instruction, and the benchmark ground truth.
920
+
921
+ ### 8.3 A trust model that does not break the product
922
+
923
+ Real sandboxing is off the table on merit: the product's value **is** mutating the live
924
+ `grok.shell.v`, which a Worker cannot reach, and an iframe with `allow-scripts` +
925
+ `allow-same-origin` is equivalent to no sandbox. ShadowRealm is Stage 2.7; the Chrome 50 floor
926
+ rules out SES. So: layered compensating controls, ordered by risk removed per unit of product
927
+ value lost.
928
+
929
+ 1. **A platform CSP with a `connect-src` allowlist.** None exists anywhere in core today. This
930
+ is the highest-leverage control in the entire review — it severs the exfiltration leg of the
931
+ lethal trifecta for *all* executed code without removing a single feature, and blunts F-01 at
932
+ the same time.
933
+ 2. **Sanitizing renderer for untrusted content** (F-01) — in js-api, so every plugin benefits.
934
+ 3. **Verified container identity, per-user path deny, SSRF allowlist, real `canUseTool`**
935
+ (F-15, F-16, F-17, F-44).
936
+ 4. **Facade + preflight on exec** — ten lines: declare `fetch`, `XMLHttpRequest`, `WebSocket`,
937
+ `localStorage`, `eval`, `Function` as extra parameter names bound to throwing stubs, and
938
+ statically reject bodies mentioning `dapi.token` or `import(`. Not a sandbox — a speed bump
939
+ that removes the cheapest primitives and, more valuably, *produces a signal when tripped*.
940
+ 5. **Risk-tiered consent, not a blanket gate.** Auto-run reads and additive UI changes; require
941
+ Run/Cancel for deletes, file writes, permission changes, and container `Bash`. The confirm UI
942
+ already exists and is unused. Add a per-session autonomy dial, as Deepnote and Databricks ship.
943
+ 6. **Make the search-bar Execute provider preview-only** (F-10).
944
+ 7. **Server-side audit** of every exec body, tool call, and verdict, keyed to the *verified* user
945
+ id. The `input_request`/`input_response` pair is a single chokepoint both directions already
946
+ traverse.
947
+ 8. **Taint-track the turn**: once WebFetch/WebSearch/synced-file/DB text enters context, drop
948
+ WebFetch and force confirmation on exec for the remainder.
949
+ 9. **Tell the truth in `CLAUDE.md:19-21`.** An honest threat model — trusted-user enterprise
950
+ install; model code runs with the user's full session authority — is defensible. The current
951
+ wording causes reviewers to skip diligence they would otherwise do.
952
+
953
+ ### 8.4 Where knowledge should live
954
+
955
+ Grokky has six knowledge homes and no ownership rule. **The rule to adopt: knowledge that
956
+ describes a capability belongs to the capability, not to the assistant.**
957
+
958
+ - Function semantics → `DG.Func` metadata (`description`, `friendlyName`, `helpUrl`, per-input
959
+ `Property.description`), owned by the package author, versioned with the code, already surfaced
960
+ by `list_view_functions`. `funcBrief` should additionally emit required-vs-optional and
961
+ `helpUrl` — today the model cannot tell which parameters it must supply.
962
+ - Widget/view semantics → `aiDescription` + `getFunctions()`.
963
+ - DB schema semantics → sticky meta, generated by an admin action. Every comparable product
964
+ harvests from the governed metadata store; Grokky ships the anti-pattern (F-47) while owning
965
+ the correct pipeline.
966
+ - Product behavior → help docs, indexed. Already correct.
967
+ - Skills → **only** cross-cutting judgment no single function owns: routing, footguns,
968
+ when-not-to. **Every skill section that is a code recipe is a missing platform function** —
969
+ delete it as that function lands. Skill byte-count is a debt metric, not an asset.
970
+ - System prompt → invariants only, byte-stable. Already correct.
971
+
972
+ ### 8.5 Other gaps against comparables
973
+
974
+ | Practice | Product precedent | Grokky |
975
+ |---|---|---|
976
+ | Tool annotations (`readOnlyHint`) | MCP spec, Agent SDK | **absent everywhere** — no `sdkTool` or `server.tool` call passes annotations, so read-only tools cannot be parallelized and mutation semantics are undeclared |
977
+ | Undo / checkpoints | Cursor snapshots each agent turn | none; `verify.ts:132-133` instructs the model *around* irreversibility instead of solving it. Cheapest win: snapshot `view.saveLayout()` + filters before each exec, offer "Revert this turn" |
978
+ | Visible plan / step list | Databricks Planner, Copilot | `tool_activity` is shown one line at a time and discarded; `TodoWrite`/`Task` are deliberately excluded. Accumulating the events into a collapsible "Steps" list is rendering-only work |
979
+ | Durable server-side sessions | Agent SDK writes every session to disk | in-memory LRU(200); the SDK's own JSONL is never re-listed (F-43) |
980
+ | Committed eval baseline in CI | Copilot's `stest` runs each scenario 10× | harness exists, runs manually in a browser, no committed baseline, unpinned CLI |
981
+ | Cost control in dollars | SDK `max_budget_usd`, `maxTurns` | ~~neither is passed~~ *(done 2026-08-24: `maxTurns` 100, `maxBudgetUsd` $2.50 per turn; bash/none modes 10 / $0.25)*; quota is a client-side counter hardcoded to 1000 |
982
+ | Feedback loop | GitHub treats feedback as eval input | `receiveFeedback` is an empty function |
983
+ | Versioned protocol | Jupyter AI moved to ACP | bespoke WS protocol documented as prose, no version field (F-02). *Not* a recommendation to adopt ACP — the verify/grounding gates justify the custom runtime — but the contract should be schema'd and versioned |
984
+
985
+ ---
986
+
987
+ ## 9. Recommended program
988
+
989
+ Ranked by quality-per-effort. Items 1-5 are the ones that eliminate the reported failure classes.
990
+
991
+ | # | Initiative | Effort | Eliminates |
992
+ |---|---|---|---|
993
+ | 0 | **Rebuild and redeploy the `grokky-claude-runtime` image from HEAD**, and confirm the running container serves post-`71eee21d1a` `verify.js` | trivial | the live half of failure 5.2 |
994
+ | 1 | **Rewrite `datagrok-projects/SKILL.md`** with the verified data-sync recipe, the query-save prerequisite, and `showSaveDialog`; add the "persistence claims must be re-read via `grok.dapi.*`" rule to `verify.ts`'s block message and the exec skill | small | failures 5.1 and 5.3, and F-13's data loss |
995
+ | 2 | **Platform CSP + sanitizing untrusted-content renderer in js-api** | medium | F-01 and the exfiltration leg for all executed code |
996
+ | 3 | **Observation ledger + declared-effect contract** ([§8.2](#82-verification-that-does-not-depend-on-the-model)) | medium | F-03…F-06 and the whole false-negative class |
997
+ | 4 | **Visible action receipts** replacing the lone red banner — the data is already in the `input_request`/`input_response` payloads | small | users unable to tell what actually happened |
998
+ | 5 | **Server-side audit of executed code and tool calls**, keyed to a verified user id | small | post-incident blindness; also produces the data for #10 |
999
+ | 6 | **Container hardening**: verified identity, per-user path deny, SSRF allowlist, real `canUseTool`, scoped `env` | medium | F-15…F-17, F-44 |
1000
+ | 7 | **Risk-tiered consent**; make the search-bar Execute provider preview-only | medium | F-09, F-10 |
1001
+ | 8 | **Fix the transport and compat blockers**: ~~`Promise.finally` + `matchAll` polyfills, `webkitSpeechRecognition`~~ *(both done 2026-08-18)*, ~~`session_reset`~~ *(done 2026-08-18)*, ~~the busy guard on New Chat/history, the `/login` regex, the on-demand connect timeout~~ *(all three done 2026-08-17)* | small | ~~F-33, F-34, F-35~~, ~~F-37, F-40, F-41~~, ~~F-43~~ |
1002
+ | 9 | **Skill-content CI**: extract every API identifier from every `SKILL.md` and assert it exists; execute the projects recipe against a stand asserting `metaParams['.data-sync']` survives; re-fence the 74 exec blocks *(2026-08-17: ~~F-29 interceptX fix, F-30 join(table) claims, F-31 HeavyAtomCount example, F-28 re-fence all 74 exec blocks~~ done;)* | medium | F-28…F-31 — confidently-wrong guidance from the assistant's own knowledge base |
1003
+ | 10 | **Tier-2 migration**: instrument exec bodies, cluster them, convert the top 10 patterns into registered `DG.Func`s, and **delete the matching skill recipe** each time | large | per-turn re-derivation of the same operation with new bugs; ungatable, unauditable, un-undoable actions |
1004
+ | 11 | **Productize DB metadata into sticky meta**; delete both checked-in schema indexes; ~~switch webpack to production mode; drop the ten unused dependencies~~ *(both done 2026-08-17)* | medium | F-46, F-47, 55% of the bundle |
1005
+ | 12 | **Close the quality loop**: implement `receiveFeedback`, log `costUsd`/tokens per turn, move quota server-side, pin the SDK, commit a benchmark baseline, add a `test` script so CI runs anything at all | small | unmeasured quality and unbounded, trivially-resettable spend |
1006
+
1007
+ **Sequencing note.** #5 before #10 is deliberate: the list of patterns to typify must come from
1008
+ data, not opinion. And #9's shared-folder hardening must land with F-23's fix, since surfacing the
1009
+ synced knowledge to the model is what activates F-25.
1010
+
1011
+ ---
1012
+
1013
+ ## Appendix A — claims that did not survive
1014
+
1015
+ Kept so they are not re-raised.
1016
+
1017
+ | Claim | Verdict |
1018
+ |---|---|
1019
+ | `Chem:getInchis(${molecule})` is per-row syntax misused for a vector function | **Refuted** — it is a real, correctly-used `vectorFunc` |
1020
+ | The `@anthropic-ai/claude-agent-sdk` `>=0.2.0` range floats across image rebuilds | **Refuted** — `package-lock.json` is committed and the Dockerfile runs `npm ci`, pinning 0.2.52. The residual (loose range, version not recorded in benchmark reports) is real but weaker |
1021
+ | Read-only exec re-arms the gate and burns the block budget | **Downgraded** — one passing verify zeroes all pending actions, and `blockCount` increments only at `Stop`; costs nothing in the normal path |
1022
+ | `userIdFromKey` fails open to a shared `default` directory | **Downgraded** — unreachable on a real deployment, since datlas always issues a JWT with `sub`. A defensive-default wart, not a live multi-tenancy break |
1023
+ | The verify gate contradicts the projects skill and costs three round-trips | **Downgraded** — the tool description already mandates `verify` and the first block explains the recovery; normal cost is one extra round-trip |
1024
+ | Concurrent partial syncs corrupt the agents directory | **Downgraded** — the startup burst short-circuits before any fetch; the concrete defect is narrower (a partial sync parked in `syncInFlight` returned to a concurrent `scope='all'` caller) |
1025
+ | `datagrok_exec` registered in `/noprompt` and `!bash` modes is a privilege boundary break | **Downgraded** — exec is equally ungated in full mode; this is a documentation/expectation mismatch |
1026
+ | `metadata generation` issues unquoted-identifier queries per column | **Downgraded** — the whole path is dead code behind an unconditional early return |
1027
+ | Six npm dependencies are needed to keep `src/depr/` type-checking | **Corrected** — `depr`'s imports are all commented out, so nothing keeps them alive; the removal list is *larger* than claimed |
1028
+ | MCP errors without `isError` break the verify gate | **Corrected** — the gate never reads MCP results. The real defect is that `formatError` bypasses `cap()`, so a large upstream stack trace lands whole in the transcript |
1029
+ | Also merged as duplicates | the four separate usage-limiter reports, three `grok.ai.config` gating reports, two agent-script Run reports, and the `exec-blocks`/`ui.ts` eval pair |
1030
+
1031
+ ---
1032
+
1033
+ ## Appendix B — sources
1034
+
1035
+ **Anthropic engineering and documentation**
1036
+ - Writing effective tools for agents — https://www.anthropic.com/engineering/writing-tools-for-agents
1037
+ - Building effective agents — https://www.anthropic.com/engineering/building-effective-agents
1038
+ - Code execution with MCP — https://www.anthropic.com/engineering/code-execution-with-mcp
1039
+ - Effective context engineering — https://www.anthropic.com/engineering/effective-context-engineering-for-ai-agents
1040
+ - Equipping agents with Agent Skills — https://www.anthropic.com/engineering/equipping-agents-for-the-real-world-with-agent-skills
1041
+ - Prompt caching — https://platform.claude.com/docs/en/build-with-claude/prompt-caching
1042
+ - Tool use — https://platform.claude.com/docs/en/agents-and-tools/tool-use/implement-tool-use
1043
+ - Agent SDK: custom tools, permissions, sessions, secure deployment — https://code.claude.com/docs/en/agent-sdk/
1044
+ - `max_budget_usd` example — https://github.com/anthropics/claude-agent-sdk-python/blob/main/examples/max_budget_usd.py
1045
+
1046
+ **Protocol and security**
1047
+ - MCP tools specification — https://modelcontextprotocol.io/specification/2025-06-18/server/tools
1048
+ - OWASP Top 10 for LLM Applications 2025 — https://genai.owasp.org/resource/owasp-top-10-for-llm-applications-2025/
1049
+ - The lethal trifecta — https://simonwillison.net/2025/Jun/16/the-lethal-trifecta/
1050
+ - Prompt-injection design patterns — https://simonwillison.net/2025/Jun/13/prompt-injection-design-patterns/
1051
+ - iframe sandbox escape analysis — https://7asecurity.com/blog/2026/06/iframe-xss-security/
1052
+ - Securing Claude managed agents — https://pluto.security/blog/securing-claude-managed-agents/
1053
+ - Lethal-trifecta testing — https://www.promptfoo.dev/blog/lethal-trifecta-testing/
1054
+
1055
+ **Comparable products**
1056
+ - Databricks Assistant / Data Science Agent — https://www.databricks.com/blog/introducing-databricks-assistant-data-science-agent
1057
+ - Databricks Genie trusted assets — https://docs.databricks.com/en/genie/trusted-assets.html
1058
+ - Hex Magic — https://hex.tech/blog/magic-ai/
1059
+ - Deepnote agent — https://deepnote.com/docs/deepnote-agent
1060
+ - Jupyter AI (ACP) — https://github.com/jupyterlab/jupyter-ai
1061
+ - VS Code Copilot Chat tool contract — https://github.com/microsoft/vscode-copilot-chat/blob/main/docs/tools.md
1062
+ - Copilot evaluation methodology — https://github.blog/ai-and-ml/generative-ai/how-we-evaluate-models-for-github-copilot/
1063
+ - Cursor checkpoints — https://docs.cursor.com/agent/chat/checkpoints
1064
+ - OpenAI function calling guide — https://developers.openai.com/api/docs/guides/function-calling