Agent skill

Use Statem

by henryqin1997 in henryqin1997/statem

Manage long Claude Code work with statem state-machine runbooks.

Apache-2.0Auto-check passedDevOps & Cloud

Install Use Statem

skills CLI
$ npx skills add henryqin1997/statem --skill use-statem -a claude-code

Project install by default; add -g for ~/.claude/skills/.

GitHub CLI
$ gh skill install henryqin1997/statem use-statem --agent claude-code

Project scope by default; add --scope user for a personal install. Needs GitHub CLI 2.90.0 or later (public preview).

Manual copy
$ git clone --depth 1 https://github.com/henryqin1997/statem.git skills-src && mkdir -p .claude/skills && cp -r skills-src/integrations/claude/statem/skills/use-statem .claude/skills/use-statem && rm -rf skills-src

Use ~/.claude/skills/ instead of .claude/skills for a personal install. The folder must contain SKILL.md.

Claude Code skills documentation · loads skills from .claude/skills/

Facts

Skill name
use-statem
GitHub stars
1.3k
Token cost
~1.1k tokens
SKILL.md length
591 words
Files
1
Skills in repo
2
Repo updated
First seen
Licence
Apache-2.0

At a glance

Manage long Claude Code work with statem state-machine runbooks.

  • Works in 7 steps: Inspect or create a spec such as… → Run statem validate statem.yaml --json. → Start or resume with statem start… → …
  • Tasks need durable state
  • SKILL.md covers Operating Loop, Context Clear, Loop Compaction and Auto Loop Hook, plus 1 more section
  • Calls python3

What it does

Use Statem is an agent skill from henryqin1997/statem. Manage long Claude Code work with statem state-machine runbooks. Use when tasks need durable state, explicit transitions, redo loops, save/resume behavior, or cross-agent review.

Its SKILL.md is about 1.1k tokens, which your agent loads only when the skill is triggered. It is a single SKILL.md file with no bundled scripts.

It sits in DevOps & Cloud, covering Runbooks and postmortems. The repository describes itself as: CLI runbook for agent long run. The licence is Apache-2.0.

When your agent uses it

  • Tasks need durable state
  • Explicit transitions
  • Save/resume behavior
  • Cross-agent review

Example prompts

  • “/use-statem”

Requirements

  • Python 3
  • Pre-approved tools (allowed-tools): Bash(statem *), Bash(python3 -m statem *)

Workflow steps

7 steps, taken from the first numbered list in SKILL.md.

  1. Inspect or create a spec such as statem.yaml.
  2. Run statem validate statem.yaml --json.
  3. Start or resume with statem start statem.yaml --run-id --json.
  4. Before work, run statem cur --run-id --json.
  5. When a state is complete, run statem goto --run-id --json.
  6. Before pausing, run statem save --run-id --json.
  7. For handoff context, read recent history: statem history --run-id --tail 10 --json.

What it can do on your machine

Read from SKILL.md and the folder at commit 8c3309a. It shows what the files ask for, not the result of running them.

  • Tool permissions

    Pre-approves these tools, so the agent can use them without asking each time:

    • Bash(statem *)
    • Bash(python3 -m statem *)

    From allowed-tools in the SKILL.md frontmatter.

  • Runs code

    Shell commands in SKILL.md call:

    • python3

    From the folder's file list and the shell code blocks in SKILL.md.

  • Network

    No URLs in SKILL.md.

    From URLs in SKILL.md, links to its own repository left out.

  • Credentials

    Names no API keys, tokens, secrets or passwords.

    From names ending in _API_KEY, _TOKEN, _SECRET, _KEY or _PASSWORD in SKILL.md.

Context cost

Use Statem loads about 1.1k tokens when it runs. Until then it costs about 47 tokens; SKILL.md has 591 words of instructions outside code blocks.

Always · name and description, kept in context so the agent knows when to use it
~47
When it runs · the whole SKILL.md, loaded when a task matches
~1.1k

Estimates: characters ÷ 4, the usual rule of thumb; real counts depend on the model's tokenizer. Scripts and assets cost tokens only if the agent reads them.

Safety

Auto-check passed

The automated check found no risky patterns in SKILL.md.

Automated static check — not a guarantee. Review scripts before installing. It scans the text of SKILL.md for risky patterns (piping downloads into a shell, reading credential files, hidden Unicode, destructive commands); files beside SKILL.md are not scanned.

SKILL.md

The full file from henryqin1997/statem at commit 8c3309a, republished under its Apache-2.0 licence (© henryqin1997). 591 words, ~1,071 tokens.

Download SKILL.mdSave it as .claude/skills/use-statem/SKILL.md (or your agent's skills folder).
name
use-statem
description
Manage long Claude Code work with statem state-machine runbooks. Use when tasks need durable state, explicit transitions, redo loops, save/resume behavior, or cross-agent review.
allowed-tools
Bash(statem *), Bash(python3 -m statem *)
argument-hint
task-or-spec

Use Statem

Use statem as a state-aware runbook for long agent runs. It should guide the work and preserve progress without turning the session into a rigid workflow harness.

Operating Loop

  1. Inspect or create a spec such as statem.yaml.
  2. Run statem validate statem.yaml --json.
  3. Start or resume with statem start statem.yaml --run-id <id> --json.
  4. Before work, run statem cur --run-id <id> --json.
  5. When a state is complete, run statem goto <next> --run-id <id> --json.
  6. Before pausing, run statem save --run-id <id> --json.
  7. For handoff context, read recent history: statem history --run-id <id> --tail 10 --json.

If statem is not on PATH, use python3 -m statem from the repository that contains the Python package.

For dynamic servers, company machines, or disposable git checkouts, prefer a machine-local state directory. Set STATEM_STATE_DIR once, for example $HOME/.local/state/statem/<project>, so runtime state survives checkout replacement. After moving to a new checkout, run statem start <spec> --run-id <id> once to rebind the run to the current spec path.

Commit YAML runbooks with the repo. Do not commit runtime state; treat .statem/ or STATEM_STATE_DIR as local, copy-on-use execution data.

Context Clear

Avoid /clear in normal loops. It flushes the conversation, including any instructions that were supposed to run after it, and can lose useful intent that was not written to durable files. Prefer explicit transitions plus safe compaction. Before a hard clear, run statem prompt --run-id <id> and paste the generated prompt immediately after /clear. After a hard clear, recover from .statem with start, cur, and history instead of relying on previous chat context.

Loop Compaction

For cyclic runbooks, prefer an explicit session hygiene node after a full loop. When another cycle will continue and the context is noisy, run statem compact-prompt --run-id <id>, use the generated /compact instruction, then recover with statem cur and statem history --tail 10.

Agents may inspect the full graph with statem state; cur, next, and goto are for disciplined execution and attention anchoring, not for hiding the runbook.

Show full SKILL.md (258 more words)Show less

Auto Loop Hook

When the host supports a Stop hook, users may opt into auto-loop behavior with integrations/hooks/statem_stop_hook.py. The hook runs when the agent is about to hand control back to the user. If a statem run is active, the current node is not a terminal/handoff node, and there are outgoing transitions, it returns a continuation prompt that tells the agent to inspect statem cur and keep working from the current node.

Registration examples live in:

  • examples/hooks/README.md
  • examples/hooks/codex-stop-autoloop.hooks.json
  • examples/hooks/claude-stop-autoloop.settings.json

Merge the matching snippet into the host hook configuration and use an absolute script path if the hook is registered outside the statem repository.

Treat this as host-level glue. It must not advance state, run /clear, or hide the graph. The agent should still transition only with statem goto.

Spec Guidance

  • Put runtime data under .statem/; do not mix it into the spec.
  • Use in_hook for setup after entering a node.
  • Use before_transfer for checks/redos while still in the current node. It is a spec field, not a CLI command; statem goto runs it automatically.
  • Use out_hook to persist current-node progress before leaving.
  • Use edge hook as prepare-transfer work after out_hook and before entering the target. If a blocking edge hook fails, the pointer stays at the source so the agent can retry.
  • Use type: command for deterministic shell checks and hooks.
  • Use type: predicate for file checks instead of shell when possible.
  • Use type: llm_review to call Codex, Claude, or another reviewer command.
  • Treat blocked transitions as useful feedback: stay in the node, fix the issue, then retry.

© henryqin1997, Apache-2.0. Rendered from Markdown: HTML in the file is shown as text, images as links, and headings moved down two levels. Raw file

Files

Just SKILL.md in integrations/claude/statem/skills/use-statem of henryqin1997/statem.

Open the folder on GitHubat commit 8c3309a

Compare with similar skills

Use Statem next to the 5 skills that share the most tags, products or categories with it. Stars are the repository's; “used in” counts other GitHub owners with a copy.

Use Statem compared with similar skills
SkillStarsUsed inTokensAuto-checkLicenceRepo updated
Use Statem this skillhenryqin1997/statem1.3k—~1.1kAutomated safety check: PassApache-2.0
Trader Memory Coretradermonty/claude-trading-skills3k2 repos~4.3kAutomated safety check: PassMIT
Author Migrationnrwl/nx29k—~12kAutomated safety check: NotesMIT
Write Notes Like Deepseekczm15053/write-notes-like-deepseek497—~2kAutomated safety check: PassNone
OpenRig Upgrade Proceduremvschwarz/openrig6.2k—~2.9kAutomated safety check: PassApache-2.0
GreptimeDB Release RunbookGreptimeTeam/greptimedb6.7k—~1.4kAutomated safety check: PassApache-2.0

Similar skills

  • Trader Memory Core

    tradermonty/claude-trading-skills

    Track investment theses across their lifecycle — from screening idea to closed position with postmortem.

    3k GitHub starsUsed in 2 repos~4.3k tokens
    DevOps & CloudAuto-check passed
  • Author or scope a first-party Nx migration. An agent skill from nrwl/nx.

    29k GitHub stars~12k tokensUpdated today
    DevOps & CloudAuto-check: notes
  • Write Notes Like Deepseek

    czm15053/write-notes-like-deepseek

    A skill your agent uses when a change is non-trivial by DSH standards (behavior, architecture, cross-file contracts, process/tooling, testing strategy, or on-disk/wire/config formats), when choosing…

    497 GitHub stars~2k tokensUpdated 2 days ago
    DevOps & CloudAuto-check passed
  • OpenRig Upgrade Procedure

    mvschwarz/openrig

    Walks an agent through upgrading the OpenRig CLI and daemon one observed step at a time, keeping live seats alive and reconciling managed plugin files.

    6.2k GitHub stars~2.9k tokensUpdated today
    DevOps & CloudAuto-check passed
  • GreptimeDB Release Runbook

    GreptimeTeam/greptimedb

    Runbook for publishing a GreptimeDB version: pick the release branch, verify the Cargo version, then tag, create the GitHub release and open the docs note PR.

    6.7k GitHub stars~1.4k tokensUpdated today
    DevOps & CloudAuto-check passed
  • Make Trace

    AIScientists-Dev/Flowtrace

    Turn any source that describes how a kind of task gets done (a SKILL.md, a chat log, a runbook, plain prose) into a runnable Morph trace.

    485 GitHub stars~3.7k tokensUpdated 4 mo ago
    DevOps & CloudAuto-check passed

More from henryqin1997/statem

  • Statem

    henryqin1997/statem

    A skill your agent uses when a long coding or research task should be managed with statem state-machine runbooks, including creating specs, starting or resuming runs, checking current state…

    1.3k GitHub stars~1.2k tokensUpdated 1 mo ago
    Auto-check passed

Categories

Questions about Use Statem

What does Use Statem do?

Manage long Claude Code work with statem state-machine runbooks. Use Statem is an agent skill from henryqin1997/statem. Manage long Claude Code work with statem state-machine runbooks.

When should I use Use Statem?

Use Statem fits situations like: tasks need durable state; explicit transitions; save/resume behavior; cross-agent review.

How do I install Use Statem in Claude Code?

Run `npx skills add henryqin1997/statem --skill use-statem -a claude-code`. Or copy the skill folder (integrations/claude/statem/skills/use-statem in henryqin1997/statem) into .claude/skills/use-statem in your project. Claude Code loads it when a task matches its description.

How do I install Use Statem in Codex?

Run `npx skills add henryqin1997/statem --skill use-statem -a codex`. Or copy the skill folder (integrations/claude/statem/skills/use-statem in henryqin1997/statem) into .agents/skills/use-statem in your project. Codex loads it when a task matches its description.

Can I use Use Statem in Cursor, Gemini CLI or GitHub Copilot?

Cursor, Gemini CLI, GitHub Copilot and OpenCode also load SKILL.md folders. With the skills CLI, run `npx skills add henryqin1997/statem --skill use-statem -a cursor` (or -a gemini-cli, github-copilot or opencode for the others). To copy it by hand, put the folder in .cursor/skills/use-statem, .gemini/skills/use-statem, .github/skills/use-statem and .opencode/skills/use-statem in your project.

What does Use Statem need to run?

Going by SKILL.md and its folder, Use Statem needs the command-line tools its instructions call (python3). Our summary lists: Python 3. Its frontmatter pre-approves these tools: Bash(statem *), Bash(python3 -m statem *).

Does Use Statem access the network?

SKILL.md contains no URLs. Any network use would come from the scripts or tools the agent runs. This is read from the text; nothing was executed.

Is Use Statem safe to install?

Our automated static check of SKILL.md found no risky patterns, such as piping downloads into a shell, reading credential files or hidden Unicode. It is not a guarantee. Review the folder before installing.

What licence does Use Statem use?

Use Statem is published under the Apache-2.0 licence (the repository's licence). It allows redistribution, so the full SKILL.md is shown on this page.

How many tokens does Use Statem use?

About 1.1k tokens (SKILL.md is roughly 4.3k characters). Agents keep only the skill's name and description in context until a task matches; then they load SKILL.md in full.

What are the alternatives to Use Statem?

Skills that share tags, products or a category with Use Statem: Trader Memory Core (tradermonty/claude-trading-skills, 3k stars), Author Migration (nrwl/nx, 29k stars), Write Notes Like Deepseek (czm15053/write-notes-like-deepseek, 497 stars) and OpenRig Upgrade Procedure (mvschwarz/openrig, 6.2k stars). The comparison table on this page puts their stars, adoption, token cost, safety result and licence side by side.

Who maintains Use Statem?

henryqin1997 (a GitHub user) maintains it in henryqin1997/statem, which has 1,335 GitHub stars. The repository holds 2 skills in this directory. The repository was last updated on September 2, 2026.

Source: henryqin1997/statem on GitHub. Facts on this page come from the repository at the commit we read; the author's words are quoted as theirs.