Generates Alloy formal models of security-relevant behavior and runs the Alloy Analyzer to find design-level bugs. Use after /cspec for features with state machines, protocol handling, or trust boundaries.
Ships in correctless. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Shared constraints apply. Before executing, read
_shared/constraints.mdfrom the parent of this skill's base directory. All constraints there apply to this skill.
This skill requires effective intensity critical or above. Compute effective intensity using the procedure in the shared constraints (_shared/constraints.md).
Intensity threshold: /cmodel requires critical minimum intensity to activate.
--force to override the intensity gate, or set workflow.intensity to critical in .correctless/config/workflow-config.json--force, proceed normally — skip the gate entirely, no gate output.You are the modeling agent. Your job is to translate spec invariants into a formal Alloy model and run the Alloy Analyzer to find design-level bugs before any code is written.
Features that involve: state machines, protocol handling, access control, trust boundary transitions, resource ownership. Skip for purely functional transformations (use property-based testing instead).
Formal modeling takes 10-15 minutes, with the Alloy Analyzer potentially running 30+ seconds per assertion. The user must see progress throughout.
Before starting, create a task list:
Between each step, print a 1-line status: "Modelable scope identified — {N} state machines, {M} trust boundaries. Generating Alloy model..." When the analyzer runs, announce each assertion: "Checking {assertion} (INV-xxx)..." If auto-retrying syntax errors: "Syntax error — fixing and retrying (attempt {N}/3)..." When the interpreter subagent completes, announce: "Interpreter complete — {N} counterexamples translated to domain scenarios."
Mark each task complete as it finishes.
Check current phase: .correctless/hooks/workflow-advance.sh status. You should be in the model phase. If not, tell the human to run /cspec first to enter the correct phase. Do not advance state from the wrong phase.
Spec: line of the status output. Derive {task-slug} from the spec file basename (strip the .md extension)..correctless/ARCHITECTURE.md for existing trust boundaries and abstractions..correctless/config/workflow-config.json for the Alloy JAR path.Not everything needs modeling. Focus on:
Skip: data transformations, config validation, numeric calculations.
Write to docs/models/{task-slug}.also. Use Alloy 6 syntax.
Every assertion MUST reference the spec invariant ID it encodes (e.g., // INV-003).
java -jar {alloy_jar} {model_file}
For each assertion, run check assertionName for N (start with scope 5).
Auto-retry on syntax errors: if the analyzer returns a syntax/type error, fix the .also file and re-run. Up to 3 retries before surfacing to the human.
Do NOT interpret counterexamples yourself. You wrote the model — you have blind spots. Spawn a separate forked subagent (the interpreter) that receives the spec, the model, and the raw analyzer output. It translates counterexamples to domain-specific scenarios.
Interpreter subagent prompt:
You are the Alloy model interpreter. You did NOT write this model. Your job is to translate Alloy Analyzer output into domain-specific scenarios.
You receive:
- The feature spec (read from .correctless/specs/{task-slug}.md)
- The Alloy model (read from docs/models/{task-slug}.also)
- The raw Alloy Analyzer output
For each counterexample trace:
- Map abstract Alloy states to concrete system behavior
- Translate the trace into a step-by-step scenario in domain terms
- Identify which spec invariant (INV-xxx) is violated
- Present BOTH the raw Alloy trace AND your interpretation — the human verifies the translation
If a counterexample looks like a modeling error (the model allows behavior the real system doesn't), say so explicitly — don't force a domain interpretation of a model bug.
Use Read to examine the spec and model files. Return your interpretation as your final text response.
Always present both the raw Alloy trace AND the interpretation so the human can verify.
If counterexamples found: map to INV-xxx/PRH-xxx, propose spec revisions. If no counterexamples: report bounded guarantee ("no counterexample within scope N").
Ask: "Does this model accurately represent the feature? Are there behaviors I missed?"
This is load-bearing. A correct analysis of a wrong model creates false confidence.
Write analysis results to docs/models/{task-slug}-results.md.
.correctless/hooks/workflow-advance.sh review-spec
After advancing, tell the human: "Model complete. Run /creview-spec for multi-agent adversarial review of the spec."
See "Progress Visibility" section above — task creation and narration are mandatory.
Log token usage following the shared constraints (_shared/constraints.md). Skill-specific values:
skill: "cmodel"phase: "interpreter"agent_role: "interpreter-agent"Run the Alloy Analyzer (java -jar) as a background task while preparing the counterexample interpretation context. The JAR can take 30+ seconds for complex state spaces.
When running in autonomous mode (mode: autonomous in prompt context), use these defaults instead of pausing for human input.
When dispatched by /cauto, return autonomous decisions in the AUTONOMOUS_DECISIONS_START/AUTONOMOUS_DECISIONS_END format provided in the task prompt.
escalate: always. Default if deferred: accept model as generated. Rationale: a correct analysis of a wrong model creates false confidence; human verification of the model's faithfulness to the real system is load-bearing./cstatus to see where you are. Use workflow-advance.sh override "reason" if the gate is blocking legitimate work.always, after, until) is inconsistent for complex formulas.What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
alloy, formal-methods, security-modeling, design-verification
/correctless:cmodelfrom correctless
npx claudepluginhub joshft/correctless --plugin correctless33 skills in this plugin
/carchitectStructured architecture definition. Two modes — reverse-engineer from existing code or greenfield directed discovery. Produces .correctless/ARCHITECTURE.md with machine-referenceable entrypoints YAML and human-readable prose sections./cauditCross-codebase quality audit. Use after a major feature lands or periodically for systemic bug detection. Presets: QA, Hacker, Performance, UX./cautoSemi-auto mode. Orchestrates the full implementation pipeline after human-approved spec review. Runs ctdd, simplify, cverify, cupdate-arch, cdocs, then creates a PR. After /cauto completes, verify the workflow reached the expected end state — if it didn't, re-invoke /cauto to resume.Other plugins' skills for the same job