@oxgeneral/orch 1.0.7 → 1.0.8

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 (70) hide show
  1. package/dist/{App-LEVUTWQN.js → App-5OVBVRCD.js} +1 -1
  2. package/dist/{agent-Q34L27AY.js → agent-SI4JF5MV.js} +1 -1
  3. package/dist/{agent-shop-D2RS4BZK.js → agent-shop-JHDTCWCD.js} +1 -1
  4. package/dist/chunk-3AXNSYCM.js +2 -0
  5. package/dist/{chunk-BCPUTULS.js → chunk-HWEMBO36.js} +83 -54
  6. package/dist/chunk-J7ITYXE6.js +116 -0
  7. package/dist/chunk-J7ITYXE6.js.map +1 -0
  8. package/dist/{chunk-4TDXD3LA.js → chunk-SWNSNPBO.js} +12 -2
  9. package/dist/chunk-SWNSNPBO.js.map +1 -0
  10. package/dist/chunk-U2JVMD2G.js +66 -0
  11. package/dist/chunk-U2JVMD2G.js.map +1 -0
  12. package/dist/{chunk-EH3HRQP4.js → chunk-W3J7CURM.js} +8 -116
  13. package/dist/chunk-W3J7CURM.js.map +1 -0
  14. package/dist/chunk-ZMLF5HI5.js +11 -0
  15. package/dist/cli.js +1 -1
  16. package/dist/container-SEIWOLHY.js +4 -0
  17. package/dist/doctor-Q3GHJNZL.js +2 -0
  18. package/dist/index.d.ts +32 -1
  19. package/dist/index.js +12 -5
  20. package/dist/index.js.map +1 -1
  21. package/dist/init-D4356W7G.js +73 -0
  22. package/dist/orchestrator-G3Y7THMG.js +6 -0
  23. package/dist/{orchestrator-XPEMMBOO.js.map → orchestrator-G3Y7THMG.js.map} +1 -1
  24. package/dist/{orchestrator-JOTMB5XT.js → orchestrator-GQLNLOXB.js} +8 -4
  25. package/dist/{org-WAK3CDPG.js → org-KLYK6MMJ.js} +1 -1
  26. package/dist/skill-loader-IGRIELEM.js +9 -0
  27. package/dist/skill-loader-RHCFIK74.js +4 -0
  28. package/dist/skill-loader-RHCFIK74.js.map +1 -0
  29. package/dist/{task-QFLIIRKZ.js → task-3R2IX4HM.js} +1 -1
  30. package/dist/{tui-BJHZBCIR.js → tui-47O2OCKC.js} +1 -1
  31. package/dist/{workspace-manager-5EYCMAEO.js → workspace-manager-RH24FSNT.js} +4 -3
  32. package/dist/workspace-manager-RH24FSNT.js.map +1 -0
  33. package/dist/workspace-manager-VJ4FN5PJ.js +3 -0
  34. package/package.json +1 -1
  35. package/skills/library/autoplan.md +315 -0
  36. package/skills/library/benchmark.md +242 -0
  37. package/skills/library/browse.md +266 -0
  38. package/skills/library/canary.md +248 -0
  39. package/skills/library/careful.md +42 -0
  40. package/skills/library/codex.md +431 -0
  41. package/skills/library/design-consultation.md +367 -0
  42. package/skills/library/design-review.md +744 -0
  43. package/skills/library/document-release.md +365 -0
  44. package/skills/library/freeze.md +60 -0
  45. package/skills/library/guard.md +55 -0
  46. package/skills/library/investigate.md +171 -0
  47. package/skills/library/land-and-deploy.md +636 -0
  48. package/skills/library/office-hours.md +746 -0
  49. package/skills/library/plan-ceo-review.md +1029 -0
  50. package/skills/library/plan-design-review.md +428 -0
  51. package/skills/library/plan-eng-review.md +420 -0
  52. package/skills/library/qa-only.md +388 -0
  53. package/skills/library/qa.md +766 -0
  54. package/skills/library/retro.md +532 -0
  55. package/skills/library/review.md +421 -0
  56. package/skills/library/setup-browser-cookies.md +86 -0
  57. package/skills/library/setup-deploy.md +211 -0
  58. package/skills/library/ship.md +1018 -0
  59. package/skills/library/unfreeze.md +31 -0
  60. package/skills/library/upgrade.md +220 -0
  61. package/skills/orch/SKILL.md +138 -0
  62. package/dist/chunk-4TDXD3LA.js.map +0 -1
  63. package/dist/chunk-EH3HRQP4.js.map +0 -1
  64. package/dist/chunk-WVJTXBPL.js +0 -11
  65. package/dist/container-FXUUV6PP.js +0 -4
  66. package/dist/doctor-P2J6VAUX.js +0 -2
  67. package/dist/init-PTAYCSMO.js +0 -53
  68. package/dist/orchestrator-XPEMMBOO.js +0 -6
  69. package/dist/workspace-manager-5EYCMAEO.js.map +0 -1
  70. package/dist/workspace-manager-XKOZ5WM6.js +0 -3
@@ -0,0 +1,266 @@
1
+ ---
2
+ name: browse
3
+ version: 1.1.0
4
+ description: |
5
+ Fast headless browser for QA testing and site dogfooding. Navigate any URL, interact with
6
+ elements, verify page state, diff before/after actions, take annotated screenshots, check
7
+ responsive layouts, test forms and uploads, handle dialogs, and assert element states.
8
+ ~100ms per command. Use when you need to test a feature, verify a deployment, dogfood a
9
+ user flow, or file a bug with evidence. Use when asked to "open in browser", "test the
10
+ site", "take a screenshot", or "dogfood this".
11
+ ---
12
+
13
+ ## SETUP (run this check BEFORE any browse command)
14
+
15
+ ```bash
16
+ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
17
+ B=""
18
+ [ -n "$_ROOT" ] && [ -x "$_ROOT/.claude/skills/orch/browse/dist/browse" ] && B="$_ROOT/.claude/skills/orch/browse/dist/browse"
19
+ [ -z "$B" ] && B=~/.claude/skills/orch/browse/dist/browse
20
+ if [ -x "$B" ]; then
21
+ echo "READY: $B"
22
+ else
23
+ echo "NEEDS_SETUP"
24
+ fi
25
+ ```
26
+
27
+ If `NEEDS_SETUP`:
28
+ 1. Tell the user: "orch browse needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
29
+ 2. Run: `cd <SKILL_DIR> && ./setup`
30
+ 3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
31
+
32
+ ## Core QA Patterns
33
+
34
+ ### 1. Verify a page loads correctly
35
+ ```bash
36
+ $B goto https://yourapp.com
37
+ $B text # content loads?
38
+ $B console # JS errors?
39
+ $B network # failed requests?
40
+ $B is visible ".main-content" # key elements present?
41
+ ```
42
+
43
+ ### 2. Test a user flow
44
+ ```bash
45
+ $B goto https://app.com/login
46
+ $B snapshot -i # see all interactive elements
47
+ $B fill @e3 "user@test.com"
48
+ $B fill @e4 "password"
49
+ $B click @e5 # submit
50
+ $B snapshot -D # diff: what changed after submit?
51
+ $B is visible ".dashboard" # success state present?
52
+ ```
53
+
54
+ ### 3. Verify an action worked
55
+ ```bash
56
+ $B snapshot # baseline
57
+ $B click @e3 # do something
58
+ $B snapshot -D # unified diff shows exactly what changed
59
+ ```
60
+
61
+ ### 4. Visual evidence for bug reports
62
+ ```bash
63
+ $B snapshot -i -a -o /tmp/annotated.png # labeled screenshot
64
+ $B screenshot /tmp/bug.png # plain screenshot
65
+ $B console # error log
66
+ ```
67
+
68
+ ### 5. Find all clickable elements (including non-ARIA)
69
+ ```bash
70
+ $B snapshot -C # finds divs with cursor:pointer, onclick, tabindex
71
+ $B click @c1 # interact with them
72
+ ```
73
+
74
+ ### 6. Assert element states
75
+ ```bash
76
+ $B is visible ".modal"
77
+ $B is enabled "#submit-btn"
78
+ $B is disabled "#submit-btn"
79
+ $B is checked "#agree-checkbox"
80
+ $B is editable "#name-field"
81
+ $B is focused "#search-input"
82
+ $B js "document.body.textContent.includes('Success')"
83
+ ```
84
+
85
+ ### 7. Test responsive layouts
86
+ ```bash
87
+ $B responsive /tmp/layout # mobile + tablet + desktop screenshots
88
+ $B viewport 375x812 # or set specific viewport
89
+ $B screenshot /tmp/mobile.png
90
+ ```
91
+
92
+ ### 8. Test file uploads
93
+ ```bash
94
+ $B upload "#file-input" /path/to/file.pdf
95
+ $B is visible ".upload-success"
96
+ ```
97
+
98
+ ### 9. Test dialogs
99
+ ```bash
100
+ $B dialog-accept "yes" # set up handler
101
+ $B click "#delete-button" # trigger dialog
102
+ $B dialog # see what appeared
103
+ $B snapshot -D # verify deletion happened
104
+ ```
105
+
106
+ ### 10. Compare environments
107
+ ```bash
108
+ $B diff https://staging.app.com https://prod.app.com
109
+ ```
110
+
111
+ ### 11. Show screenshots to the user
112
+ After `$B screenshot`, `$B snapshot -a -o`, or `$B responsive`, always use the Read tool on the output PNG(s) so the user can see them. Without this, screenshots are invisible.
113
+
114
+ ## User Handoff
115
+
116
+ When you hit something you can't handle in headless mode (CAPTCHA, complex auth, multi-factor
117
+ login), hand off to the user:
118
+
119
+ ```bash
120
+ # 1. Open a visible Chrome at the current page
121
+ $B handoff "Stuck on CAPTCHA at login page"
122
+
123
+ # 2. Tell the user what happened (via AskUserQuestion)
124
+ # "I've opened Chrome at the login page. Please solve the CAPTCHA
125
+ # and let me know when you're done."
126
+
127
+ # 3. When user says "done", re-snapshot and continue
128
+ $B resume
129
+ ```
130
+
131
+ **When to use handoff:**
132
+ - CAPTCHAs or bot detection
133
+ - Multi-factor authentication (SMS, authenticator app)
134
+ - OAuth flows that require user interaction
135
+ - Complex interactions the AI can't handle after 3 attempts
136
+
137
+ The browser preserves all state (cookies, localStorage, tabs) across the handoff.
138
+ After `resume`, you get a fresh snapshot of wherever the user left off.
139
+
140
+ ## Snapshot Flags
141
+
142
+ The snapshot is your primary tool for understanding and interacting with pages.
143
+
144
+ ```
145
+ -i --interactive Interactive elements only (buttons, links, inputs) with @e refs
146
+ -c --compact Compact (no empty structural nodes)
147
+ -d <N> --depth Limit tree depth (0 = root only, default: unlimited)
148
+ -s <sel> --selector Scope to CSS selector
149
+ -D --diff Unified diff against previous snapshot (first call stores baseline)
150
+ -a --annotate Annotated screenshot with red overlay boxes and ref labels
151
+ -o <path> --output Output path for annotated screenshot (default: <temp>/browse-annotated.png)
152
+ -C --cursor-interactive Cursor-interactive elements (@c refs — divs with pointer, onclick)
153
+ ```
154
+
155
+ All flags can be combined freely. `-o` only applies when `-a` is also used.
156
+ Example: `$B snapshot -i -a -C -o /tmp/annotated.png`
157
+
158
+ **Ref numbering:** @e refs are assigned sequentially (@e1, @e2, ...) in tree order.
159
+ @c refs from `-C` are numbered separately (@c1, @c2, ...).
160
+
161
+ After snapshot, use @refs as selectors in any command:
162
+ ```bash
163
+ $B click @e3 $B fill @e4 "value" $B hover @e1
164
+ $B html @e2 $B css @e5 "color" $B attrs @e6
165
+ $B click @c1 # cursor-interactive ref (from -C)
166
+ ```
167
+
168
+ **Output format:** indented accessibility tree with @ref IDs, one element per line.
169
+ ```
170
+ @e1 [heading] "Welcome" [level=1]
171
+ @e2 [textbox] "Email"
172
+ @e3 [button] "Submit"
173
+ ```
174
+
175
+ Refs are invalidated on navigation — run `snapshot` again after `goto`.
176
+
177
+ ## Full Command List
178
+
179
+ ### Navigation
180
+ | Command | Description |
181
+ |---------|-------------|
182
+ | `back` | History back |
183
+ | `forward` | History forward |
184
+ | `goto <url>` | Navigate to URL |
185
+ | `reload` | Reload page |
186
+ | `url` | Print current URL |
187
+
188
+ ### Reading
189
+ | Command | Description |
190
+ |---------|-------------|
191
+ | `accessibility` | Full ARIA tree |
192
+ | `forms` | Form fields as JSON |
193
+ | `html [selector]` | innerHTML of selector (throws if not found), or full page HTML if no selector given |
194
+ | `links` | All links as "text → href" |
195
+ | `text` | Cleaned page text |
196
+
197
+ ### Interaction
198
+ | Command | Description |
199
+ |---------|-------------|
200
+ | `click <sel>` | Click element |
201
+ | `cookie <name>=<value>` | Set cookie on current page domain |
202
+ | `cookie-import <json>` | Import cookies from JSON file |
203
+ | `cookie-import-browser [browser] [--domain d]` | Import cookies from Comet, Chrome, Arc, Brave, or Edge (opens picker, or use --domain for direct import) |
204
+ | `dialog-accept [text]` | Auto-accept next alert/confirm/prompt. Optional text is sent as the prompt response |
205
+ | `dialog-dismiss` | Auto-dismiss next dialog |
206
+ | `fill <sel> <val>` | Fill input |
207
+ | `header <name>:<value>` | Set custom request header (colon-separated, sensitive values auto-redacted) |
208
+ | `hover <sel>` | Hover element |
209
+ | `press <key>` | Press key — Enter, Tab, Escape, ArrowUp/Down/Left/Right, Backspace, Delete, Home, End, PageUp, PageDown, or modifiers like Shift+Enter |
210
+ | `scroll [sel]` | Scroll element into view, or scroll to page bottom if no selector |
211
+ | `select <sel> <val>` | Select dropdown option by value, label, or visible text |
212
+ | `type <text>` | Type into focused element |
213
+ | `upload <sel> <file> [file2...]` | Upload file(s) |
214
+ | `useragent <string>` | Set user agent |
215
+ | `viewport <WxH>` | Set viewport size |
216
+ | `wait <sel|--networkidle|--load>` | Wait for element, network idle, or page load (timeout: 15s) |
217
+
218
+ ### Inspection
219
+ | Command | Description |
220
+ |---------|-------------|
221
+ | `attrs <sel|@ref>` | Element attributes as JSON |
222
+ | `console [--clear|--errors]` | Console messages (--errors filters to error/warning) |
223
+ | `cookies` | All cookies as JSON |
224
+ | `css <sel> <prop>` | Computed CSS value |
225
+ | `dialog [--clear]` | Dialog messages |
226
+ | `eval <file>` | Run JavaScript from file and return result as string (path must be under /tmp or cwd) |
227
+ | `is <prop> <sel>` | State check (visible/hidden/enabled/disabled/checked/editable/focused) |
228
+ | `js <expr>` | Run JavaScript expression and return result as string |
229
+ | `network [--clear]` | Network requests |
230
+ | `perf` | Page load timings |
231
+ | `storage [set k v]` | Read all localStorage + sessionStorage as JSON, or set <key> <value> to write localStorage |
232
+
233
+ ### Visual
234
+ | Command | Description |
235
+ |---------|-------------|
236
+ | `diff <url1> <url2>` | Text diff between pages |
237
+ | `pdf [path]` | Save as PDF |
238
+ | `responsive [prefix]` | Screenshots at mobile (375x812), tablet (768x1024), desktop (1280x720). Saves as {prefix}-mobile.png etc. |
239
+ | `screenshot [--viewport] [--clip x,y,w,h] [selector|@ref] [path]` | Save screenshot (supports element crop via CSS/@ref, --clip region, --viewport) |
240
+
241
+ ### Snapshot
242
+ | Command | Description |
243
+ |---------|-------------|
244
+ | `snapshot [flags]` | Accessibility tree with @e refs for element selection. Flags: -i interactive only, -c compact, -d N depth limit, -s sel scope, -D diff vs previous, -a annotated screenshot, -o path output, -C cursor-interactive @c refs |
245
+
246
+ ### Meta
247
+ | Command | Description |
248
+ |---------|-------------|
249
+ | `chain` | Run commands from JSON stdin. Format: [["cmd","arg1",...],...] |
250
+
251
+ ### Tabs
252
+ | Command | Description |
253
+ |---------|-------------|
254
+ | `closetab [id]` | Close tab |
255
+ | `newtab [url]` | Open new tab |
256
+ | `tab <id>` | Switch to tab |
257
+ | `tabs` | List open tabs |
258
+
259
+ ### Server
260
+ | Command | Description |
261
+ |---------|-------------|
262
+ | `handoff [message]` | Open visible Chrome at current page for user takeover |
263
+ | `restart` | Restart server |
264
+ | `resume` | Re-snapshot after user takeover, return control to AI |
265
+ | `status` | Health check |
266
+ | `stop` | Shutdown server |
@@ -0,0 +1,248 @@
1
+ ---
2
+ name: canary
3
+ version: 1.0.0
4
+ description: |
5
+ Post-deploy canary monitoring. Watches the live app for console errors,
6
+ performance regressions, and page failures using the browse daemon. Takes
7
+ periodic screenshots, compares against pre-deploy baselines, and alerts
8
+ on anomalies. Use when: "monitor deploy", "canary", "post-deploy check",
9
+ "watch production", "verify deploy".
10
+ ---
11
+
12
+ ## SETUP (run this check BEFORE any browse command)
13
+
14
+ ```bash
15
+ _ROOT=$(git rev-parse --show-toplevel 2>/dev/null)
16
+ B=""
17
+ [ -n "$_ROOT" ] && [ -x "# browse binary (project-local)" ] && B="# browse binary (project-local)"
18
+ [ -z "$B" ] && B=# browse binary path (adapt to your browse tool setup)
19
+ if [ -x "$B" ]; then
20
+ echo "READY: $B"
21
+ else
22
+ echo "NEEDS_SETUP"
23
+ fi
24
+ ```
25
+
26
+ If `NEEDS_SETUP`:
27
+ 1. Tell the user: "the browse tool needs a one-time build (~10 seconds). OK to proceed?" Then STOP and wait.
28
+ 2. Run: `cd <SKILL_DIR> && ./setup`
29
+ 3. If `bun` is not installed: `curl -fsSL https://bun.sh/install | bash`
30
+
31
+ ## Step 0: Detect base branch
32
+
33
+ Determine which branch this PR targets. Use the result as "the base branch" in all subsequent steps.
34
+
35
+ 1. Check if a PR already exists for this branch:
36
+ `gh pr view --json baseRefName -q .baseRefName`
37
+ If this succeeds, use the printed branch name as the base branch.
38
+
39
+ 2. If no PR exists (command fails), detect the repo's default branch:
40
+ `gh repo view --json defaultBranchRef -q .defaultBranchRef.name`
41
+
42
+ 3. If both commands fail, fall back to `main`.
43
+
44
+ Print the detected base branch name. In every subsequent `git diff`, `git log`,
45
+ `git fetch`, `git merge`, and `gh pr create` command, substitute the detected
46
+ branch name wherever the instructions say "the base branch."
47
+
48
+ ---
49
+
50
+ # /canary — Post-Deploy Visual Monitor
51
+
52
+ You are a **Release Reliability Engineer** watching production after a deploy. You've seen deploys that pass CI but break in production — a missing environment variable, a CDN cache serving stale assets, a database migration that's slower than expected on real data. Your job is to catch these in the first 10 minutes, not 10 hours.
53
+
54
+ You use the browse daemon to watch the live app, take screenshots, check console errors, and compare against baselines. You are the safety net between "shipped" and "verified."
55
+
56
+ ## User-invocable
57
+ When the user types `/canary`, run this skill.
58
+
59
+ ## Arguments
60
+ - `/canary <url>` — monitor a URL for 10 minutes after deploy
61
+ - `/canary <url> --duration 5m` — custom monitoring duration (1m to 30m)
62
+ - `/canary <url> --baseline` — capture baseline screenshots (run BEFORE deploying)
63
+ - `/canary <url> --pages /,/dashboard,/settings` — specify pages to monitor
64
+ - `/canary <url> --quick` — single-pass health check (no continuous monitoring)
65
+
66
+ ## Instructions
67
+
68
+ ### Phase 1: Setup
69
+
70
+ ```bash
71
+ # Project slug detection
72
+ SLUG=$(basename "$(git rev-parse --show-toplevel 2>/dev/null)" 2>/dev/null || echo "unknown")
73
+ mkdir -p .orch/canary-reports
74
+ mkdir -p .orch/canary-reports/baselines
75
+ mkdir -p .orch/canary-reports/screenshots
76
+ ```
77
+
78
+ Parse the user's arguments. Default duration is 10 minutes. Default pages: auto-discover from the app's navigation.
79
+
80
+ ### Phase 2: Baseline Capture (--baseline mode)
81
+
82
+ If the user passed `--baseline`, capture the current state BEFORE deploying.
83
+
84
+ For each page (either from `--pages` or the homepage):
85
+
86
+ ```bash
87
+ $B goto <page-url>
88
+ $B snapshot -i -a -o ".orch/canary-reports/baselines/<page-name>.png"
89
+ $B console --errors
90
+ $B perf
91
+ $B text
92
+ ```
93
+
94
+ Collect for each page: screenshot path, console error count, page load time from `perf`, and a text content snapshot.
95
+
96
+ Save the baseline manifest to `.orch/canary-reports/baseline.json`:
97
+
98
+ ```json
99
+ {
100
+ "url": "<url>",
101
+ "timestamp": "<ISO>",
102
+ "branch": "<current branch>",
103
+ "pages": {
104
+ "/": {
105
+ "screenshot": "baselines/home.png",
106
+ "console_errors": 0,
107
+ "load_time_ms": 450
108
+ }
109
+ }
110
+ }
111
+ ```
112
+
113
+ Then STOP and tell the user: "Baseline captured. Deploy your changes, then run `/canary <url>` to monitor."
114
+
115
+ ### Phase 3: Page Discovery
116
+
117
+ If no `--pages` were specified, auto-discover pages to monitor:
118
+
119
+ ```bash
120
+ $B goto <url>
121
+ $B links
122
+ $B snapshot -i
123
+ ```
124
+
125
+ Extract the top 5 internal navigation links from the `links` output. Always include the homepage. Present the page list via AskUserQuestion:
126
+
127
+ - **Context:** Monitoring the production site at the given URL after a deploy.
128
+ - **Question:** Which pages should the canary monitor?
129
+ - **RECOMMENDATION:** Choose A — these are the main navigation targets.
130
+ - A) Monitor these pages: [list the discovered pages]
131
+ - B) Add more pages (user specifies)
132
+ - C) Monitor homepage only (quick check)
133
+
134
+ ### Phase 4: Pre-Deploy Snapshot (if no baseline exists)
135
+
136
+ If no `baseline.json` exists, take a quick snapshot now as a reference point.
137
+
138
+ For each page to monitor:
139
+
140
+ ```bash
141
+ $B goto <page-url>
142
+ $B snapshot -i -a -o ".orch/canary-reports/screenshots/pre-<page-name>.png"
143
+ $B console --errors
144
+ $B perf
145
+ ```
146
+
147
+ Record the console error count and load time for each page. These become the reference for detecting regressions during monitoring.
148
+
149
+ ### Phase 5: Continuous Monitoring Loop
150
+
151
+ Monitor for the specified duration. Every 60 seconds, check each page:
152
+
153
+ ```bash
154
+ $B goto <page-url>
155
+ $B snapshot -i -a -o ".orch/canary-reports/screenshots/<page-name>-<check-number>.png"
156
+ $B console --errors
157
+ $B perf
158
+ ```
159
+
160
+ After each check, compare results against the baseline (or pre-deploy snapshot):
161
+
162
+ 1. **Page load failure** — `goto` returns error or timeout → CRITICAL ALERT
163
+ 2. **New console errors** — errors not present in baseline → HIGH ALERT
164
+ 3. **Performance regression** — load time exceeds 2x baseline → MEDIUM ALERT
165
+ 4. **Broken links** — new 404s not in baseline → LOW ALERT
166
+
167
+ **Alert on changes, not absolutes.** A page with 3 console errors in the baseline is fine if it still has 3. One NEW error is an alert.
168
+
169
+ **Don't cry wolf.** Only alert on patterns that persist across 2 or more consecutive checks. A single transient network blip is not an alert.
170
+
171
+ **If a CRITICAL or HIGH alert is detected**, immediately notify the user via AskUserQuestion:
172
+
173
+ ```
174
+ CANARY ALERT
175
+ ════════════
176
+ Time: [timestamp, e.g., check #3 at 180s]
177
+ Page: [page URL]
178
+ Type: [CRITICAL / HIGH / MEDIUM]
179
+ Finding: [what changed — be specific]
180
+ Evidence: [screenshot path]
181
+ Baseline: [baseline value]
182
+ Current: [current value]
183
+ ```
184
+
185
+ - **Context:** Canary monitoring detected an issue on [page] after [duration].
186
+ - **RECOMMENDATION:** Choose based on severity — A for critical, B for transient.
187
+ - A) Investigate now — stop monitoring, focus on this issue
188
+ - B) Continue monitoring — this might be transient (wait for next check)
189
+ - C) Rollback — revert the deploy immediately
190
+ - D) Dismiss — false positive, continue monitoring
191
+
192
+ ### Phase 6: Health Report
193
+
194
+ After monitoring completes (or if the user stops early), produce a summary:
195
+
196
+ ```
197
+ CANARY REPORT — [url]
198
+ ═════════════════════
199
+ Duration: [X minutes]
200
+ Pages: [N pages monitored]
201
+ Checks: [N total checks performed]
202
+ Status: [HEALTHY / DEGRADED / BROKEN]
203
+
204
+ Per-Page Results:
205
+ ─────────────────────────────────────────────────────
206
+ Page Status Errors Avg Load
207
+ / HEALTHY 0 450ms
208
+ /dashboard DEGRADED 2 new 1200ms (was 400ms)
209
+ /settings HEALTHY 0 380ms
210
+
211
+ Alerts Fired: [N] (X critical, Y high, Z medium)
212
+ Screenshots: .orch/canary-reports/screenshots/
213
+
214
+ VERDICT: [DEPLOY IS HEALTHY / DEPLOY HAS ISSUES — details above]
215
+ ```
216
+
217
+ Save report to `.orch/canary-reports/{date}-canary.md` and `.orch/canary-reports/{date}-canary.json`.
218
+
219
+ Log the result for the review dashboard:
220
+
221
+ ```bash
222
+ # Project slug detection (adapt to your project structure)
223
+ mkdir -p .orch/reports
224
+ ```
225
+
226
+ Write a JSONL entry: `{"skill":"canary","timestamp":"<ISO>","status":"<HEALTHY/DEGRADED/BROKEN>","url":"<url>","duration_min":<N>,"alerts":<N>}`
227
+
228
+ ### Phase 7: Baseline Update
229
+
230
+ If the deploy is healthy, offer to update the baseline:
231
+
232
+ - **Context:** Canary monitoring completed. The deploy is healthy.
233
+ - **RECOMMENDATION:** Choose A — deploy is healthy, new baseline reflects current production.
234
+ - A) Update baseline with current screenshots
235
+ - B) Keep old baseline
236
+
237
+ If the user chooses A, copy the latest screenshots to the baselines directory and update `baseline.json`.
238
+
239
+ ## Important Rules
240
+
241
+ - **Speed matters.** Start monitoring within 30 seconds of invocation. Don't over-analyze before monitoring.
242
+ - **Alert on changes, not absolutes.** Compare against baseline, not industry standards.
243
+ - **Screenshots are evidence.** Every alert includes a screenshot path. No exceptions.
244
+ - **Transient tolerance.** Only alert on patterns that persist across 2+ consecutive checks.
245
+ - **Baseline is king.** Without a baseline, canary is a health check. Encourage `--baseline` before deploying.
246
+ - **Performance thresholds are relative.** 2x baseline is a regression. 1.5x might be normal variance.
247
+ - **Read-only.** Observe and report. Don't modify code unless the user explicitly asks to investigate and fix.
248
+
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: careful
3
+ version: 0.1.0
4
+ description: |
5
+ Safety guardrails for destructive commands. Warns before rm -rf, DROP TABLE,
6
+ force-push, git reset --hard, kubectl delete, and similar destructive operations.
7
+ User can override each warning. Use when touching prod, debugging live systems,
8
+ or working in a shared environment. Use when asked to "be careful", "safety mode",
9
+ "prod mode", or "careful mode".
10
+ ---
11
+
12
+ # /careful — Destructive Command Guardrails
13
+
14
+ Safety mode is now **active**. Every bash command will be checked for destructive
15
+ patterns before running. If a destructive command is detected, you'll be warned
16
+ and can choose to proceed or cancel.
17
+
18
+ ## What's protected
19
+
20
+ | Pattern | Example | Risk |
21
+ |---------|---------|------|
22
+ | `rm -rf` / `rm -r` / `rm --recursive` | `rm -rf /var/data` | Recursive delete |
23
+ | `DROP TABLE` / `DROP DATABASE` | `DROP TABLE users;` | Data loss |
24
+ | `TRUNCATE` | `TRUNCATE orders;` | Data loss |
25
+ | `git push --force` / `-f` | `git push -f origin main` | History rewrite |
26
+ | `git reset --hard` | `git reset --hard HEAD~3` | Uncommitted work loss |
27
+ | `git checkout .` / `git restore .` | `git checkout .` | Uncommitted work loss |
28
+ | `kubectl delete` | `kubectl delete pod` | Production impact |
29
+ | `docker rm -f` / `docker system prune` | `docker system prune -a` | Container/image loss |
30
+
31
+ ## Safe exceptions
32
+
33
+ These patterns are allowed without warning:
34
+ - `rm -rf node_modules` / `.next` / `dist` / `__pycache__` / `.cache` / `build` / `.turbo` / `coverage`
35
+
36
+ ## How it works
37
+
38
+ The hook reads the command from the tool input JSON, checks it against the
39
+ patterns above, and returns `permissionDecision: "ask"` with a warning message
40
+ if a match is found. You can always override the warning and proceed.
41
+
42
+ To deactivate, end the conversation or start a new one. Hooks are session-scoped.