A professional, AI-powered Telegram bot that interviews developers and generates production-ready
AGENTS.mdfiles for their projects β deployed on Cloudflare Workers at the edge.
AGENTS.md is an open standard (adopted by 20,000+ GitHub repos) that acts as a "README for AI coding agents." It gives assistants like OpenAI Codex, GitHub Copilot, Cursor, Claude Code, and Aider the context they need to work effectively in your codebase without re-exploring it every session.
Unlike .cursorrules or CLAUDE.md, AGENTS.md is vendor-neutral and supported across the entire AI coding ecosystem.
Telegram User
β
βΌ (HTTPS webhook)
Cloudflare Worker (src/index.ts)
β
ββββ Session State βββββββΊ Cloudflare KV
β
ββββ AI Engine ββββββββββΊ Anthropic Claude API
β (acknowledgments + context)
β
ββββ Generator ββββββββββΊ AGENTS.md (sent as document)
| Component | Technology |
|---|---|
| Runtime | Cloudflare Workers (V8 isolates) |
| State | Cloudflare KV (6-hour TTL sessions) |
| AI Engine | Anthropic Claude Sonnet 4 |
| Messaging | Telegram Bot API (webhook mode) |
| Language | TypeScript (strict mode) |
The bot conducts a structured interview across 15 steps:
/start
β
βββ 1. Project Name
βββ 2. Project Description β agent persona/role
βββ 3. Tech Stack
βββ 4. Package Manager
βββ 5. Build Commands β critical for CI
βββ 6. Test Commands β run before every commit
βββ 7. Lint / Format Commands
βββ 8. Dev / Local Run Commands
βββ 9. Architecture Overview β capability-based, not path-based
βββ 10. Code Conventions
βββ 11. Git Workflow
βββ 12. External Services & Env Vars
βββ 13. Security Sensitive Areas
βββ 14. Agent Boundaries & Permissions
βββ 15. MCP Server Configuration
βββ 16. Custom Notes / Gotchas
β
βββ Summary Review β [Generate] β AGENTS.md delivered as file
Claude AI powers:
- Warm acknowledgments between each question
- Follow-up clarification when answers are ambiguous
- Context preservation across the session
- Cloudflare account (free tier works)
- Wrangler CLI (
npm install -g wrangler) - Telegram bot token from
@BotFather - Anthropic API key
git clone https://github.com/yourorg/agents-md-bot
cd agents-md-bot
npm install# Production namespace
wrangler kv namespace create SESSIONS
# Preview namespace (for local dev)
wrangler kv namespace create SESSIONS --previewCopy the IDs into wrangler.toml:
[[kv_namespaces]]
binding = "SESSIONS"
id = "YOUR_PRODUCTION_KV_ID"
preview_id = "YOUR_PREVIEW_KV_ID"wrangler secret put TELEGRAM_BOT_TOKEN
# Paste your bot token from @BotFather
wrangler secret put ANTHROPIC_API_KEY
# Paste your Claude API key
wrangler secret put WEBHOOK_SECRET
# Paste any random string, e.g.: openssl rand -hex 32npm run deploy
# Output: https://agents-md-bot.YOUR-SUBDOMAIN.workers.devVisit in your browser (once):
https://agents-md-bot.YOUR-SUBDOMAIN.workers.dev/setup
You should see: { "ok": true, "description": "Webhook was set" }
Open Telegram, find your bot, send /start.
# Start local dev server (uses preview KV)
npm run dev
# In another terminal, use ngrok or cloudflared tunnel for webhook:
cloudflared tunnel --url http://localhost:8787
# Register the tunnel URL as webhook:
curl "https://api.telegram.org/botYOUR_TOKEN/setWebhook" \
-d "url=https://YOUR-TUNNEL.trycloudflare.com/webhook"The bot generates files following the AGENTS.md best practices:
# Project Name β AGENTS.md
> Read this entirely before planning any task.
**Package manager:** `pnpm`
## Project Overview
[1-3 sentence description that anchors agent context]
## Tech Stack
- Node.js 22, TypeScript, Fastify
- Prisma + PostgreSQL
- Redis for caching
## Commands
### Run Locally
\`\`\`bash
pnpm dev
\`\`\`
### Build
\`\`\`bash
pnpm build
\`\`\`
### Test
\`\`\`bash
pnpm test
pnpm test path/to/file.test.ts
\`\`\`
### Lint & Format
\`\`\`bash
pnpm lint && pnpm format
\`\`\`
## Architecture Overview
[Capability-based description, not file paths]
## Conventions & Code Style
[Naming, patterns, do/don't rules]
## Git Workflow
[Branching, commit format, PR requirements]
## External Services & Environment
[APIs, env vars, no secrets]
## Security & Sensitive Areas
[Auth flows, sensitive files, PII concerns]
## Agent Boundaries & Permissions
| Category | Rule |
|----------|------|
| β
Allowed freely | Read files, lint, test |
| β οΈ Ask first | Package installs, file deletion |
| β Never | Push to main, commit secrets |
## MCP Server Configuration
[Available MCP servers and their capabilities]| Command | Description |
|---|---|
/start |
Begin a new AGENTS.md interview |
/preview |
Preview data collected so far |
/cancel |
Cancel current session |
/help |
Show help |
- Zero cold starts β V8 isolates spin up in < 1ms
- Global edge β runs in 300+ cities closest to users
- KV built-in β no external database needed for sessions
- Free tier β 100,000 requests/day
The conversational quality of acknowledgments significantly affects completion rates. Claude's warm, context-aware responses keep users engaged through all 15 questions compared to static canned responses.
6-hour TTL on KV sessions balances server costs with realistic user session length. Users can resume a session within 6 hours of starting.
Webhooks are required for Cloudflare Workers (no persistent connections). Each webhook call is a fresh Worker invocation β stateless by design, with all state in KV.
agents-md-bot/
βββ src/
β βββ index.ts # Worker entry point + webhook routing
β βββ agent.ts # Claude-powered conversation engine
β βββ agentsmd.ts # AGENTS.md document generator
β βββ session.ts # KV-backed session management
β βββ telegram.ts # Telegram Bot API client
βββ wrangler.toml # Cloudflare Workers configuration
βββ tsconfig.json # TypeScript configuration
βββ package.json
βββ README.md
MIT
Built with β€οΈ using Cloudflare Workers + Anthropic Claude Following the AGENTS.md open standard