Bot Phone · plain text

Step lists: the reference

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).

Scripts instead of steps (beta, Dec 1 2026)

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.

What a shortcut is (Nov 29 2026)

How to use it

  1. Work it out live with the phone tools: 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.
  2. Write the list. Check it with 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).
  3. Dry run it with 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.
  4. Submit it with 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).
  5. 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).

The list

{"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"}}
KeyRequiredWhat
appyesThe Android package.
launchyesThe start activity, package/.Activity (for example the screen screen_read {only: "app"} shows right after app_open).
first_screenadvisedThe activity the app opens on (default: launch's class name).
stepsyessteps[0] is {"do": "start"}. Every step has an intent: a few plain words on what it is for.
intentyesThe shortcut's intent (below): why, what success looks like, the plain steps the list implements, and what happens downstream.
time_zonenoAn IANA zone (Europe/Berlin). Dated files get their time in it, and an input's "today" is that zone's day. Default UTC.
successyesHow a run shows it reached the goal (below).
goalnoShown to the person next to what the run really checks.
inputsnoPer-run values (below). Every input must be used by a step.
on_unexpectednoKnown popups to dismiss: {id | text | label} to tap, or {screen, button: "back"}. Any other unexpected screen stops the run and reports where.

The intent (required)

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.

KeyRequiredWhat
goalyesWhy this shortcut exists, in the person's terms (4+ words).
successyesWhat a good run ends with, in plain words (3+ words; a sentence or a list). The success check is how the code tests it.
stepsyesThe 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.
notesnoAnything a person rebuilding it should know (1-1000 characters).
constraintsnoRules every version must keep ("never delete anything").
judgmentnoWhat 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.

Steps

Each step is {"do": <kind>, ..., "intent": "..."}. Blocks nest at most 3 deep; at most 200 steps.

StepFieldsWhat it does
startfresh (default true)First step only: close the app, open it, wait for first_screen (what app_close + app_open + screen_wait do live).
screen_waitscreen, 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_waits (0.1-30)A plain pause. A pause right before a wait is refused.
screen_waitdismiss: trueLook once for a known popup (on_unexpected) and dismiss it.
screen_waitany (2-8 selectors), timeout_s (1-60, default 20), asWait 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_taptarget: {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_taptarget: {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_scrolluntil {id | text}, contains, max_swipes (1-30), direction (down/up), inSwipe until it shows (with in: inside that section).
screen_swipefrom [x,y], to [x,y], msRaw, flagged; 2 in a row are refused (use screen_scroll). hold_ms (drag) is live only for now.
device_pressbuttonback, enter, tab, delete, ... (not home; never power).
screen_typeinput, 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_readtarget {id}, asThe 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_readread: "text", target ({id} or a selector), in, pattern, asThe 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_datefiles, date, name, pattern; from_name, timeRight 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.
pulldir, ext, expect, date, name, time, time_by, pattern, wait_s, retry_tap, holdCollect 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).
scriptcode, as, timeout_s0.40.0: run a Python script (the scripts sandbox, as try_script) inside the run: below "Script steps".
for_eachid, steps; optional max (every item by default: no need to size it); as, date, year_id, since, scroll; or match, in, order, dedupe, stop_beforeRepeat 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).
repeattimes (1-1000) and/or until_screen, stepsA bounded loop. A repeat that only waits or swipes is refused.
if_screenscreen, then, elseA choice you made by looking.
judgequestion (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).

Walking a dated list (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"}]}

Files with dates

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.

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.

Any elements inside a section (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.

Android's permission dialogs

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 order, counters in nested loops, and a time per item (Nov 29 2026 17:46 SGT)

One day per page, viewers, strips and rows (Nov 30 2026, 0.30.0)

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:

Either kind of next also takes (0.35.0):

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:

  1. a page counter on the screen (exactly one text like 3/13, 3 / 13 or 3 of 13) decides alone;
  2. otherwise the screen's elements (ids, texts, labels and places, the photo's frame too) and a small downscaled grey picture of the screen (24 x 48 cells): a change in either is a new page. The pictures are compared with SSIM (scikit-image; same page at 0.85 or more), so small differences, such as a loading spinner or a toast, do not count. Viewers whose photos all have the same size and no counter (only the picture tells them apart) need this picture.

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.

File numbers.

Per-row summary (FR-2, 0.40.0)

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.

Script steps (0.40.0; Liu Chao's decision Dec 1 2026 09:22 SGT, FR-1)

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"}

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).

Composites: one shortcut that runs others (Nov 29 2026; composite-shortcuts.md)

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"}]}

Inputs

{"type": "text" | "date" | "number", "note", "format", "default"}. Values are given per run (inputs) and never stored in the shortcut.

Success

{"end_screen": "...", "files": N | "files_min": N | "files_equal": name or [names], "by_ext": {".jpg": N}}

Gates and flags

The same text bots get from the MCP tool step_list_reference. Terms · Privacy