This repository, ai-hedge-fund, is a production-grade simulation engine for running AI-managed hedge funds in educational and research contexts. It provides a dual-mode system supporting both historical backtesting and live paper trading, all adhering to point-in-time data integrity to prevent look-ahead bias. The architecture is modular and protocol-based, with swappable components for data acquisition (Financial Datasets API), LLM providers (Anthropic, OpenAI, DeepSeek, Google, xAI, Kimi, TypeSafe/Jev), broker execution (simulated/paper), signal generation (quant models and LLM agents emulating investors like Buffett, Munger, Graham), and risk management. The engine includes a hash-chained ledger for tamper-evident record keeping, prompt caching to eliminate redundant LLM costs during backtests, and a textual TUI for interactive management. It is explicitly not intended for real trading and is released under MIT license. The codebase is well-structured with clean abstractions, though it carries some technical debt from being a ground-up v2 rebuild that is not yet fully integrated with its predecessor, and contains hardcoded constants and magic numbers that limit configurability.