# Choose Register, Lease, or CRDT

## When to use

Use this task after the state has been accepted as repairable coordination state.

## Inspect first

- Define the key, value, writers, concurrency shape, and conflict consequence.
- Locate existing locators, codecs, resolvers, lease durations, or CRDT types.
- Read [collection selection](/en/09-choosing-collections.html).

## Required inputs

Obtain the actual invariant among current value, exclusive ownership, and mergeable concurrent updates. Record how an external resource rejects a stale owner.

## Implementation path

1. Select Register for current metadata and define a deterministic resolver.
2. Select Lease for time-bounded ownership and pass a fencing token to the external resource.
3. Select CRDT for local updates with commutative, associative, and idempotent merge behavior.
4. Split the model or reject DSM when one state needs conflicting invariants.
5. Add a failure experiment for both the selected and rejected options.

## Constraints

- Register convergence does not roll back an external transaction.
- Lease depends on external fencing; holding a lease alone cannot block a stale owner from writing elsewhere.
- A CRDT merge function needs the required algebraic properties.

## Failure patterns

- Using Register as an exclusive lock.
- Treating the local Lease holder view as permanent global ownership.
- Selecting CRDT for a non-commutative external effect.

## Validation

Run the focused chapter verification and add a concurrent, stale-owner, or duplicate-delta counterexample. Record the achieved E1, E2, E3, or E4 evidence level.

## Evidence

- [State and collection contracts](/agent/en/v/0.1.2/reference/state-and-collection-contracts.md)
- [Validation scopes](/agent/en/v/0.1.2/reference/validation-scopes.md)
- [Pinned DSM source](https://github.com/xbdotl/dsm/tree/505e7557da94e3f74da84ecf75bc8a9282732e4f)
