Skip to content
Agent Orchestration
MCP

statewright

Ships with statewright: Agents are suggestions, states are laws. Your workflows, in the harness you choose. Statewright defines tools, checks, and transitions for each phase of agent work. Use it with…

From plugin
statewright
5102 skills1 agent1 MCP

Claude Code

> /plugin marketplace add statewright/statewright
> /plugin install statewright@statewright

Security report

Info

Not enough data

  • Known flaws

    Not published

  • Signed build

    Not published

  • Maintained

    Nov 15, 2026

    Last push

  • Licence

    Not published

  • Runs as

    Remote

    mcp.statewright.ai

  • Deprecated

    Not published

Signals from public registries, not an audit. Checked Nov 20, 2026.

statewright README

statewright

Agents are suggestions, states are laws.

Your workflows, in the harness you choose. Statewright defines tools, checks, and transitions for each phase of agent work. Use it with Claude Code, Codex, Cursor, OpenCode, Pi, or OMX, or connect a custom MCP host. Tool enforcement and model routing depend on the integration. Full docs →

Plugin releases: Claude 0.3.8 and Codex 0.3.8. See the Claude notes and Codex notes. Changes on a development branch are not necessarily included in those packages.

Statewright workflow editor

0.4.0 release notes. Codex notes · Claude notes.

The problem

An agent with the same tools throughout a task can edit during review or deploy before checks finish. A workflow needs a way to make those boundaries explicit and, where the host supports it, enforce them before a tool runs.

The approach

Define the tools and checks each phase needs. Planning can allow reading, implementation can enable edits, and testing can permit designated commands. On intercepted tool paths, the integration rejects calls outside the current phase and explains which tools and transitions are available. Managed shell checks also screen writes and destructive operations when edits are disallowed.

State machines support retries, loops, and approval gates. You can keep your selected model throughout a workflow or configure phase-specific routes on supported clients. The research results below report a small local-model experiment, not a general model-size requirement.

Quickstart

Claude Code

/plugin marketplace add statewright/statewright
/plugin install statewright@statewright

Codex

codex plugin marketplace add statewright/statewright
codex plugin add statewright@statewright

OpenCode

Use the OpenCode setup guide to load the native plugin through the shared executor.

Cursor

Choose Cursor Agent through the executor or standalone IDE mode. The IDE's MCP/rules mode is advisory; the Agent integration adds native tool hooks.

Also available: Pi, OMX, and custom MCP connections. The install guide covers every adapter and its connection requirements.

In Claude Code 2.1.295 or newer, run the plugin commands at Claude's prompt, then open the Arbiter's connection status and choose Connect. Claude manages its native OAuth login. In Codex, restart after installation and ask for statewright_connect; approve the matching device code in your browser. Neither flow requires pasting a key into the conversation. Other hosts have their own connection instructions.

Existing Claude manual-hook installs must complete the migration before starting a workflow; updating the plugin does not remove old settings hooks.

Desktop guides: Claude Code → Local uses the ordinary Claude app; ChatGPT with Codex uses the macOS ChatGPT + Statewright launcher. Ordinary cloud chats are a separate integration and cannot enforce model routing.

For ChatGPT web and other remote MCP hosts, see the web workflow guide. Web guidance and visible transition receipts do not provide the native plugins' hooks or model routing.

Start with agentic-engineering (alias engineering) for a fix, small feature, refactor or investigation. This illustrative sequence shows the normal change path; actual states, events and tools come from the selected workflow:

❯ Use the engineering workflow to fix the failing tests in calc.py

◆ statewright — statewright_load_workflow (name: agentic-engineering)
◆ [statewright] Workflow activated: agentic-engineering

◆ statewright — statewright_get_state (MCP)

◆ diagnose → baseline: understand the failure and record a focused plan

  Read the relevant code; reproduce the failing test

◆ implement: make the smallest coherent change

  Edit calc.py and add regression coverage

◆ validate → review: check the result and look for missed cases

  Run the focused checks; record results and limitations

◆ handoff → complete: summarize the outcome and what was verified
◆ [statewright] Workflow complete.

In Claude, /statewright opens the sidebar: choose a workflow, then Start workflow. Selection alone does not start a run.

The starter uses your selected model, supports evidence-backed no-change outcomes, and allows one repair round before stopping with a useful handoff. It does not automatically commit or deploy. See the starter workflow guide for boundaries and upgrades.

Research results

In the reported experiment, two local models completed 2 of 10 attempts without Statewright constraints and 10 of 10 with them, using the same tasks and hardware. This covered a 5-task SWE-bench subset, not the full 2294-instance benchmark.

ModelSizeBug Fix (26 lines)SWE-bench (5 tasks)
gemma33.3GBFAILFAIL
gemma4:e2b7.2GBPASS*FAIL
gpt-oss:20b13.8GBPASSPASS (5/5)
gemma4:31b19.9GBPASSPASS (5/5)
llama3.342.5GBPASSPASS (2/2)†

*with specialized edit_line tool adaptation †tested on 2 of the 5 tasks (added after initial experiment run)

In this sample, the two models completing all five tasks were 13.8GB and 19.9GB; the smaller tested models did not complete that subset. These observations do not establish a minimum model size or isolate why a model failed. Outcomes depend on the tested tasks, model, tools, and configuration. Research brief →

How it works

Architecture

Three layers, each independently useful:

  1. Engine (crates/engine) — Pure Rust state machine evaluator. States, transitions, guards, tool restrictions. Deterministic. No LLM in the loop. No runtime dependencies.

  2. Agent binary (crates/cli, binary: sw-agent) — Direct-to-Ollama agent executor. Loads a workflow, runs the LLM in a constrained loop, enforces tool access, and streams structured JSONL events. Supports per-state model routing via --config, and single-state execution via --state (the TUI or MCP gateway orchestrates, sw-agent executes one state at a time and exits).

  3. Executor and plugin layer (plugins/executor + crates/mcp-gateway + plugins/) — One executor owns the workflow session, credentials, isolated delivery, telemetry, and host lifecycle. Thin host adapters translate native tool hooks and model-routing controls for Pi, Claude Code, OpenCode, Cursor, and OMX. Codex uses the same delivery core through its app-server adapter. The statewright_run_agent MCP tool remains available for states that benefit from direct Ollama execution.

The TUI (crates/tui, binary: statewright) is a ratatui terminal interface that spawns sw-agent as a subprocess and renders its JSONL event stream in real time. It handles keyboard input, demo mode, and fixture selection.

Per-state model routing

States can specify a model; meta.default_model applies where no state override is present. This is optional: the default engineering starter retains your selected model. The native Claude 0.3.8 plugin routes subsequent main-conversation requests without restarting the app. Codex's managed App Server adapter routes turns. Pi and OpenCode switch live, Cursor's executor resumes the same chat, and OMX applies its route at startup. Requested settings are not execution receipts: use the response's observed model when available.

This configuration excerpt illustrates Haiku for diagnosis, Opus for a proposed fix, and Sonnet as the default. It omits transitions and other required workflow fields; use the complete starter or authoring guide for a runnable definition. It is not a measurement of token use or savings.

{
  "meta": { "default_model": "claude-sonnet-4-20250514" },
  "states": {
    "diagnose": {
      "model": "claude-haiku-4-5-20251001",
      "allowed_tools": ["Read", "Bash"]
    },
    "propose_fix": {
      "model": "anthropic/claude-opus-4-6",
      "allowed_tools": ["Read"]
    },
    "execute": {
      "allowed_tools": ["Read", "Edit", "Bash"]
    }
  }
}

Here, diagnose requests Haiku, propose_fix requests Opus, and execute inherits the default_model (Sonnet). The sw-agent binary also accepts a --config file with a model_routing block for per-state Ollama URL, temperature, and context window overrides.

Guardrails

GuardrailWhat it does
Per-state tool enforcementRejects tools outside allowed_tools on the integration's intercepted paths
Bash discernmentBlocks echo > file, rm -rf, sed -i, and scripting interpreters (python, node) when Write/Edit aren't allowed. Even if Bash itself is permitted.
Edit guardsRejects diffs exceeding max_edit_lines, caps files edited per state
Command allow-listsOnly prefix-matched commands run (e.g. pytest, cargo test)
Conditional transitionsProgrammatic guards on context data: test_result eq pass, coverage gt 80
Approval gatesrequires_approval pauses for human review

Approval routing

Mark a transition with requires_approval: true to park it for review. The gateway defaults to local UI routing and stores the pending approval (including its approval_message) in the session state cache. Managed Codex and Claude clients keep the workflow parked until the gate is resolved.

An approval transition may include a statewright/evidence-packet/v1 manifest with a concise summary, checklist, and project-relative artifacts. The managed client hashes and uploads those files through the bound approval, then opens an authenticated review page. Reviewers can inspect the packet from a browser or mobile device without receiving the agent's turn history. Evidence retention is plan-controlled, and path escape, unsupported files, or digest mismatch fail closed.

Set meta.approval_mode to "external" when an out-of-band reviewer owns the decision. In that mode clients leave the pending approval to that channel and do not present a local prompt. Statewright does not currently ship a Telegram, Slack, or Discord dispatcher; an external integration must resolve the pending approval through the gateway callback/API.

Codex and Claude Code refresh their cached workflow state after a transition. Codex presents an authorized native decision dialog and links the review page. Claude's native sidebar exposes Review this step for a pending gate. Native host permissions and Statewright review decisions remain separate. An external approval mode leaves the decision to the configured integration.

Additional workflow controls:

GuardrailWhat it does
@statewright
Ships withstatewright
5102 skills1 agent1 MCP
Get the whole plugin

Stars on GitHub

Momentum

stars in total
510
Star history of statewright/statewright on GitHub, a chart by star-history.com

More MCP servers from other plugins.

orca-component-fixtures

orca-component-fixture…

MCP

Ships with orca: Orca lets you run a fleet of coding agents (e.g. Claude Code, Codex) with your own subscription. Available on…

orca5d124k
@stablyai@stablyaiInstall MCP
paperclip

paperclip

MCP

Ships with paperclip: Open-source orchestration for teams of AI agents. If OpenClaw is an employee, Paperclip is the company.…

paperclip6d113k
@paperclipai@paperclipaiInstall MCP
ruflo

ruflo

MCP

Ships with claude-flow: 📖 RuFlo Explained — Build an AI Team That Plans, Remembers, Tests, and Improves A 14-chapter guide: from…

@ruvnet@ruvnetInstall MCP
t

t

MCP

Ships with oh-my-claudecode: For Codex users: Check out oh-my-codex — the same orchestration experience for OpenAI Codex CLI.…

Questions about statewright.

Which coding agents can use statewright?
statewright works in any agent that reads an MCP config file: Claude Code, Codex, Cursor, Gemini CLI, GitHub Copilot, OpenCode and Windsurf. Each agent reads it from its own file; this page names the file for each one.
How do I add statewright to Claude Code?
Run these in order, one at a time. 1. In Claude Code: /plugin marketplace add statewright/statewright 2. In Claude Code: /plugin install statewright@statewright