product_id
uuid
The variant the row pertains to — joined to products table.
p_88421
// decision_log
The decision_log is the single source of truth for every catalog move Magistry makes — and the model for every other audit table on the plane. Anatomy below.
#84193 DISCOUNT_TEST SKU-LIN-228 (-15%)
ACTIVE → ON_DISCOUNT ✓ APPLIED
#84194 DRAFT SKU-CER-019
ACTIVE → DRAFTED ✓ APPLIED
#84195 SCALE_WINNER SKU-WOO-441
ACTIVE → ACTIVE (paid sig) ✓ APPLIED
#84196 REVIVE_SEASONAL SKU-LIN-007
SEASONAL_VAULT → PUBLISHED ⏸ HELD
trigger: SEASONAL_WINDOW_OPEN
reason: kill_switch flipped at 09:14
— cycle 2026-05-25T09:00Z, 142 rows total —// anatomy
row_id : 84193
product_id : p_88421
sku : SKU-LIN-228-SND-L
from_state : ACTIVE
to_state : ON_DISCOUNT
action : DISCOUNT_TEST
trigger : OPTIMIZE_CYCLE_FAILED
trigger_meta : 2 consecutive cycles, no lift
evidence : {
perf_window : 9123 (28d rolling)
cycle_history : 771 (2 prior cycles)
judge_score : 0.88 (above 0.85 floor)
margin_tier : "A" (cost verified)
store_p75 : 2.4x (winner floor)
current_roas : 1.6x (28d)
policy_mode : autonomous
}
reversal_op : { action: "PRICE_RESTORE",
restore_to: 89.00,
auto_fire_at: "+14d" }
applied_to_shopify: true
applied_at : 2026-05-25T08:02:14Z
applied_by : catalog_agent.discount_executor
status : APPLIED
audit_chain : signal → plan → judge → execute → logproduct_id
uuid
The variant the row pertains to — joined to products table.
p_88421
from_state
lifecycle_state
Where the SKU was before the action.
ACTIVE
to_state
lifecycle_state
Where it lands. Validated against ALLOWED_TRANSITIONS.
ON_DISCOUNT
action
Action enum
One of the enumerated moves — never freeform text.
DISCOUNT_TEST
trigger
Trigger enum
Why the action was emitted. The reason the engine picked this row.
OPTIMIZE_CYCLE_FAILED
evidence
jsonb
Pointers to the windows, scores, and citations behind the call.
{cycle: 771, perf: 9123, judge: 0.88}
applied_to_shopify
bool
Dry-run vs live. The single flag that gates real-world impact.
false (Phase 1)
reversal_op
jsonb
Pre-stored inverse op — populated at plan time, not rollback time.
{action: PRICE_RESTORE}
applied_at
timestamptz
When the executor stamped the mutation. Append-only past tense.
2026-05-25T08:02Z
// triggers
Initial classification of a freshly-synced SKU into WINNER / MID / LOSER buckets.
Rolling-window ROAS falls below the store-calibrated p75 winner floor.
Zero units sold for N consecutive days — typically 21d for default plans.
Copy + image regenerate cycle ran twice without lift — discount test next.
Calendar trigger paired with positive signal — vault SKU returns to PUBLISHED.
Spend spike or conversion drop detected — auto-PAUSE within rate-limit bounds.
A human did something. Logged the same way as agent moves — same plane, same shape.
// evidence
// windows
// scores
// citations
// policy
{
"windows": {
"perf_window": 9123,
"anomaly_window": 4471
},
"scores": {
"judge_score": 0.88,
"calibration": 0.92,
"uniqueness": 0.78
},
"citations": {
"policy_cite": 214,
"supplier_signal": "batch_swap_flag",
"operator_override": null
},
"policy": {
"mode": "autonomous",
"rate_limit": "ok (3/8 this week)",
"kill_switch": "off"
},
"math": {
"store_p75_roas": 2.4,
"current_roas": 1.6,
"margin_tier": "A"
}
}// reversal model
row #84193
action : DISCOUNT_TEST
delta : -15%
status : APPLIED
applied_at : 2026-05-25T08:02Z
reversal_op : { action: "PRICE_RESTORE",
restore_to: 89.00,
fire_mode: "one_click" }row #84207 (reverses #84193)
action : PRICE_RESTORE
delta : +15% (restores €89.00)
status : APPLIED
applied_at : 2026-05-25T11:32Z
reverses : 84193
triggered_by: operator (jane@store.com)
— audit chain stays intact —// why append-only
If a row can be changed after the fact, it's a note. Magistry rows are events — they happened, they're stamped, they don't move.
Roll back row #84193 and you get row #84194 — pointing at the original. The chain is the story; nothing gets quietly overwritten.
When finance asks 'what did the agent do on the 14th', the answer is a SELECT. Not a reconstruction.
// decision_log
Every action a row, every row a reason, every reason a citation. The decision_log is what turns an agent into a teammate you can put on the org chart.
Append-only · One-click rollback · Built to be read