Skip to content

Project Structure

Agent Wilson is a monorepo with three independent packages (no workspace manager — each has its own node_modules):

agentwilson/
├── cli/ # Wilson — AI bookkeeper CLI (Bun)
├── site/ # Marketing site & skill marketplace (Vite + TanStack Start)
├── api/ # Firebase Functions backend (Node 20)
├── docs/ # Product plans and research docs
└── app/docs/ # This documentation site (Starlight)
src/
├── index.tsx # Entry point, CLI flag routing
├── cli.ts # Interactive TUI startup
├── headless.ts # Headless mode (--run) execution
├── reports.ts # Structured report commands (--summary, --pnl, etc.)
├── providers.ts # Provider resolution (prefix → adapter)
├── agent/
│ ├── agent.ts # Core agent loop
│ ├── scratchpad.ts # Tool result accumulator, context management
│ └── prompts.ts # System prompt builder
├── model/
│ ├── llm.ts # Central callLlm() facade with retry
│ └── providers/ # Provider adapters (OpenAI, Anthropic, Google)
├── tools/
│ ├── registry.ts # Tool registry, conditional loading
│ ├── categorize/ # AI transaction categorization
│ ├── export/ # CSV/XLSX export
│ ├── import/
│ │ ├── parsers/ # Bank-specific CSV parsers + OFX + QIF
│ │ └── detect-bank.ts # Format detection
│ ├── query/ # Transaction search, spending summary, anomaly detection
│ └── search/ # Web search providers
├── skills/
│ ├── types.ts # SkillMetadata, Skill interfaces
│ └── */SKILL.md # Built-in skill definitions
├── orchestration/
│ ├── chains/ # Sequential tool pipelines
│ └── teams/ # Parallel agent execution
├── mcp/
│ ├── config.ts # MCP config reader
│ ├── client.ts # MCP server lifecycle
│ └── adapter.ts # MCP → Wilson tool adapter
├── db/
│ ├── schema.ts # SQLite schema definition
│ └── queries.ts # Database query functions
├── categories/
│ └── pfc-taxonomy.ts # Plaid PFC v2 category taxonomy
├── components/ # TUI components (chat log, editor, prompts)
├── controllers/ # Agent runner, model selection, input history
└── utils/ # Shared utilities
FilePurpose
SOUL.mdWilson’s personality, values, anti-patterns
BRAND.mdVisual identity and design system (Forensic Noir)
env.exampleTemplate for environment variables
src/providers.tsSingle source of truth for all 9 LLM providers
src/agent/agent.tsThe core agent loop
src/tools/registry.tsTool registry with conditional loading
src/skills/types.tsSkill and SkillMetadata TypeScript interfaces
src/db/schema.tsSQLite database schema
LayerTechnology
RuntimeBun
LanguageTypeScript (ESM)
LLM orchestrationLangChain
DatabaseSQLite (better-sqlite3)
TUIpi-tui
ValidationZod
Local AIOllama