← pstackCONTENT HISTORYWHAT CHANGED · RULE-BASED ANALYSIS
Update to pstack
Snapshot Sep 30, 2026 · 23:14 UTC · version 0.2.0
Collection source: not recorded for this historical snapshot.
First saved snapshot
No earlier snapshot is available to establish a change.
Compare saved observations
Download comparison JSONFull technical diff · 0 changed fields
Full snapshot data
{
"description": "Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs.",
"included_files": [],
"name": "principle-make-operations-idempotent",
"skill_md_contents": "---\nname: principle-make-operations-idempotent\ndescription: \"Apply when designing commands, lifecycle steps, or processing loops that run amid crashes, restarts, and retries. Converge to the same end state regardless of partial prior runs.\"\ndisable-model-invocation: true\n---\n\n# Make Operations Idempotent\n\nDesign operations so they converge to the correct state regardless of how many times they run or where they start from. Every state-mutating operation should answer: \"What happens if this runs twice? What happens if the previous run crashed halfway?\"\n\n**Why:** Commands, lifecycle operations, and processing loops run where crashes, restarts, and retries are normal. If partial state changes the next run's outcome, every restart becomes a debugging session.\n\n**The pattern:**\n- Convergent startup: scan for existing state, clean stale artifacts, adopt live sessions\n- Content-based cleanup: compare by content equivalence, not creation order\n- Self-healing locks: use PID-based stale lock detection\n- Idempotent scheduling: failed work respawns cleanly, fresh input regenerated after each cycle\n\n**The test:**\n1. What happens if this runs twice in a row?\n2. What happens if the previous run crashed at every possible point?\n3. Does re-execution converge to the same end state?\n\nIf any answer is \"it depends on what state was left behind,\" the operation needs a reconciliation step.\n"
}SHA-256 of public snapshot: 7b08b3ece492665f9c136624c4914532217e15df9efba5a78d5f02a4e2771670