irreversible-action-gate
Skill19 starsChanged 5 months agoMITView on GitHub
Gate agent tool calls by reversibility BEFORE execution: classify each action REVERSIBLE / SEMI_REVERSIBLE / IRREVERSIBLE from its declared properties (side-effect scope, idempotency, destructiveness, compensating action), prescribe the matching delivery contract (idempotency key, retry policy, dry-run-first, human approval, compensation registration), check deterministic preconditions against graph facts, and analyze multi-step plans as sagas with an explicit point of no return. Use whenever an agent executes tools with side effects — anything beyond pure reads. NOT for read-only pipelines (nothing to gate), NOT a transaction manager (it prescribes the contract; your executor enforces it), NOT a substitute for the Ch6 information-flow or trust gates (those govern data and tool quality; this governs consequence).
1 other project uses a version of this.
Adopted by
Most recently taken up by
- annatchijova/SKILLStheir own version, first seen Jul 8, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- annatchijova/SKILLS★ 8same 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 repository51 other files it gives its agents.
- AGENTS.mdAGENTS.md
- dual-graph-routerSkill
- eight-pillar-readiness-mapSkill
- harness-node-splitterSkill
- agent-constraint-triangle-scorerSkill
- context-failure-classifierSkill
- enterprise-readiness-scorerSkill
- vector-vs-graph-retrieval-selectorSkill
- workflow-agent-spectrum-classifierSkill
- capability-authorization-gateSkill
- entity-resolution-strategy-selectorSkill
- graph-model-selectorSkill
- homoiconic-meta-schemaSkill
- kg-extraction-approach-selectorSkill
- knowledge-organization-classifierSkill
- schema-pattern-selectorSkill
- three-graph-routerSkill
- bi-temporal-edgeSkill
- graphiti-incremental-updateSkill
- hierarchical-memorySkill
- hindsight-epistemic-classifierSkill
- letta-failure-modesSkill
- memory-consistency-model-selectorSkill
- memory-consolidationSkill
- rrf-hybrid-retrievalSkill
- cost-performance-scorerSkill
- kv-cache-latency-budgeterSkill
- model-routing-selectorSkill
- schema-evolution-migratorSkill
- subgraph-access-controlSkill
- constraint-guided-plan-validatorSkill
- investigation-dag-plannerSkill
- loop-pipeline-routerSkill
- parallel-reconcile-mergeSkill
- pipeline-architecture-selectorSkill
- structured-output-contract-designerSkill
- evolution-taxonomy-classifierSkill
- execution-graphSkill
- four-layer-eval-cascadeSkill
- graduated-validation-protocolSkill
- intervention-selectorSkill
- semantic-backprop-attributorSkill
- xskill-self-improving-objectSkill
- draft-tool-trust-verifierSkill
- federated-context-governanceSkill
- hierarchical-orchestration-routerSkill
- information-flow-control-gateSkill
- mcp-gateway-two-meta-toolsSkill
- rag-mcp-tool-selectionSkill
- skill-quality-evaluatorSkill
- tool-primitive-selectorSkill
The file
We split this skill into the rules it gives an agent
4 rules. About 0 are common, 3 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈3
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 55
Before executing a multi-step remediation plan — the saga analysis tells you where the point of no return sits and whether reversible steps …
- Very specific: line 58
When designing a tool registry: run every tool through classify once and store the class as a tool property the orchestrator can filter on.
- Distinctive: line 60
When an executor needs a retry policy and nobody has written one: the prescription (at-most-once vs at-least-once-with-key vs safe-retry) …
- Distinctive: line 66
Read-only pipelines: every action classifies REVERSIBLE and the gate adds a no-op.
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Irreversible-Action Gate
Overview
An agent that can call tools can cause consequences, and consequences are not uniform: re-reading a metric is free, scaling a service down is undoable, deleting a snapshot or paging a human is not. Most agent failures that make postmortems are not wrong answers — they are wrong actions that could not be taken back, retried into duplication, or executed before their preconditions held.
This skill is the deterministic gate at the execution boundary. It does four things, all before any tool runs: classifies the action's reversibility, prescribes the delivery contract that class demands, checks the action's preconditions against known graph facts (fail-closed), and — for multi-step plans — computes the compensation stack and the point of no return: the first irreversible step, before which recovery is backward (undo what was done) and after which recovery is forward only (finish what was started).
The classification is property-driven, not name-driven: an action is what its
declared side-effect scope, idempotency, destructiveness, and compensation
say it is. "The tool is called cleanup" carries no information; "the tool
is data-destructive, external, and has no compensating action" does.
When to Use
- Any agent whose tools mutate state: deployments, configuration changes, scaling, deletions, notifications, payments, ticket creation.
- Before executing a multi-step remediation plan — the saga analysis tells you where the point of no return sits and whether reversible steps are needlessly ordered after it.
- When designing a tool registry: run every tool through
classifyonce and store the class as a tool property the orchestrator can filter on. - When an executor needs a retry policy and nobody has written one: the prescription (at-most-once vs at-least-once-with-key vs safe-retry) is derivable from the action's properties.
When NOT to Use
- Read-only pipelines: every action classifies REVERSIBLE and the gate adds a no-op. Skip it.
- As a transaction manager: this skill prescribes the contract (register compensation first, require the key, dry-run first); enforcing it is the executor's job. The gate cannot roll anything back itself.
- As a replacement for the other Ch6 gates:
information-flow-control-gategoverns what data may flow between tools;draft-tool-trust-verifiergoverns whether a tool does what it claims. This skill governs what happens if the tool DOES what it claims and you wish it hadn't. - For human-approval workflow design: the gate says WHEN approval is required (irreversible without dry-run); how approval is collected is out of scope.
Process
| Step | What happens | CLI |
| 1 | Classify reversibility from declared properties | classify --action-spec action.json |
| 2 | Prescribe the delivery contract (key, retry, dry-run, approval, compensation, consistency) | prescribe --action-spec action.json |
| 3 | Check preconditions against graph facts, fail-closed | gate --action-spec action.json --facts facts.json |
| 4 | Analyze a multi-step plan: compensation stack + point of no return + reorder flags | saga --plan-spec plan.json |
| 5 | Walk the checkout-service remediation end-to-end | scenario devops-remediation |
| 6 | Run the verification battery | benchmark |
Rationalizations (and why they fail)
| Rationalization | Why it fails |
| "The model is careful; it won't call the destructive tool wrongly." | Care is a probability; the gate is a contract. The classification runs in microseconds and does not have good days and bad days. |
| "We can always retry on timeout." | A timeout on a non-idempotent mutation is not a failure receipt — the action may have succeeded. Retrying without an idempotency key is how one deployment becomes two. That is why the prescription forces at-most-once or a key, never blind retry. |
| "We'll add rollback handling later if we need it." | After the point of no return there is no later. The saga analysis exists precisely because compensation must be registered BEFORE the step executes, not designed during the incident. |
| "Everything in our system is reversible; we have backups." | Backups make internal destruction semi-reversible. They do nothing for external effects: pages sent, customers emailed, money moved. Scope is part of the classification for exactly this reason. |
| "Preconditions slow the agent down." | The gate is one dict lookup per precondition. The Ch3 SHACL discipline it mirrors runs in milliseconds. The slow version is executing RollbackDeployment against a target that never carried :rollbackApproved. |
Red Flags
- An action classified IRREVERSIBLE executing without dry-run or human approval — the prescription was ignored, not wrong.
- A non-idempotent mutation with
retry_policyanything other than at-most-once or at-least-once-with-idempotency-key. - A saga whose compensation stack is empty while it contains SEMI_REVERSIBLE steps — compensations declared but not registered.
- Reversible steps ordered after the point of no return without a stated reason — the reorder flags exist to be read.
- A tool registry where every action classifies REVERSIBLE — almost certainly under-declared properties, not a genuinely harmless toolset.
Non-Negotiable Verification
python cli.py benchmarkexits 0 — the battery covers all three classes, the retry-policy matrix, fail-closed gating, PONR placement, and the reorder flag.python cli.py --helpexits 0 and prints this skill's frontmatter description (so any harness can discover the skill from --help).- For your own tool registry: run
classifyon every tool and have a human confirm the class of anything marked REVERSIBLE — under-declared properties are the failure mode the battery cannot catch for you.
Security Posture
- Prompt injection: action properties come from the tool registry, not from
retrieved text. If an attacker can edit the registry to mark a destructive
tool
idempotent: true, side_effect_scope: none, the gate is defeated — registry entries are privileged configuration and must be write-protected. - Data exfiltration: the gate itself reads only declared properties and boolean facts; it never sees payloads. Keep it that way — a gate that logs full tool arguments becomes a sensitive-data sink.
- Privilege escalation: fail-closed is the invariant. A precondition absent from the facts dict blocks execution; treat any "default allow on missing fact" patch as a vulnerability, not a convenience.
Source Attribution
Distilled from Agentic GraphRAG (O'Reilly, by Anthony Alcaraz and Sam Julien), Chapter 6 — Tool Orchestration, composing the execution-boundary discipline the book states across chapters: Ch5's "action irreversibility" risk and Outlines-constrained plans with explicit rollback procedures, Ch3's SHACL precondition gates before tool invocation, Ch4's consistency escalation before irreversible decision points, and Ch7's reversibility hierarchy. External anchor: the saga pattern (Garcia-Molina & Salem, SIGMOD 1987) for compensation-based recovery.
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.

