op: add
Increment a numeric field by a value.
Allowed phases
| Phase | Status |
|---|---|
preflight | ✗ forbidden |
core | ✓ allowed |
side_effects | ✗ forbidden |
Syntax
- op: add
path: /shows_attended
value: 1
- op: add
path: /wallet/balance
value: "event.amount"
cap:
max: 10000
min: 0Parameters
| Field | Required | Description |
|---|---|---|
path | yes | Numeric field path |
value | yes | Amount to add (literal or expression) |
cap | no | { max: N, min: N } — clamp result after addition |
if_missing | no | create, fail, or skip |
target_stream | no | Cross-stream target (avoid) |
target_entity | no | Entity ID for cross-stream target |
Behavior
- Pair with
cap: { min: 0 }to prevent negative balances or inventory. - If the field is missing and
if_missingiscreate(default), the field is created starting from the added value.
Related operations
See also
- Operations index — all ops by phase
- actions — rule structure and phases
- Intents: Rules — narrative examples