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
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
- Time: waiting between steps, rereading, repeating instructions.
- Rework: the same task returns two or three times because the brief was not closed.
- Drift: code and specification separate without anyone noticing.
- Risk: an agent without limits on a machine with access to everything.
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.
| Layer | OpenSpec | Factory |
|---|---|---|
| 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.
1. Shared context
The agent does not guess the stack, the decisions or the state. It reads them:
- Specifications: what must be true, with verifiable scenarios.
- Repository contract: commands, limits, conventions and traps.
- Runbooks: how to deploy, how to verify and how to roll back.
- State: what is done, what is blocked and what comes next.
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:
| Gate | What it proves |
|---|---|
| Build | The code compiles |
| Filtered tests | What changed works |
| Format | No noise in the diff |
| Spec | The scenarios are still valid |
| Mutation | The 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.
- An incident becomes a row in the record: gap, decision, where it lives and commit.
- A rule repeated in two places is removed from one.
- A gate that detected nothing is reviewed: either it is unnecessary or it is mis-calibrated.
Without this part, the factory stays flat: it does the work, but it does not learn.
Principles
- One fact, one place. Duplication is trust debt.
- Text before code. A rule in markdown can be reviewed; a script hides decisions.
- Deterministic gates. What a command can prove, a model should not decide.
- The human at the gates. Scope, permissions, merge and production.
- Evidence wins. Without a build, a test or a capture, it is not done.
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
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.
| Level | When | Execution | Review | Review model |
|---|---|---|---|---|
[HARD] | data, concurrency, money or something hard to undo | 1 to 1 | per task | the most capable available |
| NORMAL | a normal feature without special risk | batches of 1–3 | per block | intermediate model |
[FAST] | small, repetitive or visual | batches of 3–5 | per block | economical 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:
- A maximum-criticality task, after its review.
- A third round of changes on the same task (the cap is three).
- A permission that needs the human.
- A finding that is not in the plan.
- A file colliding with another lane.
- A red CI that the retry does not fix.
- The end of the block: the PR.
- The lane close: the deploy and its verification.
- The context threshold, before the model loses the thread.
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,reviewerandopenspec-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.
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;
--semanais 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
| Moment | Command | Question | Output |
|---|---|---|---|
| Before coding, spec change or closure | /openspec-review | Is the contract coherent? | Verdict and scenario → task matrix |
| Task or block | /revisar | Does the implementation meet the contract? | Verdict and scenario → evidence matrix |
Block or change closure; --semana optional | /curar | Which 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.
The five gates
| Gate | Command | What it proves |
|---|---|---|
| Build | compile the project | The code is coherent |
| Tests | filter the classes touched | What changed works |
| Format | verify without writing | No noise in the diff |
| Spec | validate the change | The scenarios are still valid |
| Mutation | break the test on purpose | The 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
- During the task the filter for the classes touched runs. The full suite is too slow for every step.
- When closing the block the full suite runs, before the PR.
- The reviewer runs the minimum gates the copy needs, without repeating the build the test command already does, and adds the block mutation in NORMAL/
[FAST]—or verifies the[HARD]ones— in a frozen copy. If the scope does not touch production logic (docs, tests or verification), there is no mutation: diff, filter and 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.
| Workflow | When |
|---|---|
| Backend / Front | PR touching that side |
| Docs | changes to documentation and harness |
| Pre-deploy | push to main: gates, pre deploy and smoke |
| Production | manual, 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:
- A gate cannot run because of environment permissions.
- The test does not cover what the task claims.
- The mutation does not produce red.
- CI fails for a cause the retry does not fix.
Every stop leaves a reason. Without a reason, there is no way to fix the cause.