robinhood-options-mobile

AI Trade Post-Mortem & Behavioral Journal Auto-Tagger

Overview

The AI Trade Post-Mortem & Behavioral Journal Auto-Tagger (TradePostMortemAnalysis, TradePostMortemSheet, analyzeTradePostMortem) provides an automated, objective diagnostic review immediately upon closing an equity or options position. It evaluates trade execution quality independently of P&L outcome, identifies cognitive biases, catalogs execution mistakes, generates actionable tactical lessons, and auto-tags entries directly into the trader’s Firestore-backed Emotion Journal.

By distinguishing between “Good Wins” (disciplined execution, sound thesis) and “Bad Wins” (lucky execution that broke rules), as well as “Good Losses” (proper risk management, adhered to invalidation) and “Bad Losses” (bag-holding, averaging down against rules), the post-mortem engine protects traders from outcome bias and reinforces systematic consistency.


Core Capabilities

1. Execution Quality vs. Outcome Matrix

2. Cognitive Bias Detection & Antidotes

Analyzes the trade narrative and execution data against a comprehensive behavioral finance taxonomy:

For each detected bias, the AI delivers a concrete, actionable Cognitive Antidote (e.g., “Set bracket orders with mechanical take-profit limit orders upon entry”).

3. Execution Flaws Catalog

Identifies specific operational mistakes with impact severity (minor, moderate, severe):

4. Automated Emotion Journal Auto-Tagger


Architecture & Integration

Robinhood Options Mobile
├── lib/model/trade_post_mortem_model.dart        # TradePostMortemAnalysis & ExecutionFlaw models
├── lib/widgets/trade_post_mortem_sheet.dart       # Interactive diagnostic bottom sheet UI
├── lib/services/generative_service.dart          # Client callable invoker (analyzeTradePostMortem)
├── functions/src/gemini.ts                       # Backend Cloud Function with Gemini 3.1 Flash-Lite
├── lib/widgets/position_order_widget.dart        # Launch action from stock order view
├── lib/widgets/option_order_widget.dart          # Launch action from option order view
├── lib/widgets/personalized_coaching_widget.dart # Launch action from coaching activity stream
└── lib/widgets/trading_psychology_widgets.dart   # Journal entry card tag chip rendering

Backend Cloud Function (analyzeTradePostMortem)


User Experience Flow

  1. Trade Close Event: A stock or option closing order fills, or the user reviews completed trades in the Order Details or AI Coaching screen.
  2. Launch Post-Mortem: Tapping the “Post-Mortem Analysis” button (Icons.fact_check_outlined) opens TradePostMortemSheet.
  3. Review Diagnostic:
    • High-contrast execution score & letter grade card.
    • Outcome verdict badge (“Good Loss”, “Bad Win”, etc.).
    • Coach summary synthesis.
    • Thesis adherence progress bar.
    • Detected biases with cognitive antidotes.
    • Execution flaw warning cards.
    • Tactical lessons bullet points.
  4. Auto-Tag & Save: Tapping “Auto-Tag Journal” saves an EmotionLog to Firestore with generated tags and displays a success confirmation.

Automated Test Coverage