state-check
Purpose
This skill checks for common state inconsistencies: workflows listed in active-workflows.md without matching directories, directories without matching table entries, lifecycle state mismatches between dossiers and directory locations, stale handoffs, and empty run-logs. Run it after completing a workflow, at session start, or whenever state feels uncertain.
Preconditions
- The
.agents/directory exists with the standard structure.
Required Reads
.agents/state/active-workflows.md[required] -- coordination index..agents/state/current-focus.md[required] -- project focus.- All
dossier.mdfiles in workflow lifecycle directories. - All
handoff.mdfiles in active workflow directories. - All
run-log.mdfiles in active workflow directories.
Procedure
- Parse active-workflows.md. Extract every workflow ID, its listed state, and its listed owner.
- Scan lifecycle directories. For each lifecycle directory (
active/,blocked/,suspended/,done/,failed/,draft/,abandoned/), list the workflow subdirectories present. - Cross-reference table vs. directories.
- For every workflow in the table: verify a corresponding directory exists in the lifecycle directory matching the table's state column. Flag mismatches.
- For every workflow directory found: verify it has a corresponding row in the table. Flag orphan directories.
- Check dossier lifecycle state. For each workflow directory with a
dossier.md, read theLifecycle Statemetadata and verify it matches the directory location. Flag mismatches. - Check current-focus.md references. Verify that any workflow IDs mentioned in
current-focus.mdcorrespond to existing workflows. Flag dangling references. - Check handoff freshness. For each active workflow, check if
handoff.mdexists and has content beyond the template. Warn if a workflow has been active for more than one session buthandoff.mdis still a template placeholder. - Check run-log content. For each active workflow, check if
run-log.mdhas any entries beyond the template. Warn if a workflow has been active but the run-log is empty. - Report results. Output a summary:
State Check Results:
Consistent: <count> workflows
Inconsistencies found:
- <workflow-id>: <description of inconsistency>
- ...
Warnings:
- <workflow-id>: handoff.md is stale / run-log.md is empty
- ...
No inconsistencies found. (if clean)
Output
Results are delivered as a direct response to the user, not written to a file.
Completion Criteria
- All lifecycle directories have been scanned.
- All table entries have been cross-referenced against directories.
- All dossier lifecycle states have been checked.
current-focus.mdreferences have been validated.- Handoff and run-log freshness has been checked for active workflows.
- A clear summary has been delivered.
Error Handling
- If
active-workflows.mddoes not exist, report: "No active-workflows.md found. Cannot perform state check." - If a lifecycle directory does not exist, skip it and note: "Directory .agents/workflows/<state>/ does not exist."
- If a dossier is missing from a workflow directory, flag it: "<workflow-id>: missing dossier.md."