A step list is how a bot turns the live commands that worked into a shortcut. Bot Phone compiles it into the shortcut's code, checks it and replays it once from the app's first screen; when every check passes it is ready and publish_shortcut makes it live, unless it adds a risky power over the live version (a new app, phone or pull folder; a delete, install or file-edit step): then the owner publishes it in the Bot Phone app; live, the owner can disable it or roll back (and the bot can roll back what it published, rollback_shortcut).
The publishing rule (0.37.3, Dec 1 2026): a check never publishes unless it is asked to. A bot's check_shortcut_draft leaves a passing draft ready and the bot publishes it with publish_shortcut; publish: true on the check makes a full pass (the list's own inputs, no post short of its grid) go live by itself; publish: false never publishes. A person's check (or a check after the owner asked to publish) publishes a full pass as before. In every case a version that adds a risky power waits for the owner's OK, a short check never goes live by itself, and a control-plane restart never publishes a ready draft. There is no recording and no AI on Bot Phone's side: what the list says is what runs.
Bots read this file with the MCP tool step_list_reference. The examples use a made-up app (Trip Journal, com.example.tripjournal); use the ids, screens and words of your own app, as screen_read shows them.
Steps are the tools (Nov 29 2026, Liu Chao 19:23 SGT). Every step is a phone tool with the same name and the same parameters: screen_wait, screen_tap, screen_scroll, screen_swipe, screen_type, screen_read, device_press, file_rename, file_set_date. What you call live (without phone, reason, verify and rules) is the step. A few things are not steps, and a list that names one is told why: screen_capture (nobody looks at a run's pictures), file_list / file_get (a run collects with pull), file_put, file_delete, app_install, app_uninstall, app_list, and app_open / app_close (the first step, start, closes and opens the app). Live-only options for now: screen_tap count (double tap) and hold_ms (long press), screen_swipe hold_ms (drag) and direction (0.36.0), screen_wait changed_from and screen_read sig (0.36.0), screen_type text (a step types a per-run input). The phone data tools notification_list, clipboard_get, clipboard_set and list_my_commands are live only (not steps). The old step names (tap_id, tap, wait_for_screen, wait, scroll_until, swipe, key, type, pause, dismiss, read_number, read_text, rename_files, set_file_date) are refused with the new form named; saved shortcuts and drafts keep running unchanged (they are stored in Bot Phone's own form and shown in these names).
When a flow needs loops, branches or reading values, a Python script can do it with the same checked basics: try_script runs one once in a sandbox on the phone's server (accounts with scripts switched on). The whole library (bp.screen.read/text/find, bp.tap, bp.swipe, bp.wait with botphone.Timeout, bp.app.restart with Android's permission dialog answered, bp.dismiss_popups, bp.collect/bp.save, the errors, costs and examples) is in the script_reference tool. 0.40.0: a step list can run a saved script as one of its steps (script, below "Script steps"); a whole script is still not a shortcut on its own.
run_resume).
manifest.json: today by you, the bot that receives the run (with your own live tools if you need the app's words), before you deliver and send run_report. Later, in hosted mode, Bot Phone's own agent will do it in the run.
screen_tap with an element target, screen_scroll, screen_wait (and screen_wait {dismiss: true}). They run the same server code as the shortcut's steps, so what works live works the same in the shortcut.
try_steps {steps, check_only: true}. It needs no phone and returns every problem at once: validation (launch included), the lint hard gate, the code gate, and the goal flags. It does not count as a try (only a flood cap of 30 a minute).
try_steps {phone, steps, inputs}: one run from the app's first screen, nothing saved, at most 3 a minute and 20 an hour. got shows the files, the numbers screen_read {as} read (and their sums) and, for a dated list, dates: {done, stopped_at, skipped} and more_to_fetch. A dated list takes about a minute per date: poll with try_steps {try, wait: 50} (it answers as soon as the run ends; polls leave the plan out). A try cannot be resumed: fix it and try again.
draft_shortcut {steps, name, phone}, then check_shortcut_draft. If every check passes it is ready; with publish: true a full pass goes live by itself (published, went_live; the owner gets a went-live notice with Roll back / Disable), unless it adds a risky power over the live version: then it is ready (waiting_for: owner, needs_ok_for says what) and the owner publishes it in the app. If not, it comes back as needs_fix with findings: fix them with update_shortcut_draft and check again. The replay's files are a short hand-off: run_result {run_id: check_run} gives signed download links (encrypted, shredded after 24 h; keep: true on the check leaves its copies on the phone).
publish_shortcut {draft} publishes a ready draft that adds no risky power, or tells the owner it needs their OK (the usual way for a bot: its checks do not publish unless publish: true).
{"app": "com.example.tripjournal",
"launch": "com.example.tripjournal/.StartActivity",
"first_screen": "JournalActivity",
"goal": "Save the new trip pictures since the last sync, one day at a time, with their dates",
"intent": {
"goal": "Keep every trip picture in the family archive without saving any twice",
"success": "Every picture of each new day is collected, as many as the app's Chosen counter says, each with its day",
"steps": ["open Trip Journal on the Days list",
"for each day newer than the last sync: choose all its pictures, save them to the phone",
"collect the saved pictures and date them with their day"],
"constraints": ["never delete anything in the app"]},
"time_zone": "Europe/Berlin",
"inputs": {"last_sync": {"type": "date", "default": "since_last_run"}},
"on_unexpected": {"dismiss": [{"id": "later_button"}], "otherwise": "stop"},
"steps": [...],
"success": {"end_screen": "DaysActivity", "files_equal": "chosen"}}
| Key | Required | What |
|---|---|---|
app | yes | The Android package. |
launch | yes | The start activity, package/.Activity (for example the screen screen_read {only: "app"} shows right after app_open). |
first_screen | advised | The activity the app opens on (default: launch's class name). |
steps | yes | steps[0] is {"do": "start"}. Every step has an intent: a few plain words on what it is for. |
intent | yes | The shortcut's intent (below): why, what success looks like, the plain steps the list implements, and what happens downstream. |
time_zone | no | An IANA zone (Europe/Berlin). Dated files get their time in it, and an input's "today" is that zone's day. Default UTC. |
success | yes | How a run shows it reached the goal (below). |
goal | no | Shown to the person next to what the run really checks. |
inputs | no | Per-run values (below). Every input must be used by a step. |
on_unexpected | no | Known popups to dismiss: {id | text | label} to tap, or {screen, button: "back"}. Any other unexpected screen stops the run and reports where. |
The intent is the source of truth the step list implements, in plain language. It is kept with every version of the shortcut (shortcut_versions, list_shortcuts), shown to the owner on the shortcut's page and in the notice when it goes live, and given to a bot that repairs a failed run (task_intent in the failed step's question). It is the basis for rebuilding the shortcut later, with other ids or for a changed app. A list without one, or with one that says nothing ("TBD", two words), is refused.
| Key | Required | What |
|---|---|---|
goal | yes | Why this shortcut exists, in the person's terms (4+ words). |
success | yes | What a good run ends with, in plain words (3+ words; a sentence or a list). The success check is how the code tests it. |
steps | yes | The plain step-by-step description of what happens on the phone (2+ steps; a list, or one text numbered or one per line). The step list implements it; per-step intents stay. |
notes | no | Anything a person rebuilding it should know (1-1000 characters). |
constraints | no | Rules every version must keep ("never delete anything"). |
judgment | no | What the AI decides in this shortcut, in plain sentences (up to 20, each up to 300 characters), e.g. "whether the screen shows the attendance for today". Given to the AI at every judge step and repair (docs/ai-runs.md). |
Lengths (refused with the limit when longer): intent goal 4-500 characters, success 3-600, each of up to 60 steps and 20 constraints / judgment sentences up to 300, notes up to 1000; a step's own intent 3-120 printable characters. Any other text value in a list is at most 2000 characters, except a script step's code (below).
A shortcut says only what Bot Phone does on the phone (Liu Chao, Nov 29 2026): after_handoff and consumer were removed and are refused as unknown keys. What your bot does with the files afterwards is up to your bot.
Each step is {"do": <kind>, ..., "intent": "..."}. Blocks nest at most 3 deep; at most 200 steps.
| Step | Fields | What it does |
|---|---|---|
start | fresh (default true) | First step only: close the app, open it, wait for first_screen (what app_close + app_open + screen_wait do live). |
screen_wait | screen, target {id, text}, timeout_s (1-60, default 20) | Wait until the screen (activity) is in front and/or an element with this id is on it. With text: that element (or, without id, any element) shows exactly this text, e.g. {target: {id: "choose_menu", text: "Choose"}} once saving is over. |
screen_wait | s (0.1-30) | A plain pause. A pause right before a wait is refused. |
screen_wait | dismiss: true | Look once for a known popup (on_unexpected) and dismiss it. |
screen_wait | any (2-8 selectors), timeout_s (1-60, default 20), as | Wait until one of the elements shows (0.33.0; engine name wait_any), e.g. {"do": "screen_wait", "any": [{"text": "Saved"}, {"id": "btn_retry"}], "timeout_s": 30, "as": "outcome"}. as holds which one showed: "1" for the first in the list, "2" for the second (the first in list order when several show); the run's counts say it too (wait_any_1, ...). Known popups are dismissed. None in time: the run stops with what the phone shows. Use it instead of a fixed pause. |
screen_tap | target: {id, text, nth, in} | Tap the element with this resource id (text: the fallback, or which of several). in: only elements inside that section count (below). |
screen_tap | target: {text} | {text_input} | {label} | {x, y} (raw, flagged) | {item: true}; label (the plan's name for a raw tap) | text_input: the element whose text is an input's value. Inside for_each: {target: {item: true}} taps the item; {target: {item: true, id}} taps the element with that id in the item's row (the for_each needs as). The live verify (wait for the screen to change, never a second tap) has no step field: a saved run never repeats a tap, and the next screen_wait is its check. count and hold_ms are live only for now. |
screen_scroll | until {id | text}, contains, max_swipes (1-30), direction (down/up), in | Swipe until it shows (with in: inside that section). |
screen_swipe | from [x,y], to [x,y], ms | Raw, flagged; 2 in a row are refused (use screen_scroll). hold_ms (drag) is live only for now. |
device_press | button | back, enter, tab, delete, ... (not home; never power). |
screen_type | input, target {id} | Type an input's value into the field with that id. Never a password, PIN or code field. Live, screen_type {text} types fixed text. |
screen_read | target {id}, as | The first whole number in that element's text ("Chosen: 3" -> 3) into the name as. Allowed inside for_each: it is read per item. Live, screen_read {target: {id}, as} answers the same value. |
screen_read | read: "text", target ({id} or a selector), in, pattern, as | The element's text (else its label) into the name as; with pattern (a regex matching the whole text) its first group. pattern, in or a selector target imply read: "text". A later pull's time can name it (below). Try it live with the screen_read tool and the same target + pattern (it answers text). (Engine word: read_text.) |
file_rename, file_set_date | files, date, name, pattern; from_name, time | Right after a pull: name its files by the row's date and write that date into them (below, "Files with dates"). The live tools of the same names take the same parameters. |
pull | dir, ext, expect, date, name, time, time_by, pattern, wait_s, retry_tap, hold | Collect the files that appeared in dir (a folder under /sdcard/) since the start, ending with ext (one string like ".jpg"; leave it out for every file). expect: a number to wait for, or a screen_read as name: then this pull must collect exactly that many or the run fails. date (inside a dated for_each, its as): every file of this pull gets the row's date (below). The live tools for the same job: file_list with since + wait_s, then file_get {as: "link"} with paths or files (one zip link); a pull's files are the run's held files ({run: "this"}), encrypted at rest and fetched with run_result. 0.40.0: wait_s (1-120) and retry_tap ({id} and/or {text}, with a number expect): wait that long for expect files, tap the target once and wait again, and fail the run if still fewer ("pull: 0 of 1 new file(s) in /sdcard/Pictures after 10 s and one retry tap"); without them a number expect only waits (30 s) as before. hold: true keeps the files unnamed for a later script step (below). |
script | code, as, timeout_s | 0.40.0: run a Python script (the scripts sandbox, as try_script) inside the run: below "Script steps". |
for_each | id, steps; optional max (every item by default: no need to size it); as, date, year_id, since, scroll; or match, in, order, dedupe, stop_before | Repeat the steps for each element with this id. Without as: the rows on the screen, by position. With as: rows top to bottom, told apart by their text, which goes into the name as (below). With match / in: any elements matching a selector inside a section, in screen order, scrolling for more (below). |
repeat | times (1-1000) and/or until_screen, steps | A bounded loop. A repeat that only waits or swipes is refused. |
if_screen | screen, then, else | A choice you made by looking. |
judge | question (plain, up to 300 characters), answers (2-8 short words like yes, no, skip), cases {answer: [steps]} | A decision that needs judgment (docs/ai-runs.md): the AI sees the screen as text and must pick one of answers (asked again once if it does not); the steps under that answer run next (an answer without a case does nothing). Needs an AI key in Settings: without one, or at the run's AI cost cap, the run stops and says why. Every answer is audited with its inputs and cost and shown in run_result under ai. |
AI repair (docs/ai-runs.md, option B). When a step fails in a real run and the owner has an AI key with repair on, the AI first tries to reach that step's goal with neutral phone actions (tap, swipe, scroll, press, wait, type an input, reopen the app) through the runner's own guards, at most 2 repairs a run and 10 actions each. If it gets there the run goes on, and the actions it took become a new draft version of the shortcut (run_result -> ai.repairs[].draft): check it with check_shortcut_draft, which publishes it under the usual rules. The live shortcut never changes by itself. If the AI gives up, your bot is asked as before (step_failed).
for_each with as){"do": "for_each", "id": "entry_date", "as": "day", "date": "D MMM", "year_id": "year_label", "since": "last_sync",
"scroll": 10, "intent": "each day since the last sync", "steps": [
{"do": "screen_tap", "target": {"id": "choose_menu", "text": "Choose"}, "intent": "start choosing"},
{"do": "screen_tap", "target": {"item": true, "id": "row_choose_all"}, "intent": "choose every picture of this day"},
{"do": "screen_read", "target": {"id": "chosen_count"}, "as": "chosen", "intent": "read the Chosen counter"},
{"do": "screen_tap", "target": {"id": "save_to_device"}, "intent": "save them to the phone"},
{"do": "screen_wait", "target": {"id": "choose_menu", "text": "Choose"}, "intent": "wait until saving is over"},
{"do": "pull", "dir": "/sdcard/Pictures", "ext": ".jpg", "expect": "chosen", "date": "day", "name": "picture",
"time": "12:00", "intent": "collect this day's pictures"}]}
as: the row's text goes into this name (a new lower_case name).
date: the rows show a date in this format: MMM D ("Nov 26"), D MMM, or one with a year (YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY, D MMM YYYY, DD MMM YYYY, MMM D, YYYY, D/M/YYYY). Then as holds the date as YYYY-MM-DD. Without a year in the text, the year comes from the nearest year_id heading above the row (within 260 px). Without one, it is the latest such date on or before the run's day, so "Dec 30" read on Jan 2 is last year's. Relative times that apps show for recent items are read too, on the run's clock in the list's time_zone: just now, now, today, yesterday, N seconds/minutes/hours ago, N days ago, N weeks ago (also a/an/one for N), the short forms 30s, 5m, 1h, 2d, 1w (with or without ago), and the Chinese 刚刚, 今天, 昨天, 前天, N秒前, N分钟前, N小时前, N天前, N周前. Seconds, minutes and hours count back from the moment the row is read, so "2 hours ago" read at 01:00 is yesterday; days and weeks count calendar days back from today. Months and years ("2 months ago") are not exact and are not read. Any other text that is not a date stops the run with a clear message, unless a skip_if / only_if passes that row over (below).
since: a date input. The rows are newest first, and the loop stops at the first row dated before it. With default: "since_last_run" that is the day before the last synced day of this shortcut (what its last delivered run handed off; the first time, 14 days back). The input's value stays in Bot Phone: the shortcut only learns whether a row is in range. A job or run_task can pass the input to override it.
scroll: when no new row is left on the screen, slow swipes down bring more: at most this many in all (1-30), and none once the list stops moving.
since (its swipes run out, the run's time limit is near: no new row starts when about 90 s plus 1.5 rows' time is left, or an optional max is reached: then the loop reads the next row's date without doing anything, so a loop that ends exactly at its max is not counted as stopped early), the result says more_to_fetch: true with more_to_fetch_why. Once that run is delivered, the last synced day does not move past what was done, and the next run passes over the dates already done (no actions) and goes on from where this one stopped. When a run reaches the since row (or the end of the list), the last synced day moves to the newest date done. dates in the result: done (pulled), stopped_at (the row before since that ended the loop; not pulled) and skipped (done by an earlier run).
screen_tap {target: {item: true, id}}: the element with that id whose height overlaps the row's (the nearest), found again wherever the screen moved the row.
A pull with date gives every file of that pull the row's date: one date per download batch. After the pull, on Bot Phone's side (never on the phone), each file is named by pattern plus its extension (.jpg for a JPEG). NN counts per date and name, after what this shortcut already delivered. The date is written into the file (EXIF DateTimeOriginal, CreateDate, ModifyDate and OffsetTime*, plus the file mtime) in the list's time_zone (default UTC) and goes in the handoff manifest (date, kind, taken_at). Every value is the list's own; nothing about any one app is built into Bot Phone.
time: "12:00" (the default): 12:00:01, 12:00:02, ...
time: "08:00/20:00": the first file at 08:00:01, the others at 20:00:NN (when the first file of a batch is different from the rest).
name: a lower-case word (default file); it is also the item's kind in the result and the manifest.
pattern: the file name without extension, from letters, digits, _ . - and {date} {name} {nn}; it needs {date}. Default {date}_{name}_{nn} (for example 2026-11-26_picture_01.jpg). Without {nn}, one file per date and name; nn: N fixes the first number (see "One day per page" below).
Without date, files keep the app's names and nothing in them changes. The manifest has the run's day.
The same thing with the file tools (what you tried live is what you save). Right after the pull, inside the dated for_each:
{"do": "pull", "dir": "/sdcard/Pictures", "ext": ".jpg", "expect": "chosen", "intent": "collect this date's pictures"},
{"do": "file_rename", "files": {"run": "this"}, "date": "day", "name": "picture", "pattern": "{date}_{name}_{nn}",
"intent": "name them by their date"},
{"do": "file_set_date", "files": {"run": "this"}, "from_name": "{date}_{name}_{nn}", "time": "08:00/20:00",
"intent": "write the date into them"}
Live, file_rename {phone, files, date, name, pattern, start_nn} and file_set_date {phone, files, date | from_name, time, tz} do the same on your own files at once (fetched, put or edited by you; any other file needs the owner's approval) (files = {paths: [...]} or {dir, glob}; preview: true shows the plan). In a step list files is {run: "this"} (the pull's files) or left out, the two steps go together, the zone is the list's time_zone, and NN continues after what the shortcut already delivered.
match, in; Liu Chao, Nov 29 2026 16:32 SGT)for_each can repeat over any elements, not only rows sharing an id: the elements matching a selector inside a section of the screen, in screen order, scrolling inside the section for more. Nothing in it is tied to one app. The same selector and section shapes work on the live tools, so a bot tries it live first: screen_read and screen_tap take the selector as target with in and order (screen_read numbers the elements n in the order the loop walks them; screen_tap {target: {..., nth, in, order}} taps the nth), and screen_scroll takes in.
selector {"id" | "id_re": str, "text" | "text_re": str, "label" | "label_re": str} (label: the accessibility label)
at least one part; every given part must match. id may have the package:id/ prefix or not.
*_re: a regular expression that must match the whole value (at most 100 characters;
nested repeats like (a+)+ are refused).
section {"container": selector, "nth": 1-50}
the bounds of the nth element (screen order) matching container, e.g. a grid's resource id.
| {"heading": selector, "until": selector, "nth": 1-50}
from the bottom of the nth heading down to the next element below it matching until
(default: the next element with the heading's id; a heading without id needs until),
or to the bottom of the screen. When the heading scrolls away above, the section goes on
from the top of the screen down to the next until element.
| {"heading": "row", "until": selector}
steps only, inside a for_each with as: the section under the current row of that loop
(e.g. each day's photos under the day heading the outer loop is on).
for_each {"do": "for_each",
"match": selector, (or "id": "<resource id>", the same as {"id": ...})
"in": section, optional: the whole screen without it
"order": "screen" | "reverse", screen (default): rows top to bottom, each row left to right
(row-major for a grid; elements whose vertical middles are
within half a height share a row); reverse: the other way
(it then scrolls up)
"dedupe": "position" | "bounds" | "text",
how an item is told apart: position (default: its place in the
content, steady while the list scrolls; the scroll distance is
measured by texts on the screen), bounds (its place on the
screen: lists that do not scroll), text (its text, else its
description)
"scroll": 1-30, swipes in all, inside the section, to reach more items
"max": 1-1000, at most this many items (default: every one)
"stop_before": selector, items from the first element matching it on are not taken
"as": "name", optional: the item's text (else description) into a name
"steps": [...]} {"do": "screen_tap", "target": {"item": true}} taps the current item, found again
by its key wherever the screen is now
The loop ends when the section's end is on the screen and every item above it was done (section), at a stop_before element, when scroll is used up, or when the list stops moving. A section that is not on the screen stops the run with that reason (a missing section is never read as an empty one). date, year_id and since stay with the for_each by id (dated rows); put a selector loop inside one.
Example (one thumbnail per download in each day's section; made-up ids):
{"do": "for_each", "id": "day_label", "as": "day", "date": "MMM D", "since": "last_sync", "scroll": 10,
"intent": "each day since the last sync", "steps": [
{"do": "for_each", "match": {"id": "thumb"}, "in": {"heading": "row"}, "scroll": 5,
"intent": "each photo of that day", "steps": [
{"do": "screen_tap", "target": {"item": true}, "intent": "open the photo"},
{"do": "screen_tap", "target": {"id": "download"}, "intent": "download it"},
{"do": "device_press", "button": "back", "intent": "back to the list"},
{"do": "screen_wait", "target": {"id": "day_label"}, "intent": "wait for the list"}]},
{"do": "pull", "dir": "/sdcard/Pictures", "ext": ".jpg", "date": "day", "name": "photo", "intent": "collect"}]}
Another app: {"do": "for_each", "match": {"id": "card", "label_re": ".*\\$\\d+"}, "in": {"container": {"id": "grid_reco"}}, "dedupe": "bounds", ...} walks the priced cards of one grid, two per row, left to right.
After a fresh start Android can put its own question over the app ("Allow ... to send you notifications?"). While waiting (screen_wait, start), Bot Phone answers Android's permission controller dialog with its Don't allow button: never Allow, and a dialog without a deny button is left alone (the run stops as before). Only that system dialog counts; the app's own popups still need on_unexpected.dismiss. Every answer is recorded: a run warning, counts.system_dialogs_denied and system_dialogs in the try's got; live commands write an audit row bot.system_dialog and return system_dialogs. On by default; turn it off with "on_unexpected": {"system_dialogs": false} (live: system_dialogs: false). The trusted side looks and taps; the shortcut's code only asks.
pull collects its new files in the order they were written to the phone (file mtime, to the nanosecond where the phone's stat gives it, then the path), so files from a burst of downloads keep their download order and NN in <date>_<name>_NN follows it. The live file_list uses the same order.
screen_read {as} inside any loop (also the inner loop of a dated loop) adds up per item; success.files_equal compares the run's files with that sum (with a list of names: the sum of the sums). pull.expect compares one pull with the number read last.
time: "08:30/16:30" gives the first file the first time (08:30:01) and the others the second (16:30:NN; NN keeps counting per date and name, so names and times stay unique). Which file is "first" is time_by on the pull: date (default, unchanged: the first file of that date and name in the run and the ledger), row (the first file collected under each row of the dated for_each, so two rows with the same date each get their own first), or pull (the first file of each pull). Nothing app-specific.
screen_read {read: "text", target: {id} | a selector, in, as, pattern} (engine word read_text) stores a text from the screen (the element's text, else its description; with pattern, a regex matching the whole text, its first group kept, e.g. "Drop-off (\\d{1,2}:\\d{2})") in a name; a later pull takes time: "<name>" or "<name>/16:30" (the first file at the time read, the others at 16:30). 8:05, 08:05, 8.05 and 8h05 read as 08:05; a missing text or one that is not a time stops the run cleanly with what was read. Try it live first: the screen_read tool with target + pattern answers text, what the step would read on that screen.
All generic and deterministic: nothing here knows any app, and no AI decides anything.
**One day per page (next with date).** For a screen that shows one day and an arrow to the day before. id is the date heading, next is the button (a selector). The first turn is the day on the screen. Each later turn taps next and waits up to 10 s for the heading to change. The loop stops at the first day before since, or after max days (default 366). It also stops if the button is gone, the heading does not change, or the date does not go back. Those stops, its max and the time limit all give more_to_fetch (more_to_fetch_why). A long backlog passes over the days already done, as with dated rows. Not with scroll or year_id, and no {item: true} taps.
{"do": "for_each", "id": "day_title", "as": "day", "date": "D MMM YYYY", "since": "from_day",
"next": {"id": "btn_prev_day"}, "intent": "each day back to from_day", "steps": [
{"do": "screen_read", "target": {"id": "start_time"}, "as": "start", "optional": true,
"intent": "read the start time (may be empty)"},
{"do": "screen_tap", "target": {"id": "btn_save_all"}, "intent": "download this day's photos"},
{"do": "pull", "dir": "/sdcard/Pictures", "ext": ".jpg", "date": "day", "name": "visit", "time": "start",
"time_default": "08:30:01", "intent": "collect them, dated at the start time"}]}
**Pages of a viewer (next without date).** Steps through the pages of a viewer, such as a full-screen photo viewer. Each turn after the first turns the page and waits for it to change. The loop ends when turns stop changing the page (the last photo), a page comes back (a viewer that wraps around), the button is gone, or after max pages (default 100). next is one of:
{"id": "iv_next"};
{"swipe": "left"} (also right, up, down). It is a fast fling (200 ms) across the middle of the screen, from 88% to 12% of its width (78% to 22% of its height for up / down), clear of the side back-gesture zones and the system bars, or across the loop's in: {"container": ...} when given (0.35.0; before, 80% to 20% over 300 ms, which a photo viewer's pager can drag part way and snap back);
{"swipe": {"from": [950, 1200], "to": [130, 1200]}}. All four numbers are whole pixels of the screen (screen_capture and screen_read use the same ones), or all are fractions 0-1 of the screen (or of the in container), e.g. {"from": [0.9, 0.5], "to": [0.1, 0.5]}. Every page-turn swipe takes 200 ms. Try it live with screen_swipe first (with ms: 200).
Either kind of next also takes (0.35.0):
retries (0-5, default 2): when a turn changes nothing (some viewers ignore a swipe while a photo loads), the loop waits retry_wait_s, looks again (a late change counts, with no extra swipe), and otherwise turns again. It ends only after retries + 1 turns in a row that changed nothing. 0 ends at the first one (the 0.33 behaviour).
retry_wait_s (0.5-5, default 1.5): that wait, in seconds.
Each turn waits up to 4 s for the page to change while it has retries left; the last try waits what is left of 90 s for the whole turn (at least 10 s). These are wall-clock seconds (0.36.1; before, only the pauses between looks counted, and a look takes seconds, so a "4 s" try took about 36 s). While it waits, the loop takes cheap screenshots and reads the whole screen only when the picture moved; a change counts only when that full look differs from the last page and from the screen just before the turn, and a confirmed change ends the turn at once (no more swipes). For example {"swipe": "left", "retries": 3, "retry_wait_s": 2}. max and the run's time limit still bound the loop, and before each turn the loop checks the time left: when the limit is near it ends there, so the steps after it (close the viewer, pull) still run and the run finishes cleanly with stopped: time limit and a resume point (the current row's date is not counted as done, so the next run does it again). The same check runs before each row of a loop over rows without a date and each item of a loop over a selector; dated row loops already stop starting rows near the limit. Files the app saved during a run that the run never pulled are listed in its result (selfserve.left_on_phone) and recorded with its phone copies, so the cleanup treats them like the pulled ones.
id (optional) is what tells the pages apart, such as a 3 / 13 counter; as (only with id) holds its text. Without id, the whole screen tells the pages apart, with no AI involved:
3/13, 3 / 13 or 3 of 13) decides alone;
The status bar never counts (its clock changes on its own). After each turn the page must also hold still (two looks 0.5 s apart the same, up to 5 s more), so a photo that is still loading counts as one page. The run's counts say which part told the pages apart (viewer_by_counter, viewer_by_elements, viewer_by_pixels) and how many turns were tried again (viewer_retries). When the viewer was opened from a post's grid (tap_id in the row), the grid's size is the post's expected photo count. 0.38.1: it is exact only when counted after the grid was dragged into view (no "+N" badge, fewer than 9 thumbnails, every thumbnail whole, and the next post's heading or the post's own text right under the grid; nothing in the screen's bottom 10%, where tab bars sit, counts). A count is never the only reason to stop: at the count the viewer turns once more, and a new photo there means the count was wrong (it goes on, the post reports count_was_wrong). Only a post that reached an exact count needs that turn: each post's report says probe_needed (true only then) and probed (true/false when needed, null when not). A post with an "at least" count (a full grid of 9, a "+N" badge, a grid cut by the screen's edge) or none already runs to the real end (no change, a counter at N / N, a page that came back), so it reports probe_needed: false, probed: null. A post with a wrong count, or one that stopped at its count without that one more turn, is warned and makes the check short (not a full pass). in here takes only {container}, and only with a swipe. Not with scroll, since, year_id, dedupe or row filters.
{"do": "for_each", "next": {"swipe": "left", "retries": 3}, "max": 60, "intent": "each photo of the post", "steps": [
{"do": "screen_tap", "target": {"id": "btn_save"}, "intent": "save this photo"}]}
{"do": "for_each", "id": "tv_counter", "next": {"id": "iv_next"}, "max": 50, "intent": "each photo of the post",
"steps": [{"do": "screen_tap", "target": {"id": "btn_save"}, "intent": "save this photo"}]}
**A sideways strip (direction: "right").** For a generic for_each with in: {container}, for example thumbnails with 3 visible. It swipes the strip right to left, half its width at a time, and walks each item once. Items are told apart by their place in the strip. With no text on the screen, the shift is measured by lining up the items themselves. The loop ends when a swipe moves nothing or after scroll swipes.
{"do": "for_each", "match": {"id": "iv_thumb"}, "in": {"container": {"id": "photo_strip"}}, "direction": "right",
"scroll": 20, "intent": "each thumbnail", "steps": [
{"do": "screen_tap", "target": {"item": true}, "intent": "open it"}]}
**Rows with the same text (dedupe: "position").** For a for_each over rows by id with as. Rows are told apart by their place in the list, which stays steady while it scrolls, so two posts of one date are both walked. {item: true} taps find that same row again. Without it, rows are told apart by their text, as before.
**Row filters (skip_if, only_if).** A selector for an element in the row's block: from the row down to the next row. Rows with a skip_if match, or without an only_if match, are passed over without any steps. A dated row still counts for since, so a skipped row before since still ends the loop. The element must be on the screen with the row. The row's own element is part of its block, so "skip_if": {"id": "<the row id>", "text_re": ".*ago"} passes over rows whose own text matches. A row that is passed over and whose text is not a date (for example "Pinned") is skipped instead of stopping the run.
{"do": "for_each", "id": "tv_post_date", "as": "day", "date": "MMM D", "since": "from_day", "scroll": 20,
"dedupe": "position", "skip_if": {"id": "post_kind", "text": "Newsletter"}, "steps": [ ... ]}
The end of a list. A row loop decides that a list has ended only when a swipe changes nothing on the whole screen. Before this, it compared only the row texts, so a tall post whose date heading stayed on the screen read as the end. When the swipes run out first, the loop ends with scroll (more_to_fetch). A dated loop that reaches the true end with no row before since ends with end.
Dates and times from the screen.
screen_read {..., date: "D MMM YYYY"} reads the text as a date, in the same formats as a dated for_each. A pull can then use it as date anywhere after it. A text that is not a date stops the run with what was read.
screen_read {..., optional: true}: a missing or empty text reads as "" and does not stop the run.
pull time:
"HH:MM" gives :NN seconds.
"HH:MM:SS" is exact: the first file gets that time and each further file of the pull one second more.
"HH:MM/HH:MM" gives the first file and the rest different times.
"<name>" or "<name>/HH:MM" uses a time read from the screen. "<name>" alone is exact (0.33.0): the pull's first file gets HH:MM:00 and each further file one second more. The seconds never come from a file's number.
time_default (HH:MM or HH:MM:SS): used when the screen text named by time is empty. A text that is not a time still stops the run.
start_time, else 08:30:01: {"date": "day", "time": "start", "time_default": "08:30:01"}.
end_time, else 18:15:00: {"date": "day", "time": "end", "time_default": "18:15:00"}.
{"do": "screen_read", "target": {"id": "day_title"}, "as": "shown", "date": "D MMM YYYY"}, then {"do": "pull", ..., "date": "shown", ...}.
File numbers.
nn: N numbers this pull's files N, N+1, ... in every run, so the names are the same each time and the destination can dedupe them. Two files with one name in a run stop it. Needs {nn} in the pattern.
pattern without {nn} (for example {date}_{name}) gives one file per date and name. A second such file in the run stops it.
A run of a list with a dated for_each reports one line per row it walked in run_result.rows: {n, loop, date, of_date, files, duplicates, viewers, pages, pull_retry_taps} (n the row's place in the run, of_date its place among the rows of its date, 1 = the first walked, which on a newest-first feed is the newest). counts.pull_retry_taps adds them up. At most 300 rows are listed.
Rows passed over (0.40.2): rows of a dated loop that skip_if / only_if passed over in range are not rows (they do not count in of_date / rows_of_date); they are listed in run_result.passed_over [{loop, date, row, why}]. An only_if that finds no match on the last row on the screen (the rest of its block may be below the edge) looks again after one swipe before passing it over (tr_da24978f3b09 passed a dated post over unopened that way, and its check still matched).
What a check expects of the walk (0.40.2, any list): every row of a dated loop whose steps pull files must pull at least one (or find it a duplicate); a row that pulled nothing fails the check ("row N of LOOP (DATE): listed but its steps pulled no file"). A check that passes is short (it does not publish by itself; publish_shortcut or a full check does) when: inputs narrowed it (as before), a post turned fewer photos than its grid showed, rows were passed over by only_if, or a dated walk ended by its scroll budget, max or the time limit before reaching its since date. These hold with the default range as well as with an explicit from_day.
For what a step cannot say (numbering per post, a time per post, choosing names from what the run saw), a list can end a stretch of steps with a script step:
{"do": "script", "as": "per_post", "code": "def run(bp, inputs):\n ...", "timeout_s": 300,
"intent": "name and date the photos post by post"}
try_script). A list with a script step is refused at draft, revise, try and check elsewhere ("script steps are not on for this account yet"), and a published one whose account loses scripts fails at that step.
try_script (no network, no host paths, the run's token, the checked calls, the same limits; the app and folders are the list's). It is checked when the list is saved and again by the draft check (the same rules as try_script's code check: def run(bp, inputs), no imports outside the allowed ones, at most 64 KB, at most 5 script steps per list). timeout_s 5-1800 (default: the run's time left).
try_script's): up to 64 KB, newlines and tabs allowed, Windows line ends (\r\n) stored as \n, no other control characters. The whole list's JSON is at most 64 KB, so the scripts share that. (0.40.0-0.40.1 drafted and checked a longer script but refused it at publish with "strings are at most 2000 characters": sc_3a120087b165.) A draft or revise now also runs the publish check on the compiled files, so a list that drafts publishes.
$file:**: Bot Phone takes the code text as sent. A client that replaces a whole string value "$file:/path/script.py" with that file's text before the call (some agent tools do) can be used to send it; a literal $file:... string reaching Bot Phone is just text and fails the check ("define run(bp, inputs)").
bp.context): step, vars (the values of the for_each as names and read numbers/texts in scope where the step is), rows (the per-row summary above, each with rows_of_date and date_complete), dates ([{loop, date, rows, complete}]: complete = the loop went past that date, so no row of it is left), files (the held files not saved yet: {h, name, size, sha256, date, row, i, order}, row = the row's n, i = the file's place in its row counting duplicates, so it is the same in every run), results (earlier script steps' results by their as) and inputs (the list's date and number inputs, resolved).
bp.tap, bp.collect, ...), and for the held files bp.save(handles, date, time, name, pattern, nn, step_s) (named and dated as a dated pull) and bp.skip(handles) (left out of this run: not handed off, not remembered, so the next run collects them again).
as for later script steps and in run_result.scripts ([{step, script, as, end, result, saved, skipped, ms, calls, log, error}]). An error or a timeout fails the run with the script's error type and line. Held files no script step saved are handed off with plain names (NNN_name) and a warning.
hold: true**: inside a loop, the pull keeps its files unnamed (with the row's date when date is given) for a later script step. name, time, pattern, nn, time_by do not go with it, and a list with a hold needs a script step after it.
bp.save times with seconds: time: "HH:MM:SS" dates file i of that call (i = 0, 1, ...) exactly HH:MM:SS + i * step_s seconds (step_s 0-3600, default 1); past 23:59:59 is refused. time: "HH:MM" is as before (HH:MM:NN). step_s goes only with HH:MM:SS. pattern may hold literal letters and digits ({date}_post2_photo_{nn}), nn is the first file's number.
Example: one name and time block per post (a dated feed, newest first; examples/per_post_feed.py, replayed on tr_be593160cd39's shape in platform/tests/test_per_post_script.py):
{"do": "for_each", "id": "tv_publish_time", "as": "post_day", "date": "YYYY-MM-DD", "since": "from_day",
"dedupe": "position", "only_if": "<unchanged>", "steps": [
"... open the post, save its photos (unchanged) ...",
{"do": "pull", "dir": "/sdcard/Pictures", "ext": ".jpg", "date": "post_day", "hold": true,
"intent": "hold this post's photos for the naming script"}]},
{"do": "script", "as": "per_post", "code": "<examples/per_post_feed.py>", "intent": "name and date the photos per post"}
Post k of a date (k = 1 for its oldest post) is {date}_post{k}_photo_{nn}.jpg, dated 12:00 + (k - 1) x 30 min (15 min when the date has more than 10 posts) + nn seconds: on 2026-11-30's two posts the older (10 photos) is post1_photo_01..10 at 12:00:01-12:00:10, the newer (8) post2_photo_01..08 at 12:30:01-12:30:08. A date the run did not finish is skipped (fetched again next run with its full post count).
Instead of a step list, draft_shortcut takes steps: {kind: "composite", ...}: no steps, no app, only the shortcuts to run in order with one schedule and one combined result.
{"kind": "composite", "goal": "sync activities, then attendance",
"inputs": {"from_day": {"type": "date", "default": "today-2"}},
"children": [
{"shortcut": "daily_sync", "version": "live", "inputs": {"from_day": "$from_day"}},
{"shortcut": "attendance_sync", "version": 3, "inputs": {"last_sync": "$from_day"},
"on_failure": "continue_and_report", "label": "Attendance"}]}
children: 1-8, each a published shortcut of the account (version: "live" or a number), at most 2 levels of composites, no cycles. "$name" passes a composite input through (renaming is fine); other values are literals.
since). A child's inputs keys are the names that child declares (attendance_sync above declares last_sync; a step-list shortcut never declares a reserved name, so {"since": ...} fits only a built-in shortcut that has a since input). Anything else is a problem that lists the child's inputs.
on_failure: stop (default, later children are skipped) or continue_and_report. Combined status: ok (every child ok), partial (at least one child ok, others failed or skipped), failed (none ok).
on_partial (0.30.0): hand_off (default: the ok children's files are handed off, verdict: partial) or fail (one verdict: any failed child fails the whole run, nothing is handed off, no cursor moves). run_result shows composite.verdict (ok, partial or failed).
queued with step waiting for <phone> and composite.queued {phone, behind, since}. It takes its phones when they are free, first come first served among waiting composites, then runs; waited_s says how long it waited. It can be cancelled while it waits, and after 60 min it fails without touching a phone. A composite's own children never wait for it. A plain shortcut started on a busy phone is still refused (409 busy), and a scheduled catch-up retries it.
part_of {run_id, shortcut, child_index}, the composite run that started it.
phone, else the run's phone (given to run_shortcut, or set with update_shortcut), else the child shortcut's own phone (its settings, else the phone its live version was published on). So a composite that names no phone needs no phone to run or to be scheduled; when all its children use one phone, get_shortcut shows it as the composite's phone (phone_from: children). Access to every phone and app is checked at check time and again at every run start. Every phone is locked for the whole run.
time_limit_min if the composite sets one (run_limit_from: composite) or the owner's run limit (owner), else the children's limits added up, at most 120 minutes (children, recomputed at every run start). get_shortcut shows run_limit_min, run_limit_from and max_runs_per_day: the owner's daily cap (max_runs_per_day_from: daily_cap, counted once). shortcut.json no longer stores a runs-a-day number (0.30.0), so the two can't disagree.
check_shortcut_draft is a static check (no phone, no replay; try_steps refuses a composite with composite_no_try). Its powers are the union of the children's, so publish_shortcut (or the check's publish: true) makes it live unless it adds a phone no child uses.
run_result: composite.children[] (status, timing, summary, run id) and one file list deduped by sha256, each file with child (and also when another child made the same file). One run_report on the composite run; its children can't be reported or cancelled alone (409 part_of_composite).
{"type": "text" | "date" | "number", "note", "format", "default"}. Values are given per run (inputs) and never stored in the shortcut.
YYYY-MM-DD, today, today-N, since_last_run or since_last_ok (0.30.0).
since_last_ok: the day (SGT) on which this shortcut's last fully good run started, inclusive. A fully good run was reported done with every file delivered, nothing left to fetch and, for a composite, verdict ok. The first time, it is 14 days back. It is resolved when the run starts, so the run and every child see one fixed date. A sync then starts from its last fully good run, even after a partial one. The overlap with that day is expected: destinations dedupe.
format: how a date is typed or matched (screen_type, screen_tap {target: {text_input}}). One of YYYY-MM-DD, DD/MM/YYYY, MM/DD/YYYY, D MMM YYYY, DD MMM YYYY, MMM D, YYYY, D/M/YYYY, MMM D.
child, dry_run, max_items, mode, since. Use e.g. last_sync or from_date with default: since_last_run instead of since.
{"end_screen": "...", "files": N | "files_min": N | "files_equal": name or [names], "by_ext": {".jpg": N}}
files_equal: the files collected must equal the number screen_read {as} read. With a list, it is their sum. A number read inside for_each adds up over the items.
files_equal only as a verified quiet day: every named counter was actually read on the screen (and read 0), or the dated for_each around it read a row dated before its since (the list was read down to the boundary and nothing in range was there). A loop that ended at the list's end, its swipes, its max or the time limit, or a counter never read, proves nothing and fails the check (a broken run must not look like a quiet day). The same rule lets a verified zero-result check run publish a draft.
files_min with files_equal is refused (the verified-zero rule already covers files_min: 0).
pull {expect: <name>} (that pull must collect exactly that many).
by_ext is checked only when given.
for_each. Every fix is named: rewrite the list, no need to plan again.
needs_fix with the warnings in findings.
for_each walks every item (an optional max stops it sooner) and repeat with until_screen needs no times. Each wait keeps its own timeout. A run has one backstop: it is stopped if it is still going after its time limit, 1 hour unless the owner sets another on the shortcut (5 minutes to 4 hours). A dated walk ends cleanly before that and says more_to_fetch, so the next run goes on from there. Dry runs use the same 1 hour.
The same text bots get from the MCP tool step_list_reference. Terms · Privacy