AI-Berkshire Integration with External Platforms: Claude Code, OpenAI Codex, and Custom APIs
AI-Berkshire supports dual-platform integration with Claude Code and OpenAI Codex through a three-layer architecture that exposes plain-text skill definitions and command-line tool interfaces, enabling connections to external APIs and custom agents without modifying core system code.
AI-Berkshire is an open-source investment research framework built by xbtlin that natively supports ai-berkshire integration with multiple LLM platforms. The repository's architecture deliberately separates concerns into three distinct layers—Skill, Agent, and Tool—making it possible to run the same investment research workflows across different AI providers or connect to external data sources through standard interfaces.
Three-Layer Architecture Designed for Integration
The integration capabilities stem from a modular design where each layer communicates through standard interfaces rather than proprietary APIs.
Skill Layer: Declarative Markdown Definitions
The system defines 19 capabilities as declarative Markdown files located in skills/*.md. These files describe commands like /investment-research and /news-pulse using plain text that any LLM client can interpret. Because skills are not hardcoded to specific SDKs, they compile into both Claude Code commands and Codex skill packages.
Agent Layer: Provider-Agnostic Orchestration
Team-lead agents coordinate multiple "master" agents that emulate four distinct investing philosophies. The orchestration logic resides in pure Python modules that do not import provider-specific libraries, allowing the same agent code to execute under Claude Code, OpenAI Codex, or future LLM runtimes.
Tool Layer: CLI-First External Interfaces
All computational heavy lifting lives in the tools/ package, including financial_rigor.py for calculations and xueqiu_scraper.py for data fetching. These tools expose command-line interfaces rather than Python APIs, enabling any platform that supports subprocess execution—including REST API wrappers or internal data warehouses—to invoke AI-Berkshire functionality.
Dual LLM Platform Support
The repository maintains first-class integration with both Anthropic and OpenAI ecosystems.
Claude Code Integration
Running ./scripts/install-claude-commands.sh registers all 19 skills as native Claude Code slash commands. The script parses the Markdown skill definitions and installs them into the Claude Code environment, allowing users to execute:
claude /investment-research 腾讯
This triggers the four-master agent to perform a full research run using the orchestration logic.
OpenAI Codex Compatibility
The scripts/sync-codex-skills.py utility transforms the same skills/*.md sources into Codex-compatible skill packages. This generates declarative skill definitions that Codex can execute, ensuring identical behavior across platforms:
codex --skill investment-research 腾讯
Extending to Custom Platforms and External APIs
Beyond the supported LLM clients, AI-Berkshire integrates with arbitrary external services through the tool layer.
To add a new data source, create a Python module in tools/ (e.g., tools/esg_fetcher.py) that accepts command-line arguments. Reference this tool from any skill's command block using standard shell execution:
python3 tools/esg_fetcher.py --ticker $TICKER > esg.txt
This pattern allows integration with:
- Third-party financial data APIs
- Internal enterprise data warehouses
- Custom agent frameworks
- CI/CD pipelines
Practical Implementation: Integration Examples
Install Claude Code commands:
git clone https://github.com/xbtlin/ai-berkshire.git
cd ai-berkshire
./scripts/install-claude-commands.sh
Execute via Claude Code:
claude /investment-research 腾讯
Install Codex skills:
./scripts/install-codex-skills.sh
Execute via Codex:
codex --skill investment-research 腾讯
Add custom tool integration:
# tools/esg_fetcher.py
import argparse
import requests
def fetch_esg(ticker):
# Implementation to fetch ESG scores
pass
if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument("--ticker", required=True)
args = parser.parse_args()
print(fetch_esg(args.ticker))
Summary
- AI-Berkshire integrates natively with Claude Code and OpenAI Codex through dual-compatibility scripts
- The Skill layer uses plain Markdown files (
skills/*.md) that compile to multiple LLM formats - The Tool layer exposes CLI interfaces via
tools/*.py, enabling subprocess-based integration with any platform - Agent logic is written in pure Python without provider-specific dependencies
- New integrations require only adding files to
tools/and referencing them in skill definitions
Frequently Asked Questions
Can AI-Berkshire integrate with LLM platforms other than Claude Code and OpenAI Codex?
Yes. Because the skill definitions are plain Markdown and the agent logic uses standard Python without provider-specific SDKs, any LLM client that supports either Markdown-based skill definitions or subprocess execution can run AI-Berkshire workflows.
How do I add a new external API to AI-Berkshire?
Create a new Python file in the tools/ directory that accepts command-line arguments, then reference it from a skill's command block using shell syntax. The existing tools/xueqiu_scraper.py serves as a reference implementation for HTTP-based data fetching.
Does integrating custom tools require modifying the core agent code?
No. The three-layer architecture ensures that custom tools integrate at the Tool layer, while skills reference them through shell commands. This plug-and-play design keeps the Agent layer and core repository code untouched.
What is the difference between the Claude Code and Codex integration scripts?
scripts/install-claude-commands.sh installs skills as native Claude Code slash commands, while scripts/sync-codex-skills.py packages the same skills/*.md files into Codex-compatible skill formats. Both consume the same source files but target different LLM client ecosystems.
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 →