How a recommendation is born
When you invoke /rx-finance (or fitness, or learning),
eleven steps fire in a fixed order. The first two reconcile yesterday's state.
The middle steps compose the new rec. The last steps persist it. Every step
is deterministic — the LLM does narrative, not arithmetic.
The 11 canonical steps
-
0.5 · Auto-revive snoozed recs D-032
Update the rec store: any row with
snoozed_until ≤ NOW()flips back tostatus=open. Lazy — runs only when you invoke a rx command, not on a cron. -
0.7 · Phase W reconciler D-040
Query the rec store for recent rows. For each, check the on-disk markdown frontmatter. If the DB says
status=actedbut the file still saysopen, patch the file. Idempotent — re-running is a no-op once synced. -
1 · Read drift signals from canonical source
Fitness:
SELECT * FROM v_drift_signals(7-component SQL view). Finance: ~6 SQL queries against hypotheses/opportunities/drift_alerts/positions. Learning:ganesh_state_snapshot.py(markdown helper). Numbers are copied verbatim (D-011) — no LLM math. -
2 · Read auxiliary signals
Fitness:
body_recomp_snapshot.py(10% second layer). Finance: watchlist context, position concentration. Learning: bundle helper output. Each door has one or two extras the SQL view doesn't cover. -
3 · Compose composite drift
Weighted average. Fitness uses two layers:
composite = 0.90 × view.drift + 0.10 × body_recomp_sub(D-022). Finance and learning are flat single-layer composites. -
4 · Auto-dedup check D-012
If a prior open rec exists, was created < 48 hours ago, has the same driving signal, and a drift score within ±0.05 — and no acute signal has fired — skip writing a new rec. Instead, write a short "no-change confirmation" artifact and stop. Prevents inbox bloat from same-state re-runs.
-
5 · Pick the driving signal
Of the components that fed into the composite, the one with the highest weighted contribution becomes the driving signal. The rec body addresses this signal specifically — not the whole drift surface.
-
6 · Pull evidence from the vault
Call the vault indexer's
/searchendpoint with a query keyed off the driving signal. Top-K results (typically 3–5) become source citations. See Deep tech for retrieval mechanics. -
7 · Compose the rec artifact D-008
YAML frontmatter (id, created_at, drift_score, drift_breakdown, confidence + breakdown, status=open, signals_fired, source_refs, prior_open_recs).
Body in fixed sections: TL;DR, What I'm seeing, Recommendation, Why, Counter-thesis (mandatory), Sources. -
8 · Write markdown to disk
File path
<Door>/rx/rx-YYYY-MM-DD-NN.md, where NN is the next sequence number for that date. -
9 · INSERT into rec store
Door-specific:
· Fitness/nutrition → Supabaserecommendations
· Finance → TradingV postgresrecommendationsviaPOST /v1/rx/recswithX-RX-Ingest-Token
· Learning → skipped (markdown is the only store) -
10 · Patch frontmatter with store ID
After insert, the returned
idis written back into the markdown's frontmatter (verocity_rx_idfor fitness,tradingv_rec_idfor finance). Learning skips this step. -
11 · Return TL;DR to chat
Operator gets the artifact path + the one-line TL;DR. The full rec is then read either in the editor (markdown) or in the UI surface (Lovable / FastAPI panel).
Three load-bearing rules
D-008 · counter-thesis mandatory
Every rec must contain the strongest argument against taking the action, with explicit reject/accept conditions. A rec without one is malformed.
D-011 · numbers verbatim
All numeric fields — drift score, sub-scores, confidence — are copied from the canonical SQL view or helper JSON. The LLM never arithmetics on signals.
D-012 · auto-dedup <48h
Same driving signal + drift ±0.05 within 48 hours → short-circuit. Prevents the inbox from filling with near-identical artifacts.
The snooze + auto-revive lifecycle
A rec spends its life in one of these states:
snooze_count ≥ 2 (D-031). Snooze caps at 7 days.
/rx-<door> invocation.
If you never run the command, snoozed recs sit forever. Decision D-032 made this
deliberate to keep the system operator-driven and predictable.
Where the LLM is allowed to think
| Step | Done by | Why |
|---|---|---|
| 0.5 · auto-revive | SQL UPDATE | Pure state transition. |
| 0.7 · reconcile | SQL SELECT + file Edit | Pure diff + patch. |
| 1 · read drift | SQL view | Math owned by view; no LLM math (D-011). |
| 2 · aux signals | Helper script | Deterministic helper, no LLM. |
| 3 · composite | Arithmetic in command | Single weighted average; values verbatim. |
| 4 · dedup check | Comparison rule | Pure boolean predicate. |
| 5 · driving signal | argmax(weighted sub-scores) | Deterministic. |
| 6 · vault search | HTTP /search call | Indexer returns ranked sources. |
| 7 · compose body | LLM | Narrative, citation framing, counter-thesis composition. |
| 8 · write file | file write | Mechanical. |
| 9 · INSERT | SQL / HTTP POST | Mechanical. |
| 10 · patch FM | YAML edit | Mechanical. |
| 11 · return | Mechanical. |