Skip to content

hexamh/AGENTS.md

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

9 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

AgentsMD Bot πŸ€–

A professional, AI-powered Telegram bot that interviews developers and generates production-ready AGENTS.md files for their projects β€” deployed on Cloudflare Workers at the edge.


What is AGENTS.md?

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.


Architecture

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)

Tech Stack

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)

Agent Conversation Flow

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

Quick Start

Prerequisites

1. Clone & Install

git clone https://github.com/yourorg/agents-md-bot
cd agents-md-bot
npm install

2. Create KV Namespace

# Production namespace
wrangler kv namespace create SESSIONS

# Preview namespace (for local dev)
wrangler kv namespace create SESSIONS --preview

Copy the IDs into wrangler.toml:

[[kv_namespaces]]
binding = "SESSIONS"
id = "YOUR_PRODUCTION_KV_ID"
preview_id = "YOUR_PREVIEW_KV_ID"

3. Set Secrets

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 32

4. Deploy

npm run deploy
# Output: https://agents-md-bot.YOUR-SUBDOMAIN.workers.dev

5. Register Webhook

Visit in your browser (once):

https://agents-md-bot.YOUR-SUBDOMAIN.workers.dev/setup

You should see: { "ok": true, "description": "Webhook was set" }

6. Test

Open Telegram, find your bot, send /start.


Local Development

# 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"

Generated AGENTS.md Structure

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]

Bot Commands

Command Description
/start Begin a new AGENTS.md interview
/preview Preview data collected so far
/cancel Cancel current session
/help Show help

Design Decisions

Why Cloudflare Workers?

  • 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

Why Claude for Acknowledgments?

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.

Session TTL

6-hour TTL on KV sessions balances server costs with realistic user session length. Users can resume a session within 6 hours of starting.

Why Webhook vs. Long-Polling?

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.


Project Structure

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

License

MIT


Built with ❀️ using Cloudflare Workers + Anthropic Claude Following the AGENTS.md open standard

About

Join telegram

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors