Inspiration

The Rebellion of a Retail Investor.

I am a retail investor, not a coder. My journey started with a painful realization: both the market and traditional AI chatbots were working against me. The market fed on my emotions (FOMO), and AI assistants suffered from "Sycophancy"—prioritizing agreeableness over truth, often hallucinating reasons to support my biased trade ideas. I didn't need a "Yes-Man"; I needed a Risk Manager.

Inspired by Charlie Munger’s "Invert, always invert," I realized that true intelligence isn't about generating more text; it's about Entropy Reduction. We needed to constrain the AI to create order from chaos. I treated Gemini not as a tool, but as a Co-founder. Together, we co-architected the V8.0 Protocol—a set of rigorous constraints to curb entropy.

What it does

Invert.bot is an active decision engine that acts as an AI Investment Committee. It shifts the paradigm from "Passive Tool" to "Cognitive Exoskeleton," upgrading the user's decision-making process.

1. The Three-Column Workbench (Interface) Designed for deep focus, moving beyond linear chat:

  • Left (Context): Temporal grounding (Session history & Dates).
  • Middle (Live Data): Dynamic "Stock Cards" visualizing real-time data fetched via Gemini's Function Calling (Price, RSI, Earnings).
  • Right (Reasoning): The "Committee Room." Users multi-select cards to trigger cross-asset analysis via the V8.0 Protocol.

2. The V8.0 Protocol (Agent Architecture) Gemini 3 orchestrates four distinct agents to audit your trade:

  • Layer 1 - The Analyst (Blue Team): Scans macro cycles and moats to construct a bullish thesis.
  • Layer 1 - The Skeptic (Red Team): Our Core Differentiator. Simulates a vicious short-seller to attack the thesis, exposing traps.
  • Layer 2 - The Judge: Synthesizes the debate into a Quantitative Logic Score (0-10). Scores < 6.0 trigger a hard "Pass."
  • Layer 3/4 - Risk Manager: Calculates position sizing based on confidence (Kelly Criterion) and sets hard stop-losses.

How we built it

We architected a dual-model decision engine leveraging the specific strengths of Gemini 3 Pro and Gemini 3 Flash.

1. The "Senses": Function Calling for Active Research We moved beyond RAG to Active Research. We registered 7 professional tools. Gemini autonomously determines when to call them:

  • get_realtime_quotes / get_technical_indicators: Live data & RSI/MACD.
  • get_financial_reports: Parsing 10-K/10-Q.
  • get_macro_calendar / search_news: Macro & Sentiment context.
  • calculate_risk: Position sizing algorithms.

2. The "Constitution": System Instructions & Long Context We leveraged Gemini 3 Pro’s superior instruction-following to embed our V8.0 Protocol. By injecting complex System Instructions, we forced the model to maintain a "Multi-Persona State Machine," ensuring the "Red Team" and "Blue Team" exist simultaneously within a single inference context without hallucination.

3. Interaction & Efficiency

  • Streaming: Visualizing the "Chain of Thought" in real-time.
  • Hybrid Routing: Gemini 3 Pro handles heavy reasoning (Red/Blue debate), while Gemini 3 Flash handles lightweight tasks (NER, Routing) for low latency.

Challenges we ran into

  • The "Alignment Bias" Trap: LLMs are probability machines that tend to agree with users to maintain flow. When a user expresses FOMO, the AI becomes an accomplice. Solution: We used the V8.0 Protocol to "prune the probability tree," cutting off compliant branches.
  • Temporal Hallucination: Early versions lacked a sense of "Now." Solution: We implemented a Layer 0 Global Anchor, forcing the model to validate current ET time and Market State before analysis.
  • Complex Tool Orchestration: Managing the dependency chain of 7 financial tools. Solution: We engineered a strict logic sequence (Macro → Fundamental → Technical) to mirror human analysts.

Accomplishments that we're proud of

  • Interface Innovation (The "Object-Oriented" Chat): We decoupled Data from Reasoning. By creating the "Middle Column" as a dynamic Visual Working Memory, users can perform Cross-Asset Analysis (e.g., compare NVDA vs. AMD) simply by selecting cards. This transcends standard linear chatbots.
  • Algorithmic Entropy Reduction: We successfully built an Anti-Sycophancy Engine. By restricting the scope to "Truth" (Data) and the logic path to "Critical Thinking" (Red Team), we built a cold, rational system that outputs high-density logic rather than emotional massage.
  • Architecture over Fine-Tuning: We proved that you don't need expensive model fine-tuning to build a vertical expert. By structuring Gemini’s System Instructions into a Layer 0-4 pipeline, we transformed a generalist model into a domain expert using pure logic architecture.

What we learned

  • Logic is the New Syntax: In the Gemini era, the barrier to entry is no longer coding ability, but Domain Taste. "Skill" is simply the explicit coding of a domain expert's tacit knowledge.
  • Constraint is Intelligence: LLMs are naturally high-entropy. We learned that by restricting the AI (e.g., "You can only answer based on these 3 principles"), we actually increased its intelligence and reliability.
  • The Era of the "Cognitive Exoskeleton": The goal of AI isn't to replace humans (Automation), but to upgrade them (Augmentation). Invert.bot doesn't just give answers; it helps users internalize the "Red/Blue" adversarial mental model.

What's next for Invert.bot

  • Adaptive Evolution: Implementing a Feedback Loop where the "Judge Agent" tracks its own predictions against actual market outcomes (P&L) to autonomously refine its scoring weights.
  • Multi-Modal Deep Research: Leveraging Gemini 3’s massive context window to ingest unstructured data (PDFs, Charts, Earnings Calls) for "Cross-Document Synthesis"—spotting contradictions between CEO speeches and balance sheets.
  • Fractal Strategy Expansion: Integrating specialized sub-protocols like the Mercenary Protocol (for 2x ETFs) and Flash Crash Defense (for macro events).
  • Privacy First: Implementing Zero-Knowledge architecture for portfolio data.

Built With

  • function-calling
  • gemini-3-flash
  • gemini-3-pro
  • google-ai-studio
  • google-gemini-api;
  • google-search;
  • gray-matter;
  • js-yaml;
  • long-context-window
  • lucide-react;
  • next.js-14;
  • numpy;
  • orchestrate
  • pandas;
  • python;
  • react-18;
  • react-markdown;
  • react-masonry-css;
  • reasoning
  • rehype-highlight;
  • remark-gfm;
  • server-sent-events
  • state-machine
  • streaming-api
  • stripe-sdk;
  • structured-output
  • supabase-postgresql;
  • system-instructions
  • tailwind-css;
  • typescript;
  • vercel-sandbox;
  • vercel;
  • yahoo-finance;
  • zustand;
Share this project:

Updates