The Problem

Dexter is an autonomous agent designed for deep financial research, automating task planning, tool execution, and self-validation using live market data. For a technical client, the primary pain point is the architectural fragility inherent in a codebase of this size (86 modules, 190 import edges) where circular dependencies and duplicated logic create significant risk and friction during maintenance or extension.

What This Does

Dexter functions as a research orchestration layer. It decomposes complex financial queries into structured steps, executes tools (browser, financial data APIs, web search), and synthesizes answers via an LLM loop. The core execution flow originates at src/cli.tsx:25 and is driven by src/agent/agent.ts:59, which reaches 39 internal functions. Model interaction is handled by src/model/llm.ts, which defines getChatModel and withRetry. The agent relies on a tool registry managed by src/tools/registry.ts. Execution paths touch the filesystem during evaluation runs via src/evals/run.ts:338 (using fs.readFileSync) and make outbound model calls via the run -> callModel -> callLlm traced path.

How It Is Wired

Execution starts at the CLI entry point src/cli.tsx:25. The primary runner is src/agent/agent.ts:59, which coordinates the run loop. Key functions with wide blast radius include callLlm (called from 4 places) and formatToolName (called from 4 places). The internal call graph contains 6 modules in circular dependencies, specifically src/agent/prompts.ts, src/tools/registry.ts, and src/tools/finance/index.ts, which mutually reach each other and hinder refactoring. Hub modules with high dependency counts are src/tools/types.ts (16 modules depend on it) and src/theme.ts. Additionally, 64 repeated 6-line blocks exist across files like src/cli.tsx, src/hooks/useModelSelection.ts, and src/hooks/useAgentRunner.ts, violating the DRY principle and increasing cognitive load.

How To Use It

Setup: The repository requires the Bun runtime (v1.0+). Install dependencies using:

bun install

Configure required API keys by copying env.example to .env. Required keys include OPENAI_API_KEY. Optional keys for financial data (FINANCIAL_DATASETS_API_KEY) and web search (EXASEARCH_API_KEY or TAVILY_API_KEY) are documented in the file.

Configuration: Environment variables are managed in .env. The project uses TypeScript configuration defined in tsconfig.json.

Running it: Execute the agent in interactive mode:

bun start

For development with watch mode:

bun dev

Evaluation: Run the eval suite against the financial question dataset:

bun run src/evals/run.ts

Real-World Use

A practical scenario involves automating a competitive analysis request, such as "Analyze the recent margin expansion trends for NVIDIA versus AMD." A user invokes the CLI, the agent decomposes the query into steps (e.g., retrieving income statements, calculating ratio changes), executes src/tools/finance/prices.ts and src/tools/finance/fundamentals.ts, and iterates via src/agent/agent.ts until a self-validated answer is formed, outputting a structured report.

Code Health & Issues

Static analysis identified 17 distinct issues across 7 high and 10 medium severity:

  • [HIGH/soundness] Import cycle member x6: Files src/agent/prompts.ts, src/tools/registry.ts, and src/tools/finance/index.ts participate in circular imports, creating brittle dependency paths.
  • [HIGH/clarity] Duplicated code blocks: 64 repeated 6-line blocks found across 13 files, including src/cli.tsx and multiple hook files, indicating copy-paste logic that requires extraction.
  • [MEDIUM/cognitive_load] High branching density x8: Files src/tools/finance/api.ts, src/utils/env.ts, and src/utils/text-navigation.ts exhibit 18 branch points over 60 lines, suggesting logic that should be decomposed or dispatched via a table.
  • [MEDIUM/clarity] Hub modules x2: src/tools/types.ts and src/theme.ts are depended upon by 16 and 14 modules respectively, creating high-blast-radius change points.
  • [HIGH] Pin third-party GitHub Actions to commit SHA: The workflow uses oven-sh/setup-bun@v2, which is untagged and subject to owner-driven updates that could alter CI behavior with repository secrets.
  • [HIGH] Add a LICENSE: No license file exists at the repository root, defaulting to "all rights reserved" and preventing legal reuse.
  • [MEDIUM] Enable Dependabot or Renovate: No update bot is configured for the 26 declared dependencies.

The Bottom Line

Dexter is a functional autonomous agent with a clear focus on financial research orchestration. However, it carries significant technical debt: circular imports create soundness risks, duplicated logic increases merge friction, and the absence of a license and dependency automation poses operational risk. It is suitable for teams requiring a customizable research prototype, but requires refactoring of the import graph and duplicated blocks, as well as IP clearance, before it is viable for production or client-facing engagements.