▦ OpenSpec Software Factory ES

Method

The method, piece by piece

In 30 seconds. OpenSpec fixes what must be true; tasks turn it into small commits; gates and the reviewer demand evidence; the curator turns the trace into rules. If you prefer to see it running, start with the example.

Daily operation — docs, scripts, curator and optional wiki — lives in How it runs.

On this page
  1. The problem is not writing code
  2. Four parts, one factory
  3. Four loops, one direction
  4. Who does what
  5. Evidence decides, not the agent

The problem is not writing code

An agent's bottleneck is not how fast it writes. It is everything around it: what to read, what to decide, what to prove and what to fix afterwards.

Three symptoms

1. Context lives in the conversation

An agent remembers the stack, the decisions and the state while the session is open. Close it and it starts from zero. The next session rebuilds context by asking, or worse, invents it.

A long prompt is not context: it is a wish list nobody can verify.

2. The human becomes middleware

Pick the task, write the brief, review the output, decide whether to relaunch and when to stop. The agent writes, but the human holds the loop. That does not scale: the better the agent works, the faster the next decision reaches the queue.

3. The system does not compound

The same mistake repeats because nobody rewrites the rule that allowed it. The conversation where it was explained is gone; the document that forbade it was outdated; the test that should cover it proved something else.

What it costs

Why OpenSpec alone is not enough

OpenSpec solves the first half: it defines what must be true with proposals, requirements, scenarios and tasks. It is the contract.

It does not solve the second half: who executes it, with what evidence, and how the system that executes it gets corrected. That is what the factory adds.

LayerOpenSpecFactory
What must be true✅✅
Who executes it—Subagents with a brief
How it is proven—Gates and mutation
What was learned—Trace and curator
When to stop—Explicit stops

The factory does not replace OpenSpec: it executes it.

Four parts, one factory

The thesis is simple: an agent does not improve because of a better model, but because of a system around it that says what to read, what to produce, how to prove it, and what to fix afterwards.

Context specs · docs · state Agents brief · gates · commit Trace cost · verdict · cause Curator rule · commit the next pass starts with better rules

1. Shared context

The agent does not guess the stack, the decisions or the state. It reads them:

The rule is "one fact, one place". If a piece of data lives in two documents, one of them will eventually lie.

2. Agents with gates

Work is delegated with a closed brief: change, tasks, level, model, acceptance criterion and expected files. The subagent implements; it does not decide the plan. The level and block are written in tasks.md during planning; the coordinator reads them, it does not decide them.

Before committing, gates decide for it:

GateWhat it proves
BuildThe code compiles
Filtered testsWhat changed works
FormatNo noise in the diff
SpecThe scenarios are still valid
MutationThe test fails when it should fail

A red mutation is the only proof that a test proves something. It is always reverted with the inverse edit, and the tree is checked clean.

3. Trace

Every task leaves a line with agent, cost and result. Every review leaves verdict, model and cause, including an urgent fix with no OpenSpec change: in that case the trace lives only in the chore: registra revisión commit. And the commit stores the brief in trailers:

feat(notes): 1.2 create note returns 201

Brief-Cambio: notes
Brief-Tareas: 1.2
Brief-Nivel: NORMAL
Brief-Modelo: opencode/<intermediate-model>
Brief-Aceptacion: repeating creation with the same idempotency key returns 201 without duplicating the note

The trace is not a log: it is the raw material of the curator.

4. Curator

When a block or a change closes, the curator reads what happened and rewrites the system. The symptom is not patched; the rule that allowed it is fixed.

Without this part, the factory stays flat: it does the work, but it does not learn.

Principles

Four loops, one direction

The method is understood through its loops. Each has a cadence, an artifact and a gate. What changes between them is not the tool: it is the level of decision.

PROJECT · months state · decisions CHANGE · weeks specs · design · tasks BLOCK · days branch · PR TASK · hours brief → implement → gates → commit → review evidence: build · tests · mutation · format one run = one commit each level contains the next and no gate is skipped

Project

It lives in the state and the decision record. It is not updated on every task: it changes when the environment, an operational decision or a pending item changes. Its question is "where are we and what comes next?".

Change

It is a product unit with its own specification: proposal, requirements, design and tasks. It lives in the repository and is archived when closed. Its question is "what must be true and how do we prove it?".

Block

It is a deliverable phase. One branch, one worktree, several tasks and one PR. Its question is "what can be integrated together without breaking anything?". The block merge integrates into main; the deploy belongs to the lane, not to each block.

Task

It is the agent's unit of work. Its question is "what do I do now and how do I know it is right?". It is implemented in the block's worktree, reviewed by commit range, and leaves a trace.

Level and review

The task label decides the model and the batch size. It is not a preference: it is a policy.

LevelWhenExecutionReviewReview model
[HARD]data, concurrency, money or something hard to undo1 to 1per taskthe most capable available
NORMALa normal feature without special riskbatches of 1–3per blockintermediate model
[FAST]small, repetitive or visualbatches of 3–5per blockeconomical model

[HARD] does not authorize large tasks: it changes the review and the model, not the size. A task is split before starting if it meets two or more of: it touches more than 3 production files, mixes two independent flows, crosses more than one external system or has more than 5 separately verifiable scenarios.

Where the loop stops

Autonomy is not "never ask". It is knowing exactly when to stop:

Everything else keeps going. And every stop leaves a reason, so the curator can fix the cause.

Who does what

The method separates five responsibilities that a single agent mixes: coordinate, implement, review code, review specifications and curate the harness. The first three form the task loop; the other two run outside it. Each has its own context, model and limits.

The coordinator and the curator are the main session, not subagents: they are the only ones that can ask for permissions and talk to the user. The subagents are implementer, reviewer and openspec-reviewer.

The names implementer, reviewer and openspec-reviewer, and the /implementar and /revisar commands, are those of the OpenCode adapter for v0.1. The roles —coordinate, implement, review and curate— are part of the method; another harness would have to translate the names and commands. See the adapter.

Coordinator brief · order · gates Implementer code · tests · commit Gates build · test · format Reviewer evidence · verdict if there are findings, the delta goes back to the same implementer Rule the coordinator does not implement or review; the reviewer does not write production code

The spec reviewer and the curator do not appear in the task flow: the former is used before coding, when closing a change or when a specification changes; the latter when closing a block or change; --semana is optional.

Coordinator

Reads the plan, picks the ready task and transcribes the closed brief from tasks.md: change, tasks, block, level, model, acceptance criterion and expected files. It does not decide the level or the block. Launches the implementer, checks the gates and, when the block closes, pushes the branch and waits for CI. It does not touch code.

Implementer

Works in the block's worktree. Implements, writes the test, runs the gates and applies the task mutations set by the level —only if there is production logic— and reverts them; the block's manual mutation is run by the reviewer. Commits when everything is green. Marks the task and leaves the trace with agent, cost and result. It does not push. It does not decide the level, block or plan.

Reviewer

Reviews the commit range, not the uncommitted tree. Reads the requirements, checks the evidence, runs the minimum gates without duplicating the build and, only if there is production logic, runs the block mutation or verifies the [HARD] ones in a frozen copy. It issues a verdict. It does not write production code.

Its report includes a scenario → evidence → status matrix: every scenario in scope must have a test, a mutation or manual evidence. If the scenario or its requirement calls for delivering, sending or notifying, a test that only checks enqueueing does not count: the evidence must reach the delivery boundary. Every new integration point is validated with an omission mutation: remove the wiring and require a red test. A new DI registration is mutated by removing its startup line, and the red must come from a test that resolves the consumer from the real ServiceProvider, not from a harness that registers dependencies by hand.

Spec reviewer

Checks coherence between proposal, specs, design and tasks. It touches neither code nor tests: its output is a verdict on the contract. It is used before coding, when closing a change or when a specification changes.

Its report includes the scenario → task matrix: a scenario with no task and no cited delegated coverage (change, task and owner) is CRITICAL. The SHALL/MUST prevails over the scenario: if it calls for delivering, sending or notifying and no scenario reflects it, that is also CRITICAL.

The three moments

MomentCommandQuestionOutput
Before coding, spec change or closure/openspec-reviewIs the contract coherent?Verdict and scenario → task matrix
Task or block/revisarDoes the implementation meet the contract?Verdict and scenario → evidence matrix
Block or change closure; --semana optional/curarWhich harness rule should change?0–3 proposals for docs/harness.md

Curator

Not a subagent: the main session runs it with /curar. It turns the trace of a block or change, or the last 7 days with --semana, into 0–3 proposals for docs/harness.md. It does not review code, does not change rules without approval and does not run per task. Cadence: block or change close; --semana is optional.

Who assigns the level and the block

The block is the ## N. heading in tasks.md; the level is each task's label. Both are written during planning, normally with /opsx-propose and human review, not while coordinating.

The coordinator reads the requested block and copies the task level into the brief; it does not invent them. Without a label, the task is treated as NORMAL. If a task is too large, it is split before starting and the user approves it. A block is a deliverable phase: its branch and PR.

Models and permissions

Models per level

The task level decides the model and the batch size. Levels are not mixed: the highest one sets the model. The canonical table — when it applies, execution, review and model — lives in Level and review.

Permissions

A subagent cannot approve a confirmation: there is no user in its session. That is why what it may run is defined in advance. Irreversible actions are denied; routine ones are allowed; doubtful ones are escalated to the human in the coordinator.

Evidence decides, not the agent

An agent can say "it is done". The gates decide whether that is true. The rule is simple: no evidence, no commit.

TASK GATES test Build compiles Tests what changed works Format no noise Spec scenarios valid Mutation the test fails Mutation proves that the test proves something apply change production red test must fail revert inverse edit green test clean tree if it stays green, the test was not proving anything

The five gates

GateCommandWhat it proves
Buildcompile the projectThe code is coherent
Testsfilter the classes touchedWhat changed works
Formatverify without writingNo noise in the diff
Specvalidate the changeThe scenarios are still valid
Mutationbreak the test on purposeThe test proves something

Mutation

A test that always passes proves nothing. Mutation changes production code, runs the test and requires it to fail. Then it is reverted with the inverse edit, never with git checkout, and the tree is checked clean.

1. apply mutation
2. run the filter   → it must fail
3. revert with the inverse edit
4. git status --short → empty
5. final green pass

A commit cannot contain mutation markers or rely on a green pass from before the revert.

Task and block gates

CI

CI does not replace local gates: it confirms them in a clean environment. A red run nobody looks at is a false green; that is why every block or PR push waits for its result before moving on.

The wait is blocking: gh run watch <id> --exit-status on GitHub Actions, or the CI's equivalent command; do not poll with sleep.

The mutation gate is local and only applies to production logic: [HARD] mutates during the task and in the review; NORMAL/[FAST] once in the block review. Always on a frozen copy. A mutation sweep in CI, if one exists, is informational: it observes, it does not approve.

The table describes patterns from the reference implementation, not a contract: each project defines its workflows and paths. The template core is the documentation workflow and the secrets gate; PR and deployment gates are added per project.

WorkflowWhen
Backend / FrontPR touching that side
Docschanges to documentation and harness
Pre-deploypush to main: gates, pre deploy and smoke
Productionmanual, with explicit confirmation

The secrets gate always runs in CI: one that does not run protects nothing.

The stops

Gates do not decide everything. The loop stops when:

Every stop leaves a reason. Without a reason, there is no way to fix the cause.