explorbot 0.2.3 → 0.2.4

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