A local-only portfolio management system that combines deterministic screening, per-symbol LLM analysis, and a learning loop. It pulls live data from Schwab, screens the Russell 3000 across three risk profiles, and produces a CIO-style daily action plan that goes through a multi-CIO debate. A separate Alpaca paper sleeve, traded by an autonomous Claude executor, tests ideas without touching real capital.
Investment Monitor runs unattended on a single mini PC, reachable over Tailscale. A scheduled task fires the pipeline three times a day. On Saturday one slot becomes a forced full-LLM run after a five-year price backfill; other weekend runs skip the LLM stages. A Flask dashboard surfaces the latest CIO plan, holdings analysis, screener results, and learning-loop metrics.
EXECUTION_ENABLED flag (off by default) gates the paper pipeline. There is no live-trade path: the
live Schwab side is manual approval only, and the code never places live orders.
The whole run is implemented end-to-end in one orchestrator (src/orchestration/daily_run.py),
read top to bottom. The deterministic screener and action engine always cover the full portfolio; the LLM
stages (amber) operate only on a bounded candidate set capped at 90 symbols. The debate takes the
screener's top 25 plus up to 15 gated candidates, and every held position gets its own thesis.
flowchart TD
accTitle: Investment Monitor daily pipeline
accDescr {
Schwab snapshot and tax-lot sync, then resolve universe, then shared data fetch. That feeds the screener (three profiles, also fed by the SEC EDGAR Form 4 insider signal) and the 200-week MA screener. Both lead to performance metrics, then the action engine (x3, with reason codes), then the candidate set builder (cap 90). From there, the LLM chain runs in sequence: analyst, CIO plan, tax-loss-harvesting review, red team, then the multi-CIO debate. The result goes to the decision ledger with outcome scoring, then the email digest, then the strategy engines, whose saved state feeds the next CIO plan. A separate paper sleeve builds its own paper CIO plan, auto-approves it, and a Claude paper executor trades it on Alpaca.
}
A[Schwab snapshot
+ tax-lot sync] --> B[Resolve universe
Russell 3000 + movers + watchlist]
B --> C[Shared data fetch
quotes / fundamentals / prices]
I[SEC EDGAR Form 4
insider-buying signal] --> D
C --> D[Screener x3 profiles
conservative / neutral / aggressive]
C --> E[200-week MA screener]
D --> F[Performance metrics]
E --> F
F --> G[Action engine x3
reason codes + notes]
G --> H[Candidate set builder
cap 90 symbols]
H --> L{{LLM Analyst
per-symbol BUY/HOLD/SELL}}
L --> M{{CIO plan
unified action plan}}
M --> T{{Tax-loss-harvesting review}}
T --> O{{Red-team critique}}
O --> W{{Multi-CIO debate
Value / Momentum / Risk-parity
+ meta-CIO}}
W --> P[Decision ledger
+ outcome scoring]
P --> R[Email digest]
R --> S[Strategy engines
TLH · collars · rotation
duration · dividend · quality-mom]
S -.->|saved state feeds next plan| M
Q{{Paper CIO plan
from Alpaca paper portfolio}} --> U[Auto-approve]
U --> X{{Claude paper executor
within guardrails}}
X --> V[Alpaca
paper sleeve]
classDef llm fill:#fef3c7,stroke:#d97706,color:#000
class L,M,T,O,W,Q,X llm
Deterministic stages cover the full portfolio; amber LLM stages run on the bounded candidate set.
Python 3.12, Flask 3.1 dashboard with 90+ routes and 40 templates surfacing the latest run.
SQLAlchemy 2.0 ORM over a 58-table SQLite database, with schema changes managed by Alembic migrations. All persistence flows through one DataStore layer.
OAuth client for live quotes, fundamentals, and price history, plus holdings. The universe itself comes from the iShares IWV holdings file.
A separate paper sleeve, traded by an autonomous Claude executor and tracked against the live portfolio and SPY.
A provider router pins each stage to OpenAI gpt-4.1-mini (high-volume) or Claude via claude-cli (deep analysis). The Claude CLI also runs the CIO personas, the meta-CIO, position theses and the paper executor.
Research signals feed the agents that screen and contextualise candidates.
A read-only MCP server (MCP 1.17, 34 tools) exposes the system's data for Claude to query directly, over stdio locally and over SSE for remote clients via Tailscale.
Six pluggable sleeve strategies — tax-loss harvesting, dividend capture, options collars, sector rotation, duration, quality-momentum — registered from strategies.yaml behind one Strategy base class.
An insider open-market-purchase counter (transaction code P) over a 90-day window, wired in as an opt-in screening factor and refreshed weekly.
Fires the pipeline three times a day (on Saturday one slot becomes a forced full-LLM run after a five-year backfill; other weekend runs skip the LLM stages), plus a weekly insider-cache backfill.
A typed signal contract (Pydantic), an LLM prompt cache, Alembic migrations, fail-fast config checks, CSRF protection, backups and failure alerts, and about 1,600 automated tests in CI.
A single STAGE_ROUTING table is the source of truth for which stage hits which provider.
High-volume per-symbol and aggregate work — analyst, CIO, narrator, macro, tax — is pinned to
OpenAI gpt-4.1-mini for cost and speed. The deeper red-team critique routes to Claude via the
claude-cli at zero marginal cost, as do the CIO debate personas, the meta-CIO, the
position theses and the paper executor.
llm_traces table — model, tokens, latency, stage —
which the learning loop reads from.
Pull a fresh Schwab snapshot, sync tax lots, then resolve the day's universe: Russell 3000 plus market movers and the personal watchlist.
A shared data fetch feeds three parallel screeners (conservative / neutral / aggressive) using a 16-factor model (Piotroski F-score included) — including an opt-in SEC EDGAR insider-buying signal — alongside a once-daily 200-week moving-average screen.
The action engine turns scores into BUY/HOLD/SELL calls per profile, and its own reason codes and notes explain each call.
Holdings, today's actions, screen hits, 200-week retests, and pinned names are merged into a bounded candidate set (capped at 90 symbols) — the only thing the expensive LLM stages see. The debate takes the screener's top 25 plus up to 15 gated candidates, and every held position gets its own thesis.
A per-symbol LLM analyst issues BUY/HOLD/SELL with conviction; a CIO plan ranks them into one unified plan plus a watchlist; a tax-loss-harvesting review and a red-team pass critique it; then a multi-CIO debate (Value, Momentum and Risk-parity Claude personas plus a meta-CIO) settles it, with hard gates computed in Python.
Decisions are written to a ledger with outcome scoring, and a digest email goes out.
Six registered sleeve strategies — tax-loss harvesting, dividend capture, options collars, sector rotation, duration, and quality-momentum — evaluate the portfolio after the ledger and digest. The state they save is what the next CIO plan reads.
Separately, the paper sleeve builds its own CIO plan from the Alpaca paper portfolio and auto-approves it. An autonomous Claude paper executor trades it within guardrails, and paper returns are tracked against the live portfolio and SPY.