Early Access. Commands and behavior can change between releases.
triggers: with three keys: a name, an on that matches an event, and
a run that says what to start. run is either a stage, which starts a Factory run, or a
command, which runs one agent session once.
Event → trigger → what runs
The diagram below shows which events start what.Event source
Trigger in factory.yaml
What runs
Board: label, status
→
source: board→
Run at
planGitHub: CI failed
→
source: github→
Run at
buildSchedule (cron)
→
source: schedule→
One command, once
CLI:
triggers fire↗
The trigger column reads
on.source · on.event → run.stage or run.command.
Narrow a match with filters under on: label or status for board events, branch
for CI, and repo for both. branch takes a glob such as factory/*. A schedule trigger takes cron and tz instead. The
reference lists every key.
A board trigger only starts work on an item that has every pickup label and no hold label, and
never on an item in triage. The number of open runs is capped by limits.maxActiveRuns; a run
over the cap waits in a queue and starts when one ends.
Assigning an item doesn’t start work in v1. The language still accepts an
assigned board
event, but v1 doesn’t support it. Add the pickup label instead.Defaults
If your file has notriggers key, these apply:
The defaults also include an
assigned row, which v1 doesn’t support (see above). To leave it
out, write your own triggers list. Once you write a triggers list, it replaces the defaults:
copy the ones you want to keep.
triggers: [] turns off every trigger from the file.
How stages chain
Triggers only start work. After that, a run moves from stage to stage on its own, and waits for you at two gates. You open each gate with a label, never by typing a command.plan
/spec→
You approve the plan
factory:approved→
build
/implement↓ ↑ rework
review
/code-review←
You approve the merge
merge-ready←
land
/shipReview sends work back to build when it finds problems or CI fails.
A run starts at
plan from a run.stage: plan trigger, from architech factory runs start, or
when CI fails on a branch no run owns. A run.stage: build trigger sends the run that owns the
branch back to build.
The label names above are the defaults; see label roles.
How many gates apply depends on policy.autonomy, and a change to a protected path always waits
for merge approval. See approvals and guards.
architech factory runs show <run> lists each stage with its command.
Routines
A routine is asource: schedule trigger. When the clock reaches its time, one agent session
runs one command, once. It creates no Factory run and passes no gate. The session appears in your
workspace’s sessions list.
A schedule trigger has no
event, and it can’t start a stage: run.stage is refused for it.
Push the file to create or change the routine. Removing the trigger from the file and pushing
removes the routine. Disabling the trigger pauses it.
Run a routine now
Test a routine, or run it outside its schedule:fire takes the trigger’s name from factory.yaml. It reads the Factory from the local file;
pass --factory <id> to pick another one. It works only for a schedule trigger, and only while the
trigger and its Factory are enabled. Each call is a new firing. To retry a firing without running
it twice, pass the same --key <key> both times.
Slack channel
Triggers infactory.yaml start on board, GitHub and schedule events. To start work from a
mention in a Slack channel, create a gateway trigger with the mutagent CLI:
Before you create it:
- Slack is connected to your workspace:
mutagent gateway connect slack. See Slack. - The Mutagent app is invited to the channel.
- GitHub is connected, and the Mutagent GitHub App can reach the repository.
mutagent gateway triggers lists your triggers. See
Triggers and routines for every option.
Test an event trigger
To check which trigger an event would match, without starting anything:{"kind":"board.label","data":{"label":"factory:pickup"}}.
A disabled trigger never matches.