# Understanding the Four-Master Methodology in AI Berkshire: A Technical Deep Dive

> Unlock the power of the four-master methodology in AI Berkshire. Explore this technical deep dive into formalizing investment philosophies for automated AI-driven research. Learn how it works.

- Repository: [Xbt Lin/ai-berkshire](https://github.com/xbtlin/ai-berkshire)
- Tags: deep-dive
- Published: 2026-07-29

---

**AI Berkshire encodes the investment philosophies of Warren Buffett, Charlie Munger, Duan Yong-ping, and Li Lu into a formalized, executable scaffold that drives every research skill, data-validation step, and final report through modular Markdown definitions and automated challenge prompts.**

AI Berkshire is an open-source investment research engine that rigorously applies the "four-master" (四大师) framework to financial analysis. This methodology moves beyond simple inspiration by hard-coding the distinct analytical lenses of four legendary investors directly into the repository's executable architecture. The result is a repeatable, transparent research process where every stock analysis, industry funnel, and earnings call review passes through the same disciplined, master-specific validation layers.

## The Three-Layer Architecture of the Four-Master Framework

The four-master methodology is woven into AI Berkshire's architecture at three distinct integration points, ensuring that Buffett's margin-of-safety principles, Munger's latticework of mental models, Duan's business-quality focus, and Li Lu's value-oriented rigor permeate every analysis.

### Skill Definitions: Markdown-Based Command Structures

Each research skill in [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md), [`skills/industry-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/industry-research.md), [`skills/earnings-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/earnings-team.md), [`skills/investment-team.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-team.md), and [`skills/industry-funnel.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/industry-funnel.md) is defined as a Markdown-based "slash-command" that explicitly lists seven analysis modules. Every module maps to a specific master's viewpoint, creating a structured template that the Claude-Code or Codex runtime parses into executable steps.

These Markdown files declare the research process in plain text, making the methodology transparent and editable without requiring code changes. The seven-step template is consistent across all research-related skills, guaranteeing that every report follows the same four-master structure regardless of sector or asset class.

### Execution Pipeline: From Parsing to Challenge Prompts

When a user invokes a skill—such as `/ investment-research 腾讯`—the runtime parses the Markdown and executes steps in order. At the end of each of the seven analysis modules, the pipeline inserts master-specific "追问" (challenge) prompts that force deeper examination through a particular master's lens.

For example, after analytical blocks, the system injects prompts such as those found in lines 100-112 of [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md), including "段永平式追问：这门生意好在哪？" (Duan Yong-ping style challenge: What makes this business good?). These hard-coded challenges ensure that AI-generated analysis reflects the qualitative depth and skeptical rigor characteristic of the four masters, rather than surface-level financial metrics.

### Report Generation: Mandatory Four-Master Review Sections

The final report template enforces the inclusion of a "四大师模拟点评" (Four Masters Simulation Review) section, a confidence-rating grid, and explicit AI-bias disclosures. As implemented in lines 97-100 and 195-197 of [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md), this requirement ensures every output document contains distinct sections where the investment thesis is evaluated from each of the four masters' perspectives.

Generated reports in the `reports/` directory, such as `reports/领益智造/领益智造投资研究报告-20260707.md`, demonstrate this structure in practice, providing concrete examples of how the methodology manifests in completed research documents.

## Data Validation and Automation Layer

The four-master methodology demands the data-first discipline championed by Buffett and Munger, enforced through mandatory validation tools. Before any qualitative judgment is recorded, the workflow automatically triggers [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) to verify market-cap data and other financial metrics, followed by [`tools/report_audit.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/report_audit.py) to audit the draft report for structural completeness.

This automation ensures that the AI cannot proceed to master-specific qualitative analysis until quantitative rigor is established. The [`AGENTS.md`](https://github.com/xbtlin/ai-berkshire/blob/main/AGENTS.md) file documents the compatibility rules that keep these Markdown skills synchronized with generated Codex artifacts in `codex-skills/*/SKILL.md`, preserving the four-master logic for both Claude Code and Codex users when running [`scripts/sync-codex-skills.py`](https://github.com/xbtlin/ai-berkshire/blob/main/scripts/sync-codex-skills.py).

## How to Trigger the Four-Master Workflow

Users invoke the methodology through simple slash commands that activate the full seven-module pipeline with embedded master challenges.

```bash

# Invoke the investment-research skill for a ticker

/ investment-research 腾讯

```

*Internal execution flow:*

1. **Parser** reads [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md) and extracts the seven modules.
2. **Step 1** gathers data (lines 35-53) and runs `tools/financial_rigor.py verify-market-cap`.
3. **Step 2-6** execute the seven analysis blocks, each ending with a master-specific challenge prompt (e.g., line 100 for Buffett, line 110 for Munger).
4. **Step 7** calls [`tools/report_audit.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/report_audit.py) to audit the draft.
5. **Final report** writes to `~/腾讯投资研究报告.md`, containing the required "四大师模拟点评" section.

## Summary

- **Modular Markdown Architecture**: The four-master methodology lives in plaintext skill definitions at [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md) and related files, making the framework transparent and version-controllable.
- **Hard-coded Challenge Prompts**: Master-specific "追问" prompts are embedded at lines 100-112 of the investment research skill, forcing Duan Yong-ping, Li Lu, Buffett, and Munger-style scrutiny at each analysis stage.
- **Mandatory Validation Gates**: [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) and [`tools/report_audit.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/report_audit.py) enforce quantitative rigor before qualitative judgment, aligning with the data-first principles of the four masters.
- **Cross-Skill Consistency**: All research skills share the same seven-step template, ensuring uniform application of the four-master framework across stocks, industries, and earnings calls.
- **Automated Report Structure**: Every output must include the "四大师模拟点评" section, confidence ratings, and bias disclosures as defined in lines 97-100 of the skill files.

## Frequently Asked Questions

### What are the four masters in AI Berkshire's methodology?

The four-master framework integrates the investment philosophies of **Warren Buffett** (margin of safety, moat analysis), **Charlie Munger** (latticework of mental models, multidisciplinary thinking), **Duan Yong-ping** (business quality and cultural analysis), and **Li Lu** (value investing with a focus on understanding the business deeply). These are hard-coded as distinct analytical lenses throughout the research pipeline in the AI Berkshire repository.

### How does the four-master methodology enforce data quality?

According to the AI Berkshire source code, the workflow mandates calling [`tools/financial_rigor.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/financial_rigor.py) for quantitative verification and [`tools/report_audit.py`](https://github.com/xbtlin/ai-berkshire/blob/main/tools/report_audit.py) for structural auditing before any master-specific qualitative analysis occurs. This ensures that Buffett and Munger's data-first discipline is maintained regardless of which AI model generates the research.

### Can I customize the master-specific prompts in AI Berkshire?

Yes. Because the skill definitions are Markdown-based files located in the `skills/` directory—particularly [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md) lines 100-112 where challenge prompts are defined—you can edit the "追问" prompts without modifying Python code. Running [`scripts/sync-codex-skills.py`](https://github.com/xbtlin/ai-berkshire/blob/main/scripts/sync-codex-skills.py) propagates these changes to the `codex-skills/` artifacts for Codex compatibility.

### Where does the four-master methodology appear in generated reports?

Every completed investment report must include the "四大师模拟点评" section as enforced by the template in lines 97-100 and 195-197 of [`skills/investment-research.md`](https://github.com/xbtlin/ai-berkshire/blob/main/skills/investment-research.md). This section requires explicit evaluation of the investment thesis from each of the four masters' viewpoints, along with confidence ratings and AI-bias disclosures, as seen in example reports under `reports/领益智造/` and similar directories.