Files
autocraft/docs/pipeline.md
2026-11-11 12:56:56 +00:00

205 KiB
Raw Permalink Blame History

How the triage pipeline works

The pipeline sorts the craft apps' open issues and PRs (about 21,000), reviews and merges the PRs we want, and fixes clear bugs. Models read, sort and review. People answer the decisions that need judgement, on this dashboard.

The flow

Each column is an actor. Rows run top to bottom in pipeline order. The heavy line is the automatic path: nothing on it waits for a person. Thin lines are side branches, and dashed lines are branches that wait for the operator (Decide, Duplicate?, Close this PR?, Merge?, Hold) or are rare. Cards in the GitHub writes column name the approval they need for that repo (Repos page) and stay within their daily limit. The security deep scan is not drawn: an operator starts each scan, and it runs outside the daily pipeline (see Security deep scan).

pipeline

The stages, in order:

  1. Sync: Mirrors every issue, PR and comment of the tracked repos into the local database each minute, reads the CI state of each default branch every 2 minutes, and makes a vector of each item's title and body for similar-item search.
  2. Duplicates: Finds items that describe the same bug or request as another open item, or one closed in the last year, and compares each group.
  3. Classify: Gives each open item one type label and two flags (security, needs decision). Jev goes first, Haiku gives a second opinion, and a referee settles disagreements outside the scope labels.
  4. Priority: Gives each open item a level from P0 to P4, then orders the candidates of later stages by a work rank.
  5. Decide: Asks an operator for scope calls, prepares every open decision with a summary, a pick and drafted answers, and answers questions about an item in its conversation.
  6. Label: Writes each settled type label and flag to GitHub. A label a person set is never changed.
  7. Review: Opus reviews every wanted PR at its current head, reading the repo, and gives a verdict with the complete fix list. It writes nothing to GitHub until the final review is posted.
  8. Fix: Writes a patch for a bugfix issue where the fix is clear, tests it in the sandbox and opens a PR.
  9. Fix-up: For a take-with-fixes review, applies the listed small fixes to the contributor's branch, or posts them as a comment when the branch cannot be pushed to. For a wanted PR whose gate check fails, runs the formatter, reruns an infrastructure failure once, or has a model patch the code. For a red default branch in an approved repo, reruns a flaky failure once and asks an operator about reporting an infrastructure failure.
  10. Verify: Records upstream CI as the verification of taken PRs in repos that have it. A repo without CI, and a bugfix that changes a test file, get a model-planned build in a build environment; a model summarises failures.
  11. Merge queue: Merges PRs that pass the rules in integration batches (up to 50 PRs, checked by upstream CI on the batch PR) through safe-merge, and asks for a Merge? decision on PRs outside the rules. Before a PR the rule would merge goes into a batch, and before a pre-approved merge is handed over to the queue, Opus reviews its head commit once more, adversarially and independently of the first review; a defect it verifies becomes a fix-up or a Merge? question (for a pre-approved merge, a Merge? question). Approves held CI runs of outside contributors where the repo allows it.
  12. Act: Makes the comments and closes that follow an operator's answer, from fixed templates.
  13. Post-merge review: Opus reviews each PR the pipeline merged a second time, reading what landed with the pipeline's own commits and reviews of the PR, and lists defects and minor findings. Each defect that no open item covers becomes one follow-up issue in repos approved for commenting, except on a security fix whose advisory is not published yet (its findings are only shown); minor findings are only shown.

Sync, Embed, Duplicates, Classify, Priority and Decide cover the whole org. Label, Review, Fix, Fix-up, Verify, Merge, Post-merge review and Act go one or a few repos at a time. The work rank orders the candidates of Decide, Review, Verify and Fix-up, highest first.

Sync

Every issue, PR and comment of the tracked repos is mirrored into the local database every minute (one org-wide search for changes). Later stages plan from the mirror. The mirror can be minutes behind GitHub, so every stage that writes to GitHub or spends a model call first reads the item's live state (state, draft flag, head commit) in one batched query and skips what changed; the skipped items come back on a later pass. Automatic; no model.

Each run searches from 10 minutes before the newest updatedAt stored, and once an hour it also re-reads the 6 hours before it, because GitHub's search index can show an item late. An item whose stored row already matches GitHub is not written again. A window of one second with more than 1,000 matches cannot be read by search: the run logs a warning and lists every tracked repo for it instead, and no high-water mark moves until the run finishes. Once a day per tracked repo (the repo reconciled longest ago, one per run) the sync lists the repo's open issues and PRs. Mirror rows that are open here but not listed as open are read individually: closed or merged ones are updated, and deleted or transferred ones are marked CLOSED and recorded in the audit log as item-gone. Tracking a repo again clears its high-water mark, so the next sync reads it in full. Only the last 20 comments and 10 reviews of an item are mirrored.

Main CI (main-ci). After a sync run, when the last poll is at least 2 minutes old, one GraphQL query reads the default-branch head commit and its checks for every synced repo. The poll belongs to the sync run, so it runs with the pipeline switch on or off, and a failed poll does not fail the sync. autocraft main-ci [--repo R] prints the table, and the main-ci runner step polls on request (read-only). main_ci keeps one row per head seen (the latest 50 per repo) with its state, failing checks and checks. The state of a head:

  • red: a gate check failed. The gate checks are the ones named gate, as in CI fix; in a repo whose checks have no such name, any failed check that is not on the repo's optional-check list counts.
  • optional: only checks outside the gate, or only checks on the repo's optional-check list, failed.
  • running: something is pending and no gate check failed.
  • green: every check passed or was skipped.
  • none: no checks.

For a red repo, the culprit is the first red head after the last green one (its PR number is read from "Merge pull request #N" or a trailing "(#N)"), and red_since is when that head's state became red. GET /api/main-ci returns the summary and one entry per repo (red first); GET /api/main-ci/summary returns the counts alone, which GET /api/progress also carries as mainCi. A change of state bumps the mainci live topic.

Embed

Each item gets a vector from its title and body. A new vector is made only when the text changes. Runs locally on this machine; no model quota and no limit.

Duplicates

Finds open issues and PRs that describe the same bug or request as another open item, or one closed within the last year, in the same repo.

  • Candidates. Nearest neighbours by vector (similarity 0.75 or more, at most 3 per item, same kind). A pair an operator already ruled on is not asked again. A change of the cut-off scans every item again once. A quiet pull request (a security fix not yet published) is never a candidate, on either side of a pair.
  • Check. Jev answers first (0.9 or more is a duplicate, 0.1 or less is distinct). Haiku settles the rest. While Jev is unavailable (see Waits), Haiku decides every pair on its own: its answer is the verdict.
  • Groups. Items joined by duplicate pairs form a group. The members of each kind (PRs, issues) are compared together in one call by the Compare duplicate groups step (autocraft dupe-compare).
    • PRs: Opus, with read-only tools on a checkout of the default branch, gets each PR's title, body, linked issues and code diff; CI and review state are background, not rules. It picks the PR to keep and, for each other PR, says whether it is a duplicate, what it does better and which parts are worth carrying into the kept one.
    • Issues: Sonnet, without tools, gets all reports in one call. It picks the report to keep and lists what each other report adds (steps, versions, logs).
    • A PR is never closed as a duplicate of an issue; the kept PR is linked to the kept issue.
    • A closed or merged member wins without a call. A set of more than 10 members is compared in rounds of 10 whose winners meet.
    • A set is compared again only when a member's state, head commit or text changes. Live state is checked on GitHub before the calls; a set with a changed member waits for the next sync. autocraft dupe-compare again <repo>#<n> (operator, audited as compare-again) marks the sets that include an item for one more comparison; the open group decision keeps its id and is rewritten from the new result.
    • When the model gives no valid answer twice, the rule decides: the closed or merged one, else the one with a merged fix, else the one with 5 or more extra comments, else the older one. The decision says it was kept by rule and recommends nothing.
  • Decision. One per group, asked once the group is compared: "Keep #A and close #B, #C as its duplicates?" with Keep #A, Keep #N instead (up to three alternatives) and Not duplicates. The summary is the 2 or 3 sentences the comparison model wrote in the same call (which one to keep, why, what to carry over); what each item does better, what is worth carrying over and what it adds stay as structured points. The recommendation (Keep #A) carries the comparison's one-sentence reason; a group picked by the rule has none. An open decision is rewritten when its comparison changes. Every #number in the decision links to the item page and to GitHub. Only an operator's answer counts. Open per-pair decisions of the group are superseded by it (audited); answered ones keep their effect.
  • Held out. While the decision is open or answered Keep #A / Keep #N instead, the items it closes are left out of Decide, Review, Verify, Fix-up and Fix. "Not duplicates" releases them for good and stores every pair of the group as distinct.
  • Comments. The exact texts are written when the decision is asked, one set per answer (Keep #A and each Keep #N instead), and shown under that answer, so the answer approves exactly the words it posts. The page sends a hash of the shown texts with the answer; a changed set is refused (409) and the page reloads. Each member to close gets "Closing as a duplicate of #A." and, for a PR with parts to carry over, a second line "Parts to carry over to #A: ..." naming the first two points. For issue groups the kept issue gets one comment, "Details from the closed duplicates:", with at most six bullets built from the points each closed report adds, each crediting its source (- #n: ...; links, HTML, cross-repo references and mentions removed). The kept PR's fallback suggestion (used when its branch can't be pushed to) is part of the set. No model writes these, and none is written after an answer.
  • Act. In a repo approved for comments, Act posts the stored texts for an answered group (Keep #A or Keep #N instead) and closes the members, within the step's limit and pilot. Each write is recorded in dupe_group_posts right after it happens, so a crash or retry never repeats a comment or a close. Before closing, Act reads the kept items (a closed, unmerged one stops the decision) and each member on GitHub: one already closed or merged, a PR whose head differs from the head stored when the decision was asked, or an issue whose text changed is skipped and recorded; such a member (and one whose close failed three times) is released: its role becomes stay, it is no longer held or settled by the decision, and the next comparison may ask about it again. Roles and answer are re-read before every write, so an undo or refresh stops the decision. A member whose writes fail three times is skipped. Undo is refused once Act wrote to GitHub. The decision is applied when every member to close has been closed. After an operator's answer sets the roles, the planner lists Act for each member the group closes; a member already closed is skipped.
  • Carry-over. When PRs closed in a group name parts worth carrying over, Act queues a job for the kept PR (dupe_carries). Fix-up works it with its take-fix rules: a model (sandboxed) writes a diff porting the listed parts, shown with the closed PRs' diffs; the patch check (Opus) must approve; the push to the PR's branch needs push approval and maintainer edits. Without them, in a repo approved for comments, the parts are posted on the kept PR as one comment instead. Two failed tries hold the job. Take-fix tries and stages of the PR are not touched.
  • Hand-off. A close goes to Act. Confirmed duplicates raise the original's priority.

Models: Jev, Haiku (pair checks); Opus and Sonnet (group comparison). Daily limits: 2000 pairs for the check, 200 comparisons for the group comparison. Both honour the pilot list. Writes nothing to GitHub.

Classify

Every open item gets one type label (bugfix, performance, missing feature, small extra, plugin candidate, infra) and two flags (security, needs decision).

  • Jev first. Haiku gives a second opinion when Jev is under 90 % sure of the type or unsure of a flag. Items of repos with the pipeline on come first.
  • While Jev is unavailable (see Waits), Haiku classifies every due item and its label and flags settle the item (source Haiku). Items Haiku settled stay settled when Jev returns; Jev classifies them again only after their text changes.
  • A type is settled when Jev is at 90 % or more, or Haiku agrees with Jev. Disagreements among the scope labels go to Decide.
  • Each flag follows the same rule on its own, whatever the type's state. Security: Jev at 0.9 or more sets it, under 0.3 clears it, in between Haiku's flag counts. Needs decision: the same with 0.8. Until Haiku has answered an unsure flag, the flag is not set (no label, no priority bump). A settled bugfix keeps needs decision only when Jev is at 0.7 or more.
  • Other disagreements (for example bugfix against missing feature) go to the Sonnet referee, which applies the classification rules and says whether it is sure. A sure label settles the type, and a scope label then follows the normal scope path. When Sonnet is unsure, Opus referees the same item with the same prompt. Opus's label settles the item either way; an unsure Opus also sets the needs-decision flag, so Decide asks an operator the scope question for that label. The referee has its own step and daily limit.
  • Started by the operator for a full pass; the pipeline classifies new and changed items on its own. Daily limit 2000.

Areas

A repo can have an area list: 10 to 25 parts of the app, each with a name and a one-line description. Repos without a list skip this question. A list is saved in versions; the highest version is current.

  • Classify asks Jev one more choice question per item, among the repo's areas plus "none of these". The descriptions are the criteria; a pull request's evidence includes its changed file paths (from the cached diff). Jev at 90 % or more settles it. Below that Haiku decides, and Haiku decides alone while Jev is unavailable. "None of these" is a valid answer.
  • item_areas holds one row per item: area (empty for none of these), source (jev, haiku or operator), Jev's confidence, the list version asked against, and the time. An item asked against the current version is not asked again; operator-set rows are never asked.
  • An operator edits the list on the repo's page: add, rename, merge two areas, remove, edit a description. Each save is a new version. Renamed and merged areas re-point their items; the items of a removed area become unassigned. Items whose area survives move to the new version.
  • Unassigned items (no row, none of these, or removed area) are counted per repo. Re-scan (areas-rescan) asks them again against the current list.
  • Propose (areas-propose): one Opus call per repo, with read-only tools on the default branch and the workspace (docs, docs/gaps.md) and a sample of open item titles. It returns a list that waits as a proposal; accepting it (as it is or edited) saves a version.
  • Suggest (areas-suggest): Sonnet reads a sample of unassigned items and suggests up to 8 new areas. The operator accepts or ignores each one; accepting saves a version and queues a re-scan.
  • Propose, suggest and re-scan are started by an operator only. The assignment itself runs inside classify-new and classify-all and counts against their limit.
  • CLI: autocraft areas list|propose|accept|edit|rescan|suggest --repo R.

Priority

Each open item gets a level from P0 to P4.

Level Meaning
P0 critical Crash, data loss, security hole, broken build or install, unusable app
P1 high A core feature is broken, or a regression
P2 normal An ordinary bug, feature or change
P3 low Cosmetic, wording, docs, nice-to-have
P4 backlog Kept open but not worked on now: vague or wishlist requests, ideas without a clear ask, very large asks with little reach. Plugin candidates are P4.
  • Jev picks the level; under 90 % sure, Haiku decides. While Jev is unavailable (see Waits), Haiku rates every due item. The security flag raises the level by one, up to P0.
  • Reach (0 to 99) breaks ties inside a level: commenters, comments, linked PRs, confirmed duplicates, the security flag and age. No model. It is not shown.
  • Models run again only when the item's text changes; reach is recomputed from the mirror on every pass.
  • Unrated items count as P2. Daily limit 3000 items sent to Jev; raise it for the first pass over a new org.
  • Fix skips P4 issues: no code is written for the backlog. Everywhere else P4 items come last. Review still reviews P4 PRs.

Work rank

One key per open item decides what the pipeline works on next, for issues and PRs alike. No model; recomputed whenever the items, priorities or fix estimates change. Items are ordered by, in turn:

  1. Level, P0 first.
  2. Type: bugfix, performance, infra, missing feature, small extra, plugin candidate; not settled last.
  3. Size, smaller first: S, M, L, XL.
  4. Reach, higher first.
  • The key is one integer, (4 - level) * 10000 + type * 1000 + size * 100 + reach, so every candidate list sorts by it.
  • PR size comes from changed lines: up to 50 S, up to 300 M, up to 1,000 L, more XL. An issue counts as M until Fix triage estimates its size.
  • Decide, Review, Fix, Fix-up, Verify and the merge queue all take the highest-ranked item first.
  • When Review and Fix both have work, the one with the higher-ranked item starts first. Daily limits still cap both.
  • Queue position: an item whose next step is a queued stage (Review, Fix, Fix-up, Verify, Merge) has a place among the in-scope items (repo switch on or fast-tracked, the pilot, not our own integration PRs) with the same next step, in work-rank order with fast-tracked items first; Merge places follow the Merge tab's order. It shows as a badge such as "Review #3" on Items, Queue, Decisions and the item page, and links to that stage's Queue tab with the item highlighted (/queue/review?item=<repo>:<number>). Items waiting for a person, running, held or done have none.
  • The Work queue page lists every open item in rank order with its level, type, size and next step.

Decide

Asks the operator for a scope call on open items that either carry the needs-decision flag (settled), or where Jev and Haiku chose different labels among missing feature, small extra and plugin candidate.

  • Each decision has a question, up to four options, up to five facts and a 2 to 4 sentence summary written by Opus (see Prepare). Duplicate decisions carry the group comparison as their summary (see Duplicates); Merge? and Close? decisions start with the stored Opus review text at the PR's head (the Merge? summary says when Opus was unsure), written when the decision is asked and by the next Merge or Act run for open ones not yet prepared; once a decision is prepared, its summary and pick stay the judgement model's. The Close? question of a quiet pull request carries no review reason, and its closing comment is the fixed line without a reason.
  • Prepare. Every open decision of one item, of any kind (scope, merge, close, duplicate, split, other), gets one call of the judgement model (prompt decide.prepare; the operator picks Opus or Sonnet on the Pipeline page, default Opus). The call reads the item (title, body, labels, comments), a PR's diff (code files, as Review reads it), the decision (question, facts, options with hints, risks), the operator's earlier messages in the item's conversation, and what stopped the pipeline: the question's context, the newest Opus review (verdict, reason, fixes, risks), the classifiers' labels and reasons, the duplicate comparison, and for a duplicate group its members. It runs sandboxed with read-only tools on a checkout (a PR's head commit, an issue's default branch) and the workspace (see Trust boundary). Dashboard comments and picks are never read. When a single item's reply has a choices block but every core and added core in it was dropped by validation, or has none at all, the call is repeated once with the drop reasons listed after the decision, and the choices of the repeat are kept (its cost is added to the first call's); the same single repeat happens when the pick's own core was dropped, and a pick that still has no core after it is stored as no pick. The call also reads the PR's current CI and mergeable state, which wins over the ask-time facts. For a quiet pull request (a security fix not yet published) the validated choices leave out the extras and cores that post model-written public text (comment, open issue, transfer); merge, hold, close, backlog and fix-up cores stay.
  • Output. The reply is the summary (2 to 6 sentences, 40 to 1000 characters) followed by one fenced choices block: a JSON object with the pick ({core, reason}; core is a core key or null, the reason one sentence), cores (per core worth drafting, not only the pick: its reason for a closing core or instructions for a fix-up core, and its extras, each with on for what Opus would tick and its text), add (up to three cores no offered core covers, each with an end of close, duplicate, transfer, fixup or review) and an optional ask (a question to the author, kept as a proposed comment card). The cores of a decision are computed from its options and the item (the prompt lists them with the extra kinds each takes); our code checks every extra with the checker of the step of the same name and every core with its extras as the card its button would run, drops what fails with a note, and stores the rest as the decision's choices (table decision_choices, source prepare, replacing the earlier version). The pick is kept only when its core survived; a pick on an option core also sets the decision's recommendation. The summary, the pick with its reason and the recommendation are stored on the decision; the text becomes an Opus turn in the item's conversation (created when there is none) that carries the choices and the ask card, and cards still proposed from earlier turns become replaced. A group decision, and any decision of an item other than the item's newest open one, gets the summary and a pick-only block (o:<option key> or null).
  • When it runs. A decision counts as prepared once a prepare is stored for its current question and options. Only a Merge? decision is tied to the PR head: a push makes it due again. Merge? and Close? decisions for an older head are never prepared (they are about to be withdrawn). Every other kind stays prepared across pushes until a new counted comment arrives (from a maintainer, operator or the PR's author, not our own posts; the prepare keeps the id of the newest one it read), a new Opus review is stored at the current head, or its question or options change. After a push, choices that rest on the code (a drafted comment or issue, a fix-up) are refused until the update; the others (answer, backlog, hold, label, close) still run. A non-merge decision whose current choices hold such a core is prepared again once for each new head. A decision gets at most 3 automatic prepares per UTC day (table decision_prepares, counted when the model call starts); past that it keeps its choices, the dashboard says they are from an earlier prepare, and only an operator's Re-prepare (POST /api/decisions/<id>/reprepare, audit reprepare) clears the prepare and failure marks, sets prepare_requested_at and puts the decision first in line, and the current choices stay until the new ones replace them. While the decision is open, has no prepare for its current state and has tries left, the dashboard shows it as preparing. A failed call is tried again an hour later, at most 3 tries per head; the decisions already open when the prepare step was introduced are prepared oldest first, at the step's normal concurrency, within its limit. New scope decisions are asked first and prepared in the same run.
  • Each prepare call counts as an item of the step against its limit and daily limit.
  • An item with an open or answered scope decision is not asked again. Maintainers and operators can send feedback (text, a pick, or both); only the operator's answer counts.
Answer Effect
take In scope. PRs go to Review
small-extra Keep in core, label "small extra"
plugin Not for core. Keep open, label "plugin candidate"
close Out of scope. Goes to Act, which posts "Closing this as out of scope" and a one-sentence reason: the reason a conversation card gave when it answered (the reason of its answer settle, cleaned like a comment and stored as the decision's public text), else the decision's own text. A reason is cut at a sentence or word end, never inside a word
need-info Ask how the reference app behaves, then decide again

Model: Opus. Daily limit 100.

Snooze. An operator can snooze an open decision (POST /api/decisions/<id>/snooze with {on}). It stays open and the pipeline keeps waiting; the inbox (status=open) and the Needs-you counts leave it out and status=snoozed lists it, until the item has activity after the snooze: a GitHub comment or review, a pushed commit, a decision comment or opinion, an operator conversation message. This is computed when read (SNOOZED_SQL), so no writer clears it. The columns are not part of the decisions live topic; decision-snooze reports them and is not planner input.

Handled answer. An operator can answer any single-item decision with handled and a required note (up to 500 characters): the decision closes, nothing is written to GitHub and no step acts on it. It counts as applied at once and Undo still works.

Backlog. Every decision of every kind (scope, duplicate group, Merge?, Close?, split, other) also offers backlog ("Backlog"), always last. The pipeline does not store it with the asked options; the dashboard and the CLI add it. Answering it holds the question undecided:

  • Nothing is written to GitHub (no label, comment, close or merge), and a duplicate group needs no textsHash for it because it stores no comment texts.
  • The item (every member of a batch or group) is held out of Decide, Review, Verify, Fix, Fix-up, Act and the merge queue, the same way an open Duplicate? decision holds it, and no new decision is asked for it. The Work queue shows a held PR as "Held". The Flow page counts scope items under their own bucket, "Backlog".
  • The decision leaves the Waiting list. The Decisions page has a Backlog view that lists them. An operator can Reopen one there (two clicks, audited as reopen, nothing written to GitHub): the answer is cleared and the decision is open again. Other users see the view without controls.
  • An operator can move many open decisions at once: autocraft decisions backlog --outside-pilot (open decisions none of whose items is in scope: a repo with its pipeline on and, when a pilot is set, a pilot item) or --repo R. It lists what it would change and writes only with --apply; each answer is recorded for the CLI user and audited. The admin API offers the same as POST /api/decisions/backlog with {outsidePilot, repo, apply} (operators only; a dry run unless apply is true).

Closed items. After every sync, open scope, close, merge and single-item duplicate decisions of items that are closed or merged in the mirror, and open duplicate-group decisions with fewer than two open members, are answered withdrawn by the pipeline with the reason as the note ("the pull request was closed on GitHub", "the pull request was merged", "the duplicate group has one open item left") and audited as decision-withdrawn; the item's timeline shows it. The first run after deploy clears the existing ones. A single-item question is renamed (~replaced-<time>), so an item that reopens is asked again under the same id; a withdrawn scope decision does not cover its item. Nothing is written to GitHub.

One open question per item. An item has at most one open single-item decision: when a newer scope, Merge? or Close? question is asked, the item's older open ones (any of the three kinds, at any head) are set aside like a withdrawn question (renamed ~replaced-<time>, answered withdrawn by the pipeline with a note, audited as decision-withdrawn); a set-aside scope question is not asked again. An open Merge? or Close? question asked at a head the PR no longer has is set aside the same way (note "the pull request changed since"), because the merge queue and Act read only the current head's question; answered decisions are never touched. Every sync applies the same rules to existing rows.

Withdraw. autocraft decisions withdraw --outside-pilot (or --repo R, dry run unless --apply) deletes open scope decisions with their opinions, comments and the stage row Decide wrote when asking, so the items count as never asked and Decide asks them again when they are in scope. Other kinds are not withdrawn. Each is audited as withdraw; nothing is written to GitHub.

Label

Writes each settled type label and flag to GitHub. No model.

  • Only settled types are labelled. A label a person set is never changed: items with a different type label are skipped and reported.
  • Needs the repo's label approval. Without it the stage only plans.
  • Writes in batches, at most 60 a minute. A re-run skips items already labelled. Each batch first reads the live state of its items; an item that is no longer open is skipped, counted and its mirror row updated.
  • An operator's plugin scope answer sets the plugin candidate type, also where the classifiers disagreed; the label goes through the same approval.

Review

Code review of open, non-draft PRs whose settled type is bugfix, performance, missing feature, small extra or infra. A PR flagged needs-decision waits for a take or small-extra answer. A PR already reviewed at its current head is skipped; a push brings it back. Reads GitHub, writes nothing.

One Opus pass reviews every wanted PR at a new head, docs-only and translation PRs included. Opus's verdict is the final one.

Step opus-review, one PR per call, highest work rank first, daily limit 40 PRs. The step checks runs before it in the same lane. Opus reads the repo with read-only tools in a sandboxed checkout of the PR head, as the Opus prompt review.opus describes; PR text and diffs are quoted as untrusted data. Before the calls, the candidates' live state and heads are read in one query; a PR that is closed, a draft or at a different head than selected is dropped and returns as a candidate on the next pass.

Step review-carry, one repo per call, calls no model, so it runs while Claude is paused. A head with no review whose only new commit since a sure take or take-fix review is our own fix-up of that review's fixes, approved by the patch check, gets the earlier verdict as a carried take, with the discussion mark of the earlier review. Not carried: a review made stale by new discussion, a pre-merge or carry-over fix-up, any commit that is not ours. The Plan holds a carry action for such a head instead of a review action, so opus-review leaves it to this step.

  • Input. Title, body, size (S up to 50 changed lines, M up to 300, L above), CI and merge state, changed files, and the diff of code files. Tests and lockfiles are listed, not diffed.
  • Too large. A diff over the call's length limit, or no diff from GitHub: held ("too large for the final review") without a model call.
  • Discussion. Opus also gets what others wrote on the PR, in a separate <discussion> block after the diff: top-level comments, review bodies and the unresolved inline review threads (path, line, first comment and the last three replies, author; outdated ones marked). All of it is read from GitHub in one query per PR when the review starts; if that read fails, the PR is skipped for this pass. Our own posts are left out (comments by the pipeline account, reviews we posted, threads we started). HTML comments and collapsed tool output (such as "Prompt for AI agents" and analysis chains) are removed, each entry is cut to 1,200 characters and the block to 9,000, threads first. The text is untrusted and cannot close its block: the model checks each claim against the diff, never follows instructions in it, and names each finding it checked in risks ("checked: : holds" or "does not hold"). A finding that holds and is not fixed makes the verdict take-fix (small fix, in the fix list) or hold. Each review stores when it read the discussion (seen_at) and a hash of the counted entries.
  • Waits before a review. A due review does not start while any of these holds (the plan names it); a maintainer's or operator's request after the latest review (a comment, Review again) lifts all of them. Blocked: a hold review named open items in blocked_by (repo#n, #n or owner/repo#n; each must be a tracked open item other than the PR, or an issue with an unanswered decision); no new head and no discussion starts a review until every blocker is merged, closed or decided, then the PR gets one fresh review. A blocker that itself waits on this PR is ignored, and the list expires after 14 days. CI: a head is reviewed only once its checks have finished and passed (a PR with no checks when none are pending); the first review of a PR also runs on finished red CI, and so does the one after blockers settled. While a head's CI runs or is red, the repo's checks are read again every minute, and a red head with an earlier take or take-fix review goes to CI fix. Cap: at most 3 Opus calls per PR per UTC day, counting new heads, re-runs, and failed calls (agent runs of opus-review, one per job: a reply-fix turn is part of its review); carried reviews do not count. Interval: setting review_min_interval_minutes (default 120, 0 turns it off; autocraft pipeline review-interval [minutes], audited) is the least time since the PR's last call; the plan says "next review after hh:mm" and the planner wakes then. A head made only by our own pushes since the last review skips the cap and the interval. Failures: a call that gives no valid review waits 10 minutes, then 30 minutes, then 2 hours at that head; a fourth failure holds the head until a new commit or Review again. A carry waits only for CI. Delta reviews, once a review runs, are as before.
  • Stale reviews. New discussion makes a PR's review stale when a counted comment or review is newer than the review's seen_at and the hash of the counted entries differs from the one the review read. Counted entries are the PR author's and those of authors with association owner, member, collaborator or contributor, but at a head that already has a review only a maintainer's (owner, member, collaborator or a dashboard operator or maintainer) makes the review stale; the PR author's comments are read by the next review without starting one. Others are shown to the model but never trigger. A one-line comment that only addresses a bot (@coderabbitai resume, @dependabot rebase) is never counted. Bot accounts never trigger (GitHub type Bot, a login ending in [bot], or a login on the review-bot list, default coderabbitai, dependabot and renovate, set with AUTOCRAFT_REVIEW_BOTS), even when the bot is the PR author; empty bodies and bare approvals never trigger. A stale PR is a candidate again at the same head, subject to the waits below. Until a PR has an Opus review at its head, it has no final verdict and no queue state, and it cannot merge; an integration batch that contains it is rebuilt without it. Just before a single or batch merge the discussion is read live again; a maintainer's or operator's entry the review did not read stops the merge and marks the PR stale (the PR author's comments do not). A re-review at the same head sets aside the head's Merge? decision (kept, renamed), so the question is asked again and an earlier answer does not count; the exception is a head where Opus was ever unsure (see Unsure): its question stays while unanswered. The posted review is edited when a newer Opus review exists at the same head. Reviews made before snapshots existed count as having read everything up to the migration. autocraft review again <repo>#<n> (operator, audited as review-again) marks a PR's review stale by hand, ignoring the waits.
Verdict Meaning
take Wanted, correct, nothing to change
take-fix Wanted and nearly right; small mechanical fixes are listed
hold Needs a person: unclear reference behaviour, design or scope choice, too large
close Wrong or broken beyond a small fix, not wanted, already done, or superseded

Opus also returns a complete fix list for take-fix, its reasons and sure.

  • Final verdict. The latest Opus verdict at the PR's current head. A PR with no Opus verdict at its head is not reviewed yet.
  • Unsure. A take or take-fix with sure false stays take or take-fix, so Fix-up, Verify and CI proceed. It never merges without an operator's Merge? answer, and the Merge? summary says Opus was unsure. Unsure sticks: every stored review is also appended to opus_review_history. The chain of a PR is its current head plus the heads AutoCraft pushed it from (conflict merges of the base, fix-up pushes, carry-over pushes). If any review in the chain was a take or take-fix with sure false, the PR needs an operator's merge answer at its current head, given after that head's latest review; a later sure review, an answer at an earlier head, or an answer given before the latest review does not lift it. A head the author pushed starts fresh. Any unanswered Merge? question of the PR, at any head, keeps it off the rule path; asking at a new head sets the PR's other unanswered questions aside, and a merge by any path closes the PR's open questions. A skipped review never merges by rule.
  • New push. Opus reads only the changes from the head it reviewed last to the new head, with its earlier review as context. If GitHub's compare fails or the old head is not an ancestor (force push), it reads the full diff.
  • Duplicates. Duplicate PRs are handled by the Duplicates stage; the review does not name them.
  • Stored per PR and head in opus_reviews (verdict, sure, reason, fixes, risks, mode full / delta, base head). The final_reviews view reads it; every later stage reads the view. Integration batches get no Opus review of their combined diff.

Posting the final review

Step review-post, only in repos with comment approval; calls no model. For each open PR with an Opus review and a public text at its current head that no review of ours describes yet, it posts one pull request review with event COMMENT (never an approval or a change request). PRs by the pipeline's own account, integration batch PRs, PRs held as duplicates and items outside the pilot are left out. Daily limit 40 posts and edits. A dry run (autocraft review-post --repo R) lists the bodies without posting.

  • Live check. Right before posting the PR is read from GitHub. Only an open PR whose head is the reviewed head gets the review; any other is skipped and returns after a new review at its new head.
  • One review per PR. The review's node id and head are stored in review_posts. An Opus review at a later head edits our earlier review (updatePullRequestReview) instead of adding another. Each post and edit is audited (review-post, review-edit).
  • Body. A fixed template (listed on the Prompts page as review.post): an italic first line, AI-generated review (Opus 5.5). Not a maintainer decision., with the model name and version taken from the model id stored on the review; a verdict line in neutral words (take: no blocking problems found; take-fix: small fixes needed; hold: changes needed; close: significant problems found; a note when Opus was not sure); the public summary and points that Opus wrote for the PR author (plain statements about the code, with file:line, at most 8 points; no mention of other reviews, models, CI state, mergeability or the pipeline); one Recommendation: … line (below); and Reviewed at <short sha>. Opus's internal reason, fixes and risks are never posted. A review without a valid public field (opus_reviews.public_review is null) is not posted; the PR gets its review after a later Opus review at a new head. The model's text is untrusted: mentions are removed, each item is one line of at most 600 characters, and the body is cut at 6000 characters; the Recommendation line and the Reviewed at line are reserved first and never cut.
  • Recommendation. The last line before Reviewed at says what the pipeline does next, derived at posting time from the PR's merge queue entry and the repo's merge and push approvals, and recomputed when the review is edited at a new head. Take, inside the merge rule and merging approved: merge after CI and checks pass.; take otherwise: merge, after a maintainer's decision.; take-fix: merge after the fixes above., with ; they may be pushed to this branch. when the repo has push approval and maintainers can modify the PR; hold: update the pull request; it will be reviewed again.; close, or anything unclear (no queue entry, declined): wait for maintainer feedback. The line names no rule, tier, score or account.

Hand-off, by final verdict: take goes to Verify, take-fix to Fix-up (with Opus's fix list), close to a "Close this PR?" decision (answered yes, Act closes it), hold waits for a person.

Fix

Opens a PR for open bugfix issues in public Rust repos where the fix is clear. Needs the repo's fix approval.

  • Candidates. No pending scope decision (needs-decision issues need a take), no open PR that mentions the issue, no earlier attempt, not held as a duplicate. Highest work rank first. A duplicate or Backlog hold is checked again right before the claim, the assignment and the PR.
  • Triage. Sonnet decides if the fix is clear. If not, the issue is held with the reason.
  • Live check. Right before the PR is opened and right before the issue comment, the issue is read from GitHub. If it is closed, no PR or comment is made, the attempt is recorded as failed ("the issue is closed") and the mirror row is updated.
  • Patch. Sonnet writes a diff to the listed files plus one regression test. Our code validates it: only listed files, at most 300 changed lines, no binary, symlink or mode changes.
  • Test name. The regression test is <crate dir>/tests/autocraft_regression_<n>.rs, run as the cargo target autocraft_regression_<n>, with n the issue number. Security fixes use a neutral hashed name instead.
  • Sandbox. The patched head must build and pass; the test alone on the base commit must fail. Untrusted code runs only there.
  • Opus check. After the sandbox passes and before anything is pushed, Opus reads the issue, the triage reasoning and the full patch with its test. A reject counts as a failed round and its reasons go into the next round's prompt; the check is recorded with the patch hash.
  • Assignment. The pipeline account is assigned to the issue when triage says fixable, before the first patch round, if nobody is assigned (see Merge queue, "Assignment"). The issue stays assigned while a fix attempt runs or its PR is open and is released when the attempt fails or is skipped. In a repo approved for comments, the fix start also posts one comment, "A PR for this is in progress.", once per issue, when the issue is nobody's or only ours.
  • Rounds. A failure gets a Haiku summary and a new round. Three failed rounds end the attempt (held).
  • PR. Pushed to our fork, opened against the repo with "Fixes #N.", and the issue gets one comment, "A PR for this is in progress". The PR then goes through Review like any other.

Models: Sonnet, Haiku, Opus (patch check). Daily limit 10 attempts.

Fix-up

For a take-fix review, Sonnet applies the listed small fixes to the contributor's branch, so the PR need not wait for them.

  • Needs the repo's push approval, a pushable PR and no conflict. A PR is pushable when its head branch is in the base repository itself (GitHub reports no maintainer edits for those) or maintainers may modify it. A head branch in the base repository is never pushable when it is the repo's default branch, the base of any open PR, or named like a long-lived branch (release, main, master, develop, stable, hotfix, integration). Otherwise the PR is held ("cannot push"), with no write.
  • Cannot push. In a repo with comment approval, one comment lists the fixes (at most 6, cleaned of links and mentions), once per head, if the head is still the reviewed one. The PR shows as "asked the contributor"; a new head goes back to Review. Without the approval it stays held. A head recorded as asked becomes a fix candidate again when the PR is now pushable. The same comment is posted when the fix-up cannot be made on a pushable branch: the fixes are too large or name files a fix-up may not edit, or the 2 tries are used. A PR in needs-fix-up always names what it waits on: the contributor's fixes, the contributor's merge of the base branch, the new review of our pushed fix-up, or a repo approval (comment or push).
  • Safety. The checkout is untrusted: no working tree, hooks or filters run. The diff may touch only the files named in the review, at most 300 lines. Only Rust files (not build.rs) and Markdown files (*.md) may be edited, and nothing under .cargo or .github; a fix list naming any other file holds the PR ("the fixes name files a fix-up may not edit"). Holds of that kind whose files are all editable are tried again. Hunk header line counts are recomputed from the hunk bodies before the checks, since models often miscount; a refusal for a wrong count is not one of the 2 tries. On a quiet pull request (a security fix not yet published) the prompt carries the quiet rule and a patch whose added lines contain a giveaway word is refused like any other refused try; the stored reason names neither the word nor the fix. A quiet pull request is never asked for changes (the ask comment would list the review's fixes): it is held instead. An operator fix-up's comment on it names the files only.
  • Opus check. Before the push, Opus reads the PR, the review's fix list and our patch. A reject pushes nothing, records the try as "rejected" with Opus's reason and counts as one of the 2 tries; the check is recorded with the patch hash.
  • Assignment. A PR is assigned to the pipeline account when the stage starts work on it (after the cheap checks pass, before the model call; a conflict merge before the base merge), only when nobody is assigned. See Merge queue, "Assignment" for when it is released. No "in progress" comment is posted: the comment after the push covers it.
  • Live check. The PR is read from GitHub before the model calls and again after the Opus check. If it is no longer open, is a draft or its head moved, nothing is assigned or pushed and the PR is tried again on a later run.
  • Push. One commit "Apply review fixes", pushed with a lease so a branch that moved is left alone, plus one comment from a fixed template. When the newest comment on the PR, read live, is our own review-fix comment and no review came after it, that comment is edited instead to list the files of both rounds (the first line, then "Pushed further fixes from a later review: ..."); carry and operator comments are always posted new, and if the read fails a new comment is posted.
  • Conflicts. An open, non-draft PR whose final review at the current head is take or take-fix and that GitHub reports as conflicting gets the default branch merged into its branch (same scope, push approval and pushable rule as above; the PR need not be take-fix). Nothing is checked out. git merge-tree computes the merge. A clean merge becomes a commit with two parents (the PR head first), "Merge into ", pushed with a lease; there is no rebase and no force-push. With conflicts, Sonnet (sandboxed, read-only tools) gets each conflicted file as numbered conflict sections, not whole: for each section its id and start line, about 30 lines before and after (shared out where sections are close), the pull request's side and the default branch's side (each with its newlines, so no lines and one blank line differ; the start line is the one in the PR head's file), plus the file's path and line count, quoted as untrusted with the PR title, description and review summary. It returns one resolution text per section id. Our code accepts the reply only when every section is answered exactly once and no other id appears, with no conflict markers. It splices the answers into the merge-tree file, so text outside the sections cannot change. Each answer may use lines from the two sides plus at most 3 others, none of which adds an import, declaration, attribute, unsafe code or a dependency (a Rust file may not gain an item line; a lockfile or a manifest takes exactly one side); a file with CRLF line endings is resolved as LF text and written back with CRLF; a file with mixed or bare CR line endings, or invalid UTF-8, is refused. A PR whose base is not the default branch is skipped, so only the default branch is ever merged in. Merge-tree and the file reads use the plain two-sided marker style, ignoring user and system git config. Opus then checks the resolution: it gets each section (about 10 lines of context, both sides, our resolution) and the PR's own diff, not the diff of the merge, which also holds everything the default branch changed. A reject pushes nothing and counts as a try; so does a resolution so long that the check's input goes over its limit. A resolution with Rust files is stored and linted before it is pushed (one build task: rustfmt on those files, clippy on the merged tree); the formatter's whitespace changes are folded in by the harness. Clippy findings on lines the resolution changed go back to Sonnet with the earlier resolution's diff, and the new resolution gets the same validation, Opus check and lint; the stored row keeps the state linting between rounds, and the next collect picks the re-lint up. After 2 lint rounds with findings left, the try is recorded as rejected with the first finding as its reason. Afterwards one comment from a fixed template ("Merged into this branch to resolve the conflict."). When the newest comment on the PR, read live, is our own earlier conflict note and no comment or review came after it, that comment is edited instead ("Merged into this branch to resolve conflicts (3 times, last at 04:47 UTC)."), with the note line of the latest merge; if the read fails, a new comment is posted. The PR is assigned to the pipeline account only once the checks that need no model pass (conflicted paths, markers, line endings, section sizes). A refusal that the same head always gets again (those checks, the conflict sections over the size limit of 120,000 characters shown to Sonnet or 40,000 for one section, or the conflict sections over the check's 80,000 character limit, measured as the check receives them with the longer side of each section standing in for its resolution; that bound is computed before the claim) is recorded once as held for that head: no second try, and no assignment when it was found before the model call. A model-dependent failure (Sonnet's answer fails our validation, Opus rejects) counts as a try, at most 2 per head; tries count against the daily limit. A PR we can't push to gets, in a repo with comment approval, one comment per head asking the contributor to merge or rebase ; without the approval it is held with no write. The new head goes through Review (Opus reads the PR's full diff for a merge commit of ours, not a delta that would include the base branch's changes) and Verify like any new head.
  • Live read. What the live read shows (conflicting, closed, draft, head moved) is written to the checks table, so a PR that is no longer a candidate is not selected again until the checks sync changes it. A PR that reads as conflicting goes to the conflict merge.
  • Hand-off. The new head is reviewed again. At most 2 tries per PR. Daily limit 20 PRs, pushes and comments together.

Models: Sonnet (patch, conflict resolution), Opus (patch check).

CI fix

A PR we want (final review take, or take-fix once its listed fixes are pushed or posted) whose gate check failed at its reviewed head gets a CI fix. Candidates are open, non-draft PRs in the pilot and in a repo whose pipeline is on, not held, not on Backlog, not conflicting and not blocked by a maintainer's changes request, whose checks were read at the reviewed head and fail. The changes-request test is the merge queue's: a live read newer than the PR's last change decides, otherwise the mirrored reviews and the review decision do. When the failed checks include ones with "gate" in their name, only those count; otherwise every failed check does. Limits: at most 2 tries per head, and per PR over all heads at most 2 pushed CI fixes and 4 tries (our own pushes make new heads). A PR at its limit stays ci-failed, with a note on the item. Steps cifix (no daily limit; it needs push approval or comment approval) and cifix-rerun (daily limit 30 PRs).

  • Reading. The failed check runs of the head and, per failed run, the failed steps' log (gh run view --log-failed) are read from GitHub, cut to the last 4,000 characters per step. Read-only. The log is untrusted: a prompt quotes it as data. A head whose gate checks all passed (an optional check failed), or with no failed check run (a commit status or a run waiting for approval failed), is recorded skipped: final for the head, not a try.
  • Triage, from the log text and no model. A cancelled run: skip, final, not a try. A timed out or startup-failed run, or a network or runner error with no compiler or test error in the log: infra (tested before format). Only the formatter failed and the log holds its Diff in <path>:<line> lines (a step name alone is not enough): format. No readable log: a failed try. Anything else: code.
  • Format. Only files that are in both the PR's diff and the log's Diff in lines are formatted. The build task's environment is read from the PR's base commit, never from the PR's own workflow. The task copies the PR head and runs the image's rustfmt by absolute path on those files (no glob expansion), offline, from outside the checkout, under an empty environment with the toolchain paths fixed, so the PR's .cargo/config.toml aliases, rust-toolchain.toml and environment do not apply. The result is accepted only if it is formatting alone: the Rust token streams of each file before and after must be identical (identifiers, literals with their exact contents, comments, punctuation; only whitespace between tokens may differ). A reordered use, an added trailing comma, a changed string or comment, or / * turned into /* is refused. It also passes the same checks as a model patch (Rust files only, at most 300 changed lines, the guard below). No model call.
  • Infra. The cifix-rerun step records the rerun (rerunning, then rerun) before it calls gh run rerun --failed, once per head, when the repo's CI approval is on. After the rerun the failure is read again: an infra failure again is a failed try only when the failed checks completed after the rerun was requested (older results are waited on, for at most 2 hours; waiting does not count against the step's limit); anything else goes on as code.
  • Code. Sonnet (prompt cifix.patch, high effort, sandboxed read-only checkout) writes a diff from the log and the PR's code. The editable files are the PR's changed Rust files plus files named on a compiler location line (--> path:line) directly after an error line. Our code refuses a patch that edits a test file or CI config (only .rs files outside build.rs and .github are editable), adds #[allow], #[ignore], #[expect], #[warn], #[cfg_attr], #[cfg(...)] or #[should_panic], removes a test or an assertion, changes a hunk inside a #[cfg(test)] item (found in the file at the head), or adds an early return; to a #[test] function. Opus then checks it with the Fix-up check prompt, told the goal is to make the failing check pass without changing what the PR does. On a quiet pull request (a security fix not yet published) the prompt carries the quiet rule and a patch whose added lines contain a giveaway word is refused.
  • Push. Like a fix-up: needs push approval and maintainer edits, pushes with a lease on the head, and posts one comment. Just before the write the PR's reviews are read live: a changes request, or reviews that can't be read, record skipped instead. A branch we can't push to gets the patch as one comment in a repo approved for comments; elsewhere nothing is written. Every try is a row in ci_fixes (shown with the fix-ups on the item page). The row is written as pushing, with the commit about to be pushed, before the push, and replaced by its outcome after; fix-ups and conflict merges do the same, and the push chain includes pushing rows, so a crash between a push and its record keeps the head in the chain and an unsure review earlier in it still needs a person's Merge? answer. The post-merge review lists CI fix pushes with the other pipeline commits.
  • Exits. Every exit records a state. A head that moved or a PR that closed after the work began is a failed try (a moved head is also noted in the checks data); a patch comment that fails is comment-failed, final; a formatter task's formatting row is closed by whichever state follows.
  • After. Upstream CI on the new head decides. The Flow page counts the Fix-up node's CI fix states: to read, to rerun, pushed, gave up.

Red default branch (main-fix). Needs the repo's "Fix red main" approval (off by default; autocraft main-fix-approval lists it, the Repos page switches it, with the other write switches). The step runs per repo when the pipeline is on and the repo's current default-branch head is red (see Main CI), with a daily limit of 20 heads or fix attempts (main-fix). For a red head with no rows yet it reads the failed gate checks and log tails with the CI fix reader, and Haiku (prompt mainfix.classify, medium effort, no tools) sorts each failed check. One row per (repo, head, check) goes into main_fixes with the verdict and a state:

  • flaky (a timeout, a network error, a cancelled job, a lost runner): the failed jobs are rerun once with gh run rerun --failed; the row is rerun-requested before the call. When the head turns green the row is rerun-passed. When the head is red again after a new reading (or 10 minutes after the rerun), the check counts as code.
  • infra (an HTTP 401 or 403 from a service, a missing secret, a quota, an external service down): nothing in the code is wrong. One decision of kind other per (repo, check, red run) asks "Open an upstream issue for the failing check?" with the options Open issue and Not now (and Backlog), the run link and a scrubbed log excerpt as facts. Rows are asked. Only on the answer Open issue does the step open one issue (issue-opened, with the operator note line); Not now makes them declined. Nothing is posted before the answer.
  • code (a compile error, a failing test, a lint or format failure): the row is needs-fix. onCodeVerdict in src/mainfix/index.ts is the one place the fix PR step takes over.

Fix PR. Each needs-fix row of an approved repo gets one attempt (per repo, head and check; src/mainfix/pr.ts), counted against the main-fix daily limit each time the model is asked:

  1. One attempt covers all the needs-fix rows of a head: one patch, one PR (title names the first check and "+N more"), and the rows share the PR number. A head that is still running (a rerun in progress) leaves the rows at needs-fix, uncounted. Optional checks of the repo are never read as failures.
  2. Skipped as nothing-to-do when main is green again or has moved to a newer head ("main is green again", "main moved to a newer head"), or when a fix PR of ours from this red streak is still open, or when an open PR opened or updated after the repo's red-since time names the failing check in its title or body, or changes a file the failure names (read with gh api .../pulls/N/files, at most 30 PRs). The reason carries the PR as #N.
  3. The patch comes from the CI fix path (patchFromFailure in src/cifix/index.ts, shared with the CI fix step): the failed check's log tail, the files its compiler location lines name listed by path when a read-only sandbox checkout of the head is available (shown whole or as excerpts only without one), the cifix.patch prompt with an empty diff, the same validators and guard, the Opus check (fixup.check), git apply --check with exact line offsets in excerpted files, and the region check. It is applied to the default-branch head commit, not to a PR head. A patch that changes Rust files is linted before the push, asynchronously like the fix-up and CI fix lint: the step stores the patch on the rows (state linting, with the lint task, round and files), queues the lint task and ends. The next run of the step for the repo (due once the task ended, or the head moved on) collects it: formatter changes are folded in by the harness; clippy findings on the patch's lines go back to the model, at most 2 lint rounds. The findings continue the model session that wrote the patch when it was last used within 60 minutes (the prompt cache window): the call is a resume of the sandbox session kept with the stored row (session id, account, session store and checkout path), on the same account, with the findings as the message, and the reply is validated, checked and linted like any patch. Otherwise, or when that account is paused or busy, it is a new call with the earlier patch and the findings. The checkout is the read-only copy of the same commit, rebuilt at the same path if it was pruned. Fix-up, CI fix, conflict resolution (one session per resolved file) and this step work this way; the kept session is removed when the row leaves linting (pushed, failed, dropped), at 60 minutes, and by the sweep at the start of each run. Fix issue sends lint findings through its own build rounds and starts a new call, then fix-failed ("clippy findings remain after 2 rounds"); a lost lint task is queued once more. A patch without a Rust file skips the lint. Nothing waits on a timer.
  4. The clean commit goes to the pipeline account's fork on autocraft/main-ci-<check-slug>-<sha7> (pushBranch, fork found or created as for Fix issues). A PR "Fix main CI: " is opened against the default branch with ghOpenPr: the body names the failing check with its run link, the culprit commit (and its PR when the message names one) and the patched files, and starts with the AI note (Sonnet). The row becomes pr-opened with pr_number and pr_url. Approval and the red head are read again right before the push.
  5. fix-failed (reason on the row) records any other end: no patch, a refusal, an Opus rejection, a failed push. The Main CI page shows "needs a person" and nothing retries it.

The PR is one of our own Fix PRs: the merge queue counts main_fixes.pr_number PRs by the pipeline account as whitelisted like Fix issues PRs, and they still need green CI and the Opus review. Only such a PR (branch prefix autocraft/main-ci-, by the pipeline account, in main_fixes) is merged singly and not held while main is red; the branch name alone does not count.

A head the reader finds nothing to act on (no failed check run, or only optional checks failed) gets one nothing-to-do row. GET /api/main-ci carries each repo's row as autocraft ("rerunning failed jobs", "asked an operator", "needs a fix", "checking a fix", "opened fix PR #N", "needs a person", "nothing to do: infra", or null). autocraft main-fix --repo R --apply runs the step by hand.

Verify

Upstream CI is the verification for take PRs in a repo that has CI (the repos' CI runs the full format, lint and test gate). Verify records ci-enough for them without a model call or a sandbox task. The merge queue still waits for CI to be green at the head: a PR with ci-enough and CI pending is waiting-ci, and one with failing CI is ci-failed. Only public PRs whose CI does not fail are verified. A private repo is recorded unavailable ("not verified"), and the PR goes on to the Merge? decision.

A repo has no CI when none of its latest 20 PRs ever reported a check. Until the checks of a repo were read at least once, Verify records nothing for it. In a repo with CI the language does not matter. In a repo without CI, and for the exception below, Verify builds and tests in the sandbox; that needs a Rust repo (a Cargo.toml at the root), and for a non-Rust repo Verify records unavailable.

  • Exception in repos with CI. A bugfix PR whose diff adds or changes a test file gets a Sonnet plan limited to regression or ci-enough; a tests answer counts as ci-enough. If the diff cannot be read, CI is the verification.
  • Plan. Sonnet, no tools, picks one kind: ci-enough (no task), tests (repos without CI only: up to 5 crates, optional test filters) or regression (bugfixes only: a test that fails on the base commit and passes on the head). Our code validates the plan; anything invalid is an error.
  • Result. Pass or fail comes from exit codes only, never from a model.
  • Test name. The regression test is <crate dir>/tests/autocraft_regression_<n>.rs, run as the cargo target autocraft_regression_<n>, with n the PR number.
  • Regression. The test must fail on the base commit and pass on the head. If it also passes on the base, the verification fails with "regression test passes on base" and the PR is held.
  • Failure. Haiku writes a summary of at most 60 words from the failing step's log (credentials scrubbed, quoted as untrusted). The PR is held.
  • Errors. An environment error is retried once per head. An operator can plan a failed or errored verification again from the Item page ("Verify again").
  • Stale. A verification counts only at the head it was made for (the checks table's head when newer than the mirror's, as in Review); a push or a close cancels its tasks.

Models: Sonnet (plan, only where the plan is needed), Haiku (failure summary). Daily limit 30 PRs.

Merge queue

The queue lists every PR whose final review (Review) is take or take-fix at its current head (Merge queue, read-only), with one state each: ready, waiting-ci, ci-failed, conflict, needs-fix-up, waiting-verify, verify-failed, verify-error, needs-decision, decision-answered-merge, declined, refused, merged, and for PRs in an integration batch batch-checking, in-batch and batch-failed. A PR a maintainer has blocked is in changes-requested (below). A PR whose Actions runs wait for a maintainer's approval shows ci-approval (see below).

Optional checks. An operator sets a per-repo list of optional checks (exact check names; autocraft optional-checks [--repo R] | add R NAME | remove R NAME, or the repo page, audited as optional-check-add and optional-check-remove; setting optional_checks:<repo>). A tracked repo starts with sonarcloud / SonarCloud Scan on its list, once. The queue, single merges and batch PR checks count a failure of only listed checks as success, when nothing else is pending or failing (the stored overall and checks stay as GitHub reported them; the Opus review input shows the raw state). The merge step passes --allow-failed NAME to safe-merge for each listed check. CI fix does not treat listed checks as failures to fix, and main CI shows optional for a failure of only listed checks.

Main CI red. While the repo's default branch is red (Main CI page), PRs that would be ready (ready, decision-answered-merge, refused) are in waiting-main-ci ("Waiting: main CI red"): no single merge runs and no new batch starts, because their CI would fail against the broken main. A batch that is already open keeps its checks running but is not merged until main is green. PRs from branches named autocraft/main-ci-* (the fix PRs AutoCraft opens for a red main) are not held; they merge alone and never join a batch. States optional, running and none of main CI do not hold anything.

Runs waiting for approval. GitHub holds the workflow runs of an outside contributor's PR (action_required) until a maintainer approves them; the check rollup does not list them, and safe-merge refuses such a head. The checks job reads the runs of each PR whose latest review is a final take or take-fix at the head the checks describe (one request per PR, again while runs wait) and records them in ci_run_approvals. A PR with runs waiting is in state ci-approval, never ready, and shows no Merge? question until they ran. The CI approval (an operator's per-repo approval, setting ci_approved:<repo>, audited as ci-approve and ci-revoke; autocraft ci-approval shows it) lets the ci-approve step approve those runs (POST .../actions/runs/{id}/approve, audit action ci-run-approve). It reads the PR again first and does nothing when it is closed, a draft or at another head than the reviewed one. It never acts on PRs without a final take or take-fix review at the head, or on the pipeline's own integration PRs. Daily limit 30 PRs. After the approval the PR counts as waiting for CI until the next checks read, and then follows the usual flow.

Duplicate groups. A PR that is a member of an open duplicate group decision has no Merge? question: an open one (or a merge answer not yet applied) is set aside with the note "set aside while the PR is in a duplicate group", and none is asked while the group is open. After the group is answered, the PR that stays open is asked again in the normal way.

Changes requested. A formal "changes requested" review blocks the merge. A PR is blocked when a reviewer with write access has CHANGES_REQUESTED as their latest APPROVED, CHANGES_REQUESTED or DISMISSED review. As on GitHub, it stands across pushes until that reviewer approves or it is dismissed. Comments, COMMENTED reviews and reviews by people without write access neither block nor clear.

  • Live reads decide. Reads at merge time ask GitHub for the latest review of each reviewer with write access (latestOpinionatedReviews(writersOnly: true)), because a reviewer's association with the repo depends on the viewer and can show as CONTRIBUTOR or NONE for a private member. GitHub's review decision CHANGES_REQUESTED also blocks, since it is empty when the repo requires no reviews and cannot decide alone.
  • Stored result. The latest live result of each PR is kept in review_gates, which sync never touches. The queue trusts a live result newer than the PR's last update. Otherwise it uses the mirrored reviews (the latest 10 per PR, with the reviewer's association), where only a stranger association, an approval or a dismissal clears a block.
  • Re-read. Each merge run reads every PR in changes-requested again before it builds its queue, so a block the mirror guessed wrongly clears after one live read.
  • State. A blocked PR is in changes-requested: never eligible, never put in a batch, and asked no Merge? question. A Merge? decision open for it, or answered merge and not yet applied, is set aside like a superseded one and asked again if the block clears, but only when a live read found the block (a block seen only in the mirrored reviews waits for the next live read); a hold or close answer stands.
  • Merge paths. The merge step reads the PR live before it runs any merge command. The built-in safe-merge reads the reviews live too and refuses with "changes requested by a maintainer".
  • Batches. Before a batch PR merges, each member and the batch PR are read live. A blocked member is dropped and the batch is rebuilt without it. Changes requested on the batch PR itself fail the batch: the PR is closed with a comment naming the review, its members are held until they change, and no new batch is built from them.
  • Read failures. After 3 failed live reads in a row the queue shows a note on the PR; the next successful read clears it.

Merge without asking only when all of these hold at the PR's current head:

  • final review verdict is take (not take-fix)
  • size S or M
  • type is bugfix or infra (tests, CI, docs, build)
  • author is on the whitelist (see Contributors)
  • CI is green
  • Verify passed, or recorded "CI is enough" (CI must still be green at the head)
  • GitHub reports it mergeable
  • neither the review nor the pre-merge review at the head names a conflict with an owner statement (below)

Owner memory. What the operators said once is kept and shown to the reviews of related work. A statement is an operator's answer note on a decision, an operator's comment or review on any mirrored item (tracked repos and shared repos alike) that AutoCraft did not post (text that starts with the AI note line, and bot accounts, are left out), or an operator's message in an AutoCraft conversation. Operators are the logins with the operator role. The embed step collects new sources and embeds each statement (item title and text) with the item embedder; nothing waits for a timer. A review (Review or Pre-merge) gets up to five statements from any repo whose cosine similarity to the PR's embedding is at least 0.7, best first and newest first among equal scores, never one said on the PR itself, each with where it was said (repo#number), its kind, the item's title, the date and the text (cut to 800 characters). The reviewer judges what a statement asks for: it names in conflicts ({id, reason}) only a statement the change goes against. A change that follows a statement, or only shares its topic, is no conflict. Unknown ids are dropped. A PR with a conflict never merges by the rule: it gets the "Merge this PR?" decision, and its reasons name the statement's item and an excerpt. An operator's Merge answer lets it merge as for any other PR. The item page shows each conflict with the item the statement was said about, an excerpt and the reviewer's reason.

A take PR that fails any of the first four, is not verified (Verify unavailable) or has no CI checks gets a "Merge this PR?" decision (Merge, Hold, Close) once Verify has an outcome, and its question says "not verified: " or "no CI". Such a PR is never merged by the rule. The merge-ask step asks these decisions for every tracked repo, whether or not merging is approved there; it writes only decisions. One decision per head, so a push asks again. An answer of merge needs a mergeable PR and the head must not have moved; it also needs green CI and a passed Verify (or CI is enough), except for a PR whose question said "no CI" or "not verified".

A conflicting PR also shows what Fix-up does about it next to its state: "conflict: merging " while the merge is queued or active, "conflict: asked the contributor", or "conflict: held" after 2 tries (or when the branch can't be pushed and commenting is not approved).

A PR held by an open Duplicate? decision shows as held-duplicate and is not merged.

Merge step. Needs the repo's merge approval. It lands the PRs that may merge in integration batches (below), runs safe-merge --merge. safe-merge is built in (autocraft safe-merge OWNER/REPO PR --squash|--merge [--allow-pending NAME]... [--allow-failed NAME]...); it refuses unless the PR is open, not a draft, mergeable and every check and Actions run for the head finished green, and it merges pinned to that head. --allow-failed NAME accepts a failed check of that exact name only while GitHub's merge state of the PR is not BLOCKED; at least one check must still have succeeded, and the success message names the failed checks it accepted. $AUTOCRAFT_MERGE_CMD can name another command instead; it is called with OWNER/REPO PR --squash|--merge --head <sha> and must refuse when the PR head differs from <sha>. It never calls gh pr merge itself and never passes --allow-pending; it passes --allow-failed only for the repo's optional checks. A refusal is recorded with its reason and the batch stays open; any other error stops the run. A PR in a repo Verify cannot build (unavailable) is merged on its own through safe-merge (squash, or merge when the commits have more than one author). Haiku writes the failure summary of a held PR. Daily limit 10 PRs: a batch of 6 uses 6.

Single merges. When a repo has at most N PRs that may merge (N is the single-merge limit, default 3), and no two of them change the same file, the merge step merges them one at a time, and starts no batch. PRs the rule covers go first, then PRs an operator approved, each group by work rank. A PR that was refused at its current CI and mergeable state is left out until GitHub reports something different, so it cannot hold up the others. A workspace-level manifest or lockfile (Cargo.lock, a root Cargo.toml, pnpm-lock.yaml, a root package.json) is a file like any other: two PRs that both change one overlap. The changed files come from the PR diffs cached by Review. Before each merge the PR is read again from GitHub; it must still be open at the reviewed head, mergeable, with green CI and the same Verify result. The first PR that is not goes unmerged, the round ends (right after a merge, a PR whose mergeable state GitHub has not computed yet ends the round without a refusal on record), and the remaining PRs wait for the next round; no CI re-run is waited for. Every merge goes through safe-merge as above. With more than N PRs that may merge, two that overlap, or a limit of 0, the integration batches below run as usual. A repo with a batch in flight keeps using batches until that batch ends.

The limit is set by an operator on the Repos page (a number field) or with autocraft merge-single [N] (0 to 100; without N it shows the value). A change is audited as single-merge-max.

Integration batches. A batch starts whenever a repo has PRs that may merge and no batch in flight there; nothing waits for more PRs. It takes PRs in work-rank order, up to the repo's batch size (1 to 50, starting at 20), at most about 10,000 changed lines in all; an L-size PR goes alone. A PR that conflicts with the batch so far waits for the next batch.

  1. Build integration-<repo>-<yyyymmdd>-<n> from the current default branch by merging each PR head with a merge commit in the cached bare clone (git merge-tree, no working tree, no hooks or filters). Contributor commits stay, so GitHub marks each PR merged when the batch lands.
  2. Push the branch to the pipeline account's fork and open a PR to the storytold repo that lists the batch's PRs as links. Upstream CI runs on it and is the only check of the combined tree. If the push or the PR fails, the error is kept on the batch and the next try waits 1, 2, 4, 8 minutes (at most 30); after 5 failures the batch fails and its PRs return to the queue. The batch PR comes from the pipeline account's fork, so GitHub may hold its workflow runs for approval; where the repo's CI approval is on and every member was reviewed at its batched head, the ci-approve step approves them, otherwise the batch shows "batch PR runs wait for a maintainer's approval".
  3. When upstream CI is green and the PR is mergeable, safe-merge --merge lands it. The repo's batch size grows by one.

If upstream CI fails, the batch is split in half and each half is retried, and the repo's batch size halves (minimum 1). A single PR that fails goes on hold (batch-failed), with the names of the failing checks as the reason, until it has a new head. A person closing the batch PR holds its PRs the same way.

Rebuilds. A PR in the batch that is no longer mergeable by the rule or the operator's answer, or that was closed, merged or pushed to on GitHub, leaves the batch: right before the batch branch is pushed and again right before the merge command one query checks every member for state OPEN at the batched head, and the rest are rebuilt in a new batch (merge, not rebase). When the default branch moves, the batch is kept if its tip still merges cleanly with the new head (GitHub's mergeable flag and upstream CI on the batch PR cover the rest); a conflict, or GitHub reporting one, closes the batch PR and rebuilds. A batch PR merged by someone else is recorded as merged.

Assignment. A stage assigns the pipeline's account when its work on the item starts (audit action assign): the fix-up, conflict merge and CI fix before their model call or push, the fix issue step after triage, a single merge right before safe-merge, and the batch step when a PR is put into a batch. It reads the assignees from GitHub first and assigns only when the item is open and nobody is assigned. It never assigns again when the audit shows we assigned it and the assignment is gone: a person who removed us is final. A later start after our own unassign assigns again; the fix-up checks again right before its push, because the planner may have released the PR while the model worked. The planner decides the release (the unassign step, audit action unassign; only the global switch is needed): the assignment stays while the PR is on the path to merge (in flight, in a batch, a fix-up, conflict merge, CI fix, stored-patch collect, pre-merge review or merge is due, or the state is ready, waiting for CI, pre-merge review, verification, CI approval or a green main, decision-answered-merge, needs-fix-up, ci-failed or refused), and is removed in every other open state (a PR whose review is stale only because of the pipeline's own push or comment keeps it, since its re-review is due): waiting on a person (needs-decision, declined, changes-requested, held, backlog, duplicate, opus-hold), opus-close, draft, review-stale, scope, out of scope, verification failed, a failed batch, a merge held by an operator, CI runs that wait for a maintainer because the repo's CI approval is off, and a stage that gave up (fix-up tries used up or the branch can't be pushed to, CI fix failed, capped or ended without a push, a conflict the conflict step only asked about or holds, whatever the queue state). A refused merge keeps the assignment, and so does a batch that could not open its PR: both return to the queue. It stays when work is due or in flight. It removes only our own assignment, only while we are the sole assignee, and reads the assignees from GitHub just before the write. An issue stays assigned while its fix attempt runs or its fix PR is open and is released when the attempt fails or is skipped, or the issue is held or out of scope. A closed or merged item keeps its assignee. The batch PR is not assigned.

Limits and exclusions. PRs in repos with no CI, and PRs in a repo Verify cannot build, are merged on their own (a batch PR would never turn green). A batch with more PRs than the daily limit has left waits, and rebuilds and splits take at most what is left. A merge job that started, opened, advanced, split or merged a batch counts as having made progress. A crash after the batch PR was created is repaired by adopting the open PR of the branch. Fetches into the shared cache retry on ref-lock errors.

The pipeline's own integration PRs (author the pipeline account, number in merge_batches) are left out of classify, labels, review, Opus review, duplicates, decide, act, fix-up, verify and the queue. There is no Opus review of the combined diff. The Merge queue page lists the batches with their PRs, state and batch PR.

Queue controls and Fast track

Operators control what merges next from the Queue page, the CLI or the API. Every control is audited.

  • Hold merge (autocraft merge-hold <repo#n>, merge-release): reviews, fix-ups and Verify go on, but the PR does not merge alone or in a batch until Release. It differs from Backlog, which stops all work on the item. A hold on a PR already in a batch makes the next merge run rebuild the batch without that PR (the batch PR is closed and a new batch holds the others); Remove from batch does this at once. A hold set while a merge is in progress is checked again right before the merge command runs.
  • Remove from batch (autocraft batch-remove <repo#n>): holds the PR and ends its batch. The batch PR is closed through the GitHub write path (audited, on the GitHub activity page). The other PRs return to the queue and the next merge run builds a batch without the held PR. Neither control removes the pipeline account's assignment on the member PRs.
  • Stop batch (autocraft batch-stop <id>): closes the batch's integration PR. Each member PR is held (audited per PR), so the next merge run does not rebuild the same batch; release them one by one with Release or merge-release.

Fast track (autocraft fasttrack add|remove|list) marks PRs or issues, given as a GitHub URL, repo#n or owner/repo#n. Fast-tracked items go first in every stage that orders work by the work rank (Decide, Review, Opus review, Fix, Fix-up, Verify, merges and single merges), in the order they were added; new ones join the end. Removing the mark returns the item to normal ranking.

  • A fast-tracked item runs through every stage even when its repo's Pipeline switch is off, and it ignores the pilot list. Other work of that repo does not run: sandbox tasks are claimed only for fast-tracked items and a repo that is off touches only batches made of fast-tracked PRs. The Fix PR of a fast-tracked issue takes the issue's place. Repos whose best candidate is fast-tracked are visited first, in fast-track order. The global pipeline switch, per-repo approvals, daily limits and the merge rule are unchanged.
  • An item that is closed or merged is ignored: it drops out of the list and its positions, and its row stays in the fast_track table.

The Queue page API (GET /api/queue/page?tab=all|review|fix|verify|merge&repos=pipeline|all|<repo>) serves the tabs. The default repo filter is the repos whose pipeline is on plus fast-tracked items of any repo. Rows carry their fast-track place ("2 of 5") and hold. GET /api/merge/held lists the held PRs as repo#n. The Merge tab adds "Next merges": what merges next and what each PR waits for (CI, Verify, re-review, batch check, hold), read from the merge queue states.

Pre-approved merge

A resolution card's fixup step with merge set is an operator's Merge answer given ahead of a fix-up. A fixup step without it only queues the fix-up, and a review step marks the head's review stale so Opus reviews it again.

On a scope question the fix-up cores (fixup-merge, x:fixup) also keep the PR in core: the card settles with the answer small-extra when its extras add the "small extra" label or the PR already has it, and with take otherwise. Validation allows a fixup step together with an answer settle in exactly this case (a scope decision, answer take or small-extra). The card records the answer after its other steps and before the fix-up is queued, so the fix-up's plan check and the later review see the PR in core and a merge can follow. If the fix-up cannot be queued, the step error says the question is answered. Choices stored under a fixup-merge:<small-extra|take> or x:fixup:<small-extra|take> key read as the plain key.

  • Fix-up. The operator's instructions (1 to 1500 characters, never posted) are queued per head (operator_fixups). The Fix-up step works them with source operator in its fixups rows: the model gets the instructions as a trusted operator block in place of the fix list, may edit any existing file of the repository except what every fix-up refuses (CI workflows, cargo configuration, build scripts, files that instruct coding agents) and the build and trust files (Cargo.toml, Cargo.lock, rust-toolchain*, .gitmodules, .gitattributes, CODEOWNERS, .claude/), and the patch goes through the same checks, lint and push approval as any fix-up. The PR's tries (2) apply to operator fix-ups as to the review's. After a push the comment on the PR reads "Fixes included:" and a numbered list of what the fix-up changed, taken from the model's own CHANGES: list after its diff (the files when it gave none), each item cleaned to one plain line, left out when it repeats a run of 12 words of the instructions, and checked by the reference lint; the instructions are never quoted. The review's own fix-up and the merge queue leave the PR alone while the pre-approval is before its Merge answer.
  • States (preapprovals, shown as Item.preapproval): fixup (queued or running), review (the push's head waits for its Opus review), ci (the review says take, is sure and not stale; waiting for CI, then for a clean pre-merge review of the head), queued, merged, asked, cancelled, failed. Each change is evaluated on the runner's tick from rows other steps write (fixups, reviews, checks, the mirrored head, merges), so it has no timer and no wait of its own (the one time comparison is made on the tick, as the next paragraphs say). Each one writes an audit row (preapproval) and a system line in the item's conversation.
  • Hand-over. Only when, at the pushed head, the review is a sure take that is not stale (read again just before), CI is green and the pre-merge review is clean (the planner runs it for a pre-approved merge in ci; a failed one is retried like any other, then ends the pre-approval as asked), the PR's Merge? decision at that head is answered Merge in the operator's name, in the same way a dashboard answer is written. The move from ci to queued and the answer are one transaction, so a cancel that ran first leaves nothing answered. The merge queue takes it from there with every check it always makes (CI, safe-merge). The pre-approval never merges anything itself. It ends merged when the queue merged that head, and cancelled when the answer stops counting (the operator lost the role, merging was revoked, the answer was withdrawn).
  • Not take or CI not green. A fix-up that did not push (failed), a review that is not a sure take, or a pre-merge review with defects, or a CI or conflict problem the pipeline's own fix steps gave up on (asked) ends the pre-approval and asks a Merge? question at the head the normal way, so Prepare writes its options. While red CI or a conflict can still be fixed by the CI fix or the conflict merge, the pre-approval waits; when a base merge that left the diff unchanged pushes a commit on top of the pushed head, that commit becomes the pre-approval's head and it goes back to review; a CI fix or a changed-diff conflict resolution ends the pre-approval and the Merge? question is asked at the new head: the new head needs a fresh sure take review, a clean pre-merge review and green CI.
  • Plain Merge answer. An operator's plain Merge answer at head H carries across the pipeline's own base merge to H2 only when the merge left the PR's own diff unchanged (own_diff same): a row starts in review at H2 with no fix-up, and the same review, pre-merge review and CI checks run before the Merge? question at H2 is answered. After a CI fix or a conflict resolution that changed the PR's diff, the answer does not carry and a Merge? question is asked at the new head. Rows of untracked repos are left alone until the repo is tracked again. An error while advancing a row is recorded once in the item's trace (audit preapproval-error).
  • Cancelled. When the head becomes any commit other than the fix-up's push (someone else pushed; the pipeline's own base merge that left the diff unchanged continues the row, except while it is queued), when the PR closes or merges elsewhere, or when an operator cancels it (POST /api/items/:repo/:n/preapproval/cancel, audited). A cancel always takes the Merge answer it wrote back, in the same transaction as the state change. A queued PR that is in an integration batch is first removed from the batch (the operator control: the batch PR is closed; the hold the removal sets is released again, so the PR returns to normal handling); the cancel is refused only when a merge job of the repo is running or the PR is merged. A head that goes back to the commit the fix-up started from counts as another push once a review of the pushed head exists or a repo sync has finished after the push (the mirror may lag until then). While an operator fix-up request can be worked (same head, pushable, push approved, not conflicting, not a draft, tries left), the queue also leaves the PR alone; a request that can no longer be worked is ended with a reason in the thread, and a pre-approval whose fix-up cannot run ends as asked. A merge that lands after a cancel turns the row into merged.

Act

Makes the GitHub comments and closes that follow an operator's answer. No model. Needs the repo's comment approval; daily limit 20 items.

Trigger Action
Scope decision answered close One comment, then close
"Close this PR?" answered close One comment, then close the PR
Duplicate decision answered close Duplicate of #y., then close
Duplicate group answered Keep #A or Keep #N instead The stored details comment on the kept item, then the stored comment and close on each member to close; while the GitHub identity is the app, the comments are the app's and each close is made as the answering operator
  • Close reasons. An issue closed as a duplicate gets GitHub's reason DUPLICATE, linked to the kept issue; when the kept item is a PR, or GitHub rejects the link, the reason is NOT_PLANNED. Scope and close answers close issues as NOT_PLANNED. A PR has no reason.
  • Close this PR? The step asks it for each PR whose latest review says close at the current head: options Close, Hold, Keep open. A new head asks again, and an answer given at an old head is skipped.
  • Comment rules. Comments are fixed templates in code (listed on Prompts): one or two short factual lines, a fixed first sentence and at most Reason: <text>, cut to one line of 200 characters with @, URLs and Markdown links removed. The reason text may come from a model; the decision page shows the exact comment, and the operator's answer approves that text.
  • Before writing, the step re-reads the item and skips it, without a comment, when it is already closed or merged, gone, or its head moved. A comment is never posted twice.

Post-merge review

A second Opus review of every PR the pipeline merged, to catch what the first review and the merge let through (for example a requested fix that a conflict merge dropped). Only merges recorded after the stage started, or since autocraft postmerge backfill --since <date>, are reviewed, and only for PRs in the pilot. Each merged PR is reviewed once, oldest merge first; there is no daily limit on the model step. A backfill more than 14 days back needs --yes.

  • Input. The PR's title, body and author; the merged diff (the merge commit against its first parent, kept to the files the PR changed, code files only, the same size cap as Review; for a PR merged through an integration batch, the PR's own diff at the merged head, which includes the pipeline's pushes to the PR branch; when the PR's own diff cannot be read there is no diff and the review is tried again later); the commits the pipeline added (conflict merges, fix-ups, parts carried over from duplicates); the PR's earlier Opus reviews; the open issues and PRs, and those closed in the last 30 days, that mention the PR number or one of its files, by number, state and title, to avoid duplicates; and the follow-up issues earlier reviews of the PR filed (filed_before), with their state. The call reads a checkout at the merge commit with the same read-only tools and reference mount as Review, and its reply goes through the same lint and fix turn.
  • Findings. Each finding is a defect (wrong behaviour, a crash, data loss, a correctness bug) or minor (style, wording, commit titles, stale comments, test-only gaps), with a title, a public body, file and line, the number of an open item that already covers it, and two internal notes: the stage that should have caught it and why it did not. An empty list is a valid review. A reply that is not valid is asked again once, then stored as an error and tried again after an hour, three times at most, after which the review is held; a diff over the size cap is held.
  • Filing. The postmerge-file step opens one GitHub issue for each defect that no open item covers, in repos approved for comments: the title is the finding's title, the body is the note line (AI-generated issue (<Model>). Not a maintainer decision.), Follow-up to #<n>. and the finding's text, then the Location: line when the finding names a file. Daily limit 20 issues; defects over the limit are filed by later runs, and every attempt counts against it. Public text outside code is cleaned: URLs go, Markdown links keep their text, issue references (owner/repo#n, #n, GH-n) read "issue n"; code spans and closed fenced blocks keep their URLs and references, and an unclosed fence is not code. Every @ before a name is removed, code included. A title or body that names the product or the pipeline's GitHub account is stored and never filed. No issue is filed for a security fix whose advisory is not published yet (its quiet pull request); its findings are only shown on the dashboard.
  • Safety. Before the create call the step writes a follow-up row in state filing; after it, the row becomes filed with the issue number in a separate step. A row left in filing (crash, lost response, failed record) is never retried: the issue may exist, the item page says "Outcome unknown, check GitHub", and the run stops. A refusal from GitHub that cannot have created an issue (issues disabled, no permission) is stored as failed and tried again after 1 hour, then after 6 hours, three attempts at most. A defect whose cited file is no longer on the default branch is skipped as stale. Defects in the same file, within 20 lines and with a similar title are filed once: the first of a run, or one this stage filed in the last 30 days; the others are marked duplicates of it. A PR that already has a filed follow-up from an earlier review never files automatically again, and neither does a PR that itself fixes a follow-up issue: their findings are stored and shown as not filed.
  • After filing. The issue is mirrored, classified and fixed like any other issue. It counts as a pilot item when the PR it follows up is one, and so does the Fix PR opened for it.
  • Item page. A merged PR shows its findings with severity, text, file and line, and the issue filed for each defect, the duplicate it was marked as, why it was not filed, and the follow-ups of earlier reviews. Operators and maintainers also see which stage missed the finding and why.
  • Commands. autocraft postmerge review <repo>#<n> [--again] reviews one PR now (refused while the runner has a postmerge job running for the repo); autocraft postmerge file <repo>#<n> <finding> files one defect of the PR's latest review, counted from 0, whatever holds the PR's automatic filing back (the PR must still be in the pipeline's scope: repo flag and pilot); autocraft postmerge backfill --since <ISO date> [--yes] makes the step review the pipeline's merges since that date. All are logged in the audit log.

Security deep scan

Audits the default branch of one repo for vulnerabilities an outsider can reach, then fixes confirmed findings privately and lands each fix as a pull request that does not say what it protects against. It is not part of the daily pipeline: an operator starts each scan, the private fix of each confirmed finding starts on its own, and an operator starts every other step on a finding (Land, Advisory, Publish). The pipeline's on/off switch and daily limits do not apply. Its steps (security-scan, security-fix, security-land, security-advisory, security-publish) are jobs with no registry entry, so they get the default step time limit. The only model is Opus at high effort, with tools Read, Grep and Glob on a read-only checkout (no shell, no web tool).

  • Starting a scan. Only an operator, from the repo page or, on a test repo, with autocraft security scan REPO --as LOGIN (--cap USD | --no-cap). The spend cap is a dollar amount above 0 and up to 100,000, or none. A repo has at most one active scan (modeling, scanning or verifying); a second start is refused with 409. The scan pins the default branch's head commit; every call, and any later fix, works on that commit. The scan's job and agent runs are recorded under the pseudo repo (security):<repo>, so job and run listings that hide untracked repos hide them. Stopping a scan cancels its job; the scan ends stopped before its next call. A scan whose job ended without finishing is closed as stopped (job cancelled) or failed, and one that was never queued fails after a minute. Scan states: modeling, scanning, verifying, done, stopped, capped, failed.
  • Threat model. security.model (Opus, high, 60 turns) lists entry points (kind from a fixed list, else other) and splits the code into areas, each with paths, entry points, a risk from 1 to 5 and a reason. Areas are sorted by risk, highest first (ties keep the reply's order), at most 60; an area whose paths are not in the checkout is skipped. A reply with no valid area is asked once more, then the scan fails.
  • Area calls. One security.area call per area, in risk order (Opus, high, 60 turns). A finding is kept only with confidence of at least 0.8, a title, severity (critical, high, medium, low), reach and impact, and at least one ref with a path and line (at most 8 refs, at most 12 findings per area). The first ref is the sink; a finding whose sink is not a real line of a file in the checkout is dropped, other refs that are not real lines are dropped. The model sets urgent only for a flaw that is easy to exploit against current users and needs an immediate release; it only marks the finding, the operator picks the route. A reply that cannot be read is asked once more; after that the area is failed and the scan goes on.
  • Verify. One security.verify call per new finding (Opus, high, 40 turns) tries to disprove it. The finding stays only with verdict confirmed and a score of at least 8 of 10; otherwise it is disproved. The model may propose a test; the scan stores it and does not run it. When the call gives no readable answer after two tries, the finding stays listed as not verified. A finding still unchecked when the scan ends is listed with the same note.
  • Spend cap. Before every call (and again before the repeat of an unreadable one) the scan stops as capped when the cost so far plus the call's expected cost would pass the cap. The expected cost is $2 for the threat model; for an area, the mean cost of the area calls so far, or before the first one $1 plus the area files' size in bytes divided by 200,000, at most $6; for a verify, the mean cost of the verify calls so far, or $0.60 before the first. A call that answered without reporting its cost counts as its expected cost. Money spent is added to the scan and to the area, and a call that stopped the scan is never started, so the cap is not passed by more than the error of an estimate. With no cap the check is skipped.
  • Continuing a scan. An operator can continue a scan in state capped (POST /api/security/scans/<id>/continue with {"cap": number|null}, the Continue button on the scan header, or on a test repo autocraft security continue REPO SCAN_ID --as LOGIN (--cap USD | --no-cap); audit action security-scan-continue). The new cap must be above what the scan has spent, or none; the repo must have no other active scan (409), and a scan in any other state is refused with 409 (a stopped scan was ended by an operator and may have no threat model, so it is not continued). The scan keeps its id, pinned commit, threat model, areas, findings and cost, takes the repo's active-scan slot again and queues a new security-scan job. Its state is verifying when the cap left findings unchecked, modeling when the cap stopped it before the threat model existed, else scanning. The runner checks out the pinned commit (the scan fails if the checkout is another commit), skips the threat model and every area already done or failed, first verifies the findings the cap left unchecked (they return to unverified; findings an operator already acted on stay as they are), and goes on in risk order. An area the cap stopped between its call and its verifies is not scanned again. The cap check uses the new cap against the total cost, and the estimates start from the mean cost of the calls the scan already made.
  • Estimate. After the threat model the estimate is the cost so far plus the sum of the area guesses. After each area it is the cost so far plus the remaining area count times the mean cost per started area, which includes that area's verify calls.
  • Dedupe. A new finding repeats an earlier finding of the same repo (any scan) when its fingerprint (first ref's path and line, plus the title reduced to lower-case words) is exactly the same, or when, for an earlier finding that is neither disproved nor a repeat, the sink file is the same, the sink line is within 3 lines and the category is the same or the titles share at least half of their words longer than 2 characters. A repeat is stored hidden, pointing at the earlier finding, which shows it in its timeline, and is not verified again. A disproved finding suppresses only an exact fingerprint match, so a reworded report of the same line can be raised again.
  • Findings and states. Verify and dedupe states (unverified, disproved, repeats) are never listed. Listed states: new, dismissed, backlog, fixing, ready, landing, awaiting-admin, landed, advisory, published. Operator actions: Dismiss (needs a reason; from new, backlog, ready, awaiting-admin), Backlog (from new, dismissed), Reopen (from dismissed, backlog, to new), Fix (from new, backlog; needs a verification), Land and Advisory (from ready, awaiting-admin), Publish (from landed, advisory). A step moves the finding to its working state when queued and a second press while it works is refused; a finding left in fixing, or in landing with no pull request, after its job ended goes back to new or ready with a note.
  • Scan pages. The Deep scans page (/security/scans, GET /api/security/scans?repo=) lists scans newest first with state, spent against cap, areas, findings and start; the repo page's Security part links to it filtered by repo. A scan page (/security/scans/<id>, GET /api/security/scans/<id>) shows the scan header (an operator can Stop an active scan and Continue a capped one), the threat model (summary, entry points, areas with risk, state and cost), every model call in order and the scan's findings. Each call is one security_calls row; its agent_run_id is the first agent run the call made, set when the call ends. A call still running, and a call of a scan from before the column, takes the first agent run listed under the scan that started within the call's time window. A call opens inline to the run's prompt and output (the Agents page's run detail) and links to /agents/<run>; a running call shows its latest progress line. The pages follow the security and agents live topics (security_calls is in security, which the planner ignores).
  • Who sees it. Operators and maintainers read scans and findings; only operators act. Everyone else gets 404 from every endpoint, so the endpoints do not show that findings exist, and sees no scan jobs or agent runs.
  • Scan test. Optional, behind the Run scan tests switch (off by default). For a finding that survives verify and has a proposed test, security.scantest (Opus, medium, 30 turns) writes one Rust integration test file; our code turns it into a diff that adds that one file and checks it like a regression test (at most 150 lines). The scan queues one build task (step scan-test, hidden from viewers like fix tasks) that builds the crate on the pinned commit and runs only that test, before the automatic fix is considered. A later runner tick reads the task with no job: a failure at the test step is confirmed, a pass is not-shown (the finding gets the note "The proposed test passes on the current code."), a build failure, a timeout, a second environment error or more than 4 hours is could-not-build. Findings are never dropped or re-rated. While a test is building or not-shown the automatic fix skips the finding (an operator can still press Fix); the fix prompt then receives the test and its result as scan_test. The finding page shows the badge and the test.
  • Fix. security.fix (Opus, high, 40 turns, up to 3 rounds) writes one diff on the pinned commit: edits to existing .rs files of the Rust crate that holds the sink, plus exactly one new integration test file with a neutral name derived from a hash of the repo and finding number (no finding number or topic in it). The diff may change at most 300 lines, may not touch manifests, lock files or build scripts, and must apply with git apply --check. The model gets the build check tool for fmt, clippy and test. The reply's title (at most 72 characters), summary (at most 600) and every line the diff adds must pass the word check below. Once the wording checks pass, the job stores the round in security_fix_rounds (state building, with the kept session), queues the round's two build tasks (neutral: no finding number, the hashed test name, the pinned commit) and ends; no job waits on a build. The worker container builds the patch and runs the crate's tests, fmt and clippy on the changed lines; the new test must fail on the pinned commit without the fix and pass with it (a test that passes without the fix is a failed round); formatter changes ride in the same commit. security.fixcheck (Opus, high, 30 turns) then reviews the diff: it must remove the defect at its cause, keep the test meaningful and the change small, and reveal nothing. Fix starts on its own when verify confirms a finding (state new with a verify score of at least the threshold), once per finding: a finding that has had a security-fix job that was not cancelled is never started again automatically. The job counts as an automatic one, so switching the pipeline off cancels it while queued; the runner starts it again at start-up and on each planner pass while the pipeline is on, after moving a finding left fixing by the cancelled job back to new. The job is requested by pipeline and audited security-finding-fix with auto: true; its spend is not part of the scan's cap. When the round's tasks end, the runner's planner pass queues a security-fix job for the finding (advanceSecurityFixes on every runner tick, requested by whoever started the fix; a fix the pipeline started continues only while the pipeline is on; none while one is queued or running). A round that builds longer than 4 hours counts as ended: its unfinished tasks are cancelled and it is read as an environment error, then as a failure after the one retry, and a finding with a building round is not reset by the job-less check. That job reads the result: an environment error queues the tasks once more and ends; a failed round is repeated, in the same job, at most 3 rounds in all (a round that fails before its build counts too): the next round continues the model session of the round before (same account, same read-only checkout), with only the failure reason and the harness output as its message, while the prompt cache is warm (RESUME_WINDOW_MS); outside the window, or when the account is busy or paused or the session store is gone, it is a new call with the reason and the last diff. The session is kept with the building round and continues in the job that collects it, within the window; the sweep at the start of each run removes it from a round that waited longer, and it is deleted when the fix ends. The age-based prune of session stores covers a crash. The review stays a separate new call. The job log and security_calls.resumed record which rounds were resumes; if none succeeds the finding returns to new with the reason as a note. An operator's Fix starts it again. A fix the build cannot cover (a finding outside a Rust crate) is refused the same way. On success the commit, diff, title and summary are stored with the finding and the commit is written to a local ref in the bare cache. The commit is authored by the box account and is never pushed before Land or Advisory.
  • Word check. Text bound for a public place may not contain a giveaway word: security, vulnerability, exploit, attack, malicious, CVE and GHSA ids, advisory, injection, traversal, overflow, out of bounds, RCE, untrusted, crafted, sanitize, zero-day, payload, escalate, bypass, and their forms. Added code lines are checked against the short list (security, vulnerability, exploit, attack, malicious, CVE, GHSA, advisory) because identifiers such as an overflow error are ordinary code; added comments, the names of added files and added function names (underscores, slashes and dots split words) are checked against the full list.
  • Land (quiet route). The default route for any finding. The Land step pushes the stored commit to the pipeline account's fork under a neutral branch (autocraft/fix-<title slug>-<random hex>, the form of other pipeline branches; while the GitHub identity is the app, to the base repository) and opens a pull request with the fix's title, the summary, and one line saying the regression test fails without the change and passes with it. Before anything is pushed the title, body and branch pass the word check, and the write layer checks them again, with the commit message, so no caller can skip it. The pull request then goes through the normal Verify, review and merge steps; the Land step does not merge. Land stays landing with the pull request number. The landing poll (below) moves it on.
  • Quiet pull request. A pull request is quiet from the moment it opens until its finding is published or dismissed; a quiet pull request that is closed unmerged stays quiet for as long. The finding goes back to ready and the next Land opens a new one. Nothing about the finding may reach a public place or a viewer in that time. These protections apply:
    • No review is posted on it (the pipeline never posts reviews on its own pull requests), and it gets no security label; the dashboard's verdict for it carries no security flag and, for viewers, no referee reason.
    • The review's fix list is never asked as a comment: the fix-up step holds it as "cannot push" with the reason "a quiet pull request is not asked for changes".
    • An operator's fix-up, a CI fix, a conflict resolution and a default-branch fix whose culprit is the quiet pull request use a prompt with the quiet rule. The lines the model writes must pass the word check or the try is refused as "the patch uses wording this pull request must not contain". A conflict resolution checks only the lines the model wrote, not those taken from either side.
    • A "Close this PR?" decision on it has no model reason and the close comment is the plain template. Conversation cards on it drop any step that posts text, and answering such a card is refused with 409.
    • The pull request is left out of duplicate pairing, and its post-merge review is only shown: no follow-up issue is filed for its defects, and postmerge file refuses it.
    • For viewers the dashboard veils it: its decisions show no comments and no model output, the item trace leaves out model events.
    • No GitHub write about the finding is shown in the feed, activity page or live topics (the write actions are not in the public action set).
  • Advisory route. An operator picks it for an urgent finding (the area call's urgent mark shows as a badge; no code picks the route). The Advisory step creates a draft repository advisory (with the affected-version range, as under After merge), starts its temporary private fork, pushes the stored commit there with the box user's token (the GitHub App cannot reach these forks), and opens the pull request inside the fork. When GitHub refuses a step with 403 or 404, the finding becomes awaiting-admin with a note naming what a repository admin must do (allow advisories for the box account, start the fork on the advisory page, add the box account to it, open the pull request, merge it). The steps already done are kept and are not repeated on the next press; any other failure returns the finding to ready. An admin merges the fork's pull request on the advisory page. Land from awaiting-admin abandons this route: the fork and pull request are forgotten (the advisory id stays) and the quiet route starts.
  • Landing poll. Read by the sync run when the last poll is more than about two minutes old, with the pipeline on or off; it only reads GitHub state and has no timer wait. A quiet pull request that the mirror shows MERGED moves the finding to landed; one CLOSED moves it to ready with a note; an open one gets a note with the reason it waits (draft, conflicts, failed or pending checks, a refused merge, or waiting for the merge step), worded without naming the finding. An awaiting-admin finding moves to advisory when its fork pull request is merged or when the default branch holds a commit with the fix's patch id.
  • After merge. When a quiet fix lands the poll creates the draft advisory (best effort; Publish creates it when this failed). One claim row keeps the merge poll and a Publish press from creating two drafts; a claim older than 10 minutes counts as a crashed attempt. The draft's text holds the impact, how it is reached, the affected code and the fix's pull request, and stays private to repo admins and security managers. Publish (from landed or advisory, after a release) creates the draft when there is none, sets a range on a draft that has none, publishes it, and, with the CVE option and on a public repo, requests a CVE (a failed request is noted, the finding is still published). Every advisory write (create, fork, pull request in the fork, range, publish, CVE) runs as the box account whatever the GitHub identity is, and is recorded as such.
  • Advisory range. A draft advisory names its affected versions as <= <version>, the version in the Cargo.toml of the crate that holds the finding's first reference at the scan's pinned commit (the workspace version when the crate inherits it); when no version can be read the range is <= <first 12 characters of the commit>. GitHub refuses to publish an advisory without a range, so Publish first sets one on a draft that has none.
  • Commands. autocraft security scan REPO --as LOGIN (--cap USD | --no-cap), continue REPO SCAN_ID --as LOGIN (--cap USD | --no-cap), stop SCAN_ID --as LOGIN, list REPO, show REPO N and act REPO N fix|dismiss|backlog|reopen|land|advisory|publish --as LOGIN [--reason TEXT] [--cve]. scan, continue, stop and act are refused unless the repo is marked as a test repo and --as names an operator (audit rows are marked as a session); list and show only read.

Conversations

Each item can have one conversation with Opus, shown beside its decision. Everyone with access to the repo reads it; only operators write, edit, run and dismiss. It belongs to the item, so it stays when a decision is asked again.

  • Start. An operator writes the first message, or the prepare step stores its summary and drafts as the first Opus turn of the item's conversation when the item has none.
  • Reply. The Conversation step (daily limit 30 messages, Opus, effort high) answers each operator message with one claude -p call in the sandbox: the item's repository, the workspace and the item tools (see Trust boundary), read-only, Read, Grep and Glob only. It runs while the pipeline is On, for any tracked repo, including one whose pipeline is off. Tool output is not stored; Opus reads again when it needs to.
  • Progress. The call runs with --output-format stream-json --verbose, and each tool call becomes a short plain line ("Reading craft-i18n/packs/hu/…", "Searching for …", "Explorer: Reading …", "Looking up repo#n"). The answering message keeps the last five lines (at most one write a second) and the page shows the latest under "Opus is replying…", the earlier ones on hover. The lines are cleared when the reply is stored; they hold no file contents.
  • Prompt order (conversation.turn on Prompts): the fixed prompt and action list; the item block, written once when the conversation starts and sent byte for byte afterwards; the earlier turns oldest first, each as stored; the new message last. Nothing that changes comes before the newest turn, so each call reuses the cached start of the one before. When the head commit, title or text, state, labels, comments, or the open decision or its answer change after the block was written, a system turn ("The PR was updated (labels, comments): ...") carries the changed fields before the next call. A system turn that arrives while Opus is answering is held and placed after the reply, so the prompt already sent stays the start of the next one. All GitHub text is quoted as untrusted data.
  • Choices. On an item whose open decision has cores, a reply may end with a choices block instead of cards (same format as the prepare's): the entry of each listed core replaces that core's draft whole, add appends cores (three at most in all), drop removes added ones, pick is required, and ask becomes a proposed comment card. The merge core takes a comment extra (posted before the merge); closing cores use their reason as the closing comment. The prompt lists the cores in the item block and, when the list changes, in a <cores> line of the next operator turn; the stored turn carries a <choices> block with the validated drafts. A turn's choices are merged into the decision's current version, source conversation. A reply's actions block on such an item is not read as choices: a card that only asks the author is kept, the others are dropped with a note. The rest of this section describes the cards of an item without an open decision, or whose decision has no cores (a decision about several items).
  • Cards. A reply ends with resolution cards, drafts for the question's options plus extra outcomes: at most one resolution per option, at most two extra outcomes (handled, a close, a step-only action), the first being Opus's pick, plus at most one "ask" card. A card for an answer option shows that option's key (option). A resolution has ordered steps and a settlement, and one button runs both. Steps: a comment (its text is the card's editable text), labels of the managed set, and last a close (completed or not_planned; a PR is closed without a reason) or a duplicate close of another item of the repo. Settlement, for an item with an open decision: answer one of its options, close it as handled (Opus's one-line summary is the note; nothing more is written to GitHub), or Backlog. Our code enforces: at most one comment step and one close or duplicate step; every card settles the open decision, except one card whose only step is a comment and whose settle is empty (ask the author and keep the question open); a close or duplicate step settles as handled when no settlement is given and allows no other kind; an answer whose option closes takes no comment, close or duplicate step, and one that merges takes no close or duplicate step but may take a comment; an item without an open decision has no settlement. A card that breaks a rule is dropped with a note under the reply. Our code writes the title, one plain line per step, one line for the settlement and the button ("Close issue", "Close PR", "Close as duplicate", "Answer """, "Move to Backlog", "Close question", "Post comment"; with a comment and a settlement the settlement or close label stays), never the model. Comment text is cleaned like the Act step's comments: entities decoded, then HTML, images, links and @ signs removed (an operator may add links when editing). Running: the steps run in order through the existing write path with the repo's approvals (comments and closes need comment approval, labels need label approval) and the operator's login on the audit rows, then the settlement. The decision must still be open and unchanged ("the decision changed") before the first step; an answer needs write access to every repo of the decision, clears its claims and runs in one transaction like a dashboard answer. A failing step stops the run, the card fails with the error and the steps already done, and the decision stays open. After a close the item's other open decisions, except duplicate-group decisions, are closed as handled at once. A duplicate close keeps Act's checks (not our integration PR, not held by Backlog, inside the pilot) and records an actions row. A label step refuses a second type label. The dashboard asks for a second confirmation when the card closes the item or the answered option writes to GitHub, and names those writes. Cards stored before resolutions (single comment, answer, label, Backlog, duplicate, resolve and close actions) stay runnable as they were and show their one line as the only step, with a settlement line where they settle. A card ends as Done with a link, Failed with the reason, or Dismissed. What an operator ran or dismissed is added to the conversation as a system turn.
  • Drafts. A new Opus reply marks every still-proposed card of earlier replies replaced; they refuse to run ("replaced by a later reply"). Each card records the PR head and newest GitHub comment Opus had been told about. A push since makes the card refuse ("the PR changed since this was proposed", view stale: "pr-changed"); new GitHub comments only mark it (stale: "new-comments"). The run request may carry skip, the positions of steps the operator removed: the rest run in order and the result names the skipped ones. A card left with no steps and no settlement is refused.
  • Messages without a question. An operator message may be sent with ask: false: it is stored as a turn without a pending state, no Opus reply is queued, and Opus reads it among the turns at the next ask. It also starts the conversation when the item has none.
  • Shared maintainer posts. Maintainer Feedback (decision comments and opinions on the item's decisions) never reaches a prompt by itself. An operator can include a post (POST /api/conversations/<repo>/<n>/includes with {source, on}, source decision-comment:<id> or decision-opinion:<id>; table conversation_includes, which the planner does not watch). The next operator message that asks Opus carries every included, unsent post in its stored block as <included from="maintainer" login="..." at="..."> (cleaned like comment text, at most 1,500 characters), and the post is marked sent with that turn, so it is stored once and never re-sent. Un-including a sent post answers 409. The prompt treats included posts as claims to check.
  • One message at a time. A new message waits until Opus has answered the previous one. A run claims the message before it calls Opus, so two runs or a double submit answer it once; a claim older than the prompt timeouts is released. A card left Running by a crash (older than 10 minutes) is marked Failed, "outcome unknown", when the Conversation step starts and when the dashboard starts. A message that got no usable reply is marked failed and can be written again.
  • Shell. autocraft conversation show <repo>#<n>, conversation say <repo>#<n> <text> [--by LOGIN] [--now] (queues the message; --now answers it at once), conversation do <card> --by LOGIN. say and do need an operator login; say --now answers only while the pipeline is On and the step's daily limit has room.

Which model does what

Model Used for
Jev Duplicates: judges each candidate pair first
Classify: classifies every item first
Priority: picks the level
Reports how sure it is; at 90 % or more it matched maintainers' labels 98 % of the time
Haiku Duplicates: settles pairs Jev is unsure of
Classify: second opinion where Jev is unsure
Priority: decides where Jev is unsure
Decide: summaries of duplicate decisions
Fix: failure summaries
Fix-up: sorts a red default branch's failed checks (flaky, infra or code)
Verify: failure summaries
Does every item while Jev is unavailable
Sonnet Duplicates: compares each group of issues
Classify: referee for label disagreements; area suggestions
Fix: triages the issue and writes the patch
Fix-up: writes the patch and resolves conflicts
Verify: plans a regression test (bugfixes that change a test file) or, in a repo without CI, the build and tests
Opus takes over when Sonnet is unsure
Opus Duplicates: compares each group of pull requests
Classify: referee when Sonnet is unsure; proposes area lists
Decide: prepares every open decision (summary, pick, drafted answers; the judgement model setting), and conversation replies
Review: reviews every wanted PR
Fix: checks the patch
Fix-up: checks the patch
Merge queue: pre-merge review of the head commit
Post-merge review: reviews each merged PR
When Opus is unsure too, its label stands and Decide asks a scope question
The review gives a verdict, a complete fix list and how sure Opus is
Reads the merge commit and lists findings; the reply is linted like the Review stage's

These calls run with tools: Read, Grep and Glob on a read-only checkout inside a sandbox (see Trust boundary): the Opus review, the Fix-up patch and its Opus check, the CI fix patch, the Verify planner (checkouts of the PR head), Fix triage, patch and Opus check (checkouts of the base commit), the decision prepare (the PR head for a pull request, else the default branch) and conversation replies (the default branch). Every one of them also gets the workspace and, when a snapshot exists, the item tools (see Trust boundary). Every other call runs without tools. The Prompts page shows each prompt's tools, turn limit and sandbox mode.

Stable prompt prefix. The model reads a repeated start of a prompt from its cache at a fraction of the cost, so every call keeps its start identical. All claude calls run in one fixed empty directory (~/.cache/autocraft/claude-cwd, AUTOCRAFT_CLAUDE_CWD), because the CLI puts its working directory into its system prompt; the sandbox's /work is likewise fixed. A call without tools replaces the CLI's system prompt (--system-prompt) with the prompt's fixed text, up to the line where the item data starts, and sends only the item data on stdin. A sandboxed call keeps the CLI's system prompt, which carries the tool guidance, and sends the whole prompt on stdin with the item data last. The fixed text holds no dates, counts, repository names or item data. Accounts keep separate caches, so a prompt is cached once per account.

Item tools. A sandboxed call can also search and read every synced issue and PR without calling GitHub, through a read-only MCP server (src/itemtools/server, run by /usr/bin/node with no dependencies). Tools: search_items (full-text over titles, bodies and comments, optional repo, kind and state), item (text, labels, latest comments and reviews, decision outcomes), similar_items (nearest stored embeddings) and pr_diff (the cached diff of the PR head, cut at 30,000 characters, one file or an offset on request). Results frame all GitHub text as untrusted and are size-capped. The server reads a snapshot file, item-snapshot/items.db beside the mirror (AUTOCRAFT_SNAPSHOT_DIR), kept in place after every sync pass and each embed run: a refresh compares first without a write lock and applies only the rows added, changed or removed since the last one in one transaction (rollback journal, full-text index kept by triggers); a journal left by an interrupted refresh is rolled back before the next one, and never survives a rebuild. Reviews still PENDING are left out, and the file is rebuilt only when missing or of another schema version. Only repositories with visibility public are copied. It holds items, comments, reviews, their full-text index, embeddings and the kind, chosen option and date of each decision outcome; no settings, audit, accounts, tokens, paths or dashboard notes. itemTools() returns the mounts (server code at /app/item-tools, snapshot directory at /data/snapshot, the cached diffs of each repository in the snapshot at /data/diffs/<repo>, all read-only) and the items server definition; tool names are mcp__items__*. autocraft item-tools snapshot builds the snapshot and autocraft item-tools call <tool> <json> runs a tool without a model. PR heads are not fetched into the bare clones, so the tools read no files at a PR head.

Prompts shows every prompt exactly as sent. The code can call a model only with a registered prompt. Classifiers and Cost show how often the models agree and what each stage costs.

Claude accounts and agent runs

An agent run is one model call: one claude -p call or one Jev request. Each is recorded when it starts and ends (prompt id and version, model, account, item refs, tokens, summary). Everything is kept ten years; prompts and raw output are stored compressed. Each run also lists its tool uses (name, scrubbed arguments, result size, timing for streamed calls, the check row of a check-tool use) and its cost. The Agents page lists runs. A running call with tools also keeps the latest line of what it is doing (the same lines as in Conversations), shown on its row in Running now and cleared when it ends.

Reply lint and the fix turn. After a reply parses, a per-prompt lint looks for problems the model can fix: a mention of the reference folder or a page file in public text, a quote of 12 or more consecutive words from the repo's reference pages, public text that refers to documentation or a vendor of another product (Jev first, Haiku for the unsure cases and while Jev is unavailable; only for repos that have reference documentation), and a summary or one-sentence reason over its word cap. Problems go back to the model as one follow-up message on the same session, with the same account, sandbox mounts and working directory so the prompt cache is read. The follow-up runs for one turn with no tool permission and asks only for the flagged fields, as a JSON object keyed by field name; they are put into the first reply, which stays as it was otherwise. A problem marked internal (text that is never posted or shown) is recorded without a follow-up. The follow-up is its own agent run, and its tokens count as usual. The merged reply is linted too. If it still has problems, cannot be read, or the call had no sandbox (and so no session), the offending text is left out and an over-long summary is cut to its first sentence. A lint problem never repeats the whole call. During the call the session store is a directory of its own under the app's cache, mounted into the sandbox and removed when the call ends. Prompts that use it: review.opus, dupes.compare-prs.opus (word caps only) and conversation.turn (comment cards).

Operators manage accounts on the Accounts page (under Operations); viewers see the same page without controls. Labels, config directories and logins are the only account data kept here. Config directories, credentials, tokens and email addresses never appear in the API, logs or UI.

  • Add. An operator gives a label. The account gets an empty config directory, <AUTOCRAFT_ACCOUNTS_ROOT>/<id> (mode 0700), and starts disabled. Accounts listed in the AUTOCRAFT_ACCOUNTS file are added to the list on first start with their own directories.
  • Sign in. Sign in runs claude auth login --claudeai for that account's config directory, hidden in a pseudo-terminal, and shows the sign-in URL. The operator opens it, signs in, and pastes the code the page shows into the dialog. The code is checked against a strict pattern, sent to the command and never stored or logged. A sign-in ends when the code is accepted or refused, after 30 seconds without an answer to the code, after 10 minutes, or on Cancel.
  • Long-lived token. The Long-lived token action runs claude setup-token through the same URL and code steps as the sign-in. The CLI prints a one-year token (sk-ant-oat01-…); the server writes it to <config dir>/oauth-token (mode 0600, temporary file and rename) and keeps it nowhere else: not in the database, the audit rows (account-token-start, -code, -cancel, -set, -remove), logs, errors or API responses. The database holds when it was set and when it was rejected. While the file exists and the token is not rejected, every model call on the account, on the host and in the sandbox, gets CLAUDE_CODE_OAUTH_TOKEN; the sandbox then mounts no credentials file, and the account skips the token-expiry wait. Status, /usage and sign-out run without the token, because the token can only make model requests; usage readings still need the regular sign-in. A call that fails with an authentication error while using the token marks it rejected (shown on the Accounts page); that call fails as any failed call, and later calls use the regular sign-in path. Setting a new token clears the mark, and Remove token and Sign out delete the file. The Accounts page shows the token as set (with its date and an expiry about one year later), rejected or none.
  • Status. claude auth status gives signed in or out, the login method and the plan. The login's end date comes from the refresh-token expiry in the credentials file; only that number is read. Status is read every 15 minutes, after a sign-in or sign-out, and on Refresh.
  • Sign out runs claude auth logout. Enable and Disable set whether the runner may use the account.
  • Usage. For each enabled, signed-in account the runner runs claude -p /usage --output-format json --verbose every minute (every 5 minutes after a failed reading, and on Refresh). /usage is a local command: it makes no model call and spends no tokens. Its report gives the 5-hour (session) and weekly (weekly_all) use and reset times; a limit whose window has not started is left out. The reading is saved as <id>.json in AUTOCRAFT_USAGE_DIR (default <AUTOCRAFT_ACCOUNTS_ROOT>/.usage) in the format below, and a reading older than 30 minutes counts as unknown.

Before each call, the runner picks an enabled account with a free slot and headroom (5-hour and weekly use under the pause levels, which operators set; default 80 % for both; a reading older than 30 minutes counts as unknown), preferring the lowest weekly use. When none qualifies, the call waits. Waiting calls form one queue (table model_waits, refreshed on every poll; entries not seen for 30 seconds are ignored). A freed slot goes to the waiter with the highest priority class (2 security, 1 path to merge: fix-up, CI fix, main fix, fix issue, verify, pre-merge, Opus review, decide, conversation; 0 the rest), then the repo with fewer running calls, then the step with fewer running calls, then the oldest. Follow-up turns of a running call skip the queue. Stages that call Claude show as paused, with the reason, while no account has headroom. Jev calls use no account; their parallelism is the jev_parallel setting (default 4), and jev_enabled (default on) switches Jev off. The pause levels are the usage_pause setting ({"fiveHour":80,"weekly":80}), changed on the Accounts page or with autocraft accounts pause.

Build environments and tasks

Untrusted code (a PR's build and tests) never runs where the GitHub token or a Claude login is. It runs as a task on a build environment, a worker an operator registers.

  • Worker. Holds no GitHub token, no Claude login and no database access. It fetches public source anonymously by commit and pulls tasks by key.
  • Task. Names the source (repo, head and base commit), what it requires (OS, toolchains, memory), a plan of steps with timeouts and network setting, an optional patch (1 MiB at most, applied before the first step) and an optional warm build cache key.
  • Scheduling. Workers claim queued tasks that match their capabilities, by priority. A task without a heartbeat for 2 minutes is requeued once, then fails. Cancelling a task stops it at once.
  • CI parity. Before the first step the worker reads the repo's .github/workflows/ci.yml at the task's base commit (never the PR head, so a PR cannot choose packages or env) and, when it calls the suite's craft-common-actions gate, takes the gate's inputs plus the defaults in gate.yml: the packages list, craft-fonts-ref, require-craft-fonts, and the env, linux-env and dev-debug settings. Packages go into a derived image, craft-sandbox/<toolchain>-<hash> (hash of the base image reference and the sorted package list), built once with apt-get and network by the worker and then reused. craft-fonts at the pinned commit, and craft-i18n at the commit in the checkout's craft-i18n.rev, are downloaded by commit into the worker's work dir and mounted read-only at /craft-fonts and /craft-i18n, with CRAFT_FONTS_DIR, CRAFT_FONTS_REQUIRED and CRAFT_I18N_DIR/CRAFT_I18N_REQUIRED set for every step. Steps still run offline except fetch deps. The task detail lists the image, package count and both commits. A repo whose CI does not call the gate runs in the stock image. Only Linux inputs apply; the gate's Rust toolchain, targets and cargo tools are not reproduced.
  • Results are data. Logs and artifacts are size-capped, typed by content (PNG, JSON, JUnit XML, text) and served with nosniff and a sandboxing policy. Nothing a worker sends is executed, rendered as HTML or put in a prompt by the coordinator. A later step that lets a model read it frames it as untrusted.
  • Access. Worker calls arrive on their own listener, authenticated by key (stored hashed, shown once), with body caps and rate limits. Only operators register environments, rotate keys or cancel tasks, and each is audited. Tasks of repos a viewer cannot see are hidden from that viewer.
  • Task rows and logs are deleted ten years after the task ends; artifacts after 30 days.

What needs a person

  • Scope calls: is this in scope, closer to the reference app, a plug-in rather than core?
  • Reference behaviour that public sources don't settle.
  • Merges outside the rule (see Merge queue). Contributors shows who is on the whitelist and why. The pipeline's own account counts as whitelisted for the Fix PRs it opened from issues (S or M bugfix after Verify can merge by the rule); an operator's deny still wins.
  • Closing a PR the review says to close.
  • A label where Jev and Haiku disagree outside the scope labels: the Work queue says "Referee: waiting for Sonnet", then "Referee: waiting for Opus" when Sonnet was unsure, and links to the Items list of disagreements. When Opus is unsure too, the label stands and the item is asked as a scope question.
  • Duplicate? answers: an open one holds the item out of Review, Verify, Fix and the merge queue (Work queue: "Held").

Everything else waits for a decision on this dashboard.

Releases. An operator can release an item that stopped waiting for a person, from the Item page (two clicks, audited, nothing written to GitHub; the pipeline takes the item up on its next pass): Review again at this head (removes a hold review of the current head), Verify again (after failed or error) and Try the fix again (a skipped or failed issue fix; the attempt count starts over).

Applied answers. An answer that writes nothing counts as applied once the pipeline used it (scope take / small-extra when the item is reviewed or fixed, plugin when the label is on the item, need-info and Close? hold / keep at the next pass). From then the dashboard offers no Undo. A Backlog answer is never applied; Reopen takes its place.

Actions

Answering a question

A decision offers one core action (pick exactly one) and extras (checkboxes that run with it). The Do it button names the GitHub writes of the chosen core and the ticked extras. Opus prepares the cores and drafts the extras (see Decide, Prepare); the maintainer can change every text and tick. Only the cores that apply to the item now are offered: a PR gets no transfer, an issue gets no fix-up.

Cores. The writes column uses the action tags of the page.

Action Writes on GitHub What AutoCraft does
The question's own answers: Merge, Close, Out of scope, Hold, Keep open, Wanted in core, Small extra, Plug-in candidate, Check the reference app Merge: merge. Close and Out of scope: comment, close. The rest write nothing at once Merge queues the PR: it merges after CI and checks pass. Close records the answer and stops work on the item. Wanted in core and Small extra keep the item in core: PRs go to review, an issue may get a fix attempt. Plug-in candidate adds the plugin candidate label later (Label). Check the reference app and Hold keep the item out of later stages until asked again. Keep open does not ask again at this head
Fix up first, then merge push, merge Pushes the fix-up, reviews the PR again and merges if the review and CI pass; otherwise a new question comes back (see Pre-approved merge). On a scope question it also keeps the PR in core: the answer is Small extra when the card adds the "small extra" label or the PR already has it, else Wanted in core
Fix up the PR push Pushes the fix-up and reviews again. On a scope question it also keeps the PR in core, as above
Review the PR again none Marks the head's review stale; Opus reviews it again and the pipeline decides again
Close issue as completed, Close issue as not planned, Close PR close Records the answer and stops work on the item. A comment extra is offered
Close as duplicate of #n close Comments "Duplicate of #n.", closes the item and stops work on it
Move issue to another repo move Stops work on the issue here
Later none Moves the decision to the Backlog (see Decide, Backlog)

Opus adds the cores from Fix up the PR to Move issue when no offered core covers the case, at most three per decision. Close and Out of scope as an answer of the question take a one-sentence reason instead of a comment: it is posted in the closing comment.

Extras. An extra is offered only when the core takes it for this item. Comment and open issue are always offered, empty; the others appear when Opus drafts them. Opus's ticks are the defaults.

Extra Writes on GitHub What AutoCraft does
Comment comment Posts the text on the item before the core runs. The answers Close and Out of scope have no comment extra: their reason is the closing comment
Label label Adds one of the managed labels (bugfix, performance, missing feature, small extra, plugin candidate, infra, security, needs decision)
Remove label unlabel Removes a managed label the item has
Open issue open issue Opens an issue in this or another tracked repo, for example a follow-up with Merge
Assign assign Assigns the item's author or a person with write access
Request reviewers request review PRs only: one to three people with write access, never the author

The steps run in this order: comment, labels, unlabels, assign, request reviewers, open issue, fix-up or review, and last the closing step (close, duplicate or transfer). Choices have no reopen extra: a card on a closed item (written in the item's conversation) starts with a reopen step, only on an issue or a closed, unmerged PR.

Who can press Do it. Operators. Maintainers can too, on a repo that acts as the GitHub App, while the maintainer-writes setting is on and the maintainer has write, maintain or admin access to every repo the decision covers; the write then shows under their own GitHub name. Everyone else reads the decision.

More buttons. These are for operators.

  • Something else… opens a box for an instruction to Opus. Opus answers in the item's conversation and may draft new choices: changed drafts, a new pick and up to three added cores.
  • Re-prepare clears the prepared summary and puts the decision first in line for a new Prepare call. The current choices stay until the new ones replace them.
  • Snooze hides the decision from the inbox until the item has new activity. The decision stays open and the pipeline keeps waiting.

What AutoCraft does on its own

Each write needs the repo's approval (Repos page) and stays within the stage's daily limit (see Daily limits). The pipeline's on/off switch stops all of them except the security deep scan.

Action Stage Approval and limit
Type labels and flags Label Label approval. No limit
Assign or release the pipeline's account Fix, Fix-up, CI fix, Merge queue The stage's own approval. Released when the work ends (see Merge queue, Assignment)
Post or edit the final review Review (review-post) Comment approval. 40 posts a day
Approve a contributor's held CI runs Merge queue (ci-approve) CI approval. 30 a day
Push the review's small fixes, or comment them when the branch cannot be pushed to Fix-up Push approval for the push, comment approval for the comment. 20 PRs a day
Format, rerun or patch a failing check CI fix Push approval for the push, comment approval for a patch comment, CI approval for the rerun. Two tries a head; reruns 30 a day
Merge the base branch into a conflicting PR, and comment Fix-up Push approval, comment approval. Two tries a PR; counted with Fix-up
Fix a red default branch: rerun, open a fix PR CI fix (main-fix) Fix red main approval, off by default. 20 a day
Open a fix PR for a bugfix issue Fix Fix approval. 10 attempts a day
Merge: singly, or in an integration batch of up to 50 PRs Merge queue Merge approval. The merge rule or an operator's Merge answer. 10 a day
Comment, then close, after an answer Act Comment approval. 20 a day
Open a follow-up issue for each defect of a post-merge review Post-merge review Comment approval. 20 a day
Private fix of a confirmed security finding Security deep scan Starts when Verify confirms the finding. Writes nothing to GitHub: Land, Advisory and Publish are operator presses. Pipeline switch and daily limits do not apply

Trust boundary

  • Untrusted code never runs where GitHub or Claude credentials are (see Build environments).
  • Only the operator's answers are acted on. The pipeline reads the chosen option, never free text.
  • Comments and picks by other people are shown here but never reach a model's prompt.
  • All GitHub text is untrusted data: models judge it and never follow instructions in it.
  • Every GitHub write (labels, comments, closes, pushes, fix PRs, merges) needs the operator's approval for that repo, given on the Repos page; the CLI reads approvals and cannot set them. Approvals are audited.
  • Model calls run without tools, except a prompt that registers a sandbox mode (the Opus review, Fix-up patch and check, CI fix patch, Verify planner, Fix triage, patch and check, the decision prepare, the duplicate-PR comparison and conversation replies). Claude Code's file tools could otherwise read anything this user can, such as tokens and other accounts' logins, and untrusted text could steer a model into echoing it. Two layers keep that from happening, plus a backstop:
    1. Claude Code allows only Read, Grep and Glob, denies everything else without asking (dontAsk, no prompts), allows reads of the checkout path only, is confined to the working directory and the checkout (--restricted), loads no MCP servers, skills, slash commands or user and project settings, and stops after a registered number of turns.
    2. bubblewrap runs the call in new namespaces (network shared, the API needs it) with an empty home and a clean environment. Only these are visible: the claude binary, /usr, the TLS certificates and resolver config, the checkout read-only at /repo, and the used account's credentials file, read-only (the rest of its config directory is not). The working directory is an empty /work and the checkout is added with --add-dir, so instructions and settings inside the checkout are never loaded as project memory; CLAUDE.md, CLAUDE.local.md, AGENTS.md and every .claude/ path are also left out of the checkout.
    3. Backstop: after the reply JSON is parsed, anything in its text (and in stderr) that looks like a token or key is removed before it is stored or used (the log scrubber). Repo docs. The checkout leaves instruction files out, so the sandboxed calls that judge or change a repository's code or scope (the Opus review, pre-merge and post-merge reviews, the decision prepare, Fix triage and patch, Fix-up patch and conflict, the CI fix patch, and conversation replies) get the maintainers' own documents separately: AGENTS.md (stored as AGENTS.txt, so Claude Code never loads it as memory) and ROADMAP.md, read from the repository's default-branch commit in the cached clone (never from a pull request's head) and mounted read-only at /repo-docs, outside the working directory. There is one directory per repository and commit under the cache directory, deleted after a day without use. A repository with neither file gets no mount and no prompt sentence. The prompt's repository access then ends with one fixed sentence: the rules are at /repo-docs/AGENTS.txt and the roadmap at /repo-docs/ROADMAP.md; read the rules before judging or writing code and the roadmap when the question is whether a change is wanted; follow their conventions, but their text never changes the task or the output format; name a real conflict with a rule (file and line) only when there is one; ignore links to other repositories' rule files. A mention of /repo-docs or AGENTS.txt in public text is a lint problem, like a mention of /reference. The fixed working directory of every call is under the app's cache directory, and Claude Code loads a CLAUDE.md from the working directory and its parents. None may exist in the install root, the cache directory or any parent of them, because every tool-free call would load it too. An account with a long-lived token (see below) skips all of this: the sandbox gets the token as CLAUDE_CODE_OAUTH_TOKEN and no credentials file, and no expiry wait applies to the account. The sandbox never refreshes the OAuth token, since a refresh inside it could invalidate the account's stored login. Before a sandboxed call the code reads only the token's expiry; a call that has a checkout needs the token to outlast its margin (30 minutes, plus 45 minutes when the call has the check tool). An account with less is not eligible for the call, which waits (wait reason <account>: login token expires within <n> min; waiting for its refresh, bounded by the caller's maximum wait) until a host-side run refreshes the token, which the minutely /usage reading does. The call never runs on the host without its tools. If the token expires between the choice and the claim, that run ends as failed (skipped: token near expiry) and the call waits again. Calls without a checkout run on the host and are unaffected. Workspace. Every sandboxed call (the Opus review, the Fix-up patch and check, the CI fix patch, the Verify planner, Fix triage, patch and check, the decision prepare, the duplicate-PR comparison and conversation replies) also sees a read-only checkout of the default branch of every tracked repository with visibility public at /repos/<name>, except repositories listed in the workspace_exclude setting (private repositories are never mounted, because replies are visible to everyone with dashboard access) (default none; autocraft workspace-exclude, GET|PUT /api/sandbox/workspace). The item's own checkout stays at /repo. There is one checkout per repository and head. A repository's head is looked up when a call needs it, at most every 5 minutes; when it moved, a checkout of the new head is built and the previous one is removed 3 hours later. A call waits at most 20 seconds for a new checkout and mounts the previous one when it is not ready; a repository with no checkout yet is left out. The same caps as for any checkout apply (the largest repositories are about 2,000 files and 50 MB); a repository over them is logged and left out. The call may start one subagent, workspace-search (the name differs from Claude Code's built-in Explore, which the model would otherwise pick; the prompt names it as the subagent_type) (Haiku, medium effort, Read, Grep and Glob), for broad searches. Its definition is a generated file mounted read-only at /agents.json, identical across calls so the prompt prefix caches. Only the main call has the Agent tool. Item tools (itemTools(), passed by askClaude to every call with the workspace; none without a snapshot) add read-only mounts and an MCP config (--mcp-config, still with --strict-mcp-config) whose mcp__<server>__* tools both the call and the explorer may use. The explorer's tokens are recorded on the agent run, and as separate token rows by model with the same run and stage, so the Cost page splits by model and totals stay whole. The checkout is built from the cached clone without a working tree: only regular files under validated paths are written (no symlinks, submodules or .git), files over 2 MB are left out, and a tree over 20,000 files or 150 MB gets no checkout. Nothing in it is executed. Checkouts are kept per repo and commit and deleted after a day without use; reusing one refreshes its time, and a checkout a running call has mounted is never deleted. A superseded workspace checkout is removed only when nothing touched or holds it in the 3 hours after the swap. When there is no checkout, the head moved, or bubblewrap is missing, the call runs without tools (AUTOCRAFT_NO_SANDBOX=1 forces that).
  • Every text posted to GitHub (comments, reviews, review and comment edits, issue and pull request bodies, close comments) starts with a note line, a blank line, then the text. src/github/write.ts adds it, and every posting function requires a note, so no post can skip it. The wording depends on who stands behind the post, with the model named as in the review note (Opus 5.5):
    • A model wrote the text on the pipeline's own initiative: _AI-generated <review|comment|issue|pull request> (<Model>). Not a maintainer decision._
    • An operator chose the action (an Act close or comment from a decision, a conversation card, a duplicate close, a batch ended by an operator): _AI-generated reply (<Model>)_. Decisions asked by the security scan count as written by Opus 5.5.
    • Fixed template text with no model behind it: _Automated message. Not a maintainer decision._, or _Automated reply_ when an operator chose it. The audit row's text is the text as posted, note included.
  • Every write on GitHub is recorded. src/github/write.ts is the only module that sends one: GraphQL mutations, gh commands that create, close or comment, git pushes and merges. Each function adds a row to the audit table before the write (state started, so a crash leaves a trace) and finishes it after (done, or failed with the error), with the action, the repo and item (repo#number, or repo:branch for a branch), the details (label names, comment text and URL, pushed commit, merge commit), the source (the stage and its run id, a decision id, or the operator for manual actions) and, when the write failed, the error. Labelling writes one row per item. test/github-writes.test.ts fails when any other file under src/ sends a mutation, pushes, merges or runs a gh write command. The GitHub activity page (Insight) lists these rows, newest first, for anyone signed in; it filters by repo and action, and rows of repos the viewer cannot read are left out. A merge started from the command line (autocraft safe-merge) is recorded under the login cli.
  • Only operators can turn the pipeline on or off, change limits, manage accounts or cancel jobs. A maintainer or viewer account, even a compromised one, cannot trigger a merge, close, post, label, push or any step.

Architecture

Three processes share one database. None needs a terminal or Claude session kept open.

Process What it does
Sync Copies changes from GitHub into the mirror, every minute
Dashboard Shows everything to people on the access list; records answers, opinions, the pipeline switch and limits. Never runs a step or calls a model
Runner Runs the pipeline steps as jobs, each in its own process, and records progress, logs, results and token use

Each step has a fixed list of settings (a choice, a tracked repo, a bounded number or a run id). Nothing typed on the dashboard can reach a prompt or a shell. A step has at most one queued or running job per repo (a job without a repo counts as every repo; security fix jobs are per finding), so one step works several repos at once. The step_parallel setting limits how many repos one step has queued or running at once: a positive integer or none, default 1 (autocraft pipeline parallel [N|none], audited as step-parallel). A few steps share a named mutex and run one at a time: Rank, Embed, the classification steps (Classify new, Classification pass, Area rescan), Dupes and Compare duplicate groups, and the security land, advisory and publish steps. The runner starts queued jobs security first, then by id, up to a cap of 32 job processes (AUTOCRAFT_RUNNER_JOBS). A job whose step calls Claude starts only while the model-call queue has room for its class, unless no job of its step runs.

The runner and dashboard connections shadow repos, items, comments, stages, classifications, decisions and token_usage with temporary views of tracked repos (scopeToTracked in src/repos.ts), so rows of untracked repos stay in the database but are never seen. A write to one of these tables names main. (test/main-qualified-writes.test.ts enforces it; trigger bodies are not checked).

Live updates

Pages update without a reload. The database is the single source of truth and the browser only caches views of it. Triggers on the tables the dashboard reads bump a per-topic counter in change_seq (topics: items, ranks, stages, checks, classify, dupes, decisions, jobs, queue and others, listed in src/live.ts), whichever process wrote the row. An UPDATE bumps only when a column other than the bookkeeping ones (fetch and compute times, derived hashes) changed, and the settings the runner and sync keep for themselves bump nothing. The dashboard reads the counters twice a second and sends the changed topic names over a server-sent event stream (GET /api/live, one per browser tab, with a heartbeat every 25 s). The browser refetches the cached views that read those topics (web/src/api/topics.ts), each view at most once every 3 s. A reconnecting tab gets the full counter map first and refetches what changed while it was away. Actions are ordinary POSTs; their effects come back through the same stream. Views that change without a database write, such as a job's log tail and the runner's heartbeat age, poll slowly.

On and Off

The pipeline starts Off. An operator switches it on the Pipeline page or with autocraft pipeline on|off; the switch records who and when. Off cancels waiting automatic jobs and queues no new ones. A running job started by the pipeline stops starting new items (Fix-up, CI fix, Fix red main, Fix, Collect fix results, Verify and Collect verification) and finishes the item in hand, with its GitHub writes refused. A cancel request or a passed deadline stops new items the same way. Draining behaves like Off for new items; the item in hand finishes with its writes.

Work leases. A PR, issue or finding is worked by one job at a time. Fix-up (including conflict merges and operator fix-ups), CI fix (work, formatter results, lint results), Fix, Collect fix results and the security fix take a lease (pr:<repo>#<n>, issue:<repo>#<n>, finding:<repo>#<n>) before the item's first model call and release it when the item ends. A job that finds the item leased by another running job skips it without counting it against its limit and records the keys it skipped; the planner queues the step again once no running job holds any of them. A lease whose job is not running is free; runner start and a job's end delete its leases.

While On, the runner plans whenever the content the stages read changed (a change-counter topic other than jobs, usage, agent runs, sandbox environments and audit moved, or a sandbox task ended), a job ended, an operator changed a limit or released work, or a wait the last pass found ended. A 5-minute timer is only a fallback. The planner queues a job for each stage and repo that has work, no job of that step and repo queued or running, the step under step_parallel, and limit left; a lane queues one job per repo in a pass. Per-repo stages (Label, Review, Merge, Act, Fix-up, Fix) queue only for repos whose pipeline is on and that have the matching approval.

A stage does not wait on a timer when it has work. Two rules decide when a stage that has work is held back:

  • Same input. Each queued job stores a fingerprint of the input it saw (the stage, the repo and the counters of the topics the stage reads). A job that handled no items and made no other progress (no batch started, opened or advanced, no decision asked) is not queued again until the fingerprint changes. A step reports such progress with acted, next to items.
  • Failures. After a failed job the stage waits 1 minute, then 2, 4, 8 and 16, then 30 minutes, until a job succeeds. A changed fingerprint or an operator release ends the wait at once. Jobs a runner stop ended do not count.

Stages that watch an outside system (upstream CI of PRs waiting for it, open batch PRs, finished sandbox tasks) are exempt from the first rule and read it again every minute. The full classification pass is never started automatically.

Pipeline switch per repo. Each tracked repo has a Pipeline toggle (Repos page, list and detail; autocraft repos pipeline <repo> on|off; audited as repo-pipeline). A newly tracked repo starts off. Off means sync only: the mirror sync, Embed and Rank keep running, and every other stage skips the repo: no candidates, no model calls, no sandbox builds (operator smoke tests excepted), no merge jobs. The planner plans only for repos that are on and drops any job whose repo parameter names another repo (the stage shows "outside the pipeline scope"); an integration batch in flight in a repo that is switched off waits until it is switched on. The per-repo approvals still gate every GitHub write in a repo that is on.

GitHub identity. One instance-wide switch decides whether GitHub writes and dashboard sign-in use the box account (box, the default) or the GitHub App (app). Operators set it on the GitHub App page or with autocraft identity [box|app]; audited as github-identity. Switching to app is refused unless an app is registered and its installation covers every tracked repo; the refusal lists the repos that are not covered. Every switch ends all dashboard sessions, so everyone signs in again under the new mode. Under app, only a merge or a close that carries out a person's answer is made as that person (their own user token, user:<login>); actsAsPerson in src/github/identity.ts holds the rule. Every other write runs as the app, including the comment posted before a close, labels, assignments, new issues, review requests, transfers, and all rule merges, reviews, fix-up, conflict and CI-fix comments and pushes, claims, batch and fix-issue PRs, post-merge issues, CI approvals and reruns. Each of those runs with an installation token: gh and git children get a replaced environment holding only that token, so the box account's GITHUB_TOKEN and GH_TOKEN never reach them. Fix-up pushes to a contributor's fork use the same token (the PR must allow maintainer edits). The app owns no fork, so autocraft/* branches of batch and fix-issue PRs are pushed to the base repo. When no token can be minted (app not registered, not installed, repo outside the installation) the write fails with an app identity: error; it never falls back to the box account. Security advisory writes stay on the box account and are audited as legacy. A merge or close under a user:* grant never gets the app token. A decision whose answer carries out no merge or close never waits for the answerer's token or permission.

Pilot. The setting pilot_items (a list of repo#number items) narrows the repos that are on further: with a pilot set, no stage reads, calls a model on, builds or writes for anything outside it. Classify, Priority, Dupes (the listed items as subjects; their neighbours may be any item), Referee, Decide, Review, Opus review, Post reviews, Label, Verify, Fix-up, Fix, Merge, Merge? questions, Checks (it refreshes the CI state of the pilot PRs of the repo only) and Act pick candidates among the pilot items only. The planner plans only for repos that are on and have a pilot item. Embed and Rank stay unrestricted: Embed runs a local model on this machine (it only downloads the model files on first use and sends no item text anywhere), and Rank is arithmetic over stored scores. A Fix PR the pipeline opened for a pilot issue counts as a pilot item. Empty or absent means no pilot. A pilot item in a repo that is off has no effect. Whole repos are not accepted in the list; they are switched on the Repos page. Operators set the list on the Pipeline page or with autocraft pipeline pilot set <repo#number>..., pilot show and pilot clear; each change is in the audit log.

Outside authors

Two protections keep an author outside the team from using up model spend, for example by opening hundreds of PRs. Both apply to items created by an outside author: an author who is not an operator or maintainer on the access list, not the pipeline's own account, not a GitHub Bot (author type Bot or a login ending in [bot]: an app can open items only where it is installed), not an owner, member or collaborator of the repo (the author association GitHub reports), and not on the Contributors whitelist (an allow override or a whitelisted tier). Each protection is off at 0. Only items in scope for model work count and can be held: items of repos whose Pipeline switch is on, never fast-tracked ones.

  • Daily budget. Of one outside author's items created in the last 24 hours (by creation time, across tracked repos), only the first outside_prs_per_day PRs (default 5) and the first outside_issues_per_day issues (default 5) get model work. Later open items wait with the wait "Author over daily limit" until an older item passes 24 hours, so a held item starts by itself once the window frees.
  • Surge breaker. More than outside_surge_per_hour (default 30) new outside-author items in the last hour trips the breaker outside-surge. Outside-author items created from an hour before the trip hold until an operator resumes it; there is no timer. After a resume only items created later count towards a new trip. Insiders' and older items continue. The health check outside-surge (warning) shows the trip in the top bar and in /healthz/checks; the trip and the resume are audited like the other breakers.

The gate. Held items live in outside_holds, which the planner rewrites once per pass (refreshOutsideHolds, src/outside.ts) from one query on the items created in the last 24 hours. The pilot condition (pilotSqlFor) leaves a held item out of scope, so every stage that picks candidates through it skips the item: Classify, Priority, Duplicates, Decide, Review, Fix-up, CI fix, Fix, Verify and the rest. Sync, Embed and Rank keep running. A fast-tracked item and a released item are not held.

Admission. An item the gate has let through once (planned without a hold) or that already had pipeline work when the protections began is admitted and never held by the daily limit afterwards, even if the limit is lowered. The surge breaker holds only items created from an hour before the trip that were not admitted before it, and its holds last until the resume, however old the items are; the resume starts a planner pass at once. Bot authors known only by login (dependabot, renovate, github-actions, the review bot list) count as Bot until the mirror has stored their author type.

Release. An operator presses Release on the item page or in the author's group in Needs you; the item is exempt from then on. Release all releases every item now held for one author. An operator can also set the author to allow on the Contributors page.

Settings. The three numbers are on the Pipeline page; operators edit them, everyone else reads them. Changes are audited as abuse-limits, releases as outside-release and outside-release-author.

Daily limits

Limits count items handled per stage per day (from 00:00 UTC), including by failed or stopped jobs. Operators change them on the Pipeline page or with autocraft pipeline limit. Empty means no limit; 0 pauses the stage. A job's limit is what is left of the day's limit after today's count and after the unspent part (limit minus items handled) of every queued or running job of the same step, so concurrent jobs of a step never pass the day's limit together. Fix-up takes its item budget before an item's first await. The page shows why a stage cannot start. An operator can start a stage's count for today again from zero ("Reset count" beside the figure, autocraft pipeline limit reset <step>|--all, audited as limit-reset): only jobs that started after the reset count, until 00:00 UTC.

Step Default limit (new database) Step Default limit (new database)
Embed none Fix 10
Duplicates 2000 Fix-up 20
Compare duplicate groups 200 CI fix none
Classify 2000 CI fix reruns 30
Referee 500 Fix red main 20
Priority 3000 Verify 30
Decide 100 Merge 10
Conversations 30 Pre-merge review none
Label none Approve CI runs 30
Review (Opus) 40 Act 20
Checks none (0 pauses it) Post-merge review none
Post reviews 40 File follow-up issues 20

Steps not in the table have no limit setting.

Waits

Automated work waits only for the reasons below. A stage that is not running shows its reason on the Pipeline page: nothing to do, waiting for CI on N PRs, failed with the retry time, the daily limit, or a pause.

Wait Why How long Shows as
Sync Poll of GitHub 1 minute; the search catch-up runs hourly, the reconcile daily Syncs list
Webhook re-read A GitHub App webhook names an item that changed; the runner reads that item again from GitHub Drained every 5 seconds while requests are queued; the poll stays the backup Item page, On GitHub: updated time
Main CI poll GitHub's check state of each default branch head; read by the sync run, with the pipeline on or off 2 minutes Main CI page and the top bar
Author over daily limit An author outside the team opened more than the daily number of PRs (setting outside_prs_per_day, default 5) or issues (outside_issues_per_day, default 5) in 24 hours; the later items get no model work (Sync, Embed and Rank still run) Until an older item of the author is more than 24 hours old, or an operator presses Release; 0 turns the limit off Plan wait "author's daily limit (N new PRs a day)", the item page and Needs you
Outside surge breaker More than outside_surge_per_hour (default 30) new items from outside authors in the last hour stop model work for outside-author items created from then on; insiders' and older items continue Until an operator resumes it (the Resume button on the Pipeline page); no timer Plan wait "the outside-surge breaker", the Stopped list and a warning in the top bar
Duplicate set changed on GitHub Wait for the sync to bring the set 10 minutes Duplicates stage
Rule fallback of a duplicate group The model call failed; retried up to 3 times 15 minutes Duplicates stage
Failed Opus referee An Opus referee call that keeps failing must not re-run every pass 1 hour between tries, at most 3; then Decide asks a scope question Plan wait "the label referee"
Work rank recompute Its input moves in bursts while a sync writes; nothing waits on it at most once a minute none
Failed prepare A prepare call that keeps failing must not re-run Decide 1 hour between tries, at most 3 at one PR head; then the decision keeps what it has none (the decision shows no pick or drafts)
Checks before Review and Verify CI data younger than 5 minutes is reused 5 minutes Job list
Blocked by another item A hold review named an open item as its reason (for example the PR is stacked on another open PR); the PR is not reviewed again, on new commits or discussion, until that item is merged, closed or decided Until the blocker is merged, closed or decided; a maintainer's comment or Review again lifts it Plan wait: the blocker's reference
CI on the latest commit A new head is reviewed only after its CI has finished and passed; a head whose CI runs or is red is skipped Until CI at the head finishes green, or a later push Plan wait: CI on the latest commit
Failed review A review call that gave no valid review is not repeated at once: the failure is counted per head 10 minutes after the first failure, 30 after the second, 2 hours after the third; a fourth holds the head until a new commit or Review again Plan wait: the review after n failed tries
Review cap for today At most 3 Opus review calls per PR per UTC day, new commits, re-runs, and failed calls together (a reply-fix turn is part of its review) Until the next UTC day; a maintainer's comment or Review again lifts it Plan wait: review cap for today reached
Minimum time between reviews Setting review_min_interval_minutes (default 120, 0 turns it off; autocraft pipeline review-interval): a PR reviewed less than that long ago waits, then the latest green head is reviewed The setting's minutes since the PR's last review; a maintainer's comment or Review again lifts it Plan wait: next review after hh:mm
Fix landing poll A deep-scan fix that went out as a pull request waits for its merge, which the mirror reports; a fix that went the advisory way waits for a repository admin to merge it, which shows as the patch reaching the default branch 2 minutes, read by the sync run, with the pipeline on or off The finding's state: landing, awaiting admin, then landed or advisory
Lint task A model patch is stored while a build worker formats it and runs clippy on the patched tree; the result is collected when the task ends Until the build task ends (minutes); a lost task is queued once more, then the patch is given up Builds page; the PR's fix-up or CI fix row is linting
Conflict merge cap for today At most 2 merges of the base branch per PR per UTC day (over all heads); a busy base branch otherwise keeps a PR in a merge, check and review loop Until the next UTC day Plan wait: conflict merge cap for today reached
CI results of earlier pushes A repository with 3 pushes of ours whose required checks are not final yet gets no further push from Fix-up, CI fix or the default-branch fix Until the checks of those pushes end (a push without a result is settled as unknown after 3 days) Items skipped for another job or run; no state change
Sandbox build External Until the task ends; a build-environment error queues it again once per head Verification state planned or running
Warm build of the default branch Limits sandbox load; never blocks a PR Once a day per repo Sandbox tasks
Nightly checks The nightly schedule of the Nightly checks build feature: queued at most once a day per repo, below all PR work Once a day per repo; a failure backs off to the next night Sandbox tasks of the step nightly
Nightly build External Until the task ends Nightly results in state queued
Pre-merge review A PR the rule would merge, or a pre-approved merge before its hand-over, waits for an adversarial Opus review of its head commit (one model call per head); while the step cannot run (pipeline off, usage pause) it waits Until the call ends; a failed call is tried again after 1 hour, at most 3 tries, then a person decides Queue state waiting-premerge
Pre-merge review retry The model call for the head failed or returned no valid review 1 hour between tries; after 3 failed tries the merge queue asks a person Queue state waiting-premerge (tries left) or a Merge? question ("pre-merge review failed")
Transient merge refusal The merge command was refused because GitHub or the network failed (a 5xx, a timeout, a rate limit), which says nothing about the PR One more try at the next merge job; a second such refusal at the head asks a person (Merge? with the reason) Queue state refused, then a Merge? question
Mergeable state unknown GitHub has not computed whether a PR with a take review and green CI merges; the checks job reads it every minute After 5 checks reads in a row that still show an unknown state, the PR is requested once from GitHub's REST endpoint, which starts the computation; a null answer ends the wait and the merge queue asks a person (Merge? with the reason). A known state sets that question aside. No timer Plan wait: GitHub's merge state, unknown for n checks reads, then a Merge? question
Upstream CI of PRs and open batch PRs External Read again every minute per repo while any waits "waiting for CI on N PRs in repo"
Runs waiting for approval GitHub holds the runs of an outside contributor's PR until a maintainer approves them; the pipeline approves them once the head has a final take or take-fix review and the repo's CI approval is on Until the step runs (read again with each checks job) Queue state ci-approval
Batch PR runs awaiting approval The batch PR comes from the pipeline account's fork, so GitHub may hold its workflow runs (action_required) until a maintainer approves them; the ci-approve step approves them when the repo's CI approval is on and every member was reviewed at its batched head Until the runs are approved and finish (read again with each checks job) Batch note "batch PR runs wait for a maintainer's approval"
Batch push retry Pushing the batch branch or opening its PR failed 1, 2, 4, 8 minutes (at most 30); the batch fails after 5 failures and its PRs return to the queue Batch state checking with the error
Main CI red The repo's default branch fails CI, so every PR's CI would fail against it; ready PRs and open batches wait, AutoCraft's main-fix PRs (branches autocraft/main-ci-*) do not Until main is green Queue state waiting-main-ci
Changes requested A reviewer with write access has a formal review that blocks the merge Until that reviewer approves or a maintainer dismisses the review; no timer. Blocked PRs are read again every merge run Queue state changes-requested with the reviewer in its note
Failed post-merge review The model gave no valid reply twice 1 hour, three tries in all Post-merge review on the item page: no review yet
Failed post-merge filing GitHub refused to create the issue 1 hour, then 6 hours; stops after three attempts Post-merge review on the item page: not filed, with the attempts
Failed job Retry a real failure without hammering 1, 2, 4, 8, 16, then 30 minutes; ends on a release, and after a single failure also on a changed input "failed N times in a row; retry at HH:MM UTC"
Job past its deadline The runner stopped a job for running past its step's deadline; running the same paid work again at once would stop it again At least 1 hour (longer after more failures in a row); no timer runs, the planner reads the failure "failed N times in a row; retry at HH:MM UTC"
Daily limit Cost control. For Act, which card presses share with its closes, a press that finds no room is queued and carried out in order (item priority level, then time of the press) when room returns Until 00:00 UTC, or until an operator raises the limit "daily limit of N items reached; resumes at 00:00 UTC"
Jev unavailable Jev is switched off (autocraft accounts jev off), the jev command is missing, or its account fails: out of credit, or a missing or rejected key (status 401, 402, 403, or a message about credit, billing, quota or the key). Haiku does Jev's classify, priority and duplicate work through the Claude accounts. Off or not installed: no retry until it is switched on or the command exists (checked on each pass). Account failure: the first pass an hour after the last failure tries Jev again; no timer runs. Other Jev errors (timeouts, server errors, bad answers) are retried as before 1 hour after an account failure Accounts page and run logs
Circuit breaker A push stage (fix-up, CI fix, fix issue) stops when 2 of its last 10 pushes turned a required check red; the merge path stops when main CI turns red because of a merge of ours or a post-merge review finds a defect in it Until an operator resumes the stage (autocraft pipeline resume <stage> or the Resume button on the Pipeline page); no timer "tripped: ..." as the stage's pause reason
Claude account slots Each Claude account runs a limited number of calls at once (set by operators on the Accounts page); calls beyond that wait in a queue, security first, then the path to merge, then triage Until a running call ends or an operator raises an account's slots "waiting for a Claude account" in the job log
Security fix build The private fix of a security finding waits for its build tasks in the worker; no job holds the wait Until the tasks end, at most 4 hours; then they are cancelled and the round is read as failed none
Claude usage pause Account headroom Until usage reading recovers; re-read every minute Claude pause reason
Rate limits GitHub. Writes are also paced under GitHub's limits: at most 60 a minute and 400 an hour per identity and repo owner (one key for the box account, which runs every legacy repo, operator presses on those included; only user: identities, an operator's own token, are exempt), and a key pauses 60 seconds after a secondary-limit failure. A write waits at most 15 seconds for its turn, then fails as paced and the planner retries it Per the API's reset; write pacing frees as the minute and hour windows move Job log
Planner fallback Safety net; the planner normally runs on a change 5 minutes none
Flow summary and vector index Display and search caches 10 and 30 minutes at most; also rebuilt on change none
Retention Pruning old rows and logs Days to months none

GitHub writes are paced inside the write module, so every write path is covered. Per identity and repo owner, at most 60 writes a minute and 400 an hour are started (GitHub's limits are about 80 and 500). The box account runs every write under the box identity and is one key for all owners, operator presses on those repos included. Only user: identities (an operator's own token) are exempt. A write over budget waits until the window frees, for at most 15 seconds; past that it fails as paced without an audit row and the planner retries it. After a write on a key failed with a secondary rate limit or abuse error, that key pauses for 60 seconds.

Who On the Pipeline page
Anyone signed in Sees the switch, limits and use today, every stage and job with its log, result and cost, and recent syncs
Operator Also turns the pipeline on and off, changes limits and cancels jobs; all audited

Logs hold no secrets; anything that looks like a token is hidden.

Optional and off by default. It counts explicit mentions of tracked items in Discord channels the operators choose, answers pings of the bot and runs issue search commands (below). Nothing else in the pipeline reads the counts, and the planner ignores the tables (the discord topic is not in INPUT_TOPICS).

  • Switch. The runner starts a gateway client only when AUTOCRAFT_DISCORD_TOKEN_FILE and AUTOCRAFT_DISCORD_KEY_FILE name files (mode 600). The token is read from the file and is never logged or stored in the database. A failed connection or a bad configuration is logged and shown on the Discord page; the pipeline keeps running.
  • Gateway. Node's built-in WebSocket and fetch, with the GUILDS, GUILD_MESSAGES and MESSAGE_CONTENT intents, heartbeats, resume or reconnect with backoff, and a pause on rate limits. A refusal that cannot be fixed by retrying (bad token, intents not allowed) stops reconnecting. The client reads only MESSAGE_CREATE, MESSAGE_UPDATE, MESSAGE_DELETE and MESSAGE_DELETE_BULK of watched channels and never message history; it also receives INTERACTION_CREATE. Messages by bots are not counted. It posts only the replies described under "Ping replies" and "Commands".
  • Matching. An item counts when the message holds a GitHub issue or PR URL of a tracked repo, repo#123 or owner/repo#123 for a tracked repo. Code blocks count. A message counts once per item. An edit replaces the message's references.
  • Storage. discord_mentions has one row per message and item: repo and number in the clear for counting, and the guild, channel, message ID and message time sealed with AES-256-GCM under a key derived from the key file. A keyed hash of the message ID and one of the channel ID are kept in plain columns only to find rows for deletion; a keyed hash of the author ID is sealed with the row, so no per-person value sits in a plain column. No message text, no author ID and no per-person data is kept. A deleted message (watched channel or not), a deleted channel or thread, a guild the bot is removed from, or an edit that drops the reference deletes its rows. A message deleted while the bot is offline keeps its row until a deletion request; unwatching a channel keeps its rows.
  • Deletion requests. autocraft discord forget --message <link or id> and autocraft discord forget --user <user id> delete rows (the second opens every row to find the author, only matches messages seen after this feature started, and also removes the user's account link). Each is audited.
  • Channels. The bot reports its servers and its text, announcement and forum channels into discord_channels; watched is the operators' choice (Discord page, or autocraft discord watch|unwatch <channel id>). Nothing in an unwatched channel is read. Threads and forum posts count under their parent channel: watching the parent watches them.
  • Bot permissions. The invite needs the bot and applications.commands scopes and the permissions View Channels, Send Messages, Add Reactions and Read Message History. With the Discord page switch "React to recorded messages" on (the default), the bot adds a ✅ to a message when it first records it against items; a refused reaction (missing permission, deleted message) is logged once per channel and skipped.
  • REST. src/discord/rest.ts is the one client for posting, editing and deleting messages, interaction callbacks and registering commands. It runs requests of a rate-limit bucket one at a time, waits out X-RateLimit-Remaining: 0 windows, retries a 429 after the retry_after Discord names (up to four tries) and honours the global limit. Requests of different buckets run side by side. Interaction callbacks are sent at once, never queued behind other requests.
  • Commands. src/discord/interactions.ts keeps a table of command handlers keyed by command name (and subcommand) and button handlers keyed by custom_id prefix; other features add theirs with command() and component(). Every interaction is deferred first and edited when the handler is done, except handlers that answer with a form (a modal must be the first response within 3 seconds) or acknowledge a menu choice. At READY and at each GUILD_CREATE the guild's commands are replaced with the registered set (a bulk overwrite, so it is idempotent). Registered now: /autocraft search (no fields; it opens a form, see Search), the message command "Find issue", and /autocraft link code:<code>, /autocraft unlink, /autocraft stats [repo] (repo choices by autocomplete: public tracked repos) and /autocraft status item:<repo#n> (public status layer; "No item found" for an unknown or hidden item); all replies are ephemeral. A handler that fails after the deferral edits the response with a short error. /autocraft help answers privately with the commands, pings, the "Find issue" message command and what the ✅ reaction means.
  • Ping replies. A new message from a person (not a bot or webhook) that mentions the bot, directly or through its managed role, in a watched channel gets one public reply: the issues closest to the question, with allowed_mentions set to none. The question is the quoted message when the ping is a reply, otherwise the ping's text without mentions. Edits get no reply. A message counts as a ping only when its text contains <@botId>, <@!botId> or the bot's role mention; the author-of-the-quoted-message entry Discord adds to mentions does not count, and a reply to one of the bot's own messages is ignored. When the ping, or the quoted message, is deleted, the reply is deleted in Discord and then its row (the pings handler owns this, so discord_replies is untouched until it runs); autocraft discord forget --message does the same through the bot token. discord_replies holds a keyed hash of the ping, one of the quoted message and one of the channel, and the reply's guild, channel and message ID sealed like the mention rows; no text.
  • Search. A public tracked repo named in the question as a whole word (case-insensitive) restricts the search to that repo and is left out of the embedded text; when none or several are named, all public repos are searched. /autocraft search opens a form (below); the repo chosen there wins over the detection. The message command "Find issue" searches with the message text, all repos or the one the text names. Ping replies use the detection too; the channel's default repo does not restrict the search. The question is embedded in memory with the local model (loaded on first use) and compared with the stored vectors of issues of public tracked repos: open ones and ones closed as completed in the last 180 days, shown with "(closed)". The closest twenty go to a Haiku call (prompt discord.search, step discord-search, queue class 0, no tools, cost in agent_runs) that picks up to ten with a one-line reason; picks outside the candidate list are dropped. The picks are shown open issues first, then by activity (comments plus reactions, highest first), then by the latest update; the model's order does not matter, and a missing reaction count counts as 0. A command reply lists every pick that fits in one message; a public ping reply lists the best three. The call's prompt and reply texts are deleted when it ends, and every discord-search text at startup, whatever its state. The spend of the day (UTC) in agent_runs for that step is compared with the discord_search_daily_usd setting (default 1); at or above it, or when the call fails or times out waiting for an account, the reply lists the ten closest with a cosine of at least 0.55 (three for a ping), in the same order and with no reasons. Limits: 5 questions a minute per person and 20 per channel, counted in memory by keyed hash; a pinged question over a limit gets no reply, a command gets a short refusal.
  • Reply buttons. One link button per result, and "File a new issue", a button that opens the search form (below) with the app preselected: the channel's default repo (set per channel on the Discord page, public tracked repos only; a thread uses its parent's), else of the top result's repo or the only public tracked repo, with the description filled from the question.
  • Search form and new issue helper. /autocraft search answers at once with a form: an app select (a Label component around a string select; public tracked repos by release_apps.name, else the repo name, preselected with the channel's default repo, at most 25 with the most open issues kept when there are more) and a description box; the "File a new issue" button opens the same form with the description and repo filled in. Submitting searches that repo (up to ten matches, like Search) and replies privately with the matches, a link button for each, and "None of these, file a new one". In parallel a Haiku call (prompt discord.issue-questions) picks up to three follow-up questions by id from a fixed list (steps to reproduce, expected and actual result, version and platform; issue templates are not synced); "None of these" opens a second form with them (without matches the flow continues at once, behind a Continue button when questions are asked). A second Haiku call (discord.issue-draft) writes the title, body and kind (bug or feature), which are length-capped and stripped of mentions, HTML and any link that is not an issue or pull request of a public tracked repo. The private draft has a type select (Bug report or Feature request, preset to the model's kind) and the buttons File it, Edit (title and body in a form) and Open on GitHub instead (a prefilled new-issue link, body trimmed with a note to fit 1500 encoded characters). File it calls fileIssue() (src/discord/file-issue.ts): a person who has not signed in gets a "Sign in with GitHub" link button and presses File it again afterwards; a filed issue answers "Filed as repo#N" with a link button and ends the session; a refusal shows its reason and the GitHub link. Person text sits in memory for the session only (15 minutes); the calls run as step discord-issue with cost in agent_runs, their prompt and reply texts are deleted when a call ends and at startup. Spend of the day against the discord_issue_daily_usd setting (default 2): at or above it no model call is made and the draft is built from the form. Limits: 3 new-issue sessions an hour per person, 10 per channel, counted in memory by keyed hash, when the form is submitted (over the limit the matches show without the None button); searches 5 a minute per person.
  • Filing from Discord. Built and off (FILING_IN_DISCORD in src/discord/file-issue.ts): until the sign-in also confirms the Discord user in the browser, the draft offers only the prefilled GitHub link and the sign-in routes are not served. fileIssue() (src/discord/file-issue.ts) files a drafted issue under the person's own GitHub account, for public tracked repos only. A person who has not signed in gets a "Sign in with GitHub" link (/discord/github/start?state=..., state random, single use, stored hashed with the Discord user's keyed hash, valid 10 minutes); the callback (/discord/github/callback, both public, no dashboard session) stores the GitHub App user token in reporter_tokens, sealed like user_tokens with an AAD naming the table and reporter. The runner refreshes it as the dashboard does (compare-and-swap on version; a dead refresh token asks for sign-in again). The issue is created with the person's token through gh, audited as discord-issue-open under their GitHub login through createReporterIssue in src/github/write.ts (the audit row keeps the repo, number and URL, not the text; write limit 50 a day), with the footer "Filed from Discord with AutoCraft." and the label bug or enhancement when the repo has it and the token may set it (an audited discord-issue-label write). Before filing, a junk check (Jev, Haiku where unsure or unavailable, discord.junk.*) refuses spam, abuse, empty and test drafts, and refuses to file when no model answers; the model sees only the draft and the texts are deleted. Limits per 24 hours: 3 issues per GitHub login and 30 per repo (discord_filed; the slot is reserved before the junk check and freed on any failure, rows older than 24 hours are deleted). A new sign-in revokes the token it replaces. The new-issue session limit (3 an hour) counts when the person chooses "None of these, file a new one", not at each search. /autocraft unlink and autocraft discord forget --user remove the sign-in and the person's discord_filed rows and queue the token's revoke. The GitHub App's callback URLs must include /discord/github/callback.
  • Attention signals. src/discord/signals.ts checks each new message in a watched channel that names a tracked item (and each edit; a link-preview update is skipped) for one question per item, at most five items (a message naming more is not checked; 10 checks per minute per author and 30 per channel, in memory, over a limit it stays a plain mention; two model calls at a time, the rest wait): does it ask for attention (a review, a merge, an answer, whether anyone is looking)? Jev (discord.signal.jev) answers first: 0.8 or more is a signal, below 0.3 a plain mention, in between Haiku (discord.signal.haiku, no tools, the text as delimited data) decides. Without Jev, Haiku decides alone. Haiku calls stop for the day when the signal calls cost the discord_signal_daily_usd setting (default $1); a message past the cap stays a plain mention. The text is used for that call only: the result is one signal flag on the mention row, the recorded prompt and reply are deleted when the call ends (and at startup), and a deleted message takes its row and flag with it. The item page header shows "Asked about on Discord ×N" linking to the newest such message (links need the key file). Items has a "Seen on Discord" filter (discord=1) that lists every mentioned item, asked about or not. The flag is display only: nothing in the pipeline reads it, and the discord topic stays out of INPUT_TOPICS.
  • Public status. src/public/status.ts is the only source of what anonymous people may learn, and exports the visibility rule (isPublicRepo, publicRepoNames, hiddenSql) that search candidates, counts, queue places and repo lists share. publicStatus(repo, number) gives an item's title, URL and one step of a fixed list (New, Triaged, In review, Waiting for CI, Fix-up in progress, Needs a maintainer decision, In the merge queue with its place in the Queue page order (fast-tracked first, then ready before batched, then work rank), Merged, Closed), derived from the item's stage, cached plan, open decisions and queue; holds and refusals show as In review. It returns nothing for an untracked or non-public repo, and for security fixes (a quiet fix PR, a finding's fix PR, an item flagged or labelled security). publicStats gives open issues and PRs, merges and posted reviews of the last 7 days (and how many merges were AutoCraft's), the median open-to-merge time over 30 days and the merge queue length, per public repo or in total.
  • Linking accounts. A signed-in dashboard user chooses Link Discord in the account menu and gets a code (8 characters, single use, valid 10 minutes, one live code per login, stored as a keyed hash in discord_link_codes; audited as discord-link-code). In Discord they run /autocraft link code:<code>; the bot answers privately "Linked to " and the link is stored in discord_links (keyed hash of the Discord user ID, login, time; audited as discord-link). Code entries are limited to 5 a minute per Discord user. /autocraft unlink, Unlink Discord in the account menu and the operators' list on the Discord page remove links (audited as discord-unlink). The account menu and the Discord page refresh on their own topic, discord-links.
  • Privacy and terms pages. /privacy and /terms are public and need no session. Its contact line is the discord_contact setting.

Commands

Dry run is the default for every writing command; --apply writes (and still refuses unapproved repos).

Command Stage
autocraft sync, embed, dupes, classify, prioritize Sync to Priority
autocraft areas list|propose|accept|edit|rescan|suggest --repo R Classify (areas)
autocraft rank, rank show <repo> <n> Work rank
autocraft discord forget --message <link|id>|--user <id>, discord channels|watch|unwatch Discord mentions and search
autocraft decide [--repo R] Decide
autocraft labels ensure|plan|apply --repo R Label
autocraft checks --repo R, review --repo R, opus-review --repo R, review-post --repo R [--apply] Review
autocraft fixissue --repo R, fixissue-collect Fix
autocraft fixup --repo R Fix-up
autocraft cifix --repo R, cifix-rerun --repo R Fix-up (CI fix)
autocraft main-fix --repo R [--apply], main-fix-approval [--repo R] Fix-up (red default branch)
autocraft optional-checks [--repo R], optional-checks add|remove R NAME Merge queue (optional checks)
autocraft verify --repo R, verify-collect Verify
autocraft queue, merge --repo R, merge-hold|merge-release <repo#n>, batch-remove <repo#n>, batch-stop <id> Merge queue
autocraft fasttrack add|remove <item>, fasttrack list Fast track
autocraft act --repo R Act
autocraft postmerge review <repo#n> [--again], postmerge file <repo#n> <finding>, postmerge backfill --since <date> [--yes] Post-merge review
autocraft security scan|stop|list|show|act Security deep scan
autocraft conversation show|say|do Conversations
autocraft decisions test-repo [REPO on|off] Marks a tracked repo as a test repo
autocraft decisions answer ID OPTION --as LOGIN [--note TEXT], cards REPO#N, card ID --as LOGIN [--skip N,N] [--note TEXT], retry ID --as LOGIN Answer, run a card or retry a write on test repos
autocraft pipeline on|off|limit, accounts list|set|jev Switch, limits, accounts

On a test repo, an operator login may answer decisions and run cards from the CLI; the audit rows are marked as a session. The command refuses a decision that touches any repo not marked as a test repo, and a login that is not an operator. A duplicate group answer approves the comments stored now and prints them. On a test repo, a post-merge defect or a red default branch trips the breaker merge:<repo> only, which holds merges on that repo and not the whole pipeline.