Install

Install mfactory once for your user, then install the factory into each repository. Setup fills in factory/factory.toml. Doctor checks that a run can start.

What you need

The factory adds nothing to your project's dependencies. It is a folder of Python files that need one package besides the standard library: PyYAML, for the pipelines in factory/pipes/*.yaml. install.sh installs it when it is missing, and mfactory doctor checks for it. macOS, Linux, or WSL. The script uses fcntl and bash.

Install the command

curl -fsSL https://raw.githubusercontent.com/danielsmag/modular-factory/master/install.sh | bash -s -- --global
OptionMeaning
--globalInstall mfactory for your user. Do not combine it with --tool.
--version v0.2.0Install that release. Default: the latest release, or the master branch before the first release.
--source DIRInstall from a local copy of this repository instead of downloading.

This creates ~/.mfactory (FACTORY_HOME when set) and links ~/.local/bin/mfactory. It also serves the dashboard. The workspace, the list of your projects, is ~/.mfactory/workspace.toml.

To read the script before running it, download it first:

curl -fsSL -o install.sh https://raw.githubusercontent.com/danielsmag/modular-factory/master/install.sh
less install.sh
bash install.sh --global

Install into a repository

From the repository:

mfactory install --tool claude

To install straight into the repository you are in, without a command on PATH:

curl -fsSL https://raw.githubusercontent.com/danielsmag/modular-factory/master/install.sh | bash -s -- --tool claude
OptionMeaning
--tool claude|cursor|codexThe tool to generate agents for. Repeat it, or separate names with commas. Default: claude.
--personalKeep factory/, .factory/, and the generated files untracked in this checkout. Writes .git/info/exclude and does not touch .gitignore.
--version v0.2.0Install that release.
--source DIRInstall from a local copy instead of downloading.

The installer prints each step. The version numbers below are an example:

ok    .factory/ installed (version 0.36.1)
ok    factory/factory.toml written
ok    factory/pipes/default.yaml written: the default pipe, ready to edit
ok    .gitignore gained /.factory/jobs/, /.factory/telemetry/, /.worktrees/
ok    generated files for claude
ok    GitHub labels: factory, factory:needs-info, factory:needs-human
PathWhat it isCommit it?
factory/factory.tomlProject settings: checks, models, tracker, skills.Yes
factory/pipes/*.yamlThe pipes. install writes default.yaml.Yes
.factory/The factory: its CLI, prompts, and defaults.Yes
.factory/jobs/The state and files of each job.No, ignored
.worktrees/One git worktree per running job.No, ignored
.claude/agents/mfactory-*.mdOne small agent file per step, generated from factory/factory.toml. Cursor and Codex use their own folders.Yes
.claude/skills/mfactory/The /mfactory skill. Codex uses .agents/skills/mfactory/.Yes

Running the installer again is safe: it never overwrites factory/factory.toml or a pipe file that is already there.

Personal install

Use this when the factory is for you, not for everyone who clones the repository. .gitignore stays as it was.

mfactory install --tool claude --personal

The same flag works from the installer script and from the Makefile:

curl -fsSL https://raw.githubusercontent.com/danielsmag/modular-factory/master/install.sh | bash -s -- --tool claude --personal
make install PERSONAL=1 TOOL=claude

The installer appends this block to .git/info/exclude. The patterns cover every tool, so turning one on later does not show new files in git status:

# software factory, this checkout only
/factory/
/.factory/
/.worktrees/
/.claude/agents/mfactory-*
/.claude/agents/factory-*
/.claude/skills/mfactory/
/.cursor/agents/mfactory-*
/.cursor/agents/factory-*
/.agents/skills/mfactory/
/.codex/agents/mfactory-*
/.codex/agents/factory-*
ok    .factory/ installed (version 0.36.1)
ok    factory/factory.toml written
ok    factory/pipes/default.yaml written: the default pipe, ready to edit
ok    .git/info/exclude gained /factory/, /.factory/, /.worktrees/, /.claude/agents/mfactory-*, /.claude/agents/factory-*, /.claude/skills/mfactory/, /.cursor/agents/mfactory-*, /.cursor/agents/factory-*, /.agents/skills/mfactory/, /.codex/agents/mfactory-*, /.codex/agents/factory-*
ok    generated files for claude: 10 written
ok    GitHub labels: factory, factory:needs-info, factory:needs-human

Next:
  1. In your tool, run `/mfactory setup` to fill in factory/factory.toml (or edit it yourself).
  2. Run `.factory/bin/mfactory doctor`.
  3. Leave factory/, .factory/ and the generated files untracked. This checkout ignores them.
  4. Label an issue `factory` and run `/mfactory run`.

git status does not list factory/factory.toml, .factory/, or .claude/agents/mfactory-build.md. git check-ignore -v factory/factory.toml names .git/info/exclude.

Running mfactory install again in that checkout, without --personal, does not touch .gitignore:

ok    .git/info/exclude already ignores the factory (personal install)

doctor then reports:

ok    factory/factory.toml and .factory/ are ignored in this checkout (.git/info/exclude). Worktrees built from origin/main do not contain them. A check that needs those files must use the main checkout.

Jobs build a worktree from origin/<base>. That worktree does not contain factory/ or .factory/. A check command that needs those files has to reach the main checkout itself. A checkout set up before factory/ keeps factory.toml at its root; mfactory migrate layout moves it. Skip the commit step below.

To install for the team afterwards, delete that block from .git/info/exclude, then run mfactory install. That run appends /.factory/jobs/ and /.worktrees/ to .gitignore and tells you to commit.

mfactory upgrade in a personal checkout ends with:

Next: run `.factory/bin/mfactory doctor`. Leave factory/, .factory/ and the generated files untracked.

Set up

In your coding tool, in the repository:

/mfactory setup

In Codex, mention the skill with $factory setup, or ask in words: "set up the factory".

The agent reads your README, package manifest, and CI workflows, then edits factory/factory.toml:

It asks before turning on any optional step. By default a maintainer merges the pull request and the factory does not. Ask whether a merge to the base branch publishes a release. Only when it does not, and you want the factory to merge, turn the merge step on. See who merges. You can also edit factory/factory.toml and the pipes by hand. The reference lists every key.

After any change to factory/factory.toml or a pipe:

.factory/bin/mfactory sync

This rewrites the generated agent files to match.

Check

.factory/bin/mfactory doctor
ok    factory 0.36.1, Python 3.12.3
ok    git: git version 2.43.0
ok    gh: gh version 2.60.0
ok    gh is signed in
ok    factory/factory.toml is valid
ok    pipe "default" (factory/pipes/default.yaml) is valid: 9 steps on, off: spec-approval, debug, merge, ready-to-verify, verify
ok    Claude Code: claude 2.1.0
ok    generated agent and skill files match factory/factory.toml
ok    origin/main can be fetched
ok    .factory/jobs/ is ignored by git
ok    GitHub labels exist
...   running the checks on origin/main
ok    the checks pass on origin/main (41s)

Everything a run needs is in place.

The version numbers above are examples. Doctor runs your checks on a clean copy of the base branch, which can take as long as your CI. Pass --skip-checks to leave that out.

It reportsWhat to do
A problem in factory/factory.toml or a pipe, naming the keyFix that key. mfactory graph shows the pipeline in effect. mfactory pipes validate checks every pipe.
[checks].commands is emptyRun /mfactory setup, or list the commands yourself.
Generated files differ from factory/factory.tomlRun .factory/bin/mfactory sync. Edit factory/factory.toml and the pipes, never the generated files.
factory/ and .factory/ are not on origin/<base> yetCommit and push them. Jobs build from that branch. A personal install does not report this: those files are listed in .git/info/exclude.
factory/ and .factory/ are ignored in this checkoutExpected after mfactory install --personal. Worktrees from origin/<base> do not contain the factory.
The checks fail on the base branchFix the base branch first. Otherwise every job fails for a reason it did not cause.
A label is missingmfactory install creates them. It needs write access to the repository.
<tool> isn't on PATHA warning only. It is fine if you run the tool as an app.

Commit

git add factory .factory .gitignore .claude .cursor .codex .agents 2>/dev/null
git commit -m "Add the software factory"
git push

Then run a job.

More than one tool

[tools]
enabled = ["claude", "cursor"]

mfactory sync writes agent files for each. Any one of the tools can run /mfactory run. They share the same job state in .factory/jobs/, so do not run two orchestrators on the same checkout at the same time.

Cursor also reads .claude/skills. With Claude Code and Cursor enabled, the factory writes the skill only to .claude/skills/mfactory, so Cursor lists it once. With all three tools enabled it also writes .agents/skills/mfactory for Codex, and Cursor may list the skill twice. The copies are identical. See Tools.

Upgrade

mfactory upgrade
mfactory upgrade --version v0.2.0
mfactory upgrade --self
mfactory upgrade --all

mfactory upgrade updates the CLI from install.sh --global and every project in the workspace. Standing in an installed checkout that is not listed updates that checkout too. It replaces .factory/ (not .factory/jobs/), runs sync, and leaves factory/ alone. It refuses a release whose schema number differs from your factory/factory.toml. The changelog says what to change when that number moves. One project failing does not stop the others. Commit the result in each repository. A personal install stays untracked: upgrade tells you to leave factory/, .factory/, and the generated files untracked.

--self updates only the global CLI. --all upgrades only the projects in the workspace.

Remove

mfactory uninstall
mfactory uninstall --config
mfactory uninstall --labels

uninstall removes .factory/, the generated agent and skill files, the job worktrees, and the checkout from the workspace. factory/ stays unless you pass --config. --labels deletes the three factory labels on GitHub. It needs factory/factory.toml still readable, so pass --labels together with --config or before deleting the folder yourself.