From a normal terminal
Open cmux, then start Codex
cmux /path/to/projectIn the new cmux terminal:
codex /start-factorySmall, local, inspectable
Pick a task and copy the commands. The current agent becomes the Lead. cmux opens the Builder, Reviewer, and Watchdog tabs.
Make commands ready to copy
The page uses this path and its directory name in every project command.
Task index
No task matches that filter.
I want to set up a new machine
Result: the command and agent skill point to one local clone.
Install cmux, Git, Python 3.11 or later, and at least one agent command.
cmux version
git --version
python3 --version
command -v codex
command -v claudegit clone https://github.com/mullender/cmux-factory.git \
~/.local/share/cmux-factory
cd ~/.local/share/cmux-factory
./installgrep -qxF 'export PATH="$HOME/.local/bin:$PATH"' ~/.zshrc || \
printf '%s\n' 'export PATH="$HOME/.local/bin:$PATH"' >> ~/.zshrc
source ~/.zshrccmux hooks setup
factory version
factory doctorDone when the cmux binary and socket checks report PASS.
I want to add the factory to a project
Result: the Git root contains a readable .factory directory.
cd /path/to/project
factory initA second run preserves project rules and prints READY.
factory doctor --projectDone when cmux, the project config, worker commands, and ignore rules pass.
I want Codex to be the Lead
Choose the command for your current location.
From a normal terminal
cmux /path/to/projectIn the new cmux terminal:
codex /start-factoryFrom an existing cmux terminal
cmux new-workspace --name project \
--cwd /path/to/project \
--command 'codex /start-factory' --focus trueI want Claude to be the Lead
The worker roles still come from .factory/factory.toml.
From a normal terminal
cmux /path/to/projectIn the new cmux terminal:
claude /start-factoryFrom an existing cmux terminal
cmux new-workspace --name project \
--cwd /path/to/project \
--command 'claude /start-factory' --focus true/start-factory is not availableGive the Lead this prompt:
Run factory doctor --project, then run factory start. You are the Lead.I want to see what the factory is doing
The output uses exact cmux IDs and readable reasons.
factory statusfactory events --followfactory status --jsonfactory note "Keep the next change smaller"factory inbox lead
factory inbox lead --archivefactory mail builder lead \
"The change is ready" --kind handoff \
--base BASE_SHA --head HEAD_SHAI want Reviewer to inspect what Builder committed
Builder and Reviewer use separate worktrees. Reviewer never reads Builder's live files.
factory status
factory mail lead builder "Make the bounded change" \
--kind assignment --base BASE_SHAfactory inbox lead --archiveThe mail contains full base_sha and head_sha fields.
factory mail lead reviewer "Review this change only" \
--kind assignment --base BASE_SHA --head HEAD_SHAThe factory checks out HEAD_SHA and its recorded submodule commits before it sends the mail.
git -C .factory/worktrees/builder status
git -C .factory/worktrees/reviewer status
factory statusI want to change instructions for one project
These changes travel with the project repository.
| File | Purpose |
|---|---|
.factory/config/OPERATING_RULES.md | Rules for all agents |
.factory/config/STYLE.md | Shared writing style |
.factory/roles/lead.md | Lead duties and limits |
.factory/roles/builder.md | Builder duties and limits |
.factory/roles/reviewer.md | Reviewer duties and limits |
.factory/agents/<name>/IDENTITY.md | One agent identity |
.factory/factory.toml | Names, commands, and role paths |
cd /path/to/project
$EDITOR .factory/config/OPERATING_RULES.mdgit diff -- .factory/config/OPERATING_RULES.md
git add .factory/config/OPERATING_RULES.md
git commit -m "docs: update factory operating rules"
git pushExisting agents keep their original prompt. Start a new session to load the change.
I want to publish a change
Builder and Reviewer never push. They hand commits to Lead.
git remote get-url origin
branch=$(git branch --show-current)gh search prs --head "$branch" --state open \
--json repository,number,urlVerify that a result uses the exact remote repository and branch.
gh pr view URL --json headRefName,headRepository,state,url
gh repo view OWNER/REPOSITORY --json visibilityIf the matching pull request repository is public, Lead shows its URL and asks the user for permission. Permission applies to one push only.
I want to change defaults for future projects
New projects receive these files when factory init creates their brain.
cd ~/.local/share/cmux-factory
$EDITOR templates/project/.factory/config/STYLE.mdpython3 -m unittest discover -s tests -v
git diff
git add templates/project/.factory
git commit -m "docs: update default agent instructions"
git pushcd /path/to/project
diff -u \
~/.local/share/cmux-factory/templates/project/.factory/config/STYLE.md \
.factory/config/STYLE.mdI want to use a different agent command
cmux-factory calls commands. It does not depend on a provider SDK.
cd /path/to/project
$EDITOR .factory/factory.toml{prompt} as a separate argument[agents.builder]
label = "Builder"
command = ["claude", "{prompt}"]
role = ".factory/roles/builder.md"The worker starts in the project root for shared factory state. Its prompt gives it a separate source worktree.
factory doctor --projectI want the latest factory version
The command fast-forwards the clone, verifies links, and safely syncs managed rules.
cd /path/to/project
factory updateUse factory update --no-pull while you test local template edits.
diff -u \
.factory/roles/reviewer.md \
.factory/update/roles/reviewer.md.new
# Accept all incoming rules:
factory update --no-pull --use-upstreamThe command prints exact diff, upstream, and keep-current choices. The project file stays unchanged until you choose.
factory version
factory doctorStart a new Lead so it loads the updated skill.
I want the factory to learn from a session
The POC keeps this process manual and visible.
factory note "Keep each assignment small"
factory note "Require evidence before reporting completion"tail -n 50 .factory/brain/FEEDBACK.jsonl
$EDITOR .factory/brain/LESSONS.md$EDITOR .factory/config/OPERATING_RULES.md
$EDITOR .factory/config/STYLE.md
git diff -- .factoryKeep one-time facts in the brain. Add only repeated and useful behavior to agent instructions.
git add .factory
git commit -m "docs: apply factory session lessons"
git pushI want to end the current session
The command interrupts workers and the watchdog. It leaves tabs open for inspection.
cd /path/to/project
factory stopClose the worker and watchdog tabs when you no longer need their output. The worker worktrees remain for inspection and the next start.
Quick reference
factory init [DIR]Create or verify a project brainfactory doctor --projectCheck cmux, config, and agentsfactory updateUpdate source, links, and managed rulesfactory startLaunch tabs from the Leadfactory status [--json]Show agents and surface healthfactory events [--follow]Read watchdog decisionsfactory check-in …Record agent statefactory mail FROM TO TEXTWrite agent mailfactory inbox AGENTRead or archive agent mailfactory note TEXTRecord process feedbackfactory stopInterrupt workers and watchdogfactory versionShow source and revisionfactory watchRun the watchdog loopls -l ~/.local/bin/factory
printf '%s\n' "$PATH"factory doctor --projectgit status
git log --oneline --decorate --graph --all -20Stop the old session. Start a new Lead and workers.