Writing / Quant

Building a macro-regime RAG for equity positioning

Five signals, eight regimes, and a schema that keeps the model honest.

Hassan Mehmood · 2026-05-20T00:00:00+00:00 · 7 min

quant · RAG · macro · research

I did not build this to sell a signal.

I built it because I was tired of market commentary that starts with a conclusion and retrieves a metaphor.

The pipeline is intentionally plain:

  1. Pull macro series (growth, inflation, liquidity, risk, labour).
  2. Retrieve research and historical context.
  3. Classify a regime into a closed set.
  4. Find analogues.
  5. Map to a posture, with persistence so a one-day blip does not become a philosophy.

The model runs locally. Outputs are structured. If the object does not validate, the run fails. That is the whole product idea.

Why regimes

A regime is a compression. Goldilocks, overheat, stagflation, disinflation, recovery, slowdown, crisis, reflation. You can argue with the list. You should. The alternative is a paragraph that cannot be compared to last quarter.

Analogues matter more than the label. "We have seen a version of this" is a better sentence than "the model is bullish."

What this is not

It is not a live book. It is not advice. The source is private. What I can show is the logic walkthrough — signals, retrieval, a closed regime set, then a posture.