aos watch
Follow what changes on this machine, one JSON line per event
14 commands. Run aos watch --help for the same list from the binary, or see every group.
Wait for something to happen on this machine. With a condition (--match, --gone, --until, --exit, --for, --below) a watch exits 0 when it is met and 3 on --timeout, so an agent chains the next step with &&. Without one it prints one JSON line per event until interrupted. The first sample is a baseline, so --max=1 means the next change; watch clipboard hides the text unless --content is passed. Watches are blocking, so they are not MCP tools. For mail, Teams, WhatsApp or calendar events use apl. See waiting for things.
Commands
Section titled “Commands”aos watch battery
Section titled “aos watch battery”Wait for a battery level or charging state, or print a JSON line for each power change
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch battery [--below=<pct>] [--above=<pct>] [--until=charging|discharging|full] [--interval=<5s>] [--timeout=<dur>] [--json]| flag | values | meaning |
|---|---|---|
--below |
<pct> |
Optional |
--above |
<pct> |
Optional |
--until |
charging, discharging, full |
Optional |
--interval |
<5s> |
Optional. default 5s |
--timeout |
<dur> |
Optional |
--json |
Optional |
aos watch battery --below=20 && echo time to save work # exit 0 once the charge is under 20%aos watch battery --until=full --timeout=3h # exit 3 if it is not full in 3 hoursaos watch battery --until=discharging # exit 0 when the charger is pulledaos watch battery # a JSON line for plugged, unplugged, full and each % changeaos watch camera
Section titled “aos watch camera”Report when any app starts or stops using the camera
needs a display darwin · windows only
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch camera [--until=busy|free] [--interval=<1s>] [--timeout=<duration>] [--json]| flag | values | meaning |
|---|---|---|
--until |
busy, free |
Optional |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<duration> |
Optional |
--json |
Optional |
aos watch cameraaos watch camera --until=busy --timeout=10maos watch camera --until=free && echo 'call is over, start the build'aos watch camera --json# with --until: exit 0 when the state is reached (at once if it already is), 3 on --timeoutaos watch clipboard
Section titled “aos watch clipboard”Print a JSON line whenever the clipboard text changes
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch clipboard [--interval=<500ms>] [--max=<n>] [--content]| flag | values | meaning |
|---|---|---|
--interval |
<500ms> |
Optional. default 500ms |
--max |
<n> |
Optional |
--content |
Optional |
aos watch clipboardaos watch clipboard --max=1 --contentaos watch device
Section titled “aos watch device”Report when a USB drive, audio device or Bluetooth device is connected or removed
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch device [--kind=volume|audio|bluetooth[,...]] [--until=added|removed] [--interval=<2s>] [--timeout=<duration>] [--json]| flag | values | meaning |
|---|---|---|
--kind |
volume, audio, bluetooth[,... |
Optional. comma-separated |
--until |
added, removed |
Optional |
--interval |
<2s> |
Optional. default 2s |
--timeout |
<duration> |
Optional |
--json |
Optional |
aos watch deviceaos watch device --kind=volume --until=added --timeout=2maos watch device --kind=audio,bluetooth --jsonaos watch device --kind=bluetooth --until=removed && echo 'headphones dropped, pause the music'# with --until: exit 0 on the first matching event, 3 on --timeoutaos watch display
Section titled “aos watch display”Wait for a monitor to be plugged in or removed, or print a JSON line for each
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch display [--until=added|removed|<count>] [--interval=<2s>] [--timeout=<dur>] [--json]| flag | values | meaning |
|---|---|---|
--until |
added, removed, <count> |
Optional |
--interval |
<2s> |
Optional. default 2s |
--timeout |
<dur> |
Optional |
--json |
Optional |
aos watch display --until=added && aos window move Chrome --monitor=2 # exit 0 when a monitor appearsaos watch display --until=removed --timeout=10m # exit 3 if none is unplugged in 10maos watch display --until=2 # exit 0 once exactly 2 monitors are attachedaos watch display # a JSON line per monitor added or removedaos watch file
Section titled “aos watch file”Print a JSON line whenever a file or directory entry changes
needs a display
Under WSL / SSH: runs inside WSL (where aos was started). How the host works
aos watch file <path> [--interval=<500ms>] [--max=<n>] [--recursive]| flag | values | meaning |
|---|---|---|
<path> |
Required positional argument | |
--interval |
<500ms> |
Optional. default 500ms |
--max |
<n> |
Optional |
--recursive |
Optional |
aos watch file ~/Downloadsaos watch file ./notes.md --max=1aos watch file ./src --recursive --interval=1saos watch idle
Section titled “aos watch idle”Exit 0 once the person has been idle for a while, or as soon as they are active again
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch idle (--for=<duration> | --active) [--interval=<1s>] [--timeout=<duration>] [--json]| flag | values | meaning |
|---|---|---|
--for |
<duration> |
One of these is required |
--active |
One of these is required | |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<duration> |
Optional |
--json |
Optional |
aos watch idle --for=10m && echo "away from the desk"aos watch idle --active --timeout=1h # block until the next key press or mouse moveaos watch idle --for=5m --json# idle time is input idle: macOS HIDIdleTime, Windows GetLastInputInfo, Linux xprintidle (X11 only)# exit 0 when met, 3 on --timeout, 1 when this machine cannot report idle timeaos watch lock
Section titled “aos watch lock”Print a JSON line when the screen locks or unlocks and when the machine sleeps or wakes
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch lock [--until=locked|unlocked|sleep|wake] [--interval=<1s>] [--timeout=<duration>] [--max=<n>]| flag | values | meaning |
|---|---|---|
--until |
locked, unlocked, sleep, wake |
Optional |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<duration> |
Optional |
--max |
<n> |
Optional |
aos watch lockaos watch lock --until=unlocked --timeout=2h && echo "the person is back"aos watch lock --until=lockedaos watch lock --until=wake --timeout=8h# lock: macOS CGSession, Windows WTS session state. sleep: seen as a gap in the poll clock, so sleep and wake are reported together on resume (sleep carries slept_ms)# --until exits 0 when that state is reached (at once if already locked/unlocked), 3 on --timeoutaos watch mic
Section titled “aos watch mic”Report when any app starts or stops using the microphone
needs a display darwin · windows only
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch mic [--until=busy|free] [--interval=<1s>] [--timeout=<duration>] [--json]| flag | values | meaning |
|---|---|---|
--until |
busy, free |
Optional |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<duration> |
Optional |
--json |
Optional |
aos watch micaos watch mic --until=free --timeout=1haos watch mic --until=busy && echo 'someone is on a call'aos watch mic --json# with --until: exit 0 when the state is reached (at once if it already is), 3 on --timeoutaos watch network
Section titled “aos watch network”Print a JSON line when the machine goes online or offline or changes Wi-Fi network
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch network [--until=online|offline] [--timeout=<duration>] [--max=<n>] [--interval=<5s>]| flag | values | meaning |
|---|---|---|
--until |
online, offline |
Optional |
--timeout |
<duration> |
Optional |
--max |
<n> |
Optional |
--interval |
<5s> |
Optional. default 5s |
aos watch networkaos watch network --until=online --timeout=10m && aos exec -- git pushaos watch network --until=offline# --until: exit 0 when that state is reached (at once if already there), 3 on --timeoutaos watch process
Section titled “aos watch process”Wait for one process to end or appear, or print a JSON line for each start and stop
needs a display
Under WSL / SSH: runs inside WSL (where aos was started). How the host works
aos watch process --name=<name> | --pid=<n> [--exit | --start] [--interval=<1s>] [--timeout=<dur>] [--json]| flag | values | meaning |
|---|---|---|
--name |
<name> |
One of these is required |
--pid |
<n> |
One of these is required |
--exit |
Optional | |
--start |
Optional | |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<dur> |
Optional |
--json |
Optional |
aos watch process --name=ffmpeg --exit && echo render done # exit 0 when ffmpeg endsaos watch process --pid=4821 --exit --timeout=30m # exit 3 if it is still running after 30maos watch process --name=Xcode --start # exit 0 when Xcode appearsaos watch process --name=node # a JSON line per start and stopaos watch tab
Section titled “aos watch tab”Print a JSON line with the new text whenever a browser tab’s page changes
needs a display darwin · windows only
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch tab (--id=<tab id> | --url=<substring> | --title=<substring>) [--app=<name>] [--match=<text> | --gone=<text>] [--near=<anchor text>] [--exact] [--reload=<duration>] [--interval=<1s>] [--timeout=<duration>] [--max=<n>] [--focus]| flag | values | meaning |
|---|---|---|
--id |
<tab id> |
One of these is required |
--url |
<substring> |
One of these is required |
--title |
<substring> |
One of these is required |
--app |
<name> |
Optional |
--match |
<text> |
Optional |
--gone |
<text> |
Optional |
--near |
<anchor text> |
Optional |
--exact |
Optional | |
--reload |
<duration> |
Optional |
--interval |
<1s> |
Optional. default 1s |
--timeout |
<duration> |
Optional |
--max |
<n> |
Optional |
--focus |
Optional |
aos watch tab --id=chrome:1658108662:1658109078aos watch tab --url=web.whatsapp.com --match="Build finished" --timeout=5maos watch tab --url=example.com/slots --reload=30s --match="Book now" && aos tab click --url=example.com/slots --find="Book now"aos watch tab --url=example.com/order --reload=1m --gone="Out of stock" --timeout=2haos watch tab --url=example.com/item --near="Price" --match="$" --reload=5m# with --match / --gone: exit 0 when the condition is met, 3 on --timeout or when the tab closesaos watch url
Section titled “aos watch url”Poll a URL over plain HTTP and report when its text changes, appears or goes away
needs a display
Under WSL / SSH: runs inside WSL (where aos was started). How the host works
aos watch url <url> [--every=<1m>] [--match=<text> | --gone=<text>] [--exact] [--timeout=<duration>] [--max=<n>]| flag | values | meaning |
|---|---|---|
<url> |
Required positional argument | |
--every |
<1m> |
Optional. default 1m |
--match |
<text> |
Optional |
--gone |
<text> |
Optional |
--exact |
Optional | |
--timeout |
<duration> |
Optional |
--max |
<n> |
Optional |
aos watch url https://example.com/statusaos watch url https://example.com/release --every=5m --match="v2.0" --timeout=12h && aos open https://example.com/releaseaos watch url https://shop.example.com/item --every=10m --gone="Out of stock"# with --match / --gone: exit 0 when the condition is met, 3 on --timeout# pages that need a login or JavaScript: use `aos watch tab`aos watch window
Section titled “aos watch window”Print a JSON line whenever the focused window changes, or wait for text to appear or vanish in a window
needs a display
Under WSL / SSH: runs on the Windows host (the machine with the screen). How the host works
aos watch window [--interval=<500ms>] [--max=<n>] | (--app=<name> | --title=<substring>) (--match=<text> | --gone=<text>) [--exact] [--new] [--interval=<2s>] [--timeout=<duration>] [--source=auto|accessibility|ocr] [--json]| flag | values | meaning |
|---|---|---|
--interval |
<500ms> |
Optional. default 500ms |
--max |
<n> |
Optional |
--app |
<name> |
One of these is required |
--title |
<substring> |
One of these is required |
--match |
<text> |
One of these is required |
--gone |
<text> |
One of these is required |
--exact |
Optional | |
--new |
Optional | |
--timeout |
<duration> |
Optional |
--source |
auto, accessibility, ocr |
Optional |
--json |
Optional |
aos watch windowaos watch window --max=1aos watch window --app=Teams --match="Muthu" --timeout=1h && echo "message arrived"aos watch window --app=Slack --match=deploy --new --jsonaos watch window --app=Notes --gone="Syncing" --timeout=2m# text mode reads the window like `window text`; exit 0 when met, 3 on --timeout; never raises or moves the window