{"id":50308623,"url":"https://github.com/duyet/duyetbot-agent","last_synced_at":"2026-05-28T18:30:56.864Z","repository":{"id":324859517,"uuid":"1098792830","full_name":"duyet/duyetbot-agent","owner":"duyet","description":null,"archived":false,"fork":false,"pushed_at":"2026-03-23T09:36:21.000Z","size":9730,"stargazers_count":5,"open_issues_count":22,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2026-03-30T21:34:46.207Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/duyet.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":"docs/ROADMAP-AUTONOMOUS-AGENT.md","authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-18T06:35:44.000Z","updated_at":"2026-02-01T07:18:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/duyet/duyetbot-agent","commit_stats":null,"previous_names":["duyet/duyetbot-agent"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/duyet/duyetbot-agent","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fduyetbot-agent","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fduyetbot-agent/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fduyetbot-agent/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fduyetbot-agent/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/duyet","download_url":"https://codeload.github.com/duyet/duyetbot-agent/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/duyet%2Fduyetbot-agent/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":33622066,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-05-28T02:00:06.440Z","response_time":99,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-05-28T18:30:56.677Z","updated_at":"2026-05-28T18:30:56.828Z","avatar_url":"https://github.com/duyet.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# duyetbot-agent\n\n```text\n    __          __        _    __\n   / /_  ____  / /___    | |  / /___ __      _\n  / __ \\/ __ \\/ __/ _ \\  | | / / __ `/ | /| / /\n / /_/ / /_/ / /_/  __/  | |/ / /_/ /| |/ |/ /\n/_.___/\\____/\\__/\\___/   |___/\\__,_/ |__/|__//\n              _   __         __        _\n   ____  ___/ | / /__  ____/ /____ _/ |____\n  / __ \\/ _ \\ / / / _ \\/ __  / __ `/ __/ _ \\\n / / / /  __/ / / /  __/ /_/ / /_/ / /_/  __/\n/_/ /_/\\___/_/_/_/\\___/\\__,_/\\__,_/\\__/\\___/\n          ________       __    __\n         /  _/ __ \\___ _/ /_  / /___  __  _\n         / // /_/ / _ `/ / / / / __ \\/ / / /\n       _/ // _, _/  __/ / / / / /_/ / /_/ /\n      /___/_/ |_|\\___/_/ /_/_/ .___/\\__, /\n                            /_/    /____/\n```\n\n[![Tests](https://img.shields.io/badge/tests-969%2B-brightgreen)](https://github.com/duyet/duyetbot-agent)\n[![License](https://img.shields.io/badge/license-MIT-blue)](LICENSE)\n[![Cloudflare](https://img.shields.io/badge/Cloudflare-Workers-orange)](https://workers.cloudflare.com/)\n[![Next.js](https://img.shields.io/badge/Next.js-15-black)](https://nextjs.org/)\n[![Bun](https://img.shields.io/badge/Bun-1.3-FAFAFA)](https://bun.sh/)\n\n---\n\n## Overview\n\n**duyetbot-agent** is a personal AI agent system built for the edge. It implements a **loop-based agent architecture** with tool iterations, deployed on Cloudflare Workers + Durable Objects for GitHub (@mentions) and Telegram chat interfaces.\n\n### Why This Architecture?\n\n| Feature | Traditional | duyetbot-agent |\n|---------|-------------|----------------|\n| **Cold Start** | 1-5 seconds | \u003c10ms (edge) |\n| **State Management** | External database | Built-in (Durable Objects) |\n| **Idle Costs** | Always-on servers | Free (serverless) |\n| **Scalability** | Manual scaling | Automatic global sharding |\n\n---\n\n## Architecture\n\n### Full System Diagram\n\n```text\n┌─────────────────────────────────────────────────────────────────────────────┐\n│                           EXTERNAL SERVICES                                  │\n│                                                                             │\n│  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐  ┌──────────────┐   │\n│  │   Telegram   │  │    GitHub    │  │  OpenRouter  │  │  MCP Servers │   │\n│  │   Bot API    │  │     API      │  │  (LLM API)   │  │  (optional)  │   │\n│  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘  └──────┬───────┘   │\n│         │                 │                 │                 │           │\n│         ▼                 ▼                 ▼                 ▼           │\n└─────────┼─────────────────┼─────────────────┼─────────────────┼───────────┘\n          │                 │                 │                 │\n          │ Webhook         │ Webhook         │ AI Gateway      │ MCP Protocol\n          │                 │                 │ (rate limit)    │\n          │                 │                 │                 │\n┌─────────┼─────────────────┼─────────────────┼─────────────────┼───────────┐\n│         │                 │                 │                 │           │\n│         ▼                 ▼                 │                 │           │\n│  ┌──────────────┐  ┌──────────────┐        │                 │           │\n│  │ Telegram Bot │  │  GitHub Bot  │        │                 │           │\n│  │   (Worker)   │  │   (Worker)   │        │                 │           │\n│  │              │  │              │        │                 │           │\n│  │  • Webhook   │  │  • Webhook   │        │                 │           │\n│  │  • Transport │  │  • Transport │        │                 │           │\n│  └──────┬───────┘  └──────┬───────┘        │                 │           │\n│         │                 │                 │                 │           │\n│         └─────────┬───────┘                 │                 │           │\n│                   │                         │                 │           │\n│                   ▼                         │                 │           │\n│  ┌──────────────────────────────────────┐   │                 │           │\n│  │    CloudflareChatAgent (DO)          │◄──┼─────────────────┼───────────┤\n│  │                                      │   │                 │           │\n│  │  ╔══════════════════════════════╗    │   │                 │           │\n│  │  ║     Chat Loop (Core)         ║    │   │                 │           │\n│  │  ║   ┌────────────────────┐     ║    │   │                 │           │\n│  │  ║   │ LLM Reasoning      │     ║    │   │                 │           │\n│  │  ║   │ Tool Iterations    │     ║    │   │                 │           │\n│  │  ║   │ Response Handling  │     ║    │   │                 │           │\n│  │  ║   └────────────────────┘     ║    │   │                 │           │\n│  │  ╚══════════════════════════════╝    │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  ╔══════════════════════════════╗    │   │                 │           │\n│  │  ║   Tool Executor              ║    │   │                 │           │\n│  │  ║  ┌────────┐  ┌─────────┐    ║    │   │                 │           │\n│  │  ║  │ Built- │  │   MCP   │    ║────┼───┼─────────────────┼───────────┤\n│  │  ║  │  in    │──│  Tools  │    ║    │   │                 │           │\n│  │  ║  │ Tools  │  │         │    ║    │   │                 │           │\n│  │  ║  └────────┘  └─────────┘    ║    │   │                 │           │\n│  │  ╚══════════════════════════════╝    │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  ╔══════════════════════════════╗    │   │                 │           │\n│  │  ║   Token Tracker              ║────┼───┼─────────────────┼───────────┤\n│  │  ║   • Usage tracking           ║    │   │                 │           │\n│  │  ║   • Cost calculation         ║    │   │                 │           │\n│  │  ║   • D1 persistence           ║    │   │                 │           │\n│  │  ╚══════════════════════════════╝    │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  ╔══════════════════════════════╗    │   │                 │           │\n│  │  ║   Message Store              ║    │   │                 │           │\n│  │  ║   • Conversation history     ║    │   │                 │           │\n│  │  ║   • Session persistence      ║    │   │                 │           │\n│  │  ╚══════════════════════════════╝    │   │                 │           │\n│  └──────────────────────────────────────┘   │                 │           │\n│                                             │                 │           │\n│  ┌──────────────────────────────────────┐   │                 │           │\n│  │    Memory MCP Server (Worker)       │◄──┼─────────────────┼───────────┤\n│  │                                      │   │                 │           │\n│  │  • Cross-session memory             │   │                 │           │\n│  │  • User isolation                   │   │                 │           │\n│  │  • D1 + KV storage                  │   │                 │           │\n│  │  • MCP protocol endpoint            │───┼─────────────────┼───────────┤\n│  └──────────────────────────────────────┘   │                 │           │\n│                                             │                 │           │\n│  ┌──────────────────────────────────────┐   │                 │           │\n│  │    Safety Kernel (Worker)           │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  • Health checks                    │   │                 │           │\n│  │  • Rollback triggers                │   │                 │           │\n│  │  • Dead man's switch                │   │                 │           │\n│  └──────────────────────────────────────┘   │                 │           │\n│                                             │                 │           │\n│  ┌──────────────────────────────────────┐   │                 │           │\n│  │    Web UI (Next.js)                 │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  • Chat interface                   │   │                 │           │\n│  │  • Agent playground                 │   │                 │           │\n│  │  • Admin dashboard                  │   │                 │           │\n│  └──────────────────────────────────────┘   │                 │           │\n│                                             │                 │           │\n│  ┌──────────────────────────────────────┐   │                 │           │\n│  │    Analytics Dashboard (Next.js)     │   │                 │           │\n│  │                                      │   │                 │           │\n│  │  • Token usage visualization         │   │                 │           │\n│  │  • Cost tracking                     │   │                 │           │\n│  │  • Performance metrics               │   │                 │           │\n│  └──────────────────────────────────────┘   │                 │           │\n│                                             │                 │           │\n└─────────────────────────────────────────────┼─────────────────┼───────────┘\n                                              │                 │\n                                              ▼                 ▼\n                                      ┌──────────────┐  ┌──────────────┐\n                                      │ Cloudflare   │  │   Custom     │\n                                      │ D1 Database  │  │   MCP        │\n                                      │              │  │   Servers    │\n                                      │ • Messages   │  │              │\n                                      │ • Tokens     │  │ • duyet-mcp  │\n                                      │ • Sessions   │  │ • github-mcp │\n                                      └──────────────┘  └──────────────┘\n```\n\n### Loop-Based Agent Flow\n\n```text\n┌────────────────────────────────────────────────────────────────────────────┐\n│                         Chat Loop Execution Flow                            │\n└────────────────────────────────────────────────────────────────────────────┘\n\nUser Message Arrives\n        │\n        ▼\n┌───────────────────────┐\n│  Webhook Ingestion    │\n│  • Parse \u0026 validate   │\n│  • Get/create DO      │\n│  • Queue message      │\n└───────────┬───────────┘\n            │\n            ▼\n┌───────────────────────┐\n│  Batch Processing     │\n│  • 500ms window       │\n│  • Combine messages   │\n│  • Start alarm        │\n└───────────┬───────────┘\n            │\n            ▼\n┌───────────────────────┐\n│  Send \"Thinking...\"   │\n│  • Typing indicator   │\n│  • Get messageRef     │\n│  • Start rotation     │\n└───────────┬───────────┘\n            │\n            ▼\n┌─────────────────────────────────────────────────────────────────┐\n│                     CHAT LOOP (Iterative)                      │\n│                                                                 │\n│  while (needs_tool_use) {                                      │\n│      │                                                          │\n│      ├─► Call LLM with context + tools                         │\n│      │   │                                                      │\n│      │   ├─► If tool_use detected:                             │\n│      │   │   │                                                  │\n│      │   │   ├─► Update: \"Running {tool}...\"                   │\n│      │   │   │                                                  │\n│      │   │   ├─► Execute tool (built-in or MCP)                │\n│      │   │   │   ├─ bash: Shell commands                      │\n│      │   │   │   ├─ git: Git operations                       │\n│      │   │   │   ├─ github: GitHub API                        │\n│      │   │   │   ├─ research: Web search                      │\n│      │   │   │   └─ plan: Task planning                       │\n│      │   │   │                                                  │\n│      │   │   ├─► Collect tool results                         │\n│      │   │   │                                                  │\n│      │   │   └─► Feed results back to LLM                     │\n│      │   │                                                      │\n│      │   └─► If no tool_use:                                   │\n│      │       ├─ Extract final response                        │\n│      │       └─ Break loop                                    │\n│  }                                                              │\n│                                                                 │\n└─────────────────────────────┬───────────────────────────────────┘\n                              │\n                              ▼\n                    ┌─────────────────┐\n                    │ Edit Message     │\n                    │ • Final response │\n                    │ • Debug footer   │\n                    └─────────────────┘\n```\n\n### Tool System\n\n```text\n┌────────────────────────────────────────────────────────────────────────────┐\n│                          Tool Execution System                            │\n└────────────────────────────────────────────────────────────────────────────┘\n\n           LLM Request: tool_use\n                  │\n                  ▼\n    ┌──────────────────────────┐\n    │   Tool Executor          │\n    │   (unified interface)    │\n    └──────┬───────────┬───────┘\n           │           │\n    ┌──────┴───┐   ┌───┴────────┐\n    │          │   │            │\n    ▼          ▼   ▼            ▼\n┌────────┐ ┌────────┐ ┌──────────────────┐\n│ Built- │ │  MCP   │ │  MCP Servers      │\n│  in    │ │ Tools │ │  (discovered)     │\n│ Tools  │ │        │ │                  │\n└────────┘ └────────┘ └──────────────────┘\n    │          │              │\n    │          │              └─► duyet-mcp (blog, info)\n    │          │              └─► github-mcp (advanced ops)\n    │          │              └─► Custom servers\n    │          │\n    ├─► bash    │          (External HTTP calls)\n    ├─► git     │\n    ├─► github  │\n    ├─► research│\n    └─► plan    │\n               │\n    ┌──────────┴───────────┐\n    │   Return to LLM      │\n    │   (tool results)     │\n    └──────────────────────┘\n```\n\n---\n\n## Key Features\n\n| Feature | Description |\n|---------|-------------|\n| **Loop-Based Agent** | Single agent with LLM reasoning loop and tool iterations (replaced multi-agent routing, ~8000 LOC removed) |\n| **Built-in Tools** | bash, git, github, research, plan - all executed through unified interface |\n| **MCP Integration** | Extensible via Model Context Protocol servers |\n| **Persistent Memory** | Cross-session context via memory-mcp server (D1 + KV) |\n| **Edge Deployment** | Cloudflare Workers + Durable Objects for \u003c10ms cold starts |\n| **Multi-Platform** | Telegram chat + GitHub @mentions via transport abstraction |\n| **Token Tracking** | Real-time usage and cost tracking stored in D1 |\n| **Safety Kernel** | Health checks, rollback triggers, dead man's switch |\n| **Web UI** | Next.js-based chat interface and admin dashboard |\n| **Analytics** | Token usage visualization, cost tracking, performance metrics |\n\n---\n\n## Project Structure\n\n### Monorepo Layout\n\n```text\nduyetbot-agent/\n├── packages/\n│   ├── cloudflare-agent/     # Loop-based agent (2000 LOC, 969 tests)\n│   │   ├── chat/              # Chat loop, tool executor, response handler\n│   │   ├── tracking/          # Token tracker, execution logger\n│   │   ├── persistence/       # Message store, session manager\n│   │   └── workflow/          # Step tracker, debug footer\n│   ├── core/                  # SDK adapter, session manager, MCP client\n│   ├── tools/                 # Built-in tools (bash, git, github, research, plan)\n│   ├── providers/             # LLM providers (OpenRouter via AI Gateway)\n│   ├── prompts/               # System prompts (Telegram, GitHub)\n│   ├── types/                 # Shared types (Agent, Tool, Message, Provider)\n│   ├── hono-middleware/       # Shared Hono utilities\n│   ├── analytics/             # Analytics utilities for dashboard\n│   ├── observability/         # Logging, metrics, tracing\n│   ├── progress/              # Progress tracking utilities\n│   ├── cli/                   # Command-line interface\n│   ├── api-security/          # API security utilities\n│   └── mcp-servers/           # MCP server configurations\n│\n├── apps/\n│   ├── telegram-bot/          # Telegram chat interface (Workers + DO)\n│   ├── github-bot/            # GitHub @mention handler (Workers + DO)\n│   ├── memory-mcp/            # Memory persistence server (Workers + D1)\n│   ├── safety-kernel/         # Health checks \u0026 rollback (Workers)\n│   ├── web/                   # Web UI (Next.js + Cloudflare)\n│   ├── dashboard/             # Analytics dashboard (Next.js + OpenNext)\n│   └── docs/                  # Documentation site\n│\n├── prompts-eval/              # Prompt evaluation with promptfoo\n├── scripts/                   # Build \u0026 deployment scripts\n├── docs/                      # Project documentation\n├── CLAUDE.md                  # Claude Code guidance\n└── PLAN.md                    # Implementation roadmap\n```\n\n### Package Dependencies\n\n```text\n                    @duyetbot/types\n                           │\n         ┌─────────────────┼─────────────────┐\n         │                 │                 │\n         ▼                 ▼                 ▼\n  @duyetbot/        @duyetbot/        @duyetbot/\n   providers          tools            prompts\n         │                 │                 │\n         └─────────────────┼─────────────────┘\n                           │\n                    @duyetbot/core\n                           │\n         ┌─────────────────┼─────────────────┐\n         │                 │                 │\n         ▼                 ▼                 ▼\n  @duyetbot/         @duyetbot/        @duyetbot/\n cloudflare-agent    analytics       observability\n         │\n         ├─────────────┬─────────────┬────────────┐\n         │             │             │            │\n         ▼             ▼             ▼            ▼\n  telegram-bot   github-bot   memory-mcp   safety-kernel\n```\n\n---\n\n## Quick Start\n\n### Prerequisites\n\n- **Bun** \u003e= 1.3.3\n- **Node.js** \u003e= 20 (for some tools)\n- **Cloudflare Account** (free tier works)\n- **OpenRouter API Key** ([get one here](https://openrouter.ai/))\n\n### Installation\n\n```bash\n# Clone repository\ngit clone https://github.com/duyet/duyetbot-agent.git\ncd duyetbot-agent\n\n# Install dependencies\nbun install\n\n# Setup environment variables\ncp .env.example .env.local\n# Edit .env.local with your API keys\n```\n\n### Development\n\n```bash\n# Watch mode for all packages\nbun run dev\n\n# Run tests (969+ tests)\nbun run test\n\n# Lint + type-check\nbun run check\n\n# Build all packages\nbun run build\n```\n\n### Local Development by App\n\n```bash\n# Telegram bot (wrangler dev)\ncd apps/telegram-bot\nbun run dev\n\n# GitHub bot (wrangler dev)\ncd apps/github-bot\nbun run dev\n\n# Memory MCP (wrangler dev)\ncd apps/memory-mcp\nbun run dev\n\n# Web UI (Next.js dev)\ncd apps/web\nbun run dev\n\n# Analytics dashboard (Next.js dev)\ncd apps/dashboard\nbun run dev\n```\n\n---\n\n## Deployment\n\n### Deploy All Services\n\n```bash\n# Deploy everything (includes dependencies)\nbun run deploy\n```\n\n### Deploy Individual Services\n\n```bash\n# Deploy telegram bot + dependencies\nbun run deploy:telegram\n\n# Deploy github bot + dependencies\nbun run deploy:github\n\n# Deploy memory MCP + dependencies\nbun run deploy:memory-mcp\n\n# Deploy safety kernel\nbun run deploy:safety-kernel\n\n# Deploy web UI\nbun run deploy:web\n\n# Deploy analytics dashboard\nbun run deploy:dashboard\n```\n\n### Configure Secrets\n\n```bash\n# Configure all secrets at once\nbun run config\n\n# Configure individual service\nbun run config:telegram\nbun run config:github\nbun run config:memory-mcp\nbun run config:web\nbun run config:safety-kernel\n\n# Show current secrets\nbun run config:show\n```\n\n### Required Secrets\n\n| Secret | Required For | Purpose |\n|--------|--------------|---------|\n| `OPENROUTER_API_KEY` | All apps | LLM provider access |\n| `AI_GATEWAY_BASE_URL` | All apps | Cloudflare AI Gateway endpoint |\n| `TELEGRAM_BOT_TOKEN` | telegram-bot | Telegram Bot API |\n| `GITHUB_TOKEN` | github-bot | GitHub API access |\n| `GITHUB_WEBHOOK_SECRET` | github-bot | Webhook verification |\n\n### CI/CD Deployment\n\n```bash\n# Single app deployment (no dependency rebuild)\nbun run ci:deploy:telegram\nbun run ci:deploy:github\nbun run ci:deploy:memory-mcp\nbun run ci:deploy:safety-kernel\nbun run ci:deploy:dashboard\n```\n\n---\n\n## Documentation\n\n| Document | Description |\n|----------|-------------|\n| [Architecture](./docs/architecture.md) | System design, routing flow, patterns |\n| [Getting Started](./docs/getting-started.md) | Setup guide for new developers |\n| [API Reference](./docs/api.md) | API endpoints and interfaces |\n| [Deployment](./docs/deployment.md) | Detailed deployment guide |\n| [PLAN.md](./PLAN.md) | Implementation roadmap and status |\n| [Code Browse](https://zread.ai/duyet/duyetbot-agent) | Browse code on zread.ai |\n\n---\n\n## Transport Layer Pattern\n\nThe **Transport Layer** enables clean separation between platform-specific and agent logic:\n\n```typescript\ninterface Transport\u003cTContext\u003e {\n  // Send message, get reference for edits\n  send(ctx: TContext, text: string): Promise\u003cMessageRef\u003e;\n\n  // Edit existing message (for streaming updates)\n  edit?(ctx: TContext, ref: MessageRef, text: string): Promise\u003cvoid\u003e;\n\n  // Show typing indicator\n  typing?(ctx: TContext): Promise\u003cvoid\u003e;\n\n  // Add emoji reaction\n  react?(ctx: TContext, ref: MessageRef, emoji: string): Promise\u003cvoid\u003e;\n\n  // Extract normalized input from platform context\n  parseContext(ctx: TContext): ParsedInput;\n}\n```\n\n### Benefits\n\n| Aspect | Without Transport | With Transport |\n|--------|------------------|----------------|\n| **App boilerplate** | ~300 lines | ~50 lines |\n| **Duplicate logic** | Across apps | None |\n| **New platform** | Copy entire app | Just add transport |\n| **Testing** | Hard (mixed concerns) | Easy (mock transport) |\n\n### Implementations\n\n- **Telegram**: Message splitting, parse mode fallback, admin debug footer\n- **GitHub**: Context enrichment, emoji reactions, comment threading\n\n---\n\n## Testing\n\n**969+ tests** across all packages:\n\n```bash\n# All tests\nbun run test\n\n# Specific package\nbun run test --filter @duyetbot/cloudflare-agent\n\n# Watch mode\nbun run test:watch\n\n# Coverage report\nbun run test -- --coverage\n```\n\n### Test Breakdown\n\n| Package | Tests | Coverage |\n|---------|-------|----------|\n| `@duyetbot/cloudflare-agent` | 969 | High |\n| `@duyetbot/core` | 32 | High |\n| `@duyetbot/tools` | 24 | High |\n| `@duyetbot/prompts` | 18 | High |\n\n---\n\n## Stack\n\n| Component | Technology |\n|-----------|------------|\n| **Runtime** | Bun + TypeScript |\n| **Framework** | Hono (Workers), Next.js 15 (Web) |\n| **Deployment** | Cloudflare Workers + Durable Objects |\n| **Database** | Cloudflare D1 + KV |\n| **Testing** | Vitest + Playwright |\n| **LLM Provider** | OpenRouter via AI Gateway |\n| **Protocol** | Model Context Protocol (MCP) |\n\n---\n\n## Architecture Evolution\n\n### From Multi-Agent to Loop-Based (December 2024)\n\n| Aspect | Before (Multi-Agent) | After (Loop-Based) |\n|--------|---------------------|-------------------|\n| **Architecture** | 8 specialized agents | 1 agent + tools |\n| **Code Size** | ~8000 LOC | ~2000 LOC |\n| **Real-time Updates** | Lost in routing | Every tool iteration |\n| **Debugging** | Cross-agent traces | Single execution thread |\n| **Context** | Fragmented per agent | Unified conversation |\n| **Test Count** | 1420+ tests | 969 tests |\n| **Maintenance** | Complex routing logic | Simple tool interface |\n\n### What Changed\n\n**Removed:**\n- RouterAgent, SimpleAgent, OrchestratorAgent, HITLAgent\n- CodeWorker, ResearchWorker, GitHubWorker, DuyetInfoAgent\n- `apps/shared-agents` (entire app deleted)\n- Routing infrastructure (~8000 LOC)\n\n**Added:**\n- Loop-based chat loop with tool iterations\n- Built-in tools: bash, git, github, research, plan\n- MCP tool integration\n- Real-time progress updates\n- Unified conversation context\n\n---\n\n## Contributing\n\nSee [CLAUDE.md](./CLAUDE.md) for development workflow and guidelines.\n\n**Key Principles:**\n- Evidence-based decisions over assumptions\n- Code over documentation\n- Efficiency over verbosity\n- No technical debt (early stage, no backward compatibility)\n\n---\n\n## License\n\nMIT License - see [LICENSE](./LICENSE) for details.\n\n---\n\n**Built with [Claude Code](https://claude.com/claude-code)**\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduyet%2Fduyetbot-agent","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fduyet%2Fduyetbot-agent","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fduyet%2Fduyetbot-agent/lists"}