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:

Before: The Bot Does Everything

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.

After: The Bot Is a Pipe

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

1,376 → 480 lines
65% reduction in code
8 characters
Auto-switching supported
0 lines
NLU (natural language understanding) code

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.

👩‍🏫
"Count lesson sessions at the end of the month, calculate tuition, create invoices, send them to parents…" I was doing it all myself. Just like the Bot. Every decision was mine.
💡
What if you just put lessons on Google Calendar? The system handles calculations, invoicing, and reporting—all of it. All you do is "add the lesson." Become the pipe.

Don't make yourself smart. Make the system smart.

Tutors Can Be "Pipes" Too
Just as our Discord Bot went from 1,376 lines to 480, your end-of-month workload can shrink dramatically. With the Kagemusha System, all you do is add lessons to Google Calendar. Tuition calculations, invoice PDFs, attendance summaries—all automated. You just focus on teaching. For ¥500/month, cut your administrative workload by 65%.

Still managing tutor attendance manually?

Discover Kagemusha System