Narrative Edge
How can changes in market narratives become stock recommendations whose subsequent performance can be reviewed?
Narrative Edge recommends stocks from changes in market narratives and lets readers review how those ideas performed against QQQ. I built the pipeline from analyst research notes to the public board: a language model extracts dated bullish and bearish views, then fixed rules select new long or short signals when consensus reverses, continuation ideas supported by bullish narratives, and a separate watch list of stocks whose prices have lagged. Each row connects the idea to its research date, position status, supporting view and subsequent price path.
The default board is a retrospective research-date simulation, with entry and exit dates, closed positions and returns relative to QQQ. It reviews selected recorded signals, not every historical opportunity or a strategy known at the time. Where publication timestamps are unverified, source-session dates are explicit assumptions. The recorded issuance ledger remains separate, and simulated results do not count toward live validation. That ledger enters at the first final close after both the report date and the day the rules ran, writes each close once, and is the only record that counts: the rules stay in validation until new signals and continuation each have 30 closed recorded positions. With research through 6 November 2026 it had two, one continuation and one watch position, both behind QQQ, and no closed new signals, which is no evidence either way.
Building the clustering and lifecycle engine exposed three failure modes that naive rules miss. First, shared baskets are not shared theses: AI data-center power and cooling shares 33 tickers with AI infrastructure capex, so my initial duplicate audit — which flagged pairs on either label or ticker overlap — fired exclusively on ticker overlap across the July registry while missing six true duplicates with identical raw labels. Second, publication gaps create false cooling: if a source takes a week off, a naive state machine downgrades every narrative, so the stage engine now uses hysteresis and ages silence without letting a gap flip a narrative into cooling or dormant on its own. Third, hindsight biases price windows: stock pages (such as NVDA's January–September 2026 GPU demand episode, +22.9% vs. +45.6% for the semiconductor ETF) anchor strictly on source publication dates and explicitly flag when historical detection timestamps were not recorded in real time.
| Layer | Status | What must not be conflated |
|---|---|---|
| Duplicate audit | 18 hand-labelled pairs, 15 scored and 3 marked ambiguous. Precision and recall 1.00, against 0.20 and 0.14 for the old rule. | A perfect score on a fixture I labelled is a regression test, not a claim that the rules generalize. |
| Stage and stance contracts | A frozen set of cases checked against seven written contracts, among them unchanged input, publication gaps, real flips, conflicting claims and repeated commentary. Labels proposed with an AI assistant, not independently adjudicated. | Passing a contract shows a rule is applied, not that the stance was read correctly. |
| Extraction fidelity | Not measured. | A fluent summary is not a faithful extraction. |
| Price alignment | Descriptive only. | Price is an outcome, not a label for extraction quality. |
Quality here means claims faithfully reflect their sources, distinct theses stay distinct, and narrative changes follow dated evidence. Around a thousand automated tests enforce stage and stance contracts across every change, and the redesigned duplicate audit now reaches 1.00 precision and recall on the 15-pair scored fixture (up from 0.20 and 0.14). Even so, a perfect score on a small fixture I labelled while building the classifier is a regression test, not proof of generalization, and extraction fidelity against the raw newsletter text has not yet been double-annotated. The immediate next step is scoring a sample of extracted claims with a second human annotator — with a hard stop rule that if two people cannot agree on stance for most sampled claims, the stance schema gets rewritten before any model is tuned against it.
Source documents: Cloudflare R2. Ingest workflow: GitHub Actions · Python. Source editions: Markdown files. Ticker analysis: LLM + Python. Narrative analysis: LLM + deterministic rules. Analysis refresh: Separate GitHub Actions job. Analysis artifacts: Committed JSON / JSONL. Artifact validation: Hashes · revisions · freshness. Price context: Bounded price-refresh artifacts. Subsequent price paths: Archived adjusted closes + QQQ. Independent case research: Independent editorial analysis. Market Stories: Authored JSON + WebP charts. Narrative Edge: Flask / Jinja. Static snapshot: HTML / JavaScript. Source documents to Ingest workflow: download. Ingest workflow to Source editions: convert. Source editions to Ticker analysis: source text. Source editions to Narrative analysis: source text. Analysis refresh to Ticker analysis: refresh derived work. Analysis refresh to Narrative analysis: refresh derived work. Ticker analysis to Analysis artifacts: write JSONL. Narrative analysis to Analysis artifacts: write JSONL. Analysis artifacts to Artifact validation: verify manifest. Artifact validation to Narrative Edge: coherent snapshot. Price context to Narrative Edge: display context only. Narrative Edge to Static snapshot: export snapshot. Source editions to Independent case research: reviewed narrative evidence. Subsequent price paths to Independent case research: later price evidence. Independent case research to Market Stories: essays + charts. Market Stories to Narrative Edge: /market-stories/<slug>.