Skip to content

Instantly share code, notes, and snippets.

@Rustam-Z
Forked from nodir-t/00-intro.md
Created February 9, 2026 13:13
Show Gist options
  • Select an option

  • Save Rustam-Z/771d34f5ee710dbc895358313170ac9b to your computer and use it in GitHub Desktop.

Select an option

Save Rustam-Z/771d34f5ee710dbc895358313170ac9b 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