03/The desk

The kernel has the last word

The risk kernel, evaluateDecision in packages/quant-kernel/src/riskKernel.ts, is pure deterministic code that rules on every proposal: eight checks, a final action and a SHA-256 proof. An LLM can suggest a trade. It cannot make the desk trade against the quant model, outside the ENS mandate, or while the treasury forbids it.

The eight checks

The kernel recomputes the toxicity quote and the range plan from the snapshot itself, then evaluates every check on every cycle. Trading actions are REBALANCE_RANGE and DELTA_HEDGE; the last three checks always pass for HOLD.

evaluateDecision · riskKernel.ts8 checks
  1. 01ENS_MANDATE_ACTIVEThe ENS mandate is active and not revoked. This is the kill-switch.parity.paused / revoked
  2. 02POOL_ALLOWLISTThe snapshot's pool id (default saucerswap-hbar-usdc-v2) is in the mandate's allowed pools.parity.allowedPools
  3. 03NOTIONAL_CAPThe trade notional is at most the mandate cap. For a hedge, the notional is the absolute hedge size.parity.maxNotionalUsd
  4. 04LTV_CAPProjected loan-to-value after the action is at most the cap. Bonzo is not integrated, so this is 0 today.parity.maxLtvBps
  5. 05SLIPPAGE_CEILINGThe proposal's slippage is at most the mandate's ceiling.parity.maxSlippageBps
  6. 06QUANT_AGREEMENTA trade must be the same action the quant plan recommends. An LLM cannot trade against the model.plan.recommendedAction
  7. 07POSITIVE_EV_GATEA trade needs the plan's expected 24-hour net EV to reach the floor.parity.minRebalanceEvUsd
  8. 08TREASURY_SURVIVALA trade needs the treasury to allow trading (THRIVING or CONSERVING).treasury.tradingAllowed

From checks to a verdict

  • If either of the first two checks fails, the final action is PAUSE_ON_MANDATE and approved is false.
  • Otherwise, if any of the other six fails, the final action is HOLD and approved is false. A failed EV gate is reported as "Insufficient EV ($x); refusing churn".
  • Otherwise the proposal stands. overriddenFromProposal and overrideReason record any change.

Only an approved REBALANCE_RANGE or DELTA_HEDGE reaches the executor, and the executor adds its own limits on top: MAX_TRADE_USD (default $5), MIN_TRADE_USD ($0.5), an HBAR fee reserve of 5 HBAR, and a fresh SaucerSwap quote that must not exceed parity.maxSlippageBps.

Where the limits come from

The limits are text records on the agent's ENS name, read every cycle (see ENS identity and mandate). When a record is missing, parseMandateTextRecords in contracts/ens/src/mandate.ts uses a default; when ENS cannot be read at all, the mandate is inactive with every limit at 0.

RecordDefault if the record is missingValue .env.example publishes
parity.maxNotionalUsd1000PARITY_MAX_NOTIONAL_USD=20
parity.maxSlippageBps60PARITY_MAX_SLIPPAGE_BPS=60
parity.maxLtvBps6500PARITY_MAX_LTV_BPS=6500
parity.minRebalanceEvUsd0.01PARITY_MIN_REBALANCE_EV_USD=0.01
parity.allowedPoolssaucerswap-hbar-usdc-v2PARITY_ALLOWED_POOLS=saucerswap-hbar-usdc-v2

The proof hash

The verdict is hashed over a canonical JSON payload: SHA-256 of the string below, in this key order, with each check written as NAME:1 or NAME:0.

canonicalPayload · riskKernel.tsjson
{
  "poolId", "timestampMs", "saucerSwapPrice", "referencePrice",
  "proposalSource", "proposalAction", "finalAction",
  "toxicityScore", "expectedNetEvUsd", "projectedLtvBps",
  "mandateBlock",
  "checks": ["ENS_MANDATE_ACTIVE:1", "POOL_ALLOWLIST:1", ...]
}

The hash goes to HCS inside parity.decision.v1, together with the pool, final action, approval, proposal source, toxicity score and regime, venue and reference prices, expected EV, LP edge and the names of the checks that failed. The same hash seeds the forecast id and is attached to every execution record, so a swap, a forecast and the verdict behind them can be matched up on-chain.