Edgy Matrix roast bot powered by Claude
Find a file
mikd e1f9638727 fix: force text reply on last tool-use iteration
Claude was exhausting all 6 iterations on web_search calls without
ever producing a final text reply. Set tool_choice=none on the last
iteration to guarantee a response.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-15 22:45:13 +02:00
.env.example Initial public release: Matrix Crok roast bot 2026-05-10 20:28:45 +02:00
.gitignore Initial public release: Matrix Crok roast bot 2026-05-10 20:28:45 +02:00
.leak-allowlist chore: add .leak-allowlist for canonical clone URL in README 2026-05-11 15:32:46 +02:00
crok-bot.service Initial public release: Matrix Crok roast bot 2026-05-10 20:28:45 +02:00
crok_bot.py fix: force text reply on last tool-use iteration 2026-06-15 22:45:13 +02:00
crok_context.example.txt Initial public release: Matrix Crok roast bot 2026-05-10 20:28:45 +02:00
README.md Initial public release: Matrix Crok roast bot 2026-05-10 20:28:45 +02:00

crok-bot

An edgy, foul-mouthed Matrix roast bot powered by Claude.

Trigger it with !crok in any room it's in. It reads the last 60 messages, judges everyone, and says something horrible. It can search the web to fact-check claims or find extra ammunition.

Warning

This bot is deliberately offensive. It will say vulgar, crude, and sexually explicit things. It roasts everyone in the room — including whoever triggered it. Deploy only in groups where everyone has opted in to this kind of thing.

Requirements

  • A Matrix account for the bot (@crok:yourhomeserver)
  • An Anthropic API key
  • Python 3.10+
  • pip install anthropic

Install

git clone https://git.pooperpalace.ch/mikd/crok-bot
cd crok-bot
pip install anthropic
cp .env.example .env
# Edit .env with your values

Configuration

Variable Required Description
CROK_BOT_TOKEN Yes Matrix access token for the bot account
ANTHROPIC_API_KEY Yes Anthropic API key
MATRIX_URL No Homeserver URL (default: http://localhost:8008)
BRAVE_API_KEY No Brave Search API key for live web search. Without it, Crok uses Claude's own knowledge as fallback.
CROK_ENV_FILE No Path to .env file (default: .env next to script)
CROK_STATE_FILE No Path to state file (default: crok_bot_state.json next to script)
CROK_CONTEXT_FILE No Path to context file (default: crok_context.txt next to script)

Group context

Copy crok_context.example.txt to crok_context.txt and add anything Crok should know about your group. This file is gitignored and never leaves your server.

Running

python3 crok_bot.py

As a systemd user service:

cp crok-bot.service ~/.config/systemd/user/
systemctl --user daemon-reload
systemctl --user enable --now crok-bot.service

Limits

  • 20 triggers per room per day
  • Reads the last 60 messages for context
  • Loads up to 3 recent images/stickers

License

MIT