state-machines
Skill2 starsChanged 5 months agoApache-2.0View on GitHub
Transition RunState and PhaseState only through the explicit functions in src/domain/state.ts — never mutate state-bearing fields directly.
3 other projects use a version of this.
Adopted by
Most recently taken up by
- waynesutton/convexskillstheir own version, first seen Nov 15, 2026
- waynesutton/builder-skillstheir own version, first seen Nov 15, 2026
- 2867203296/hermes-agenttheir own version, first seen Aug 19, 2026
Other versions3 projects use a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 3
- waynesutton/builder-skills★ 404same name
- waynesutton/convexskills★ 404same name
- 2867203296/hermes-agent★ 0same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- CLAUDE.mdCLAUDE.md
- boundariesSkill
- cli-view-layerSkill
- effect-servicesSkill
- find-docsSkill
- infrastructure-adaptersSkill
- model-routingSkill
- observabilitySkill
- phax-cliSkill
- phax-decide-planSkill
- phax-decide-reviewSkill
- phax-decide-specSkill
- phax-planningSkill
- phax-reviewSkill
- phax-specSkill
- validation-boundariesSkill
The file
Files
State machines
The rule
RunState and PhaseState transitions must go through the explicit
transition functions in src/domain/state.ts. Direct assignment or mutation
of state-bearing fields outside that module is a violation.
State shapes
// src/domain/state.ts
type RunState =
| "created"
| "running"
| "failed"
| "review_open"
| "completed"
| "stopped"
| "archived"
| "interrupted";
type PhaseState =
| "pending"
| "setting_up_worktree"
| "running"
| "gates_failed"
| "fixing"
| "failed"
| "passed"
| "committed"
| "cleaning_up"
| "cleaned_up"
| "review_open"
| "handoff_failed"
| "skipped";Transition functions
Each transition function takes the current state and returns
Result.Result<NewState, InvalidTransitionError>. Call-sites must handle the
Failure (invalid transition) case.
import { startRun, failRun, openRunReview } from "../domain/state.js";
import { Result } from "effect";
const next = startRun(currentState);
if (Result.isFailure(next)) {
// surface InvalidTransitionError — never silently swallow it
}Why
Direct string assignment bypasses the transition guard. This means illegal
state sequences (e.g., archived → running) become possible, which corrupts
registry.json and run-status.json in ways that are hard to detect.
The Result-returning pattern forces callers to handle illegal transitions
explicitly rather than producing silent corrupt state.
How to fix a violation
- Find the direct state field assignment (e.g.,
status.runState = "running"). - Replace with the appropriate transition function from
src/domain/state.ts. - Handle the
Failurecase and surface theInvalidTransitionError.
Audit rule
PHAX_STATE_001 — direct assignment to a state-bearing type field detected
outside domain/state.ts.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

