Skip to main content

Decision rules

The desk's strategy and review methods belong in a registry of rules the desk itself maintains, stored in accum_rules and rendered into each prompt at dispatch. The owner's direction that produced it: no hard-coded rules, only LLM rules; I approve or reject when a manual intervention is needed — and the desk should choose LP ranges, swing orders or futures on the numbers, not because a prompt ranks them.

The 2026-10-03 implementation removes strategy preferences from the reviewed worker prompt blocks. Prompts retain identity and task, current typed goals, active rules, evidence with factual legends, and the output contract. This is not a claim that arbitrary prose can create a new executor capability.

2026-10-05: the registry has a feedback loop. Until then only the decision officer could change a rule, and nothing that happened after a decision — the dream's scoring, the brief's reading of fresh data, an execution gate refusing a rule-driven row — reached the registry except as prose the next officer might or might not act on. Rule flags close that loop, citations are now counted for the brief and the dream as well as the decision, a stale-rule sweep puts never-cited rules to the owner, and the decision prompt carries an execution review of what the code did with the last plans. Four rules.* goals set the clocks (Decision goals → the catalogue).

The decision output schema is generated from nexus-decision's accepted Rust contract types. Prompt rendering strips documentation annotations, bootstrap defaults and examples from the schema, while preserving actual field names, types, supported variants and contract version. Financial choices come from current registry policy and the desk's proposal, not copied example numbers.

The record​

One document per rule:

FieldMeaning
_idthe rule key, group.name (lowercase, dotted)
textthe rule as the desk reads it, one idea, at most 700 characters
scopewhich steps render it: analysts, brief, dream, decision
classmethod — how to read, compute, size or report; policy — what to prefer, refuse, wait for or pay for
statusproposed (an add waiting for the owner), active, pinned (owner-authored or owner-confirmed), retired
sourceseed (the extraction), ai, owner
rationale, evidencewhy, with digest ids and decision timestamps
pendinga change filed behind an approval: the change, the decision, the approval id, the reason it needs the owner
cited, last_cited_athow many cycle outputs named the key — the decision's reasons and, since 2026-10-05, the brief and the dream too (Citations)

Every change writes an accum_rule_events row (seed, ai_applied, ai_pending, approved, rejected, owner_set, owner_unpinned, owner_retired). A proposal the code files on its own — an unanswered rule flag, a never-cited rule — carries decision_ts flag:<ts> or stale:<date> instead of a decision timestamp, which is the proposal's identity: a re-run does not page twice, and a rejection is recognisable as "the owner said keep".

Lifecycle​

WhoWhatResult
Deskproposes a valid method or policy add, edit or retire with rationale and evidenceapplied autonomously; rendered at the next cycle
Deskproposes a change to an explicitly owner-pinned rulefiled as pending behind a typed approval rule_change; the owner approves or rejects it from the inbox or Telegram (/approve, /reject); nothing changes until then; expired or rejected drops it
Ownerwrites a rule (PUT /v1/desk/rules/{key}, the rules page)pinned: the desk may only propose against it, which again needs approval
Ownerlifts a pin (DELETE /v1/desk/rules/{key}/pin)the rule stays active under its class rules
Ownerretires a rule (DELETE /v1/desk/rules/{key})gone from the prompts at the next cycle; history kept
Dream judge, thesis officerobject to a rule by key in rule_flags[] of their machine JSON (contradicted, costly, stale, missing)an open rule flag; the decision officer must answer it in its next decision, with a rules[] change on the key or by keeping the rule on purpose
Analystsobject to a rule in the prose of their brief (they return no machine block)the thesis officer carries the objection into its own rule_flags[]; only that row opens a flag
Execution (the worker)the LP open gate refuses a row whose reason cited a rulean execution flag with verdict refused against every key the row cited
Workera key's flags go unanswered for rules.flag_escalate_after decisionsa typed rule_change approval proposing RETIRE, the same inbox / Telegram path as a pinned-rule change; approve = retire, reject = keep; the flags close either way
Workeran active, unpinned rule (seed or AI) has cited == 0 for rules.stale_after_hoursa RETIRE proposal to the owner, at most rules.stale_page_per_decision per decision, oldest first (stale rules); "keep" silences it for another window

The 2026-10-03 standing mandate authorizes AI policy changes without routine operator approval. Numeric execution authority still changes through typed goals[]; prose rules cannot bypass current policy, authentication or receipt integrity. Explicit owner pins retain the exception lifecycle below.

The approval record's only action is an audit digest (accum_approval_rule_change); the worker's sweep_pending reads the record's status every sweep and applies or drops the change. So the web inbox and Telegram answer the same record and neither needs to know the registry. Since 2026-10-05 POST /v1/desk/rules/{key}/pending also resolves the linked approval record (before, the registry changed but the inbox row stayed open until it expired), and the sweep drops a pending change that was filed but never paged — the approval insert failed — after 24 h, so the next proposal pages again instead of sitting under awaiting_owner for ever.

What the desk reads​

params.rules (and params.rules_brief for the thesis officer) is the prompt_block for that step: the rules in force grouped by prefix, pinned rules marked with the owner's note, the keys awaiting the owner so they are not proposed twice, and a per-step meta-rule. For the decision officer it says: follow the rules, cite their keys in brackets when they drive a row, and change them through rules[] when the data says they are wrong — one idea per rule, under 700 characters, free of dates, incidents and tool preferences that the numbers should decide.

Since 2026-10-05 the decision officer's rows also carry cited, last_cited and since (the day the rule was written), the block carries flags_awaiting_answer when flags are open, and the meta-rule enumerates the exact rules[] vocabulary instead of describing it: op is exactly one of add, edit, retire; class one of method, policy; scope[] values from analysts, brief, dream, decision. The contract also accepts the aliases a model plausibly writes — analysis, analyst, cycle (analysts), thesis (brief), officer (decision) — and canonicalises them in both the host's contract check and the worker's registry apply (nexus-decision canonical_rule_scope). On 2026-10-04 19:18Z a decision was rejected twice over scope: ["analysis"] and that cycle executed nothing; a scope word is not worth a cycle. The dream's and the brief's meta-rules tell them how to raise a flag (below).

The seed (nexus-db rules_seed.rs) was extracted from the old prompts under those constraints. Gone on purpose: "pools are the default home", "JitoSOL only as the last parking place", "Kamino is the reserve", "emit unstake_sol in the same plan; the executor never funds", the seven prose futures gates, the 75/25 hard-coded mix, every date and quote. What replaced the tool ranking is one policy rule, objective.tool_neutral: LP, lending, staking, swing orders, ladder rungs and futures compete every cycle on expected net NAV over the stated horizon, after costs, with evidence quality and funding feasibility stated.

Seeding inserts only keys that do not exist. After the first boot the registry belongs to the desk and the owner; edit it there, not in the file. An existing edited, pinned or retired record is never overwritten by a seed.

The worker reads the registry once per dispatch and renders the four desk scopes from that result. A failed read stops dispatch with a registry error; it cannot silently become an empty rules block. A successful read with no active rules is a different state and is respected, including deliberate retirement. The worker does not restore seed doctrine as an outage fallback.

The editable method lp.capital_expansion_review covers larger LP budgets, specific ranges, token inventory outcomes, matched lending/holding comparisons and costs under the existing objective.score NAV-in-USDT objective. The candidate-homes block contains observed facts, capacity qualifications and schema references. Naming a rule key there does not activate an absent or retired rule. capital.drawdown_history_review likewise holds the review method for the historical-evidence policy; changing that policy does not certify missing accounting evidence.

Rules can refer to custom strategy goals that the AI or operator creates, edits, retires and reactivates. Those goals have prompt scope. Implemented execution keys retain their typed consumer identity; their economic values remain AI-editable through goals[].

Rule flags​

A rule flag (accum_rule_flags, since 2026-10-05) is one typed objection against one rule key, with evidence. It is how the steps that run after a decision talk back to the registry.

WhoHowVerdicts
Dream judgerule_flags[] in its machine JSON (accum_dream_json)contradicted, costly, stale, missing
Thesis officerrule_flags[] in the brief's machine block (accum_thesis) — its own objections and the ones the analysts raised in prose (analyst briefs have no machine block, so nothing is harvested from them directly)the same four
Execution (the worker)the LP open gate refused a row whose reason cited a rule key — the gate digest's refusals matched back to the decision's lp_plan[i]refused

One row is {key, verdict, evidence}; evidence is a string or an array of strings (joined with ; ) and is clipped at 500 characters. The worker's rule_flags::harvest runs every execute sweep: it reads the newest dream and brief machine blocks, parses the rows, drops any without a valid key, a known verdict or evidence (a flag is an objection with evidence, not a mention), keeps at most 16 per output and one per key, and inserts the ones not seen before — the _id is {from}:{source_ts}:{key}, so re-reading the same digest never duplicates. A flag against a key that is not in the registry becomes missing whatever the model wrote, so the officer sees a gap rather than a contradiction of nothing. The host sanitises malformed rule_flags rows in the dream output (wrong shape, non-string verdict, a key without a dot) instead of rejecting the dream, so a bad flag never costs the ladder vote.

Open flags render into the decision prompt inside params.rules as flags_awaiting_answer: one row per key with unanswered_decisions (how many decisions have passed since the oldest open flag on it) and the flags newest first (from, verdict, evidence, at). The officer must answer each one in that decision:

AnswerHow the worker reads itFlag closes as
change the rulea rules[] edit or retire on the key (add, for a missing one)edit / retire / add
keep it on purposecite the key in a reason that explains why the objection is wrongkept
nothing—stays open and counts another unanswered decision

Once per applied decision the worker closes the flags the decision answered (answer_from_decision), then pages the owner (escalate) for every key whose flags have gone unanswered for rules.flag_escalate_after decisions (balanced bootstrap 2; 0 disables): a typed rule_change approval proposing RETIRE with every open flag as evidence, through the same inbox and Telegram path as a change to a pinned rule — approve = retire, reject = keep; the flags close as paged either way. A missing key, a retired rule or a rule that already has a change waiting is not paged; its flag expires with the TTL. Flags older than rules.flag_ttl_hours (balanced bootstrap 72) expire unanswered and stay in the history (answered.op: expired). The sweep report carries one 🚩 line per harvest, answer, expiry and escalation.

Citations​

cited and last_cited_at used to count only the decision text, so every rule scoped to the brief, the dream or the analysts read cited: 0 for ever and looked like a candidate for retirement. Since 2026-10-05 the worker also counts, once per digest, the rule keys named in the accum (brief text), accum_thesis, accum_dream and accum_dream_json digests against the rules in force for that step; the cursor digest accum_rule_citation_cursor records the newest timestamp counted per kind, so a sweep that sees nothing new costs a handful of one-row reads. Matching is whole-token: lp.sizing does not match lp.sizing_two_sided, and a key inside brackets or backticks counts the same as a bare one. The decision officer sees the result on every row (cited, last_cited, since); the Rules board shows last cited.

Stale rules​

Once per applied decision the worker's stale_sweep takes the active, unpinned rules (seed or AI; never an owner's) with cited == 0 and no change pending that are older than rules.stale_after_hours (balanced bootstrap 168; 0 disables), oldest first, and puts at most rules.stale_page_per_decision of them (balanced bootstrap 2) to the owner as RETIRE proposals through the same rule_change approval: no cycle has cited this rule since it was written … approve to retire it; reject to keep it for another N h. A rejection ("keep") is a rejected event with decision_ts stale:<date>, and the sweep does not ask about that key again inside another window. Nothing retires without the owner's answer.

Execution review​

portfolio_state.execution_review in the decision prompt (2026-10-05) carries what the code did with the previous plans: the recent LP-open-gate digests that refused or trimmed a row, the count of open rule flags by source, and the last twelve non-seed rule events (key, kind, at, by, note). Its meaning tells the officer that a refused or trimmed row means the method behind it — the rules it cited, the goals it assumed — did not survive execution, and that the answer is a rules[] or goals[] change or a reason, never the same row re-issued.

Pages and commands​

  • GET /v1/desk/rules?status=active|pinned|proposed|retired|pending|all&scope= — the registry with counts; since 2026-10-05 also flags, the open rule flags.
  • GET /v1/desk/rules/flags?limit= — the newest flags of any state (default 100), answered ones included.
  • GET /v1/desk/rules/prompt?scope=decision — exactly what the step reads, flags_awaiting_answer included.
  • GET /v1/desk/rules/events?key=&limit= and GET /v1/desk/rules/{key}.
  • PUT /v1/desk/rules/{key} { text, class?, scope?, note? } (owner, pinned); DELETE …/{key}/pin; DELETE …/{key} { note? }.
  • POST /v1/desk/rules/{key}/pending { accept } — answer a pending change directly (the inbox and Telegram do it through the approval); since 2026-10-05 it also resolves the linked rule_change approval record and returns its status as approval.
  • POST /v1/desk/rules/reseed — insert missing seed keys.

The worker's sweep report carries one 📜 rule … line per change (applied, waiting for the owner, not filed and why), and the Telegram page for a pending change reads 🔔 OPERATOR APPROVAL NEEDED · rules registry with the current text, the proposed text, the class, the rationale and the reason it needs you. Flag harvests, answers, expiries and escalations are 🚩 … lines in the same report.

The Rules board in the console (2026-10-05) shows each rule's history (its events), a Recent rule changes list, a source filter (seed / AI / owner), last cited, and a Flagged by the desk badge on a rule with an open flag; retiring a rule from the board asks for a note, which becomes the event's note.

Operating notes​

  • A rule change needs no gitops commit and no host roll: the worker reads the registry at every dispatch.
  • The versioned role instructions carry identity and task; the templates carry data legends and the output schema. If a sentence about what to prefer or refuse is found in either, it belongs in the registry.
  • The citation counters tell you which rules earn their place. Since 2026-10-05 they count the brief and the dream as well as the decision, and a rule nobody has cited for rules.stale_after_hours is put to you as a retire proposal rather than waiting for the desk to notice.
  • The clocks are goals, not code: rules.flag_escalate_after, rules.flag_ttl_hours, rules.stale_after_hours, rules.stale_page_per_decision (group rules, worker scope, AI-editable; 0 disables the escalation or the sweep). Change them on the goals board like any other goal.
  • A rule flag is never applied by itself: every escalation is a rule_change approval you answer. Rejecting it keeps the rule and closes the flags.