---
slug: "Compensate"
name: "Compensate"
type: "Primitives"
layer: "Infrastructure"
ref: "Compensate#4b87"
sema_id: "sema:Compensate#mh:SHA-256:4b87623f38564fcc95b87d2cbf5df2f5ff41ef27e617ccafd76c7b7896b144e7"
tags: ["Infrastructure","Primitives"]
updated: 2026-11-11
mindscape: "bootstrap"
index_url: https://mindscape.world/scapes/bootstrap.json
url: https://mindscape.world/bootstrap/Compensate/
related: ["Break","System","TimeWarpLog","AtomicBid","EjectionSeat","FrameError","Gardener","OptimisticSolver","Retry","Rollout"]
---

# Compensate

Structured rollback via logged inverses in LIFO order

Layer: Infrastructure · Category: Primitives

## Mechanism

Execute inverse actions to undo partial coordination across the [System](https://mindscape.world/scapes/bootstrap/System.md) after BREAK. On receiving BREAK, agent retrieves compensation_log (built during forward execution—each action logged its inverse). Execute inverses in REVERSE chronological order (LIFO). For each inverse: attempt execution, if fail retry (inverses must be idempotent), if still fail log and continue or escalate. Report COMPENSATE_RESULT: {completed: [steps undone], failed: [steps that couldn't undo], clean: bool, downstream_confirmed: bool}. Multi-agent coordination: each agent compensates their own scope. BREAK propagates with upstream_agents hint for cross-agent dependencies—downstream agents compensate first, confirm, then upstream proceeds. Compensation cannot introduce NEW coordinated work (only cleanup and notification). Triggered by [Break](https://mindscape.world/scapes/bootstrap/Break.md), it reads the [TimeWarpLog](https://mindscape.world/scapes/bootstrap/TimeWarpLog.md) in reverse to execute the idempotent inverse of each prior action.

## Invariants

- Every forward action logs its inverse as it executes; an action with no logged inverse is not compensable.
- Inverses execute in reverse chronological order.
- Inverses are idempotent, so a retried compensation does not compound.
- Reports per-inverse outcome, including which inverses failed.

## Preconditions

- Compensation mechanism available
- Detected failure/loss

## Postconditions

- A status report exists naming which inverses succeeded and which did not

## Failure modes

- Inverse wasn't logged (can't compensate what wasn't tracked).
- Inverse isn't truly idempotent (retry corrupts state).
- External state changed between action and compensation (assumption invalid).
- Compensation creates new failure (cascading compensation).
- Time-sensitive compensation (too late to undo, window passed).
- Compensation log lost or corrupted.
- Downstream agent doesn't confirm (blocks upstream compensation).

## Caution

Compensation must not erase the audit trail of what was rolled back — log both the forward action and the compensation.

## Builds on

- [Break](https://mindscape.world/scapes/bootstrap/Break.md) (Infrastructure; References)
- [System](https://mindscape.world/scapes/bootstrap/System.md) (Infrastructure; References)
- [TimeWarpLog](https://mindscape.world/scapes/bootstrap/TimeWarpLog.md) (Infrastructure; References)

## Used by

- [AtomicBid](https://mindscape.world/scapes/bootstrap/AtomicBid.md) (Society; Composes with)
- [EjectionSeat](https://mindscape.world/scapes/bootstrap/EjectionSeat.md) (Society; References)
- [FrameError](https://mindscape.world/scapes/bootstrap/FrameError.md) (Mind; References)
- [Gardener](https://mindscape.world/scapes/bootstrap/Gardener.md) (Society; References)
- [OptimisticSolver](https://mindscape.world/scapes/bootstrap/OptimisticSolver.md) (Society; Composes with)
- [Retry](https://mindscape.world/scapes/bootstrap/Retry.md) (Mind; References)
- [Rollout](https://mindscape.world/scapes/bootstrap/Rollout.md) (Society; Composes with)

## Identity

- Sema ID: `sema:Compensate#mh:SHA-256:4b87623f38564fcc95b87d2cbf5df2f5ff41ef27e617ccafd76c7b7896b144e7`
- Ref: `Compensate#4b87`
- Supersedes:
  - `sema:Compensate#mh:SHA-256:269dac24b3d83ede5ad2419fd9d78e0e0368090c677bbd272880b1b8e6921af3`
  - `sema:Compensate#mh:SHA-256:81a5e6a4b35f905a4b19391777572e3905883ec599b49fdd35e0ab785af01bc7`
  - `sema:Compensate#mh:SHA-256:e23bc7c0d3825460855e7ee5e2e41f512ff8e318ad741b1ba4e0303cb66e39b9`
  - `sema:Compensate#mh:SHA-256:9b3b07b7a02d00b6df1ecc3ee69fa3dcd2b33e07f045c67f26deb6cf311694f2`
  - `sema:Compensate#mh:SHA-256:447fb91007e09d8674d66ab2698189026a2e9f70a2b66fbaaed406006fb8b8eb`

## Links

- [Pattern page](https://mindscape.world/bootstrap/Compensate/)
- [View in the interactive graph](https://mindscape.world/bootstrap/#Compensate)
- [JSON](https://mindscape.world/scapes/bootstrap/Compensate.json)
- [Index of all patterns](https://mindscape.world/scapes/bootstrap.json)
