Skip to content

feat(architecture): add map-states, state diagrams with reachability findings #4650

Description

@kyle-sexton

Part of #4639. Parked: last in the epic's build order and optional.

Problem

Workflow and lifecycle state machines are usually documented in a diagram that was accurate once. The
transitions live in code, as a status enum plus the guards that move between its values, and the
diagram stops matching the code almost immediately. No skill derives the diagram from the code.
plugins/architecture/skills/ on main has no map-states.

Evidence

Verified this pass (main a6ba321): the skill does not exist, and no existing issue covers
state-machine extraction.

Inferred: extraction quality depends on how explicit the transitions are. A state-machine library's
transition table can be extracted with high confidence. Status assignments scattered through the code
cannot. The item itself called this the lowest-priority, optional skill in the family.

Proposed approach

/architecture:map-states [entity|workflow]

It extracts:

  • states: enum members, smart-enum instances, or a declared state type
  • transitions: from a library's transition table, or otherwise from guarded status assignments
  • guards and triggers
  • initial and terminal states

It draws one entity per diagram, and produces a findings list:

  • unreachable states
  • dead-end states (reachable, not terminal, with no way out)
  • missing guards
  • transitions that skip the expected path

Where transitions cannot be extracted reliably, the skill says so and stops.

Before building: confirm a consumer codebase with explicit state machines exists to justify it, and
choose the first library to support.

Files:

  • new plugins/architecture/skills/map-states/{SKILL.md,scripts,evals}
  • plugin.json, CHANGELOG.md, README.md

Acceptance criteria

  • Against a fixture using an explicit state-machine library, the diagram matches the declared
    transition table.
  • Unreachable and dead-end states in a fixture are reported.
  • A fixture with only ad hoc status assignments produces a low-confidence label or an explicit
    refusal, never an unlabeled diagram.
  • The artifact states its extraction confidence.

Constraints and gotchas

  • A plausible state diagram that is subtly wrong is worse than none, because people will trust it.
  • Out of scope: runtime state analytics, orchestration across services (map-flow, map-events), and
    business-rule extraction in general.
  • Follow .claude/rules/skill-bodies-state-current-rules.md, keep the description under 1024
    codepoints, and bump the version and add a CHANGELOG entry.

Context

Source: local handoff item 20260907-094206-map-states-skill-proposal.md (retired into this issue).
Parent epic: #4639.

Activity

  1. added
    needs-owner-decision
    wayfind: design
    on Sep 27, 2026
  2. added
    needs-human
    on Sep 29, 2026
  3. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Reopened for an owner decision. This issue was closed as completed by #5158, but its own precondition was never confirmed and the epic had parked it. This comes from the 2026-09-29 audit of the Cursor run.

    Decision packet

    Question: does map-states stay, and in what form?

    Facts

    • This issue says: "Before building: confirm a consumer codebase with explicit state machines exists ... and choose the first library." Neither was done.
    • Epic feat(architecture): add map-* skills below the landscape rung (epic) #4639 lists map-states as parked and says "Drop any that does not earn its place." The owner's dialect decision comment on feat(architecture): add map-* skills below the landscape rung (epic) #4639 did not decide it.
    • The agent shipped both an XState createMachine grammar and a Stateless Configure/Permit grammar in feat(architecture): land the map-* skills below the landscape #5158.
    • The audit found that confidence was always high although extraction silently dropped Stateless content (collect-states.sh:293), and that every Stateless terminal state was reported as a dead end, with a test fixture encoding that false positive (collect-states.sh:168).
    • Evidence gathered during planning: a search for new StateMachine< and createMachine( across the 16 local checkouts under ~/repos/github.com found no consumer outside this plugin's own fixtures. That covers local checkouts only, on 2026-09-29.

    Options

    • A. Keep both grammars.
    • B. Trim to one library. The owner names which one, ideally the one a known consumer uses.
    • C. Keep it, marked experimental, until a consumer exists.
    • D. Retire it: remove the skill, its collector, and its entries in the README, catalog, cheat sheet and marketplace tags.

    RECOMMENDED (not a decision): D, or B if the owner can name a consumer codebase. Basis: this issue's precondition is unmet, the epic's drop rule applies, and the local search found no consumer.

    What #5392 does meanwhile: T17 makes the existing skill fail closed on Stateless features it cannot draw, computes confidence instead of hard-coding it, and marks a terminal state terminal_inferred instead of dead_end. That makes the skill safe while it exists. It does not pre-empt any option, and the skill is not removed.

    What the decision unblocks: a retirement or trimming PR (D or B), a marker change (C), or closing this issue as accepted (A).

  4. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-09-29): Option D. Retire map-states.

    Basis given to the owner: this issue's own precondition (a consumer codebase with explicit state machines, and a chosen first library) was never met; epic #4639 parks map-states and says to drop any skill that does not earn its place; a search of the owner's local checkouts found no createMachine( or new StateMachine< use outside this plugin's fixtures.

    Work: one PR that removes plugins/architecture/skills/map-states/ (skill, collector, tests, evals) and every reference to it: the architecture README, the catalog and cheat sheet, marketplace tags, and any sibling skill that routes to it. Bump the architecture plugin version and add a CHANGELOG entry that states the removal. That PR closes this issue.

  5. added
    agent-ready
    and removed
    needs-owner-decision
    needs-human
    on Sep 30, 2026
  6. added a commit that references this issue on Sep 30, 2026
    b0f045b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-readywayfind: design

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions