← Back to Blog
Product · July 2026 · 7 min read

Context First, or the Model Is Guessing

M
Michael · Builder & owner of Stocklake
Market context — price trend and volume

Last post covered where Stocklake came from — a decade-old Google Sheet that turned into a datalake, an app I never shipped, and an MCP server that became the actual product. This one is about why the tools are shaped the way they are.

Every analysis starts with the market, not the stock

The first thing I built out wasn't stock-level data at all — it was the market itself. Here's the reasoning: ask any model to evaluate a single stock without telling it whether the broader market is risk-on or risk-off, and it's guessing. A 15% drawdown in a stock means something completely different in a bull tape than it does three days into a VIX spike. Without that context, "should I buy this" isn't a real question — it's a coin flip with extra steps.

So the first tools in Stocklake aren't about any individual company. get_market_pulse gives a live snapshot in one call — VIX level, Fear & Greed, market breadth (what % of the universe is oversold vs. overbought), and where the major indices sit. get_market_assessment goes one layer deeper: macro regime (RISK_OFF / CAUTIOUS / NEUTRAL / AGGRESSIVE) and market outlook (BULLISH / NEUTRAL / BEARISH) with the reasoning behind each.

get_market_pulse — VIX, Fear & Greed, breadth, indices
get_market_pulse — VIX, Fear & Greed, breadth, indices in one call

Sectors are the next layer down

Broad market context alone isn't enough either. A NEUTRAL market can still have Energy ripping and Tech bleeding — sector rotation is often the more useful signal than the index level. get_sector_intelligence covers all 11 GICS sectors: which ones are LEADING, STRONG, NEUTRAL, WEAK, or LAGGING right now, plus the underlying stats (RSI distribution, breadth, 1-week/1-month performance) that back up the label.

Macro plus sector, together, is the foundation almost everything else in Stocklake sits on top of.

History matters as much as the snapshot

A live number on its own is context-free. Knowing the market is NEUTRAL today doesn't tell you if it just became NEUTRAL after two weeks of BULLISH, or if it's been stuck there for a month. So the tools carry historical depth, not just a point-in-time read — sector signals, market outlook, and regime assessments all track how they've moved over recent history, not just where they sit right now.

That said — deliberately not unlimited depth. Which brings me to a design choice I want to be upfront about.

Why the default window is recent, not everything

Early on, I gave a tool wide latitude — pull as much daily history as you want. An agent took that literally: it queried a full year of daily data for a routine check, dragged that entire year into its reasoning, and the output drifted somewhere I never intended. Not because the data was wrong — because nothing constrained how much of it the model decided was relevant, and different models handle that differently. Some stay disciplined with a large context window; some don't.

So most Stocklake tools default to a recent window — days or weeks, not a year — unless you explicitly ask for more. It's a guardrail, not a limitation: the goal is to keep the model reasoning over what's actually relevant to now, not quietly averaging in six months of noise it was never asked to consider. News data has the same problem, worse — an agent reasoning about a stock using six-month-old headlines as if they're current is its own failure mode. More on that in a later post.

On Pro and hit a gap here — history you need that the defaults don't surface? Tell us at /contact. This tuning is ongoing, not finished.

Raw context isn't the end of it — synthesize it, then keep it

Handing an agent the raw numbers is step one. Step two was asking: why make every caller re-derive the same conclusion from the same data? So the same macro and sector context that feeds get_market_assessment and get_sector_intelligence also runs through an AI synthesis pass — regime, outlook, sector signal, with the reasoning attached — and that output gets written back into Stocklake, not just handed to whoever called the tool and forgotten.

Raw data flows through an AI synthesis pass and is written back to Stocklake
Raw market & sector data → AI synthesis pass → written back to Stocklake

That's the part I actually care about most: it's not a one-off API response. It lands back in the same datalake, so the next call — mine or yours — starts from that synthesis instead of re-deriving it from scratch. One synthesis layer, built once, reused everywhere.

What this foundation unlocks

With macro, sector, and historical context loaded, the tools go deeper from there — into individual stocks. get_stock for price, fundamentals, and technicals in one call, get_stock_rating for a composite 0–10 technical read, search_stocks for screening the universe by RSI, sector, market cap, or valuation. All of it sitting on top of the same market context, not floating disconnected from it.

News and sentiment are their own layer on top of that — and their own set of lessons about what happens when an agent doesn't know how old a signal actually is. That's one of the next blog posts.


Coming up in a future post: news and sentiment — and what goes wrong when an agent doesn't know how old a signal is. See all posts →