Configuration
You edit one folder at the root of the repository, factory/: the pipes, YAML files in factory/pipes/ checked against .factory/schema/pipe.schema.json (see Pipeline), and factory/factory.toml, which holds the rest of what your project changes. Everything else comes from .factory/defaults.toml and from each tool's adapter in .factory/adapters/.
Also in factory/: Pipeline settings, Reviewers, models and skills, Trackers, planner and telemetry.
How values merge
The files merge key by key. To change one value you write only that value:
pipes:
default:
steps:
review:
on: { CHANGES: { max: 3 } } # the other edge, and its target, stay as they are
After a change, mfactory sync rewrites the generated agent files and mfactory doctor checks the result. To see what is in effect:
.factory/bin/mfactory config show # every setting and which file set it
.factory/bin/mfactory graph # the pipeline
.factory/bin/mfactory models # model and effort of every agent, per tool
.factory/bin/mfactory skills # the project's skills and who reads them
A mistake is reported with the key to fix, and nothing runs until it is fixed:
mfactory: the configuration has 2 problem(s):
- factory/pipes/default.yaml (pipe "default"): steps.review.on.CHANGES points at unknown step "biuld". Steps: intake, ask-author, spec, ...; end states: done, failed, rejected
- [models.claude].build.effort = "extreme" is not an effort level claude documents. Known: low, medium, high, xhigh, max
schema is the version of this file's format. mfactory upgrade refuses a release that needs another. It is 1 today. Behavior of who merges changed in 0.2.0 without a schema change. See who merges.
Project, tools and run
schema = 1
[project]
description = "Invoicing app for small clinics. Not a general accounting tool."
base_branch = "main"
merge_method = "squash"
[tools]
enabled = ["claude", "cursor"]
[run]
concurrency = 3
| Key | Default | Meaning |
|---|---|---|
| schema | 1 | The version of this file's format. |
| [project] description | "" | What the project is for, and what does not belong. Intake judges issues against it. |
| [project] base_branch | master | Jobs branch from origin/<base_branch> and merge into it. |
| [project] merge_method | squash | merge, squash, or rebase. With squash, the pull request title becomes the commit on the base branch. |
| [project] pr_title | "" | Example pull request title, such as feat: add CSV export [ABC-123]. The builder uses this shape instead of the spec title. Empty means the spec title. The script does not fill placeholders. |
| [project] pr_title_pattern | "" | Regular expression the whole title must match (fullmatch). Empty means no check. done refuses a READY build whose title does not match. |
| [project] issue_link | refs | How the pull request body links the issue. refs: the first line is Refs #<issue>, and the issue stays open after the merge until someone runs mfactory close issue. closes: the first line is Closes #<issue>, and GitHub closes the issue when the pull request merges. |
| [project] branch_prefix | factory/ | Concatenated with the job id. Include the slash: feature/ names the branch feature/001-add-dark-mode. A revert branch is the prefix plus revert- and the job id. |
| [project] branch_pattern | "" | Regular expression the whole branch name must match (fullmatch). Empty means no check. The factory checks the name when it chooses the branch, before creating it. A job already on disk keeps the branch stored in its job.json. |
| [tools] enabled | ["claude"] | claude, cursor, codex. |
| [tools.claude] stop_hook | false | Run the checks when the build agent stops, and send it back if they fail. Claude Code only. |
| [tools.claude] plan_usage | true | Record the Session and Weekly plan limits from Claude Code's status line, and show plan usage per step on the dashboard. Your own status line still runs. Claude Code only. |
| [tools.claude] resume_builder | false | In later rounds, wake the job's builder with SendMessage instead of starting a new one. Only the session that started it, and only while its model and effort are unchanged. Claude Code only. |
| [tools.claude] cost | true | Work out each job's cost from Claude Code's transcripts. Other tools record no cost. |
| [tools.claude] agent_tools | ["all"] | Claude Code tools every agent may use. ["all"] gives every tool, plugin and MCP tools included. A list such as ["default", "WebFetch", "mcp__github__*"] narrows it; default is the agent's built-in list. A tools key on a step or reviewer replaces it for that agent. |
| [tools.codex] intake_shell | false | Let the Codex intake agent run commands. See intake. |
| [run] concurrency | 3 | Jobs this project works on at once. A job waiting for a person, or being validated after merge, does not count. |
| [workspace] concurrency | 3 | new and resume rows across every project. workspace.toml or --concurrency overrides it. A project's factory.toml cannot. |
| [run] start | intake | The step a new job starts in. |
| [run] escalate_to | escalated | The human step a job goes to when a loop limit is reached. |
pr_title is what the agents are shown. pr_title_pattern is what the script checks. Either may be set alone. The check runs for every merge method. When the issue lacks a value the title needs, such as a ticket key, intake returns NEEDS-INFO and asks. It does not invent one. After changing either key, run mfactory sync so the build and intake agents see it.
[project]
pr_title = "feat: add CSV export [ABC-123]"
pr_title_pattern = '^(feat|fix|perf|refactor|chore|docs|test|ci|build|revert)(\(.+\))?!?: .+ \[[A-Z]+-\d+\]$'
issue_link decides who closes the issue. The factory never closes an issue on its own. With refs, the issue stays open through every step after the merge (verify, or a human step on the merge step's MERGED edge), and a person closes it with mfactory close issue <job> (add --not-planned for a job that will not ship). done refuses a READY build whose body does not start with Refs #<issue>, or that puts a closing keyword (close, fix, resolve) next to the issue number. With closes, GitHub closes the issue on merge, and doctor warns when a step runs after the merge, because that step would see a closed issue. mfactory close job <job> is separate: it ends the job as done from any step and leaves the issue alone. After changing issue_link, run mfactory sync.
branch_prefix is concatenated with the job id, so the slash belongs in the prefix. branch_pattern is checked when the factory chooses the name, before it creates the branch. A job already on disk keeps the branch stored in its job.json. A revert branch is the same prefix plus revert- and the job id, and the pattern has to match that name too.
[project]
branch_prefix = "feature/"
branch_pattern = '^(feature|fix|chore|docs|test|hotfix)/[A-Za-z0-9._-]+$'
Checks
[checks]
commands = ["npm ci --prefer-offline", "npm run lint", "npm test -- --run"]
timeout_minutes = 30
The commands run in order in the job's worktree with bash -c. The first one that exits non-zero stops the run and fails the step. They run at gate, and again in merge after the base branch is merged in, when that step is on. The working directory stays that worktree. Each command gets FACTORY_CHECKOUT, the main checkout, and FACTORY_JOB, the job id. mfactory checks runs in the current directory and still sets FACTORY_CHECKOUT; it has no job, so FACTORY_JOB is unset. A command must not rewrite files. Protected paths fail the branch even when every command exits 0. See paths.
Labels, paths and ports
[tracker]
kind = "github"
[labels]
queue = "factory"
needs_info = "factory:needs-info"
needs_human = "factory:needs-human"
[paths]
worktrees = ".worktrees"
protected = [".github/workflows/*", "infra/*"]
[ports]
base = 5100
step = 10
| Key | Meaning |
|---|---|
| [tracker] kind | Where jobs come from and where people reply to the factory: github (GitHub issues), jira, or both as a list. See Tracker: a Jira board. Pull requests are always on GitHub. |
| [labels] queue | Issues with this label are built. |
| [labels] needs_info | Put on an issue while its author is being asked. |
| [labels] needs_human | Put on an issue while a maintainer, the operator, or a named login is being asked. |
| [paths] worktrees | Where each job's worktree goes, relative to the repository. Keep it ignored by git. |
| [paths] protected | Patterns of files no job may change or delete. * also matches /. A job may add new files that match. |
| [ports] base, step | Job number n gets ports from base + step * (n % 100), so dev servers of parallel jobs do not collide. |
No job may add, change, or delete anything in factory/ (factory.toml and the pipes, or a factory.toml at the root), anything under .factory/, or a generated mfactory-* agent or skill file, whatever protected says.