idempotent-redundancy
npx machina-cli add skill parcadei/Continuous-Claude-v3/idempotent-redundancy --openclawFiles (1)
SKILL.md
828 B
Idempotent Redundancy
When adding redundant paths (fallbacks, belt-and-suspenders), make them idempotent.
Pattern
Redundancy without idempotency causes loops, churn, or data corruption.
DO
- Use
_is_merge: truefor Braintrust updates - Check if value exists before writing (fallback only if missing)
- Use atomic write/rename for file operations
- Make reconciliation steps safe to run repeatedly
DON'T
- Write unconditionally in fallback paths
- Allow multiple writers to overwrite each other
- Fire "repair" actions that can trigger more repairs
Source Sessions
- a541f08a: "Redundancy is good only if idempotent"
- 1c21e6c8: "Belt-and-suspenders, but make it idempotent"
- 6a9f2d7a: "Idempotent repair hooks"
Source
git clone https://github.com/parcadei/Continuous-Claude-v3/blob/main/.claude/skills/idempotent-redundancy/SKILL.mdView on GitHub Overview
Idempotent redundancy ensures that adding fallbacks or belt-and-suspenders does not create loops or data corruption. By making redundancy actions safe to repeat, systems can retry repairs and reconcile state without unintended side effects.
How This Skill Works
Idempotence is achieved by conditional writes (only write if a value is missing) and atomic save/rename for updates. Use _is_merge: true for Braintrust updates and design reconciliation steps to be safe to re-run without triggering additional repairs.
When to Use It
- Adding fallbacks or belt-and-suspenders in a distributed system without risking loops
- Updating Braintrust entries where concurrent writers may cause conflicts
- Running reconciliation tasks that may be retried after a failure
- Saving critical config or data files with atomic write/rename
- Synchronizing state across microservices to prevent churn from repeated repairs
Quick Start
- Step 1: Identify redundancy points and mark operations idempotent
- Step 2: Add existence checks and atomic save/rename for updates
- Step 3: Implement and test idempotent reconciliation and retriable repairs
Best Practices
- Use _is_merge: true for Braintrust updates
- Check if the value exists before writing; fallback only if missing
- Use atomic write/rename for file operations
- Make reconciliation steps safe to run repeatedly
- Avoid unconditional writes in fallback paths to prevent loops
Example Use Cases
- Braintrust updates merged safely with _is_merge: true
- Fallback writes occur only when data is missing, not overwritten
- Atomic save pattern for critical files (write to temp, then rename)
- Idempotent repair hooks that can be retried without harm
- Retries of reconciliation without creating duplicate work
Frequently Asked Questions
Add this skill to your agents