How to Set Up the AI Berkshire Environment: A Complete Installation Guide
Clone the repository, install your preferred AI client (Claude Code or OpenAI Codex), and run the installation scripts to deploy the skill layer.
The AI Berkshire project (xbtlin/ai-berkshire) implements a three-layer architecture that separates Skills, Agents, and Tools to provide investment research capabilities through AI assistants. Setting up the environment requires configuring the skill layer to communicate with either Claude Code or Codex clients, enabling parallel agent execution for financial analysis.
Prerequisites
Before installing the AI Berkshire environment, ensure you have the following:
- Node.js (for Claude Code or Codex CLI installation)
- Python 3 (for running the Codex skill synchronization scripts)
- Git (to clone the repository)
The repository supports two primary client interfaces: Claude Code (@anthropic-ai/claude-code) and OpenAI Codex (@openai/codex). You only need to install one to interact with the system.
Step-by-Step Installation Guide
Clone the Repository
Start by cloning the GitHub repository and navigating into the project directory:
git clone https://github.com/xbtlin/ai-berkshire.git
cd ai-berkshire
Install the AI Client
Choose and install your preferred client interface:
For Claude Code users:
npm install -g @anthropic-ai/claude-code
For Codex users:
# Option 1: Using the official installer
curl -fsSL https://chatgpt.com/codex/install.sh | sh
# Option 2: Using npm
npm install -g @openai/codex
# Option 3: Using Homebrew (macOS)
brew install --cask codex
Deploy the Skill Layer
The skill layer consists of human-readable markdown files under skills/ that define concrete entry points like /investment-research and /quality-screen.
For Claude Code:
Run the installation script to copy the markdown-based skill definitions into the global Claude Code command directory:
./scripts/install-claude-commands.sh
For Codex:
First, the system regenerates the Codex skill packages from the canonical skills/ sources using scripts/sync-codex-skills.py, then installs them:
./scripts/install-codex-skills.sh
This script automatically generates the Codex-compatible skill packages in codex-skills/**/SKILL.md from the source files in skills/.
Optional Codex UI Enhancements
To get a Claude-like slash-command interface within Codex, install the optional prompt definitions:
./scripts/install-codex-prompts.sh
This copies the markdown prompt files from codex-prompts/*.md into the appropriate configuration directory.
Verifying Your Setup
Confirm the installation by checking your client version:
# Claude Code
claude --version
# Codex
codex --version
Test the skill invocation with a sample command:
# Claude Code syntax
/investment-research 腾讯
# Codex syntax (after client restart)
investment-research 腾讯
When you invoke a skill, the Agent Layer activates four independent AI agents running in parallel, each adopting a different "master-investor" perspective (巴菲特, 芒格, 段永平, 李录). These agents gather data and return judgments that a Team-Lead agent aggregates. The Tool Layer in tools/—including tools/financial_rigor.py—provides reproducible calculations using Python's decimal.Decimal to avoid floating-point errors during market-cap verification and valuation checks.
Summary
- AI Berkshire (
xbtlin/ai-berkshire) uses a three-layer architecture separating Skills, Agents, and Tools for investment research. - Installation requires cloning the repo, installing either Claude Code or Codex, and running the appropriate installation script (
scripts/install-claude-commands.shorscripts/install-codex-skills.sh). - Skill files are defined in
skills/*.mdand automatically synchronized to Codex format viascripts/sync-codex-skills.py. - Verification involves testing skill commands like
/investment-researchorinvestment-teamfollowed by a company name. - Core utilities in
tools/financial_rigor.pyensure precise financial calculations usingdecimal.Decimal.
Frequently Asked Questions
Do I need to install both Claude Code and Codex?
No, you only need one client. The repository supports both Claude Code and OpenAI Codex as interchangeable entry points. Choose the client that matches your AI subscription and install the corresponding skills using either scripts/install-claude-commands.sh or scripts/install-codex-skills.sh.
What is the difference between the skills in skills/ and codex-skills/?
The skills/ directory contains the canonical human-readable markdown definitions that serve as the source of truth. The codex-skills/ directory contains auto-generated packages created by scripts/sync-codex-skills.py specifically for the Codex client format. You should edit files in skills/ only; the sync script handles the transformation.
Why does the tool layer use decimal.Decimal instead of float?
According to the source code in tools/financial_rigor.py, the Tool Layer uses Python's decimal.Decimal for all numeric calculations to maintain exact precision. This prevents floating-point rounding errors that could occur during financial validations like market-cap verification or valuation ratio calculations, ensuring reproducible results.
Can I use the slash prompts without installing the full skill set?
No, the slash prompts in codex-prompts/*.md are optional UI enhancements that work alongside the main skill layer. They provide a Claude-like interface for Codex users, but you must still run scripts/install-codex-skills.sh to install the actual skill functionality that invokes the agent layer and tool utilities.
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:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →