Skip to content

For AI agents

analint is built for coding agents as first-class users: every command speaks JSON with a versioned schema, and the model is inspectable without reading source. There are two ways to give an agent that surface.

This page documents the repository's main branch. cache is available since 0.0.3; the other listed MCP operations are available since 0.0.2. The CLI reference covers terminal options, which are not identical to the MCP argument set.

The repository ships a portable Agent Skill at skills/analint/. A skill is a plain SKILL.md that teaches an agent when and how to use analint: the show → affects → what-if → apply → check loop, fail-closed verdict interpretation, and the DSL's semantic rules (effects are simultaneous facts, where to put Field/Invariant/Lifecycle, Scope/Param/presence, the loader contract). It carries no scripts — the CLI already owns execution.

SKILL.md is an open format read natively by Claude Code, Codex, and GitHub Copilot; Antigravity and other agents that scan a skills/ directory pick it up the same way.

Install — copy the skill into the agent's skills directory:

# Claude Code: project-local or global
cp -r skills/analint .claude/skills/analint
# or  ~/.claude/skills/analint

# Codex / Antigravity: into that agent's skills directory

The agent also needs analint on PATH:

pip install analint        # or: uv add analint

Then drive it in plain language — "use analint to check this spec before editing" — and the skill supplies the workflow.

MCP server (optional)

For clients that prefer typed tool discovery over a shell, the same core is exposed as an MCP server with five tools — check, show, affects, explore, trace:

pip install "analint[mcp]"   # then configure `analint-mcp` in the client

Use MCP when the client benefits from discoverable, typed operations or has no normal shell; otherwise the CLI plus the skill is the lighter path.

Configure a local stdio server in your client's MCP settings with executable analint-mcp and no arguments. The process must have access to the spec files and its required Python imports. The exact settings-file format belongs to the client. Paths are resolved on the machine running the server; use absolute paths when the client's working directory is uncertain.

Tool reference

0.1.0: every MCP tool request loads the current model sources in a fresh worker, so edits to entry points and imported modules are visible without restarting the server. Python class identities are shared within the request. The in-process loader still caches imports; use a fresh process for library calls that must observe edited source files.

All five tools return structured dictionaries. Optional arguments and defaults below match the server's tool definitions.

Tool Required arguments Optional arguments
check None path=".", what_if=null, max_states=null, slice=true, tlc=false, cache=false, compact=false, checks=null, scenario_ids=null, tags=null, tlc_timeout=null, explain_slice=false, explain_work=false
show None path=".", kind=null, name=null
affects target path="."
explore None path=".", query=null, what_if=null, include_graph=false, max_graph_states=null, observed_values=false, max_states=null
trace A property id in query for a useful request path=".", query="", what_if=null, slice=true, max_states=null, cache=false, tlc=false, tlc_timeout=null

check runs the full validation pipeline. max_states overrides every exploration budget and must be positive; slice=false corresponds to CLI --no-slice. tlc=true tries the supported TLC fallback for INCONCLUSIVE properties. MCP exposes no strict parameter; use the CLI when that policy is needed. 0.1.0: checks selects flow/query/invariant ids without removing system actions. scenario_ids/tags add filtered scenarios, and tlc_timeout bounds each TLC run. None selects the usual full check; an empty checks list or unknown/ambiguous ids return an analint.error/v1 usage error. Qualified ids (flow:ID, query:ID, invariant:ID) resolve collisions. See the selection contract, including dependency-related supporting proofs and the selected-scope JSON metadata. For explicit selections, model_findings contains unrelated diagnostics encountered during bounded exploration. These are outside the selected verdict. 0.3.0: sliced selections limit action exploration to selected checks and dependencies. Check selection.unassessed_actions for actions whose transition defects and fireability were outside coverage. Trace returns the same selection metadata. An unfiltered check covers the full model. For derived-model results, read model.relation for the deciding relation and model.attempts for proof graph counts. The optional slice describes exact exploration. Set explain_slice=true to include one dependency path per member of each ordinary native property slice in slice_dependencies. Set explain_work=true to identify shared native graphs, fresh BFS states, cache loads and TLC counts in exploration_work.

Since 0.0.7, use compact=true to receive counts and up to three examples per finding group. The report keeps each group's check context, severity and expected rejection marker. Use compact=false to retrieve every finding. See the compact JSON format.

show returns an overview without a kind, an id list with just a kind, and details with a kind/name pair. Detailed kinds are entity, event, invariant, query, action, lifecycle, flow, scenario and contract. affects accepts a field, entity/event name or action id.

Impact reports include Create initialization, RHS/payload expressions and implicit presence/terminal guards. Inspect action presence_reads and presence_writes or entity presence_read_by/presence_written_by for membership changes; ordinary field reports describe field values. See the impact contract for default initialization and static-read semantics.

Since 0.0.6, show(kind="query", name=ID) returns the query type, predicate/goal, declared budget and declarative roots without enumerating states. show(kind="action", name=FAMILY_ID) accepts an unexpanded family name from a Contract and returns kind: "action_family", parameters, where, the shared contract and concrete variant ids. Use a concrete id for bound action details. See the CLI inspection contract for fields and root inheritance. On released 0.0.5, use overview query ids and read declarations for their details; actions require concrete expanded ids.

A what-if file can import the entry through analint_spec, but objects owned by other package modules need their original imports, such as from oauth.protocol import tokens.

explore follows the whole model for canonical or query-specific roots. It returns a compact artifact by default. To request the graph, supply both include_graph=true and max_graph_states=N; the latter caps output, not exploration. Above that graph size, the response retains the summary and explains why graph is null. Read completeness separately. Set observed_values=true to receive actual values and counts per field and presence slot in the summary. An incomplete exploration labels the counts as lower bounds. Use max_states to override the search budget independently of the output limit.

trace accepts an invariant id as well as a query id, despite the argument's name. It follows the same slice and budget decisions as check. A property without a witness returns witness: null with an explanation. Invocation settings do not carry over between calls. 0.1.0: pass the same max_states, slice, cache, tlc and tlc_timeout to trace. Both tools share the selection/execution pipeline. A TLC-decided trace returns the parsed action_trace and explicitly reports unavailable state snapshots; native traces keep their state changes. See trace output.

For example, send these arguments to check:

{
  "path": "/absolute/path/to/ticket_spec",
  "max_states": 10000,
  "slice": true
}

Then inspect the witness by passing this to trace:

{
  "path": "/absolute/path/to/ticket_spec",
  "query": "can_archive"
}

Workflow and verdicts

  1. show the inventory, then inspect the relevant action or contract.
  2. Use affects before changing a field or transition.
  3. Test a proposed property through check(what_if=...) using the same packaged entity imports as the model.
  4. Apply the accepted change and list its behaviour on Spec or Contract.
  5. Run check again and read the overall verdict and per-property findings.

The check response uses analint.check/v1. Treat only verdict: "PASS" and passed: true as success; FAIL, INCONCLUSIVE and individual NOT_CHECKED results require interpretation. Scenarios passing does not establish canonical invariants. A retrieved trace is diagnostic evidence, not a substitute for the full report. See verification concepts.

CLI consumers must read the response, not just the process exit: trace exits zero when it successfully reports a FAIL or INCONCLUSIVE property. For check, an exhausted budget normally gives INCONCLUSIVE/exit 4; --strict promotes its warning to overall FAIL/exit 1 while retaining per-property INCONCLUSIVE status.

JSON schema identifiers

Response Schema
Validation report analint.check/v1
Validation report with grouped findings analint.check.compact/v1
Model inventory analint.overview/v1
Detailed object or id list analint.show/v1
Impact analysis analint.affects/v1
Exploration artifact analint.exploration/v1
Witness/counterexample analint.trace/v1
Operation error, where supported analint.error/v1

Classify findings by their code rather than message text, and skip findings marked "expected": true (the intended rejection in a passing Expect.FAIL scenario) when routing failures; see finding codes. Finding codes and expected rejection metadata are available since 0.0.6.

Inspect error fields as well as schemas. Some lookup errors retain the operation's schema. Invariant traces identify the property with invariant instead of query; clients should accept both forms.

Which to use

Layer Job
analint CLI / library the executable source of truth
Agent Skill teaches an agent when and how to use analint
MCP server typed, discoverable operations with structured results

The skill and the JSON schemas are versioned (analint.check/v1, analint.show/v1, analint.exploration/v1, …) so an agent can detect stale instructions. Validation is always mandatory: a skill is prompt text, not a typed guarantee.