A 1,376-Line Bot Became 480 Lines
If you've ever built a Discord Bot, you know exactly what I mean.
Bot code bloats.
Adding commands, branching logic, error handling, natural language parsing, response formatting—every new feature makes the codebase fatter.
Our Bot had grown to 1,376 lines. Then it dropped to 480. Even though we added more features.
The Mindset Shift: "Don't Make the Bot Smart"
The old design looked like this:
Parse user input → determine the command → select the right character → build the prompt → call the API → format the response → send it. All Bot code. Branching everywhere.
Pass user input straight to Claude Code → Claude Code does all the thinking → receive the result and send it to Discord. The Bot is just a "pipe." It makes no decisions.
Don't make the Bot smart—make the AI smart.
Character selection, context awareness, tone switching, task execution—all handled by Claude Code. The Bot just connects input to output.
What We Did Technically
Write the Rules in CLAUDE.md
"Wrap Discord replies in [DISCORD:character_name]content[/DISCORD]." "Respond as the character mentioned by name." "Keep it concise, 200–500 characters."—Just write the rules in a file. Branching in code drops to zero.
Use claude -p --resume for Session Continuity
Claude Code retains the conversation context on its side. The entire block of code that managed conversation history in the Bot became unnecessary.
The Bot Just Captures stdout
Extract tags from Claude Code's output with regex. Switch Webhooks based on the character name and send. That's the Bot's entire logic.
Results
It's not just less code. Adding a new feature now means writing a single line in CLAUDE.md. Write "This character speaks like this," and the behavior changes with zero code modifications.
This Is Exactly How Tutor Operations Should Work
That's when it hit me. This idea of "delegating decisions to a system" applies directly to the administrative side of private tutoring.
Don't make yourself smart. Make the system smart.
Still managing tutor attendance manually?
Discover Kagemusha System