Correctless

/cmodel — Formal Alloy Modeling

Translate spec invariants into a formal Alloy model and run the Alloy Analyzer to find design-level bugs before code is written.

When to Use

How It Fits in the Workflow

Runs after /cspec (spec phase) and before /creview-spec. The modeling phase sits between “what should the system do” and “is the spec actually correct.” Finds design bugs while they are still cheap to fix.

Requires high intensity or above.

What It Does

Example

You are building an auth token lifecycle feature. After writing the spec with /cspec, you run /cmodel.

The agent identifies two state machines (token lifecycle and session lifecycle) and one trust boundary (client-to-auth-server). It generates an Alloy model encoding rules like “a revoked token cannot transition back to active” (INV-007) and “a refresh token is invalidated after single use” (INV-012).

The Analyzer finds a counterexample for INV-012: a trace where two concurrent refresh requests both read the token as valid before either marks it consumed. The interpreter subagent translates this into a concrete scenario: “Client A and Client B both present the same refresh token within 5ms. Both receive new access tokens because the revocation check and token issuance are not atomic.”

You revise the spec to require atomic check-and-consume, then advance to /creview-spec.

What It Reads / Writes

Reads Writes
Spec artifact (.correctless/specs/{slug}.md) Alloy model (docs/models/{slug}.also)
ARCHITECTURE.md Analysis results (docs/models/{slug}-results.md)
.correctless/config/workflow-config.json Token log (.correctless/artifacts/token-log-{slug}.json)

Common Issues

Intensity Levels

This skill requires high intensity or above. At standard intensity, formal modeling is skipped entirely. Features go directly from /cspec to /creview (the single-pass review). If your feature involves state machines or trust boundaries and you are at standard intensity, consider increasing workflow intensity for this feature.

Limitations