handful

Routines

After this page, you can make a routine and start it on a schedule, from a program on this computer, or on GitHub pull request, issue and release events. You can also follow each run in the chat and limit what a run can do.

A routine is a saved prompt that a bot runs for you, even while you are away. It runs on its triggers: a schedule, a trigger URL and GitHub events. A routine can have any of them, or none. Run now runs it at any time.

Make a routine

  • Ask a bot for anything that repeats, for example “every weekday at 8:10, brief me on my calendar”. The bot saves the routine.
  • Or make one yourself: open the bot panel, then Routines, then New routine. Give it a Name and write What to do each time. The schedule is optional.

The Routines tab shows each routine with its Triggers. Add trigger adds a Schedule, a GitHub event or a Trigger URL. A routine with no trigger shows “Runs only on Run now”. The switch on a routine pauses it or turns it on again. A paused routine runs on no trigger.

  • Runs shows the routine’s run history. See Follow a run.
  • Run now runs the routine at once, with optional text. See Run now with text.
  • Edit changes the name, the prompt, the schedule and the limits.
  • The bin deletes the routine and its triggers.

When you change a routine, the bot gets a notice.

Schedule

A schedule is five cron fields, or @daily, @hourly or @every 2h. Times are this computer’s local time. When the computer’s time zone changes, the next runs move to the new zone, with no restart.

A scheduled run is a turn in the bot’s chat, with the chat’s history and all of the bot’s tools.

  • Two runs must be at least 5 minutes apart.
  • While a scheduled run or a Run now without text waits in the queue, for example for a busy bot or a usage limit, the schedule adds no run. Its times only move the next run. A waiting event run does not stop the schedule.
  • Changing, pausing or deleting a routine drops its runs that have not started.

Run now with text

Run now asks for Text for this run. Then click Run.

  • Without text, the routine runs as on its schedule, even when it is paused.
  • With text, it starts an event run, and the text reaches the run as data. A paused routine does not run with text: turn it on first.

Trigger URL

A trigger URL lets a program on this computer start the routine with text, for example a script at the end of a deploy.

  1. On the routine, click Add trigger, then Trigger URL.
  2. Click Generate token. The dialog shows the URL, the token and a curl example, with Copy URL, Copy token and Copy example.
  3. Copy the token now. Handful keeps only a hash of it, so it cannot show the token again after you close the dialog.

The routine’s Triggers then list Trigger URL. Click it to open the dialog again. Regenerate makes a new token, and Delete token removes the trigger URL. In both cases the old token stops working at once.

The call is a POST to /api/routines/{id}/fire on Handful’s address, 127.0.0.1:7777 by default, with the token in an Authorization: Bearer header:

curl -X POST http://127.0.0.1:7777/api/routines/<routine id>/fire \
  -H "Authorization: Bearer <token>" \
  -H "Content-Type: application/json" \
  -d '{"text": "Deploy 412 finished. Smoke test failed."}'

The body {"text": "…"} is optional, but the Content-Type: application/json header is not: send it also on a call without a body. The text can have at most 65,536 characters. Never put the token in the URL: Handful refuses a call with a query string.

Handful answers 202 with {"runId": "…", "url": "…"}. The url opens the run in Handful. Handful refuses a call with one of these statuses, and the answer says why:

StatusWhen
400The body is not JSON.
401The token is missing or is not this routine’s, or the URL has a query string.
403The call did not come to a loopback address, or it has an Origin header of another site.
404No routine has this id.
409The routine is paused.
413The text is longer than 65,536 characters, or the body is larger than 1 MiB.
415The Content-Type is not application/json, also on a call without a body.
429The routine or this computer reached its hourly limit. The answer says when runs start again.

The trigger URL works only on Handful’s main address. The phone address does not serve it. Only you can turn on a trigger URL, in the app.

GitHub event

A GitHub event trigger runs the routine on each matching pull request, issue or release event of a repository. For example, a routine can triage each new issue.

Handful reads GitHub with the login of the GitHub CLI on this computer. Install the GitHub CLI and sign in with gh auth login first. Handful reads the login’s token for each check and does not store it. Your login must be able to read the repository.

  1. On the routine, click Add trigger, then GitHub event.
  2. Type the Repository as owner/name.
  3. Pick the Event: Pull request, Issue or Release. Pick an Action, or keep “any action”.
  4. To run on some events only, click Add filter. A trigger has at most 10 filters, and all must match.
  5. Keep the two skips on unless you need them off. See Skips.
  6. Click Save. Handful checks the repository with your GitHub login.
EventActions
Pull requestopened, closed, merged, reopened, assigned, unassigned, labeled, unlabeled
Issueopened, closed, reopened, assigned, unassigned, labeled, unlabeled
Releasepublished

A routine can have at most 10 GitHub triggers. An event starts a routine at most once, even when several of its triggers match.

Filters

A filter has a field, an operator and a value.

  • Fields of a pull request: Author, Title, Body, Base branch, Head branch, Labels, Is draft and Is merged. Fields of an issue: Author, Title, Body and Labels. A release has no filters.
  • Operators: equals, contains, starts with, is one of, is not one of and matches regex.
  • Values compare case-sensitively. A value has at most 500 characters.
  • “is one of” and “is not one of” take a comma-separated list.
  • “matches regex” must match the whole value, in Go’s regular expression syntax, and . also matches a line break.
  • Labels matches when any label of the pull request or issue matches. With “is not one of”, it matches when no label is in the list.
  • Is draft and Is merged take only equals, with true or false.

Skips

Both skips are on by default.

  • Skip events by my GitHub account: your own pull requests, merges, labels and issues do not start the routine. Your bots act on GitHub as you, so this skip stops loops.
  • Skip events by bot accounts: events by accounts whose login ends in [bot] do not start the routine.

With either skip off, the form warns: “Your bots act on GitHub as you. With this off, a bot’s own action can start this routine again.”

When events arrive

GitHub events reach Handful within minutes, sometimes hours. Handful checks the events that GitHub lists for each repository. One check serves all triggers on the same repository.

  • A new trigger runs only on events that come after you save it.
  • While Handful is off, GitHub keeps the events. When Handful starts again, it runs the routine on them. If more events came than GitHub keeps, the trigger shows “Some events may be missed: more than GitHub keeps came while Handful was off.”, and the bot’s chat shows a line.
  • When you turn a paused routine on again, its GitHub triggers start from the newest event. Events that came while it was paused do not start it.

Each GitHub trigger in Triggers shows its repository, event and filters, then the state of its checks: “Checked 08:41”, “Waiting for GitHub: rate limit until 09:00”, “Not checked yet”, or why the last check failed. Then it shows “N events filtered out today”: the events that a skip or a filter dropped today. The bin removes the trigger.

The text of a GitHub event

The run gets the event as text, for example:

Repository: acme/web
Event: pull request
Action: opened
Number: 12
URL: https://github.com/acme/web/pull/12
Actor: octocat
Title: Add CSV export
Labels: feature
Base branch: main
Head branch: csv-export
Body:
Adds a CSV export to the reports page.

An issue has no branches. A release has Tag, URL, Actor, Title and Body. Handful cuts a long body so that the text stays within 65,536 characters, and says how many characters it cut.

What an event run can do

A run that starts with text is an event run: Run now with text, a call of the trigger URL, or a GitHub event. Text from outside Handful steers it, so it can do less than a turn in the chat.

  • It runs in a new session of its own, without the chat’s history. While the bot works on another turn, the run waits as “queued”. Your messages and the bot’s other queued turns start before queued event runs. Event runs start in the order they came.
  • The bot gets the text in a routine-fire-payload block, marked as untrusted data. It does not follow instructions in the text unless the routine’s prompt says to. Say in What to do each time what to do with the text.
  • It reads and searches files, and uses skills and subagents, without asking.
  • Of Handful’s tools, it can message you, search memory, and find, read and save artifacts. A message that it sends you shows the routine’s name. It cannot save memory, change routines, skills or its profile, message other bots or rooms, or work on a team’s board.
  • Commands (Bash), file changes (Edit and Write), Monitor and web searches ask for your approval on every call. The approval card names the run, for example Routine "Triage", started by a GitHub event: issue #7 opened in acme/web. With Let event runs use the tools I always allow for this bot on, the tools that you always allow for this bot run without a card. A card that you do not answer within 270 seconds refuses the call, and the run goes on without it.

Limits

To set the limits of event runs, click Edit on a saved routine. The Limits apply only to event runs. Scheduled runs and Run now without text have no limits.

  • Stop a run after N agent turns: on by default, at 100. Set 1 to 500, or turn it off. A run that reaches it ends as “stopped at the limit (100 agent turns)”.
  • Spending limit per run: off by default. Set more than $0 and at most $1000. It is an estimate at list price: on a Claude subscription it is not what you pay, and one step can go past it. A run that reaches it ends as “stopped at the spending limit”.
  • Let event runs use the tools I always allow for this bot: off by default.

Two hourly limits are fixed. A routine has at most 30 event runs in any 60 minutes, and all routines on this computer together at most 100.

  • Past a limit, Handful refuses Run now with text and the trigger URL, and says when the routine accepts runs again.
  • A GitHub event past a limit does not run. Runs shows it as “skipped: hourly limit”. A routine keeps its 100 newest skipped events.

Follow a run

Each event run shows as one line in the bot’s chat, for example Routine "Triage" · started by a GitHub event: issue #7 opened in acme/web · running. The status changes in place:

  • queued, running, done or failed. A run that ended because Handful stopped or restarted shows as failed.
  • “waiting for your approval”
  • “done with 1 action not approved”, when you did not approve a call
  • “stopped at the limit (100 agent turns)” or “stopped at the spending limit”
  • cancelled, when you stopped the run or a change of the routine ended it

Open run shows the run’s transcript, read-only: the message that the run started with, its work and the bot’s final reply. Back to chat goes back. Stop, on the run’s line or in the open run, ends the run at once. On a queued run, it cancels the run.

In its next turn in your chat, the bot learns which event runs ended and how. Ask it about a run there.

Runs on the routine lists its newest 50 event runs and skipped events, newest first. Each row shows the time, the trigger, the status and the duration, and a run has Open run. Scheduled runs and Run now without text are not in the list. When you change or pause a routine, its queued event runs end as “cancelled: routine changed”.

What bots can do

A bot manages its own routines with the update_routine tool. It can make, change, pause, resume, delete and run them, and add and remove GitHub triggers. For example, ask: “Triage each new issue in acme/web.”

When a bot adds or removes a GitHub trigger, adds, changes or removes a schedule, or deletes a routine, its chat shows a line, for example Added a GitHub trigger to "Triage": acme/web, issue opened.

No bot can turn on a trigger URL or see its token. A bot sees only that a routine’s trigger URL is on.

Last updated