Skip to content

Commit 1af7822

Browse files
committed
docs: add better documentation for strategies
1 parent 8afe67c commit 1af7822

6 files changed

Lines changed: 431 additions & 96 deletions

File tree

CLAUDE.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,7 @@ src/balatrollm/
183183
└── strategies/ # Strategy-based templates
184184
├── default/ # Conservative strategy
185185
└── aggressive/ # High-risk strategy
186+
├── manifest.json # Strategy metadata
186187
├── STRATEGY.md.jinja # Strategy guide
187188
├── GAMESTATE.md.jinja # Game state representation
188189
├── MEMORY.md.jinja # Response history
@@ -230,9 +231,26 @@ The `--strategy` flag accepts built-in strategy names:
230231
- **Default** (`--strategy default`): Conservative, financially disciplined approach
231232
- **Aggressive** (`--strategy aggressive`): High-risk, high-reward approach with aggressive spending
232233

233-
Each strategy directory must contain:
234+
Each strategy directory must contain **5 required files**:
234235

236+
- `manifest.json`: Strategy metadata (name, description, author, version, tags)
235237
- `STRATEGY.md.jinja`: Strategy-specific guide
236238
- `GAMESTATE.md.jinja`: Game state representation
237239
- `MEMORY.md.jinja`: Response history tracking
238240
- `TOOLS.json`: Strategy-specific function definitions
241+
242+
**manifest.json Structure**:
243+
244+
```json
245+
{
246+
"name": "Default",
247+
"description": "Conservative, financially disciplined approach to Balatro",
248+
"author": "BalatroBench",
249+
"version": "0.1.0",
250+
"tags": ["conservative", "financial"]
251+
}
252+
```
253+
254+
All 5 fields are required. Strategy versions are independent from BalatroLLM versions.
255+
256+
For comprehensive strategy documentation including Jinja2 templates, validation, and contribution guidelines, see [docs/strategies.md](https://s1m0n38.github.io/balatrollm/strategies/).

CONTRIBUTING.md

Lines changed: 1 addition & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ This document provides guidelines and instructions for contributing to the proje
1616

1717
5. **Use Conventional Commits**: Follow the conventional commits specification for your commit messages.
1818

19-
6. **Submit Strategies**: Community members can contribute new playing strategies by following the strategy submission guidelines below.
19+
6. **Submit Strategies**: Community members can contribute new playing strategies. See the [Strategies documentation](https://s1m0n38.github.io/balatrollm/strategies/) for detailed guidelines.
2020

2121
## Environment Setup
2222

@@ -49,89 +49,3 @@ source .envrc
4949
```
5050

5151
> You can use [direnv](https://github.com/direnv/direnv) to automatically activate the environment when you enter the project directory.
52-
53-
## Contributing Strategies
54-
55-
Community members can contribute new playing strategies to enhance BalatroLLM's gameplay variety. Strategies define how the bot approaches decision-making during different game phases.
56-
57-
### Strategy Structure
58-
59-
Each strategy must be organized as a directory under `src/balatrollm/strategies/` containing exactly four files:
60-
61-
```
62-
src/balatrollm/strategies/your_strategy_name/
63-
├── STRATEGY.md.jinja # Strategy-specific guide and approach
64-
├── GAMESTATE.md.jinja # Game state representation template
65-
├── MEMORY.md.jinja # Response history tracking template
66-
└── TOOLS.json # Strategy-specific function definitions
67-
```
68-
69-
### Strategy Naming Requirements
70-
71-
Strategy names must follow these rules:
72-
73-
- **Lowercase letters and numbers only** (e.g., `aggressive`, `value_based`, `risky2`)
74-
- **Valid Python identifier** (cannot start with a number)
75-
- **Underscores allowed, hyphens forbidden** (e.g., `high_risk` allowed, `high-risk` forbidden)
76-
- **No spaces or special characters**
77-
78-
### Creating Your Strategy
79-
80-
1. **Study Existing Strategies**: Review `src/balatrollm/strategies/default/` and `src/balatrollm/strategies/aggressive/` to understand the template structure and content expectations.
81-
82-
2. **Create Strategy Directory**: Create a new directory following the naming requirements:
83-
84-
```bash
85-
mkdir src/balatrollm/strategies/your_strategy_name
86-
```
87-
88-
3. **Required Files**: Create all four required files using the existing strategies as templates:
89-
90-
- **STRATEGY.md.jinja**: Define your strategy's core philosophy, decision-making approach, and gameplay priorities
91-
- **GAMESTATE.md.jinja**: Template for how game state information should be presented to the LLM
92-
- **MEMORY.md.jinja**: Template for tracking and presenting response history
93-
- **TOOLS.json**: Function definitions available to the LLM during gameplay
94-
95-
4. **Template Compatibility**: Ensure your templates work with the Jinja2 templating system and provide all necessary context for LLM decision-making.
96-
97-
### Submission Process
98-
99-
1. **Fork the Repository**: Fork the BalatroLLM repository to your GitHub account
100-
101-
2. **Create Feature Branch**: Create a new branch for your strategy:
102-
103-
```bash
104-
git checkout -b feat/add-strategy-your_strategy_name
105-
```
106-
107-
3. **Implement Strategy**: Add your strategy directory with all required files
108-
109-
4. **Test Your Strategy**: Run your strategy locally to ensure it works:
110-
111-
```bash
112-
balatrollm --strategy your_strategy_name
113-
```
114-
115-
5. **Submit Pull Request**: Open a PR containing only your new strategy directory. The PR should:
116-
117-
- Have a clear title: `feat: add [strategy_name] strategy`
118-
- Include a brief description of your strategy's approach and philosophy
119-
- Follow conventional commit standards
120-
121-
### Quality Standards
122-
123-
- **Complete Implementation**: All four files must be present and functional
124-
- **Clear Documentation**: Strategy philosophy and approach should be well-documented
125-
- **Template Validation**: Ensure Jinja2 templates render correctly with game data
126-
- **Unique Approach**: Strategy should offer a meaningfully different gameplay style from existing strategies
127-
128-
### Review Process
129-
130-
Submitted strategies will be reviewed for:
131-
132-
- Compliance with naming and structure requirements
133-
- Template functionality and Jinja2 compatibility
134-
- Strategy uniqueness and gameplay value
135-
- Code quality and documentation standards
136-
137-
Once approved, your strategy will be available to all BalatroLLM users via the `--strategy` flag.

docs/index.md

Lines changed: 19 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# BalatroLLM
22

3-
<!-- <figure markdown="span"> -->
3+
<!-- TODO: This should be uncommented when the balatrollm repo is public -->
44

5-
<!-- <figcaption>A Balatro bot powered by LLM</figcaption> -->
5+
<!-- <figure> -->
6+
7+
<!-- <figcaption>BalatroLLM playing Balatro</figcaption> -->
8+
9+
<!-- <video controls playsinline> -->
10+
11+
<!-- <source src="https://github.com/user-attachments/assets/777d0c4f-d66a-47dd-9eab-7efb20beaaf2" type="video/mp4"> -->
12+
13+
<!-- Your browser does not support the video tag. -->
14+
15+
<!-- </video> -->
616

717
<!-- </figure> -->
818

@@ -36,12 +46,16 @@ BalatroLLM is a bot that uses Large Language Models (LLMs) to play [Balatro](htt
3646

3747
[:octicons-arrow-right-24: Analysis](analysis.md)
3848

39-
- :octicons-sparkle-fill-16:{ .lg .middle } __Docs for LLM__
49+
- :material-strategy:{ .lg .middle } __Strategies__
4050

4151
---
4252

43-
Documentation in [llms.txt](https://llmstxt.org/) format. Just paste the following link (or its content) into the LLM chat.
53+
Learn how strategies work, their structure using Jinja2 templates, and how to contribute your own.
4454

45-
[:octicons-arrow-right-24: llms-full.txt](llms-full.txt)
55+
[:octicons-arrow-right-24: Strategies](strategies.md)
4656

4757
</div>
58+
59+
!!! tip "Docs for LLM"
60+
61+
Documentation in [llms.txt](https://llmstxt.org/) format. Just paste [this link](llms-full.txt) (or its content) into the LLM chat.

0 commit comments

Comments
 (0)