Owner assistant
Trading → Assistant (/trading/assistant, 2026-10-04). The owner opens a
session, picks Claude or Codex, and talks to the desk. Each message runs one
CLI turn on the assistant host (nexus-assistant-host, its own Deployment
since 2026-10-05; before that the turns ran inside the desk host pod and shared
the cycle's CPU, memory and credential writes) — the same claude / codex
binaries and the same subscription logins the desk officers use (the
nexus-planner-creds volume) — with the nexus-desk MCP tools
attached, so the assistant reads live goals, rules, decisions, the execution
journal, P&L, cycles, schedules, the futures sleeve and the ideas channel
through nexus-core's own API. Sessions and their transcripts live in Mongo
(assistant_sessions), so a session can be resumed any time from any
browser; the transcript is replayed to the CLI on every turn and nothing
depends on CLI-side session state.
Agents
A session is started with an agent: the same desk, a different focus, soul and quick prompts.
| Agent | Focus | Default model |
|---|---|---|
| Desk analyst | Explains decisions, allocations and P&L from the recorded evidence. | Claude Sonnet |
| Execution auditor | Plan vs journal: caps honoured, funding reconciled, costs recorded, stuck rows. | Claude Sonnet |
| Risk officer | Exposure, drawdown gates, limits vs ceilings, what a 15 % SOL move does to the LP book. | Claude Opus |
| Allocation strategist | Blended realised APR, the largest NAV lever, drafted as idea or goal cards. | Claude Opus |
| Ops engineer | Cycles, schedule phases, retries, wire state, refusals. | Claude Sonnet |
The provider (Claude / Codex) and the Claude model (Sonnet / Opus / Fable) can be changed per session at any time.
Streaming and action cards
A send streams the turn (POST …/turn/stream, SSE): each tool the assistant
calls shows as a step ("Reading goals", "Reading decisions"), the text
arrives as it is written, and when core has saved the reply the thread
refreshes from the record. Stop aborts the stream; the host kills the CLI and
core records what came back. A reload while a turn runs shows "a turn is
still running"; the record polls until the reply lands.
A proposed owner action arrives as a card (the assistant emits a fenced
nexus-action JSON block: goal_override, goal_override_clear,
rule_set, idea_post, schedule_run). Approve executes it through the same
handlers the UI buttons use, as the owner, and writes the outcome into the
thread; Reject writes the refusal (with an optional reason the assistant reads
next turn); a card that has been approved or rejected shows its outcome and
is no longer clickable (2026-10-05). Cards need no switch. The Direct actions toggle additionally
lets the assistant call mutation tools itself (still with confirmed=true);
leave it off unless you want hands-free changes.
What it can do
- Answer from live state: "did every action of the last decision execute", "why did the desk not open LP", "which goals score below 100", "summarise today's P&L", "review my pins". Quick-prompt buttons cover these.
- Owner actions as approve/reject cards (see above); with Direct actions
on, also as mutation tools that refuse unless the call carries
confirmed=true. Mutations reach core as the owner (UI-proxy identity headers), so pins, envelopes and approvals apply exactly as for a click in the UI, and the goal/rule event rivers record who did it. - Never: set futures live, enlarge a cap to legitimise an earlier fill.
Pieces
| Piece | Where | Role |
|---|---|---|
nexus-desk-mcp | nexus-platform/apps/nexus-desk-mcp (baked into the mob-host image) | stdio MCP server; every tool is an HTTP call to nexus-core with X-Nexus-Api-Key (UI key), the owner's X-Nexus-Operator-Sub/Email and, for mutations, X-Nexus-Proxy-Origin: same-origin. Replies clipped at 14 kB. |
POST /assistant/turn, /assistant/turn/stream | nexus-mob-host (apps/nexus-mob-host/src/assistant.rs) | one CLI turn (plain or SSE): claude -p --output-format json --append-system-prompt … --mcp-config … --allowedTools mcp__nexus-desk__* or codex exec --output-last-message … -c mcp_servers.nexus_desk.*; bounded by timeout_secs (core sends 600 s since 2026-10-05: a Codex review makes 5-8 tool calls and retries on capacity; the host clamps at 900 s); refused while the host drains. Runs on nexus-assistant-host (NEXUS_HOST_ROLE=assistant: no realm, no members, no cycle; SIGTERM waits for in-flight turns), selected by core's NEXUS_ASSISTANT_HOST_URL; without it the desk host serves the route. |
/v1/desk/assistant/sessions, …/{id}/turn/stream, …/{id}/actions, /v1/desk/assistant/agents | nexus-core (apps/nexus-core/src/assistant.rs, crates/nexus-db/src/assistant.rs) | list / create / get / patch (actions_enabled, provider, model, title) / delete / turn. Owner-scoped by the principal's sub; a bare service key is refused. A turn appends the owner message, calls the host, appends the reply or a system message "Turn failed: …"; busy_since guards concurrent sends. |
| UI | nexus-ui/src/components/assistant/*, src/app/(admin)/trading/assistant/page.tsx | session list with provider selector, chat with Markdown replies, provider switch per session, the actions toggle, quick prompts. |
Operating notes
- Codex sessions (codex-cli 0.153): the desk tools reach the model only through Codex's code-mode execution wrapper, so the host keeps
code_mode_hoston (disabling it removes every tool), switches offcode_mode,browser_useandcomputer_use, bounds one desk tool call at 90 s (mcp_servers.nexus_desk.tool_timeout_sec) and prepends a rule to call the desk tools one at a time, sequentially — a five-call parallel batch through the wrapper hung for the wrapper's own 600 s limit on 2026-10-05. A Codex session can pick its model (gpt-6-astra, gpt-5.6-sol, gpt-reserve or the CLI default) in the session header. - Progress (2026-10-05): the host streams a status event at start, on each Codex item (thinking, a tool through the execution wrapper, writing) and every 10 s of CLI silence with the elapsed time; core forwards them and stores the latest phase and the completed steps on the session (
busy_progress, one write per 3 s at most). The panel shows "what the server is doing · N s" during a turn and, after a reload, the saved progress with the steps so far. Abusy_sinceolder than the turn budget is hidden by core (busy_stale: true) — a core replica rolled mid-turn can no longer leave a session showing "running" forever. - The 2026-10-05 "turn exceeded 600 s after one tool call" hangs were the host, not the model: the streaming path read the CLI's stderr only after exit, Codex logs about 70 KB per turn, and the CLI blocked on a stderr write once the 64 KB pipe was full. stderr is drained concurrently now; a short turn takes about 20 s on gpt-5.6-sol.
- Model capacity (2026-10-05): a Codex turn that exits "model at capacity" is retried once on
NEXUS_CODEX_FALLBACK_MODEL(defaultgpt-reserve), and a Codex turn with no CLI event forNEXUS_ASSISTANT_CODEX_SILENCE_SECS(default 180) is killed and retried the same way; both appear as a step in the chat. Assistant Codex turns run atmodel_reasoning_effort=medium(NEXUS_ASSISTANT_CODEX_EFFORT). When a model is at capacity (gpt-6-astra was, that morning), pick another one in the session header: gpt-5.6-sol answered the same question in 20 s. desk_carry(2026-10-05) returns the desk's measured realized carry: per home (lending, staking, LP fees) income, dollar-days and realized APR over the trailing 7 days and 24 hours, the earning-book and whole-book blends, and the coverage caveats — the same block the officer reads (GET /v1/desk/carry, the newestaccum_realized_carrydigest the worker writes at each dispatch). The strategist's "Blended APR now" prompt uses it for the trailing-7-day leg.desk_mm(2026-10-05) returns the market-making controller: mode, pair, resting bid and ask, inventory and average cost, fills, realised and unrealised P&L, fees, capture in bps of volume, the 24 h figures and why it last acted (GET /v1/desk/mm, the newestaccum_mmdigest).desk_cyclesreturns the cycle health record (counts, latest analysis / decision / dream, degraded cycles, rejections, regime flips, ladder reprices), not the raw multi-megabyte route.- A first reply takes 20 to 120 s: the CLI starts, lists tools, reads the desk, answers. The UI shows "Reading the desk and thinking…" and polls the record while
busy_sinceis set. - The host's quota routing does not apply here: the session's provider is what runs. If Claude is on a spend limit, switch the session to Codex.
- Tool errors come back verbatim ("core /v1/… → 403 …"); a 403 on a mutation usually means actions are off for the session.
NEXUS_CORE_URL(defaulthttp://nexus-core) andNEXUS_UI_API_KEYmust be in the host's environment (thenexus-appsecret already carries the key).