Skip to content
flow

FeaturesFactory

Factory

Put agent sessions through gated plans scored by proven checks, so only work that is ready for you asks for your attention.

View as Markdown
On this page

The Factory is a triage page for agent-driven work. You put a session on it, and its branch then moves through a plan: an ordered list of gates, each with weighted checks that the agent (or Flow itself, or you) must prove. Each session gets a verification score from 0 to 100, and the page only puts a session in front of you once its score crosses your line. Everything below the line keeps working on its own.

Note: The Factory is an experiment (ALPHA, it may be removed rather than shipped). Turn it on in Settings › Experiments (features.factory). While it is off, the page, its header chip and its actions are hidden, and agents can read the Factory but not change it. Your plans, records, templates and factory.threshold are kept, so turning it back on shows the Factory as you left it.

Open the Factory

  • Press ⌘; (Toggle factory) or click the factory chip in the sessions header, left of the Dashboard's grid chip. Both switch between the Factory and Sessions. The chip is lit while the page shows, and carries a blue dot while any session is worth your time.
  • Or run Go to Factory from the command palette (⇧⌘P), or flow-cli page factory.

The page lists the sessions of the selected label that are on the Factory. It opens in the main window only.

Add and remove sessions

Nothing is on the Factory until you add it.

  1. Focus the session you want to track.
  2. Run Add session to the Factory… from the command palette.
  3. Pick a template. Each row shows its name, a one-line summary and its gates ("Planning → Build → Peer review → Merge"). The session joins with that template's plan, at the Planning gate.

An agent can add its own session from its terminal:

sh
flow-cli factory add --template bugfix

Without --template, factory add uses feature. To take a session off, run Remove session from the Factory or flow-cli factory remove. That drops its plan, reports and passes; the ledger keeps a line saying it was removed.

The Factory tracks work, not windows: a work is a local checkout and its branch, so its record survives closing the group, a new window and a relaunch. A session on a detached HEAD, a group on a remote host, or a mirror group from a paired device cannot be added.

Read the page

At the top, a summary says how many sessions are worth your time and how many more are below the line. The toolbar has:

  • By attention / By gate: how the list is grouped.
  • A filter field that matches a session's title, repo, branch or gate.
  • Line at T: your threshold. Clicking it steps through 70, 80 and 90.
  • Open next: opens the next session worth your time.

Grouped by attention, sessions fall into these groups:

GroupWho is in it
Worth your timeAbove the line and waiting on you. Blocked sessions first, then the smallest diff
PlanningAt the Planning gate and below the line: pair with the agent on the plan
Not yetBelow the line. The agent keeps going; these surface when the score crosses the line. Snoozed sessions always land here
Waiting on othersEverything still missing is a reviewer's
LandedMerged, or past the last gate. Collapsed by default

Grouped by gate, the list has Planning first, then one group per gate name, then Landed.

Each card shows the session's status ("Ready for your review", "Ready to send", "Ready to merge", "Decision ready", "Agent working", …), why it stands where it does ("4 of 6 proven. Still open: …"), and at most one button:

ButtonWhenWhat it does
Approve planThe plan is ready, above the lineRecords the Planning pass
Open planAt Planning, below the lineOpens the Gate tab on the plan
ReviewA pass gate, above the lineOpens the Gate tab so you can look before passing
Send to reviewersA ready-pr gate, above the lineMarks the pull request ready for review, then records the pass
MergeA merge-pr gate, above the lineMerges the pull request; the session lands once it has merged
DecideBlocked, above the lineOpens the Gate tab on the decision

Keys on the page

KeyAction
↑ ↓ or j kMove the selection
↩Open the selected session
EscClear the filter

While a session pane is open, the keyboard belongs to its terminal: Esc, j, k and ↩ go to the program running there.

The session pane

Clicking a card opens the session's real terminal beside a narrowed list, under a strip of its gates. You can type into it as on the Sessions page. Close it with its − button or ⌥⌘\ (Close the Factory pane).

⌘\ (or the header button) toggles the secondary pane, which has three tabs:

  • Terminal: the group's other panes, with their tabs. A group with no other panes has no Terminal tab.
  • Gate: what the score is made of. The decision card, the current gate's checklist (the decision packet first while blocked), the plan while at Planning, and the gates strip, which marks each gate "passed · by WHO", "now · SCORE" or "not reached".
  • Ledger: an append-only history of everything added, reported, passed and logged for this work, newest first, with filter chips (Everyone, You, Claude, Reviewers, Automatic) and a note field. Type a note and press ↩ to log it; Esc gives the keyboard back.

⌘\ is the Factory page's own chord: the Toggle the Factory secondary pane action has no default binding, and a binding of your own on ⌘\ wins over it.

Plans and gates

Every plan starts with Planning, a fixed gate you cannot edit. After it come the plan's own gates (up to 8). Each gate asks one question ("Ready for your review?") and has a gate action that decides how it is passed:

ActionButtonHow it passes
passReview, then Mark passedYou record the pass (or an agent runs flow-cli gate pass KEY)
ready-prSend to reviewersFlow marks the pull request ready for review (skipped if it already is) and records the pass once that succeeds
merge-prMergeNever recorded by hand: the session lands when its pull request merges. At most one, and only as the last gate

A session sits at the first gate without a recorded pass. Gates advance only by an explicit pass of the current gate; a merged pull request lands the session whatever gate it was at.

Planning

At Planning you settle the rest of the plan with the agent. The Gate tab lists Planning's checklist, then the plan read-only (every later gate with its checks, weights, owners and how each is verified). The decision card has two buttons:

  • Start planning types this line into the session's terminal, without pressing Return, and gives the pane the keyboard: "Run flow-cli factory brief, then pair with me on this task's plan: the gates after Planning, each gate's checks and how they are verified, and how the score is weighted."
  • Approve plan records the Planning pass.

flow-cli factory brief prints the planning protocol for the agent: the rules, the commands, the plan's JSON shape, the templates and this work's current plan. The agent changes the plan with flow-cli factory plan set; you don't edit it on the page.

Planning's checklist:

CheckOwnerWeightProven when
Goal and why (goal)you2You tick it once the goal and the reason are written down
Gates chosen for this task (plan-gates)auto2The plan has at least one gate
Every check says how it is verified (plan-verification)auto3Every gate has a check, and every check has a verify step or a source
Score weights agreed (plan-score)you2You tick it once each check's weight says what matters
Open questions answered (questions)auto1Nothing is pending in the session's panes

The plan can change only while the work is at Planning. To change it later, run flow-cli factory replan: that clears every pass and puts the work back at Planning, keeping its reports.

Checks and the score

Each check has a label, a weight from 1 to 5, an owner (you, agent, auto or peer), and a verify step saying how it is proven (a command to run or an instruction). The checklist marks each one:

MarkState
✓Proven: reported with evidence, ticked by you, or read by Flow
~Claimed: reported without evidence. Scores 0
…Working
–Not started
✗Failed
n/aDoes not apply (no CI on the pull request, no review required). Left out of the score

Derived checks name a source, and Flow answers them itself from the session's panes, git and pull request. Their owner is always auto and nobody reports them:

SourceProven when
questions, no-questionsNothing is pending in the session's panes
ci, ci-latestThe pull request's checks passed
smallThe branch diff is under 400 lines (added plus removed)
approvalsThe pull request's review decision is approved
up-to-dateThe pull request is mergeable and not behind

Every other check is reported: by the agent with flow-cli gate report, or by you ticking a check you own on the Gate tab. An agent proves agent and auto checks; for a you or peer check it can only claim, and it can never change a check you confirmed.

The score is the weighted share of the scored checks that are proven, from 0 to 100. A session is above the line when its score reaches factory.threshold (default 80), with one hard rule: at a merge-pr gate it is never above the line until every auto check is proven.

Blocked sessions and decisions

When the agent is stuck it records why with flow-cli gate blocked "ONE LINE". While a session is blocked, a decision packet replaces the gate's checklist in the score: what is blocked, what was tried, options with trade-offs, a recommendation, and a repro you can run. The session reaches Worth your time once the packet's score crosses your line, and Unblock on the decision card (or flow-cli gate unblocked) puts it back on the gate's checks.

A pane showing a question overlay is a decision the terminal already shows in full: the session counts as blocked with a complete packet, scores 100 and reads "Decision ready".

Templates

A plan starts from a template. Five ship with Flow:

KeyNameGates after Planning
featureFeature PRBuild → Peer review (ready-pr) → Merge (merge-pr)
bugfixBug fixReproduce → Fix → Merge (merge-pr)
researchResearch spikeExplore → Findings (no pull request)
docsDocsDraft → Review
blankBlankNone: build the whole plan at Planning

Save a work's current plan as your own template, or remove one you saved:

sh
flow-cli factory template save "Spike PR"
flow-cli factory template remove "Spike PR"
flow-cli factory templates

Your templates live in ~/.flow/factory_templates.json (global, shared by every repo) and appear after the stock ones in the template picker. The file is a JSON array; you can edit it by hand:

json
[
  {
    "key": "spike-pr",
    "name": "Spike PR",
    "blurb": "Your saved template.",
    "gates": [
      {
        "key": "build",
        "name": "Build",
        "question": "Ready for your review?",
        "action": "pass",
        "checks": [
          { "slug": "unit-tests", "label": "Unit tests pass", "weight": 2, "owner": "auto", "verify": "cargo test; report the summary line" },
          { "slug": "build-small", "label": "Small enough to review", "weight": 1, "owner": "auto", "verify": "", "source": "small" }
        ]
      }
    ]
  }
]

A template whose key is not kebab-case, repeats an earlier key, takes a stock template's key, or holds an invalid plan is skipped. A missing or unreadable file never breaks anything.

Plan rules

flow-cli factory plan prints a work's plan as JSON, and flow-cli factory plan set FILE (or - for stdin) replaces the gates after Planning. Every plan, from a template or plan set, must follow these rules:

  • 0 to 8 gates after Planning. A gate's key is kebab-case, unique, and not planning or landed; its name is not empty; question is optional; action is pass (the default), ready-pr or merge-pr.
  • At most one merge-pr gate, and only as the last gate.
  • Up to 12 checks per gate. A check's slug is kebab-case and unique across the plan, and is none of Planning's or the decision packet's: goal, plan-gates, plan-verification, plan-score, questions, blocked-line, tried, options, recommendation, repro.
  • weight is 1 to 5 (default 1). owner is you, auto, agent or peer (default agent). A check with a source must be owner auto.
  • Every check needs a verify step unless it has a source (Planning's "Every check says how it is verified" checks this).

Settings

KeyTypeDefaultEffect
features.factoryboolfalseTurns the Factory on (Settings › Experiments › Factory)
factory.thresholdnumber80The score a session needs before the Factory puts it in front of you, 50 to 100 (Settings › Tools › Factory › Line threshold, in steps of 5; the page's Line at T chip cycles 70, 80, 90)

When Send to reviewers finishes marking a pull request ready, Flow raises a pr.ops notification (a toast by default; change it in Settings › Notifications).

Factory actions

Every action is in the command palette by its label and rebindable in Settings › Keyboard.

ActionSetting keyDefault
Toggle factorykeyboard.toggle_factory⌘;
Go to Factorykeyboard.go_to_factoryunbound
Add session to the Factory…keyboard.factory_addunbound
Remove session from the Factorykeyboard.factory_removeunbound
Close the Factory panekeyboard.factory_close_pane⌥⌘\
Toggle the Factory secondary panekeyboard.factory_toggle_secondaryunbound (⌘\ on the page)

For agents

Run these in the work's checkout; add --dir D for another checkout or --group G to name a session.

sh
flow-cli factory add [--template KEY]   # put this work on the Factory
flow-cli factory brief                  # the planning protocol and this work's plan
flow-cli factory plan                   # the plan as JSON
flow-cli factory plan set plan.json     # replace the gates after Planning (only at Planning)
flow-cli factory replan                 # back to Planning, passes cleared
flow-cli gate checks                    # every check: gate, slug, weight, owner, label, how verified
flow-cli gate report unit-tests --evidence "cargo test: 214 passed"
flow-cli gate report goal --claim --evidence "Ship the retry policy"
flow-cli gate blocked "Need a decision on the API shape"
flow-cli gate unblocked
flow-cli gate pass planning             # only the current gate; never a merge-pr gate
flow-cli gate note "Rebased on main"
flow-cli read factory                   # every session on the Factory, as the page sees it

gate report with --evidence proves a check; with no evidence, or with --claim, it only claims it (scoring 0); --working and --failed set those states. Every change from the command line is recorded in the ledger as Claude's. While the Factory page is open, flow-cli factory-open G opens a session's pane, as a click on its card does.

Limits

  • The Factory is ALPHA: it may change a lot, or be removed.
  • Only local checkouts on a branch can be on it; remote-host groups, mirror groups from a paired device and detached HEADs cannot.
  • The page shows the selected label's sessions only, and only in the main window.
  • Plans are edited through flow-cli factory plan set, not on the page.
Sources

Written from these files in the Flow app repo

  • src/factory.rs
  • src/factory_ui.rs
  • src/features.rs
  • src/pages.rs
  • src/command.rs
  • src/settings_catalog.rs
  • src/notifications.rs
  • src/bus_exec.rs
  • src/bin/flow-cli.rs
  • src/workspace.rs
  • docs/flow-remote.md