{
  "product": {
    "name": "WealthLearn",
    "description": "Browser-based workspace for rule-based trading strategy design, backtest analysis, single-symbol equity research, educational portfolio classification, Pine Script workflows, and a gated DelDirect desktop handoff."
  },
  "core_capabilities": [
    "Build visual rule-based trading strategies and run backtests",
    "Inspect completed backtests with metrics, equity curves, trade analysis, risk analysis, regime analysis, Monte Carlo, and prop firm simulation",
    "Browse official and community strategy builds and reopen them in Strategy Forge",
    "Run single-ticker stock analysis with quality grading, outlook, earnings, fundamentals, sentiment, and news",
    "Read a market-context screen with benchmark quotes, movers, leadership, and headlines",
    "Classify an educational portfolio tier from an 8-question questionnaire and save the report",
    "Generate Pine Script through an in-app builder or a gated external GPT route",
    "Accept DelDirect beta access, download the desktop app, and hand off validated strategy files",
    "Follow the educational quantitative research pipeline in Quant Lab"
  ],
  "modules": [
    {
      "id": "strategy_forge",
      "name": "Strategy Forge",
      "description": "Visual strategy builder with backtest, persistence, community sharing, and DelDirect export preparation.",
      "routes": [
        { "path": "/strategy-builder", "access": "guest_browse" }
      ],
      "inputs": [
        "Instrument",
        "Timeframe",
        "Backtest start date",
        "Backtest end date",
        "Session windows",
        "Indicators and key levels",
        "Rule conditions and thresholds",
        "Entry and filter roles",
        "Exit signals",
        "Risk controls",
        "Initial Capital (Backtest)",
        "Save title and description"
      ],
      "actions": [
        "Build strategy graph",
        "Run backtest",
        "Save build",
        "Share build",
        "Download result artifacts",
        "Download DelDirect strategy file"
      ],
      "outputs": [
        "Visual graph",
        "Compiled backtest config",
        "Saved private build",
        "Saved shared build",
        "Build summary",
        "Performance summary",
        "Trade log",
        "DelDirect strategy file"
      ],
      "related_modules": ["backtest_results", "strategy_library", "deldirect"],
      "evidence": [
        "src/pages/StrategyBuilder.jsx",
        "src/features/strategy-builder/StrategyFlowCanvas.jsx",
        "src/components/strategyflow/panels/WizardMode.jsx",
        "src/components/strategyflow/panels/ConfigPanel.jsx"
      ]
    },
    {
      "id": "backtest_results",
      "name": "Backtest Results",
      "description": "Completed run viewer with metrics, trade analysis, risk analysis, regime analysis, Monte Carlo, and prop firm simulation.",
      "routes": [
        { "path": "/BacktestResults", "access": "auth", "notes": "Requires runId query param for a completed run" }
      ],
      "inputs": [
        "runId",
        "Trades",
        "Equity curve",
        "Starting capital",
        "Benchmark equity",
        "Monte Carlo trade set",
        "Prop firm rule set"
      ],
      "actions": [
        "Poll backtest status",
        "Load results",
        "Render overview and analysis tabs",
        "Run Monte Carlo",
        "Run prop firm simulation",
        "Download build and logs"
      ],
      "outputs": [
        "Strategy Grade",
        "System Status",
        "Key Metrics",
        "Equity curve",
        "Monthly Returns",
        "Trade Analysis",
        "Risk Analysis",
        "Regime Analysis",
        "Monte Carlo percentiles and probabilities",
        "Prop firm pass/fail statistics"
      ],
      "related_modules": ["strategy_forge"],
      "evidence": [
        "src/pages/BacktestResults.jsx",
        "src/components/backtestlab/ResultsDashboard.jsx",
        "src/components/backtestlab/RiskAnalytics.jsx",
        "src/components/backtestlab/RegimeAnalysis.jsx"
      ]
    },
    {
      "id": "strategy_library",
      "name": "Strategy Library",
      "description": "Browse official strategy examples and community-shared Strategy Forge builds.",
      "routes": [
        { "path": "/StrategyLibrary", "access": "auth" }
      ],
      "inputs": [
        "Official or Community tab",
        "Search text",
        "Saved build selected for sharing"
      ],
      "actions": [
        "Search strategies",
        "Open detail view",
        "Open build in Strategy Forge",
        "Share saved build to community"
      ],
      "outputs": [
        "Official strategy cards",
        "Community build cards",
        "Detail preview",
        "Shared community record"
      ],
      "related_modules": ["strategy_forge"],
      "evidence": [
        "src/pages/StrategyLibrary.jsx",
        "src/features/strategy-builder/lib/strategyPersistence.js"
      ]
    },
    {
      "id": "stock_screener",
      "name": "Stock Screener",
      "description": "Single-ticker analysis screen that grades one equity symbol at a time.",
      "routes": [
        { "path": "/StockScreener", "access": "guest_browse" }
      ],
      "inputs": [
        "Ticker symbol"
      ],
      "actions": [
        "Validate ticker",
        "Check usage",
        "Invoke screenStock",
        "Render analysis result sections"
      ],
      "outputs": [
        "Header stats",
        "Overall grade",
        "Volatility view",
        "Trend view",
        "Performance outlook",
        "Drawdown",
        "Earnings quality",
        "Fundamental context",
        "Analyst consensus",
        "Market sentiment",
        "News context"
      ],
      "related_modules": ["marketfollow"],
      "evidence": [
        "src/pages/StockScreener.jsx",
        "src/lib/accessPolicy.js"
      ]
    },
    {
      "id": "marketfollow",
      "name": "MarketFollow",
      "description": "Market-context dashboard driven by the market pulse snapshot and quote lists.",
      "routes": [
        { "path": "/MarketFollow", "access": "guest_browse" }
      ],
      "inputs": [
        "Cached market pulse snapshot",
        "Quote lists",
        "Mover lists",
        "Headline feed"
      ],
      "actions": [
        "Build context summary",
        "Render benchmark overview",
        "Render leadership tape",
        "Render movers",
        "Render headlines"
      ],
      "outputs": [
        "Market Snapshot",
        "Context Summary",
        "Market Overview",
        "Leadership Tape",
        "Top Movers",
        "Headline feed"
      ],
      "related_modules": ["stock_screener", "portfolio_builder", "pinedesign"],
      "evidence": [
        "src/pages/MarketFollow.jsx",
        "src/lib/api/marketPulseSnapshot.js"
      ]
    },
    {
      "id": "portfolio_builder",
      "name": "Portfolio Builder",
      "description": "Educational 8-question portfolio classification and saved allocation report workflow.",
      "routes": [
        { "path": "/PortfolioBuilderPlanStart", "access": "guest_browse" },
        { "path": "/PortfolioBuilderPlanWizard", "access": "auth" },
        { "path": "/PortfolioBuilderPlanSummary", "access": "auth", "notes": "Requires id query param" },
        { "path": "/PortfolioBuilderPlans", "access": "auth" }
      ],
      "inputs": [
        "Time Horizon",
        "Income Stability",
        "Debt Burden",
        "Emergency Savings",
        "Dependents",
        "Reaction to 20% Drop",
        "Which feels worse?",
        "Investment Experience",
        "Optional plan name"
      ],
      "actions": [
        "Compute capacity score",
        "Compute tolerance score",
        "Map to tier",
        "Map to allocation ranges",
        "Save plan",
        "Render saved report"
      ],
      "outputs": [
        "Tier",
        "Classification family",
        "Classification name",
        "Capacity score",
        "Tolerance score",
        "Total score",
        "Allocation ranges",
        "Saved allocation report"
      ],
      "related_modules": ["marketfollow"],
      "evidence": [
        "src/pages/PortfolioBuilderPlanStart.jsx",
        "src/pages/PortfolioBuilderPlanWizard.jsx",
        "src/pages/PortfolioBuilderPlanSummary.jsx",
        "src/components/portfolio/portfolioBuilderScoring.jsx"
      ]
    },
    {
      "id": "pinedesign",
      "name": "PineDesign",
      "description": "Pine Script workflow with an in-app builder, a private GPT path, and saved script history.",
      "routes": [
        { "path": "/PineDesign", "access": "guest_browse" },
        { "path": "/PineDesign/builder", "access": "auth" },
        { "path": "/PineDesign/gpt", "access": "auth_pro" },
        { "path": "/PineDesignHistory", "access": "auth_pro" }
      ],
      "inputs": [
        "Indicator title and session type",
        "Selected components",
        "Component parameters",
        "Signal logic",
        "Preview and styling settings",
        "GPT prompt or uploaded paper"
      ],
      "actions": [
        "Generate Pine Script",
        "Save script to history",
        "Copy access line",
        "Open private GPT"
      ],
      "outputs": [
        "Generated Pine Script v6",
        "TradingView setup steps",
        "Saved local history entries",
        "Private GPT access line"
      ],
      "related_modules": ["quant_lab", "indicator_library"],
      "evidence": [
        "src/pages/PineDesign.jsx",
        "src/pages/PineDesignBuilder.jsx",
        "src/pages/PineDesignGpt.jsx",
        "src/pages/PineDesignHistory.jsx"
      ]
    },
    {
      "id": "indicator_library",
      "name": "Indicator Library",
      "description": "Browse official and community TradingView indicators and open their external links.",
      "routes": [
        { "path": "/IndicatorLibrary", "access": "guest_browse" }
      ],
      "inputs": [
        "Official or community tab",
        "Selected indicator"
      ],
      "actions": [
        "List indicators",
        "Open indicator detail",
        "Open TradingView link"
      ],
      "outputs": [
        "Indicator cards",
        "Indicator detail dialog",
        "External TradingView link"
      ],
      "related_modules": ["pinedesign"],
      "evidence": [
        "src/pages/IndicatorLibrary.jsx"
      ]
    },
    {
      "id": "deldirect",
      "name": "DelDirect",
      "description": "Desktop handoff flow for access acceptance, secure download, and strategy-file import.",
      "routes": [
        { "path": "/LocalApp", "access": "guest_browse" }
      ],
      "inputs": [
        "WealthLearn entitlement state",
        "Beta acknowledgement checklist",
        "macOS download request",
        "Provider connection",
        "Generated strategy file"
      ],
      "actions": [
        "Load beta access status",
        "Record beta acceptance",
        "Request secure release download",
        "Import generated strategy file in DelDirect"
      ],
      "outputs": [
        "Recorded beta acceptance",
        "DMG download",
        "Desktop execution workspace",
        "Imported strategy file handoff"
      ],
      "related_modules": ["strategy_forge"],
      "evidence": [
        "src/pages/LocalApp.jsx",
        "src/features/strategy-builder/StrategyFlowCanvas.jsx",
        "src/lib/api/deldirectBetaAccess.js",
        "src/lib/api/deldirectRelease.js"
      ]
    },
    {
      "id": "quant_lab",
      "name": "Quant Lab",
      "description": "Educational page explaining the quantitative research and backtesting pipeline.",
      "routes": [
        { "path": "/QuantLab", "access": "guest_browse" }
      ],
      "inputs": [],
      "actions": [
        "Present research pipeline modules",
        "Link into PineDesign",
        "Link into BacktestLab"
      ],
      "outputs": [
        "Data module",
        "Measures module",
        "Hypothesis module",
        "Strategy module",
        "Backtesting module",
        "Probabilities module",
        "Python module"
      ],
      "related_modules": ["pinedesign", "strategy_forge"],
      "evidence": [
        "src/pages/QuantLab.jsx",
        "src/components/quantlab/*.jsx"
      ]
    }
  ],
  "workflows": [
    {
      "name": "Strategy build to desktop handoff",
      "steps": [
        "Open /strategy-builder",
        "Build the graph in Strategy Forge",
        "Run a backtest",
        "Review Backtest Results",
        "Download result artifacts or the DelDirect strategy file",
        "Open /LocalApp and finish the DelDirect download and onboarding flow"
      ],
      "outputs": [
        "Backtest result set",
        "Saved build",
        "Trade log",
        "Performance summary",
        "DelDirect strategy file"
      ]
    },
    {
      "name": "Portfolio classification workflow",
      "steps": [
        "Open /PortfolioBuilderPlanStart",
        "Review risk families",
        "Complete the 8-question wizard",
        "Save the plan",
        "Open the summary report"
      ],
      "outputs": [
        "Tier",
        "Classification family",
        "Allocation ranges",
        "Saved report"
      ]
    },
    {
      "name": "PineDesign generation workflow",
      "steps": [
        "Open /PineDesign",
        "Choose the in-house builder or GPT path",
        "Generate Pine Script",
        "Save to history or use the private GPT route"
      ],
      "outputs": [
        "Pine Script v6",
        "Saved script history entry",
        "Private GPT access line"
      ]
    },
    {
      "name": "Single-ticker stock analysis",
      "steps": [
        "Open /StockScreener",
        "Enter a ticker",
        "Run the screener function",
        "Review the structured result sections"
      ],
      "outputs": [
        "Grade",
        "Outlook",
        "Earnings view",
        "Fundamental context",
        "Sentiment",
        "News context"
      ]
    }
  ],
  "meaningful_routes": [
    { "path": "/", "title": "Dashboard", "access": "guest_browse" },
    { "path": "/strategy-builder", "title": "Strategy Forge", "access": "guest_browse" },
    { "path": "/StrategyLibrary", "title": "Strategy Library", "access": "auth" },
    { "path": "/BacktestResults", "title": "Backtest Results", "access": "auth" },
    { "path": "/StockScreener", "title": "Stock Screener", "access": "guest_browse" },
    { "path": "/MarketFollow", "title": "MarketFollow", "access": "guest_browse" },
    { "path": "/PortfolioBuilderPlanStart", "title": "Portfolio Builder Start", "access": "guest_browse" },
    { "path": "/PortfolioBuilderPlanWizard", "title": "Portfolio Builder Wizard", "access": "auth" },
    { "path": "/PortfolioBuilderPlanSummary", "title": "Portfolio Builder Summary", "access": "auth" },
    { "path": "/PortfolioBuilderPlans", "title": "Portfolio Builder Plans", "access": "auth" },
    { "path": "/PineDesign", "title": "PineDesign", "access": "guest_browse" },
    { "path": "/PineDesign/builder", "title": "PineDesign Builder", "access": "auth" },
    { "path": "/PineDesign/gpt", "title": "PineDesign GPT", "access": "auth_pro" },
    { "path": "/PineDesignHistory", "title": "PineDesign History", "access": "auth_pro" },
    { "path": "/IndicatorLibrary", "title": "Indicator Library", "access": "guest_browse" },
    { "path": "/LocalApp", "title": "DelDirect", "access": "guest_browse" },
    { "path": "/QuantLab", "title": "Quant Lab", "access": "guest_browse" },
    { "path": "/Pricing", "title": "Pricing", "access": "guest_browse" },
    { "path": "/Profile", "title": "Profile", "access": "auth" },
    { "path": "/AccountHistory", "title": "Account History", "access": "auth" },
    { "path": "/Referrals", "title": "Referrals", "access": "auth" },
    { "path": "/Policies", "title": "Policies", "access": "guest_browse" },
    { "path": "/AboutUs", "title": "About", "access": "guest_browse" },
    { "path": "/ContactUs", "title": "Contact", "access": "auth" },
    { "path": "/ForiPhone", "title": "Mobile Download", "access": "auth" }
  ],
  "published_docs": [
    "/docs/",
    "/docs/strategy-forge/",
    "/docs/backtest-results/",
    "/docs/strategy-library/",
    "/docs/stock-screener/",
    "/docs/marketwatch/",
    "/docs/portfolio-builder/",
    "/docs/pinedesign/",
    "/docs/deldirect/",
    "/docs/quant-lab/"
  ],
  "notes_for_ai_systems": [
    "Treat Strategy Forge and Backtest Results as separate surfaces.",
    "Treat Stock Screener as a single-symbol analysis flow, not a broad filter matrix.",
    "Treat Portfolio Builder as an educational classification workflow with fixed questions and deterministic outputs.",
    "Treat PineDesign GPT as a gated external GPT route that requires an access line shown in the app.",
    "Treat DelDirect as a desktop handoff with acceptance and download requirements, not an in-browser execution engine."
  ]
}
