How xbtlin/ai-berkshire works
Purpose and Entry Points
AI Berkshire is a repository of AI-agent investment-research workflows, reusable skills/prompts, precision financial tools, and generated research artifacts. It is not a deployed application or service. Users install skills into Claude Code or Codex, then invoke research workflows by name. Primary entry points are skills/*.md for Claude Code, codex-skills/*/SKILL.md for Codex, and optional Codex slash prompts in codex-prompts/*.md.
Canonical Workflow Distribution
The Claude-oriented Markdown skills are the canonical workflow definitions; Codex skill packages are generated copies. Installation scripts put these assets into client-specific global directories, while synchronization scripts maintain parity.
• skills/investment-research.md
• scripts/sync-codex-skills.py
• scripts/install-codex-skills.sh
This boundary matters: workflow edits should originate in skills/, then be propagated rather than independently changed in generated Codex skill directories.
Research Orchestration Layer
Skills encode task-specific control flows for company research, earnings review, industry discovery, screening, portfolio review, news triage, and publication. The deepest flows use four independent value-investing perspectives—business model, financial/valuation, contrarian risk, and long-term trend—then synthesize a decision. Team-oriented workflows delegate parallel agent work; lightweight workflows go directly to tools and structured outputs.
• skills/investment-team.md
• skills/earnings-team.md
• skills/industry-funnel.md
Data Acquisition and Quantitative Validation
The tool layer provides local Python CLIs for financial calculations, data retrieval, screens, backtests, and report checking. financial_rigor.py is the central correctness boundary: it uses decimal.Decimal for market-cap, valuation, cross-source, and scenario calculations, preventing LLM arithmetic or unit errors. Data inputs are persisted locally as CSV/JSON rather than behind a database.
• tools/financial_rigor.py
• tools/stock_screener.py
• data/fundamentals.json
External data is obtained by tools or agent research from market/public sources; visible integrations include Morningstar-oriented data, A-share/Taiwan-stock access, and Xueqiu scraping. No always-on data pipeline or credentials-managed service is represented in the tree.
• tools/morningstar_fair_value.py
• tools/ashare_data.py
• tools/xueqiu_scraper.py
Evidence, Audit, and Reproducibility
High-stakes reports commonly preserve a research package alongside the prose: original PDFs/text, source registries, assumptions, model inputs, calculation outputs, audit samples, verdicts, and Python reproduction scripts. This creates a file-based provenance boundary between claims, inputs, and independently rerunnable verification.
• reports/腾讯/审计-20260906/复核计算.py
• reports/泡泡玛特/审计-20260906/audit-results.json
• reports/快手/《看懂快手》-20260906/审计/reproduce.py
Generic report-level quality checks are implemented separately and tested, supporting consistency across the large report corpus.
• tools/report_audit.py
• tests/test_financial_rigor.py
• tests/test_report_audit.py
Research Corpus and Indexing
reports/ is the principal product store: Markdown investment reports organized by company, sector, screening universe, and recurring research series. It also contains generated audit evidence and occasional publishable PDF artifacts. Index files expose the corpus; reports_index.py updates README/index material rather than serving a runtime search API.
• reports/README.md
• reports/index.json
• tools/reports_index.py
Runtime and Operational Model
The material runtimes are Python 3 for tools, synchronization, audits, and report builds; shell/batch scripts for installation; and user-installed Claude Code or OpenAI Codex clients for agent execution. One specialized publication pipeline builds a bilingual survey manuscript into LaTeX/PDF outputs.
• reports/RSI-survey-20260906/build.py
• reports/RSI-survey-20260906/arxiv/main.tex
• output/pdf/rsi-survey-en-20260906.pdf
There is no web server, database, queue, container, or cloud infrastructure represented. GitHub provides repository hosting and issue intake; agent clients and external public/market-data sources are the primary execution dependencies.
Main entry points: README.md Research report corpus · morningstar_fair_value.py Market-data tools · financial_rigor.py Financial rigor · fundamentals.json Fundamentals data
Components 18
Workflow Distribution
Canonical skills and generated client packages.
- Claude skill definitions · Canonical definitions edited by authors.
skills/investment-research.md - Team research workflows · Parallel perspectives are synthesized into an investment decision.
skills/investment-team.md - Earnings team workflow
skills/earnings-team.md - Industry funnel workflow
skills/industry-funnel.md - Codex skill synchronizer · Propagates canonical Claude skills into generated Codex packages.
scripts/sync-codex-skills.py - Codex installer · Installs skill assets into the user's Codex directory.
scripts/install-codex-skills.sh
Research Execution
Agent-led workflows and local validation tools.
- Claude Code and Codex · Users invoke installed workflows by name.
- Public market sources · Agent research and tools obtain market and public information.
- Market-data tools · Retrieves Morningstar, A-share/Taiwan, and Xueqiu-oriented data.
tools/morningstar_fair_value.py - Financial rigor · Decimal-based valuation, cross-source, and scenario correctness boundary.
tools/financial_rigor.py - Stock screener
tools/stock_screener.py - Fundamentals data · Local persisted financial inputs.
data/fundamentals.json - Report quality audit · Applies generic report-level consistency checks.
tools/report_audit.py
Research Artifacts
File-based reports, evidence, indexes, and publication outputs.
- Research report corpus · Principal product store for company, sector, screen, and series research.
reports/README.md - Audit and reproduction packages · Preserves inputs, calculations, verdicts, and rerunnable verification.
reports/腾讯/审计-20260906/复核计算.py - Corpus indexes · Updates repository index material; it is not a search service.
reports/index.json - RSI survey build · Builds a bilingual survey manuscript into publication artifacts.
reports/RSI-survey-20260906/build.py - Published survey PDF
output/pdf/rsi-survey-en-20260906.pdf
Connections 21
- Claude skill definitions → Codex skill synchronizer: source for generation
- Codex skill synchronizer → Codex installer: generated skills
- Codex installer → Claude Code and Codex: installs into
- Claude skill definitions → Claude Code and Codex: installed for Claude
- Team research workflows → Claude Code and Codex: invoked by
- Earnings team workflow → Claude Code and Codex: invoked by
- Industry funnel workflow → Claude Code and Codex: invoked by
- Claude Code and Codex → Market-data tools: uses
- Claude Code and Codex → Financial rigor: validates calculations with
- Claude Code and Codex → Stock screener: runs
- Claude Code and Codex → Research report corpus: creates research
- Public market sources → Market-data tools: data retrieval
- Market-data tools → Fundamentals data: persists inputs
- Fundamentals data → Financial rigor: calculation inputs
- Stock screener → Fundamentals data: screens
- Financial rigor → Audit and reproduction packages: calculation outputs
- Research report corpus → Audit and reproduction packages: preserves provenance
- Report quality audit → Research report corpus: checks
- Research report corpus → Corpus indexes: indexed by
- Research report corpus → RSI survey build: survey source
- RSI survey build → Published survey PDF: builds