LLM-powered MajorMUD playtest bot that accepts markdown-based skills and a DeepSeek API key to play autonomously.
Telnet Client ANSI Parser State Extractor
(telnetlib3) -> (regex strip) -> (structured state)
| |
v v
MajorMUD Server Agent Memory
|
^ v
| LLM Agent
Command Executor <- Command Validator <- (DeepSeek API)
- Copy
.env.exampleto.envand fill in your credentials:
cp .env.example .env-
Set
DEEPSEEK_API_KEYand your MUD server details. -
Install dependencies:
pip install -e .- Run the bot:
python -m balthazar.mainSkills are markdown files in skills/ that teach the bot how to play. Each skill has YAML frontmatter:
---
category: combat
priority: 10
triggers: combat, attack, fight
---
# Combat Skill
Rules for fighting monsters...Create new .md files to add behaviors. Higher priority skills take precedence.
Game data (races, classes, commands, quests, maps) lives in knowledge/ as markdown files. These are injected into the LLM's system prompt as reference material.
| Variable | Default | Description |
|---|---|---|
DEEPSEEK_API_KEY |
- | DeepSeek API key (required) |
DEEPSEEK_MODEL |
deepseek-chat |
Model to use |
MUD_HOST |
localhost |
MUD server hostname |
MUD_PORT |
23 |
MUD server port |
MUD_USERNAME |
- | Login username |
MUD_PASSWORD |
- | Login password |
MUD_CHARACTER |
- | Character name |
MAX_TURNS |
1000 |
Max turns per session |
LOG_LEVEL |
INFO |
Logging verbosity |
src/balthazar/
main.py # Entry point
config.py # .env configuration
loop.py # Main agent loop
telnet/
client.py # Async telnet connection & login
parser/
ansi.py # ANSI escape stripping
output.py # Prompt detection, regex extraction
state.py # State extraction from parsed output
agent/
llm.py # DeepSeek API client
skills.py # Markdown skill/knowledge loader
memory.py # Short-term & long-term memory
game/
state.py # GameState dataclass
commands.py # Command reference & validation
skills/ # Markdown skill files
knowledge/ # Game knowledge base
logs/ # Session transcripts