How AI Berkshire Handles Thesis Drift Analysis: A Claude Code Skill Deep Dive

AI Berkshire detects investment thesis drift through a Claude Code skill named /thesis-drift that compares report versions using structured evidence extraction and numerical validation via tools/financial_rigor.py, ignoring superficial wording changes to isolate only factual shifts in valuation, risk, and assumptions.

AI Berkshire implements thesis drift analysis as a specialized Claude Code skill that systematically compares investment theses to identify material changes while filtering out cosmetic edits. The /thesis-drift command defined in skills/thesis-drift.md operates by extracting structured evidence from markdown reports and validating all quantitative changes through exact decimal arithmetic. This approach ensures that drift detection reflects only verifiable factual shifts rather than stylistic revisions.

Input Parsing and Three Operation Modes

The skill accepts flexible input formats to accommodate different analytical workflows, automatically detecting whether to use explicit file paths or discovery-based comparison.

Explicit File Path Comparison

The skill accepts Chinese company names followed by explicit file paths using the format 公司名 旧报告路径 新报告路径. This mode directly loads the specified markdown files from the repository for immediate comparison.

Automatic Snapshot Discovery

When provided only a company name, the skill scans the reports/ directory to automatically locate the earliest and latest thesis snapshots matching the company identifier. This enables historical drift analysis without requiring manual file specification.

Missing Baseline Handling

If no historical baseline exists for the requested company, the skill aborts execution and returns a specific error message prompting the user to first run /thesis-tracker to establish a structured baseline. This prevents invalid comparisons against non-existent data and maintains analytical integrity.

Structured Evidence Extraction and the Factual Matrix

The skill extracts seven standardized sections from each report to ensure consistent comparison: core thesis (limited to ≤5 sentences), core-assumption checklist, red-line risk checklist, valuation anchors (price targets and multiples), management-quality assessment, competitive-moat assessment, and final recommendation status (Buy/Hold/Reduce/Exit). Missing sections are flagged as "结构缺失" but processing continues with available evidence.

Extracted facts assemble into a structured matrix with columns: 维度 | 旧报告证据 | 新报告证据 | 数据来源 | 是否可验证. Only evidence within this matrix drives drift decisions; phrasing differences and editorial changes are explicitly excluded from consideration. This evidence-normalization step ensures that only substantive factual changes trigger drift classifications.

Numerical Validation with Financial Rigor

All quantitative changes undergo verification through tools/financial_rigor.py, which implements exact decimal arithmetic using Python's Decimal type rather than floating-point calculations. This guarantees precise validation of metrics like EPS, market capitalization, and valuation multiples through cross-source verification.

Example CLI usage for valuation verification:

python3 tools/financial_rigor.py verify-valuation \
    --price 520 --eps 23.5 --bvps 118 --fcf-per-share 15

Python implementation within the skill workflow:

from tools.financial_rigor import verify_valuation

verify_valuation(
    price=new_price,
    eps=new_eps,
    bvps=new_bvps,
    fcf_per_share=new_fcf,
)

This validation step ensures that numerical changes in the thesis reflect mathematically accurate shifts rather than calculation approximations or data entry errors.

Dimensional Drift Judgement Across Five Core Dimensions

The skill evaluates five core dimensions: 估值锚点 (valuation anchors), 核心假设 (core assumptions), 红线 (risk red-lines), 管理层质量 (management quality), and 竞争护城河 (competitive moat). Each dimension receives one of three judgements defined in the decision table:

  • Improved: Evidence shows a stronger investment case (e.g., higher safety margin, new positive data)
  • Unchanged: No verifiable factual change detected; wording differences are ignored
  • Weakened: Evidence degrades the previous view (e.g., new red-line triggered, assumption invalidated)

When data sources conflict or evidence is missing, the skill marks the dimension as "无法判断" rather than inferring conclusions, maintaining strict uncertainty flagging.

Evidence-Driven Reporting Template

The final output follows a strict seven-section template defined in skills/thesis-drift.md to ensure complete traceability:

  1. Comparison objects and time span identification
  2. Overall drift conclusion (Unchanged/Positive/Negative/Insufficient)
  3. Dimensional drift table with concrete evidence and confidence levels
  4. Detailed evidence differences between versions
  5. Valuation and numeric recalculation results from financial_rigor.py
  6. Recommendation migration tracking (e.g., Hold → Reduce)
  7. Open items and next-evidence requirements

This structure ensures every Improved or Weakened classification traces directly to specific data points in the factual matrix, preventing unsubstantiated drift claims.

Core Principles Enforcing Analytical Rigor

The skill enforces four strict principles to maintain investment analysis integrity:

  • Evidence > Wording: Only factual shifts trigger drift classifications; editorial changes are ignored
  • Fundamentals > Price: Stock price movements alone affect valuation anchors but do not constitute thesis drift without underlying fundamental changes
  • Exact Calculations: All arithmetic uses the Decimal-based toolkit in financial_rigor.py with no floating-point shortcuts
  • Uncertainty Flagging: Conflicting or missing data sources result in explicit "无法判断" markers rather than synthetic guesses

Summary

  • AI Berkshire implements thesis drift analysis through the /thesis-drift Claude Code skill defined in skills/thesis-drift.md and mirrored in codex-skills/thesis-drift/SKILL.md
  • The system operates in three modes: explicit file comparison, automatic snapshot discovery, and baseline validation with abort-on-missing safeguards
  • Structured evidence extraction creates a factual matrix (维度 | 旧报告证据 | 新报告证据 | 数据来源 | 是否可验证) that drives all drift decisions while ignoring cosmetic wording changes
  • Quantitative validation uses tools/financial_rigor.py with exact decimal arithmetic for metrics like PE, PB, and FCF yield
  • Five core dimensions (估值锚点, 核心假设, 红线, 管理层质量, 竞争护城河) are judged as Improved, Unchanged, or Weakened based on verifiable evidence
  • Output follows a strict seven-section template ensuring traceability from conclusions to specific data points

Frequently Asked Questions

What triggers a thesis drift classification in AI Berkshire?

A drift classification triggers only when verifiable factual changes occur in core assumptions, valuation anchors, risk red-lines, management quality, or competitive moats. According to the skills/thesis-drift.md specification, superficial wording differences, formatting changes, or stock price movements alone do not constitute drift. The system requires evidence in the factual matrix showing concrete changes to data sources or calculations.

How does the system handle missing historical data?

If the skill cannot locate a historical baseline in the reports/ directory, it aborts execution immediately and returns a specific error message prompting the user to first run /thesis-tracker to establish a structured baseline. This prevents invalid comparisons and ensures drift analysis always references actual historical snapshots rather than generating synthetic baselines.

What is the role of tools/financial_rigor.py in drift detection?

The financial_rigor.py module provides exact decimal arithmetic validation for all quantitative metrics extracted from reports. It verifies valuation multiples, EPS calculations, and market capitalization data using cross-source validation and Benford checks, ensuring that numerical changes in the thesis reflect mathematically accurate shifts rather than floating-point approximation errors.

Can the skill detect positive improvements or only negative drift?

The system evaluates drift bidirectionally, classifying changes as Improved, Unchanged, or Weakened for each of the five core dimensions. This allows the skill to identify strengthening investment cases (such as improved management quality, expanded safety margins, or invalidated risk scenarios) as well as deteriorating conditions, providing a complete picture of thesis evolution.

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 →