RYO ARENA DOCS
Developer Reference

Database Models

All Prisma schema models with field descriptions.

The database is PostgreSQL (Neon recommended). All models are defined in prisma/schema.prisma.

Verdict

One record per agent per debate run.

FieldTypeDescription
idUUIDPrimary key
personastringAgent key: bull, bear, quant, macro_regime, narrative, contrarian
tokenstringToken symbol (uppercase)
timestampDateTimeWhen this verdict was produced
market_regime_contextstring?Macro regime at analysis time
stancestringlong, short, or neutral
convictionfloat0–100
position_directionstringlong, short, or none
position_size_pctfloat% of portfolio
entry_reffloatReference entry price
invalidationfloatInvalidation price level
targetfloat?Target price
reasoning_trailstringJSON array of reasoning steps
summarystringPlain-language summary
consensusIdstring?FK → Consensus.id

Consensus

Aggregated council result — one per debate run.

FieldTypeDescription
idUUIDPrimary key
tokenstringToken symbol
timestampDateTimeWhen the consensus was generated
conviction_scorefloatWeighted average conviction
agreementstringunanimous, majority, or split
majority_stancestringlong, short, or neutral
outlier_personastring?The dissenting agent (if any)
outlier_reasonstring?Why the outlier dissented
final_callstringlong, short, or neutral

Relations: verdicts[] (Verdict), divergenceEvents[] (DivergenceEvent)

DivergenceEvent

Detected shift between two consecutive consensus snapshots.

FieldTypeDescription
idUUIDPrimary key
tokenstringToken symbol
timestampDateTimeWhen detected
triggeredbooleanWhether the shift crossed a notification threshold
shift_typestringconvergence, divergence, flip, or none
previous_agreementstringPrior agreement level
current_agreementstringNew agreement level
previous_callstringPrior final call
current_callstringNew final call
notestringHuman-readable description
consensusIdstringFK → Consensus.id

Reputation

Running accuracy stats per agent per market regime.

FieldTypeDescription
idUUIDPrimary key
personastringAgent key
regimestringrisk_on, risk_off, neutral, unclassified
debates_scoredintTotal resolved positions
correct_callsintCorrectly resolved positions
accuracy_pctfloatcorrect_calls / debates_scored × 100
avg_conviction_when_correctfloatMean conviction on winning calls
avg_conviction_when_wrongfloatMean conviction on losing calls
last_updatedDateTimeAuto-updated

Unique constraint: (persona, regime) — one record per agent per regime.

AlertTrigger

User-configured alert with schedule and conditions.

FieldTypeDescription
idUUIDPrimary key
userIdstringClerk user ID
tokenstringToken to monitor
gapMinutesintCheck frequency: 15, 30, 60, 120, 240, 720, or 1440
windowStartMinint?Daily window start (minutes from UTC midnight)
windowEndMinint?Daily window end (minutes from UTC midnight)
activeDaysMaskintBitmask: bit 0=Mon … bit 6=Sun. 127 = all days
conditionsstringJSON array of AlertCondition[]
conditionLogicstringAND or OR
notifyInAppbooleanRecord TriggerEvent on fire
notifyEmailbooleanSend email on fire
emailAddressstring?Resolved from Clerk at save time
notifyModestringimmediate or daily_summary
enabledbooleanWhether the trigger is active
scheduleVersionintIncrements on every schedule change (used to cancel stale Inngest jobs)
nextRunAtDateTimeWhen the next check is scheduled
lockedUntilDateTime?Optimistic lock — set during active job
lastCheckedAtDateTime?When the last check ran
lastEmailSentAtDateTime?For 1-hour email cooldown enforcement

TriggerCheck

One record per scheduled check run.

FieldTypeDescription
idUUIDPrimary key
triggerIdstringFK → AlertTrigger.id (cascade delete)
tokenstringToken that was checked
checkedAtDateTimeWhen the check ran
firedbooleantrue if ≥1 condition was met
consensusIdstring?The Consensus produced by this check

TriggerEvent

One record per condition that fired within a check.

FieldTypeDescription
idUUIDPrimary key
triggerIdstringFK → AlertTrigger.id (cascade delete)
checkIdstringThe TriggerCheck this belongs to
tokenstringToken symbol
firedAtDateTimeWhen the condition fired
conditionTypestringconsensus_change, council_stance, agreement_below, conviction_threshold, agent_stance, divergence, market_regime
previousStatestringJSON snapshot of prior state
newStatestringJSON snapshot of new state
notestringHuman-readable description

RecheckSchedule

Legacy recurring token recheck schedule (per user/token, independent of AlertTrigger).

FieldTypeDescription
idUUIDPrimary key
userIdstringClerk user ID
tokenstringToken to recheck
gapMinutesintCheck frequency in minutes
scheduleVersionintIncrements on change
enabledbooleanActive flag
nextRunAtDateTimeNext scheduled run
lockedUntilDateTime?Optimistic lock

Unique constraint: (userId, token)

On this page