Core Functionalities of the ai-berkshire Project: A Modular Investment Research Framework

AI Berkshire is a modular, agent-driven research framework that transforms individual investors into full-stack research operations through 18 canonical skills, four parallel AI agents embodying value-investment masters, and precision financial tools.

The ai-berkshire project is an open-source investment research framework designed to automate deep fundamental analysis through multi-agent AI systems. Its core functionalities center on a three-layer architecture—Skill, Agent, and Tool—that delivers reproducible, data-rigorous research workflows. All components are implemented as Markdown files, Python utilities, and shell scripts within the xbtlin/ai-berkshire repository.

Skill Layer: 18 Canonical Research Capabilities

The repository defines 18 canonical skills exposed via slash-commands (Claude Code) or skill names (Codex). These skills reside in the skills/ directory and are generated into codex-skills/ and codex-prompts/ via scripts/sync-codex-skills.py.

Deep Research Skills

These skills perform full-company analysis from multiple value-investment perspectives:

  • investment-research – Comprehensive single-company analysis
  • investment-team – Parallel-agent team research for faster coverage
  • management-deep-dive – Leadership and governance analysis
  • private-company-research – Detective work for non-public entities (e.g., SpaceX)
  • deep-company-series – Extended multi-part research series

Financial Analysis Skills

  • earnings-review – First-hand reading of raw SEC filings
  • earnings-team – Team-based earnings deep-dive ready for publication

Industry Screening Skills

  • industry-research – Whole-industry chain mapping
  • industry-funnel – Multi-stage funnel filtering from market to final picks
  • quality-screen – Fast hard-filters based on 7-point quality checklist
  • bottleneck-hunter – Supply chain constraint identification
  • investment-checklist – Rapid 8-point red-line evaluation (快速否决清单)

Portfolio Management Skills

  • portfolio-review – Position sizing and allocation analysis
  • thesis-tracker – Ongoing thesis monitoring and validation
  • news-pulse – Immediate price-move attribution and news analysis

Thinking Tools

  • dyp-ask – "Ask Duan Yong-ping" style Q&A reasoning
  • financial-data – Rigorous data cross-validation workflows
  • wechat-article – Collaborative article generation for WeChat publication

Agent Layer: Parallel Multi-Perspective Analysis

Every skill internally spawns four autonomous agents representing the viewpoints of value-investment masters (段永平, 巴菲特, 芒格, 李录). According to the architecture documented in assets/architecture.mmd and rendered in assets/architecture.png, these agents operate concurrently to multiply research depth.

Each agent performs three core functions:

  1. Data Collection – Gathering information from web sources or local tools/ utilities
  2. Independent Analysis – Evaluating business models, moats, valuations, and risks
  3. Adversarial Validation – Challenging conclusions through "reverse-thinking" and "mirror-tests"

A Team Lead agent synthesizes the outputs, applying the 8-point red-line checklist (快速否决清单) to produce a structured report containing:

  • Decision rating: Pass / Grey / Fail
  • Price-range recommendations: Aggressive, balanced, and conservative allocations
  • Confidence levels: A/B/C information richness ratings with source citations

Tool Layer: Precision Finance Utilities

Located in tools/, these Python modules guarantee data integrity and mathematical exactness using decimal.Decimal to prevent floating-point drift.

Financial Rigor Engine

The tools/financial_rigor.py module provides CLI commands for precise calculations:

  • verify-market-cap – Cross-validates market cap calculations against reported figures
  • verify-valuation – Validates DCF and valuation metrics
  • cross-validate – Multi-source data verification
  • three-scenario – Scenario analysis modeling
  • benford – Benford's Law anomaly detection for financial fraud screening
  • calc – Decimal-based arithmetic utility

Data Acquisition and Screening

Deterministic Workflow Pipeline

The core functionalities of the ai-berkshire project follow a deterministic execution model ensuring reproducible research:

  1. Skill Invocation – User triggers a skill (e.g., /investment-research 腾讯)
  2. Agent Dispatch – Four parallel agents spawn, calling tools for data retrieval and numeric validation
  3. Sub-report Generation – Agents produce independent analyses with uncertainty ratings and mirror-test results
  4. Synthesis – Team Lead aggregates outputs, applies the red-line checklist, and delivers the final structured report

This pipeline guarantees identical inputs always generate the same structured output, enabling side-by-side comparison and audit trails.

Practical Code Examples

The following commands demonstrate common ai-berkshire workflows after cloning the repository and running installation scripts:


# Deep company research with four-master synthesis

investment-research 腾讯

# Parallel-agent team research for faster coverage

investment-team 美团

# Quick buy-decision checklist for multiple tickers

investment-checklist 腾讯, 阿里巴巴, 茅台, 英伟达

# Industry funnel screening from broad market to final three picks

industry-funnel "AI算力"

# Private company deep dive (e.g., SpaceX)

private-company-research SpaceX

# Raw SEC filing earnings review

earnings-review PDD 2025Q4

# Immediate price-move attribution

news-pulse 腾讯

For precise financial validation:


# Verify market cap calculation with decimal precision

python3 tools/financial_rigor.py verify-market-cap \
  --price 510 --shares 9.11e9 --reported 4.65e12 --currency HKD

These commands work with both Claude Code (slash-commands) and Codex CLI (codex --skill <name>).

Summary

The ai-berkshire project delivers investment research automation through these core functionalities:

  • 18 canonical skills organized across five functional families (deep research, financial analysis, industry screening, portfolio management, and thinking tools)
  • Four-agent parallel architecture embodying value-investment masters (段永平, 巴菲特, 芒格, 李录) with adversarial validation and Team Lead synthesis
  • Precision finance tools using decimal.Decimal arithmetic in tools/financial_rigor.py for exact market-cap verification, cross-validation, and Benford-Law screening
  • Deterministic workflow ensuring reproducible outputs with Pass/Grey/Fail decisions and red-line checklist validation
  • Extensible architecture via Markdown-based skill definitions in skills/ and Python modules in tools/, synchronized through scripts/sync-codex-skills.py

Frequently Asked Questions

What are the four value-investment masters referenced in the ai-berkshire project?

The four agents represent 段永平 (Duan Yongping), 巴菲特 (Warren Buffett), 芒格 (Charlie Munger), and 李录 (Li Lu). Each agent analyzes investments through the specific lens and methodology of these masters, then challenges other agents' conclusions through mirror-tests and reverse-thinking exercises.

How does the ai-berkshire project ensure financial calculation accuracy?

All monetary calculations use Python's decimal.Decimal class instead of floating-point numbers to eliminate rounding errors. The tools/financial_rigor.py module provides specialized commands like verify-market-cap and cross-validate that enforce multi-source verification and mathematical exactness.

Can I add custom skills to the ai-berkshire framework?

Yes. Create a new Markdown file in the skills/ directory defining the workflow, parameters, and examples. Then run scripts/sync-codex-skills.py to regenerate the codex-skills/ and codex-prompts/ directories. The architecture supports seamless extension through plain-text configuration files.

What is the difference between investment-research and investment-team skills?

investment-research performs a comprehensive single-company analysis, while investment-team deploys parallel agents for faster full-coverage research. The team variant is optimized for speed and breadth, whereas the standard research skill emphasizes depth and detailed synthesis of the four masters' perspectives.

Have a question about this repo?

These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:

Share the following with your agent to get started:
curl -s "https://instagit.com/install.md"

Works with
Claude Codex Cursor VS Code OpenClaw Any MCP Client

Maintain an open-source project? Get it listed too →