@istmx/skills 2.0.0 → 2.1.1

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 (230) hide show
  1. package/README.md +141 -51
  2. package/RELEASE_v2.1.0.md +68 -0
  3. package/bin/cli.js +64 -86
  4. package/context/conversation_transcript.md +786 -0
  5. package/context/progress.md +129 -0
  6. package/istm/SKILL.md +20 -11
  7. package/istm-animate/SKILL.md +19 -11
  8. package/istm-architecture/SKILL.md +70 -14
  9. package/istm-architecture/templates/agents.md +21 -2
  10. package/istm-awwward-designer/SKILL.md +31 -7
  11. package/istm-design/SKILL.md +26 -12
  12. package/istm-design/anti-laziness/architectural-patterns.md +55 -0
  13. package/istm-design/anti-laziness/parameter-tuning.md +44 -0
  14. package/istm-design/anti-laziness/prompt-engineering.md +52 -0
  15. package/istm-design/anti-laziness/reference-prompts.md +79 -0
  16. package/istm-design/archetypes/brandkit/SKILL.md +798 -0
  17. package/istm-design/archetypes/brutalist/SKILL.md +92 -0
  18. package/istm-design/archetypes/minimalist/SKILL.md +85 -0
  19. package/istm-design/archetypes/soft/SKILL.md +98 -0
  20. package/istm-design/core/ui-ux-pro-max/data/stacks/wpf.csv +1 -1
  21. package/istm-design/core/ui-ux-pro-max/scripts/design_system.py +1 -1
  22. package/istm-design/image-to-code/SKILL.md +1228 -0
  23. package/istm-design/imagegen/SKILL.md +987 -0
  24. package/istm-design/presets/airbnb/DESIGN.md +545 -0
  25. package/istm-design/presets/airbnb/README.md +5 -0
  26. package/istm-design/presets/airtable/DESIGN.md +554 -0
  27. package/istm-design/presets/airtable/README.md +5 -0
  28. package/istm-design/presets/apple/DESIGN.md +562 -0
  29. package/istm-design/presets/apple/README.md +5 -0
  30. package/istm-design/presets/binance/DESIGN.md +634 -0
  31. package/istm-design/presets/binance/README.md +5 -0
  32. package/istm-design/presets/bmw/DESIGN.md +544 -0
  33. package/istm-design/presets/bmw/README.md +5 -0
  34. package/istm-design/presets/bmw-m/DESIGN.md +503 -0
  35. package/istm-design/presets/bmw-m/README.md +5 -0
  36. package/istm-design/presets/bugatti/DESIGN.md +454 -0
  37. package/istm-design/presets/bugatti/README.md +5 -0
  38. package/istm-design/presets/cal/DESIGN.md +542 -0
  39. package/istm-design/presets/cal/README.md +5 -0
  40. package/istm-design/presets/catalog.md +127 -0
  41. package/istm-design/presets/claude/DESIGN.md +589 -0
  42. package/istm-design/presets/claude/README.md +5 -0
  43. package/istm-design/presets/clay/DESIGN.md +541 -0
  44. package/istm-design/presets/clay/README.md +5 -0
  45. package/istm-design/presets/clickhouse/DESIGN.md +544 -0
  46. package/istm-design/presets/clickhouse/README.md +5 -0
  47. package/istm-design/presets/cohere/DESIGN.md +451 -0
  48. package/istm-design/presets/cohere/README.md +5 -0
  49. package/istm-design/presets/coinbase/DESIGN.md +570 -0
  50. package/istm-design/presets/coinbase/README.md +5 -0
  51. package/istm-design/presets/composio/DESIGN.md +506 -0
  52. package/istm-design/presets/composio/README.md +5 -0
  53. package/istm-design/presets/cursor/DESIGN.md +537 -0
  54. package/istm-design/presets/cursor/README.md +5 -0
  55. package/istm-design/presets/dell-1996/DESIGN.md +632 -0
  56. package/istm-design/presets/dell-1996/README.md +5 -0
  57. package/istm-design/presets/elevenlabs/DESIGN.md +504 -0
  58. package/istm-design/presets/elevenlabs/README.md +5 -0
  59. package/istm-design/presets/expo/DESIGN.md +526 -0
  60. package/istm-design/presets/expo/README.md +5 -0
  61. package/istm-design/presets/ferrari/DESIGN.md +531 -0
  62. package/istm-design/presets/ferrari/README.md +5 -0
  63. package/istm-design/presets/figma/DESIGN.md +578 -0
  64. package/istm-design/presets/figma/README.md +5 -0
  65. package/istm-design/presets/framer/DESIGN.md +544 -0
  66. package/istm-design/presets/framer/README.md +5 -0
  67. package/istm-design/presets/hashicorp/DESIGN.md +575 -0
  68. package/istm-design/presets/hashicorp/README.md +5 -0
  69. package/istm-design/presets/hp/DESIGN.md +670 -0
  70. package/istm-design/presets/hp/README.md +5 -0
  71. package/istm-design/presets/ibm/DESIGN.md +550 -0
  72. package/istm-design/presets/ibm/README.md +5 -0
  73. package/istm-design/presets/intercom/DESIGN.md +546 -0
  74. package/istm-design/presets/intercom/README.md +5 -0
  75. package/istm-design/presets/kraken/DESIGN.md +125 -0
  76. package/istm-design/presets/kraken/README.md +5 -0
  77. package/istm-design/presets/lamborghini/DESIGN.md +288 -0
  78. package/istm-design/presets/lamborghini/README.md +5 -0
  79. package/istm-design/presets/linear/DESIGN.md +548 -0
  80. package/istm-design/presets/linear/README.md +5 -0
  81. package/istm-design/presets/lovable/DESIGN.md +298 -0
  82. package/istm-design/presets/lovable/README.md +5 -0
  83. package/istm-design/presets/mastercard/DESIGN.md +365 -0
  84. package/istm-design/presets/mastercard/README.md +5 -0
  85. package/istm-design/presets/meta/DESIGN.md +683 -0
  86. package/istm-design/presets/meta/README.md +5 -0
  87. package/istm-design/presets/minimax/DESIGN.md +746 -0
  88. package/istm-design/presets/minimax/README.md +5 -0
  89. package/istm-design/presets/mintlify/DESIGN.md +852 -0
  90. package/istm-design/presets/mintlify/README.md +5 -0
  91. package/istm-design/presets/miro/DESIGN.md +825 -0
  92. package/istm-design/presets/miro/README.md +5 -0
  93. package/istm-design/presets/mistral/DESIGN.md +773 -0
  94. package/istm-design/presets/mistral/README.md +5 -0
  95. package/istm-design/presets/mongodb/DESIGN.md +767 -0
  96. package/istm-design/presets/mongodb/README.md +5 -0
  97. package/istm-design/presets/nike/DESIGN.md +575 -0
  98. package/istm-design/presets/nike/README.md +5 -0
  99. package/istm-design/presets/nintendo-2001/DESIGN.md +649 -0
  100. package/istm-design/presets/nintendo-2001/README.md +5 -0
  101. package/istm-design/presets/notion/DESIGN.md +821 -0
  102. package/istm-design/presets/notion/README.md +5 -0
  103. package/istm-design/presets/nvidia/DESIGN.md +640 -0
  104. package/istm-design/presets/nvidia/README.md +5 -0
  105. package/istm-design/presets/ollama/DESIGN.md +539 -0
  106. package/istm-design/presets/ollama/README.md +5 -0
  107. package/istm-design/presets/opencode/DESIGN.md +521 -0
  108. package/istm-design/presets/opencode/README.md +5 -0
  109. package/istm-design/presets/pinterest/DESIGN.md +597 -0
  110. package/istm-design/presets/pinterest/README.md +5 -0
  111. package/istm-design/presets/playstation/DESIGN.md +661 -0
  112. package/istm-design/presets/playstation/README.md +5 -0
  113. package/istm-design/presets/posthog/DESIGN.md +690 -0
  114. package/istm-design/presets/posthog/README.md +5 -0
  115. package/istm-design/presets/raycast/DESIGN.md +669 -0
  116. package/istm-design/presets/raycast/README.md +5 -0
  117. package/istm-design/presets/renault/DESIGN.md +589 -0
  118. package/istm-design/presets/renault/README.md +5 -0
  119. package/istm-design/presets/replicate/DESIGN.md +616 -0
  120. package/istm-design/presets/replicate/README.md +5 -0
  121. package/istm-design/presets/resend/DESIGN.md +585 -0
  122. package/istm-design/presets/resend/README.md +5 -0
  123. package/istm-design/presets/revolut/DESIGN.md +636 -0
  124. package/istm-design/presets/revolut/README.md +5 -0
  125. package/istm-design/presets/runwayml/DESIGN.md +244 -0
  126. package/istm-design/presets/runwayml/README.md +5 -0
  127. package/istm-design/presets/sanity/DESIGN.md +357 -0
  128. package/istm-design/presets/sanity/README.md +5 -0
  129. package/istm-design/presets/sentry/DESIGN.md +551 -0
  130. package/istm-design/presets/sentry/README.md +5 -0
  131. package/istm-design/presets/shopify/DESIGN.md +516 -0
  132. package/istm-design/presets/shopify/README.md +5 -0
  133. package/istm-design/presets/slack/DESIGN.md +482 -0
  134. package/istm-design/presets/spacex/DESIGN.md +363 -0
  135. package/istm-design/presets/spacex/README.md +5 -0
  136. package/istm-design/presets/spotify/DESIGN.md +246 -0
  137. package/istm-design/presets/spotify/README.md +5 -0
  138. package/istm-design/presets/starbucks/DESIGN.md +580 -0
  139. package/istm-design/presets/starbucks/README.md +5 -0
  140. package/istm-design/presets/stripe/DESIGN.md +487 -0
  141. package/istm-design/presets/stripe/README.md +5 -0
  142. package/istm-design/presets/supabase/DESIGN.md +462 -0
  143. package/istm-design/presets/supabase/README.md +5 -0
  144. package/istm-design/presets/superhuman/DESIGN.md +448 -0
  145. package/istm-design/presets/superhuman/README.md +5 -0
  146. package/istm-design/presets/tesla/DESIGN.md +286 -0
  147. package/istm-design/presets/tesla/README.md +5 -0
  148. package/istm-design/presets/theverge/DESIGN.md +339 -0
  149. package/istm-design/presets/theverge/README.md +5 -0
  150. package/istm-design/presets/together/DESIGN.md +633 -0
  151. package/istm-design/presets/together/README.md +5 -0
  152. package/istm-design/presets/uber/DESIGN.md +636 -0
  153. package/istm-design/presets/uber/README.md +5 -0
  154. package/istm-design/presets/vercel/DESIGN.md +736 -0
  155. package/istm-design/presets/vercel/README.md +5 -0
  156. package/istm-design/presets/vodafone/DESIGN.md +538 -0
  157. package/istm-design/presets/vodafone/README.md +5 -0
  158. package/istm-design/presets/voltagent/DESIGN.md +521 -0
  159. package/istm-design/presets/voltagent/README.md +5 -0
  160. package/istm-design/presets/warp/DESIGN.md +526 -0
  161. package/istm-design/presets/warp/README.md +5 -0
  162. package/istm-design/presets/webflow/DESIGN.md +588 -0
  163. package/istm-design/presets/webflow/README.md +5 -0
  164. package/istm-design/presets/wired/DESIGN.md +497 -0
  165. package/istm-design/presets/wired/README.md +5 -0
  166. package/istm-design/presets/wise/DESIGN.md +544 -0
  167. package/istm-design/presets/wise/README.md +5 -0
  168. package/istm-design/presets/xai/DESIGN.md +465 -0
  169. package/istm-design/presets/xai/README.md +5 -0
  170. package/istm-design/presets/zapier/DESIGN.md +537 -0
  171. package/istm-design/presets/zapier/README.md +5 -0
  172. package/istm-design/references/pick-ui-library.md +1 -1
  173. package/istm-design/semantic-design/DESIGN.md +121 -0
  174. package/istm-design/semantic-design/SKILL.md +184 -0
  175. package/istm-system-design/SKILL.md +12 -5
  176. package/istm-workflow/istm-autoplan/SKILL.md +1905 -0
  177. package/istm-workflow/istm-autoplan/SKILL.md.tmpl +923 -0
  178. package/istm-workflow/istm-craft/SKILL.md +12 -6
  179. package/istm-workflow/istm-cso/ACKNOWLEDGEMENTS.md +14 -0
  180. package/istm-workflow/istm-cso/SKILL.md +1313 -0
  181. package/istm-workflow/istm-cso/SKILL.md.tmpl +407 -0
  182. package/istm-workflow/istm-cso/sections/audit-phases.md +253 -0
  183. package/istm-workflow/istm-cso/sections/audit-phases.md.tmpl +251 -0
  184. package/istm-workflow/istm-cso/sections/manifest.json +14 -0
  185. package/istm-workflow/istm-debt/SKILL.md +44 -0
  186. package/istm-workflow/istm-debug/SKILL.md +12 -3
  187. package/istm-workflow/istm-design-review/SKILL.md +2053 -0
  188. package/istm-workflow/istm-design-review/SKILL.md.tmpl +312 -0
  189. package/istm-workflow/istm-develop/SKILL.md +10 -4
  190. package/istm-workflow/istm-eng-review/SKILL.md +1112 -0
  191. package/istm-workflow/istm-eng-review/SKILL.md.tmpl +163 -0
  192. package/istm-workflow/istm-eng-review/sections/manifest.json +14 -0
  193. package/istm-workflow/istm-eng-review/sections/review-sections.md +942 -0
  194. package/istm-workflow/istm-eng-review/sections/review-sections.md.tmpl +225 -0
  195. package/istm-workflow/istm-gain/SKILL.md +50 -0
  196. package/istm-workflow/istm-health/SKILL.md +1104 -0
  197. package/istm-workflow/istm-health/SKILL.md.tmpl +320 -0
  198. package/istm-workflow/istm-qa/BROWSER.md +1468 -0
  199. package/istm-workflow/istm-qa/SKILL.md +1743 -0
  200. package/istm-workflow/istm-qa/SKILL.md.tmpl +354 -0
  201. package/istm-workflow/istm-qa/references/issue-taxonomy.md +85 -0
  202. package/istm-workflow/istm-qa/templates/qa-report-template.md +126 -0
  203. package/istm-workflow/istm-release/SKILL.md +989 -0
  204. package/istm-workflow/istm-release/SKILL.md.tmpl +160 -0
  205. package/istm-workflow/istm-release/sections/manifest.json +14 -0
  206. package/istm-workflow/istm-release/sections/release-body.md +547 -0
  207. package/istm-workflow/istm-release/sections/release-body.md.tmpl +420 -0
  208. package/istm-workflow/istm-review/SKILL.md +57 -0
  209. package/istm-workflow/istm-ship/SKILL.md +1504 -0
  210. package/istm-workflow/istm-ship/SKILL.md.tmpl +582 -0
  211. package/istm-workflow/istm-ship/sections/adversarial.md +218 -0
  212. package/istm-workflow/istm-ship/sections/adversarial.md.tmpl +19 -0
  213. package/istm-workflow/istm-ship/sections/apple-release.md +58 -0
  214. package/istm-workflow/istm-ship/sections/apple-release.md.tmpl +56 -0
  215. package/istm-workflow/istm-ship/sections/changelog.md +45 -0
  216. package/istm-workflow/istm-ship/sections/changelog.md.tmpl +3 -0
  217. package/istm-workflow/istm-ship/sections/greptile.md +51 -0
  218. package/istm-workflow/istm-ship/sections/greptile.md.tmpl +49 -0
  219. package/istm-workflow/istm-ship/sections/manifest.json +62 -0
  220. package/istm-workflow/istm-ship/sections/plan-completion.md +329 -0
  221. package/istm-workflow/istm-ship/sections/plan-completion.md.tmpl +31 -0
  222. package/istm-workflow/istm-ship/sections/pr-body.md +209 -0
  223. package/istm-workflow/istm-ship/sections/pr-body.md.tmpl +207 -0
  224. package/istm-workflow/istm-ship/sections/review-army.md +406 -0
  225. package/istm-workflow/istm-ship/sections/review-army.md.tmpl +56 -0
  226. package/istm-workflow/istm-ship/sections/test-coverage.md +264 -0
  227. package/istm-workflow/istm-ship/sections/test-coverage.md.tmpl +23 -0
  228. package/istm-workflow/istm-ship/sections/tests.md +403 -0
  229. package/istm-workflow/istm-ship/sections/tests.md.tmpl +116 -0
  230. package/package.json +6 -3
@@ -0,0 +1,1468 @@
1
+ # Browser — Complete Reference
2
+
3
+ istm-workflow's browser surface in one document. Headless Chromium daemon, ~70+
4
+ commands, ref-based element selection, codifiable browser-skills, real-browser
5
+ mode with a Chrome side panel, an in-sidebar Claude PTY, an ngrok pair-agent
6
+ flow, and a layered prompt-injection defense — all behind a compiled CLI that
7
+ prints plain text to stdout. ~100-200ms per call. Zero context-token overhead.
8
+
9
+ If you've used istm-workflow in the last release or two, the productivity loop is the
10
+ new headline: `/scrape <intent>` drives a page once, `/skillify` codifies the
11
+ flow into a deterministic Playwright script, and the next `/scrape` on the
12
+ same intent runs in ~200ms instead of ~30 seconds of agent re-exploration.
13
+
14
+ ---
15
+
16
+ ## Quick start
17
+
18
+ ```bash
19
+ # One-time: build the binary (browse/dist/browse, ~58MB)
20
+ bun install && bun run build
21
+
22
+ # Set $B once and forget about it
23
+ B=./browse/dist/browse # or ~/.claude/skills/istm-workflow/browse/dist/browse
24
+
25
+ # Drive a page
26
+ $B goto https://news.ycombinator.com
27
+ $B snapshot -i # @e refs you can click/fill/inspect later
28
+ $B click @e30 # click ref 30 from the snapshot
29
+ $B text # get clean page text
30
+ $B screenshot /tmp/hn.png
31
+
32
+ # Codify a repeated flow
33
+ /scrape latest hacker news stories
34
+ /skillify # writes ~/.istm-workflow/browser-skills/hn-front/...
35
+ /scrape hacker news front page # second call: 200ms via the codified skill
36
+
37
+ # Watch Claude work in real time
38
+ $B connect # headed Chromium + Side Panel extension
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Table of contents
44
+
45
+ 1. [What it is](#what-it-is)
46
+ 2. [The productivity loop — `/scrape` + `/skillify`](#the-productivity-loop)
47
+ 3. [Architecture](#architecture)
48
+ 4. [Command reference](#command-reference)
49
+ 5. [Snapshot system + ref-based selection](#snapshot-system)
50
+ 6. [Browser-skills runtime](#browser-skills-runtime)
51
+ 7. [Domain-skills (per-site agent notes)](#domain-skills)
52
+ 8. [Real-browser mode (`$B connect`)](#real-browser-mode) — including [`--headed` + `--proxy` + `--navigate` (v1.28.0.0)](#headed-mode--proxy--browser-native-downloads-v12800)
53
+ 9. [Side Panel + sidebar agent](#side-panel--sidebar-agent)
54
+ 10. [Pair-agent — remote agents over an ngrok tunnel](#pair-agent)
55
+ 11. [Authentication + tokens](#authentication)
56
+ 12. [Prompt-injection security stack (L1–L6)](#security-stack)
57
+ 13. [Screenshots, PDFs, visual inspection](#screenshots-pdfs-visual)
58
+ 14. [Local HTML — `goto file://` vs `load-html`](#local-html)
59
+ 15. [Batch endpoint](#batch-endpoint)
60
+ 16. [Console, network, dialog capture](#capture)
61
+ 17. [JS execution — `js` + `eval`](#js-execution)
62
+ 18. [Tabs, frames, state, watch, inbox](#tabs-frames-state)
63
+ 19. [CDP escape hatch + CSS inspector](#cdp)
64
+ 20. [Performance + scale](#performance)
65
+ 21. [Multi-workspace isolation](#multi-workspace)
66
+ 22. [Environment variables](#environment-variables)
67
+ 23. [Source map](#source-map)
68
+ 24. [Development + testing](#development)
69
+ 25. [Cross-references](#cross-references)
70
+ 26. [Acknowledgments](#acknowledgments)
71
+
72
+ ---
73
+
74
+ ## What it is
75
+
76
+ A compiled CLI binary that talks to a persistent local Chromium daemon over
77
+ HTTP. The CLI is a thin client — it reads a state file, sends a command,
78
+ prints the response to stdout. The daemon does the real work via
79
+ [Playwright](https://playwright.dev/).
80
+
81
+ Everything that was a Chrome MCP server in the early days now happens through
82
+ plain stdout. No JSON-schema framing, no protocol negotiation, no persistent
83
+ WebSocket — Claude's Bash tool already exists, so we use it.
84
+
85
+ Three escalating modes:
86
+
87
+ - **Headless** (default). Daemon runs Chromium with no visible window. Fastest,
88
+ cheapest, what skills like `/qa`, `/design-review`, `/benchmark` use by
89
+ default.
90
+ - **Headed via `$B connect`**. Same daemon, but Chromium is visible (rebranded
91
+ as "istm Browser") with the Side Panel extension auto-loaded. You watch
92
+ every command tick through in real time.
93
+ - **Pair-agent over a tunnel**. Daemon binds a second listener that ngrok
94
+ forwards. A remote agent (Codex, OpenClaw, Hermes, anything that can speak
95
+ HTTP) drives your local browser through a 26-command allowlist with a
96
+ scoped, single-use token.
97
+
98
+ ---
99
+
100
+ ## The productivity loop
101
+
102
+ The shipped headline of v1.19.0.0. Two istm-workflow skills wrap the browser-skills
103
+ runtime so the second time you ask Claude to scrape a page, it runs in ~200ms.
104
+
105
+ ### `/scrape <intent>`
106
+
107
+ One entry point for pulling page data. Three paths under the hood:
108
+
109
+ 1. **Match path (~200ms)** — agent runs `$B skill list`, semantically matches
110
+ the intent against each skill's `triggers:` array + `description` + `host`,
111
+ and runs `$B skill run <name>` if a confident match exists.
112
+ 2. **Prototype path (~30s)** — no match, agent drives the page with `$B goto`,
113
+ `$B text`, `$B html`, `$B links`, etc., returns the JSON, and appends a
114
+ one-line "say `/skillify`" suggestion.
115
+ 3. **Mutating-intent refusal** — verbs like *submit*, *click*, *fill* route
116
+ to `/automate` (Phase 2b, P0 in `TODOS.md`). `/scrape` is read-only by
117
+ contract.
118
+
119
+ ### `/skillify`
120
+
121
+ Codifies the most recent successful `/scrape` prototype into a permanent
122
+ browser-skill on disk. Eleven steps, three locked contracts:
123
+
124
+ - **D1 — Provenance guard.** Walks back ≤10 agent turns for a clearly-bounded
125
+ `/scrape` result. Refuses with one specific message if cold. No silent
126
+ synthesis from chat fragments.
127
+ - **D2 — Synthesis input slice.** Extracts ONLY the final-attempt `$B` calls
128
+ that produced the JSON the user accepted, plus the user's intent string.
129
+ Drops failed selectors, drops chat, drops earlier-session content.
130
+ - **D3 — Atomic write.** Stages everything to `~/.istm-workflow/.tmp/skillify-<spawnId>/`,
131
+ runs `$B skill test` against the temp dir, and only renames into the final
132
+ tier path on test pass + user approval. Test fail or rejection: `rm -rf` the
133
+ temp dir entirely. No half-written skill ever appears in `$B skill list`.
134
+
135
+ Mutating-flow sibling `/automate` is split out as P0 in `TODOS.md` and ships
136
+ on the next branch — same skillify machinery, per-mutating-step confirmation
137
+ gate when running non-codified.
138
+
139
+ See [`docs/designs/BROWSER_SKILLS_V1.md`](docs/designs/BROWSER_SKILLS_V1.md)
140
+ for the full design + decision trail.
141
+
142
+ ---
143
+
144
+ ## Architecture
145
+
146
+ ```
147
+ ┌─────────────────────────────────────────────────────────────────┐
148
+ │ Claude Code │
149
+ │ │
150
+ │ $B goto https://staging.myapp.com │
151
+ │ │ │
152
+ │ ▼ │
153
+ │ ┌──────────┐ HTTP POST ┌──────────────┐ │
154
+ │ │ browse │ ──────────────── │ Bun HTTP │ │
155
+ │ │ CLI │ 127.0.0.1:rand │ daemon │ │
156
+ │ │ │ Bearer token │ │ │
157
+ │ │ compiled │ ◄────────────── │ Playwright │──── Chromium │
158
+ │ │ binary │ plain text │ API calls │ (headless │
159
+ │ └──────────┘ └──────────────┘ or headed) │
160
+ │ ~1ms startup persistent daemon │
161
+ │ auto-starts on first call │
162
+ │ auto-stops after 30 min idle │
163
+ └─────────────────────────────────────────────────────────────────┘
164
+ ```
165
+
166
+ ### Daemon lifecycle
167
+
168
+ 1. **First call.** CLI checks `<project>/.istm-workflow/browse.json` for a running
169
+ server. None found — it spawns `bun run browse/src/server.ts` in the
170
+ background. Daemon launches headless Chromium via Playwright, picks a
171
+ random port (10000–49151, deliberately below the macOS ephemeral pool
172
+ 49152-65535 so the OS never hands a colliding port to another process),
173
+ generates a bearer token, writes the state file (chmod 600), starts
174
+ accepting requests. ~3 seconds. One launch-time exception to fail-fast:
175
+ when a macOS XProtect definition update SIGKILLs the pinned Chromium at
176
+ spawn, the daemon classifies the kill signature, clears the quarantine
177
+ flag on the Playwright cache, reinstalls the pinned revision from the
178
+ istm-workflow install root (bounded ~120s), and retries once — at most once per
179
+ daemon process. If the heal can't complete, the original launch error
180
+ plus manual `bunx playwright install chromium` guidance lands on daemon
181
+ stderr (see `browse-daemon.log`). Wired at all three launch sites in
182
+ `browser-manager.ts` via `browse/src/xprotect-heal.ts`.
183
+ 2. **Subsequent calls.** CLI reads the state file, sends an HTTP POST with
184
+ the bearer token, prints the response. ~100-200ms round trip.
185
+ 3. **Idle shutdown.** After 30 minutes of no commands, daemon shuts down and
186
+ cleans up the state file. Next call restarts it.
187
+ 4. **Crash recovery.** If Chromium crashes, the daemon exits immediately —
188
+ no self-healing, don't hide failure. CLI detects the dead daemon on the
189
+ next call and starts a fresh one.
190
+ 5. **Busy vs dead.** A daemon that stops answering HTTP while its process is
191
+ alive is busy, not dead. The CLI gives `/health` a bounded ~8s to recover,
192
+ then reports busy with a nonzero exit — it never kills an alive pid.
193
+ Only an explicit `--force-restart` replaces a live-but-unresponsive
194
+ daemon (tabs, cookies, and logins are lost). `browse stop` against a
195
+ daemon that already died is success: the desired end state holds, so it
196
+ cleans the stale state file instead of booting a daemon just to stop it.
197
+
198
+ ### Multi-workspace isolation
199
+
200
+ Each project root (detected via `git rev-parse --show-toplevel`) gets its
201
+ own daemon, port, state file, cookies, and logs. No cross-workspace
202
+ collisions. State at `<project>/.istm-workflow/browse.json`.
203
+
204
+ | Workspace | State file | Port |
205
+ |-----------|-----------|------|
206
+ | `/code/project-a` | `/code/project-a/.istm-workflow/browse.json` | random (10000–49151) |
207
+ | `/code/project-b` | `/code/project-b/.istm-workflow/browse.json` | random (10000–49151) |
208
+
209
+ ---
210
+
211
+ ## Command reference
212
+
213
+ ~70 commands across read, write, and meta. Selectors accept CSS, `@e` refs
214
+ from `snapshot`, or `@c` refs from `snapshot -C`. Full table:
215
+
216
+ ### Reading
217
+
218
+ | Command | Description |
219
+ |---------|-------------|
220
+ | `text [sel]` | Clean page text (or scoped to a selector) |
221
+ | `html [sel]` | innerHTML, or full page HTML if no selector |
222
+ | `links` | All links as `text → href` |
223
+ | `forms` | Form fields as JSON |
224
+ | `accessibility` | Full ARIA tree |
225
+ | `media [--images\|--videos\|--audio] [sel]` | Media elements with URLs, dimensions, types |
226
+ | `data [--jsonld\|--og\|--meta\|--twitter]` | Structured data: JSON-LD, OG, Twitter Cards, meta tags |
227
+
228
+ ### Inspection
229
+
230
+ | Command | Description |
231
+ |---------|-------------|
232
+ | `js <expr> [--out <file>] [--raw]` | Run inline JavaScript expression in page context, return as string. With `--out <file>` the result is written to disk instead of returned (a `data:*;base64,...` result is decoded to raw bytes unless `--raw`). `--out` makes the invocation a WRITE (needs `write` scope, never allowed over the tunnel). |
233
+ | `eval <file> [--out <file>] [--raw]` | Run JS from a file (path under /tmp or cwd; same sandbox as `js`). `--out`/`--raw` behave as for `js`. |
234
+ | `css <sel> <prop>` | Computed CSS value |
235
+ | `attrs <sel\|@ref>` | Element attributes as JSON |
236
+ | `is <prop> <sel\|@ref>` | State check: visible, hidden, enabled, disabled, checked, editable, focused |
237
+ | `console [--clear\|--errors]` | Captured console messages |
238
+ | `network [--clear]` | Captured network requests |
239
+ | `dialog [--clear]` | Captured dialog messages |
240
+ | `cookies` | All cookies as JSON |
241
+ | `storage` / `storage set <key> <val>` | Read both localStorage + sessionStorage; set localStorage |
242
+ | `perf` | Page load timings |
243
+ | `inspect [sel] [--all] [--history]` | Deep CSS via CDP — full rule cascade, box model, computed styles |
244
+ | `ux-audit` | Page structure for behavioral analysis: site ID, nav, headings, text blocks, interactive elements |
245
+ | `cdp <Domain.method> [json-params]` | Raw CDP method dispatch (deny-default; allowlist in `cdp-allowlist.ts`) |
246
+
247
+ ### Navigation
248
+
249
+ | Command | Description |
250
+ |---------|-------------|
251
+ | `goto <url>` | Navigate to URL (`http://`, `https://`, `file://`) |
252
+ | `load-html <file>` | Load local HTML in memory (no `file://` URL; survives viewport scale changes) |
253
+ | `back`, `forward`, `reload` | Standard nav |
254
+ | `url` | Current page URL |
255
+ | `wait <sel\|--networkidle\|--load>` | Wait for element, network idle, or page load (15s timeout) |
256
+
257
+ ### Interaction
258
+
259
+ | Command | Description |
260
+ |---------|-------------|
261
+ | `click <sel\|@ref>` | Click element |
262
+ | `fill <sel> <val>` | Fill input |
263
+ | `select <sel> <val>` | Select dropdown option (value, label, or visible text) |
264
+ | `hover <sel>` | Hover element |
265
+ | `type <text>` | Type into focused element |
266
+ | `press <key>` | Playwright keyboard key (case-sensitive: Enter, Tab, ArrowUp, Shift+Enter, Control+A, ...) |
267
+ | `scroll [sel\|@ref]` | Scroll element into view, or jump to page bottom if no selector |
268
+ | `viewport [<WxH>] [--scale <n>]` | Set viewport size + optional `deviceScaleFactor` 1-3 (retina screenshots) |
269
+ | `upload <sel> <file> [...]` | Upload file(s) |
270
+ | `dialog-accept [text]` | Auto-accept next alert/confirm/prompt; text is sent for prompts |
271
+ | `dialog-dismiss` | Auto-dismiss next dialog |
272
+
273
+ ### Style + cleanup
274
+
275
+ | Command | Description |
276
+ |---------|-------------|
277
+ | `style <sel> <prop> <val>` | Modify CSS property (with undo support) |
278
+ | `style --undo [N]` | Undo last N style changes |
279
+ | `cleanup [--ads\|--cookies\|--sticky\|--social\|--all]` | Remove page clutter |
280
+ | `prettyscreenshot [--scroll-to <sel\|text>] [--cleanup] [--hide <sel>...] [path]` | Clean screenshot with optional cleanup, scroll, hide |
281
+
282
+ ### Visual
283
+
284
+ | Command | Description |
285
+ |---------|-------------|
286
+ | `screenshot [--selector <css>] [--viewport] [--clip x,y,w,h] [--base64] [sel\|@ref] [path]` | Five modes: full page, viewport, element crop, region clip, base64 |
287
+ | `pdf [path] [--format letter\|a4\|legal] [...]` | PDF with full layout: format, width/height, margins, header/footer templates, page numbers, --tagged for accessibility, --toc waits for Paged.js |
288
+ | `responsive [prefix]` | Three screenshots: mobile (375x812), tablet (768x1024), desktop (1280x720) |
289
+ | `diff <url1> <url2>` | Text diff between two URLs |
290
+
291
+ ### Cookies + headers
292
+
293
+ | Command | Description |
294
+ |---------|-------------|
295
+ | `cookie <name>=<value>` | Set cookie on current page domain |
296
+ | `cookie-import <json>` | Import cookies from JSON file |
297
+ | `cookie-import-browser [browser] [--domain d]` | Import from installed Chromium browsers (interactive picker, or `--domain` for direct import) |
298
+ | `header <name>:<value>` | Set custom request header (sensitive values auto-redacted) |
299
+ | `useragent <string>` | Set user agent (triggers context recreation, invalidates refs) |
300
+
301
+ ### Tabs + frames
302
+
303
+ | Command | Description |
304
+ |---------|-------------|
305
+ | `tabs` | List open tabs |
306
+ | `tab <id>` | Switch to tab |
307
+ | `newtab [url] [--json]` | Open new tab; `--json` returns `{tabId, url}` for programmatic use |
308
+ | `closetab [id]` | Close tab |
309
+ | `tab-each <command> [args...]` | Fan out a command across every open tab; returns JSON |
310
+ | `frame <sel\|@ref\|--name n\|--url pattern\|main>` | Switch to iframe context (or back to main); clears refs |
311
+
312
+ ### Extraction
313
+
314
+ | Command | Description |
315
+ |---------|-------------|
316
+ | `download <url\|@ref> [path] [--base64]` | Download URL or media element using browser cookies |
317
+ | `scrape <images\|videos\|media> [--selector] [--dir] [--limit]` | Bulk download all media from page; writes `manifest.json` |
318
+ | `archive [path]` | Save complete page as MHTML via CDP |
319
+
320
+ ### Snapshot
321
+
322
+ | Command | Description |
323
+ |---------|-------------|
324
+ | `snapshot [-i] [-c] [-d N] [-s sel] [-D] [-a] [-o path] [-C]` | Accessibility tree with `@e` refs; `-i` interactive only, `-c` compact, `-d N` depth, `-s` scope, `-D` diff vs previous, `-a` annotated screenshot, `-C` cursor-interactive `@c` refs |
325
+
326
+ ### Server lifecycle
327
+
328
+ | Command | Description |
329
+ |---------|-------------|
330
+ | `status` | Daemon health + mode (headless / headed / cdp) |
331
+ | `stop` | Shut down daemon (succeeds even if the daemon already died — never boots one just to stop it) |
332
+ | `restart` | Restart daemon |
333
+ | `connect` | Launch headed istm Browser with Side Panel extension |
334
+ | `disconnect` | Close headed Chrome, return to headless |
335
+ | `focus [@ref]` | Bring headed Chrome to foreground (macOS); `@ref` also scrolls into view |
336
+ | `state save\|load <name>` | Save or load browser state (cookies + URLs) |
337
+ | `memory [--json]` | Snapshot Bun heap + per-tab JS heap + Chromium process tree + bounded buffer sizes. Use `--json` for programmatic consumers; text mode renders sorted top-10 tabs with "and N more" tail. |
338
+
339
+ The daemon's own stdout/stderr persists to `<project>/.istm-workflow/browse-daemon.log`
340
+ (append mode, rotated to `.log.1` at the size cap, single generation), with
341
+ tokens and unsanitized page content kept out — check it when a daemon dies
342
+ without an obvious cause. A live-but-unresponsive daemon is never auto-killed;
343
+ pass `--force-restart` to replace it explicitly (see "Daemon lifecycle" above).
344
+
345
+ ### Handoff
346
+
347
+ | Command | Description |
348
+ |---------|-------------|
349
+ | `handoff [reason]` | Open visible Chrome at current page for user takeover (CAPTCHA, MFA, complex auth) |
350
+ | `resume` | Re-snapshot after user takeover, return control to AI |
351
+
352
+ ### Meta + chains
353
+
354
+ | Command | Description |
355
+ |---------|-------------|
356
+ | `chain` (JSON via stdin) | Run a sequence of commands. Pipe `[["cmd","arg1",...],...]` to `$B chain`. Stops at first error. |
357
+ | `inbox [--clear]` | List messages from sidebar scout inbox |
358
+ | `watch [stop]` | Passive observation — periodic snapshots while user browses; `stop` returns summary |
359
+
360
+ ### Browser-skills runtime
361
+
362
+ | Command | Description |
363
+ |---------|-------------|
364
+ | `skill list` | List all browser-skills with resolved tier (project > global > bundled) |
365
+ | `skill show <name>` | Print SKILL.md |
366
+ | `skill run <name> [--arg k=v...] [--timeout=Ns]` | Spawn the skill script with a per-spawn scoped token |
367
+ | `skill test <name>` | Run the skill's `script.test.ts` against bundled fixtures |
368
+ | `skill rm <name> [--global]` | Tombstone a user-tier skill |
369
+
370
+ ### Domain-skills
371
+
372
+ | Command | Description |
373
+ |---------|-------------|
374
+ | `domain-skill save\|list\|show\|edit\|promote-to-global\|rollback\|rm <host?>` | Per-site agent notes (host derived from active tab). Lifecycle: quarantined → active (after N=3 successful uses without classifier flag) → global (explicit promote) |
375
+
376
+ Aliases: `setcontent`, `set-content`, `setContent` → `load-html` (canonicalized
377
+ before scope checks, so a read-scoped token can't use the alias to run a
378
+ write command).
379
+
380
+ ---
381
+
382
+ ## Snapshot system
383
+
384
+ The browser's key innovation is **ref-based element selection** built on
385
+ Playwright's accessibility tree API. No DOM mutation. No injected scripts.
386
+ Just Playwright's native AX API.
387
+
388
+ ### How `@ref` works
389
+
390
+ 1. `page.locator(scope).ariaSnapshot()` returns a YAML-like accessibility tree.
391
+ 2. The snapshot parser assigns refs (`@e1`, `@e2`, ...) to each element.
392
+ 3. For each ref, it builds a Playwright `Locator` (using `getByRole` + nth-child).
393
+ 4. The ref→Locator map is stored on `BrowserManager`.
394
+ 5. Later commands like `click @e3` look up the Locator and call `locator.click()`.
395
+
396
+ ### Ref staleness detection
397
+
398
+ SPAs can mutate the DOM without navigation (React router, tab switches,
399
+ modals). When this happens, refs collected from a previous `snapshot` may
400
+ point to elements that no longer exist. `resolveRef()` runs an async
401
+ `count()` check before using any ref — if the element count is 0, it throws
402
+ immediately with a message telling the agent to re-run `snapshot`. Fails fast
403
+ (~5ms) instead of waiting for Playwright's 30-second action timeout.
404
+
405
+ ### Extended snapshot features
406
+
407
+ - **`--diff` (`-D`).** Stores each snapshot as a baseline. On the next `-D`
408
+ call, returns a unified diff showing what changed. Use this to verify that
409
+ an action (click, fill, etc.) actually worked.
410
+ - **`--annotate` (`-a`).** Injects temporary overlay divs at each ref's
411
+ bounding box, takes a screenshot with ref labels visible, then removes the
412
+ overlays. Use `-o <path>` to control the output.
413
+ - **`--cursor-interactive` (`-C`).** Scans for non-ARIA interactive elements
414
+ (divs with `cursor:pointer`, `onclick`, `tabindex>=0`) using `page.evaluate`.
415
+ Assigns `@c1`, `@c2`... refs with deterministic `nth-child` CSS selectors.
416
+ These are elements the ARIA tree misses but users can still click.
417
+
418
+ ---
419
+
420
+ ## Browser-skills runtime
421
+
422
+ Per-task directories that codify a repeated browser flow into a deterministic
423
+ Playwright script. The compounding layer.
424
+
425
+ ### Anatomy of a browser-skill
426
+
427
+ ```
428
+ browser-skills/<name>/
429
+ ├── SKILL.md # frontmatter + prose contract
430
+ ├── script.ts # deterministic Playwright-via-browse-client logic
431
+ ├── _lib/browse-client.ts # vendored copy of the SDK (~3KB, byte-identical to canonical)
432
+ ├── fixtures/<host>-<date>.html # captured page for fixture-replay tests
433
+ └── script.test.ts # parser tests against the fixture (no daemon required)
434
+ ```
435
+
436
+ The bundled reference is `browser-skills/hackernews-frontpage/`: scrapes the
437
+ HN front page, returns 30 stories as JSON. Try it:
438
+
439
+ ```bash
440
+ $B skill list # shows hackernews-frontpage (bundled)
441
+ $B skill show hackernews-frontpage
442
+ $B skill run hackernews-frontpage # JSON of 30 stories in ~200ms
443
+ $B skill test hackernews-frontpage # runs script.test.ts against fixture
444
+ ```
445
+
446
+ ### Three-tier storage
447
+
448
+ `$B skill list` walks all three in priority order; first hit wins. Resolved
449
+ tier is printed inline next to each skill name:
450
+
451
+ | Tier | Path | When |
452
+ |------|------|------|
453
+ | **Project** | `<project>/.istm-workflow/browser-skills/<name>/` | Project-specific skills (committed or gitignored) |
454
+ | **Global** | `~/.istm-workflow/browser-skills/<name>/` | Per-user skills, all projects |
455
+ | **Bundled** | `<istm-workflow-install>/browser-skills/<name>/` | Ships with istm-workflow, read-only |
456
+
457
+ ### Trust model
458
+
459
+ Two orthogonal axes — daemon-side capability and process-side env — independently
460
+ configured.
461
+
462
+ | Axis | Mechanism | Default |
463
+ |------|-----------|---------|
464
+ | **Daemon-side capability** | Per-spawn scoped token bound to read+write scope (browser-driving commands minus admin: `eval`, `js`, `cookies`, `storage`). Single-use clientId encodes skill name + spawn id. Revoked when spawn exits. | Always scoped — never the daemon root token |
465
+ | **Process-side env** | `trusted: true` frontmatter passes `process.env` minus `istm_TOKEN`. `trusted: false` (default) drops everything except a minimal allowlist (LANG, LC_ALL, TERM, TZ) and pattern-strips secrets (TOKEN/KEY/SECRET/PASSWORD, AWS_*, ANTHROPIC_*, OPENAI_*, GITHUB_*, etc.) | Untrusted (must opt in) |
466
+
467
+ `istm_PORT` and `istm_SKILL_TOKEN` are injected last, so a parent process
468
+ can't override them.
469
+
470
+ ### Output protocol
471
+
472
+ stdout = JSON. stderr = streaming logs. Exit 0 / non-zero. Default 60s
473
+ timeout, override via `--timeout=Ns`. Max stdout 1MB (truncate + non-zero
474
+ exit if exceeded). Matches `gh` / `kubectl` / `docker` conventions.
475
+
476
+ ### How the SDK distribution works
477
+
478
+ Each skill ships its own copy of `browse-client.ts` at `_lib/browse-client.ts`,
479
+ byte-identical to the canonical `browse/src/browse-client.ts`. `/skillify`
480
+ copies the canonical SDK alongside every generated script. Each skill is
481
+ fully self-contained: copy the directory anywhere, it runs. Version drift
482
+ impossible — the SDK is frozen at the version the skill was authored against.
483
+
484
+ ### Atomic write discipline (`/skillify` D3)
485
+
486
+ `browse/src/browser-skill-write.ts` provides three primitives:
487
+
488
+ - `stageSkill(opts)` — writes files to `~/.istm-workflow/.tmp/skillify-<spawnId>/<name>/`
489
+ with restrictive perms.
490
+ - `commitSkill(opts)` — atomic `fs.renameSync` into the final tier path.
491
+ Refuses to follow symlinked staging dirs (`lstat` check), refuses to
492
+ clobber existing skills, runs `realpath` discipline on the tier root.
493
+ - `discardStaged(stagedDir)` — `rm -rf` the staged dir + per-spawn wrapper.
494
+ Idempotent. Called on test failure or approval rejection.
495
+
496
+ There is no "almost shipped" state. Tests pass + user approves = atomic
497
+ rename. Tests fail or user rejects = staging vanishes.
498
+
499
+ See [`docs/designs/BROWSER_SKILLS_V1.md`](docs/designs/BROWSER_SKILLS_V1.md)
500
+ for the full design rationale.
501
+
502
+ ---
503
+
504
+ ## Domain-skills
505
+
506
+ Different mental model from browser-skills: agent-authored *notes* about a
507
+ site (not deterministic scripts). One per hostname. Lifecycle:
508
+
509
+ 1. `domain-skill save <host>` — agent writes a note about the site (e.g.,
510
+ "GitHub: PR creation needs `--draft` flag for non-staff", "X.com: timeline
511
+ uses cursor pagination, not page numbers"). Default state: **quarantined**.
512
+ 2. After **N=3** successful uses without the L4 prompt-injection classifier
513
+ flagging the note, it auto-promotes to **active**.
514
+ 3. `domain-skill promote-to-global <host>` lifts it to the global tier
515
+ (machine-wide, all projects).
516
+ 4. `domain-skill rollback <host>` demotes; `domain-skill rm <host>` tombstones.
517
+
518
+ The classifier flag is set automatically by the L4 prompt-injection scan;
519
+ agents do not set it manually.
520
+
521
+ Storage:
522
+ - Per-project: `<project>/.istm-workflow/domain-skills/<host>.md`
523
+ - Global: `~/.istm-workflow/domain-skills/<host>.md`
524
+
525
+ Source: `browse/src/domain-skills.ts`, `domain-skill-commands.ts`.
526
+
527
+ ---
528
+
529
+ ## Real-browser mode
530
+
531
+ `$B connect` launches **istm Browser** — a rebranded Chromium controlled by
532
+ Playwright with the Side Panel extension auto-loaded and anti-bot stealth
533
+ patches applied. You watch every command tick through a visible window in
534
+ real time.
535
+
536
+ ```bash
537
+ $B connect # launches istm Browser, headed
538
+ $B goto https://app.com # navigates in the visible window
539
+ $B snapshot -i # refs from the real page
540
+ $B click @e3 # clicks in the real window
541
+ $B focus # bring window to foreground (macOS)
542
+ $B status # shows Mode: cdp
543
+ $B disconnect # back to headless mode
544
+ ```
545
+
546
+ The window has a subtle golden shimmer line at the top and a floating
547
+ "istm-workflow" pill in the bottom-right corner so you always know which Chrome
548
+ window is being controlled.
549
+
550
+ ### What "istm Browser" means
551
+
552
+ Not your daily Chrome — a Playwright-managed Chromium with custom branding
553
+ in the Dock and menu bar (the `.app` name, Dock icon, and tray, NOT the UA
554
+ string), always-on Layer C anti-bot stealth (most JS-observable automation
555
+ tells are masked, so many anti-bot-protected sites load cleanly), a
556
+ stock-Chrome user agent that reports the underlying Chromium version, and the
557
+ istm-workflow extension pre-loaded via `launchPersistentContext`. The UA no longer
558
+ carries a `istmBrowser` suffix — that branding string was itself a
559
+ high-entropy tell, so the browser now reports a plain `Chrome/<version>` UA.
560
+ Deepest-layer CDP-protocol detection still gets through (Google can still
561
+ trigger captchas; see the CDP-patch item in `TODOS.md`). Your regular Chrome
562
+ with your tabs and bookmarks stays untouched.
563
+
564
+ ### When to use headed mode
565
+
566
+ - **QA testing** where you want to watch Claude click through your app
567
+ - **Design review** where you need to see exactly what Claude sees
568
+ - **Debugging** where headless behavior differs from real Chrome
569
+ - **Demos** where you're sharing your screen
570
+ - **Pair-agent** sessions (the remote agent drives your local browser)
571
+
572
+ ### CDP-aware skills
573
+
574
+ When in real-browser mode, `/qa` and `/design-review` automatically skip
575
+ cookie import prompts and headless workarounds — the headed browser already
576
+ has whatever session you logged into.
577
+
578
+ ### Headed mode + proxy + browser-native downloads (v1.28.0.0)
579
+
580
+ Three coordinated flags for sites that block headless browsers, fingerprint
581
+ Playwright defaults, or sit behind authenticated upstream proxies:
582
+
583
+ ```bash
584
+ # Visible Chromium. Auto-spawns Xvfb on Linux containers without DISPLAY.
585
+ $B --headed goto https://example.com
586
+
587
+ # SOCKS5 with auth — Chromium can't prompt for SOCKS5 creds, so $B runs a
588
+ # local 127.0.0.1 bridge that handles the auth handshake.
589
+ $B --proxy socks5://user:pass@residential.proxy.host:1080 goto https://example.com
590
+
591
+ # HTTP/HTTPS proxy passes through to Chromium directly.
592
+ $B --proxy http://corp-proxy:3128 goto https://example.com
593
+
594
+ # Browser-native download for Content-Disposition, redirect chains, anti-bot
595
+ # CDNs where page.request.fetch() falls over.
596
+ $B download "https://protected.example.com/file" /tmp/file.bin --navigate
597
+
598
+ # Combined.
599
+ $B --headed --proxy socks5://user:pass@host:1080 \
600
+ download "https://protected.example.com/file" /tmp/file.bin --navigate
601
+ ```
602
+
603
+ **Credential policy.** Pass creds via the URL (`socks5://user:pass@host`) OR
604
+ the env vars `BROWSE_PROXY_USER` / `BROWSE_PROXY_PASS` — never both. `$B`
605
+ refuses with a clear hint when both are set; silent override created
606
+ "works on my machine" debugging traps.
607
+
608
+ **Daemon discipline.** `--proxy` and `--headed` are daemon-startup config.
609
+ A running daemon with config A meeting a new invocation with config B exits
610
+ 1 with a `browse disconnect` hint instead of silently restarting and dropping
611
+ tab state, cookies, or sessions.
612
+
613
+ **Stealth scope (Layer C, always on).** Every context — headless `launch`,
614
+ `--headed`/`--proxy`, `handoff`, and the `useragent`/`viewport --scale`
615
+ rebuild (`recreateContext`) — gets the full Layer C mask, no opt-in flag.
616
+ Layer C masks `navigator.webdriver`, restores the `window.chrome.*` shape
617
+ (`runtime`, `app`, `csi`, `loadTimes`), aligns `Notification.permission`
618
+ with the Permissions API, reports a per-install
619
+ `hardwareConcurrency`/`deviceMemory` from the host profile, sweeps the known
620
+ Selenium/Phantom/Nightmare/Playwright globals, and installs a
621
+ `Function.prototype.toString` proxy so every patched getter reports
622
+ `[native code]` even under the depth-3 recursion check. It still does NOT
623
+ fake `navigator.plugins` or `navigator.languages` — modern fingerprinters
624
+ cross-check those for consistency, and synthesizing fixed values flags MORE
625
+ bot-like, not less. ChromeDriver's `cdc_`/`__webdriver` runtime artifacts and
626
+ the Permissions notifications tell are also cleaned up on every path.
627
+
628
+ `istm_STEALTH=extended` (also accepts `1` or `true`; off by default) layers
629
+ six more aggressive patches on top — WebGL renderer spoof, a faked
630
+ `navigator.plugins` PluginArray, `navigator.mediaDevices`. That mode actively
631
+ lies and can break sites that reflect on those properties; use it only when
632
+ the default triggers detection. For gbrowser builds with the C++ patches, the
633
+ `istm_*` host-profile env (GPU vendor/renderer, UA-CH platform/model,
634
+ hardware) emits the Pack 1 `--istm-workflow-gpu-vendor` / `--istm-workflow-gpu-renderer` /
635
+ `--istm-workflow-ua-platform` / `--istm-workflow-ua-model` / `--istm-workflow-hw-concurrency` /
636
+ `--istm-workflow-device-memory` switches that push the GPU/UA-CH/hardware spoof down
637
+ to native code, and `istm_CDP_STEALTH=on` (or `1`/`true`) emits the Pack 2
638
+ `--istm-workflow-suppress-prepare-stack-trace` switch (closes the Cloudflare
639
+ `Error.prepareStackTrace` canary). On stock Playwright Chromium every one of
640
+ these switches is a safe no-op.
641
+
642
+ `launchHeaded` / `handoff` also strip Playwright's automation-tell launch
643
+ defaults via `ignoreDefaultArgs` (`STEALTH_IGNORE_DEFAULT_ARGS`):
644
+ `--enable-automation` (the "Chrome is being controlled by automated test
645
+ software" infobar), `--disable-extensions`,
646
+ `--disable-component-extensions-with-background-pages`,
647
+ `--disable-popup-blocking`, `--disable-component-update`, and
648
+ `--disable-default-apps`.
649
+
650
+ **Container support.** `--headed` on Linux without `DISPLAY` walks the
651
+ display range (`:99`, `:100`, ...) until `xdpyinfo` reports a free slot,
652
+ then spawns Xvfb. Cleanup-on-disconnect validates the recorded PID's
653
+ `/proc/<pid>/cmdline` matches `Xvfb` AND start-time matches before sending
654
+ any signal — no PID-reuse footguns. Skips spawn entirely when
655
+ `WAYLAND_DISPLAY` is set (Chromium uses Wayland natively). Standard
656
+ Debian/Ubuntu containers work out of the box; minimal images (alpine,
657
+ distroless) may need fonts/dbus/gtk libs for headed Chromium to render.
658
+
659
+ **Failure modes.** SOCKS5 upstream rejected or unreachable — fail-fast at
660
+ startup with a redacted error after 3 retries (5s budget). Mid-stream
661
+ upstream drop — bridge kills the affected client connection only; no
662
+ transport retries that could corrupt browser traffic.
663
+
664
+ ---
665
+
666
+ ## Side Panel + sidebar agent
667
+
668
+ The Chrome extension that ships baked into istm Browser shows a live
669
+ activity feed of every browse command in a Side Panel, plus `@ref` overlays
670
+ on the page, plus an interactive Claude PTY inside the sidebar.
671
+
672
+ ### The Terminal pane (the headline)
673
+
674
+ The Side Panel's primary surface is the **Terminal pane** — a live `claude -p`
675
+ PTY you can type into directly from the sidebar. Activity / Refs / Inspector
676
+ are debug overlays behind the footer's `debug` toggle. WebSocket auth uses
677
+ `Sec-WebSocket-Protocol` (browsers can't set `Authorization` on a WebSocket
678
+ upgrade), and the PTY session token is a 30-minute HttpOnly cookie minted
679
+ via `POST /pty-session`.
680
+
681
+ The toolbar's Cleanup button and the Inspector's "Send to Code" action both
682
+ pipe text into the live Claude PTY via `window.istmInjectToTerminal(text)`,
683
+ exposed by `sidepanel-terminal.js`. There's no separate `/sidebar-command`
684
+ POST — the live REPL is the only execution surface.
685
+
686
+ ### Activity feed
687
+
688
+ A scrolling feed of every browse command — name, args, duration, status,
689
+ errors. Shows up in real time as Claude works. Backed by SSE (`/activity/stream`)
690
+ that accepts the Bearer token OR the HttpOnly `istm_sse` session cookie
691
+ (30-minute stream-scope cookie minted via `POST /sse-session`).
692
+
693
+ ### Refs tab
694
+
695
+ After `$B snapshot`, shows the current `@ref` list (role + name) so you can
696
+ see what Claude is targeting.
697
+
698
+ ### CSS Inspector
699
+
700
+ Powered by `$B inspect` (CDP-based). Click any element on the page to see the
701
+ full CSS rule cascade, computed styles, box model, and modification history.
702
+ The "Send to Code" button injects a description into the Claude PTY.
703
+
704
+ ### Sidebar architecture
705
+
706
+ | Component | Where it lives | Notes |
707
+ |-----------|----------------|-------|
708
+ | Side Panel UI | `extension/sidepanel.js`, `sidepanel-terminal.js` | Chrome extension surface |
709
+ | Background SW | `extension/background.js` | Manages tab events, port management |
710
+ | Content script | `extension/content.js` | Page overlays, `istm-workflow` pill |
711
+ | Terminal agent | `browse/src/terminal-agent.ts` | PTY spawn, lifecycle, auth |
712
+ | Sidebar utilities | `browse/src/sidebar-utils.ts` | URL sanitization, helpers |
713
+
714
+ Before modifying any of these, read the comment block in `CLAUDE.md` under
715
+ "Sidebar architecture" — silent failures here usually trace to not understanding
716
+ the cross-component flow.
717
+
718
+ ### Manual install (for your regular Chrome)
719
+
720
+ If you want the extension in your everyday Chrome (not the Playwright-controlled
721
+ one):
722
+
723
+ ```bash
724
+ bin/istm-workflow-extension # opens chrome://extensions, copies path to clipboard
725
+ ```
726
+
727
+ Or do it manually: `chrome://extensions` → toggle Developer mode → Load
728
+ unpacked → navigate to `~/.claude/skills/istm-workflow/extension` → pin the
729
+ extension → enter the port from `$B status`.
730
+
731
+ v1.63 pinned the extension identity via the manifest `key` field, so existing
732
+ unpacked installs get a new extension ID and panel-local state (saved port)
733
+ resets once — a one-time in-product notice explains this.
734
+
735
+ ---
736
+
737
+ ## Pair-agent
738
+
739
+ Remote AI agents (Codex, OpenClaw, Hermes, anything that speaks HTTP) can
740
+ drive your local browser through an ngrok tunnel. The whole flow is gated
741
+ by a 26-command allowlist, scoped tokens, and a denial log.
742
+
743
+ ### How it works
744
+
745
+ ```bash
746
+ /pair-agent # generates a setup key, prints connection instructions
747
+ # Copy the instructions to the remote agent
748
+ # Remote agent runs:
749
+ # POST <tunnel-url>/connect with setup key → gets a scoped token (24h, single client)
750
+ # POST <tunnel-url>/command with token → runs allowed commands
751
+ ```
752
+
753
+ ### Dual-listener architecture (v1.6.0.0+)
754
+
755
+ When `pair-agent` activates, the daemon binds **two HTTP listeners**:
756
+
757
+ - **Local listener** (`127.0.0.1:LOCAL_PORT`). Full command surface. Never
758
+ forwarded by ngrok. Used by your Claude Code, the Side Panel, anything
759
+ on your machine.
760
+ - **Tunnel listener** (`127.0.0.1:TUNNEL_PORT`). Locked allowlist —
761
+ `/connect`, `/command` (scoped tokens + 26-command browser-driving
762
+ allowlist), `/sidebar-chat`. ngrok forwards only this port.
763
+
764
+ Root tokens sent over the tunnel return 403. SSE endpoints use a 30-minute
765
+ HttpOnly `istm_sse` cookie (never valid against `/command`).
766
+
767
+ ### The 26-command tunnel allowlist
768
+
769
+ Defined in `browse/src/server.ts` as `TUNNEL_COMMANDS`. Pure gate function
770
+ `canDispatchOverTunnel(command)` is exported for unit testing. Set:
771
+
772
+ ```
773
+ goto, click, text, screenshot, html, links, forms, accessibility,
774
+ attrs, media, data, scroll, press, type, select, wait, eval,
775
+ newtab, tabs, back, forward, reload, snapshot, fill, url, closetab
776
+ ```
777
+
778
+ Notably absent: `pair`, `unpair`, `cookies`, `setup`, `launch`, `restart`,
779
+ `stop`, `tunnel-start`, `token-mint`, `state`, `connect`, `disconnect`. A
780
+ remote agent that tries them gets a 403 plus a fresh entry in the denial log.
781
+
782
+ ### Tunnel denial log
783
+
784
+ `~/.istm-workflow/security/attempts.jsonl` — append-only, salted SHA-256 of source
785
+ + domain only (no raw IP, no full request body), rotates at 10MB with 5
786
+ generations. Per-device salt at `~/.istm-workflow/security/device-salt` (mode 0600).
787
+
788
+ ### Tunnel egress receipts (v1.63+)
789
+
790
+ Every tunnel session open writes a hash-chained egress receipt (sink
791
+ `browse-tunnel`) to `~/.istm-workflow/security/egress.jsonl` BEFORE ngrok forwards
792
+ anything. Fail-closed: if the receipt can't be written, the tunnel listener
793
+ is torn down and the start is refused. Inspect the ledger with
794
+ `bin/istm-workflow-egress list` and verify chain integrity with
795
+ `bin/istm-workflow-egress verify` (exit 3 on tamper).
796
+
797
+ See [`docs/REMOTE_BROWSER_ACCESS.md`](docs/REMOTE_BROWSER_ACCESS.md) for the
798
+ full operator guide.
799
+
800
+ ### Tab ownership
801
+
802
+ Scoped tokens default to `tabPolicy: 'own-only'`. A paired agent can `newtab`
803
+ to create its own tab and drive that tab freely, but it can't `goto`, `fill`,
804
+ or `click` on tabs another caller owns. `tabs` lists ALL tab metadata (an
805
+ accepted tradeoff — see ARCHITECTURE.md), but `text`/`html`/`snapshot` content
806
+ of unowned tabs is blocked by ownership checks.
807
+
808
+ ---
809
+
810
+ ## Authentication
811
+
812
+ Three token types, three lifetimes, three scopes.
813
+
814
+ | Token | Generated by | Lifetime | Scope |
815
+ |-------|--------------|----------|-------|
816
+ | **Root token** | Daemon startup (random UUID) | Daemon process lifetime | Full command surface, local listener only — 403 over tunnel |
817
+ | **Setup key** | `POST /pair` | 5 minutes, one-time use | Single redemption: present at `/connect`, get a scoped token |
818
+ | **Scoped token** | `POST /connect` (with setup key) | 24 hours | Per-client, allowlist-bound, optionally tab-scoped |
819
+
820
+ The root token is written to `<project>/.istm-workflow/browse.json` with chmod 600.
821
+ Every command that mutates browser state must include
822
+ `Authorization: Bearer <token>`.
823
+
824
+ ### SSE session cookie (v1.6.0.0+)
825
+
826
+ SSE endpoints (`/activity/stream`, `/inspector/events`) accept the Bearer
827
+ token OR a 30-minute HttpOnly `istm_sse` cookie minted via
828
+ `POST /sse-session`. The `?token=<ROOT>` query-param auth is no longer
829
+ supported. This is what lets the Chrome extension subscribe to the activity
830
+ feed without putting the root token in extension storage.
831
+
832
+ ### PTY session cookie
833
+
834
+ The Terminal pane uses a separate session cookie, `istm_pty`, minted via
835
+ `POST /pty-session`. Different scope — can spawn / drive the live `claude`
836
+ PTY, can't dispatch arbitrary `/command` calls. `/health` endpoint MUST NOT
837
+ surface this token.
838
+
839
+ ### Extension token bootstrap (v1.63+)
840
+
841
+ `GET /health` is liveness/status only — it never carries a token, in any
842
+ mode. The Side Panel extension bootstraps the root token via
843
+ `POST /extension-token` on the local listener. The server releases the
844
+ token only when the caller's Origin is exactly
845
+ `chrome-extension://<istm_EXTENSION_ID>` — the `key` field in
846
+ `extension/manifest.json` pins the extension ID (`istm_EXTENSION_ID` in
847
+ `browse/src/server.ts`; derivation reproducible via
848
+ `bun browse/scripts/extension-id.ts`) — AND the parsed Host hostname is
849
+ loopback. Anything else gets a detail-free 403. The endpoint is never
850
+ added to `TUNNEL_PATHS`, so the tunnel surface 404s it by default-deny.
851
+
852
+ ### Token registry
853
+
854
+ `browse/src/token-registry.ts` handles mint/validate/revoke for all three
855
+ types, plus per-token rate limiting. Setup keys are single-use; scoped
856
+ tokens have a sliding 24h window; the root token is rotated on each daemon
857
+ startup.
858
+
859
+ ---
860
+
861
+ ## Security stack
862
+
863
+ Layered defense against prompt injection on untrusted page content.
864
+
865
+ | Layer | Module | Lives in |
866
+ |-------|--------|----------|
867
+ | **L1** Datamarking | `content-security.ts` | server + page-content read path |
868
+ | **L2** Hidden-element strip | `content-security.ts` | server + page-content read path |
869
+ | **L3** ARIA + URL blocklist + envelope wrapping | `content-security.ts` | server + page-content read path |
870
+ | **L4** TestSavantAI ML classifier (112MB ONNX) | `security-classifier.ts` | security sidecar subprocess* |
871
+ | Canary token utilities | `security.ts` | pure functions — no live injector today |
872
+ | `combineVerdict` ensemble | `security.ts` | server (inline L4 verdict path) |
873
+
874
+ \* `security-classifier.ts` cannot be imported from the compiled browse
875
+ binary — `@huggingface/transformers` v4 requires `onnxruntime-node` which
876
+ fails to `dlopen` from Bun compile's temp extract dir. The compiled binary
877
+ runs L1–L3 plus the pure parts of `security.ts`; L4 runs in a plain-Node
878
+ sidecar (`security-sidecar-entry.ts`, spawned lazily by
879
+ `security-sidecar-client.ts` on the first `/pty-inject-scan`).
880
+
881
+ ### Thresholds
882
+
883
+ - `BLOCK: 0.85` — single-layer score that would cause BLOCK if cross-confirmed
884
+ - `WARN: 0.75` — cross-confirm threshold in `combineVerdict`
885
+ - `LOG_ONLY: 0.40` — log-only floor
886
+ - `SOLO_CONTENT_BLOCK: 0.92` — single-layer threshold for label-less content classifiers
887
+
888
+ ### Ensemble rule
889
+
890
+ `combineVerdict` retains multi-layer ensemble semantics (2-of-N block votes;
891
+ single-layer high confidence degrades to WARN — the Stack Overflow
892
+ instruction-writing FP mitigation), but only L4 (testsavant) is live today:
893
+ the Haiku transcript and DeBERTa ensemble layers were removed along with the
894
+ sidebar chat pipeline that hosted them. **Canary leak always BLOCKs
895
+ (deterministic).**
896
+
897
+ ### Env knobs
898
+
899
+ - `istm_SECURITY_OFF=1` — emergency kill switch. Classifier stays off
900
+ even if warmed. Just the ML scan is skipped.
901
+ - Classifier model cache: `~/.istm-workflow/models/testsavant-small/` (112MB, first
902
+ run only).
903
+ - Attack log: `~/.istm-workflow/security/attempts.jsonl` (salted SHA-256 + domain
904
+ only, rotates at 10MB, 5 generations).
905
+ - Per-device salt: `~/.istm-workflow/security/device-salt` (0600).
906
+
907
+ There is no security status indicator in the sidebar and no `security`
908
+ field on `/health` (#2557): the session-state file that fed them lost its
909
+ only writer when the chat-path agent was removed, so they reported stale or
910
+ empty data. The live defenses report through their own call sites. See
911
+ ARCHITECTURE.md § "Prompt injection defense" for the full threat model.
912
+
913
+ ---
914
+
915
+ ## Screenshots, PDFs, visual
916
+
917
+ ### Screenshot modes
918
+
919
+ | Mode | Syntax | Playwright API |
920
+ |------|--------|----------------|
921
+ | Full page (default) | `screenshot [path]` | `page.screenshot({ fullPage: true })` |
922
+ | Viewport only | `screenshot --viewport [path]` | `page.screenshot({ fullPage: false })` |
923
+ | Element crop (flag) | `screenshot --selector <css> [path]` | `locator.screenshot()` |
924
+ | Element crop (positional) | `screenshot "#sel" [path]` or `screenshot @e3 [path]` | `locator.screenshot()` |
925
+ | Region clip | `screenshot --clip x,y,w,h [path]` | `page.screenshot({ clip })` |
926
+
927
+ Element crop accepts CSS selectors (`.class`, `#id`, `[attr]`) or `@e`/`@c`
928
+ refs. **Tag selectors like `button` aren't caught by the positional
929
+ heuristic** — use the `--selector` flag form.
930
+
931
+ `--base64` returns `data:image/png;base64,...` instead of writing to disk —
932
+ composes with `--selector`, `--clip`, `--viewport`.
933
+
934
+ Mutual exclusion: `--clip` + selector, `--viewport` + `--clip`, and
935
+ `--selector` + positional selector all throw.
936
+
937
+ ### Retina screenshots — `viewport --scale`
938
+
939
+ `viewport --scale <n>` sets Playwright's `deviceScaleFactor` (context-level,
940
+ 1–3 cap):
941
+
942
+ ```bash
943
+ $B viewport 480x600 --scale 2
944
+ $B load-html /tmp/card.html
945
+ $B screenshot /tmp/card.png --selector .card
946
+ # .card at 400x200 CSS pixels → card.png is 800x400 pixels
947
+ ```
948
+
949
+ `--scale N` alone (no `WxH`) keeps the current viewport size. Scale changes
950
+ trigger a context recreation, which invalidates `@e`/`@c` refs — rerun
951
+ `snapshot` after. HTML loaded via `load-html` survives the recreation via
952
+ in-memory replay. Rejected in headed mode (real browser controls scale).
953
+
954
+ ### PDF generation
955
+
956
+ `pdf` accepts the full Playwright surface plus a few additions:
957
+
958
+ - **Layout:** `--format letter|a4|legal`, `--width <dim>`, `--height <dim>`,
959
+ `--margins <dim>`, `--margin-top/right/bottom/left <dim>`
960
+ - **Structure:** `--toc` (waits for Paged.js if loaded), `--outline`,
961
+ `--tagged` (PDF/A accessibility), `--print-background`,
962
+ `--prefer-css-page-size`
963
+ - **Branding:** `--header-template <html>`, `--footer-template <html>`,
964
+ `--page-numbers`
965
+ - **Tabs:** `--tab-id <N>` to render a specific tab
966
+ - **Large payloads:** `--from-file <payload.json>` (avoids shell argv limits)
967
+
968
+ ### Responsive screenshots
969
+
970
+ `responsive [prefix]` — three screenshots in one call: mobile (375x812),
971
+ tablet (768x1024), desktop (1280x720). Saves as `{prefix}-mobile.png` etc.
972
+
973
+ ### `prettyscreenshot`
974
+
975
+ Combines cleanup + scroll + element hide in one call:
976
+
977
+ ```bash
978
+ $B prettyscreenshot --cleanup --scroll-to "hero section" --hide ".cookie-banner" /tmp/clean.png
979
+ ```
980
+
981
+ ---
982
+
983
+ ## Local HTML
984
+
985
+ Two ways to render HTML that isn't on a web server:
986
+
987
+ | Approach | When | URL after | Relative assets |
988
+ |----------|------|-----------|-----------------|
989
+ | `goto file://<abs-path>` | File already on disk | `file:///...` | Resolve against file's directory |
990
+ | `goto file://./<rel>`, `goto file://~/<rel>` | Smart-parsed to absolute | `file:///...` | Same |
991
+ | `load-html <file>` | HTML generated in memory, no parent-dir context needed | `about:blank` | Broken (self-contained HTML only) |
992
+
993
+ Both are scoped to files under cwd or `$TMPDIR` via the same safe-dirs
994
+ policy as `eval`. `file://` URLs preserve query strings and fragments (SPA
995
+ routes work).
996
+
997
+ `load-html` has an extension allowlist (`.html`, `.htm`, `.xhtml`, `.svg`) and
998
+ a magic-byte sniff to reject binary files mis-renamed as HTML. 50MB size cap
999
+ (override via `istm_BROWSE_MAX_HTML_BYTES`).
1000
+
1001
+ `load-html` content survives later `viewport --scale` calls via in-memory
1002
+ replay (TabSession tracks the loaded HTML + waitUntil). The replay is
1003
+ purely in-memory — HTML is never persisted to disk via `state save` to
1004
+ avoid leaking secrets or customer data.
1005
+
1006
+ ---
1007
+
1008
+ ## Batch endpoint
1009
+
1010
+ `POST /batch` sends multiple commands in a single HTTP request. Eliminates
1011
+ per-command round-trip latency — critical for remote agents over ngrok where
1012
+ each HTTP call costs 2-5s.
1013
+
1014
+ ```json
1015
+ POST /batch
1016
+ Authorization: Bearer <token>
1017
+
1018
+ {
1019
+ "commands": [
1020
+ {"command": "text", "tabId": 1},
1021
+ {"command": "text", "tabId": 2},
1022
+ {"command": "snapshot", "args": ["-i"], "tabId": 3},
1023
+ {"command": "click", "args": ["@e5"], "tabId": 4}
1024
+ ]
1025
+ }
1026
+ ```
1027
+
1028
+ Each command routes through `handleCommandInternal` — full security pipeline
1029
+ (scope checks, domain validation, tab ownership, content wrapping) enforced
1030
+ per command. Per-command error isolation: one failure doesn't abort the
1031
+ batch. Max 50 commands per batch. Nested batches rejected. Rate limiting:
1032
+ 1 batch = 1 request against the per-agent limit.
1033
+
1034
+ Pattern: agent crawling 20 pages opens 20 tabs (individual `newtab` or
1035
+ batch), then `POST /batch` with 20 `text` commands → 20 page contents in
1036
+ ~2-3 seconds total vs ~40-100 seconds serial.
1037
+
1038
+ ---
1039
+
1040
+ ## Capture
1041
+
1042
+ Console, network, and dialog events flow into O(1) circular buffers (50,000
1043
+ capacity each), flushed to disk asynchronously via `Bun.write()`:
1044
+
1045
+ - Console: `.istm-workflow/browse-console.log`
1046
+ - Network: `.istm-workflow/browse-network.log`
1047
+ - Dialog: `.istm-workflow/browse-dialog.log`
1048
+
1049
+ The `console`, `network`, and `dialog` commands read from the in-memory
1050
+ buffers (not disk) so capture is real-time even when disk is slow.
1051
+
1052
+ Dialogs (alert, confirm, prompt) are auto-accepted by default to prevent
1053
+ browser lockup. `dialog-accept <text>` controls prompt response text.
1054
+
1055
+ ---
1056
+
1057
+ ## JS execution
1058
+
1059
+ `js` runs an inline expression. `eval` runs a JS file. Both run in the
1060
+ **same JS sandbox** — the only difference is inline-vs-file. Both support
1061
+ `await` — expressions containing `await` are auto-wrapped in an async
1062
+ context:
1063
+
1064
+ ```bash
1065
+ $B js "await fetch('/api/data').then(r => r.json())" # auto-wrapped
1066
+ $B js "document.title" # no wrap needed
1067
+ $B eval my-script.js # file with await
1068
+ ```
1069
+
1070
+ For `eval` files, single-line files return the expression value directly.
1071
+ Multi-line files need explicit `return` when using `await`. Comments
1072
+ containing the literal token "await" don't trigger wrapping.
1073
+
1074
+ Path safety: `eval` rejects paths outside cwd or `/tmp`. `js` doesn't read
1075
+ files at all.
1076
+
1077
+ ---
1078
+
1079
+ ## Tabs, frames, state
1080
+
1081
+ ### Tabs
1082
+
1083
+ ```bash
1084
+ $B tabs # list all open tabs
1085
+ $B tab 3 # switch to tab 3
1086
+ $B newtab https://example.com # open new tab, switch to it
1087
+ $B newtab --json # programmatic: returns {"tabId":N,"url":...}
1088
+ $B closetab # close current
1089
+ $B closetab 2 # close tab 2
1090
+ $B tab-each "text" # run "text" on every tab, return JSON
1091
+ ```
1092
+
1093
+ `tab-each <command>` fans out a command across every open tab and returns a
1094
+ JSON array — handy for "give me the text of every tab I have open."
1095
+
1096
+ ### Frames
1097
+
1098
+ ```bash
1099
+ $B frame "#stripe-iframe" # switch to iframe by selector
1100
+ $B frame @e7 # by ref
1101
+ $B frame --name "checkout" # by name attribute
1102
+ $B frame --url "stripe.com" # by URL pattern match
1103
+ $B frame main # back to top frame
1104
+ ```
1105
+
1106
+ Refs are cleared on switch (the iframe has its own AX tree).
1107
+
1108
+ ### State save/load
1109
+
1110
+ ```bash
1111
+ $B state save my-session # save cookies + URLs to .istm-workflow/browse-state-my-session.json
1112
+ $B state load my-session # restore
1113
+ ```
1114
+
1115
+ In-memory `load-html` content is intentionally NOT persisted (avoid leaking
1116
+ secrets to disk).
1117
+
1118
+ Manual save/load is one-shot. For state that survives daemon restarts
1119
+ automatically, opt in with `BROWSE_PERSIST_STATE=1` in the daemon's
1120
+ environment: the headless daemon snapshots cookies + per-tab
1121
+ URL/localStorage/sessionStorage to `<stateDir>/session-state.json` (0600,
1122
+ atomic writes) every 30 seconds and at clean shutdown, then restores it off
1123
+ the boot path on the next launch. Default OFF — cookies on disk are a real
1124
+ cost, so the user opts in. Headless only (headed mode's persistent Chromium
1125
+ profile already owns its state). Loaded HTML and tab ownership are never
1126
+ persisted, cookies for localhost, `.internal`, loopback IP literals
1127
+ (127.0.0.0/8, `::1`), and link-local/cloud-metadata addresses
1128
+ (169.254.0.0/16) are dropped on restore, and a corrupt snapshot is quarantined to
1129
+ `session-state.json.corrupt` so persistence can never block a launch.
1130
+
1131
+ ### Watch
1132
+
1133
+ ```bash
1134
+ $B watch # passive observation: snapshot every 5s while user browses
1135
+ $B watch stop # return summary of what changed
1136
+ ```
1137
+
1138
+ Useful when you're driving the browser manually and want Claude to see what
1139
+ you did at the end without spamming `snapshot` calls.
1140
+
1141
+ ### Inbox
1142
+
1143
+ ```bash
1144
+ $B inbox # list messages from sidebar scout
1145
+ $B inbox --clear # clear after reading
1146
+ ```
1147
+
1148
+ The sidebar scout (a background process the Chrome extension can spawn) drops
1149
+ notes for Claude when the user surfaces something they want noticed. Stored
1150
+ in `.istm-workflow/browser-scout.jsonl`.
1151
+
1152
+ ---
1153
+
1154
+ ## CDP
1155
+
1156
+ ### `$B cdp` — raw Chrome DevTools Protocol dispatch
1157
+
1158
+ Deny-default. Only methods enumerated in `browse/src/cdp-allowlist.ts`
1159
+ (`CDP_ALLOWLIST` const) are reachable; any other method returns 403. Each
1160
+ allowlist entry declares scope (tab vs browser) and output (trusted vs
1161
+ untrusted). Untrusted methods (data-exfil-shaped, e.g.
1162
+ `Network.getResponseBody`) get UNTRUSTED-envelope wrapped output.
1163
+
1164
+ ```bash
1165
+ $B cdp Page.getLayoutMetrics
1166
+ $B cdp Network.enable
1167
+ $B cdp Accessibility.getFullAXTree '{"depth":5}'
1168
+
1169
+ # Perf measurement on a simulated low-end client (overrides persist on the
1170
+ # tab until you clear them — callers own restoration):
1171
+ $B cdp Emulation.setCPUThrottlingRate '{"rate":4}' # clear: '{"rate":1}'
1172
+ $B cdp Network.emulateNetworkConditions '{"offline":false,"latency":150,"downloadThroughput":195000,"uploadThroughput":97500}'
1173
+ # clear: '{"offline":false,"latency":0,"downloadThroughput":-1,"uploadThroughput":-1}'
1174
+ ```
1175
+
1176
+ To discover allowed methods: read `browse/src/cdp-allowlist.ts`.
1177
+
1178
+ ### `$B inspect` — CDP-based CSS inspector
1179
+
1180
+ ```bash
1181
+ $B inspect ".header" # full rule cascade for the header
1182
+ $B inspect ".header" --all # include user-agent rules
1183
+ $B inspect ".header" --history # show modification history
1184
+ ```
1185
+
1186
+ Returns the matched rule cascade with specificity, computed styles, the box
1187
+ model, and (with `--history`) every CSS modification made via `$B style` since
1188
+ the page loaded. Powered by a persistent CDP session per page in
1189
+ `browse/src/cdp-inspector.ts`.
1190
+
1191
+ ### `$B ux-audit`
1192
+
1193
+ ```bash
1194
+ $B ux-audit
1195
+ ```
1196
+
1197
+ Returns JSON with site identity, navigation, headings (capped 50), text
1198
+ blocks, interactive elements (capped 200) — page structure for behavioral
1199
+ analysis without dumping the full HTML. Used by `/qa` and `/design-review`
1200
+ for cheap coverage maps.
1201
+
1202
+ ---
1203
+
1204
+ ## Performance
1205
+
1206
+ | Tool | First call | Subsequent calls | Context overhead per call |
1207
+ |------|-----------|------------------|---------------------------|
1208
+ | Chrome MCP | ~5s | ~2-5s | ~2000 tokens (schema + protocol) |
1209
+ | Playwright MCP | ~3s | ~1-3s | ~1500 tokens (schema + protocol) |
1210
+ | **istm-workflow browse** | **~3s** | **~100-200ms** | **0 tokens** (plain text stdout) |
1211
+ | **istm-workflow browse + codified skill** | **~3s** | **~200ms** | **0 tokens** (single skill invocation) |
1212
+
1213
+ In a 20-command browser session, MCP tools burn 30,000–40,000 tokens on
1214
+ protocol framing alone. istm-workflow burns zero. The codified-skill path takes a
1215
+ 20-command session down to a single `$B skill run` call.
1216
+
1217
+ ### Why CLI over MCP
1218
+
1219
+ MCP works well for remote services. For local browser automation it adds
1220
+ pure overhead:
1221
+
1222
+ - **Context bloat** — every MCP call includes full JSON schemas. A simple
1223
+ "get the page text" costs 10x more context tokens than it should.
1224
+ - **Connection fragility** — persistent WebSocket/stdio connections drop
1225
+ and fail to reconnect.
1226
+ - **Unnecessary abstraction** — Claude already has a Bash tool. A CLI that
1227
+ prints to stdout is the simplest possible interface.
1228
+
1229
+ istm-workflow skips all of this. Compiled binary. Plain text in, plain text out.
1230
+ No protocol. No schema. No connection management.
1231
+
1232
+ ---
1233
+
1234
+ ## Multi-workspace
1235
+
1236
+ Each project root (detected via `git rev-parse --show-toplevel`) gets its
1237
+ own daemon, port, state file, cookies, and logs. No cross-workspace
1238
+ collisions.
1239
+
1240
+ | Workspace | State file | Port |
1241
+ |-----------|-----------|------|
1242
+ | `/code/project-a` | `/code/project-a/.istm-workflow/browse.json` | random (10000–49151) |
1243
+ | `/code/project-b` | `/code/project-b/.istm-workflow/browse.json` | random (10000–49151) |
1244
+
1245
+ Browser-skills three-tier lookup walks project → global → bundled, so a
1246
+ project-tier skill at `/code/project-a/.istm-workflow/browser-skills/foo/` shadows
1247
+ the global `~/.istm-workflow/browser-skills/foo/` only inside project-a.
1248
+
1249
+ ---
1250
+
1251
+ ## Environment variables
1252
+
1253
+ | Variable | Default | Description |
1254
+ |----------|---------|-------------|
1255
+ | `BROWSE_PORT` | 0 (random 10000–49151) | Fixed port for the HTTP server (debug override) |
1256
+ | `BROWSE_IDLE_TIMEOUT` | 1800000 (30 min) | Idle shutdown timeout in ms |
1257
+ | `BROWSE_STATE_FILE` | `.istm-workflow/browse.json` | Path to state file |
1258
+ | `BROWSE_SERVER_SCRIPT` | auto-detected | Path to `server.ts` |
1259
+ | `BROWSE_CDP_URL` | (none) | Set to `channel:chrome` for real-browser mode |
1260
+ | `BROWSE_CDP_PORT` | 0 | CDP port (used internally) |
1261
+ | `BROWSE_HEADLESS_SKIP` | 0 | Skip Chromium launch entirely (test harness only) |
1262
+ | `BROWSE_TUNNEL` | 0 | Activate the dual-listener tunnel architecture (requires `NGROK_AUTHTOKEN`) |
1263
+ | `BROWSE_TUNNEL_LOCAL_ONLY` | 0 | Test-only — bind both listeners locally without ngrok |
1264
+ | `istm_BROWSE_MAX_HTML_BYTES` | 52428800 (50MB) | `load-html` size cap |
1265
+ | `istm_SECURITY_OFF` | unset | Emergency kill switch — disable ML classifier |
1266
+ | `istm_STEALTH` | unset | Set to `extended` (also accepts `1`/`true`) to layer six aggressive patches (WebGL spoof, faked plugins, mediaDevices) on top of Layer C. Actively lies; can break sites. |
1267
+ | `istm_CDP_STEALTH` | unset | Set to `on`/`1`/`true` to emit `--istm-workflow-suppress-prepare-stack-trace` (gbrowser Pack 2 / B11 C++ patch only; no-op on stock Chromium) |
1268
+ | `istm_GPU_VENDOR`, `istm_GPU_RENDERER`, `istm_GPU_CHIPSET` | unset | Per-install GPU spoof fed to the Pack 1 WebGL/UA-CH C++ patches. Set by gbd from the host profile; emitted as `--istm-workflow-gpu-vendor` / `--istm-workflow-gpu-renderer` / `--istm-workflow-ua-model` cmdline switches only when present. |
1269
+ | `istm_PLATFORM` | unset | Host platform classification (`MacARM`/`MacIntel` → `macOS`, `Win32` → `Windows`, `Linux*` → `Linux`) emitted as `--istm-workflow-ua-platform` |
1270
+ | `istm_HW_CONCURRENCY`, `istm_DEVICE_MEMORY` | host profile (fallback 8) | Per-install `hardwareConcurrency`/`deviceMemory` reported by Layer C and emitted as `--istm-workflow-hw-concurrency` / `--istm-workflow-device-memory` for the worker-navigator C++ patch |
1271
+
1272
+ ---
1273
+
1274
+ ## Source map
1275
+
1276
+ ```
1277
+ browse/
1278
+ ├── src/
1279
+ │ ├── cli.ts # Thin client — reads state, sends HTTP, prints
1280
+ │ ├── server.ts # Bun HTTP daemon — routes commands, dual-listener
1281
+ │ ├── browser-manager.ts # Chromium lifecycle, tabs, ref map, crash detection
1282
+ │ ├── port-allocator.ts # Fixed 10000-49151 scan range for every long-lived listener (never port:0)
1283
+ │ ├── xprotect-heal.ts # macOS XProtect launch-kill classify + quarantine-clear + bounded reinstall
1284
+ │ ├── socks-bridge.ts # Local 127.0.0.1 SOCKS5 bridge that handles auth handshakes Chromium can't speak
1285
+ │ ├── proxy-config.ts # --proxy URL parsing + cred resolution (URL vs env, fail-fast on both)
1286
+ │ ├── proxy-redact.ts # Cred-redaction helper for any proxy URL surfaced to logs/errors
1287
+ │ ├── xvfb.ts # Xvfb auto-spawn + orphan cleanup with PID + start-time validation
1288
+ │ ├── stealth.ts # Layer C: webdriver mask + window.chrome.* + Notification/Permissions + per-install hardware + toString proxy + automation-global sweep; buildistmLaunchArgs (istm_* cmdline switches); istm_STEALTH=extended opt-in
1289
+ │ ├── browse-client.ts # Canonical SDK — what skills import as _lib/browse-client.ts
1290
+ │ ├── snapshot.ts # AX tree → @e/@c refs → Locator map; -D/-a/-C handling
1291
+ │ ├── read-commands.ts # Non-mutating: text, html, links, js, css, is, dialog, ...
1292
+ │ ├── write-commands.ts # Mutating: goto, click, fill, upload, dialog-accept, ...
1293
+ │ ├── meta-commands.ts # state, watch, inbox, frame, ux-audit, chain, diff, ...
1294
+ │ ├── browser-skills.ts # 3-tier walk + frontmatter parser + tombstones
1295
+ │ ├── browser-skill-commands.ts # $B skill list/show/run/test/rm + spawnSkill
1296
+ │ ├── browser-skill-write.ts # D3 atomic stage/commit/discard helper for /skillify
1297
+ │ ├── skill-token.ts # mintSkillToken / revokeSkillToken (per-spawn, scoped)
1298
+ │ ├── domain-skills.ts # Per-site agent notes (state machine: quarantined→active→global)
1299
+ │ ├── domain-skill-commands.ts # $B domain-skill save/list/show/edit/promote/rollback/rm
1300
+ │ ├── cdp-allowlist.ts # Deny-default CDP method allowlist
1301
+ │ ├── cdp-bridge.ts # CDP session lifecycle bridge
1302
+ │ ├── cdp-commands.ts # $B cdp dispatcher
1303
+ │ ├── cdp-inspector.ts # $B inspect — persistent CDP session per page
1304
+ │ ├── activity.ts # ActivityEntry, CircularBuffer, SSE subscribers, privacy filtering
1305
+ │ ├── buffers.ts # Console/network/dialog circular buffers (O(1) ring)
1306
+ │ ├── tab-session.ts # Per-tab session state (load-html replay, ref map scope)
1307
+ │ ├── token-registry.ts # Mint/validate/revoke for root + setup keys + scoped tokens
1308
+ │ ├── sse-session-cookie.ts # 30-min HttpOnly cookie for /activity/stream + /inspector/events
1309
+ │ ├── pty-session-cookie.ts # Separate scope: live Claude PTY auth
1310
+ │ ├── tunnel-denial-log.ts # ~/.istm-workflow/security/attempts.jsonl writer (salted)
1311
+ │ ├── path-security.ts # validateOutputPath / validateReadPath / validateTempPath
1312
+ │ ├── url-validation.ts # URL safety checks for goto
1313
+ │ ├── content-security.ts # L1-L3: datamarking, hidden strip, ARIA, URL blocklist, envelopes
1314
+ │ ├── security.ts # L5 canary + L6 verdict combiner + thresholds
1315
+ │ ├── security-classifier.ts # L4 ML classifier (TestSavantAI, runs in the security sidecar)
1316
+ │ ├── security-sidecar-entry.ts # Sidecar subprocess entrypoint hosting the ONNX classifier
1317
+ │ ├── security-sidecar-client.ts # server.ts-side client that drives the sidecar
1318
+ │ ├── terminal-agent.ts # Side Panel Claude PTY manager (auth + lifecycle)
1319
+ │ ├── sidebar-utils.ts # Sidebar URL sanitization + helpers
1320
+ │ ├── cookie-import-browser.ts # Decrypt + import cookies from real Chromium browsers
1321
+ │ ├── cookie-picker-routes.ts # HTTP routes for /cookie-picker/*
1322
+ │ ├── cookie-picker-ui.ts # Self-contained HTML/CSS/JS for cookie picker
1323
+ │ ├── network-capture.ts # Network request capture for $B network
1324
+ │ ├── media-extract.ts # Media element extraction for $B media
1325
+ │ ├── project-slug.ts # Project slug derivation for state paths
1326
+ │ ├── error-handling.ts # safeUnlink / safeKill / isProcessAlive
1327
+ │ ├── platform.ts # OS detection (macOS, Linux, Windows)
1328
+ │ ├── telemetry.ts # Anonymous opt-in usage telemetry
1329
+ │ ├── find-browse.ts # Locate running daemon or bootstrap
1330
+ │ └── config.ts # Config resolution (env / files)
1331
+ ├── test/ # Integration tests + HTML fixtures
1332
+ └── dist/
1333
+ └── browse # Compiled binary (~58MB, Bun --compile)
1334
+
1335
+ browser-skills/
1336
+ └── hackernews-frontpage/ # Bundled reference skill
1337
+ ├── SKILL.md
1338
+ ├── script.ts
1339
+ ├── _lib/browse-client.ts
1340
+ ├── fixtures/hn-2026-04-26.html
1341
+ └── script.test.ts
1342
+
1343
+ scrape/SKILL.md.tmpl # /scrape istm-workflow skill — match-or-prototype entry point
1344
+ skillify/SKILL.md.tmpl # /skillify istm-workflow skill — codify last /scrape into permanent skill
1345
+ ```
1346
+
1347
+ ---
1348
+
1349
+ ## Development
1350
+
1351
+ ### Prerequisites
1352
+
1353
+ - [Bun](https://bun.sh/) v1.0+
1354
+ - Playwright's Chromium (installed automatically by `bun install`)
1355
+
1356
+ ### Quick start
1357
+
1358
+ ```bash
1359
+ bun install # install deps + Playwright Chromium
1360
+ bun test # all integration tests (~3s for browse-only)
1361
+ bun run dev <cmd> # run CLI from source (no compile)
1362
+ bun run build # compile to browse/dist/browse
1363
+ ```
1364
+
1365
+ ### Dev mode vs compiled binary
1366
+
1367
+ During development, use `bun run dev` instead of the compiled binary. It runs
1368
+ `browse/src/cli.ts` directly with Bun, so you get instant feedback:
1369
+
1370
+ ```bash
1371
+ bun run dev goto https://example.com
1372
+ bun run dev text
1373
+ bun run dev snapshot -i
1374
+ bun run dev click @e3
1375
+ ```
1376
+
1377
+ The compiled binary (`bun run build`) is only needed for distribution. It
1378
+ produces a single ~58MB executable at `browse/dist/browse` using Bun's
1379
+ `--compile` flag.
1380
+
1381
+ ### Running tests
1382
+
1383
+ ```bash
1384
+ bun test # all tests
1385
+ bun test browse/test/commands # command integration tests
1386
+ bun test browse/test/snapshot # snapshot tests
1387
+ bun test browse/test/cookie-import-browser # cookie import unit tests
1388
+ bun test browse/test/browser-skill-write # D3 atomic-write helper tests
1389
+ bun test browse/test/tunnel-gate-unit # canDispatchOverTunnel pure tests
1390
+ ```
1391
+
1392
+ Tests spin up a local HTTP server (`browse/test/test-server.ts`) serving HTML
1393
+ fixtures from `browse/test/fixtures/`, then exercise the CLI against those
1394
+ pages.
1395
+
1396
+ ### Adding a new command
1397
+
1398
+ 1. Add the handler in `read-commands.ts` (non-mutating) or `write-commands.ts`
1399
+ (mutating), or `meta-commands.ts` (server / lifecycle).
1400
+ 2. Register the route in `server.ts`.
1401
+ 3. Add the entry to `COMMAND_DESCRIPTIONS` in `browse/src/commands.ts` (with
1402
+ a clear `description` and `usage` — the `gen-skill-docs` validation
1403
+ suite enforces no `|` characters in `description`).
1404
+ 4. Add a test case in `browse/test/commands.test.ts` with an HTML fixture
1405
+ if needed.
1406
+ 5. Run `bun test` to verify.
1407
+ 6. Run `bun run build` to compile.
1408
+ 7. Run `bun run gen:skill-docs` to regenerate SKILL.md (the command appears
1409
+ in the command-reference table downstream).
1410
+
1411
+ ### Adding a new browser-skill
1412
+
1413
+ For a hand-written skill: copy `browser-skills/hackernews-frontpage/`,
1414
+ update SKILL.md frontmatter, rewrite `script.ts` against your target site,
1415
+ re-capture the fixture, update the parser test. `bun test` validates the
1416
+ SKILL.md contract (sibling SDK byte-identity, frontmatter schema).
1417
+
1418
+ For an agent-written skill: drive the page once with `/scrape <intent>`,
1419
+ say `/skillify`, accept the proposed name in the approval gate. The skill
1420
+ lands at `~/.istm-workflow/browser-skills/<name>/` after the test passes.
1421
+
1422
+ ### Deploying to the active skill
1423
+
1424
+ The active skill lives at `~/.claude/skills/istm-workflow/`. After making changes:
1425
+
1426
+ ```bash
1427
+ cd ~/.claude/skills/istm-workflow
1428
+ git fetch origin && git reset --hard origin/main
1429
+ bun run build
1430
+ ```
1431
+
1432
+ Or copy the binary directly:
1433
+
1434
+ ```bash
1435
+ cp browse/dist/browse ~/.claude/skills/istm-workflow/browse/dist/browse
1436
+ ```
1437
+
1438
+ ---
1439
+
1440
+ ## Cross-references
1441
+
1442
+ - [`ARCHITECTURE.md`](ARCHITECTURE.md) — system-level architecture, dual-listener tunnel design, prompt-injection defense threat model
1443
+ - [`CLAUDE.md`](CLAUDE.md) — project-level instructions, sidebar architecture notes, security-stack constraints
1444
+ - [`docs/REMOTE_BROWSER_ACCESS.md`](docs/REMOTE_BROWSER_ACCESS.md) — operator guide for `/pair-agent` (setup keys, scoped tokens, denial log)
1445
+ - [`docs/designs/BROWSER_SKILLS_V1.md`](docs/designs/BROWSER_SKILLS_V1.md) — design doc for browser-skills runtime (Phase 1 + 2a + roadmap)
1446
+ - [`scrape/SKILL.md`](scrape/SKILL.md) — `/scrape` skill: match-or-prototype data extraction
1447
+ - [`skillify/SKILL.md`](skillify/SKILL.md) — `/skillify` skill: codify last `/scrape` into permanent skill
1448
+ - [`TODOS.md`](TODOS.md) — `/automate` (Phase 2b P0), Phase 3 resolver injection, Phase 4 eval + sandbox
1449
+
1450
+ ---
1451
+
1452
+ ## Acknowledgments
1453
+
1454
+ The browser automation layer is built on [Playwright](https://playwright.dev/)
1455
+ by Microsoft. Playwright's accessibility tree API, locator system, and
1456
+ headless Chromium management are what make ref-based interaction possible.
1457
+ The snapshot system — assigning `@ref` labels to AX tree nodes and mapping
1458
+ them back to Playwright Locators — is built entirely on top of Playwright's
1459
+ primitives. Thank you to the Playwright team for building such a solid
1460
+ foundation.
1461
+
1462
+ The prompt-injection L4 layer uses
1463
+ [TestSavantAI/distilbert-v1.1-32](https://huggingface.co/TestSavantAI/distilbert-v1.1-32)
1464
+ (112MB ONNX), run locally via `@huggingface/transformers`.
1465
+
1466
+ The CDP escape hatch is gated by an allowlist directly inspired by Codex's
1467
+ T2 outside-voice review during the v1.4 design pass: deny-default with an
1468
+ explicit allowlist, not allow-default with a denylist.