Build stock-deep-evaluation v1: single-stock equity evaluation app

Next.js 15 + TypeScript app implementing the fully-specced first change.
Pipeline: resolve -> market data -> pure evaluation engine -> budget guard
-> analysis agent -> report.

- market-data: DataProvider interface, offline FixtureProvider (DE/SPY seeded
  from the reference example), FmpProvider (FMP free tier), TTL cache + retry.
- technicals: pure MA/volatility/swing/52-week math.
- evaluation: instrument-aware pure engine; equity branch built, ETF gated to
  "not yet supported". Reproduces the DE example (P/E 34.5, fwd 29.3, $167.6B).
- agent: AnalysisAgent interface; default Claude Code CLI transport (headless,
  subscription-backed, web-grounded), Anthropic API alternate via config.
- cost-controls: price table, spend store, monthly budget guard.
- UI: ticker search + deep-dive toggle, report view, price chart with marked
  entry/exit/stop levels, cost/budget display, ETF/not-found states.

31 vitest tests, typecheck, production build, and lint all pass. Verified
end-to-end via the API for DE, SPY, and an unknown ticker. Live Claude CLI
agent test is the documented pick-up point (see README).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-08-21 17:03:04 -04:00
co-authored by Claude Opus 4.8
parent 73e93e7cb4
commit 902758ce67
44 changed files with 12425 additions and 91 deletions
@@ -24,8 +24,25 @@ stop-loss levels — with a data layer and agent interface designed to grow.
- Introduce a **pluggable analysis-agent layer** backed by **Claude via the
Anthropic SDK** (bring-your-own API key) that synthesizes the structured data
into a written investment thesis and the reasoning behind each recommendation.
- Scope v1 to **single-ticker deep evaluation**. Watchlist monitoring, alerts,
and multi-ticker dashboards are explicitly deferred to later changes.
The default model is **Claude Opus 4.8**, with a per-ticker "deep dive" option
that escalates to **Claude Fable 5** for the hardest analyses.
- Give the agent **live web grounding** (Anthropic's server-side web search and
web fetch) so macro/news facts the structured data layer lacks — tariff and rate
developments, analyst rating/target changes, management commentary, peer
read-throughs, dated catalysts — are sourced and attributed, matching the depth
of the reference evaluation.
- Introduce **cost controls**: capture per-report token/search usage, compute its
cost from a configurable price table, track month-to-date spend, and enforce a
configurable monthly budget (warn on a soft threshold, block on the cap) so the
agent — especially the Fable 5 deep dive — can't run up a surprise bill.
- Make the data models and evaluation engine **instrument-type-aware** (equity vs.
ETF) from the start. v1 builds the **equity** branch only; the ETF branch
(holdings, expense ratio, NAV premium/discount, weighted fundamentals) is a
fast-follow change that slots into the existing seams without a refactor.
- Scope v1 to **single-ticker deep evaluation** of individual equities. Deferred to
later changes: the ETF evaluation branch, a **screening / candidate-finder** mode
(criteria → grounded shortlist that feeds this evaluator), watchlist monitoring,
alerts, and multi-ticker dashboards.
## Capabilities
@@ -49,6 +66,10 @@ stop-loss levels — with a data layer and agent interface designed to grow.
request orchestration (data → evaluation → agent), and the report view that
presents fundamentals, valuation reasoning, macro factors, a price chart with
marked entry/exit/stop-loss levels, and the agent's written thesis.
- `cost-controls`: Per-report usage capture and cost computation from a
configurable price table, running spend aggregation, and a configurable monthly
budget guard (soft-threshold warning, hard-cap block) with the numbers surfaced
in the UI.
### Modified Capabilities