Skip to content

Instantly share code, notes, and snippets.

@dzuluaga
Last active May 16, 2026 03:34
Show Gist options
  • Select an option

  • Save dzuluaga/89c7f1bd4062cff29bbcfa65af6d77e3 to your computer and use it in GitHub Desktop.

Select an option

Save dzuluaga/89c7f1bd4062cff29bbcfa65af6d77e3 to your computer and use it in GitHub Desktop.
AI-Powered Finance Council — 4 Model Investment Framework with Karpathy Wiki Method

AI-Powered Finance Council — V2

A multi-model AI investment framework built in Claude Code. Uses 5 different AI model providers (Grok, Codex, Claude Sonnet, Gemini Pro, Claude Opus) to analyze stock picks, manage staged deployments, and automate daily portfolio briefings — with a 6th adversarial review pass.


⚠️ Disclaimer / Not Financial Advice

This document describes a personal AI-assisted investment framework built for the author's own portfolio. It is shared for educational and informational purposes only.

  • I am NOT a registered investment advisor (RIA), broker-dealer, or financial professional.
  • This is NOT investment advice, financial advice, tax advice, legal advice, or a recommendation to buy/sell any security.
  • All references to specific tickers, percentages, or strategies are illustrative examples from one personal portfolio context.
  • Past performance is not indicative of future results. AI models can be wrong. Markets are unpredictable.
  • You are solely responsible for your investment decisions. Consult a licensed financial advisor and tax professional before acting on anything you read here.
  • The author assumes no liability for any losses, damages, or consequences arising from use of this framework.

Use at your own risk. If you can't afford to lose the money, don't invest it.


Track record (as of 2026-05-12)

Receipts for the framework on my personal portfolio over the first ~8 weeks of decisions (Mar 21 – May 12, 2026):

Metric Value
Filled trades tracked 12
Weighted return vs SPY (excess) +57.73%
Trades that beat SPY 11 of 12
SKIP accuracy (was skipping right?) 5 of 15 (33%)
Tracking window ~8 weeks

Honest qualifiers — read these before quoting the headline

  • Small sample. 12 fills is not a statistically robust record.
  • Concentration. 5 of 12 fills are CRDO at various dips during a 100%+ run. The headline is meaningfully a CRDO story, not 12 independent calls.
  • Bull-market window. SPY itself ran +12% over the same 5-week segment; "filled GTC" selects for stocks that moved.
  • SKIP side is weaker. Only 33% of skips were right — the framework's BUY discipline outperformed its SKIP discipline. This is a known weakness I'm tuning.
  • Methodology. "Excess return" = my fill return − SPY return over the same hold period, position-weighted across filled GTCs.

Past performance does not predict future returns. This is a personal track record on my own capital, not advice or a solicitation.


How It Works

This system uses Seeking Alpha's Alpha Picks (+405% vs S&P +94% inception, May 2026) as the primary signal source, then runs every recommendation through a 5-model council before deploying capital.

The Council (V2 — 5 strategists + Delta)

Role Model Provider Lens
Alpha — Macro/Sentiment grok-4.20 xAI (Responses API via curl) Macro + X/Twitter live + Polymarket
Beta — Fundamentals gpt-5.5 OpenAI (Codex CLI 0.125+, -c model="gpt-5.5") Valuation + 13F super-investors + earnings
Gamma — Technical claude-sonnet-4-6 Anthropic (Agent tool, model: "sonnet") RSI/MAs + support/resistance + execution math
Epsilon — Sector/Supply Chain gemini-3-pro-preview Google (Gemini CLI 0.34+) Customer concentration + supply chain + sector regime
Delta — Devil's Advocate claude-opus-4-7 Anthropic (Agent tool, model: "opus") Adversarial review of all 4 strategists

All 4 strategists run in parallel (~5-7 min wall clock). Delta runs after to stress-test their recommendations. Every buy requires majority approval + Delta sign-off.

Why split Sonnet/Opus across two Claude roles: Ensures 5 truly different model providers. Gamma's structured-data tasks (RSI, share-count math) fit Sonnet 4.6's ceiling. Delta keeps Opus 4.7 because its veto can overturn 4 strategists — adversarial-reasoning depth matters most there.

Models attempted but unavailable (verified 2026-04-28)

  • Gemini bare names without -preview suffix: All 404 (gemini-3-pro, gemini-3.1-pro, gemini-2.5-pro-latest). Use -preview variants.
  • OpenAI on ChatGPT auth: gpt-5-pro, o3, o3-pro, gpt-5-codex, gpt-5-thinking all blocked. The -m flag rejects models on ChatGPT auth, but -c model= config override works.
  • xAI: Only grok-4.20 and grok-4-latest resolve. grok-5, grok-4-20, grok-4.2, grok-4.1 all fail.

Multi-Pass Ensemble Methodology (NEW)

For high-stakes decisions (large per-decision deployment, strategic NW changes), run 5 parallel ensemble passes with different framings:

Pass Framing
1 Top picks within current AP framework (AI infra/conviction)
2 Top risk-adjusted (any sector)
3 Top contrarian discount entries (negative from pick)
4 Top momentum compounders (RSI <70, healthy uptrend)
5 Top sector diversification picks (away from concentration)

Phase 1: Broad screen

Dispatch 5 parallel Sonnet agents (one per framing) → returns ~25 candidate names.

Phase 2: Convergence aggregation

Names appearing in 3+ passes = high confidence. Names in 1 pass = noise. Build convergence matrix.

Phase 3: Multi-model deep dive on top 7 convergence candidates

Real 4-strategist council ranks survivors independently (each forms unbiased opinion before sharing).

Phase 4: Delta adversarial synthesis

Opus model challenges all 4 strategist outputs. Issues APPROVE / CHALLENGE / VETO per recommendation.

Phase 5: User decision

Final convergence-validated picks with $ allocations, limit prices, risk controls.

Wall-clock time: ~10-15 min for full 5-pass + multi-model + Delta synthesis.


Signal Rules

  1. Alpha Picks is the primary index — only buy Strong Buy or Buy rated names
  2. Strong Buy > Buy > Hold — prioritize higher ratings for new capital
  3. Hold = stop buying, consider trimming
  4. Closed by AP = EXIT immediately, no exceptions
  5. Sell rating = EXIT immediately

Hard Rules (Non-Negotiable)

  1. VIX > 30 → PAUSE all deployments
  2. VIX > 22 → PAUSE taxable account deployments (tax-free can proceed)
  3. Never deploy all cash at once — weekly DCA cadence
  4. Per-name 2% NW cap — concentration discipline (was 15% per account, NOW 2% NW)
  5. SPY 5yr benchmark filter — apply uniformly:
    • 24+ pts margin = decisive PASS
    • 10-24 pts margin = CHALLENGED (skip per consistency)
    • <10 pts margin = clear FAIL (value trap)
  6. Source verification gate — verify ratings live within 24 hours, paste evidence into council brief
  7. No buys 5 days before earnings — binary risk
  8. RSI <70 required for new buys

DCA Strategy & Buy Execution

Staged 3-Tier Limit Ladder (NEW)

For new positions, use 3-tier limit ladder instead of market orders:

Tier Price Logic
Tier 1 Current or slightly below Initial entry, captures conviction
Tier 2 -3-5% below market Better blended cost on dips
Tier 3 -7-10% below market Cascade catch on real selloff

Example pattern: Staged buy across three descending limits → blended cost during the cascade. If only Tier 1 fills, you got the conviction trade. If all three fill, you got a better blended cost during a selloff.

Other Execution Rules

  • Steady weekly cadence into Alpha Picks Strong Buy names
  • Buy on red days, not green days — counter-cyclical entries
  • Don't chase gap-up days (>3%) — wait for pullback
  • Don't chase +10% single-day moves — usually short squeezes
  • Midday 11AM-2PM ET is calmest execution window
  • No deployment on quad-witching days — wait for Monday

Account Priority

Tax-free accounts first (zero capital gains impact):

  1. PCRA (employer retirement plan) — best for aggressive reallocation
  2. Traditional IRA — tax-deferred
  3. Roth IRA — tax-free forever, highest conviction picks here
  4. RRSP (Canadian) — tax-sheltered
  5. Taxable accounts — only when VIX < 22, use ETFs (SPY/QQQ) for lower tax drag

Aggressive accounts (individual): 70% individual AP Strong Buy stocks / 30% SPY Conservative accounts (spouse): 85% SPY / 15% QQQ


Sell Framework — 6 Tiers

Tier Trigger Action Urgency
1 AP signal change (Sell/closed/downgrade) Trim/exit Immediate
2 Concentration breach (>2% NW per name) Trim to cap Within week
3 Thesis break (customer loss, fraud, exec dep) Exit fully Immediate
4 Risk-based stops (-15-20% from cost) Stop-loss exit Auto-trigger
5 Pre-binary catalyst (earnings, FDA) Partial trim 25% Strategic
6 Tax optimization (Dec) Harvest losses Year-end

Sell-into-strength vs stop-loss distinction (NEW)

Order Type Direction Place as actual order?
LIMIT SELL (capture rallies) ABOVE market ✅ YES — place GTC
Stop-loss (flash crash protection) BELOW market ❌ NO — mental rule only

Rationale: Stop orders execute terribly during volatile open auctions. Algos run stops to capture forced selling. Mental stops > placed stops.


Devil's Advocate Checklist

Every buy recommendation must survive these 8 checks:

  1. Price Action Reality — Is this asset actually going UP in the current environment?
  2. Thesis vs Reality — Is the textbook framework working RIGHT NOW? (Gold crashed during an oil shock — textbook was wrong)
  3. Concentration Check — Does this increase tech/AI overweight? Better off in cash?
  4. Conviction Check — Would I actually want to own this for 3-5 years?
  5. Timing Check — Why buy TODAY vs waiting 1 week? What do I lose by waiting?
  6. SPY Benchmark — Has it beaten SPY over 5 years? If not, why take single-stock risk?
  7. SEC Filing Check — Any insider selling, executive departures, share dilution?
  8. Contrary Scenario — How does this trade lose 20%+ in 30 days? How likely is that?

Verdict options: APPROVE / CHALLENGE / VETO

A Delta VETO on a unanimous (3-0) BUY downgrades it to WAIT.


Behavioral Red Flags (NEW — auto-monitored)

The framework actively monitors for behavioral patterns that historically destroy wealth:

Pattern 1: VRT Scar Tissue

  • Off-framework single-stock buy + multi-model consensus + thematic story
  • Even when outcome is positive, the PROCESS damages future discipline

Pattern 2: Adoption-by-FOMO

  • Margin loan request + concentrated AI bet + "expand framework to permit"
  • Documented as the exact pre-blow-up sequence

Pattern 3: Multiple "should I buy?" in single day

  • Each individually defensible
  • Together = FOMO chase mode after recent fills

Pattern 4: Concentration creep

  • Off-framework legacy positions growing past 2% NW cap
  • "This time it's different" rationalizations

Pattern 5: Selling winners + buying back cheaper

  • Tax friction destroys returns
  • Wash sale rules forfeit losses
  • Statistical edge is negative for active swing traders

Crypto Satellite Bucket Rules (NEW)

  • Total crypto cap: ≤4-5% NW
  • Composition: BTC primary (60-70%), ETH secondary (20-30%), SOL/other satellite (≤10%)
  • DCA mandatory: Monthly buys regardless of price
  • No panic ramps: Adding 2% NW in single transaction = behavioral red flag
  • Exit triggers: Sector-wide capitulation, regulatory events, framework discipline only

Pre-Framework Legacy Positions (NEW)

Holdings acquired before framework codification get special treatment:

  • Hold-only: No new buys to legacy positions
  • Trim if over cap: Apply 2% NW per-name discipline regardless of acquisition timing
  • Trim into strength: Place LIMIT SELL above market, never below
  • Tax-favored accounts: Prefer trimming in IRA/Roth where possible

Lessons Learned (10 — updated)

These were discovered through real trading mistakes:

  1. A "hedge" must actually be hedging. All 3 AI models recommended gold miners during an oil shock. Gold was crashing -3.5%/day. The "hedge" fell faster than the portfolio. Always check: is this asset ACTUALLY going up during the crisis?

  2. Multi-model consensus has blind spots. 3 different AI models (Gemini, OpenAI, Claude) all made the same mistake because they share training data bias. That's why the Devil's Advocate exists.

  3. Break-even is not an edge. Just because a position recovered to your cost basis doesn't mean you should add more. Wait for a breakout or a reset.

  4. Limits fail in falling markets… until they don't. Setting limit orders during a selloff CAN catch falling knives. BUT: a 3-tier staged ladder caught a 7% post-earnings dip beautifully. Method matters — single limit = catching knife; staged ladder = systematic dip-catch.

  5. Forward P/E matters more than trailing. A stock with 20x trailing P/E but 5x forward P/E is cheap, not expensive.

  6. Customer concentration is real risk. One company had 87% of revenue from 2 customers. Great business, terrible risk profile for a large position.

  7. Alpha Picks exits mega-caps too early. AP closed Alphabet at +19% — it went on to +259%. AP closed Meta at +72% — it went on to +300%. Trust your own conviction on names you know deeply.

  8. Gap-up days historically underperform. Buying SPY on days it gaps up >2% delivers below-average 1-week forward returns.

  9. Apply the SPY 5yr filter UNIFORMLY (NEW). Don't reject Name A for marginal SPY beat then accept Name B with similar margin. NEM (99% 5yr) and EAT (109% 5yr) both fail by your standards — pick consistency over case-by-case.

  10. Gist data is stale data (NEW). Don't recommend trimming positions you don't own. Audit portfolio file regularly. Source verification gate prevents recommendations on stated/remembered ratings — verify live within 24 hours.


Multi-Source Intelligence Stack

Real-Time Data Layer

Tool Source Purpose
fetch-prices.js Finnhub API Real-time prices, RSI, volume
fetch-polymarket.js Polymarket Gamma API Prediction market signals (no auth)
fetch-sec-filings.js SEC EDGAR Insider Form 4s, 8-K filings
earnings-calendar.js Custom aggregator Earnings dates (5-day blackout)
portfolio-dashboard.js Local portfolio file Position values, sector allocation
monte-carlo.js Custom Monte Carlo $10M target probability projection
covered-call-calc.js Options chain data Premium estimates 100+ share lots

Polymarket Integration (NEW)

Polymarket macro signals integrated for every council run:

  • Iran/geopolitical de-escalation odds
  • Fed rate cut probabilities
  • Trump-China visit / tariff peace odds
  • BTC moonshot priced odds
  • AI bubble burst by year-end odds

Sentiment Layer

  • X/Twitter live access via Grok (xAI native integration)
  • FinTwit handles tracked: @dylan522p (SemiAnalysis), @KobeissiLetter, @Beth_Kindig, @markminervini
  • Cite handles in council briefs for source verification

Smart Money Layer

  • Quarterly 13F filings (~45-day delay): Druckenmiller, Tepper, Coleman, Loeb, Klarman, Ackman, Burry, Pabrai
  • Convergence signal: 3+ super investors accumulating same name = strong signal

Automated Pipeline

The system runs daily with minimal human intervention:

Time What How
6:00 AM Full morning briefing claude -p via cron — reads Gmail (Seeking Alpha emails), fetches prices, checks SEC filings, checks congressional trading, creates Gmail draft
9:00 AM PT (16:00 UTC) Daily Council Changes briefing Remote Claude agent — emails portfolio diff vs AP changes
On demand /finance-council Full 5-model council + Devil's Advocate
On demand /finance-council.morning-briefing Quick briefing with Gmail + prices + red flags
On demand /finance-council.daily-changes Compare current portfolio vs latest AP ratings
Weekly 5-pass ensemble run Strategic NW review

Tools Built

Tool What It Does
Price Fetcher Real-time quotes via Finnhub API
SEC Filing Checker Insider selling, 8-K filings from EDGAR
Portfolio Dashboard Total NW, P&L, sector allocation, concentration flags
Earnings Calendar Upcoming earnings dates, 7-day alerts
Monte Carlo Simulator Probability of reaching target NW
Covered Call Calculator Black-Scholes premium estimates
Council Decision Log Every buy/sell with reasoning, fill prices, P&L tracking
Polymarket Fetcher (NEW) Macro/geopolitical prediction market signals
Finance Wiki 68+ ticker pages with council history, auto-synced
Wiki Sync Auto-updates wiki from JSON data sources

Data Sources

Source What Integration
Alpha Picks (Seeking Alpha) Stock picks + ratings Gmail MCP + manual paste + scraper
Finnhub Real-time stock prices API (free tier)
SEC EDGAR Insider transactions, filings API (free)
Grok (xAI) X/Twitter sentiment Responses API
Codex (OpenAI gpt-5.5) Fundamental research CLI
Gemini 3 Pro (Google) Sector/supply-chain (NEW) CLI
Polymarket (NEW) Macro/geopolitical odds Gamma API
Capitol Trades Congressional stock trading WebSearch
13F filings Super-investor positioning WhaleWisdom / GuruFocus

Knowledge Base: Karpathy's LLM Wiki Method

This system uses Andrej Karpathy's LLM Wiki pattern as its knowledge layer. Instead of re-deriving insights from raw data every conversation, the LLM incrementally builds and maintains a persistent wiki — structured, interlinked markdown files that compound knowledge over time.

Reference: Karpathy's LLM Wiki Gist

Architecture

Raw Sources (JSON data)  →  Wiki (Markdown)  →  Schema (SCHEMA.md)
  prices                      ticker pages        rules for how
  alpha picks                 weekly reviews      the LLM maintains
  council logs                decision journal    everything
  earnings                    theses
  SEC filings                 risk register
  polymarket                  catalyst calendar

Three layers:

  1. Raw Sources (data/) — JSON files from APIs, scrapers, council logs. Immutable source of truth.
  2. The Wiki (wiki/) — LLM-generated markdown pages. Ticker pages, decision logs, weekly reviews. The LLM owns this entirely — it creates, updates, and cross-references all pages.
  3. The Schema (wiki/SCHEMA.md) — Tells the LLM how the wiki is structured, what conventions to follow, and what workflows to run when ingesting new data.

How It Works for Finance

  • Ticker pages (one per stock) with YAML frontmatter: shares, cost basis, Alpha Picks rating, council vote history, earnings dates, key risks
  • Decision pages auto-generated from council-log.json after every council session
  • Weekly reviews summarizing deployments, P&L, lessons learned
  • Human-editable sections marked with <!-- human --> tags are never overwritten by automation
  • wiki-sync.js reads all JSON data files and generates/updates wiki pages automatically

Why This Matters

Without the wiki, every conversation starts from scratch — the LLM re-reads JSON files, reconstructs portfolio context, and rediscovers insights. With the wiki, there's one canonical page per stock with every council vote, every fill, every lesson. The LLM reads one page and is fully caught up.

The wiki is just a git repo of markdown files. You get version history, branching, and collaboration for free. Open it in Obsidian for graph view visualization.

Required Dependency

This system requires the Karpathy LLM Wiki pattern to function properly. When setting up, Claude Code should:

  1. Create wiki/ directory with SCHEMA.md, index.md
  2. Create wiki/tickers/ for per-stock pages
  3. Build wiki-sync.js to auto-populate from JSON data sources
  4. Configure the finance council skill to read wiki pages before launching strategists
  5. Run wiki-sync after every data refresh (scrape, council session, price fetch)

Without the wiki, the council operates in "stateless mode" — functional but without compounding knowledge. With the wiki, every session builds on all previous sessions.


How to Set Up Your Own

Prerequisites

  • Claude Code (Anthropic CLI)
  • Codex CLI (OpenAI) — npm install -g @openai/codex (v0.125+)
  • Gemini CLI (Google) — for gemini-3-pro-preview access (NEW)
  • xAI API key (for Grok) — console.x.ai
  • Finnhub API key (free) — finnhub.io
  • Seeking Alpha Alpha Picks subscription
  • macOS Keychain for API key storage

Installation

  1. Create the project:
mkdir -p finance-council/{data,wiki,scripts/{scrapers,analysis,automation},lib}
cd finance-council
npm init -y
npm install playwright
pip3 install yfinance
  1. Store API keys in macOS Keychain:
security add-generic-password -a "$USER" -s "XAI_API_KEY" -w "your-xai-key"
security add-generic-password -a "$USER" -s "FINNHUB_API_KEY" -w "your-finnhub-key"
  1. Add to ~/.zshrc:
export XAI_API_KEY=$(security find-generic-password -a "$USER" -s "XAI_API_KEY" -w 2>/dev/null)
export FINNHUB_API_KEY=$(security find-generic-password -a "$USER" -s "FINNHUB_API_KEY" -w 2>/dev/null)
  1. Install and configure CLIs:
# Codex CLI (gpt-5.5)
npm install -g @openai/codex@latest

# Gemini CLI (gemini-3-pro-preview)
# Install per Google's docs, then verify:
gemini --skip-trust -m "gemini-3-pro-preview" -p "test"
  1. Copy this CLAUDE.md into your project and tell Claude Code:

"Set up the finance council based on this CLAUDE.md. Create all skills, tools, wiki schema, and the morning briefing cron."

Claude Code will build everything — the skills, the tools (price fetcher, SEC checker, dashboard, Monte Carlo, earnings calendar, covered call calculator, polymarket fetcher, wiki-sync), the wiki schema, and the cron automation.

  1. Set up the 6AM cron:
crontab -e
# Add: 0 6 * * 1-5 /path/to/finance-council/scripts/automation/morning-council.sh
  1. Initialize the wiki:
npm run wiki-sync
  1. Start running:
# Morning briefing
/finance-council.morning-briefing

# Full council with 5 AI models
/finance-council $N PCRA

# 5-pass ensemble (high-stakes decisions)
/finance-council ensemble $N

The system improves over time — every council session adds to the decision log and wiki, compounding your knowledge base. After a few weeks, the wiki has enough history to spot patterns, flag recurring mistakes, and make increasingly informed recommendations.


How to Use This With Claude Code, Cursor, or Other AI Agents

This framework is designed to be portable across AI agent platforms. Below are setup paths for the most common environments.

Option 1: Claude Code (recommended — fully native)

The system was built in Claude Code and uses its skill system + Agent tool natively.

Setup steps:

  1. Install Claude Code: npm install -g @anthropic-ai/claude-code
  2. Clone or copy this framework into a directory: ~/finance-council/
  3. Save the V2 markdown below as CLAUDE.md in that directory:
    cp /path/to/CLAUDE-SHAREABLE-V2.md ~/finance-council/CLAUDE.md
  4. Open a Claude Code session and tell it:

    "Read the CLAUDE.md in this directory. Set up the finance council framework — create the skills, install dependencies, build the wiki schema, and configure the morning briefing cron. Ask me before adding any API keys to my keychain."

  5. Claude Code will:
    • Create ~/.claude/skills/finance-council/SKILL.md (council orchestration)
    • Create ~/.claude/skills/finance-council.morning-briefing/SKILL.md
    • Create ~/.claude/skills/finance-council.daily-changes/SKILL.md
    • Build all the tools (fetch-prices.js, fetch-polymarket.js, etc.)
    • Set up wiki-sync.js and the Karpathy LLM Wiki structure
  6. Invoke with slash commands:
    /finance-council [amount] [account]      # Full 5-model council
    /finance-council.morning-briefing         # Daily briefing
    /finance-council.daily-changes            # Portfolio vs AP rating diff
    

Option 2: Cursor

Cursor doesn't have native skills, but the framework adapts via system prompts.

Setup:

  1. Save V2 markdown as .cursorrules in your project root
  2. Cursor reads .cursorrules and applies framework to all chat sessions
  3. Build the tools (Node.js scripts) the same way as Claude Code
  4. Invoke via natural language:

    "Run the finance council for $N in PCRA"

  5. Cursor's Composer mode can dispatch parallel agent calls (similar to Claude Code's Agent tool)

Limitation: Cursor's parallel dispatch is less robust than Claude Code's Agent tool. The Phase 1 ensemble (5 parallel Sonnet runs) may need to be sequential.

Option 3: Codex CLI / GPT-5 only

If you want a single-model version (no multi-provider council), Codex can run a simplified council.

Setup:

  1. Install: npm install -g @openai/codex@latest (need 0.125+)
  2. Use codex exec --skip-git-repo-check -c model="gpt-5.5" "..." for one-shot calls
  3. Adapt the council to run 4 sequential gpt-5.5 calls with different system prompts (Macro/Fundamentals/Technical/Devil's Advocate)
  4. Trade-off: Same model = same training data biases = consensus blind spots. Less robust than multi-provider.

Option 4: Aider, OpenHands, or other coding agents

These work as code-execution agents, not orchestrators. Use them to BUILD the framework, then run the framework manually:

  1. Aider/OpenHands creates the scripts based on V2 spec
  2. You manually invoke node fetch-prices.js, gemini -p "...", curl xAI, etc.
  3. Less automated but still functional

Option 5: Mix-and-match (advanced)

Many users combine:

  • Claude Code as orchestrator (slash commands + Agent tool)
  • Codex CLI as Beta strategist (codex exec)
  • Gemini CLI as Epsilon strategist (gemini -p)
  • Curl + xAI Responses API as Alpha strategist
  • Cursor for fast script edits / debugging

This is exactly how the framework runs in production. Each tool plays to its strengths.


MCP Server Integration (optional but powerful)

If you use MCP-compatible agents (Claude Desktop, Claude Code), wire up these MCP servers for additional capability:

MCP Server What It Adds
Gmail (claude.ai connector) Read Seeking Alpha emails, draft morning briefings
Google Calendar Track earnings dates, FOMC, council meetings
Google Drive Store wiki backups, share spreadsheets
GitHub Version-control the wiki, auto-publish gists

Connect via Claude Code Desktop → Settings → MCP, or via claude mcp add.

The morning-briefing skill specifically uses Gmail MCP to read SA email digests automatically. Without it, you paste manually.


Remote Agent Triggers (advanced — runs even when you're sleeping)

If you have access to Claude Code Remote Triggers (cloud agents that run on schedule):

// Daily Council Briefing — runs 9am PT weekdays
{
  "name": "Finance Council Daily Briefing",
  "cron_expression": "0 16 * * 1-5",  // 16:00 UTC = 9am PT
  "session_context": {
    "model": "claude-sonnet-4-6",
    "allowed_tools": ["Bash", "Read", "Write", "WebSearch", "WebFetch"]
  },
  "mcp_connections": [
    { "name": "Gmail", "url": "https://gmailmcp.googleapis.com/mcp/v1" }
  ],
  "events": [{
    "data": {
      "message": {
        "role": "user",
        "content": "Run /finance-council.daily-changes and email summary to me at <your-email>"
      }
    }
  }]
}

This sends you a daily email with: AP rating changes, sell signals on your holdings, pending GTC status, market context, and one-line action items. Runs automatically Mon-Fri, no human input needed.


How to Adapt for Your Own Investing Style

This framework was built for a tech-tilted growth investor targeting meaningful CAGR over a multi-year horizon. It can be adapted:

For value investors

  • Replace SPY 5yr filter with Greenblatt Magic Formula (high earnings yield + high ROIC)
  • Replace AP signal source with Buffettology screen or GuruFocus quant
  • Increase per-name cap to 5-8% NW (Buffett-style concentration)
  • Drop AI-specific language; broaden to "moat-rated" stocks

For dividend / income investors

  • Replace SPY benchmark with dividend yield + 5yr DGR filters
  • Add covered call calculator as primary income generator (already in tools)
  • Lower per-name cap to 1-2% (yield-focused = max diversification)
  • Add REIT/MLP-specific filters

For crypto-heavy / DeFi investors

  • Replace AP with Messari ratings or Token Terminal fundamentals
  • Add on-chain signals (Glassnode, Nansen)
  • Adjust crypto satellite cap upward (this framework caps at 4-5% NW)
  • Add MEV / DEX-specific risk filters

For day-traders or short-term holders

  • This framework is NOT for you. Average holding period assumed: months to years.
  • Day-traders need different tools: Level 2, options flow, real-time news scrapers.

How Other People Actually Use This

Documented use cases from people who've adopted variants of this framework:

  1. Solo retail investor (most common): Runs /finance-council weekly to validate buy decisions, uses morning briefing to track AP changes
  2. Family office assistant: Adapted as decision-support layer for principals; advisor still makes final calls
  3. Investment club facilitator: Multiple members feed positions in, council generates consensus weekly newsletter
  4. AAIF agentic AI researcher: Uses framework as production example of multi-agent orchestration in real domain
  5. AI engineer building fintech product: Studies the framework as design pattern for cross-provider orchestration in their own product

You don't need to use it the way I use it. Adapt to your situation.


Cost Breakdown (per council run)

What does running this framework actually cost? Real numbers from production usage:

Tier Cost per run What it covers
Single council pass (4 strategists + Delta) $0.50 – $2.00 One investment decision
5-pass ensemble (broad screen + multi-model deep dive + Delta) $3.00 – $8.00 Strategic NW review
Daily briefing (cron, runs 5x/week) $0.10 – $0.30/day = ~$2-6/month Morning portfolio diff

Per-model costs

Model Approx cost per call Tokens used
Grok 4.20 (xAI) $0.05 – $0.20 5K-15K input, 1K-3K output
GPT-5.5 (Codex CLI on ChatGPT auth) $0 (subscription-bundled) N/A — flat ChatGPT Pro fee
Claude Sonnet 4.6 (Anthropic) $0.10 – $0.50 30K-60K agent tokens
Gemini 3 Pro Preview (Google) $0.05 – $0.30 5K-15K input, 1K-3K output
Claude Opus 4.7 (Anthropic) $0.25 – $1.00 30K-65K agent tokens

Annual cost estimate

Assuming you run:

  • Daily briefing weekday mornings: $3-8/month = **$50-100/year**
  • Weekly council pass: $2/run × 52 = **$100/year**
  • Monthly 5-pass ensemble: $5/run × 12 = **$60/year**

Total annual API cost: ~$210-260/year (assuming you have ChatGPT Pro for Codex, otherwise +~$200/year)

Cost vs benefit framing

Rough math on a $1M portfolio:

  • Framework costs: ~$250/year = 0.025% of portfolio
  • Typical RIA fee: 1.0% of AUM = $10,000/year
  • Robo-advisor fee: 0.25% of AUM = $2,500/year

This framework costs ~1/40th of an RIA and ~1/10th of a robo-advisor — and you get adversarial multi-model analysis the RIA doesn't provide.

(Disclaimer: RIAs offer human accountability and fiduciary duty. The framework doesn't replace that.)


Common Errors + Fixes

Real issues encountered + solutions:

Codex CLI: "Model gpt-5.5 not supported on ChatGPT account"

Error: gpt-5-pro / o3 / gpt-5-codex not supported

Cause: Using -m flag rejects models on ChatGPT auth.

Fix: Use -c config override instead:

codex exec --skip-git-repo-check -c model="gpt-5.5" "your prompt"

The -m flag rejects, but -c model= config override works. Stuck on this for hours before discovering it.

Codex CLI: "Requires a newer version of Codex"

Fix: Upgrade:

npm install -g @openai/codex@latest
# Verify: codex --version (need 0.125+)

Gemini CLI: MODEL_CAPACITY_EXHAUSTED / HTTP 429

Error: No capacity available for model gemini-3.1-pro-preview

Cause: Common during US business hours; Google rate-limits new preview models.

Fix chain (try in order):

  1. gemini --skip-trust -m "gemini-3.1-pro-preview" -p "..."
  2. Fall back to gemini-3-pro-preview (more reliable)
  3. Last resort: gemini-2.5-pro

Gemini CLI has built-in retry/backoff but not bulletproof. Be ready to retry with next-tier model.

Gemini CLI: 404 on bare model names

Cause: All Gemini bare names without -preview suffix return 404 on most accounts.

Don't use: gemini-3-pro, gemini-3.1-pro, gemini-2.5-pro-latest, gemini-exp-1206

Use: gemini-3-pro-preview, gemini-3.1-pro-preview, gemini-2.5-pro

xAI Grok: JSON parse errors on response

Python error: json.decoder.JSONDecodeError

Cause: Grok occasionally returns non-JSON or partial responses.

Fix: Use heredoc with @- for stdin payload:

curl -s -X POST https://api.x.ai/v1/responses \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $XAI_API_KEY" \
  -d @- <<'JSON' > /tmp/grok.json
{"model":"grok-4.20","input":[{"role":"user","content":"..."}]}
JSON
python3 -c "import json,sys; d=json.load(open('/tmp/grok.json')); ..."

Don't pass JSON inline via shell — quoting issues cause failures. Use file-based payloads.

Claude Code Agent tool: parallel dispatch overwhelms

Cause: Dispatching 20+ Agent calls simultaneously can hit rate limits or timeout.

Fix: Phase the dispatch:

  • Phase 1: 5 parallel calls
  • Wait for completion
  • Phase 2: Next batch

Or use run_in_background: true for long-running ones.

Finnhub: NaN values in JSON response

Python error: Unexpected token 'N' in JSON

Cause: Finnhub returns NaN for crypto tickers in some response fields.

Fix: Pre-process the response to replace NaN before parsing:

const text = response.data.replace(/NaN/g, 'null');
const data = JSON.parse(text);

Portfolio data goes stale silently

Cause: Manual scrapes don't catch all accounts. Account changes (sales, transfers) aren't reflected.

Fix:

  1. Add _needsVerification field in portfolio JSON
  2. Run weekly portfolio audit (compare scraped data to memory of recent transactions)
  3. Periodically check: "Do I still own X?" (you may have sold months ago)

This actually happened — framework recommended trimming WULF that was sold long ago.


Sample Council Output (sanitized)

What does a real council run look like? Here's a sanitized example for context.

User input

/finance-council $N decision: AP Strong Buy name X just had earnings 
beat (rev +90% YoY). Stock dipped -7% AH. Should we deploy?

Phase 1: Data fetch (auto)

  • Real-time price: $X
  • VIX: 17.29 (calm)
  • RSI: 66.4 (healthy)
  • Earnings calendar: clear (just reported)
  • SEC filings: no insider sales >$1M last 30 days

Phase 2: Strategist outputs (parallel ~5 min)

Alpha (Grok): "BUY at limit -3% from current. Multi-broker PT raises today. X/Twitter sentiment positive. Conviction 8/10." (cites @handle1, @handle2)

Beta (gpt-5.5): "VETO at current price. Forward P/E 50x = stretched even on raised guide. Add only if -15% pullback. Conviction 5/10."

Gamma (Claude Sonnet): "BUY staged at 3 tiers: market / -5% / -10%. RSI 66 healthy. 12/12 MAs bullish. Conviction 7/10."

Epsilon (Gemini): "BUY but small. Customer concentration risk (~62% one customer) caps sizing. Conviction 6/10."

Phase 3: Delta adversarial synthesis (~3 min)

Delta (Claude Opus):

"Council convergence: 3/4 BUY with caveats. Beta's $155 VETO is unrealistic (would need 15%+ drop in low-VIX tape). Epsilon's customer concentration is real but priced in.

RECOMMENDATION: Stage 3 tiers @ market / -5% / -10%, total $N. Stops at -15% from blended cost. Pre-define exit at +25% or AP downgrade.

Top 3 risks: 1) Customer concentration cliff, 2) Sector rotation away from AI infra, 3) Pre-NVDA earnings volatility could drag sector.

APPROVE with sizing discipline."

Phase 4: Final orders generated

Tier 1: LIMIT $P₁ × N₁ sh = $T₁ (Schwab PCRA)
Tier 2: LIMIT $P₂ × N₂ sh = $T₂ (RH Trad IRA)
Tier 3: LIMIT $P₃ × N₃ sh = $T₃ (Flexible)
Stop-loss: mental, $S (-15% blended)
Exit: AP downgrade or +25% target

Result tracking

After execution, council-log.json updated with reasoning, fill prices, and ongoing P&L.


Performance Benchmarks

How long does each phase take in production?

Single council run

Phase Wall clock API tokens
Data fetch (prices, polymarket, SEC) 30-60 sec minimal
4 strategists in parallel 3-7 min high
Delta synthesis 2-4 min high
Final synthesis + logging 30 sec low
Total ~6-12 min ~150K-300K tokens

5-pass ensemble

Phase Wall clock
Phase 1: 5 parallel Sonnet runs 4-6 min
Phase 2: Convergence aggregation manual review
Phase 3: Real 4-strategist deep dive 5-7 min
Phase 4: Delta synthesis 2-4 min
Total ~12-18 min

Daily briefing

Phase Wall clock
Gmail read + parse 30 sec
Price fetch (20 tickers) 15 sec
AP rating diff vs portfolio 30 sec
Email draft generation 1 min
Total ~2-3 min

Bottlenecks

  1. Gemini rate limits during US business hours (often slowest)
  2. Codex CLI cold start (~15-30 sec for first call)
  3. Parallel dispatch overhead in Claude Code Agent tool (~10 sec)

Why Multi-Model? (vs ChatGPT alone)

The honest argument for going through this much trouble:

Single-model limitations (documented)

When all 4 strategists were Claude (no multi-provider), the framework recommended:

  • Gold miners during oil shock (gold was -3.5% while oil was +5%)
  • AI optical names at peak euphoria (no skeptic)
  • Concentrated bets without challenging concentration

Why? Same model = same training data biases = consensus blind spots.

Multi-model wins (real examples)

Decision Single-model verdict Multi-model verdict Outcome
Add to MU at RSI 86 "Buy, AP Strong Buy" VETO (Beta + Delta on RSI overheat) MU corrected -10% next week
GEV trim @ $1,095 "Hold, momentum strong" TRIM (4/4 unanimous on cap discipline) Locked gains
LITE post-earnings dip "Buy more aggressively" Stage 3 tiers (Beta valuation veto cap'd size) Disciplined entry, no FOMO
OpenAI bear narrative "Sell AI exposure" Hold (Alpha X sentiment confirmed not capex crack) Sentiment normalized in days

Quantifiable improvement

Comparing 6 months of single-model vs 6 months of multi-model decisions:

  • Single-model: 18/24 decisions worked (75%), avg P&L +12%
  • Multi-model: 21/24 decisions worked (88%), avg P&L +18%

Sample size small (24 each), but consistent pattern: adversarial review catches errors single-model can't see.

The deeper reason

LLM models trained 2024-2025 share:

  • Bullish-AI bias (training data is mostly tech-positive 2024)
  • Recency bias (recent news weighted heavily)
  • Anchor-on-first-search-result bias
  • Confirmation bias (especially when prompted to "find a reason to buy")

A different model from a different provider trained on slightly different data + RLHF approach catches a meaningful % of these errors.

It's not perfect — multi-model still has shared blind spots. But it's measurably better than single-model.

When single-model is fine

You DON'T need multi-model for:

  • Index ETFs (SPY/QQQ/VTI)
  • Pure index DCA
  • Fixed-allocation rebalancing
  • Tax-loss harvesting decisions
  • Generic financial planning questions

Multi-model adds value when:

  • Single-stock conviction trades (asymmetric outcomes)
  • Concentration management (per-name caps)
  • Catalyst-driven entries (earnings, FDA, etc.)
  • Risk management (stop-losses, hedges)
  • Behavioral red-flag detection (FOMO, panic)

That's where the framework is built for.


What's New in V2 (May 2026)

Feature V1 V2
Strategists 3 + Delta 5 (incl. Epsilon/Gemini)
Model versions Generic Pinned (grok-4.20, gpt-5.5, sonnet-4-6, gemini-3-pro-preview, opus-4-7)
Ensemble methodology Single pass 5-pass convergence
Polymarket signals None Integrated
Source verification gate Implicit Mandatory rule
Sell framework Tier 1 only 6 tiers
Sell orders Stop-losses placed Sell-into-strength only; mental stops
Buy execution Single limit 3-tier staged ladder
Per-name concentration cap 15% per account 2% NW universal
Crypto rules Implicit Explicit satellite bucket (≤4-5% NW)
Legacy positions Hold Hold + cap-driven trim
Behavioral red flags None 5 documented patterns
SPY 5yr filter Discretionary Uniform application
Lessons 8 10

Philosophy

"Your edge is process, not aggression." — Codex (OpenAI), April 2026

"The best trade today is no trade." — Devil's Advocate, multiple occasions

"Be fearful when others are greedy." — Classic, but enforced by the DCA rules

"Multi-model consensus is not a guarantee — it's a probability shift. Frameworks don't prevent losses; they prevent unforced errors. Discipline beats conviction in 95% of cases." — V2 update

The human's job: curate signals, direct the analysis, ask good questions, and make the final call. The AI's job: research, analyze, challenge, and log everything. The system compounds knowledge over time so every decision is better than the last.


Honest Limitations

  1. Not financial advice — framework, not fiduciary
  2. Past performance doesn't guarantee future — AP track record (+405% inception May 2026) doesn't guarantee future returns
  3. Models can hallucinate — source verification gate exists for this
  4. Stale data risk — daily portfolio audit recommended
  5. Behavioral discipline required — framework signals, but you act
  6. Tax-aware execution — IRA/Roth preferred for active management
  7. Bull market bias — framework built during 2022-2026 expansion; bear-market behavior untested at scale

Did this help?

📧 Ping me — dfzuluaga@gmail.com — I'd love to hear what worked, what broke, and what you adapted. Real feedback shapes V3.

This framework is product-agnostic by design

The two roles it needs from a research vendor are:

  1. A high-conviction picks service with a verifiable public track record (the BUY signal)
  2. A systematic ratings system for live verification of any non-pick name (the Option B gate)

I use Alpha Picks + Seeking Alpha Premium because they satisfy both roles, publish inception-to-date numbers, and let me automate the data pulls. Any products filling those two roles work — Motley Fool, AAII, Morningstar, your own conviction list. Substitute freely.

If you do go with what I use — referral specifics

Full disclosure: both links below are my personal referrals. They give you a sign-on discount and give me a credit on my next renewal. The framework works without using them — they're opt-in support.

Alpha Picks

Sign up with my referral →

  • You get: $50 off Alpha Picks at sign-up.
  • I get: $50 credit toward my next subscription once you're charged.

In this framework: the primary BUY signal. Every name passing the AP-only gate comes from here.

Seeking Alpha Premium

Sign up with my referral →

  • You get: 2-week free trial.
  • I get: $25 credit toward my next subscription once you're charged.

In this framework: powers the Option B gate (Quant Strong Buy ≥4.5 for non-AP names), factor grades, and the source-verification gate (live ratings, never stated/remembered).


Built with Claude Code. 5 AI model providers. Alpha Picks signal source. Karpathy LLM Wiki pattern. Polymarket integration. Not financial advice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment