How to Implement a Thesis-Tracker for Investment Theses in AI-Berkshire

The thesis-tracker is a markdown-driven workflow that automatically detects whether to create a new investment thesis or validate an existing one, storing structured hypothesis tables and automated health scores in version-controlled files.

The xbtlin/ai-berkshire repository provides a disciplined, post-buy workflow for investors through its self-contained thesis-tracker skill. This system operates entirely within markdown files, requiring no external database while maintaining rigorous validation of your investment hypotheses over time through automated data pulls and structured reporting.

Architecture of the Thesis-Tracker System

The implementation follows a four-layer architecture defined in skills/thesis-tracker.md. Each layer handles a distinct responsibility, from mode detection to final report generation.

Mode Dispatcher (A-Mode vs B-Mode)

At lines 27-30 of skills/thesis-tracker.md, the mode dispatcher checks for the existence of reports/{company}-thesis.md to determine execution path:

  • A-mode (Creation): Triggered when no thesis file exists. The system establishes a new investment thesis with baseline data.
  • B-mode (Tracking): Triggered when a thesis file exists. The system pulls fresh data and validates existing hypotheses against current market conditions.

This dispatcher enables the same command—/thesis-tracker {company}—to function as both entry point and maintenance tool.

Data Engine and Financial Verification

The data engine handles information gathering differently depending on mode:

  • A-mode (lines 36-40): Invokes WebSearch for current price, PE/PB multiples, and dividend data, then calls tools/financial_rigor.py verify-valuation to validate market metrics.
  • B-mode (lines 16-23): Reads the existing thesis file, then pulls quarterly reports, news updates, and insider trade data to validate each hypothesis.

The tools/financial_rigor.py utility serves as the quantitative backbone, ensuring all valuation inputs pass verification before entering the thesis document.

Report Generator and File Structure

The report generator produces a structured markdown file at reports/{company}-thesis.md containing four critical tables:

  1. Core Hypothesis Table (lines 61-68): Tracks assumptions with validation methods and frequencies
  2. Red-Line Table (lines 73-78): Defines breaking points that trigger immediate action
  3. Valuation Anchor Table (lines 83-91): Establishes price targets and margin of safety metrics
  4. Tracking Record (lines 96-102): Appends historical check results after each B-mode run

The write-out logic is implemented in section A5 (lines 93-103) for new theses and B7 (lines 94-100) for updates.

Scoring Engine and Health Calculation

The scoring engine computes a health score (0-10) based on broken or red-line hypotheses. According to lines 76-82 of the skill file, this formula evaluates the severity of hypothesis violations to drive final recommendations—add, hold, reduce, or sell.

Step-by-Step Implementation Guide

Creating a New Thesis (A-Mode)

Run the tracker for a new company to initiate thesis creation:

/thesis-tracker Pinduoduo

The system executes this workflow:

  1. A0: Pulls latest price, PE/PB, and dividend data via WebSearch, then runs tools/financial_rigor.py verify-valuation
  2. A1: Prompts for a five-sentence core thesis following the template at lines 44-52
  3. A2-A4: Guides completion of hypothesis, red-line, and valuation tables
  4. A5: Serializes everything into reports/Pinduoduo-thesis.md

Running Quarterly Validation (B-Mode)

For existing positions, trigger a tracking check:

/thesis-tracker Pinduoduo 季度检查

The B-mode workflow executes:

  1. B1-B3: Loads the existing file, fetches fresh financial data, and re-evaluates each hypothesis
  2. B4: Scans the red-line table for any triggered conditions
  3. B5: Updates the valuation anchor with current market metrics
  4. B6-B7: Calculates the health score, generates a narrative summary, and appends a new row to the tracking record

Thesis File Structure and Templates

Each generated thesis file follows a strict markdown schema. Here is the structure from reports/Pinduoduo-thesis.md:


# Pinduoduo 投资论文(2026‑04‑09)

**建立日期**:2023‑03‑15  
**买入价格**:¥9.80(持仓 20%)  

## 核心论文(5 句)

我以 9.80元 买入 拼多多,因为:  
1. 这门生意的本质是社交电商,我理解它的赚钱方式  
2. 护城河是庞大的活跃用户基数,且在变宽  
3. 管理层执行力强,值得信赖的原因是 CEO 直接参与产品迭代  
4. 当前价格相当于内在价值的 0.75 折,安全边际来自 30% 的自由现金流  
5. 即使我错了,下行风险可控,因为业务具有高度可变成本结构  

## 核心假设清单

| # | 核心假设 | 验证方式 | 验证频率 | 当前状态 |

|---|----------|----------|----------|----------|
| 1 | 收入增速维持 15%+ | 季报收入增速 | 每季度 | 🟢 成立 |
| 2 | 毛利率稳定在 60%+ | 季报毛利率 | 每季度 | 🟢 成立 |
| 3 | 管理层持续回购 | 回购公告/现金流表 | 每季度 | 🟢 成立 |
| 4 | 竞争对手未取得突破 | 行业数据/竞对财报 | 每半年 | 🟢 成立 |

## 红线清单

| # | 红线条件 | 严重程度 | 触发后动作 |

|---|----------|----------|------------|
| 1 | 管理层诚信出问题(财务造假、关联交易) | 致命 | 立即清仓 |
| 2 | 核心业务连续 2 季度收入下滑 | 严重 | 减仓 50%,重新评估 |
| 3 | 护城河被明确突破(竞对获得同等能力) | 严重 | 启动深度研究,考虑退出 |

## 估值锚点

| 指标 | 买入时 | 乐观目标 | 中性目标 | 悲观情景 |
|------|--------|----------|----------|----------|
| 股价 | 9.80 | 12.50 | 10.40 | 8.20 |
| PE   | 15x | 20x | 15x | 10x |
| 市值 | 1.2T | 1.8T | 1.5T | 1.0T |
| 内在价值估算 | 13.00 | — | — | — |
| 安全边际 | 30% | — | — | — |

## 追踪记录表

| 检查日期 | 健康度 | 核心变化 | 动作建议 |
|----------|:------:|----------|----------|
| 2026‑04‑09 | 7/10 | 收入增速放缓至 12%,但利润率改善 | 持有 |

Automating Verification with Financial Rigor

The system integrates quantitative validation through tools/financial_rigor.py. When invoked with the verify-valuation subcommand (as seen in line 40 of the skill definition), this utility cross-checks market-cap calculations, PE/PB ratios, and dividend yields against primary sources before committing them to the thesis file.

This ensures that your valuation anchor table remains grounded in verified data rather than manual input errors.

Summary

  • The thesis-tracker in xbtlin/ai-berkshire provides a completemarkdown-driven workflow for investment management
  • Mode detection at lines 27-30 automatically selects between thesis creation (A-mode) and validation (B-mode) based on file existence
  • Data verification relies on tools/financial_rigor.py to validate all valuation metrics before storage
  • Four structured tables—core hypothesis, red-line, valuation anchor, and tracking record—maintain investment discipline
  • Health scoring (lines 76-82) quantifies thesis integrity on a 0-10 scale to drive actionable recommendations
  • All state persists in reports/{company}-thesis.md, making the system fully portable and version-controllable

Frequently Asked Questions

What triggers A-mode versus B-mode in the thesis-tracker?

The mode dispatcher at lines 27-30 of skills/thesis-tracker.md checks for the existence of reports/{company}-thesis.md. If the file is absent, the system enters A-mode to create a new thesis. If present, it enters B-mode to run a tracking check. You can force recreation by appending 建立论文 to the command.

How is the health score calculated for investment theses?

The scoring engine defined at lines 76-82 calculates a health score from 0 to 10 based on the number of broken hypotheses and triggered red-line conditions. Each violation deducts points according to severity, with fatal red-lines (like management fraud) typically dropping the score to immediate sell territory.

Can I use the thesis-tracker with Codex or Claude-Code?

Yes. The repository includes codex-skills/thesis-tracker/SKILL.md, which is auto-generated by scripts/sync-codex-skills.py from the canonical markdown definition. This wrapper makes the same workflow available to Codex users, while Claude-Code users can invoke the skill directly via the /thesis-tracker command interface.

Where are thesis files stored in the repository?

All thesis files are stored in the reports/ directory as {company}-thesis.md (e.g., reports/Pinduoduo-thesis.md). This design keeps investment data under version control, enables diff tracking over time, and ensures no external database dependencies—making the system fully portable across environments.

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 →