Skip to content

Instantly share code, notes, and snippets.

@nodir-t
Last active February 9, 2026 13:13
Show Gist options
  • Select an option

  • Save nodir-t/da74c78281f203b0439609ebe5866f49 to your computer and use it in GitHub Desktop.

Select an option

Save nodir-t/da74c78281f203b0439609ebe5866f49 to your computer and use it in GitHub Desktop.
Claudir Architecture Deep Dive — Table of Contents

Claudir Architecture Deep Dive

Claudir is a ~33,000-line Rust Telegram bot system that uses Claude AI (via Anthropic's Claude Code CLI) to power intelligent chat interactions. What makes it architecturally interesting is not just that it wraps an LLM — it's how it structures trust, isolation, and operational resilience through a deliberate three-tier hierarchy.

Table of Contents

  1. The Three-Tier System — Owner/Supervisor, CTO bot, public chatbots. Trust hierarchy, bot-to-bot messaging, config-driven personalities, self-healing wrapper.

  2. The Harness and Engine — Three-process model, message flow pipeline, spam filtering, debouncer, control loop, inject mechanism, dropped text detection.

  3. MCP and the Tool System — ~40 tools via Model Context Protocol, heartbeat problem, memory system security, rate limiting, SSRF protection.

  4. The Security Model — 11 defense layers, spam classification, tool restrictions, kill switch, real social engineering incidents.

  5. Claude Code Integration — Subprocess management, worker thread architecture, stdin/stdout streaming, crash recovery, shared state across restarts.

  6. Focus Mode — Single-chat attention, cursor system, debouncing, stop-rejection, muting vs focus.

  7. Database Schema — ~20 SQLite tables: messaging, spam, reminders, focus, billing (with WAL pattern), embeddings, operations.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment