README.md

Software Factory

A small, agent-driven way to do software work in any repository. Define a task, let an orchestrator take it through build and independent review, and keep a journal of how it went. That journal feeds back here, so the factory improves from real use rather than from guesses.

Iteration 1: deliberately minimal. Features are added only when feedback from real use shows a need. The earlier fully specified design lives on the archive/v0 branch for reference.

Principles

  1. Small first. Each task is the smallest change worth reviewing.
  2. Evidence over claims. Work isn't done until its verification has been run and shown.
  3. Independent review. The reviewer runs in a fresh context, on the other agent (Codex or Claude Code) when the session can start it, and sees only the task, the diff, and the evidence.
  4. Learn from use. Friction goes into the journal, and the journal goes into feedback reports.

How it works

The workflows in skills/ and the roles in agents/ are shared by every supported agent: Claude Code runs them as a plugin, and Codex runs a copy added to the project. The diagram uses Claude's command spelling; in Codex the same workflows are $factory-define, $factory-deliver and so on. Both agents use one task catalog, so you can switch between them per task.

/factory:define ──► $FACTORY_ROOT/tasks/DEV-NNN-*.md  (draft → ready)
                          │
/factory:deliver ─► orchestrator
                      ├─ builder agent    builds and verifies on factory/DEV-NNN-* branch
                      ├─ gate             re-checks evidence, decides: back to build or on to review
                      ├─ reviewer agent   fresh context: approve, or send findings back
                      └─ STR run          runs the steps in a sandboxed app, takes screenshots
                          │
                          ▼
                     status: done + PR with STR and screenshots + journal entry

/factory:design define ─► design definition reviewer ─► your definition approval
                          │
/factory:design deliver ► designer → artifact checks → final human visual approval

/factory:tasks ────► catalog, priorities, blockers, PR state and next-task suggestion
/factory:settle ───► tasks whose PR was merged → done; alerts on the rest (unattended)
/factory:journal ──► $FACTORY_ROOT/journal.md       (any time; `review` checks the session)
/factory:feedback ─► unreported journal entries ──► feedback issue on this repo (unattended)
Piece Kind Role
define skill Turns an idea into a small task file with checkable acceptance criteria.
deliver skill (orchestrator) Runs builder → gate → reviewer → STR run in a sandboxed app, loops on gaps and findings, opens the PR, escalates to you when stuck.
builder agent Implements the task and reports verification evidence.
reviewer agent Independent, read-only review against the task.
design skill (orchestrator) Defines and delivers design tasks, separate from code delivery.
designer agent Produces design artifacts and actionable human-review handoffs.
design-reviewer agent Independently reviews design task definitions, not final visuals.
tasks skill Shows all tasks, priorities, statuses and blockers; suggests eligible work without starting it.
migrate skill Previews and applies approved release migrations through a target version, in order.
journal skill Appends to the project's engineering journal. review lists corrections from the current session as optional entries.
feedback skill Turns unreported journal entries and recent tasks into a report without asking questions, posts it here as a feedback issue, and marks the entries reported. Suits a weekly automation.

The orchestrators are skills rather than agents because they run in your main session. Code uses define and deliver, with the builder and code reviewer. Design uses design define and design deliver, with its own definition reviewer and designer. Each track loads its own procedures and template; the development orchestrator does not load design execution rules.

Parallel design and development tracks

Ask /factory:design define <idea> for a design task (kind: design). The design reviewer first reviews the task definition in a fresh context, then you approve it for execution. /factory:design deliver <id> produces designs through the designer in Figma when access is usable, or a mocked in-app prototype on a design/DSGN-NNN-* branch using the existing design system. Storybook is optional.

The agent leaves exact artifact locations, revision, access/run instructions and a review walkthrough. The task stays reviewing until the named human explicitly approves that visual/UI revision; agent checks cannot replace this approval. See the design track.

Both tracks share a catalog, atomic ID reservations and journaling, not execution rules. New code IDs are DEV-NNN, design IDs are DSGN-NNN, with independent counters across linked worktrees. Always use the full ID; matching suffixes do not identify the same task. Tasks from before 0.5.0 are renumbered once by the release migration (003 becomes DEV-003 or DSGN-003) and keep the old number in legacy_id. Code tasks without a design dependency proceed independently; use separate worktrees for concurrent work. When implementation needs a design, define a separate code task linked to the approved artifact revision and human decision. Implementation starts from the production baseline and connects to the real system; the throwaway prototype is a reference, not a production merge candidate.

Confirm each task's priority during definition: urgent, high, normal or low. Automatic delivery chooses the highest-priority eligible ready task in its track, with a deterministic full-ID tie-break; approvals and dependencies still gate execution. New follow-ups prompt reassessment, not automatic interruption or reprioritization. /factory:tasks shows a snapshot across both tracks, including active work, blockers, PR state and incomplete metadata. It never starts work or silently fills missing priorities. When a task's PR was merged while the task wasn't done, for example after a reopen, /factory:tasks and delivery first run /factory:settle, which marks it done when nothing would be lost and lists the rest under Needs attention. See task review and selection for examples and verification scenarios.

For a step-by-step example, see Using the design workflow. To bring existing records forward, run /factory:migrate 0.6.1 for a sandbox rehearsal, preview and approval flow, or /factory:migrate check 0.6.1 for a read-only report. See Updating the plugin and existing tasks for the ordered release instructions. The former migrate-tasks command is removed.

Install in a project

Requires Claude Code and a project that is a Git repository, either local-only or with a remote. Git keeps the history of changes and holds the task catalog. In a folder without one, the factory offers to initialize it and make a base commit after you approve the contents; see project repository. In the project, run:

/plugin marketplace add je3yk/software-factory
/plugin install factory@software-factory

Choose the project scope when asked if you want the factory enabled only for that repository. Restart Claude Code, then run /factory:define <your idea>.

Codex

To use the same factory from Codex, run /factory:codex in Claude Code, or run the script directly from a factory checkout:

node /path/to/software-factory/scripts/codex.mjs install /path/to/product

This copies the factory into .agents/factory/ and adds $factory-* skills in .agents/skills/. Commit those files and restart Codex. Task records and the journal are not part of the copy. See Using factory with Codex.

Shared project records

The factory keeps records outside product branches, in the shared Git directory. From a product checkout, resolve the catalog with:

FACTORY_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)" || exit 1
FACTORY_ROOT="$FACTORY_COMMON_DIR/factory"

For a normal checkout this is .git/factory/; linked worktrees resolve the same catalog, not their own .git file:

$FACTORY_ROOT/
  tasks/      one markdown file per task
  designs/    handoffs, screenshots and design-only evidence
  journal.md  engineering journal
  task-ids/   shared atomic ID reservations
  settings.md local-only or remote, integration branch, standing baseline decisions and known noise

Do not commit factory records or task-status changes. Defining/approving a task leaves the product tree clean, and delivery branches contain only product changes. Figma-only design tasks need no Git branch; runnable prototypes still use design/DSGN-NNN-* branches.

Durable project knowledge stays with the code: use docs/factory/ for factory-relevant project documentation and .agents/skills/<name>/SKILL.md for reusable project agent skills. Update these in the implementation tasks that introduce the documented behavior, not in separate status commits.

Backup limitation: the catalog is local and unversioned. Git push/clone does not preserve it; agree an external backup/export destination at first use and export before deleting the repository. Linked worktrees share records; independent clones need explicit transfer and a single write/allocation coordinator. See storage and migration for concurrency, backup and safe migration of existing .factory/ records. No existing project is moved automatically by installing this update.

To update, refresh the marketplace and update the installed plugin, then restart Claude Code. If the project uses Codex, run /factory:codex again and commit the refreshed copy. See Updating the plugin and existing tasks for commands, version checks, and task migration.

Improving the factory

For maintenance of this repository itself, ask the agent to use the repository-local work-issue skill with an issue number or URL. This small entry point loads only the current stage skill: intake, solution definition, version-scoped migration authoring with its template when needed, implementation and independent review, PR delivery, or closure. Each stage owns its detailed procedure and can add its own scripts, templates, and references as needed. Human solution approval is required before implementation on a new dedicated branch; human PR approval and separate merge authorization are required before merging. The issue closes only after the complete solution is merged. These skills are internal repository tooling, not shipped /factory: commands or replacements for define/deliver in projects using the plugin.

The internal skills live in .agents/skills/, which Codex reads. Claude Code only discovers .claude/skills/, so that folder holds generated stubs that keep each skill's frontmatter and point to the shared file. After adding, renaming or removing a skill, or changing its frontmatter, run node scripts/claude-skills.mjs sync; node scripts/claude-skills.mjs check and the tests fail while the stubs are stale. Body-only edits need no resync.

  1. In a project, run /factory:feedback every week or two, or after a handful of tasks. It never asks questions, so a scheduled session can run it; that session needs a signed-in gh and permission to write the factory catalog. Run /factory:journal review at the end of a session to capture corrections first.
  2. Reports arrive here as issues labelled feedback. They are reports, not work items: each lists numbered points and questions.
  3. Answer the issue's questions and comment a decision per point (P1: accept, P2: reject: <reason>, P3: defer, P4: duplicate of #12). Only comments from collaborators with write access count as decisions. Change only what came up for real, preferably more than once.
  4. Ask the agent to use the repository-local triage-feedback skill on the issue. It creates enhancement issues for accepted points, links them, and closes the feedback issue. Work on those issues with work-issue.
  5. Bump the version in .claude-plugin/plugin.json, note it in CHANGELOG.md, and close the issues it addresses.

Develop

The read-only factory field guide in apps/docs/ renders the workflow graph and repository Markdown as an Astro static site. It keeps shipped plugin workflows separate from repository-only maintenance. See its README for local development, verification, and GitHub Pages setup.

claude plugin validate .
claude --plugin-dir .   # try local changes without installing
node --test tests/*.test.mjs

The tests in tests/ run the Codex setup and Claude skill-stub scripts against temporary repositories; they do not touch your Codex or Claude configuration.

Original Markdown, including metadata
# Software Factory

A small, agent-driven way to do software work in any repository. Define a task, let an orchestrator take it through build and independent review, and keep a journal of how it went. That journal feeds back here, so the factory improves from real use rather than from guesses.

> **Iteration 1: deliberately minimal.** Features are added only when feedback from real use shows a need. The earlier fully specified design lives on the [`archive/v0`](https://github.com/je3yk/software-factory/tree/archive/v0) branch for reference.

## Principles

1. **Small first.** Each task is the smallest change worth reviewing.
2. **Evidence over claims.** Work isn't done until its verification has been run and shown.
3. **Independent review.** The reviewer runs in a fresh context, on the other agent (Codex or Claude Code) when the session can start it, and sees only the task, the diff, and the evidence.
4. **Learn from use.** Friction goes into the journal, and the journal goes into feedback reports.

## How it works

The workflows in `skills/` and the roles in `agents/` are shared by every supported agent: [Claude Code](docs/adapters/claude-code.md) runs them as a plugin, and [Codex](docs/adapters/codex.md) runs a copy added to the project. The diagram uses Claude's command spelling; in Codex the same workflows are `$factory-define`, `$factory-deliver` and so on. Both agents use one task catalog, so you can switch between them per task.

```text
/factory:define ──► $FACTORY_ROOT/tasks/DEV-NNN-*.md  (draft → ready)
                          │
/factory:deliver ─► orchestrator
                      ├─ builder agent    builds and verifies on factory/DEV-NNN-* branch
                      ├─ gate             re-checks evidence, decides: back to build or on to review
                      ├─ reviewer agent   fresh context: approve, or send findings back
                      └─ STR run          runs the steps in a sandboxed app, takes screenshots
                          │
                          ▼
                     status: done + PR with STR and screenshots + journal entry

/factory:design define ─► design definition reviewer ─► your definition approval
                          │
/factory:design deliver ► designer → artifact checks → final human visual approval

/factory:tasks ────► catalog, priorities, blockers, PR state and next-task suggestion
/factory:settle ───► tasks whose PR was merged → done; alerts on the rest (unattended)
/factory:journal ──► $FACTORY_ROOT/journal.md       (any time; `review` checks the session)
/factory:feedback ─► unreported journal entries ──► feedback issue on this repo (unattended)
```

| Piece | Kind | Role |
| --- | --- | --- |
| `define` | skill | Turns an idea into a small task file with checkable acceptance criteria. |
| `deliver` | skill (orchestrator) | Runs builder → gate → reviewer → STR run in a sandboxed app, loops on gaps and findings, opens the PR, escalates to you when stuck. |
| `builder` | agent | Implements the task and reports verification evidence. |
| `reviewer` | agent | Independent, read-only review against the task. |
| `design` | skill (orchestrator) | Defines and delivers design tasks, separate from code delivery. |
| `designer` | agent | Produces design artifacts and actionable human-review handoffs. |
| `design-reviewer` | agent | Independently reviews design task definitions, not final visuals. |
| `tasks` | skill | Shows all tasks, priorities, statuses and blockers; suggests eligible work without starting it. |
| `migrate` | skill | Previews and applies approved release migrations through a target version, in order. |
| `journal` | skill | Appends to the project's engineering journal. `review` lists corrections from the current session as optional entries. |
| `feedback` | skill | Turns unreported journal entries and recent tasks into a report without asking questions, posts it here as a `feedback` issue, and marks the entries reported. Suits a weekly automation. |

The orchestrators are skills rather than agents because they run in your main session. Code uses `define` and `deliver`, with the builder and code reviewer. Design uses `design define` and `design deliver`, with its own definition reviewer and designer. Each track loads its own procedures and template; the development orchestrator does not load design execution rules.

## Parallel design and development tracks

Ask `/factory:design define <idea>` for a design task (`kind: design`). The design reviewer first reviews the task definition in a fresh context, then you approve it for execution. `/factory:design deliver <id>` produces designs through the designer in Figma when access is usable, or a mocked in-app prototype on a `design/DSGN-NNN-*` branch using the existing design system. Storybook is optional.

The agent leaves exact artifact locations, revision, access/run instructions and a review walkthrough. The task stays `reviewing` until the named human explicitly approves that visual/UI revision; agent checks cannot replace this approval. See the [design track](skills/design/SKILL.md).

Both tracks share a catalog, atomic ID reservations and journaling, not execution rules. New code IDs are `DEV-NNN`, design IDs are `DSGN-NNN`, with independent counters across linked worktrees. Always use the full ID; matching suffixes do not identify the same task. Tasks from before 0.5.0 are renumbered once by the release migration (`003` becomes `DEV-003` or `DSGN-003`) and keep the old number in `legacy_id`. Code tasks without a design dependency proceed independently; use separate worktrees for concurrent work. When implementation needs a design, define a separate code task linked to the approved artifact revision and human decision. Implementation starts from the production baseline and connects to the real system; the throwaway prototype is a reference, not a production merge candidate.

Confirm each task's priority during definition: `urgent`, `high`, `normal` or `low`. Automatic delivery chooses the highest-priority eligible ready task in its track, with a deterministic full-ID tie-break; approvals and dependencies still gate execution. New follow-ups prompt reassessment, not automatic interruption or reprioritization. `/factory:tasks` shows a snapshot across both tracks, including active work, blockers, PR state and incomplete metadata. It never starts work or silently fills missing priorities. When a task's PR was merged while the task wasn't `done`, for example after a reopen, `/factory:tasks` and delivery first run `/factory:settle`, which marks it `done` when nothing would be lost and lists the rest under **Needs attention**. See [task review and selection](docs/task-workflow.md) for examples and verification scenarios.

For a step-by-step example, see [Using the design workflow](docs/design-workflow.md). To bring existing records forward, run `/factory:migrate 0.6.1` for a sandbox rehearsal, preview and approval flow, or `/factory:migrate check 0.6.1` for a read-only report. See [Updating the plugin and existing tasks](docs/updating.md) for the ordered release instructions. The former `migrate-tasks` command is removed.

## Install in a project

Requires [Claude Code](https://claude.com/claude-code) and a project that is a Git repository, either local-only or with a remote. Git keeps the history of changes and holds the task catalog. In a folder without one, the factory offers to initialize it and make a base commit after you approve the contents; see [project repository](skills/repository.md). In the project, run:

```text
/plugin marketplace add je3yk/software-factory
/plugin install factory@software-factory
```

Choose the **project** scope when asked if you want the factory enabled only for that repository. Restart Claude Code, then run `/factory:define <your idea>`.

### Codex

To use the same factory from [Codex](https://developers.openai.com/codex/cli/), run `/factory:codex` in Claude Code, or run the script directly from a factory checkout:

```sh
node /path/to/software-factory/scripts/codex.mjs install /path/to/product
```

This copies the factory into `.agents/factory/` and adds `$factory-*` skills in `.agents/skills/`. Commit those files and restart Codex. Task records and the journal are not part of the copy. See [Using factory with Codex](docs/adapters/codex.md).

### Shared project records

The factory keeps records **outside product branches**, in the shared Git directory. From a product checkout, resolve the catalog with:

```sh
FACTORY_COMMON_DIR="$(git rev-parse --path-format=absolute --git-common-dir)" || exit 1
FACTORY_ROOT="$FACTORY_COMMON_DIR/factory"
```

For a normal checkout this is `.git/factory/`; linked worktrees resolve the same catalog, not their own `.git` file:

```text
$FACTORY_ROOT/
  tasks/      one markdown file per task
  designs/    handoffs, screenshots and design-only evidence
  journal.md  engineering journal
  task-ids/   shared atomic ID reservations
  settings.md local-only or remote, integration branch, standing baseline decisions and known noise
```

Do **not** commit factory records or task-status changes. Defining/approving a task leaves the product tree clean, and delivery branches contain only product changes. Figma-only design tasks need no Git branch; runnable prototypes still use `design/DSGN-NNN-*` branches.

Durable project knowledge stays with the code: use `docs/factory/` for factory-relevant project documentation and `.agents/skills/<name>/SKILL.md` for reusable project agent skills. Update these in the implementation tasks that introduce the documented behavior, not in separate status commits.

**Backup limitation:** the catalog is local and unversioned. Git push/clone does not preserve it; agree an external backup/export destination at first use and export before deleting the repository. Linked worktrees share records; independent clones need explicit transfer and a single write/allocation coordinator. See [storage and migration](skills/storage.md) for concurrency, backup and safe migration of existing `.factory/` records. No existing project is moved automatically by installing this update.

To update, refresh the marketplace and update the installed plugin, then restart Claude Code. If the project uses Codex, run `/factory:codex` again and commit the refreshed copy. See [Updating the plugin and existing tasks](docs/updating.md) for commands, version checks, and task migration.

## Improving the factory

For maintenance of this repository itself, ask the agent to use the repository-local [work-issue skill](.agents/skills/work-issue/SKILL.md) with an issue number or URL. This small entry point loads only the current stage skill: intake, solution definition, [version-scoped migration authoring](.agents/skills/work-issue-migrations/SKILL.md) with its template when needed, implementation and independent review, PR delivery, or closure. Each stage owns its detailed procedure and can add its own scripts, templates, and references as needed. Human solution approval is required before implementation on a new dedicated branch; human PR approval and separate merge authorization are required before merging. The issue closes only after the complete solution is merged. These skills are internal repository tooling, not shipped `/factory:` commands or replacements for `define`/`deliver` in projects using the plugin.

The internal skills live in `.agents/skills/`, which Codex reads. Claude Code only discovers `.claude/skills/`, so that folder holds generated stubs that keep each skill's frontmatter and point to the shared file. After adding, renaming or removing a skill, or changing its frontmatter, run `node scripts/claude-skills.mjs sync`; `node scripts/claude-skills.mjs check` and the tests fail while the stubs are stale. Body-only edits need no resync.

1. In a project, run `/factory:feedback` every week or two, or after a handful of tasks. It never asks questions, so a scheduled session can run it; that session needs a signed-in `gh` and permission to write the factory catalog. Run `/factory:journal review` at the end of a session to capture corrections first.
2. Reports arrive here as issues labelled [`feedback`](https://github.com/je3yk/software-factory/issues?q=label%3Afeedback). They are reports, not work items: each lists numbered points and questions.
3. Answer the issue's questions and comment a decision per point (`P1: accept`, `P2: reject: <reason>`, `P3: defer`, `P4: duplicate of #12`). Only comments from collaborators with write access count as decisions. Change only what came up for real, preferably more than once.
4. Ask the agent to use the repository-local [triage-feedback skill](.agents/skills/triage-feedback/SKILL.md) on the issue. It creates `enhancement` issues for accepted points, links them, and closes the feedback issue. Work on those issues with work-issue.
5. Bump the version in `.claude-plugin/plugin.json`, note it in [CHANGELOG.md](CHANGELOG.md), and close the issues it addresses.

## Develop

The read-only [factory field guide](apps/docs/README.md) in `apps/docs/` renders the workflow graph and repository Markdown as an Astro static site. It keeps shipped plugin workflows separate from repository-only maintenance. See its README for local development, verification, and GitHub Pages setup.

```sh
claude plugin validate .
claude --plugin-dir .   # try local changes without installing
node --test tests/*.test.mjs
```

The tests in `tests/` run the Codex setup and Claude skill-stub scripts against temporary repositories; they do not touch your Codex or Claude configuration.