Borrowing it
Nothing to install: this file belongs to uniatrix/claude-telegram-bridge. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.
curl -O https://raw.githubusercontent.com/uniatrix/claude-telegram-bridge/main/CLAUDE.mdgit clone --depth 1 https://github.com/uniatrix/claude-telegram-bridgeWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/instructions/uniatrix/claude-telegram-bridge/claude-md)<a href="https://agentmods.dev/instructions/uniatrix/claude-telegram-bridge/claude-md"><img src="https://agentmods.dev/badge/instructions/uniatrix/claude-telegram-bridge/claude-md/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/instructions/uniatrix/claude-telegram-bridge/claude-md"><img src="https://agentmods.dev/badge/instructions/uniatrix/claude-telegram-bridge/claude-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.01661 | $0.01661 |
| Opus 5 | $0.00830 | $0.00830 |
| Sonnet 5 | $0.00332 | $0.00332 |
| Haiku 4.5 | $0.00166 | $0.00166 |
Grade A, and why
claude-telegram-bridge CLAUDE.md scanned grade A with 1 finding against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 8d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Makes network callslowCapability
Not a fault in itself. Listed so you know the mod talks to something, and to what.
- `_transcribe_cloud` — hand-built multipart POST (stdlib `urllib`) to an How it starts
The opening of the file, as written. The whole thing — 104 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
Guidance for Claude Code when working in this repo.
What this is
A single-file Python bridge (bridge.py, stdlib only) that exposes the full
Claude Code agent over Telegram. It long-polls getUpdates and shells out to
the claude CLI in headless stream-json mode, with persistent per-project
sessions. Runs unchanged on Windows, Linux and WSL (branches on os.name).
Architecture (where things live in bridge.py)
load_env/CFG— config frombridge.env(seebridge.env.example).STATE/save_state— persisted tostate.json: Telegramoffset, currentcwd,model, per-cwdsessionsmap, andresume_page(pagination).md_to_html— converts Claude's markdown to Telegram HTML.send/tg/typing— Telegram transport;sendchunks at 4000 chars and falls back to plain text on bad HTML.tg_download_file(file_id, dest_dir, name_hint=None)—getFile+ download Telegram media intotmp/(gitignored), returns the local path.name_hint(the original file name) only sets the extension so the agent's Read tool detects the type. Used for image input (photo / image document) and for any other document (PDF, text, code, spreadsheet…): the file's path is handed to the agent so its Read tool ingests it; the message caption becomes the prompt (no caption → "Analise esta imagem." / "Analise este documento."). Detection lives inmain, after the owner gate, in order: image → audio → document.transcribe_audio(path)— voice/audio path. The Read tool can't ingest sound, so audio is transcribed first. Dispatches between two backends:_transcribe_local(preferred, whenSTT_CMDis set) and_transcribe_cloud(fallback, whenSTT_API_KEYis set)._transcribe_local— shells out toSTT_CMD(a local command, e.g. the bundledstt_faster_whisper.py), appending the audio path as the last arg and reading the transcript from stdout.shlex.split(posix=False)keeps Windows backslashes; wrapping quotes are stripped per token. Fully offline._transcribe_cloud— hand-built multipart POST (stdliburllib) to an OpenAI-compatible/audio/transcriptionsendpoint (STT_API_URL, default Groqwhisper-large-v3; switch to OpenAI via env).mainhandlesvoice/audio/video_note/ audio documents after the image block, echoes the transcript back, and skips with a notice when neitherSTT_CMDnorSTT_API_KEYis set. OGG is accepted directly (no ffmpeg).stt_faster_whisper.pyis the only file with a third-party dep (faster-whisper);bridge.pystays stdlib-only.
run_claude(chat_id, cwd, prompt)— the agent core. Spawnsclaude -pwith--permission-mode bypassPermissions --output-format stream-json --verboseand--resume <sid>when a session exists for that cwd. Parses the stream for the finalresultand tool-use names. Frontend-agnostic — reuse this to add a non-Telegram frontend.list_sessions/session_preview/find_session— read past session transcripts from~/.claude/projects/<slug>/*.jsonl, where<slug>is the cwd with every non-alphanumeric char replaced by-.handle— command router (/cd /pwd /ls /new /resume /model /help); unknown slash commands fall through and are treated as prompts.main— poll loop with the owner gate (OWNER_ID) enforced before anyclaudecall. Each message and each callback tap runs on its own daemon thread (process_message/_run_callback) so a long turn never blocks the poll loop. On startup it resetscwdto home (DEFAULT_CWD), re-delivers any interrupted streaming run (_finalize_orphans), and sends the owner a "Bridge reiniciado" message so no reboot ever passes silently. If a restart note (tmp/restart_note.txt, orrestart_pending.txtafter a graceful restart) is present, its text is appended once and both markers are removed.- Restart workflow (
_restart_watcher/os.execv). To reload code after a change, writetmp/restart_note.txtdescribing what changed and stop — do NOT runlaunchctl kickstart/ kill the process yourself. A daemon watcher sees the note, setsRESTARTING(new prompts are deferred), drains in-flight runs (inflight_count()→ 0, capped atRESTART_DRAIN_TIMEOUT) so each still delivers its final message, renames the note torestart_pending.txt, and re-execs in the same PID viaos.execv. This replaces a hard kickstart that would kill the childclaudemid-response and drop the final message. - Live streaming (
LiveStream). A turn edits one message in place as a throttled "working" view; on completion it collapses to a✅trace and sends the full answer as a new message (edits don't notify, new messages do).run_claudeowns delivery and returns(tools, None)on success. While a run streams,persist_livesnapshots it intoSTATE["live_runs"]for crash recovery;clear_liveremoves the snapshot on delivery.
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 8d ago First seen · 104 lines · 1,661 tokens per session scan A 268ab05d1e38
claude-telegram-bridge CLAUDE.md is an instructions file published in the GitHub repository uniatrix/claude-telegram-bridge (2 stars, last pushed yesterday), licensed MIT. It adds 1,661 tokens to every session, about $0.0083 per session on Opus 5. A static security scan graded it A with 1 finding (makes network calls). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
next.js AGENTS.md
AGENTS.md instructions for vercel/next.js, covering next.js development guide, codebase structure, monorepo overview, core package: packages/next and other important packages.
codex AGENTS.md
AGENTS.md instructions for openai/codex, covering rust/codex-rs, the codex-core crate, code review rules, crate api surface and model visible context.
vscode buildNext.instructions.md
Working notes and architecture documentation for the new esbuild-based build system in build/next. Use when making changes to the new build pipeline (transpile/bundle commands, NLS plugin, source-map handling, resource copying, or self-hosting watch tasks).
vscode oss-third-party-notices.instructions.md
Instructions for microsoft/vscode, covering vs code oss third-party-notices pipeline, architecture, pipeline flow in ci, applying the notice (cutover) and fallback chain (never fail the build).
langchain AGENTS.md
AGENTS.md instructions for langchain-ai/langchain, covering global development guidelines for the langchain monorepo, corridor security analysis, project architecture and context, monorepo structure and development tools & commands.
spec-kit AGENTS.md
AGENTS.md instructions for github/spec-kit, covering agents.md, about spec kit and specify, quickstart — add a new integration in 5 steps, integration architecture and integrationmanifest — file tracking.