explorbot 0.2.3 → 0.2.5

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 (174) hide show
  1. package/README.md +1 -1
  2. package/bin/explorbot-cli.ts +26 -8
  3. package/boat/api-tester/src/cli.ts +17 -0
  4. package/boat/api-tester/src/config.ts +4 -2
  5. package/boat/doc-collector/bin/doc-collector-cli.ts +2 -0
  6. package/boat/doc-collector/src/ai/documentarian.ts +61 -31
  7. package/boat/doc-collector/src/cli.ts +14 -1
  8. package/boat/doc-collector/src/config.ts +4 -2
  9. package/boat/prima/bin/prima-cli.ts +0 -0
  10. package/boat/prima/src/activity-line.ts +33 -0
  11. package/boat/prima/src/cli.ts +127 -86
  12. package/boat/prima/src/envelope.ts +102 -52
  13. package/boat/prima/src/prima.ts +567 -128
  14. package/boat/prima/src/pw-parser.ts +11 -1
  15. package/boat/prima/src/pw-registry.ts +4 -5
  16. package/boat/prima/src/session-log.ts +126 -0
  17. package/dist/bin/explorbot-cli.js +26 -8
  18. package/dist/boat/api-tester/bin/apibot-cli.js +2 -0
  19. package/dist/boat/api-tester/src/cli.js +17 -0
  20. package/dist/boat/api-tester/src/config.js +4 -2
  21. package/dist/boat/doc-collector/bin/doc-collector-cli.js +2 -0
  22. package/dist/boat/doc-collector/src/ai/documentarian.js +44 -19
  23. package/dist/boat/doc-collector/src/cli.js +14 -1
  24. package/dist/boat/doc-collector/src/config.js +4 -2
  25. package/dist/boat/prima/src/activity-line.js +30 -0
  26. package/dist/boat/prima/src/cli.js +109 -77
  27. package/dist/boat/prima/src/envelope.js +94 -44
  28. package/dist/boat/prima/src/prima.js +533 -119
  29. package/dist/boat/prima/src/pw-parser.js +13 -1
  30. package/dist/boat/prima/src/pw-registry.js +4 -5
  31. package/dist/boat/prima/src/session-log.js +108 -0
  32. package/dist/package.json +3 -2
  33. package/dist/rules/navigator/verification-actions.md +20 -0
  34. package/dist/src/action-result.d.ts +7 -0
  35. package/dist/src/action-result.js +4 -0
  36. package/dist/src/action.d.ts +2 -0
  37. package/dist/src/action.js +41 -2
  38. package/dist/src/ai/captain/web-mode.js +6 -3
  39. package/dist/src/ai/captain.js +2 -0
  40. package/dist/src/ai/navigator.d.ts +34 -0
  41. package/dist/src/ai/navigator.js +237 -181
  42. package/dist/src/ai/pilot.d.ts +7 -0
  43. package/dist/src/ai/pilot.js +90 -2
  44. package/dist/src/ai/provider.d.ts +2 -2
  45. package/dist/src/ai/provider.js +14 -23
  46. package/dist/src/ai/rerunner.js +2 -1
  47. package/dist/src/ai/researcher/cache.d.ts +2 -0
  48. package/dist/src/ai/researcher/cache.js +10 -2
  49. package/dist/src/ai/researcher.js +3 -2
  50. package/dist/src/ai/rules.js +17 -10
  51. package/dist/src/ai/session-analyst.js +2 -0
  52. package/dist/src/ai/task-agent.js +4 -1
  53. package/dist/src/ai/tester.d.ts +6 -3
  54. package/dist/src/ai/tester.js +50 -46
  55. package/dist/src/ai/tools.d.ts +14 -0
  56. package/dist/src/ai/tools.js +117 -37
  57. package/dist/src/commands/config-command.d.ts +51 -0
  58. package/dist/src/commands/config-command.js +117 -0
  59. package/dist/src/commands/index.js +2 -0
  60. package/dist/src/config.d.ts +9 -1
  61. package/dist/src/config.js +53 -4
  62. package/dist/src/execution-controller.d.ts +2 -0
  63. package/dist/src/execution-controller.js +6 -0
  64. package/dist/src/explorbot.d.ts +2 -1
  65. package/dist/src/explorbot.js +7 -2
  66. package/dist/src/explorer.js +2 -3
  67. package/dist/src/playwright-recorder.js +30 -0
  68. package/dist/src/remote.d.ts +55 -0
  69. package/dist/src/remote.js +235 -0
  70. package/dist/src/reporter.d.ts +1 -0
  71. package/dist/src/reporter.js +7 -1
  72. package/dist/src/state-manager.d.ts +2 -1
  73. package/dist/src/state-manager.js +3 -1
  74. package/dist/src/stats.d.ts +1 -0
  75. package/dist/src/stats.js +1 -0
  76. package/dist/src/test-plan.d.ts +3 -0
  77. package/dist/src/test-plan.js +26 -0
  78. package/dist/src/utils/aria.d.ts +2 -8
  79. package/dist/src/utils/aria.js +69 -40
  80. package/dist/src/utils/html.js +1 -0
  81. package/dist/src/utils/logger.d.ts +7 -1
  82. package/dist/src/utils/logger.js +32 -0
  83. package/dist/src/utils/page-readiness.js +18 -1
  84. package/dist/src/utils/url-matcher.js +3 -0
  85. package/dist/src/utils/web-element.d.ts +2 -0
  86. package/dist/src/utils/web-element.js +8 -0
  87. package/dist/src/utils/web-sandbox.d.ts +1 -1
  88. package/dist/src/utils/web-sandbox.js +2 -3
  89. package/docs/api-testing/basics.md +90 -0
  90. package/docs/api-testing/planning.md +57 -0
  91. package/docs/api-testing/running-tests.md +55 -0
  92. package/docs/assets/cloud-report.png +0 -0
  93. package/docs/assets/html-report.png +0 -0
  94. package/docs/assets/langfuse-trace.png +0 -0
  95. package/docs/assets/successful-explore-run.png +0 -0
  96. package/docs/basics/getting-started.md +140 -0
  97. package/docs/basics/prerequisites.md +63 -0
  98. package/docs/basics/providers.md +362 -0
  99. package/docs/basics/running.md +78 -0
  100. package/docs/contributing/ai-integration-tests.md +57 -0
  101. package/docs/contributing/contributing.md +90 -0
  102. package/docs/contributing/demo-videos.md +36 -0
  103. package/docs/contributing/npm-package.md +138 -0
  104. package/docs/contributing/observability.md +227 -0
  105. package/docs/contributing/regression-tests.md +103 -0
  106. package/docs/contributing/testing.md +95 -0
  107. package/docs/doc-collection/basics.md +128 -0
  108. package/docs/doc-collection/crawling.md +67 -0
  109. package/docs/doc-collection/interactive-mode.md +99 -0
  110. package/docs/index.json +87 -0
  111. package/docs/reference/commands.md +997 -0
  112. package/docs/reference/configuration.md +569 -0
  113. package/docs/reference/scripting.md +303 -0
  114. package/docs/reference/websocket.md +50 -0
  115. package/docs/superpowers/plans/2026-08-01-actor-boat.md +925 -0
  116. package/docs/superpowers/plans/2026-08-01-prima-boat.md +1120 -0
  117. package/docs/superpowers/reviews/2026-08-06-prima-vs-playwright-cli.md +268 -0
  118. package/docs/superpowers/specs/2026-08-01-actor-boat-design.md +204 -0
  119. package/docs/superpowers/specs/2026-08-01-prima-boat-design.md +242 -0
  120. package/docs/superpowers/specs/2026-08-03-global-config-design.md +138 -0
  121. package/docs/superpowers/specs/2026-08-07-prima-fixes-design.md +394 -0
  122. package/docs/superpowers/specs/2026-08-18-prima-false-verdicts.md +159 -0
  123. package/docs/web-testing/agents.md +158 -0
  124. package/docs/web-testing/automated-tests.md +134 -0
  125. package/docs/web-testing/basics.md +91 -0
  126. package/docs/web-testing/customization.md +131 -0
  127. package/docs/web-testing/hooks.md +238 -0
  128. package/docs/web-testing/page-interaction.md +84 -0
  129. package/docs/web-testing/planner.md +122 -0
  130. package/docs/web-testing/rerun.md +164 -0
  131. package/docs/web-testing/researcher.md +380 -0
  132. package/docs/workflow/agentic-usage.md +233 -0
  133. package/docs/workflow/application-spec.md +73 -0
  134. package/docs/workflow/ci.md +202 -0
  135. package/docs/workflow/knowledge.md +310 -0
  136. package/docs/workflow/planning-styles.md +67 -0
  137. package/docs/workflow/reporting.md +133 -0
  138. package/docs/workflow/test-plans.md +90 -0
  139. package/package.json +3 -2
  140. package/rules/navigator/verification-actions.md +20 -0
  141. package/src/action-result.ts +11 -0
  142. package/src/action.ts +43 -3
  143. package/src/ai/captain/web-mode.ts +6 -3
  144. package/src/ai/captain.ts +3 -0
  145. package/src/ai/navigator.ts +255 -186
  146. package/src/ai/pilot.ts +104 -2
  147. package/src/ai/provider.ts +14 -24
  148. package/src/ai/rerunner.ts +2 -1
  149. package/src/ai/researcher/cache.ts +12 -2
  150. package/src/ai/researcher.ts +3 -2
  151. package/src/ai/rules.ts +17 -10
  152. package/src/ai/session-analyst.ts +2 -0
  153. package/src/ai/task-agent.ts +3 -1
  154. package/src/ai/tester.ts +52 -45
  155. package/src/ai/tools.ts +136 -37
  156. package/src/commands/config-command.ts +146 -0
  157. package/src/commands/index.ts +2 -0
  158. package/src/config.ts +60 -5
  159. package/src/execution-controller.ts +8 -0
  160. package/src/explorbot.ts +7 -3
  161. package/src/explorer.ts +2 -2
  162. package/src/playwright-recorder.ts +23 -0
  163. package/src/remote.ts +244 -0
  164. package/src/reporter.ts +7 -1
  165. package/src/state-manager.ts +6 -2
  166. package/src/stats.ts +1 -0
  167. package/src/test-plan.ts +29 -0
  168. package/src/utils/aria.ts +65 -45
  169. package/src/utils/html.ts +1 -0
  170. package/src/utils/logger.ts +33 -2
  171. package/src/utils/page-readiness.ts +24 -1
  172. package/src/utils/url-matcher.ts +3 -0
  173. package/src/utils/web-element.ts +9 -0
  174. package/src/utils/web-sandbox.ts +3 -4
@@ -0,0 +1,997 @@
1
+ # Terminal Commands Reference
2
+
3
+ Explorbot runs the same commands two ways: from your shell (CLI) and inside an interactive session (TUI).
4
+
5
+ - **CLI** — run from your shell. Each command launches a browser, runs the task, prints output, and exits `0` on success or `1` on failure. Use it for CI, scripting, and chaining commands.
6
+ - **TUI** — the interactive terminal UI from `npx explorbot start`. The same commands run as slash commands against a long-lived browser.
7
+
8
+ Both share the same code, so behavior and options match.
9
+
10
+ ## Most used commands
11
+
12
+ | Goal | Command |
13
+ |------|---------|
14
+ | Start an interactive session | `npx explorbot start /path` |
15
+ | Explore a feature end to end | `npx explorbot explore /path --focus "feature"` |
16
+ | Analyze a page without running tests | `npx explorbot research /path` |
17
+ | Create a focused test plan | `npx explorbot plan /path --focus "user goal and boundaries"` |
18
+ | Run a saved plan | `npx explorbot test output/plans/plan.md` |
19
+ | List generated runnable tests | `npx explorbot runs` |
20
+ | Re-run generated tests with healing | `npx explorbot rerun output/tests/suite.js --session` |
21
+ | Teach Explorbot an app-specific fact | `npx explorbot learn /path "note"` |
22
+
23
+ Inside the TUI, use the matching slash command: `/explore`, `/research`, `/plan`, `/test`, `/runs`, or `/rerun`.
24
+
25
+ ## Command Reference
26
+
27
+ | Capability | CLI | TUI | Notes |
28
+ |---|---|---|---|
29
+ | Start interactive session | `npx explorbot start [path]` | — | Boots the TUI |
30
+ | Autonomous exploration | `npx explorbot explore <path>` | `/explore [focus]` | Full research → plan → test cycle |
31
+ | Continuous exploration | `npx explorbot freesail [url]` | `/freesail` | Explore page after page until stopped |
32
+ | Research a page | `npx explorbot research <url>` | `/research [url]` | UI analysis only |
33
+ | Generate test plan | `npx explorbot plan <path>` | `/plan [--focus <feature>]` | Writes plan markdown |
34
+ | List saved plans | `npx explorbot plans [plan]` | `/plans [plan]` | Show plans and their tests |
35
+ | Navigate to a URL | `npx explorbot navigate <url>` | `/navigate <target>` | Reachability probe + session capture |
36
+ | Drill page components | `npx explorbot drill <url>` | `/drill [--knowledge <path>] [--max-components <n>]` | Learn interactions |
37
+ | Execute plan tests | `npx explorbot test <planfile> [index]` | `/test [scenario\|number\|*]` | Run scenarios |
38
+ | Re-run generated tests | `npx explorbot rerun <file> [index]` | `/rerun <file> [index]` | With AI auto-healing |
39
+ | List generated tests | `npx explorbot runs [file]` | `/runs [file]` | Index + dry-run |
40
+ | Store domain knowledge | `npx explorbot learn [url] [note]` | `/learn [note]` | Persisted to `knowledge/` |
41
+ | Show stored knowledge | `npx explorbot knows [url]` | `/knows [url]` | List all or match a URL |
42
+ | List stored experience | `npx explorbot experience [filter]` | `/experience [filter]` | Grouped by URL |
43
+ | Compact experience files | `npx explorbot compact [target]` | `/compact [target]` | AI compression |
44
+ | Print page context | `npx explorbot context <url>` | `/context` | Knowledge, experience, elements |
45
+ | Execute CodeceptJS command | `npx explorbot shell <url> <command>` | `I.click(...)` etc. inline | One-shot vs interactive |
46
+ | Load saved plan | `npx explorbot plan:load <file> [index]` | `/plan:load <file>` | Preview a plan |
47
+ | Collect documentation | `npx explorbot docs collect <path-or-url>` | — | See [doc-collector](../doc-collection/basics.md) |
48
+ | Drive an already-open browser | `npx explorbot prima <command>` | — | One command per process, see [Prima boat](#prima-boat) |
49
+ | Extract built-in rules | `npx explorbot extract-rules <agent>` | — | Customizable rules to `rules/` |
50
+ | Create a rule file | `npx explorbot add-rule [agent] [name]` | `/add-rule [agent] [name]` | Writes `rules/<agent>/<name>.md` |
51
+ | Manage persistent browser | `npx explorbot browser {start\|stop\|status}` | — | Share browser across runs |
52
+ | Initialize project | `npx explorbot init` | — | Generates `explorbot.config.*`, or `~/.explorbot` with `--global` |
53
+ | List registered sites | `npx explorbot sites` | — | Sites stored in the global installation |
54
+ | Show resolved configuration | `npx explorbot config [url] [--json]` | `/config` | Models, config file, paths and `EXPLORBOT_*` in effect |
55
+ | Clean generated files | `npx explorbot clean [target]` | `/clean [target]` | Same targets both ways |
56
+
57
+ ## Common CLI Options
58
+
59
+ Every CLI command that drives a browser accepts these options (`start`, `explore`, `freesail`, `plan`, `navigate`, `drill`, `research`, `test`, `rerun`, `shell`, `docs collect`):
60
+
61
+ | Option | Description |
62
+ |--------|-------------|
63
+ | `-v, --verbose` | Enable verbose logging |
64
+ | `--debug` | Enable debug logging (same as `--verbose`) |
65
+ | `-c, --config <path>` | Path to configuration file |
66
+ | `-p, --path <path>` | Working directory path |
67
+ | `-s, --show` | Show browser window |
68
+ | `--headless` | Run browser in headless mode |
69
+ | `--incognito` | Run without recording experiences |
70
+ | `--session [file]` | Save/restore browser session (cookies, localStorage) from file |
71
+
72
+ ### `--session`
73
+
74
+ Saves browser state (cookies, localStorage, sessionStorage) to a JSON file. The next run restores the session, so you skip login and setup steps.
75
+
76
+ ```bash
77
+ npx explorbot start /login --session # default output/session.json
78
+ npx explorbot start /dashboard --session auth.json # custom session file
79
+ npx explorbot navigate /login --session # probe + capture auth in one shot
80
+ npx explorbot research /dashboard --session auth.json # reuse captured auth
81
+ ```
82
+
83
+ Without a file path, the flag defaults to `session.json` inside the resolved configuration's output directory. In config-free mode that is the site folder `~/.explorbot/sites/<host>/output/`, or whatever `EXPLORBOT_OUTPUT` points at.
84
+
85
+ ## Environment Variables
86
+
87
+ Every command accepts `EXPLORBOT_*` variables in place of a config file. Set `EXPLORBOT_AI_PROVIDER` and Explorbot builds its configuration from the environment when no `explorbot.config.*` is found:
88
+
89
+ ```bash
90
+ EXPLORBOT_URL=https://app.example.com \
91
+ EXPLORBOT_AI_PROVIDER=openrouter \
92
+ npx explorbot explore /login --max-tests 3
93
+ ```
94
+
95
+ <!-- START env -->
96
+ | Variable | Meaning |
97
+ |---|---|
98
+ | `EXPLORBOT_AI_PROVIDER` | Provider name; fills every model role from its recommended models. Turns on config-free mode |
99
+ | `EXPLORBOT_AI_MODEL` | Pins the main model — a model id for the provider, or a standalone provider/model-id |
100
+ | `EXPLORBOT_URL` | Base URL to test; the API boat reads it as the base endpoint |
101
+ | `EXPLORBOT_VISION_MODEL` | Screenshot analysis; overrides the provider recommendation |
102
+ | `EXPLORBOT_AGENTIC_MODEL` | Captain and Pilot decisions; overrides the provider recommendation |
103
+ | `EXPLORBOT_OUTPUT` | Output root for states, plans, research, and reports. Defaults to the site dir under ~/.explorbot/sites |
104
+ | `EXPLORBOT_EPHEMERAL` | Keep no state between runs — output goes to a fresh temp directory instead of the site dir |
105
+ | `EXPLORBOT_KNOWLEDGE` | Inline knowledge text, applied to every page |
106
+ | `EXPLORBOT_KNOWLEDGE_FILE` | Path to a knowledge markdown file |
107
+ | `EXPLORBOT_API_SPEC` | OpenAPI spec path for the API boat |
108
+ | `EXPLORBOT_NO_BANNER` | Suppress the startup banner, for machine-readable output |
109
+ <!-- END env -->
110
+
111
+ `npx explorbot config` prints the values a run actually uses — models per role, the config file behind them, the output, knowledge and experience directories, and every `EXPLORBOT_*` variable currently set. The boats answer for their own configuration the same way: `npx explorbot api config`, `npx explorbot docs config`, `npx explorbot prima config`. Add `--json` on any of them to get the same values as an object a script can read.
112
+
113
+ Explorbot resolves its configuration in this order: the path given to `--config`, then `explorbot.config.*` in the working directory, then the `EXPLORBOT_*` variables, and finally `~/.explorbot/config.*` from the global installation. A bare provider name fills every model role from the recommendations in [Providers](../basics/providers.md); a `provider/model-id` spec pins one model and splits on the first slash, so `openrouter/openai/gpt-oss-120b:nitro` selects OpenRouter with model `openai/gpt-oss-120b:nitro`. Supported providers: `openai`, `anthropic`, `google`, `groq`, `mistral`, `openrouter`, `sambanova`.
114
+
115
+ In this mode output goes to `~/.explorbot/sites/<host>/output/` (or `EXPLORBOT_OUTPUT`, or a temp directory with `EXPLORBOT_EPHEMERAL=1`), experience is kept beside it unless the run is ephemeral, and the Historian is off, so no generated test files appear. See [Agentic Usage](../workflow/agentic-usage.md) for the full picture.
116
+
117
+ ## Persistent Browser
118
+
119
+ By default, every CLI command that needs a browser (`start`, `explore`, `plan`, `navigate`, `drill`, `research`, `context`) starts a fresh Chromium process and shuts it down when done. That is slow when you restart explorbot often during development.
120
+
121
+ Run `npx explorbot browser` to keep a browser server alive across sessions. Commands that need a browser detect the running server and connect to it instead of starting a new one.
122
+
123
+ ### `npx explorbot browser start`
124
+
125
+ Start a persistent browser server. The process runs until you press Ctrl+C.
126
+
127
+ ```bash
128
+ npx explorbot browser start # headless (default)
129
+ npx explorbot browser start --show # headed — see the browser window
130
+ npx explorbot browser start --headless # explicitly headless
131
+ ```
132
+
133
+ The WebSocket endpoint is written to `output/.browser-endpoint` so other commands can find it.
134
+
135
+ ### `npx explorbot browser stop`
136
+
137
+ Stop a running browser server and delete the endpoint file.
138
+
139
+ ```bash
140
+ npx explorbot browser stop
141
+ ```
142
+
143
+ ### `npx explorbot browser status`
144
+
145
+ Check whether a persistent browser server is running.
146
+
147
+ ```bash
148
+ npx explorbot browser status
149
+ ```
150
+
151
+ ### Workflow
152
+
153
+ ```bash
154
+ # Terminal 1: start persistent browser
155
+ npx explorbot browser start --show
156
+
157
+ # Terminal 2: run commands — they reuse the same browser
158
+ npx explorbot navigate /login --session
159
+ npx explorbot research /login
160
+ npx explorbot plan /login --focus authentication
161
+ npx explorbot start /dashboard
162
+
163
+ # Each command connects to the running browser instead of launching a new one.
164
+ # When explorbot exits, the browser stays open for the next run.
165
+
166
+ # When done, stop the browser
167
+ npx explorbot browser stop
168
+ ```
169
+
170
+ | Option | Description |
171
+ |--------|-------------|
172
+ | `-s, --show` | Launch browser in headed mode (visible window) |
173
+ | `--headless` | Launch browser in headless mode |
174
+ | `-c, --config <path>` | Path to configuration file |
175
+ | `-p, --path <path>` | Working directory path |
176
+
177
+ ## Navigation
178
+
179
+ ### navigate
180
+
181
+ Drive the AI Navigator to a URL. The Navigator handles redirects, login walls, and recoverable errors. It does more than call `I.amOnPage`.
182
+
183
+ ```bash
184
+ # CLI — exits 0 if reachable, 1 otherwise
185
+ npx explorbot navigate /settings
186
+ npx explorbot navigate /login --session # capture session into output/session.json
187
+ npx explorbot navigate /dashboard --session auth.json
188
+ ```
189
+
190
+ ```
191
+ # TUI
192
+ /navigate /settings
193
+ /navigate login page
194
+ /navigate back to dashboard
195
+ ```
196
+
197
+ **CLI exit code:** `0` when the Navigator confirms it reached the page, `1` when navigation failed (unreachable URL, unresolved redirect, connection refused, and so on).
198
+
199
+ **Session capture:** combine with `--session` to capture an authenticated session for downstream agents. A typical CI pattern:
200
+
201
+ ```bash
202
+ # 1. Establish authenticated session, fail fast if the app is down
203
+ npx explorbot navigate /login --session ./auth.json || exit 1
204
+
205
+ # 2. Reuse the captured session in subsequent commands
206
+ npx explorbot research /dashboard --session ./auth.json
207
+ npx explorbot explore /reports --session ./auth.json --max-tests 10
208
+ ```
209
+
210
+ The TUI form accepts looser targets, such as state descriptions like "back to dashboard". The CLI form expects a URL or path.
211
+
212
+ ## Exploration
213
+
214
+ ### explore
215
+
216
+ Run a full exploration cycle: research → plan → test.
217
+
218
+ ```bash
219
+ # CLI
220
+ npx explorbot explore /dashboard
221
+ npx explorbot explore /checkout --max-tests 10 --focus checkout
222
+ ```
223
+
224
+ ```
225
+ # TUI
226
+ /explore
227
+ /explore checkout
228
+ ```
229
+
230
+ The CLI form navigates to `<path>` first. The TUI form always runs on the current page — positional arguments become the focus feature (same as `--focus`), not a URL. When the cycle finishes in the TUI, run `/navigate` or `/explore` again to continue.
231
+
232
+ #### Options
233
+
234
+ | Option | Description |
235
+ |---|---|
236
+ | `--max-tests <n>` | Hard cap on tests executed in this run. Sub-page expansion stops once the cap is hit. |
237
+ | `--focus <feature>` | Narrow planning to a single feature area (e.g. `--focus checkout`). The focus also becomes part of the saved plan filename. |
238
+ | `--configure <spec>` | Reuse a saved plan, mix old + new tests, filter by style/priority, control sub-page behavior. See below. |
239
+ | `--dry-run` | Mark every picked test as `skipped` instead of executing. New-test planning still runs (so you can preview what would be picked) but no AI tester actions and no plan-file writes. |
240
+
241
+ #### `--configure <spec>` — reuse, ratio, filters
242
+
243
+ Pass one string of pairs separated by `;`. Write each pair as `key:value` or `key=value`. Whitespace is allowed.
244
+
245
+ | Key | Values | Default | Effect |
246
+ |---|---|---|---|
247
+ | `new` | `0%`–`100%` (or `0`–`1.0`) | `100%` | Share of `--max-tests` reserved for newly planned tests. The remainder is filled from old tests. **Setting `new` < 100% enables reuse.** |
248
+ | `from` | path to a plan `.md` file | auto-lookup | Explicit plan source. **Also enables reuse.** When omitted, looks for `output/plans/<auto-named>.md` matching the current URL + focus. |
249
+ | `style` | comma list (e.g. `normal,curious`) | all styles | Filters new generation to these planning styles AND filters old picks to tests tagged with one of these styles. (Old tests with no style metadata are kept either way.) |
250
+ | `priority` | comma list of `critical,important,high,normal,low` | all priorities | Filters BOTH old picks AND newly-planned tests to the listed priorities. Generated tests outside the list are dropped. |
251
+ | `pick_by` | `priority` \| `random` \| `index` | `priority` | Order in which old tests are picked (and executed). `priority`: critical → low. `random`: shuffled. `index`: file order. |
252
+ | `subpages` | `none` \| `same` \| `new` \| `both` | `both` | Sub-page behavior in reuse mode. `same`: re-plan only sub-pages already in the loaded plan. `new`: only discover sub-pages not in the plan. `both`: both. `none`: skip sub-page expansion. |
253
+
254
+ Reuse is off unless `--configure` sets `new` or `from`. Without them, `npx explorbot explore` plans fresh every time.
255
+
256
+ If you request reuse but the lookup file is missing, explorbot logs a warning and falls back to fresh planning.
257
+
258
+ #### Examples
259
+
260
+ **Re-run a saved plan as-is** (no AI generation, just the saved scenarios):
261
+
262
+ ```bash
263
+ npx explorbot explore /checkout --max-tests 10 --configure="new:0%"
264
+ ```
265
+
266
+ **Mix 75% old + 25% new** — top-priority old tests fill 7 slots, planner fills the remaining 3 with fresh ideas (deduped against the loaded plan):
267
+
268
+ ```bash
269
+ npx explorbot explore /checkout --max-tests 10 --configure="new:25%"
270
+ ```
271
+
272
+ **Random sample of high-priority old tests + half new:**
273
+
274
+ ```bash
275
+ npx explorbot explore /dashboard --max-tests 8 \
276
+ --configure="new:50%;priority=critical,high;pick_by=random"
277
+ ```
278
+
279
+ **Preview without spending tester time** — see exactly which old + new tests would run, all marked `skipped`:
280
+
281
+ ```bash
282
+ npx explorbot explore /dashboard --max-tests 10 --configure="new:25%" --dry-run
283
+ ```
284
+
285
+ **Use a specific plan file from a previous branch:**
286
+
287
+ ```bash
288
+ npx explorbot explore /reports \
289
+ --configure="from=output/plans/reports_v2.md;new:0%"
290
+ ```
291
+
292
+ **Skip sub-page expansion** — only the main page is replanned:
293
+
294
+ ```bash
295
+ npx explorbot explore /admin --max-tests 5 --configure="new:25%;subpages=none"
296
+ ```
297
+
298
+ **Filter to one planning style only** (no reuse — just narrows generation):
299
+
300
+ ```bash
301
+ npx explorbot explore /admin --configure="style=curious"
302
+ ```
303
+
304
+ **Reuse + restrict to chaos-style tests in the plan + pick a random batch:**
305
+
306
+ ```bash
307
+ npx explorbot explore /admin --max-tests 6 \
308
+ --configure="new:0%;style=psycho;pick_by=random"
309
+ ```
310
+
311
+ #### How picking interacts with the budget
312
+
313
+ With `--max-tests N` and `new:R%`:
314
+
315
+ - `oldQuota = N − round(N × R)` — number of old tests selected from the loaded plan
316
+ - `newQuota = round(N × R)` — slots reserved for the planner
317
+
318
+ Selection order for old tests:
319
+
320
+ 1. Drop old tests not matching `style=` (if set)
321
+ 2. Drop old tests not matching `priority=` (if set)
322
+ 3. Order the survivors by `pick_by` (`priority` is the default)
323
+ 4. Take the first `oldQuota`; mark the rest `enabled = false` so they don't run
324
+
325
+ For new tests, the planner generates freely. The loaded plan is registered for scenario-level dedup, so the planner won't propose duplicates. Any test whose priority falls outside `priority=` is dropped before execution. Without `--max-tests`, both quotas are unbounded.
326
+
327
+ #### See also
328
+
329
+ - [Test Plans](../workflow/test-plans.md) — markdown format for saved plans
330
+ - [Planner](../web-testing/planner.md) — how new test scenarios are generated
331
+
332
+ ### freesail
333
+
334
+ Explore continuously: run the explore cycle on a page, then let the agent pick the next page and repeat until stopped or `--max-tests` is reached.
335
+
336
+ ```bash
337
+ # CLI
338
+ npx explorbot freesail # starts from /
339
+ npx explorbot freesail /dashboard --scope /app --max-tests 20
340
+ ```
341
+
342
+ ```
343
+ # TUI
344
+ /freesail
345
+ /freesail --deep
346
+ ```
347
+
348
+ | Option | Description |
349
+ |---|---|
350
+ | `--deep` | Depth-first: prioritize newly discovered pages |
351
+ | `--shallow` | Breadth-first: pick the globally least-visited page |
352
+ | `--scope <prefix>` | Restrict navigation to URLs starting with this prefix |
353
+ | `--max-tests <n>` | Maximum number of tests to run |
354
+
355
+ ### research
356
+
357
+ Analyze a page using the Researcher agent.
358
+
359
+ ```bash
360
+ # CLI
361
+ npx explorbot research /settings
362
+ npx explorbot research /dashboard --data --deep
363
+ ```
364
+
365
+ ```
366
+ # TUI
367
+ /research
368
+ /research /settings
369
+ /research --data
370
+ ```
371
+
372
+ With a URL, explorbot navigates there first.
373
+
374
+ | Option | Description |
375
+ |---|---|
376
+ | `--data` | Extract structured data from the page |
377
+ | `--deep` | Enable deep analysis (expand hidden elements) |
378
+ | `--no-fix` | Skip locator fix cycle (for debugging) |
379
+
380
+ ### plan
381
+
382
+ Generate test scenarios using the Planner agent.
383
+
384
+ ```bash
385
+ # CLI
386
+ npx explorbot plan /login
387
+ npx explorbot plan /login --focus authentication
388
+ npx explorbot plan /checkout --append --style curious
389
+ ```
390
+
391
+ ```
392
+ # TUI
393
+ /plan
394
+ /plan --focus login
395
+ /plan --focus "checkout flow"
396
+ ```
397
+
398
+ The `--focus` flag narrows generated tests to one feature area.
399
+
400
+ | Option | Description |
401
+ |---|---|
402
+ | `-a, --append` | Add tests to existing plan file |
403
+ | `--style <name>` | Planning style: `normal`, `curious`, `psycho` |
404
+ | `--focus <feature>` | Focus area for test planning |
405
+
406
+ ### test
407
+
408
+ Execute test scenarios using the Tester agent.
409
+
410
+ ```bash
411
+ # CLI
412
+ npx explorbot test output/plans/login.md # run all enabled tests
413
+ npx explorbot test output/plans/login.md 3 # run test #3
414
+ npx explorbot test output/plans/login.md 1-5 # range
415
+ npx explorbot test output/plans/login.md 1,3,7 # selection
416
+ npx explorbot test output/plans/login.md --grep authentication
417
+ npx explorbot test 3 --from-plan output/plans/login.md # index first, plan via option
418
+ ```
419
+
420
+ ```
421
+ # TUI
422
+ /test # Run next pending test
423
+ /test * # Run all pending tests
424
+ /test 2 # Run test #2 from plan
425
+ /test login # Run tests matching "login"
426
+ /test User can logout successfully # Create and run ad-hoc test
427
+ ```
428
+
429
+ | Option | Description |
430
+ |---|---|
431
+ | `--grep <pattern>` | Run only tests whose scenario matches the pattern |
432
+ | `--from-plan <file>` | Load this plan file when the first argument is a test index |
433
+
434
+ ### drill
435
+
436
+ Drill all components on a page to learn interactions.
437
+
438
+ ```bash
439
+ # CLI
440
+ npx explorbot drill /components
441
+ npx explorbot drill /components --max-components 10
442
+ npx explorbot drill /login --knowledge /login
443
+ ```
444
+
445
+ ```
446
+ # TUI
447
+ /drill
448
+ /drill --knowledge /login --max-components 10
449
+ ```
450
+
451
+ | Option | Description |
452
+ |---|---|
453
+ | `--knowledge <path>` | Save learned interactions to a knowledge file at this URL path |
454
+ | `--max-components <count>` | Maximum number of components to drill |
455
+
456
+ ## Test Rerun
457
+
458
+ ### runs
459
+
460
+ List generated test files or dry-run a specific file to preview steps.
461
+
462
+ ```bash
463
+ # CLI
464
+ npx explorbot runs
465
+ npx explorbot runs output/tests/suite.js
466
+ ```
467
+
468
+ ```
469
+ # TUI
470
+ /runs
471
+ /runs output/tests/suite.js
472
+ ```
473
+
474
+ Each test is numbered, so you can reference it with `rerun`.
475
+
476
+ ### rerun
477
+
478
+ Re-run generated tests with AI auto-healing. When a step fails, the Rerunner agent diagnoses the problem and runs a fix.
479
+
480
+ ```bash
481
+ # CLI
482
+ npx explorbot rerun output/tests/suite.js
483
+ npx explorbot rerun output/tests/suite.js 3
484
+ npx explorbot rerun output/tests/suite.js 1-5
485
+ npx explorbot rerun output/tests/suite.js 1,3,7
486
+ npx explorbot rerun output/tests/suite.js --session
487
+ ```
488
+
489
+ ```
490
+ # TUI
491
+ /rerun output/tests/suite.js
492
+ /rerun output/tests/suite.js 3
493
+ /rerun output/tests/suite.js 1-5
494
+ /rerun output/tests/suite.js 1,3,7
495
+ ```
496
+
497
+ Tests without assertions (`I.see`, `I.seeElement`, and so on) are skipped.
498
+
499
+ See [Rerunning Tests](../web-testing/rerun.md) for the full workflow and healing configuration.
500
+
501
+ ## Knowledge Management
502
+
503
+ ### knows
504
+
505
+ List all knowledge or show matching knowledge for a URL.
506
+
507
+ ```bash
508
+ # CLI
509
+ npx explorbot knows
510
+ npx explorbot knows /login
511
+ ```
512
+
513
+ ```
514
+ # TUI
515
+ /knows
516
+ /knows /login
517
+ ```
518
+
519
+ ### learn
520
+
521
+ Store knowledge about the current page for future reference.
522
+
523
+ ```bash
524
+ # CLI
525
+ npx explorbot learn # interactive mode
526
+ npx explorbot learn /login "Use admin credentials"
527
+ ```
528
+
529
+ ```
530
+ # TUI
531
+ /learn
532
+ /learn Test user credentials: test@example.com / test123
533
+ ```
534
+
535
+ Without arguments, `learn` opens an interactive editor. Knowledge is saved to `./knowledge/` and used by agents during exploration.
536
+
537
+ ## Experience Management
538
+
539
+ ### experience
540
+
541
+ List stored experiences grouped by URL. Pass a URL substring to filter, or a section ref (like `A.1`) to expand one section.
542
+
543
+ ```bash
544
+ # CLI
545
+ npx explorbot experience
546
+ npx explorbot experience /login
547
+ npx explorbot experience A.1
548
+ ```
549
+
550
+ ```
551
+ # TUI
552
+ /experience
553
+ /experience /login
554
+ ```
555
+
556
+ | Option | Description |
557
+ |---|---|
558
+ | `--recent` | Only files modified within the last 30 days |
559
+ | `--old` | Only files modified more than 30 days ago |
560
+
561
+ ### compact
562
+
563
+ Compress stored experience files with the ExperienceCompactor agent. Pass a filename or URL substring to limit scope.
564
+
565
+ ```bash
566
+ # CLI
567
+ npx explorbot compact
568
+ npx explorbot compact /login
569
+ npx explorbot compact --dry-run
570
+ ```
571
+
572
+ ```
573
+ # TUI
574
+ /compact
575
+ ```
576
+
577
+ | Option | Description |
578
+ |---|---|
579
+ | `--dry-run` | Preview without running AI or writing files |
580
+ | `--no-merge` | Skip the cross-URL merge step when compacting all |
581
+
582
+ ## Documentation Collection (CLI only)
583
+
584
+ ### `npx explorbot docs collect <path-or-url>`
585
+
586
+ Crawl pages and generate a documentation spec with `Purpose`, `User Can`, and `User Might` sections for each documented page.
587
+
588
+ ```bash
589
+ npx explorbot docs collect /users/sign_in
590
+ npx explorbot docs collect /docs/openapi#tag/project-analytics-tags --max-pages 20
591
+ npx explorbot docs collect https://teleportal.ua/ua/serials/stb/kod --path explorbot-testing --show --session --max-pages 20
592
+ ```
593
+
594
+ Output is written to:
595
+
596
+ - `output/docs/spec.md`
597
+ - `output/docs/pages/*.md`
598
+
599
+ Use `docbot.config.*` to set crawl scope, path filters, dynamic-page collapsing, and low-signal page skipping.
600
+
601
+ See [Documentation Collection](../doc-collection/basics.md) for full configuration, crawl modes, and examples.
602
+
603
+ ### `npx explorbot docs init`
604
+
605
+ Create a starter `docbot.config.ts` file.
606
+
607
+ ```bash
608
+ npx explorbot docs init
609
+ npx explorbot docs init --path explorbot-testing
610
+ ```
611
+
612
+ ## Prima boat
613
+
614
+ Prima drives a browser that is already open, one command per process. Every page command prints a plain-text envelope on stdout and exits `0` when the envelope says `ok: true`, `1` when it does not — so a coding agent can act on the result without parsing JSON. The `browser` commands print a status line instead.
615
+
616
+ Run it as `npx explorbot prima <command>` or through the standalone `prima` bin.
617
+
618
+ | Command | Purpose |
619
+ |---|---|
620
+ | `prima check <scenario>` | Run a scenario end to end as a test, verify it, and report the steps it took |
621
+ | `prima do <instructions...>` | Run high-level instructions tester-style, one argument per instruction |
622
+ | `prima pw <fn>` | Run a Playwright function expression against the open page |
623
+ | `prima ask <question>` | Answer a question about the current page |
624
+ | `prima verify <assertion>` | Assert a statement about the current page (alias: `assert`) |
625
+ | `prima research` | Map the current page and return verified locators |
626
+ | `prima go <target>` | Navigate to a url, a path, or a page described in plain words |
627
+ | `prima status <hash>` | Show the artifacts and page detail recorded for an earlier command |
628
+ | `prima report` | Turn every command of a session into one html and markdown report |
629
+ | `prima config` | Show the AI models prima runs on and the config file they come from |
630
+ | `prima browser {start\|stop\|status\|list}` | Manage the browsers prima drives |
631
+
632
+ ### Choosing a command
633
+
634
+ Start at the top and come down only when the tier above cannot hold the work.
635
+
636
+ - **`check`** takes an outcome rather than a click path, works out how to reach it, verifies it itself, and reports every step with its proof.
637
+ - **`do`** takes several described instructions and runs them tester-style in one process.
638
+ - **`pw`** is precise: a function expression built from a locator you already verified. No AI on the happy path, so it also works when no model is configured.
639
+
640
+ Never pass a locator or a function expression to `check` or `do` — describe the target. Never pass a description to `pw` — it takes executable code only.
641
+
642
+ Pass `do` the whole remaining sequence rather than one instruction per call. Every command is a process of its own, so a sequence split across calls pays the startup and page-capture cost each time. `check` and `do` legitimately run for minutes.
643
+
644
+ ### `check`, `do`, and `verify` in detail
645
+
646
+ `check` takes `--expected <outcome>`, repeatable for several; without it the scenario text is the single expected outcome. Each comes back under `### Expected outcomes` as `PASSED`, `FAILED` or `not verified` — "not verified" means the run never checked it, which is not the same as false. Page problems seen along the way appear under `### Answer` rather than as step failures.
647
+
648
+ ```bash
649
+ prima check "signup rejects a duplicate email" \
650
+ --expected "an error names the email as taken" \
651
+ --expected "no second account is created"
652
+ ```
653
+
654
+ `do` numbers every instruction and accounts for it: `### Steps` reports each as `ok` or `FAIL` with what proved it, and one that could not be carried out fails the command. Nothing runs past the last instruction given.
655
+
656
+ `verify` lists every assertion it could express as `PASSED` or `FAILED` with its Playwright form, and gives no overall verdict — read the lines and decide. `none ran` means the claim could not be expressed at all, which is not the same as false.
657
+
658
+ ### The envelope
659
+
660
+ ```
661
+ ### Result
662
+ ok: true
663
+ command: pw ({ page }) => page.click('[data-test=submit]')
664
+ used: ({ page }) => page.click('[data-test=submit]')
665
+
666
+ ### Page
667
+ url: /orders/4821 (changed: /orders/new → /orders/4821)
668
+ title: Order 4821 - Widget Depot
669
+ state: orders_4821_h1_order_placed (visit #1)
670
+
671
+ ### Changes
672
+ ariaDiff:
673
+ added:
674
+ - heading "Order placed" [level=1]
675
+ removed:
676
+ - button "Submit"
677
+
678
+ ### Instance
679
+ default (1 tab) | attached to playwright-cli session "default" | details: prima status 7f3a91
680
+
681
+ ### Artifacts
682
+ aria: /home/you/.explorbot/sites/app.example.com/output/prima/2026-08-04T10-04-22-285Z/aria.yml
683
+ html: /home/you/.explorbot/sites/app.example.com/output/prima/2026-08-04T10-04-22-285Z/page.html
684
+ ```
685
+
686
+ `used:` is code that already executed: for `go` the CodeceptJS step it ran, for `pw` the Playwright expression you passed, which a CodeceptJS test needs wrapped in `I.usePlaywrightTo(...)`. Log lines can precede the envelope, so start parsing at the first `###` line.
687
+
688
+ `### Changes` renders on every action envelope, saying `no change` when the tree is identical — so a successful command proves what it did instead of leaving you to check. `check` and `do` report per step rather than in aggregate: `### Steps` names each step with the code it ran and what proved it, and `page after each step:` points at the captures. `check` adds `### Expected outcomes`; `ask`, `research`, and `verify` add `### Answer`, `### Research`, or `### Assertions`; `pw` adds `### Value` when its expression returns one. `network:` appears under `### Artifacts` only when requests were captured, and everything else recorded for a command is behind `prima status <hash>`.
689
+
690
+ **A failed action is a failure.** Nothing is retried along a different route and no other element is substituted, so `ok: true` means the action you asked for is the one that landed. A failure adds `### Failure` with the error and the compact ARIA of the page, so you can retarget from the envelope itself instead of opening the artifact files.
691
+
692
+ ### Browsers and sessions
693
+
694
+ Prima never launches a browser implicitly. Open one first:
695
+
696
+ ```bash
697
+ playwright-cli open https://app.example.com # the session prima attaches to by default
698
+ npx explorbot prima browser start # a prima-owned browser instead
699
+ ```
700
+
701
+ By default prima attaches to the playwright-cli browser of the current workspace and works on the tabs it already has open — driving the same session from both tools is the intended usage. Stopping prima disconnects from an attached browser; it never closes it. `prima browser list` shows both kinds of browser, and the `### Instance` block names the one you are on.
702
+
703
+ Prima reaches every browser over a Playwright browser-server endpoint — a playwright-cli session, an `--endpoint`, or a `prima browser start` instance — and that client needs the Node build, which is what `npx explorbot prima` and the published `prima` bin run on. Driving a browser by running the CLI from source under Bun does not connect.
704
+
705
+ Every command takes these:
706
+
707
+ | Option | Description |
708
+ |---|---|
709
+ | `--pw-session <title>` | Which playwright-cli session, when several are open for the workspace |
710
+ | `--endpoint <ep>` | Attach to a browser server endpoint directly, skipping discovery |
711
+ | `-i, --instance <name>` | Which prima-owned browser to talk to; parallel work needs one each |
712
+ | `--session [file]` | Cookies and storage persisted across processes; ignored while attached, since the attached session keeps its own |
713
+ | `--url <url>` | Page to open when the session has no page yet |
714
+ | `--ephemeral` | Keep no state between runs. Applies to config-free runs only — with a config file the output directory comes from the config |
715
+ | `--framework <name>` | Parsed but not active yet; reported code is CodeceptJS whatever you pass |
716
+ | `-c, --config <path>`, `-p, --path <path>` | As on every other Explorbot command |
717
+
718
+ `--instance` and `--session` answer different questions: `--instance` picks *which browser process* prima drives, `--session` decides *whose cookies* it starts from.
719
+
720
+ A few commands add their own:
721
+
722
+ | Command | Option | Description |
723
+ |---|---|---|
724
+ | `check` | `--expected <outcome>` | An outcome the run must reach; repeat the flag for several |
725
+ | `ask` | `--no-vision` | Answer from page structure only, without a screenshot |
726
+ | `research` | `--data` | Include data extraction in the map |
727
+ | `research` | `--deep` | Expand hidden elements for a deeper map |
728
+ | `research` | `--fresh` | Ignore the cached map and research the page again |
729
+ | `browser start` | `-s, --show` / `--headless` | Launch the browser with or without a window |
730
+ | `browser stop` | `--all` | Stop every running instance |
731
+
732
+ Prima carries no logging flags of its own. `DEBUG` in front of a command prints everything the run does — config and browser attachment, every step as it executes, and the debug stream of the agents behind it:
733
+
734
+ ```bash
735
+ DEBUG='explorbot:*' prima do "open the account menu" "switch the theme to dark"
736
+ ```
737
+
738
+ Without it, a running command writes its current activity to stderr as a single line that each new activity overwrites, erased before the envelope is printed. Piped or captured output is unaffected.
739
+
740
+ ### Session reports
741
+
742
+ Every command is logged to `output/prima/sessions/` as it runs, so `prima report` needs no browser and outlives the session:
743
+
744
+ ```bash
745
+ prima report # the session used most recently
746
+ prima report --pw-session my-app # a named playwright-cli session
747
+ ```
748
+
749
+ It writes one html and one markdown report — each command with its steps, expected outcomes and the proof recorded for them. The log is written in the format the Testomat.io reporter replays, so the same file can be sent as a run:
750
+
751
+ ```bash
752
+ TESTOMATIO=<apiKey> npx @testomatio/reporter replay <the path prima report prints>
753
+ ```
754
+
755
+ ### Without a config file
756
+
757
+ Prima follows the same [configuration ladder](#environment-variables) as every other command, so a provider name in the environment is enough:
758
+
759
+ ```bash
760
+ EXPLORBOT_AI_PROVIDER=groq npx explorbot prima go https://app.example.com
761
+ ```
762
+
763
+ `pw` still works when no model is usable at all; commands that need one say so and point at the fallback.
764
+
765
+ ## Plan Management
766
+
767
+ ### plans
768
+
769
+ List saved plans, or show the tests of one plan.
770
+
771
+ ```bash
772
+ # CLI
773
+ npx explorbot plans
774
+ npx explorbot plans output/plans/checkout.md
775
+ ```
776
+
777
+ ```
778
+ # TUI
779
+ /plans
780
+ /plans checkout
781
+ ```
782
+
783
+ ### `/plan:save [filename]`
784
+
785
+ Save the current plan to a file.
786
+
787
+ ```
788
+ /plan:save
789
+ /plan:save my-checkout-tests
790
+ ```
791
+
792
+ Plans are saved to the `output/plans/` directory.
793
+
794
+ ### `/plan:load <filename>`
795
+
796
+ Load a previously saved plan.
797
+
798
+ ```
799
+ /plan:load output/plans/checkout-plan.md
800
+ ```
801
+
802
+ The CLI form `npx explorbot plan:load <file> [index]` previews a plan file from the shell. Pass an index to see details for one test.
803
+
804
+ ### `/plan:reload [feature]`
805
+
806
+ Clear the current plan and regenerate it with the Planner. Pass a feature to change the focus; otherwise the previous focus is reused.
807
+
808
+ ## Page Inspection (TUI)
809
+
810
+ ### `/context:aria`
811
+
812
+ Print the full ARIA accessibility snapshot of the current page.
813
+
814
+ ```
815
+ /context:aria
816
+ ```
817
+
818
+ Use it to debug element selectors and read the page structure.
819
+
820
+ ### `/context:html`
821
+
822
+ Print the combined HTML snapshot of the current page.
823
+
824
+ ```
825
+ /context:html
826
+ ```
827
+
828
+ Captures fresh page content when the stored snapshot is empty.
829
+
830
+ ### `/context:data`
831
+
832
+ Extract structured data (tables, lists) from the current page.
833
+
834
+ ```
835
+ /context:data
836
+ ```
837
+
838
+ AI finds and formats data on the page.
839
+
840
+ ### `/context`, `/context:knowledge`, `/context:experience`
841
+
842
+ Print the agent-facing context for the current page: combined snapshot, applicable knowledge, or stored experience.
843
+
844
+ The CLI counterpart is `npx explorbot context <url>` — see [below](#npx-explorbot-context-url).
845
+
846
+ ## Session Commands (TUI)
847
+
848
+ ### `/clean [target]`
849
+
850
+ Delete generated files from disk — same targets as the CLI `clean` command below.
851
+
852
+ ```
853
+ /clean
854
+ /clean plans
855
+ ```
856
+
857
+ Without a target, it cleans output artifacts and experience files.
858
+
859
+ ### `/exit`
860
+
861
+ Exit the application gracefully.
862
+
863
+ ```
864
+ /exit
865
+ /quit
866
+ ```
867
+
868
+ ## Other CLI Commands
869
+
870
+ ### `npx explorbot init`
871
+
872
+ Initialize configuration. In an interactive terminal, plain `init` first asks where it should go: **Local** writes `explorbot.config.js` in the current directory, **Global** sets up `~/.explorbot` so explorbot runs from anywhere. The Global option is disabled once a global config exists — reinstall with `--global --force`.
873
+
874
+ ```bash
875
+ npx explorbot init
876
+ npx explorbot init --config-path ./explorbot.config.js
877
+ npx explorbot init --force
878
+ ```
879
+
880
+ Passing `--config-path` or `--path` means local, and so does running outside a terminal (agents, CI): the chooser is skipped and the project config is written as before.
881
+
882
+ `--global` runs the global wizard instead — pick a provider, paste the API key, optionally check it with one test AI call. The wizard writes `~/.explorbot/config.js` with the recommended model ids of this Explorbot version and stores the key in `~/.explorbot/.env`.
883
+
884
+ ```bash
885
+ npx explorbot init --global
886
+ npx explorbot init --global --provider openrouter --api-key sk-... # no wizard
887
+ npx explorbot init --global --force # reinstall
888
+ ```
889
+
890
+ The global config holds models and keys, never a site: every command names the site it runs against.
891
+
892
+ | Option | Description |
893
+ |--------|-------------|
894
+ | `-c, --config-path <path>` | Path for the project config file |
895
+ | `-f, --force` | Overwrite an existing config file |
896
+ | `-p, --path <path>` | Working directory for initialization |
897
+ | `-g, --global` | Configure `~/.explorbot` to run from anywhere |
898
+ | `--provider <name>` | AI provider for the global config, skips the wizard |
899
+ | `--api-key <key>` | API key stored in `~/.explorbot/.env` |
900
+
901
+ See [Configuration](configuration.md#running-from-anywhere-the-global-installation) for the directory layout and how a site is resolved.
902
+
903
+ ### `npx explorbot sites`
904
+
905
+ List the sites registered in the global installation — folder name, base URL, and last run. Sites register themselves the first time you explore them by URL.
906
+
907
+ ```bash
908
+ npx explorbot sites
909
+ ```
910
+
911
+ ### `npx explorbot clean [target]`
912
+
913
+ Clean generated files. Targets: `states`, `research`, `plans`, `tests`, `experiences`, `output`.
914
+
915
+ ```bash
916
+ npx explorbot clean # output artifacts + experience files
917
+ npx explorbot clean experiences # only experience files
918
+ npx explorbot clean plans # only test plans
919
+ ```
920
+
921
+ Without a target, cleans everything under `output/` plus the `experience/` directory.
922
+
923
+ ### `npx explorbot shell <url> <command>`
924
+
925
+ Run a single CodeceptJS command on a page and exit. Use it for quick checks from a script.
926
+
927
+ ```bash
928
+ npx explorbot shell /login "I.see('Sign in')"
929
+ ```
930
+
931
+ ### `npx explorbot context <url>`
932
+
933
+ Print page context (URL, headings, knowledge, experience, interactive elements) for a URL and exit. It does not take the common browser flags — its options are:
934
+
935
+ ```bash
936
+ npx explorbot context /dashboard
937
+ npx explorbot context /dashboard --full --session auth.json
938
+ ```
939
+
940
+ | Option | Description |
941
+ |--------|-------------|
942
+ | `-p, --path <path>` | Working directory path |
943
+ | `-c, --config <path>` | Path to configuration file |
944
+ | `--session [file]` | Save/restore browser session from file |
945
+ | `--full` | Include HTML and all data |
946
+ | `--compact` | Compact view with summaries |
947
+ | `--attached` | Only auto-attached sections (default) |
948
+ | `--visual` | Annotate elements on screenshot and print screenshot path |
949
+ | `--screenshot` | Alias for `--visual` |
950
+
951
+ ### `npx explorbot extract-rules <agent>`
952
+
953
+ Extract an agent's built-in rules (including planning styles) to your `rules/` directory so you can customize them. Planning styles live under the `styles/` subdirectory and extract with the rest of the agent's rules.
954
+
955
+ ```bash
956
+ npx explorbot extract-rules planner # extracts to rules/planner/ (incl. styles/)
957
+ npx explorbot extract-rules chief # extracts to rules/chief/
958
+ npx explorbot extract-rules planner -d ./my-rules # custom directory
959
+ ```
960
+
961
+ After extraction, edit the markdown files to change how the agent behaves. See [Configuration: Rules](./configuration.md#rules) for details.
962
+
963
+ ### `npx explorbot add-rule [agent] [name]`
964
+
965
+ Create a rule file for an agent under `rules/<agent>/`. Without arguments, opens an interactive form. Also available in the TUI as `/add-rule [agent] [name]`.
966
+
967
+ ```bash
968
+ npx explorbot add-rule # interactive
969
+ npx explorbot add-rule tester wait-for-toasts
970
+ npx explorbot add-rule tester admin-creds --url "/admin/*"
971
+ ```
972
+
973
+ | Option | Description |
974
+ |--------|-------------|
975
+ | `--url <pattern>` | URL pattern for this rule |
976
+
977
+ ## Direct Browser Control (TUI)
978
+
979
+ Besides slash commands, you can run CodeceptJS commands directly in the TUI:
980
+
981
+ ```
982
+ I.amOnPage('/login')
983
+ I.click('Submit')
984
+ I.fillField('email', 'test@example.com')
985
+ I.see('Welcome')
986
+ I.waitForElement('.modal', 5)
987
+ ```
988
+
989
+ All [CodeceptJS Playwright helpers](https://codecept.io/helpers/Playwright/) are available. For a one-shot equivalent from the shell, use `npx explorbot shell <url> <command>`.
990
+
991
+ ## Keyboard Shortcuts (TUI)
992
+
993
+ | Key | Action |
994
+ |-----|--------|
995
+ | `ESC` | Enable input / cancel current action |
996
+ | `Ctrl+T` | Toggle session timer display |
997
+ | `Ctrl+C` | Exit application |