Skip to content

Commit 181b4be

Browse files
committed
docs: update documentation to reflect architecture changes
Update CLAUDE.md and README.md with simplified CLI usage, new architecture descriptions, and updated run organization structure.
1 parent 02950cc commit 181b4be

2 files changed

Lines changed: 51 additions & 74 deletions

File tree

CLAUDE.md

Lines changed: 40 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -25,44 +25,35 @@ litellm --config config/litellm.yaml
2525
### Running the Application
2626

2727
```
28-
usage: balatrollm [-h] [--model MODEL] [--base-url BASE_URL]
29-
[--api-key API_KEY] [--list-models]
30-
[--litellm-config LITELLM_CONFIG] [--strategy STRATEGY]
31-
[--verbose] [--config CONFIG]
28+
usage: balatrollm [-h] [--model MODEL] [--list-models] [--strategy STRATEGY]
29+
[--base-url BASE_URL] [--api-key API_KEY] [--config CONFIG]
3230
{benchmark} ...
3331
3432
LLM-powered Balatro bot using LiteLLM proxy
3533
3634
positional arguments:
37-
{benchmark} Available commands
38-
benchmark Analyze runs and generate leaderboards
35+
{benchmark} Available commands
36+
benchmark Analyze runs and generate leaderboards
3937
4038
options:
41-
-h, --help show this help message and exit
42-
--model MODEL Model name to use from LiteLLM proxy (default:
43-
cerebras/gpt-oss-120b)
44-
--base-url BASE_URL LiteLLM base URL (default: http://localhost:4000)
45-
--api-key API_KEY LiteLLM proxy API key (default: sk-balatrollm-proxy-
46-
key)
47-
--list-models List available models from the proxy and exit
48-
--litellm-config LITELLM_CONFIG
49-
Path to LiteLLM configuration file (default:
50-
config/litellm.yaml)
51-
--strategy STRATEGY Strategy to use. Can be a built-in strategy name
52-
(default, aggressive) or a path to a strategy
53-
directory (default: default)
54-
--verbose, -v Enable verbose logging
55-
--config CONFIG Load configuration from a previous run's config.json
56-
file
39+
-h, --help show this help message and exit
40+
--model MODEL Model name to use from LiteLLM proxy (default:
41+
cerebras/gpt-oss-120b)
42+
--list-models List available models from the proxy and exit
43+
--strategy STRATEGY Name of the strategy to use (default: default)
44+
--base-url BASE_URL LiteLLM base URL (default: http://localhost:4000)
45+
--api-key API_KEY LiteLLM proxy API key (default: sk-balatrollm-proxy-
46+
key)
47+
--config CONFIG Load configuration from a previous run's config.json
48+
file
5749
5850
Examples:
5951
balatrollm --model cerebras/gpt-oss-120b
6052
balatrollm --model groq/qwen/qwen3-32b --base-url http://localhost:4000
6153
balatrollm --strategy aggressive
62-
balatrollm --strategy path/to/my/strategy/directory
6354
balatrollm --list-models
64-
balatrollm --config runs/version/provider/model/strategy/run/config.json
65-
balatrollm benchmark --runs-dir runs --output-dir benchmark_results
55+
balatrollm --config runs/v0.3.0/default/cerebras/gpt-oss-120b/20240101_120000_RedDeck_s1_OOOO155/config.json
56+
balatrollm benchmark --runs-dir runs --output-dir benchmarks
6657
```
6758

6859
### Development
@@ -117,15 +108,17 @@ Examples:
117108

118109
## Architecture
119110

120-
**LLMBot (`src/balatrollm/bot.py`)**: Main bot class with Config integration, StrategyManager, LLM decision-making, response history tracking, BalatroClient integration, proxy validation, model validation, and project version management.
111+
**LLMBot (`src/balatrollm/bot.py`)**: Main bot class with clean architecture featuring Config integration, StrategyManager for template rendering, LLM decision-making with retry logic, response history tracking, and BalatroClient integration.
121112

122-
**CLI Entry Point (`src/balatrollm/__init__.py`)**: Command-line interface with argument parsing, configuration validation, and async game execution.
113+
**CLI Entry Point (`src/balatrollm/__init__.py`)**: Simplified command-line interface with argument parsing and async game execution using modern Python patterns.
123114

124-
**Configuration (`src/balatrollm/config.py`)**: Config dataclass handling model settings and bot parameters. Base URLs and API keys use CLI defaults for security.
115+
**Configuration (`src/balatrollm/config.py`)**: Config dataclass with metadata fields (name, description, author, tags) for enhanced run tracking and version management.
125116

126-
**Strategy System (`src/balatrollm/strategies.py`)**: StrategyManager class for Jinja2-based strategy templates and tool loading.
117+
**Strategy System (`src/balatrollm/strategies.py`)**: Lightweight StrategyManager class for managing Jinja2-based strategy templates with built-in strategy support only.
127118

128-
**Data Collection (`src/balatrollm/data_collection.py`)**: RunDataCollector for game execution logging, performance tracking, and run data organization.
119+
**Data Collection (`src/balatrollm/data_collection.py`)**: RunStatsCollector for structured game execution logging, comprehensive performance tracking, and organized run data storage.
120+
121+
**Benchmarking (`src/balatrollm/benchmark.py`)**: Comprehensive benchmark analysis system with aggregated statistics, leaderboard generation, and hierarchical result organization.
129122

130123
**Strategies (`src/balatrollm/strategies/`)**: Strategy-based organization:
131124

@@ -143,9 +136,10 @@ Each strategy contains:
143136

144137
**Game Flow**:
145138

146-
1. Validate proxy connection and model availability
147-
2. Game loop: Get state → Render strategy templates → Send to LLM → Parse response → Execute action
148-
3. Handle different states: BLIND_SELECT, SELECTING_HAND, SHOP, ROUND_EVAL
139+
1. Initialize game with run directory and data collection setup
140+
2. Main game loop: Get state → Render strategy templates → Send to LLM with retry logic → Parse response → Execute action
141+
3. Handle game states: BLIND_SELECT, SELECTING_HAND, SHOP, ROUND_EVAL, GAME_OVER
142+
4. Collect comprehensive statistics and generate run reports
149143

150144
**Available Models** (`config/litellm.yaml`):
151145

@@ -188,7 +182,8 @@ src/balatrollm/
188182
└── TOOLS.json # Function definitions
189183
190184
balatro.sh # Game automation script
191-
runs/ # Game execution logs (organized by version/model/strategy)
185+
runs/ # Game execution logs (organized by version/strategy/provider/model)
186+
benchmarks/ # Benchmark results (organized by version/strategy/provider/model)
192187
tests/test_llm.py # Test suite
193188
```
194189

@@ -199,26 +194,28 @@ tests/test_llm.py # Test suite
199194

200195
## Results Tracking
201196

202-
- `runs/[version]/[provider]/[model-name]/[strategy]/[timestamp]_[deck]_[seed].jsonl`
197+
**Run Data Structure:**
198+
199+
- `runs/[version]/[strategy]/[provider]/[model-name]/[timestamp]_[deck]_[seed]/`
203200
- JSONL format for performance analysis across providers, models, and strategies
204201
- Provider/model parsing: `groq/qwen/qwen3-32b``groq/qwen--qwen3-32b` (filesystem safe)
205-
- Enables grouping by provider (e.g., all Cerebras models) or specific model comparisons
202+
- Strategy-first organization enables easy comparison across providers/models within strategies
203+
204+
**Benchmark Results Structure:**
205+
206+
- `benchmarks/[version]/[strategy]/[provider]/[model-name].json` - Detailed model analysis
207+
- `benchmarks/[version]/[strategy]/leaderboard.json` - Strategy-specific leaderboard
208+
- Hierarchical structure matches runs organization for consistency
206209

207210
## Strategy System
208211

209-
The `--strategy` flag accepts either built-in strategy names or paths to custom strategy directories:
212+
The `--strategy` flag accepts built-in strategy names:
210213

211214
**Built-in Strategies**:
212215

213216
- **Default** (`--strategy default`): Conservative, financially disciplined approach
214217
- **Aggressive** (`--strategy aggressive`): High-risk, high-reward approach with aggressive spending
215218

216-
**Custom Strategy Paths**:
217-
218-
- Absolute paths: `--strategy /path/to/my/custom/strategy`
219-
- Relative paths: `--strategy ../custom-strategies/experimental`
220-
- The system will automatically resolve built-in strategy names first, then fall back to path resolution
221-
222219
Each strategy directory must contain:
223220

224221
- `STRATEGY.md.jinja`: Strategy-specific guide

README.md

Lines changed: 11 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -91,44 +91,24 @@ balatrollm --help
9191
```
9292

9393
```
94-
usage: balatrollm [-h] [--model MODEL] [--base-url BASE_URL]
95-
[--api-key API_KEY] [--list-models]
96-
[--litellm-config LITELLM_CONFIG] [--strategy STRATEGY]
97-
[--verbose] [--config CONFIG]
94+
usage: balatrollm [-h] [--model MODEL] [--list-models] [--strategy STRATEGY]
95+
[--base-url BASE_URL] [--api-key API_KEY] [--config CONFIG]
9896
{benchmark} ...
9997
10098
LLM-powered Balatro bot using LiteLLM proxy
10199
102100
positional arguments:
103-
{benchmark} Available commands
104-
benchmark Analyze runs and generate leaderboards
101+
{benchmark} Available commands
102+
benchmark Analyze runs and generate leaderboards
105103
106104
options:
107-
-h, --help show this help message and exit
108-
--model MODEL Model name to use from LiteLLM proxy (default:
109-
cerebras/gpt-oss-120b)
110-
--base-url BASE_URL LiteLLM base URL (default: http://localhost:4000)
111-
--api-key API_KEY LiteLLM proxy API key (default: sk-balatrollm-proxy-
112-
key)
113-
--list-models List available models from the proxy and exit
114-
--litellm-config LITELLM_CONFIG
115-
Path to LiteLLM configuration file (default:
116-
config/litellm.yaml)
117-
--strategy STRATEGY Strategy to use. Can be a built-in strategy name
118-
(default, aggressive) or a path to a strategy
119-
directory (default: default)
120-
--verbose, -v Enable verbose logging
121-
--config CONFIG Load configuration from a previous run's config.json
122-
file
123-
124-
Examples:
125-
balatrollm --model cerebras/gpt-oss-120b
126-
balatrollm --model groq/qwen/qwen3-32b --base-url http://localhost:4000
127-
balatrollm --strategy aggressive
128-
balatrollm --strategy path/to/my/strategy/directory
129-
balatrollm --list-models
130-
balatrollm --config runs/version/provider/model/strategy/run/config.json
131-
balatrollm benchmark --runs-dir runs --output-dir benchmark_results
105+
-h, --help show this help message and exit
106+
--model MODEL Model name to use from LiteLLM proxy (default: cerebras/gpt-oss-120b)
107+
--list-models List available models from the proxy and exit
108+
--strategy STRATEGY Name of the strategy to use (default: default)
109+
--base-url BASE_URL LiteLLM base URL (default: http://localhost:4000)
110+
--api-key API_KEY LiteLLM proxy API key (default: sk-balatrollm-proxy- key)
111+
--config CONFIG Load configuration from a previous run's config.json file
132112
```
133113

134114
#### `Makefile` - Development Workflow

0 commit comments

Comments
 (0)