@weavetab/skills 2.5.0 → 2.5.2

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 (63) hide show
  1. package/LICENSE +1 -1
  2. package/README.md +108 -108
  3. package/ROUTER.md +43 -43
  4. package/bin/cli.js +232 -232
  5. package/browser/dom-strategy.md +121 -119
  6. package/browser/form-automation.md +84 -87
  7. package/browser/interaction-pipeline.md +242 -216
  8. package/browser/tab-and-window.md +136 -136
  9. package/desktop/desktop-targeting.md +85 -85
  10. package/desktop/electron-discovery.md +115 -115
  11. package/developer/github-forensics.md +89 -74
  12. package/dist/bundled/weavetab-all.md +1885 -1709
  13. package/dist/bundled/weavetab-browser.md +526 -501
  14. package/dist/bundled/weavetab-desktop.md +176 -176
  15. package/dist/bundled/weavetab-developer.md +84 -67
  16. package/dist/bundled/weavetab-documents.md +184 -142
  17. package/dist/bundled/weavetab-memory.md +259 -233
  18. package/dist/bundled/weavetab-network-and-perf.md +250 -223
  19. package/dist/bundled/weavetab-plugins.md +88 -83
  20. package/dist/bundled/weavetab-resilience.md +244 -216
  21. package/dist/bundled/weavetab-security.md +93 -87
  22. package/dist/granular/browser_dom-strategy.md +121 -119
  23. package/dist/granular/browser_form-automation.md +84 -87
  24. package/dist/granular/browser_interaction-pipeline.md +242 -216
  25. package/dist/granular/browser_tab-and-window.md +136 -136
  26. package/dist/granular/desktop_desktop-targeting.md +85 -85
  27. package/dist/granular/desktop_electron-discovery.md +115 -115
  28. package/dist/granular/developer_github-forensics.md +89 -74
  29. package/dist/granular/documents_canvas-and-visual-capture.md +117 -103
  30. package/dist/granular/documents_office-document-ingestion.md +91 -63
  31. package/dist/granular/memory_selector-memory-system.md +127 -127
  32. package/dist/granular/memory_session-trail.md +111 -95
  33. package/dist/granular/memory_site-learning.md +62 -53
  34. package/dist/granular/network-and-perf_device-and-environment.md +100 -87
  35. package/dist/granular/network-and-perf_network-intercept-and-mock.md +97 -84
  36. package/dist/granular/network-and-perf_performance-and-vitals.md +86 -84
  37. package/dist/granular/plugins_hooks-and-overrides.md +40 -35
  38. package/dist/granular/plugins_plugin-runtime.md +63 -63
  39. package/dist/granular/resilience_loop-breaker.md +72 -67
  40. package/dist/granular/resilience_session-time-travel.md +146 -131
  41. package/dist/granular/resilience_stale-ref-recovery.md +61 -53
  42. package/dist/granular/security_rbac-and-policies.md +50 -47
  43. package/dist/granular/security_secret-containment-protocol.md +62 -59
  44. package/documents/canvas-and-visual-capture.md +117 -103
  45. package/documents/office-document-ingestion.md +91 -63
  46. package/evals/evaluator.js +146 -146
  47. package/evals/scenarios.json +239 -239
  48. package/memory/selector-memory-system.md +127 -127
  49. package/memory/session-trail.md +111 -95
  50. package/memory/site-learning.md +61 -52
  51. package/network-and-perf/device-and-environment.md +100 -87
  52. package/network-and-perf/network-intercept-and-mock.md +97 -84
  53. package/network-and-perf/performance-and-vitals.md +86 -84
  54. package/package.json +74 -73
  55. package/plugins/hooks-and-overrides.md +40 -35
  56. package/plugins/plugin-runtime.md +63 -63
  57. package/resilience/loop-breaker.md +72 -67
  58. package/resilience/session-time-travel.md +146 -131
  59. package/resilience/stale-ref-recovery.md +61 -53
  60. package/security/rbac-and-policies.md +50 -47
  61. package/security/secret-containment-protocol.md +62 -59
  62. package/skills.json +425 -426
  63. package/src/api.js +239 -239
@@ -1,204 +1,223 @@
1
1
  # Weavetab Domain Profile: MEMORY
2
2
 
3
- Generated for @weavetab/skills v2.5.0-beta.5
3
+ Generated for @weavetab/skills v2.5.2
4
4
 
5
5
 
6
6
  ## selector-memory-system
7
7
 
8
- # Two-Tier Memory System
9
-
10
- Weavetab operates a two-tier persistent memory system. Understanding both layers prevents wasted DOM traversals and makes agents dramatically faster across sessions.
11
-
12
- ---
13
-
14
- ## Tier 1 — Selector Confidence Cache (`~/.weavetab-system/memory/`)
15
-
16
- Per-domain JSON files (one per hostname) track individual element selectors and their interaction history.
17
-
18
- Every time an element is located and interacted with, Weavetab calculates a confidence score based on:
19
- 1. **Attribute Stability**: Prefers `data-testid`, `id`, `aria-label`, and semantic roles over dynamic Tailwind/CSS-module class strings.
20
- 2. **Success Count**: Selectors that successfully trigger navigation or state changes gain reinforcement.
21
- 3. **Origin Isolation**: Learned selectors are strictly namespaced to the origin to prevent cross-site contamination.
22
-
23
- ### Strike Degradation
24
- - **Strike 1**: Marked as degraded — falls back to secondary candidates or fuzzy label match.
25
- - **Strike 2**: Deprecated — immediate fallback to full DOM inspection via `browser_find` or `browser_map`.
26
- - **Strike 3**: Purged from memory cache to prevent stale lookups.
27
-
28
- ### Agent Discipline for Tier 1
29
- 1. **Rely on Native Tool Resolution**: When you pass a `ref`, Weavetab queries both the active volatile registry and the Tier 1 memory cache automatically.
30
- 2. **Don't Hardcode Fragile Selectors**: Never pass brittle absolute CSS paths like `div:nth-child(3) > ul > li:nth-child(2) > button`.
31
- 3. **Trust Heuristic Recovery**: If a button moves slightly on the page, the underlying engine re-anchors before reporting failure.
32
-
33
- ---
34
-
35
- ## Tier 2 — Site Profiles & Workflow Patterns (`~/.weavetab-system/memory/sites/`)
36
-
37
- One JSON file per origin stores named multi-step workflow patterns, site quirks, and reliability scores. This is the **Intelligent Memory** layer — agents learn entire flows, not just individual selectors.
38
-
39
- ### Checking a Site Profile at Session Start
40
- Always call `browser_pattern_learn` with `action: "get"` when starting an automation session on a site you may have visited before:
41
-
42
- ```json
43
- { "origin": "https://github.com" }
44
- ```
45
-
46
- Response tells you:
47
- - `known_patterns`: named flows with reliability scores and step counts
48
- - `quirks`: known cookie banners, rate limits, modal popups to handle automatically
49
- - `framework`: detected frontend stack
50
- - `_hint`: compact hint string summarizing everything
51
-
52
- ### Fast-Path Decision Rule
53
- | Reliability | Action |
54
- |---|---|
55
- | **≥ 0.8** | Use pattern steps directly via `browser_burst` — skip exploratory navigation |
56
- | **0.5 – 0.79** | Attempt pattern but verify success indicator before moving on |
57
- | **< 0.5 or strikes ≥ 3** | Ignore pattern, re-explore from scratch, then teach via `browser_pattern_learn` |
58
-
59
- ### Teaching a New Pattern After Completing a Workflow
60
- After successfully completing a multi-step flow:
61
-
62
- ```json
63
- {
64
- "origin": "https://github.com",
65
- "action": "learn",
66
- "name": "login_flow",
67
- "steps": [
68
- { "tool": "browser_click", "target": ".btn-login" },
69
- { "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" },
70
- { "tool": "browser_fill", "target": "#password", "value": "{{password}}" },
71
- { "tool": "browser_click", "target": "[type=submit]" }
72
- ],
73
- "success_indicator": "a[aria-label='Homepage']"
74
- }
75
- ```
76
-
77
- ### Recording Execution Outcomes (Reliability Upkeep)
78
- After replaying a pattern, always report the outcome:
79
-
80
- ```json
81
- {
82
- "origin": "https://github.com",
83
- "action": "record_execution",
84
- "name": "login_flow",
85
- "success": true,
86
- "duration_ms": 3200
87
- }
88
- ```
89
-
90
- ### Recording Site Quirks
91
- When you discover a cookie banner or rate limit:
92
-
93
- ```json
94
- {
95
- "origin": "https://github.com",
96
- "action": "record_quirk",
97
- "quirk_key": "cookie_banner",
98
- "quirk_data": { "selector": "#cookie-consent", "action": "click .accept-all", "appears": "first_visit" }
99
- }
100
- ```
101
-
102
- On future visits, the quirk is present in the profile so you can dismiss banners before starting your main workflow — zero wasted agent turns.
103
-
104
- ---
105
-
106
- ## File Locations (Never Write to ~/.weavetab/)
107
-
108
- | Tier | Path | Owner |
109
- |---|---|---|
110
- | Tier 1 selectors | `~/.weavetab-system/memory/<hostname>.json` | Engine (auto) |
111
- | Tier 2 site profiles | `~/.weavetab-system/memory/sites/<origin>.json` | Engine via `browser_pattern_learn` |
112
- | Knowledge hints | `~/.weavetab-system/knowledge/<hostname>.md` | Engine (auto, 20-token notes) |
8
+ # Two-Tier Memory System
9
+
10
+ Weavetab operates a two-tier persistent memory system. Understanding both layers prevents wasted DOM traversals and makes agents dramatically faster across sessions.
11
+
12
+ ---
13
+
14
+ ## Tier 1 — Selector Confidence Cache (`~/.weavetab-system/memory/`)
15
+
16
+ Per-domain JSON files (one per hostname) track individual element selectors and their interaction history.
17
+
18
+ Every time an element is located and interacted with, Weavetab calculates a confidence score based on:
19
+ 1. **Attribute Stability**: Prefers `data-testid`, `id`, `aria-label`, and semantic roles over dynamic Tailwind/CSS-module class strings.
20
+ 2. **Success Count**: Selectors that successfully trigger navigation or state changes gain reinforcement.
21
+ 3. **Origin Isolation**: Learned selectors are strictly namespaced to the origin to prevent cross-site contamination.
22
+
23
+ ### Strike Degradation
24
+ - **Strike 1**: Marked as degraded — falls back to secondary candidates or fuzzy label match.
25
+ - **Strike 2**: Deprecated — immediate fallback to full DOM inspection via `browser_find` or `browser_map`.
26
+ - **Strike 3**: Purged from memory cache to prevent stale lookups.
27
+
28
+ ### Agent Discipline for Tier 1
29
+ 1. **Rely on Native Tool Resolution**: When you pass a `ref`, Weavetab queries both the active volatile registry and the Tier 1 memory cache automatically.
30
+ 2. **Don't Hardcode Fragile Selectors**: Never pass brittle absolute CSS paths like `div:nth-child(3) > ul > li:nth-child(2) > button`.
31
+ 3. **Trust Heuristic Recovery**: If a button moves slightly on the page, the underlying engine re-anchors before reporting failure.
32
+
33
+ ---
34
+
35
+ ## Tier 2 — Site Profiles & Workflow Patterns (`~/.weavetab-system/memory/sites/`)
36
+
37
+ One JSON file per origin stores named multi-step workflow patterns, site quirks, and reliability scores. This is the **Intelligent Memory** layer — agents learn entire flows, not just individual selectors.
38
+
39
+ ### Checking a Site Profile at Session Start
40
+ Always call `browser_pattern_learn` with `action: "get"` when starting an automation session on a site you may have visited before:
41
+
42
+ ```json
43
+ { "origin": "https://github.com" }
44
+ ```
45
+
46
+ Response tells you:
47
+ - `known_patterns`: named flows with reliability scores and step counts
48
+ - `quirks`: known cookie banners, rate limits, modal popups to handle automatically
49
+ - `framework`: detected frontend stack
50
+ - `_hint`: compact hint string summarizing everything
51
+
52
+ ### Fast-Path Decision Rule
53
+ | Reliability | Action |
54
+ |---|---|
55
+ | **≥ 0.8** | Use pattern steps directly via `browser_burst` — skip exploratory navigation |
56
+ | **0.5 – 0.79** | Attempt pattern but verify success indicator before moving on |
57
+ | **< 0.5 or strikes ≥ 3** | Ignore pattern, re-explore from scratch, then teach via `browser_pattern_learn` |
58
+
59
+ ### Teaching a New Pattern After Completing a Workflow
60
+ After successfully completing a multi-step flow:
61
+
62
+ ```json
63
+ {
64
+ "origin": "https://github.com",
65
+ "action": "learn",
66
+ "name": "login_flow",
67
+ "steps": [
68
+ { "tool": "browser_click", "target": ".btn-login" },
69
+ { "tool": "browser_fill", "target": "#login_field", "value": "{{username}}" },
70
+ { "tool": "browser_fill", "target": "#password", "value": "{{password}}" },
71
+ { "tool": "browser_click", "target": "[type=submit]" }
72
+ ],
73
+ "success_indicator": "a[aria-label='Homepage']"
74
+ }
75
+ ```
76
+
77
+ ### Recording Execution Outcomes (Reliability Upkeep)
78
+ After replaying a pattern, always report the outcome:
79
+
80
+ ```json
81
+ {
82
+ "origin": "https://github.com",
83
+ "action": "record_execution",
84
+ "name": "login_flow",
85
+ "success": true,
86
+ "duration_ms": 3200
87
+ }
88
+ ```
89
+
90
+ ### Recording Site Quirks
91
+ When you discover a cookie banner or rate limit:
92
+
93
+ ```json
94
+ {
95
+ "origin": "https://github.com",
96
+ "action": "record_quirk",
97
+ "quirk_key": "cookie_banner",
98
+ "quirk_data": { "selector": "#cookie-consent", "action": "click .accept-all", "appears": "first_visit" }
99
+ }
100
+ ```
101
+
102
+ On future visits, the quirk is present in the profile so you can dismiss banners before starting your main workflow — zero wasted agent turns.
103
+
104
+ ---
105
+
106
+ ## File Locations (Never Write to ~/.weavetab/)
107
+
108
+ | Tier | Path | Owner |
109
+ |---|---|---|
110
+ | Tier 1 selectors | `~/.weavetab-system/memory/<hostname>.json` | Engine (auto) |
111
+ | Tier 2 site profiles | `~/.weavetab-system/memory/sites/<origin>.json` | Engine via `browser_pattern_learn` |
112
+ | Knowledge hints | `~/.weavetab/knowledge/<hostname>.md` | Engine (auto, 20-token notes) |
113
113
  | User config | `~/.weavetab/config.json` | Human — never written by agents |
114
114
 
115
115
 
116
116
  ## session-trail
117
117
 
118
- # Session Trails & Deterministic Macro Compilation
119
-
120
- When an agent executes an exploratory workflow (e.g. logging into a dashboard, navigating to analytics, setting date filters, and downloading a CSV), re-running that flow autonomously in the future should not require 15 reasoning steps.
121
-
122
- `browser_burst` with `compile_from_history: true` automatically converts recent successful session actions into a high-performance, deterministic execution script.
123
-
124
- ---
125
-
126
- ## 1. Compiling and Replaying Recent Actions (`browser_burst`)
127
-
128
- Replay recent successful actions directly in a single turn:
129
-
130
- ```json
131
- {
132
- "compile_from_history": true
133
- }
134
- ```
135
-
136
- Or pass `dry_run: true` to inspect the compiled macro steps before running them:
137
-
138
- ```json
139
- {
140
- "compile_from_history": true,
141
- "dry_run": true,
142
- "history_limit": 15
143
- }
144
- ```
145
-
146
- ### Response Example:
147
- ```json
148
- {
149
- "success": true,
150
- "steps_completed": 0,
151
- "compiled_steps": [
152
- { "tool": "browser_navigate", "args": { "url": "https://analytics.example.com" } },
153
- { "tool": "browser_fill", "args": { "ref": "w:12", "value": "metrics" } },
154
- { "tool": "click_and_wait", "args": { "ref": "w:15" } }
155
- ],
156
- "message": "compiled 3 macro steps from history"
157
- }
158
- ```
159
-
160
- ---
161
-
162
- ## 2. Parameterizing Variable Inputs
163
-
164
- When `"parameterizeInputs": true` is passed:
165
- - Text inputs and dates entered during the exploratory session are replaced with named parameters.
166
- - Secrets entered via `browser_type_secret` are never hardcoded; they are replaced with environment variable or secret lookups.
167
-
168
- ---
169
-
170
- ## 3. Replaying Compiled Automations
171
-
172
- Compiled macros can be executed in sub-second time without LLM inference overhead using `browser_automation`:
173
-
174
- ```json
175
- {
176
- "macroId": "macro_8f7b2c",
177
- "parameters": {
178
- "startDate": "2026-09-01",
179
- "endDate": "2026-09-03"
180
- }
181
- }
182
- ```
183
-
184
- ---
185
-
186
- ## 4. Emitting Operational Thoughts (`browser_thoughts`)
187
-
188
- Log agent rationale and internal reasoning directly to the Weavetab HUD and telemetry stream without bloating user chat responses:
189
-
190
- ```json
191
- {
192
- "thought": "Detected dynamic React hydration delay. Holding interaction until DOM mutation settles."
193
- }
118
+ # Session Trails & Deterministic Macro Compilation
119
+
120
+ When an agent executes an exploratory workflow (e.g. logging into a dashboard, navigating to analytics, setting date filters, and downloading a CSV), re-running that flow autonomously in the future should not require 15 reasoning steps.
121
+
122
+ `browser_burst` with `compile_from_history: true` converts recent successful session actions into a deterministic, replayable macro.
123
+
124
+ ---
125
+
126
+ ## 1. Compiling and Replaying Recent Actions (`browser_burst`)
127
+
128
+ Replay recent successful actions directly in a single turn:
129
+
130
+ ```json
131
+ {
132
+ "compile_from_history": true
133
+ }
134
+ ```
135
+
136
+ Or pass `dry_run: true` to inspect the compiled macro steps before running them:
137
+
138
+ ```json
139
+ {
140
+ "compile_from_history": true,
141
+ "dry_run": true,
142
+ "history_limit": 15
143
+ }
144
+ ```
145
+
146
+ ### Response Example:
147
+ ```json
148
+ {
149
+ "success": true,
150
+ "steps_completed": 0,
151
+ "compiled_steps": [
152
+ { "tool": "browser_navigate", "args": { "url": "https://analytics.example.com" } },
153
+ { "tool": "browser_type", "args": { "ref": "w:12", "text": "metrics" } },
154
+ { "tool": "click_and_wait", "args": { "ref": "w:15" } }
155
+ ],
156
+ "message": "compiled 3 macro steps from history"
157
+ }
158
+ ```
159
+
160
+ Compiled steps reuse the exact arguments the original tool calls carried (for example a `browser_fill` step keeps its `fields` array). `history_limit` caps how many recent trail entries are considered (default 20).
161
+
162
+ ---
163
+
164
+ ## 2. What Gets Compiled
165
+
166
+ The compiler walks the session trail and keeps only successful steps whose tool is replayable (clicks, typing, navigation, keys, scroll, select, wait, fill, and similar). It:
167
+ - Drops failed steps.
168
+ - De-duplicates consecutive identical calls.
169
+ - Exposes the result as `compiled_steps` with `args` nested under each step.
170
+
171
+ Because secrets entered via `browser_type_secret` are referenced by environment-variable key (`envKey`) rather than plaintext, compiled macros never contain credentials.
172
+
173
+ ---
174
+
175
+ ## 3. Background Scripts (`browser_automation`)
176
+
177
+ For recurring monitoring or polling that should run without an LLM turn, `browser_automation` injects a self-running script into the page:
178
+
179
+ ```json
180
+ {
181
+ "action": "start",
182
+ "id": "price_watch",
183
+ "script": "setInterval(() => document.querySelector('#price')?.textContent, 5000)",
184
+ "persistent": true,
185
+ "onResult": "store"
186
+ }
187
+ ```
188
+
189
+ - **`action`**: `start`, `stop`, `list`, or `poll`.
190
+ - **`id`**: unique script identifier (required for `start`/`stop`).
191
+ - **`script`**: the JavaScript to inject (required for `start`).
192
+ - **`persistent`**: re-run in a loop when `true`.
193
+ - **`onResult`**: `notify_agent`, `store` (default), or `ignore`.
194
+
195
+ Scripts are cleared on tab close — do not rely on them for expensive, long-running work.
196
+
197
+ ---
198
+
199
+ ## 4. Emitting Operational Thoughts (`browser_thoughts`)
200
+
201
+ Log agent rationale and internal reasoning directly to the Weavetab HUD and telemetry stream without bloating user chat responses:
202
+
203
+ ```json
204
+ {
205
+ "action": "feedback",
206
+ "message": "Detected dynamic React hydration delay. Holding interaction until DOM mutation settles.",
207
+ "style": "observation"
208
+ }
194
209
  ```
195
210
 
211
+ Use `"action": "question"` to surface a free-text question to the user (with `input` set to `sentence` or `paragraph`, and an optional `timeout`).
212
+
196
213
 
197
214
  ## site-learning
198
215
 
199
216
  # Site Learning — Autonomous Workflow Memory
200
217
 
201
- Weavetab's Site Learning engine accumulates cross-session knowledge about websites and multi-step automation flows. Each site gets one profile file at ~/.weavetab-system/memory/sites/<origin>.json — never duplicated, always merged on write.
218
+ Weavetab's Site Learning engine accumulates cross-session knowledge about websites and multi-step automation flows. Each site gets one profile file at `~/.weavetab-system/memory/sites/<origin>.json` — never duplicated, always merged on write.
219
+
220
+ A profile holds `framework`, `captcha_frequency`, `quirks`, and named `patterns` (each with `steps`, `reliability`, `strikes`, and execution counters).
202
221
 
203
222
  ---
204
223
 
@@ -206,38 +225,41 @@ Weavetab's Site Learning engine accumulates cross-session knowledge about websit
206
225
 
207
226
  On every session visiting a known or potentially-known site, run:
208
227
 
209
- `json
210
- { "tool": "browser_pattern_learn", "action": "get", "origin": "https://github.com" }
211
- `
228
+ ```json
229
+ { "action": "get", "origin": "https://github.com" }
230
+ ```
231
+
232
+ `action` defaults to `"learn"`, so `get` must be stated explicitly. If `origin` is omitted, `get` reads the active tab's origin.
212
233
 
213
234
  Parse the response:
214
- - known: false → site is new, proceed exploratorily, teach after completion
215
- - known_patterns → list of named workflows with reliability scores
216
- - quirks → auto-handle any listed quirks (cookie banners, rate limits) before main task
217
- - ramework → adjust interaction strategy accordingly (React, Vue, etc.)
235
+ - `known: false` → the site is new; proceed exploratorily and teach it after completion.
236
+ - `_hint` → a compact text summary listing `framework`, `captcha_frequency`, `known_patterns` (with reliability and step counts), and `quirks`.
237
+ - `quirks` → auto-handle any listed quirks (cookie banners, rate limits) before the main task.
218
238
 
219
239
  ---
220
240
 
221
241
  ## 2. Fast-Path vs. Exploratory Decision
222
242
 
223
- Use the _hint field or individual
243
+ Use the per-pattern `reliability` (and `strikes`) values to choose your strategy:
224
244
 
225
245
  | Reliability | Strikes | Strategy |
226
246
  |---|---|---|
227
- | ≥ 0.8, strikes = 0 | ✓ | **Fast path**: replay steps via rowser_burst directly |
228
- | 0.5–0.79 | 0–1 | **Cautious path**: replay steps, verify success_indicator after each critical step |
247
+ | ≥ 0.8, strikes = 0 | — | **Fast path**: replay the stored steps via `browser_burst` directly |
248
+ | 0.5–0.79 | 0–1 | **Cautious path**: replay steps, verify `success_indicator` after each critical step |
229
249
  | < 0.5 | any | **Re-explore**: navigate manually, collect correct steps, then teach |
230
- | any | ≥ 3 | **Re-learn**: ignore cached pattern, re-explore, then call rowser_pattern_learn with updated steps |
250
+ | any | ≥ 3 | **Re-learn**: ignore the cached pattern, re-explore, then `learn` again with updated steps |
251
+
252
+ The `_hint` string flags eligible patterns with `[fast-path eligible]` and stale ones with `[RE-LEARN NEEDED]`.
231
253
 
232
254
  ---
233
255
 
234
256
  ## 3. Quirk Auto-Handling
235
257
 
236
- If a profile has known quirks, resolve them immediately after navigation before executing your main task:
258
+ If a profile lists quirks, resolve them immediately after navigation before executing your main task. Example stored quirk data:
237
259
 
238
- `
239
- Profile quirks: { cookie_banner: { selector: "#cookie-consent", action: "click .accept-all", appears: "first_visit" } }
240
- `
260
+ ```
261
+ { "cookie_banner": { "selector": "#cookie-consent", "action": "click .accept-all", "appears": "first_visit" } }
262
+ ```
241
263
 
242
264
  Execute the action before doing anything else. Never spend reasoning turns on a known dismissible popup.
243
265
 
@@ -247,11 +269,10 @@ Execute the action before doing anything else. Never spend reasoning turns on a
247
269
 
248
270
  After successfully completing a multi-step flow for the first time (or after re-learning):
249
271
 
250
- `json
272
+ ```json
251
273
  {
252
- "tool": "browser_pattern_learn",
253
- "origin": "https://github.com",
254
274
  "action": "learn",
275
+ "origin": "https://github.com",
255
276
  "name": "login_flow",
256
277
  "steps": [
257
278
  { "tool": "browser_navigate", "target": "https://github.com/login" },
@@ -262,18 +283,19 @@ After successfully completing a multi-step flow for the first time (or after re-
262
283
  "success_indicator": "a[aria-label='Homepage']",
263
284
  "entry": "/login"
264
285
  }
265
- `
286
+ ```
287
+
288
+ Each step accepts `tool`, an optional `target` (selector or URL), an optional `value`, and an optional `extra` object forwarded verbatim to `browser_burst` replay.
266
289
 
267
290
  **Pattern Naming Rules**:
268
- - Use snake_case
269
- - Be descriptive: login_flow, pr_review, csv_export, checkout_flow
270
- - Duplicate name on same origin = **update** (merge), never creates a second pattern
291
+ - Use snake_case.
292
+ - Be descriptive: `login_flow`, `pr_review`, `csv_export`, `checkout_flow`.
293
+ - A duplicate name on the same origin is an **update** (merge) — it never creates a second pattern.
271
294
 
272
295
  **Step Quality Rules**:
273
- - Use semantic selectors: data-testid, id, ria-label, readable text-based selectors
274
- - Avoid: .hash_abc123, div:nth-child(4), deep anonymous chains like div > div > div > span
275
- (the engine automatically drops volatile selectors during compilation)
276
- - For sensitive inputs, record the step with a placeholder like {{username}} — never hardcode credentials
296
+ - Prefer semantic selectors: `data-testid`, `id`, `aria-label`, readable text-based selectors.
297
+ - Avoid hashed classes (`.hash_abc123`), positional selectors (`div:nth-child(4)`), and deep anonymous chains (`div > div > div > span`) — the engine drops volatile selectors during compilation.
298
+ - For sensitive inputs, record a placeholder like `{{username}}` — never hardcode credentials.
277
299
 
278
300
  ---
279
301
 
@@ -281,20 +303,21 @@ After successfully completing a multi-step flow for the first time (or after re-
281
303
 
282
304
  Every time you replay a pattern, report the outcome:
283
305
 
284
- `json
306
+ ```json
285
307
  {
286
- "tool": "browser_pattern_learn",
287
- "origin": "https://github.com",
288
308
  "action": "record_execution",
309
+ "origin": "https://github.com",
289
310
  "name": "login_flow",
290
311
  "success": true,
291
312
  "duration_ms": 3100
292
313
  }
293
- `
314
+ ```
315
+
316
+ `success` is required. The engine updates reliability via EWMA (α=0.15):
317
+ - A success nudges reliability toward 1.0 (and resets `strikes` to 0).
318
+ - A failure lowers reliability and increments `strikes`; 3 consecutive failures trigger a re-learn flag.
294
319
 
295
- The engine uses EWMA (α=0.15) to update the reliability score:
296
- - Success run → reliability climbs toward 1.0 slowly
297
- - Failure run → reliability drops; 3 consecutive failures trigger [RE-LEARN NEEDED] flag
320
+ If no pattern with that name exists for the origin, the call returns `error_code: "PATTERN_NOT_FOUND"`.
298
321
 
299
322
  ---
300
323
 
@@ -302,11 +325,10 @@ The engine uses EWMA (α=0.15) to update the reliability score:
302
325
 
303
326
  When you encounter a cookie consent modal, popup, or rate limit for the first time:
304
327
 
305
- `json
328
+ ```json
306
329
  {
307
- "tool": "browser_pattern_learn",
308
- "origin": "https://example.com",
309
330
  "action": "record_quirk",
331
+ "origin": "https://example.com",
310
332
  "quirk_key": "cookie_banner",
311
333
  "quirk_data": {
312
334
  "selector": "#cookie-consent",
@@ -314,46 +336,50 @@ When you encounter a cookie consent modal, popup, or rate limit for the first ti
314
336
  "appears": "first_visit"
315
337
  }
316
338
  }
317
- `
339
+ ```
318
340
 
319
- Supported quirk_key values: cookie_banner,
341
+ Supported `quirk_key` values: `cookie_banner`, `rate_limit`, `modal_popups`.
320
342
 
321
343
  For rate limits:
322
- `json
344
+
345
+ ```json
323
346
  {
347
+ "action": "record_quirk",
348
+ "origin": "https://example.com",
324
349
  "quirk_key": "rate_limit",
325
350
  "quirk_data": { "threshold": "60req/min", "recovery": "wait 30s" }
326
351
  }
327
- `
352
+ ```
328
353
 
329
354
  ---
330
355
 
331
356
  ## 7. Anti-Patterns to Avoid
332
357
 
333
- - **Never create per-session pattern names** like login_2026_09_16 — one name per workflow per origin, forever updated in place.
334
- - **Never call rowser_pattern_learn in a loop** — one call per workflow completion. The write is idempotent (skips disk write if nothing changed).
335
- - **Never store credentials in steps** — use placeholders or rowser_type_secret in actual execution.
336
- - **Never write to ~/.weavetab/** — all memory belongs in ~/.weavetab-system/memory/sites/.
358
+ - **Never create per-session pattern names** like `login_2026_09_16` — one name per workflow per origin, forever updated in place.
359
+ - **Never call `browser_pattern_learn` in a loop** — one call per workflow completion. The write is idempotent (skips the disk write if nothing changed).
360
+ - **Never store credentials in steps** — use placeholders or `browser_type_secret` during actual execution.
361
+ - **Never write to `~/.weavetab/`** — all memory belongs in `~/.weavetab-system/memory/sites/`.
337
362
 
338
363
  ---
339
364
 
340
365
  ## 8. Full Session Example: GitHub PR Review
341
366
 
342
- `
367
+ ```
343
368
  1. browser_pattern_learn { action: "get", origin: "https://github.com" }
344
- → patterns: { pr_review: { reliability: 0.95, steps: 3 } }
345
- → quirks: {} (none)
369
+ → known_patterns: pr_review (reliability 0.95, 3 steps) [fast-path eligible]
370
+ → quirks: none
346
371
 
347
- 2. Since reliability=0.95 (≥ 0.8): use fast path
348
- browser_burst with the 3 stored steps
372
+ 2. Since reliability = 0.95 (≥ 0.8): use the fast path.
373
+ browser_burst with the 3 stored steps.
349
374
 
350
375
  3. After completion:
351
376
  browser_pattern_learn {
352
377
  action: "record_execution",
353
378
  name: "pr_review",
379
+ origin: "https://github.com",
354
380
  success: true,
355
381
  duration_ms: 2800
356
382
  }
357
- `
383
+ ```
358
384
 
359
385
  Total agent turns for a known site: **3 tool calls** vs. potentially 12+ with full exploration.