factory

A software factory you install into any repository. You label a GitHub issue. Agents decide whether it is worth building, write a spec, build it on a branch, and review it. By default a maintainer merges the pull request.

It runs inside the coding tool you already use: Claude Code, Cursor, or Codex. Everything a project changes lives in factory/: pipelines as YAML in factory/pipes/, and the rest in factory/factory.toml.

Install

Install the command once, then put the factory in a repository:

curl -fsSL https://raw.githubusercontent.com/danielsmag/modular-factory/master/install.sh | bash -s -- --global
mfactory install --tool claude

Use --tool cursor or --tool codex instead, or repeat --tool for several. Then, in the coding tool, /mfactory setup. The install guide has each step, and what to do when mfactory doctor reports a problem.

Why a factory

One folderPipes in factory/pipes/. Checks, models, reviewers, and skills in factory/factory.toml. A mistake names the key. The pipeline is dataYAML you can read. No prompt describes the graph. Changing an edge changes no prompt. The script decidesStep, edge, limit, checks, merge. Agents write one step. Three toolsClaude Code, Cursor, and Codex. One set of prompts. mfactory sync writes each tool's files. Nothing to pinPython with PyYAML, git, and the GitHub CLI. No package added to the project. The label is the gateOnly issues with the factory label run. Adding a label needs triage or write access.

One job, two commands

The orchestrator repeats two commands. It does not choose the next step.

$ .factory/bin/mfactory next 004
start-agent mfactory-spec
prompt: Job: 004-dark-mode. Step: spec. Job folder: /repo/.factory/jobs/004-dark-mode/. ...
then: .factory/bin/mfactory done 004-dark-mode

$ .factory/bin/mfactory done 004-dark-mode
004-dark-mode #12: spec DONE -> build

next runs checks, merge, and verify itself. For agent and review steps it prints which agents to start and the one-line prompt of each. done reads the file the agent wrote and follows the edge for that outcome.

The default pipeline

Each step names its type and where each outcome leads. This is what .factory/bin/mfactory graph prints. Steps marked off are passed through.

intake           agent   ACCEPT -> spec | NEEDS-INFO -> ask-author (max 2) | REJECT -> rejected
ask-author       human   ANSWER -> intake | REJECT -> rejected
spec             agent   DONE -> spec-approval
spec-approval    human   off, continues as APPROVE -> build
build            agent   READY -> gate | BLOCKED -> escalated
gate             checks  PASS -> review | FAIL -> debug (max 2)
debug            agent   off, continues as FOUND -> build
review           review  PASS -> approve | CHANGES -> build (max 2)
approve          agent   APPROVE -> ready-to-merge | ESCALATE -> escalated
ready-to-merge   human   FEEDBACK -> build (max 3) | REJECT -> rejected
merge            merge   off, continues as MERGED -> ready-to-verify
ready-to-verify  human   off, continues as VERIFY -> verify
verify           verify  off, continues as PASS -> done
escalated        human   FEEDBACK -> build | REJECT -> rejected

The factory does not merge unless the project turns that step on. Who merges has the three keys that change it. A max on an edge is how many times in a row a step may send a job that way. When the limit is used up, the job goes to a maintainer.

Get startedInstallThe command, the repository, setup, and doctor. Get startedFirst jobLabel an issue, run it, answer when it waits. ConceptsHow it worksScript, orchestrator, agents, and where files live. GuidesPlannerDuplicates, order, and overlap. Nothing changes until you approve. ReferenceConfigurationEvery key in factory/, and which file set it.