agent-state-machine

agent-state-machine is a skill for Claude Code, Codex from aka-kika/akakika-skills. It costs 46 tokens per session (1,603 once invoked), scanned A, original, MIT.

A fixed set of states and allowed changes for AI-agent tasks, background jobs, local model runs, queues, and notifications. It defines states such as queued, running, waiting, failed, cancelled, and completed, along with recovery paths.

In plain words
What is it for?
Use it to design task status displays, retry and stop behaviour, queue handling, notifications, and recovery flows for agent or background work.
Why use it?
It prevents different parts of an application from inventing conflicting status labels or leaving failed tasks without a way forward.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one. Also seen: mentions Claude Code; mentions Codex.

Good fit Use it to design task status displays, retry and stop behaviour, queue handling, notifications, and recovery flows for agent or background work.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/aka-kika/akakika-skills/agent-state-machine
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Any agent
npx skills add aka-kika/akakika-skills --skill agent-state-machine
Clone the repo
git clone --depth 1 https://github.com/aka-kika/akakika-skills

Made for: Claude Code, Codex.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for agent-state-machine

README.md
[![agentmods](https://agentmods.dev/badge/skills/aka-kika/akakika-skills/agent-state-machine/github.svg)](https://agentmods.dev/skills/aka-kika/akakika-skills/agent-state-machine)
Your own site
<a href="https://agentmods.dev/skills/aka-kika/akakika-skills/agent-state-machine"><img src="https://agentmods.dev/badge/skills/aka-kika/akakika-skills/agent-state-machine/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for agent-state-machine

Your own site · 80×15
<a href="https://agentmods.dev/skills/aka-kika/akakika-skills/agent-state-machine"><img src="https://agentmods.dev/badge/skills/aka-kika/akakika-skills/agent-state-machine.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 46 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 1,603 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe. Third-party audits
  • NVIDIA SkillSpector pass 7 Sept 2026
How audits are shown
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5.1 $0.00046 $0.01603
Opus 5 $0.00023 $0.00801
Sonnet 5 $0.00009 $0.00321
Haiku 4.5 $0.00005 $0.00160

Measured 12d ago against content hash a32053706dc9, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-11, from the pricing page.

Security

Grade A, and why

agent-state-machine scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 12d ago.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

skills/ai-agents/agent-state-machine/SKILL.md · 303 lines

How it starts

The opening of the file, as written. The whole thing — 303 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Agent State Machine

Model every agent / task / run with one shared state machine: a fixed set of states, only the transitions that are legal between them, and a recovery path out of every failure or wait. This kills the most common agent-UX bug — random status strings invented per screen.

When to use

  • Active runs, task queues, AI generation, local model jobs
  • Agent progress, notifications, error recovery
  • Retry / stop / cancel behavior and "needs review" states

Core rule

Agent UX needs clear states, legal transitions, and recovery paths. Do not invent random labels per screen.

State vocabulary

Draft
Queued
Starting
Thinking
Running
Waiting
Blocked
Paused
Cancelling
Cancelled
Failed
Completed
Needs Review
Archived

State meanings

Draft        Created but not ready to run
Queued       Ready and waiting
Starting     Preparing environment/model/files
Thinking     Planning/reasoning before action
Running      Executing work
Waiting      Waiting for external service/user/system
Blocked      Cannot continue without user action
Paused       Temporarily stopped, can resume
Cancelling   Stop requested, cleanup in progress
Cancelled    Stopped by user/system
Failed       Ended with error
Completed    Finished successfully
Needs Review User should inspect result
Archived     Hidden from active workflow
Draft → Queued
Queued → Starting
Starting → Thinking
Thinking → Running
Running → Waiting
Waiting → Running
Running → Needs Review
Running → Completed
Running → Failed
Running → Blocked
Running → Cancelling
Cancelling → Cancelled
Failed → Queued
Blocked → Queued
Needs Review → Archived
Completed → Archived
Paused → Running

Avoid impossible transitions unless explicitly handled.

Reference implementation

Swift shown below, but the pattern is language-agnostic — one enum, one validator.

enum AgentRunState: String, Codable, CaseIterable, Hashable {
    case draft
    case queued
    case starting
    case thinking
    case running
    case waiting
    case blocked
    case paused
    case cancelling
    case cancelled
    case failed
    case completed
    case needsReview
    case archived

    var title: String {
        switch self {
        case .draft: "Draft"
        case .queued: "Queued"
        case .starting: "Starting"
        case .thinking: "Thinking"
        case .running: "Running"
        case .waiting: "Waiting"
        case .blocked: "Blocked"
        case .paused: "Paused"
        case .cancelling: "Cancelling"
        case .cancelled: "Cancelled"
        case .failed: "Failed"
        case .completed: "Completed"
        case .needsReview: "Needs Review"
        case .archived: "Archived"
        }
    }

    var symbol: String {
        switch self {
        case .draft: "doc"
        case .queued: "list.bullet.rectangle"
        case .starting: "play.circle"
        case .thinking: "brain"
        case .running: "bolt.circle"
        case .waiting: "clock"
        case .blocked: "xmark.octagon"
        case .paused: "pause.circle"
        case .cancelling: "xmark.circle"
        case .cancelled: "xmark.circle"
        case .failed: "exclamationmark.triangle"
        case .completed: "checkmark.circle"
        case .needsReview: "checkmark.seal"
        case .archived: "archivebox"
        }
    }
}

Read the full file on GitHub · 303 lines

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 12d ago First seen · 303 lines · 46 tokens per session scan A a32053706dc9

Subscribe to this mod's changes

agent-state-machine is a skill published in the GitHub repository aka-kika/akakika-skills (10 stars, last pushed 2d ago), licensed MIT. It adds 46 tokens to every session and 1,603 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

apple-design

Cross-platform UI/UX design reviewer grounded in Apple's Human Interface Guidelines (122 pages pulled from developer.apple.com, including 57 component pages) plus a design-craft lens for distinctive, non-templated work. Use it to audit, review, critique, or improve any mobile app (iOS, Flutter, React Native) or…

dickwu/apple-design-skill · 194 tokens

data-charts-tako

Search and visualize the world's data - get charts, insights, and embeddable knowledge cards for finance, economics, demographics, sports, and more.

gooseworks-ai/goose-skills · 35 tokens

monorepo-management

Master monorepo management with Turborepo, Nx, and pnpm workspaces to build efficient, scalable multi-package repositories with optimized builds and dependency management. Use when setting up monorepos, optimizing builds, or managing shared dependencies.

wshobson/agents · 54 tokens

browse-and-evaluate

Use when exploring the ai-agent-skills catalog to find, compare, and evaluate skills before installing. Always use --fields to limit output size and --dry-run before committing to an install.

MoizIbnYousaf/Ai-Agent-Skills · 43 tokens

render-airdrop-carousel

Assemble a viral iOS "AirDrop" notification-carousel video ad (≈6–8s, 9:16) from a brand line plus 6–16 real product photos — a native AirDrop share-sheet card ("Brand would like to share a · Decline / Accept") springs up and its preview window CYCLES through the products, landing on a range/lineup payoff with an…

gooseworks-ai/goose-skills · 207 tokens

render-3d-product-showcase

Assemble a premium 3D product-showcase ad from a config — four beat clips (an orbiting hero rotation, a macro push-in, a physics reveal, a typographic close) normalized to the brand-color canvas, hard-concatenated in order, closed on a deterministic Playwright brand end card, and mixed under one instrumental bed at…

gooseworks-ai/goose-skills · 159 tokens