The Loop Lifecycle
Factory operates as a continuous state machine across four distinct phases:
1. Triage (/factory-triage)
Section titled “1. Triage (/factory-triage)”Intakes bug reports, feature requests, and alerts. A maintainer or triage loop converts them into Agent-ready tasks by:
- Narrowing scope to a single deliverable.
- Defining strict, disjoint
Owned Paths. - Providing explicit
Acceptance Criteria. - Supplying a runnable
Verification Command.
2. Dispatch (/factory-work)
Section titled “2. Dispatch (/factory-work)”The dispatcher checks available concurrency slots and claims tickets:
- Locking: Assigns the ticket to the agent and marks it
In Progress. A read-back confirms no race occurred. - Worktree: Branches from
origin/<base>into an isolated folder. - Agent execution: Hands prompt and constraints to the chosen harness.
3. Independent Verification
Section titled “3. Independent Verification”When the agent reports completion:
- The worker executes the ticket’s declared
Verification Commanddirectly. - If tests or linters fail, the run does not advance. Failure evidence is retained so the ticket can be corrected or retried without treating self-attestation as success.
4. Review & Merge (/factory-merge)
Section titled “4. Review & Merge (/factory-merge)”Open PRs are evaluated:
- CI Status: Must be green.
- Reviewer Critique: Evaluates diff correctness, security rules, and project conventions.
- Mechanical Fixes: Fixes minor Prettier/ESLint issues automatically before final re-verification.
- Merge: Merges into the configured base branch. The ticket reaches
Doneonly after the merge and any required post-merge checks succeed.
The Reaper
Section titled “The Reaper”If an agent crashes, stalls, or exceeds its configured deadline, the reaper reclaims the ticket and records recovery telemetry. Cleanup is conservative: a worktree with useful or ambiguous state may be retained for inspection rather than deleted.