factory README

The project's README from github.com/addyosmani/factory. As one markdown file: README.md.

Factory: a reference software factory

A software factory is a repeatable loop around software delivery. Instead of opening a new agent session for every issue and steering it by hand, you define what work may be attempted, how work starts, what evidence must be produced, and where a human must make the decision.

This repository installs that operating model into an existing GitHub project using stock Claude Code. A thin Codex adapter uses the same policy, queue, gates, and evidence files. There is no custom orchestrator or queue service to run.

In practical terms: GitHub Issues become a work queue. Scheduled agents triage the queue, implement bounded tasks, run your real tests, obtain an independent review, and open draft pull requests. Humans remain responsible for ambiguous requirements, system design, load-bearing changes, and every merge.

What this gives you

Once configured, the factory can:

The value begins after code generation. This is a version-controlled method for deciding what an agent may pick up unattended, how independent runs hand work to one another, and what proof a human receives before making the final call.

The mental model

There is no background factory process in this repository. The repository supplies the rules and procedures. Claude Code cloud routines provide the default clock and compute. GitHub carries the durable queue and pull requests. Each run starts fresh, handles one stage, records evidence, and stops.

Factory concept Concrete mechanism
Intent and risk budget A human-owned docs/factory/CHARTER.md
Work queue GitHub Issues with factory:* labels
Handoff between stages A structured factory-handoff:v1 issue comment
Standard operating procedures Version-controlled Claude and Codex skills
Clock and triggers Claude routines, schedules, GitHub events, or the optional API-trigger Action
Worker A fresh Claude Code or Codex session
Quality control Your test commands, gates.sh, and an independent verifier
Control room /factory, backed by live issues, PRs, and run records
Release authority A human reviewing and merging the pull request

Each loop is short and restartable. Broad goals are decomposed into queue items that one run can claim and finish. GitHub labels and committed files survive when sessions end, making a failed run inspectable and allowing the next run, or a different harness, to continue without relying on conversation history.

How an issue becomes a reviewed pull request

flowchart LR
    I["GitHub issue"] --> T["Scheduled triage"]
    T -->|"small and allowed"| R["ready-to-implement"]
    T -->|"needs decisions"| S["ready-to-spec"]
    T -->|"blocked or unclear"| P["needs-info / wait"]
    S --> H["Human-guided spec"]
    H --> R
    R --> B["Implementation run"]
    B --> G["Gates + fresh verifier"]
    G --> D["Draft pull request"]
    D --> V["PR verification"]
    V --> C["/factory control room"]
    C --> M{"Human decision"}
    M -->|"merge"| X["Ship"]
    M -->|"revise or close"| D
    X --> W["Weekly monitor"]
    W --> I

For example, suppose issue #142 reports that expired tokens return 500 instead of 401:

  1. The scheduled triage routine reads the issue, checks the charter, and decides whether it is small and permitted. It applies one queue label and writes a handoff containing the expected files, completion condition, gate level, and confidence.
  2. If the issue is factory:ready-to-implement, a later implementation run claims the deterministic branch claude/fq-142. Only the first push wins, so two scheduled sessions cannot both own the issue.
  3. The implementation run writes a failing test, makes the scoped change, runs the required gates, and delegates to a fresh verifier. It opens a draft PR only if those checks agree.
  4. Opening the PR can trigger a separate verification routine. That routine reruns the gates, checks scope, and leaves a verdict on the PR.
  5. /factory shows the PR in the human review queue. A person reads the evidence and decides whether to request changes, close it, or merge it. No routine merges.

If triage cannot infer product intent, the issue goes to factory:ready-to-spec and the spec workflow pauses at four explicit human approval gates. If it needs a missing fact, the issue is parked with the question rather than converted into speculative code.

Where the human stays in the loop

The factory automates repeated mechanical steering while keeping engineering judgment with a person. That person still:

Agents may classify issues, move queue labels, implement permitted work, run checks, and open draft PRs. They may not quietly widen their scope, rewrite the charter, approve their own work, or merge. GitHub branch protection is the final enforcement boundary.

How work starts from GitHub

One current product limit matters to the first arrow in the diagram: Claude routines have native GitHub triggers for pull requests and releases, but not for newly created issues. This reference uses an hourly scheduled triage routine to poll for untriaged issues. That is the simplest reliable default and means an issue may wait until the next run.

If you need immediate triage, install the optional GitHub Action. It reacts to the issue event and calls the triage routine's API endpoint. Pull-request verification can use the native pull_request.opened trigger. LIMITS.md documents the trigger boundary and the tradeoff in detail.

Where Claude Code and Codex fit

The factory method is shared; the unattended automation is Claude-first in this reference.

Capability Claude Code Codex
Project policy CLAUDE.md plus the shared charter and contract AGENTS.md plus the same charter and contract
Repeatable stages Canonical skills under .claude/skills/ Thin adapters under .agents/skills/
Interactive triage, spec, implementation, and status Yes Yes
Deterministic gates and GitHub queue Shared Shared
Unattended schedule supplied by this repository Five prompts for Claude cloud routines Not provisioned automatically
Native GitHub trigger used here Pull-request verification Not packaged by this reference

Codex can run the same stages interactively, or you can map them to Codex goals and automation surfaces available to you. The repository does not create those schedules or claim that their lifecycle matches Claude routines. Whichever harness starts a run, GitHub labels remain the queue and the shared contract remains the policy.

Codex reads AGENTS.md, discovers repository skills, and can load the committed repository hook. The adapters point back to the canonical Claude workflows rather than maintaining a second implementation.

Start here

This repository is an installer for another project. Clone it, run install.sh against the repository you want to automate, then open that target repository in your coding agent.

factory/
├── README.md            <- you are here
├── ADVICE.md            when the harness is enough, and when Factory helps
├── GETTING_STARTED.md   desktop-first local setup
├── QUICKSTART.md        Claude cloud sessions and routines
├── ARCHITECTURE.md      why it is shaped this way
├── ROUTINES.md          the five routine prompts, copy verbatim
├── LIMITS.md            honest constraints + corrections to the common plan
├── CONTRIBUTING.md      change map and validation expectations
├── CLAUDE.md            Claude Code contributor instructions
├── AGENTS.md            Codex contributor instructions
├── install.sh
├── tests/               disposable-repo smoke tests
└── template/            shared contract plus Claude Code and Codex adapters

Install

git clone https://github.com/addyosmani/factory.git
cd /path/to/your/repo
/path/to/factory/install.sh --dry-run .
/path/to/factory/install.sh .

Then read GETTING_STARTED.md. The installer never overwrites an existing file, so re-running it is safe.


What gets installed

Piece File Does
Charter docs/factory/CHARTER.md Human-owned tier, load-bearing paths, automatable work, definition of done, and stop conditions
Contract docs/factory/CONTRACT.md Harness-neutral queue protocol, policy, and durable-evidence rules
Gates .claude/scripts/gates.sh Types, lint, tests, build, audit, mutation, architecture. Three levels. Emits a verdict line no agent may paraphrase.
Live queue GitHub factory:* labels Visible state and handoff between independent runs
Concurrency claim deterministic claude/fq-<n> branch First non-forced push wins; later runs stop
Triage .claude/skills/factory-triage/ Issues → live labels plus a reviewable queue snapshot
Spec .claude/skills/factory-spec/ Four human-approved gates before any code exists
Implement .claude/skills/factory-implement/ One item, test first, gates green, independently verified, draft PR
Verifier .claude/agents/factory-verifier.md Reads the diff cold. Reverts the fix to prove the test fails. Rejects when uncertain.
Critic .claude/agents/factory-critic.md Adversarial second lens on load-bearing changes
Verify .claude/skills/factory-verify/ PR-level check, driven by a GitHub-triggered routine
Monitor .claude/skills/factory-monitor/ Weekly sweep that closes the loop by filing issues
Control room /factory What needs you, right now, review queue first
Tuning /factory-tune Monthly constraint review, proposes only
Merge guard .claude/hooks/block-merge.sh Blocks common shell merge paths; GitHub rules remain the enforcement boundary
Doctor .factory/scripts/doctor.sh Finds placeholders, missing labels, missing remotes, and setup gaps

The four ideas doing the work

1. Everything lives in the repo. Cloud sessions start from a fresh clone. Committed .claude/ reaches them; your ~/.claude/ does not. So one set of files drives terminal, Desktop, cloud, and routines with no config to keep in sync.

2. Autonomy tracks consequence, not difficulty. The charter's TIER sets how much freedom every routine gets. A ten-thousand-line migration on an unlaunched project is a safer bet than a fifty-line change to a client's auth path, and the config should say so.

3. The gate script is the verdict. gates.sh ends with a line skills must quote verbatim. A missing required gate is MISCONFIGURED with exit 2, so an absent test command cannot quietly become a green run.

4. The writer never grades the work. Implementation delegates to a separate verifier that reads the diff cold and is told to ignore any account of what was done. Its best check is one no gate can make: revert the fix and confirm the test actually fails.

The two constraints most people delete

Back-pressure is a number. STOP_IF in the charter caps how many items may sit awaiting review. When the queue is full, the implement routine refuses to start. The binding constraint on a factory is not how many agents can run, it is how many decisions are pending your judgment.

Merge is never automated, on any tier. Enforce this with a GitHub ruleset or branch protection. The committed Claude and Codex hooks catch common shell routes, but hooks are a guardrail rather than a complete security boundary.


Before you build on this

Read LIMITS.md. The headline:

LIMITS.md §7 also corrects the widely circulated build plan point by point. The load-bearing error in that plan is the issue trigger, because it is the first stage of the pipeline.

Validate the reference

The local suite creates disposable Git repositories and exercises installation, idempotency, fail-closed gates, deterministic claim races, merge guards, setup diagnosis, and negative-test restoration:

bash tests/run.sh

License

MIT © 2026 Addy Osmani.

Further reading

Start with Dex Horthy's software-factory playbook, "Harness Engineering Is Not Enough: Why Software Factories Fail". It makes the most important constraint concrete: generation scales more easily than human judgment, verification, and long-term comprehension.

This reference is intentionally smaller than the organization-scale designs above. In a personal portfolio, developer variability is not the binding constraint. One person's review attention is the entire quality apparatus, which argues for fewer moving parts, state owned by the repository, and a hard cap on pending decisions.

factory (addyosmani/factory)

Searching Database…

What is this?Factory is a reference operating model that turns an existing GitHub repository into a repeatable software delivery loop driven by Claude Code and Codex. It uses GitHub Issues as a work queue: scheduled agents triage issues, implement small permitted tasks, run tests and gates, get an independent review, and open draft pull requests for a human to merge.
Is this an app I run, or a set of files I install into my repo?It is an installer, not a running service: 'install.sh' adds policy files, skills, scripts, and GitHub labels into your target repository, and Claude Code cloud routines (or Codex) then supply the schedule and compute. There is no separate orchestrator process to host.
How do I get it running on my project?Clone this repository, then run 'install.sh' against the repository you want to automate, and open that target repo in your coding agent. The installer never overwrites existing files, so re-running it is safe.
Which coding agents does this work with?It is built around stock Claude Code, using CLAUDE.md, committed skills under '.claude/skills/', and Claude cloud routines for scheduling. A thin Codex adapter under '.agents/skills/' reads AGENTS.md and shares the same policy, queue, and gates, though Codex's automated schedule isn't provisioned by the repo.
Does it react to new GitHub issues right away?No — Claude routines only have native triggers for pull requests and releases, not newly created issues, so this reference polls for untriaged issues on an hourly schedule by default. You can add the optional GitHub Action for faster triage.
What is gates.sh?It is the deterministic check script covering types, lint, tests, build, audit, and architecture. It ends with a verdict line that skills must quote verbatim, and a missing required check fails closed as MISCONFIGURED rather than silently passing.
What happens when the human review queue is full?A STOPIF limit in the charter caps how many items may sit awaiting review at once. When that queue is full, the implement routine refuses to pick up new work, keeping back-pressure on pending human decisions rather than on agent concurrency.
How do I see what needs my attention?The '/factory' control room surfaces the human review queue first, backed by live GitHub issues, pull requests, and run records, so you always know what's waiting on a decision.
Why build this instead of letting Claude Code work unsupervised?The README frames Factory as the layer needed once you want agents acting on issues without someone watching every session: a committed charter, deterministic gates, and an independent verifier replace ad-hoc manual steering.
Creator
addyosmani
Size
0.1 MB
Stars
236
Updated
CommitAug 19
Age
1mo
Commits · 90 Days