How coder/balatrollm works
Project type and purpose
• This is a Python-based CLI tool (“BalatroLLM”) that drives a poker-deck roguelike game bot by orchestrating calls between (a) the BalatroBot HTTP API and (b) one or more LLM backends.
• It wraps configuration, game-state collection, strategy selection (via Jinja-templated prompts), LLM invocation, and action execution into a cohesive command-line interface.
File structure
• Top-level directories:
• src/balatrollm – core Python packages:
– cli.py (Click-based entry point)
– config.py (YAML loader)
– client.py (HTTP client for BalatroBot API)
– collector.py (game-state assembler)
– llm.py (LLM provider abstraction)
– executor.py (sends chosen actions back to the API)
– bot.py (orchestrator tying all subcomponents)
– strategy.py / strategies/… (Strategy pattern: multiple folders of Jinja templates + manifest.json)
– views.py + views/*.html (optional local HTML rendering of responses/tasks)
• config/ – example YAML to drive runtime behavior
• docs/ + mkdocs.yml – documentation site
• tests/ – unit & integration tests
• Config files: .envrc.example, pyproject.toml, Makefile, GitHub workflows for CI/CD & PyPI releases.
README for additional insights
• Emphasizes LLM-powered decision making, the BalatroBot API as external service, and multiple “strategies” to choose from.
Elements
• Internal modules (solid rectangles, blue)
• Related modules into logical clusters (e.g., “Orchestrator”, “Strategy Plugins”, “Adapters”)
Final advice
• Be exhaustive but clear: don’t omit the Collector or Executor—they’re as critical as the LLM call.
• Sequence: CLI → Config → API → Collector → Strategy → LLM → Executor → API.