Dexter: AI Agent for Deep Financial Research

repository·main·Indexed 12 days ago

https://github.com/virattt/dexter

An autonomous financial research agent that decomposes complex queries into actionable plans using real-time market data. It features an evaluation suite with LangSmith, a WhatsApp gateway for interactive research, and a microcompact context management system to handle large financial datasets within LLM token limits.

Tokens
24.6K
Snippets
77
Records
119
Agent score
98%

What's inside Dexter

  1. Use the DCF Valuation Skill

    main

    The dcf-valuation skill performs a discounted cash flow (DCF) valuation analysis to estimate a company's intrinsic value per share.

    Triggering the skill: The skill is automatically triggered when a user asks for:

    • Fair value or intrinsic value
    • DCF or valuation analysis
    • "What is [X] worth?"
    • Price targets
    • Undervalued/overvalued analysis
    • Comparison of current price to fundamental value.
  2. Calculate FCF Growth Rate and Project Cash Flows

    main

    FCF Growth Rate Calculation

    1. Calculate the 5-year FCF CAGR from cash flow history.
    2. Cross-validate with free_cash_flow_growth (YoY) and revenue_growth.
    3. Selection Rule: For stable history, use CAGR with a 10-20% haircut. Cap the growth rate at 15%.

    Projecting Future Cash Flows

    • Years 1-5: Apply the growth rate with a 5% annual decay. Multiply the growth rate by 0.95, 0.90, 0.85, and 0.80 for years 2 through 5 respectively.
    • Terminal Value: Use the Gordon Growth Model with a 2.5% terminal growth rate (GDP proxy).
  3. Define Tripwires for risk assessment

    main

    Every risk in the risks table must include a tripwire. A tripwire is an observable data point that would invalidate the thesis within the holding period.

    Good Tripwires (Observable/Actionable):

    • "Q3 ad-tier ARPU prints below $8"
    • "Top customer announces in-sourcing on Q2 call"
    • "Gross margin contracts more than 150bps in any quarter"
    • "Insider sales exceed $50M in any rolling 90-day window"

    Bad Tripwires (Non-observable/Non-actionable):

    • "Macro deteriorates"
    • "Competition increases"
    • "Sentiment shifts negatively"
  4. Perform WACC reasonableness checks

    main

    Validate your calculated WACC using these benchmarks:

    • Value Creation: For value-creating companies, WACC should typically be 2-4% below ROIC (Return on Invested Capital).
    • Value Destruction: If calculated WACC > ROIC, the company may be destroying value.
    • Peer Comparison: Compare the result to sector peers if data is available.
  5. Constructing driver-based scenarios for investment memos

    main

    Investment memos produced by this skill must use driver-based scenarios (Bear, Base, and Bull) rather than arbitrary numbers.

    Scenario Requirements

    For each scenario, you must specify:

    1. Revenue growth (forecasted for 2-3 years out).
    2. EBIT / operating margin at that forecast point.
    3. Exit multiple (e.g., P/E, EV/EBITDA, or EV/Sales).
    4. Probability weight (the sum of Bear, Base, and Bull probabilities must equal 100%).
    5. Price target (derived from the above metrics).
    6. Return vs. current price (including the sign).

    Key Calculations

    • Probability-weighted return = $\sum(\text{probability} \times \text{return})$ across all scenarios.
    • Upside / downside ratio = $|\text{bull return}| / |\text{bear return}|$.

    Asymmetry Check

    If the upside/downside ratio is < 2x, the setup is considered weak asymmetry. The memo must flag this prominently in the header rather than hiding it.

  6. Use the X Research Skill for sentiment analysis

    main

    The x-research skill performs agentic research over X/Twitter using the x_search tool. It is designed to decompose research questions into targeted searches, iterate to refine signal, and synthesize findings into a sourced sentiment briefing.

    Use this skill when you need to answer questions like:

    • "what are people saying about [topic]"
    • "X/Twitter sentiment for [ticker]"
    • "check X for [event]"
    • "what's CT saying about [market]"

    It is particularly useful for gathering public opinion on stocks, sectors, companies, or market events.

  7. Enable and use WhatsApp Group Chat

    main

    Dexter can participate in WhatsApp groups and will respond only when @-mentioned.

    Configuration

    To enable group participation, update .dexter/gateway.json with a groupPolicy.

    • groupPolicy: Set to "open" (any group), "allowlist" (restricted), or "disabled" (default).
    • groupAllowFrom: A list of groups allowed to interact with Dexter. Use ["*"] to allow any group.

    Example Configuration:

    {
      "channels": {
        "whatsapp": {
          "enabled": true,
          "accounts": {
            "default": {
              "groupPolicy": "open",
              "groupAllowFrom": ["*"]
            }
          },
          "allowFrom": ["+1234567890"]
        }
      }
    }

    Usage

    1. Add Dexter's WhatsApp number to the group.
    2. Important: You must use WhatsApp's @-mention picker (tap @ and select the contact). Typing a phone number manually will not trigger a response.
    3. Dexter will see recent group messages for context and respond to the mention.
  8. Workflow for DCF Valuation Analysis

    main

    A complete DCF analysis follows an 8-step workflow:

    1. Gather financial data: Collect cash flow history, financial metrics, balance sheet, current price, and company facts.
    2. Calculate FCF growth rate: Determine the 5-year FCF CAGR (capped at 15%).
    3. Estimate discount rate (WACC): Use sector-specific WACC ranges and capital structure weights.
    4. Project future cash flows: Project years 1-5 with a 5% annual decay in growth rate, plus a terminal value.
    5. Calculate present value: Discount FCFs to find Enterprise Value, adjust for Net Debt, and divide by outstanding shares.
    6. Run sensitivity analysis: Create a 3×3 matrix varying WACC (±1%) and terminal growth (2.0%, 2.5%, 3.0%).
    7. Validate results: Perform sanity checks on EV comparison, terminal value ratios, and per-share multiples.
    8. Present results: Output a structured summary with valuation, inputs, projections, sensitivity, and caveats.
    DCF Analysis Progress:
    - [ ] Step 1: Gather financial data
    - [ ] Step 2: Calculate FCF growth rate
    - [ ] Step 3: Estimate discount rate (WACC)
    - [ ] Step 4: Project future cash flows (Years 1-5 + Terminal)
    - [ ] Step 5: Calculate present value and fair value per share
    - [ ] Step 6: Run sensitivity analysis
    - [ ] Step 7: Validate results
    - [ ] Step 8: Present results with caveats
  9. Adjust WACC based on company-specific factors

    main

    After selecting a base WACC from the sector table, apply adjustments based on the following risk and stability factors:

    Add to base WACC (Increase Risk/Cost):

    • High debt (D/E > 1.5): +1-2%
    • Small cap (< $2B market cap): +1-2%
    • Emerging markets exposure: +1-3%
    • Concentrated customer base: +0.5-1%
    • Regulatory uncertainty: +0.5-1.5%

    Subtract from base WACC (Decrease Risk/Cost):

    • Market leader with moat: -0.5-1%
    • Recurring revenue model: -0.5-1%
    • Investment grade credit rating: -0.5%
  10. Follow the Investment Memo Style Guide

    main

    When using the write-memo skill, the generated output must adhere to buyside writing conventions to avoid looking AI-generated. Key stylistic requirements include:

    • Voice: Use first person plural (e.g., "we believe", "our base case"). Be direct rather than hedging (e.g., "Margins compress 200bps in '27" instead of "margins could potentially face pressure"). State a view, provide evidence, and hedge exactly once with a "wrong if" clause.
    • Sentence Structure: Use one sentence per idea in narrative sections. Avoid long sentences with multiple comma chains or parentheticals.
    • Numbers: Quantify everything. Use specific basis points (bps), percentages with explicit bases (e.g., "28% YoY"), and specific multiples (e.g., "18x FY26 EPS"). Never fabricate numbers; if data is missing, write "not disclosed".
  11. Run Dexter in interactive or development mode

    main

    Once installed and configured, you can run Dexter using the following commands:

    • Interactive Mode: Use this to chat with the agent directly.

      bun start
    • Watch Mode: Use this for development, which enables hot reloading.

      bun dev
    bun start
    # or
    bun dev
  12. Close the memo with Monitoring KPIs

    main
    Memos should not include a "Conclusion" section, as the recommendation, thesis, and scenarios already provide the necessary context. Instead, the final section of the memo body should be Monitoring KPIs—the specific metrics that confirm or invalidate the thesis. This ensures the memo ends on actionable items: what to watch.