Ask Omni Risk Engine

GPT-powered portfolio and risk analysis built from compact, documented terminal snapshots.

Ask Omni is not an unbounded chat box. It is a preset-driven risk workflow that expands a small terminal request into a compact backend snapshot with account state, market context, liquidation data, funding, open interest, recent fills, and symbol or global news before sending a GPT request.

At a glance

Prompt design
Compacted Ask Omni sends compact JSON snapshots instead of dumping full terminal state.
Risk scope
Portfolio + symbol The snapshot builder includes account, position, order, market, liquidation, and news context.
AI posture
Decision support Outputs are meant to support interpretation and action ranking, not promise execution outcomes.

Why It Matters

What traders and researchers should take away

  • It turns a broad terminal state into a smaller risk-focused prompt instead of asking a model to reason from an unbounded UI dump.
  • It grounds GPT output in actual portfolio, market, liquidation, funding, open interest, and news context.
  • It is useful for ranking what matters now, where liquidation pressure sits, how current news interacts with the book, and what de-risking options matter first.

How it works

What the product uses behind the scenes

  • The terminal frontend sends a small presetId, question, scope, selected symbol, and liquidation scope.
  • omni-api resolves authorized account context, public profile context, market context, liquidation context, and symbol/global news.
  • ask_omni.rs builds a RiskSnapshot, compacts it into prompt_snapshot, and sends a structured request to the OpenAI Responses API.
  • Prompt metadata records what was included, so the AI response can be audited against snapshot size and context limits.

Notes

Things to know

  • Ask Omni is preset-driven today, not a general tool-calling agent.
  • The model does not receive the full raw terminal state or an unbounded history blob.
  • Use outputs as evidence-backed decision support rather than deterministic advice.

Request-to-response flow

The frontend stays thin. The backend owns account authorization, context loading, prompt compaction, model request shaping, and response metadata.

Implementation flow example
flowchart LR
  UI[Terminal Ask Omni panel] --> API[/api/ask-omni]
  API --> OMNI[omni-api ask_omni.rs]
  OMNI --> ACCOUNT[account + private funding state]
  OMNI --> MARKET[mark, funding, open interest]
  OMNI --> LIQ[liquidation context]
  OMNI --> NEWS[symbol + global news]
  ACCOUNT --> SNAP[RiskSnapshot]
  MARKET --> SNAP
  LIQ --> SNAP
  NEWS --> SNAP
  SNAP --> COMPACT[prompt_snapshot + promptMeta]
  COMPACT --> GPT[OpenAI Responses API]
  GPT --> ANSWER[markdown answer + metadata]
  • The browser sends the Ask Omni preset, optional question text, selected scope address, selected symbol, and liquidation scope.
  • The backend validates the preset and scope, then resolves the signed-in user context before loading account-sensitive data.
  • Market context is selected from the focus symbol, largest positions, and open orders rather than every possible market.
  • The final response returns rendered markdown plus snapshot and prompt metadata for debugging and auditability.

Preset workflows

Presets give the model a narrow job and make the terminal UI predictable for traders who need fast analysis, not a blank chat surface.

  • risk_overview ranks portfolio concentration, active risk, relevant market context, and what matters now.
  • liquidation_check emphasizes liquidation distance, nearby buckets, and cluster overlap for fragile positions.
  • leverage_check focuses on leverage, IM/MM usage, collateral stress, and margin efficiency.
  • performance_review weights recent fills and turnover so the output can explain current behavior rather than only current exposure.
  • hedge_first asks for action ranking: first hedge, first reduction, or least disruptive de-risking candidate.
  • global_sentiment, tradfi_sentiment, energy_sentiment, btc_sentiment, and oil_sentiment reuse the snapshot machinery with a news-aware emphasis.

What goes into the risk snapshot

Ask Omni uses structured context that mirrors the terminal workflow: account state, market state, liquidation context, and AI news are combined before GPT sees the request.

  • Account context includes equity and margin summary, top positions, open orders, and a compact recent fill-history summary.
  • Market context includes mark price, funding, open interest, and per-symbol liquidation stats for the focus symbol and relevant account symbols.
  • News context includes compact symbol news and global news from the backend GPT news pipeline.
  • Prompt metadata records counts for positions, orders, news items, and retained liquidation context so the prompt can be inspected without leaking secrets.

Why prompt compaction matters

Ask Omni deliberately avoids sending raw terminal state. The model receives a bounded JSON snapshot with the pieces needed for the selected preset.

  • Compaction limits irrelevant context growth when an account has many symbols, fills, orders, or news matches.
  • The model receives structured evidence rather than screenshots, DOM state, or arbitrary browser memory.
  • The backend can keep private account data behind authenticated API boundaries while still giving the model enough context for useful risk analysis.
  • The same pattern makes explanations easier to inspect: cite the snapshot builder, not hidden UI state.

Safety boundaries

Ask Omni is decision support for traders. It should not be described as autonomous execution, guaranteed advice, or a funding authority.

  • Ask Omni does not move collateral, approve agents, withdraw funds, or bypass wallet authority.
  • It is preset-driven today, not a general tool-calling agent with arbitrary terminal actions.
  • It does not receive unbounded raw history or full terminal state.
  • Outputs should be framed as risk interpretation and action ranking, not deterministic trading advice.

References

Implementation references

  • Ask Omni

    omni-terminal/docs/ASK_OMNI.md

    Primary documentation for the Ask Omni request shape, backend flow, presets, and prompt compaction.

  • Ask Omni frontend builder

    omni-terminal/src/lib/utils/askOmni.ts

    Shows the frontend request shape and preset metadata sent from the terminal.

  • Ask Omni API route

    omni-terminal/src/routes/api/ask-omni/+server.ts

    Shows how the SvelteKit route proxies Ask Omni requests to the backend API boundary.

  • Ask Omni backend builder

    hyperliquid-data-api/crates/omni_api/src/ask_omni.rs

    Shows prompt snapshot construction, compaction, metadata, and OpenAI Responses request shaping.

  • Ask Omni backend route

    hyperliquid-data-api/crates/omni_api/src/routes/hl.rs

    Shows scope validation, market-symbol selection, account context loading, and liquidation context wiring.

  • Terminal news display

    omni-terminal/docs/NEWS_DISPLAY.md

    Documents the news source that also feeds symbol and global news context for Ask Omni.

  • Plain-text routing notes

    omni-terminal/docs/LLMS_AUTHORITY.md

    Defines how public summaries should frame Omni’s AI risk and news context with evidence.