The Refinery

Scope

An orchestrator and eight specialised agents, a Severance-style dashboard, and a morning brief delivered before market open. Observation only. No trades.

Stack

  • Claude for building and testing
  • TradingView for research
  • Gmail SMTP for email notifications

Github repo

Open in GitHub

Why I built this

A morning routine I kept skipping, and an itch to build agentic

Two threads collided. I had a manual morning routine before the market opened: the same charts, the same news feeds, the same macro data. Twenty minutes that I would skip on the days it mattered most.

The other thread was wanting to build something agentic from scratch, end to end, instead of reading more posts about how others were doing it. The Refinery is the result. Nine coordinated agents watch a personal TFSA portfolio overnight, scan for setups, and email a brief before the market opens. Local-first, laptop-only, under fifteen cents a day.

Solution overview

An orchestrator dispatches eight specialised agents on a schedule, collects their output, and assembles the morning brief.

Inputs

yfinance market data
News & macro feeds

Agents

Orchestrator
Scanner
TA
Sentiment
Portfolio
Postmortem
Learning
Roster
Memory

Outputs

SQLite memory
Gmail SMTP brief
Local dashboard

Learnings and next steps

Learnings

  • Observation-only is a feature. No brokerage integration means no risk of accidental trades, simpler security, and full focus on signal quality.
  • Prompt caching is the budget lever. Sonnet for heavy analysis with caching, Haiku for lighter screens. Without caching, the daily bill would be an order of magnitude higher.
  • Local-first wins for personal projects. No cloud infrastructure to maintain. The whole system runs on a laptop and shuts down when it sleeps.
  • Strict module boundaries prevent spaghetti. One gateway per resource keeps the surface area small. Easy to test, easy to swap a model out without touching the rest.

Next steps

  • Email brief readability. The v1 emails assumed expert-level knowledge and leaned on abbreviations. For someone keeping up with a fast-moving market, the brief needs to be simple and informative. I tweaked the notification system to spell out terms, lead with the most important moves, and skip the jargon.