courier
AGENTS.md0 starsChanged 5 months agoMITView on GitHub
Canonical agent operating guide. Read this every iteration before doing work. It is tool-agnostic: any MCP-speaking coding agent can load courier and should follow this file. Harness-specific setup (Claude Code skills, hooks, etc.) lives in its own file — see "Harness-specific integrations" below. courier is a Rust stdio MCP server that bridges one Telegram account to coding-agent sessions. Text a dedicated Telegram account from your phone; any coding-agent session that loads courier can later pull the backlog and act on…
- Reads credentials
Where files are headingNew AGENTS.md files have more rules about keeping secrets out of the code, and fewer about code style.
Of the AGENTS.md files we read, the 35,117 first seen in the last six months, against the older ones: the kind of rule that gained most share, and the kind that lost most. About files like this in general, not this one, and an estimate, since a kind is a pattern in the words.
The file
We split this AGENTS.md into the rules it gives an agent
3 rules. About 0 are common, 2 are distinctive, and 1 is very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
1
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 21
Only surface messages from the sender allowlist, and only from the
- Distinctive: line 50
NOT Telegram server-side read-state.
- Very specific: line 97
Before claiming any milestone done, run its validator from docs/build-plan.md fresh, read the output, and quote the proving line.
≈ “Common” is an estimate: at least 1 in 5 of the 45,344 AGENTS.md files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
AGENTS.md — courier
Canonical agent operating guide. Read this every iteration before doing work. It is tool-agnostic: any MCP-speaking coding agent can load courier and should follow this file. Harness-specific setup (Claude Code skills, hooks, etc.) lives in its own file — see "Harness-specific integrations" below.
What this is
courier is a Rust stdio MCP server that bridges one Telegram account to coding-agent sessions. Text a dedicated Telegram account from your phone; any coding-agent session that loads courier can later pull the backlog and act on it. The messaging app is transport; the product is a durable, pull-based inbox any session can drain on demand.
One-liner: "Text your coding-agent sessions."
Hard constraints — do not violate
- Access control is not optional. A user account can be DMed by anyone. Only surface messages from the sender allowlist, and only from the one configured target chat. Everything else is ignored.
- The grammers session file is a credential (full account access). It is
git-ignored (see
.gitignore) — enforcement lives there, not in this prose. Keep itchmod 600and never move it into a tracked path. Same for.envandapi_id/api_hash. - No server-side mark-as-read. Handled-state stays local. (Conflating it with Telegram read-state would clobber the human's own unread view.)
- v1.2 adds live listening; still single-machine, no hosted infra.
await_messagelong-polls as an extension of pull — that's in scope. Still forbidden: the Claude Code channel contract (evaluated, rejected — see docs/spec.md decision log; it's a specific rejected design, not a statement that courier is Claude-Code-only) and an always-on supervisor (v3).
Stack (locked — see docs/spec.md decision log for rationale)
- Language: Rust
- Telegram:
grammers— pure-Rust MTProto, logs in as a user account (not a bot). Dev happens on Codeberg; the GitHub repo is archived. Crate:grammers-client(+grammers-session). - Interface: an MCP server (stdio) any MCP client can load, exposing
four pull tools plus a send-only CLI subcommand. Built on the Rust MCP SDK
(
rmcp— confirmed 2026-07-16: v2.2.0, active, official; featuresserver, transport-io, macros, schemars; hold shared state asArc<tokio::sync::RwLock<…>>— handler is cloned per session, and std mutexes across.awaitdeadlock). - Handled-state: a local JSON ledger file of processed message IDs. NOT Telegram server-side read-state.
The four tools (+ one CLI subcommand)
check_inbox— return messages from the target chat whose IDs are not in the local ledger, oldest-first. Photo/document attachments are downloaded and surfaced asmedia_path(ormedia_erroron failure — never silent drop).reply— send a message back to the target chat.mark_handled— append message IDs to the ledger after acting. Discipline: act → reply → mark_handled, one message at a time, never batched. If a session dies mid-drain, anything not yet marked reappears on the nextcheck_inbox— that's the whole point of per-message marking.await_message(timeout_seconds)— long-poll; block until the next allowlisted message arrives in the target chat, or return{"timed_out": true}after ~55s. A timeout means call it again — that's normal idling, not an error. Delivery is claimed via a flock-guardedclaims.jsonnext to the ledger, so with multiple listeners exactly one gets each message. Pull (check_inbox) ignores claims and remains the durable backstop if nothing is listening.courier notify "<text>"— a send-only CLI subcommand of the same binary (not a tool, not part of the MCP surface): sends to the target chat and exits, no read, no MCP round-trip.--from-hookreads a JSON notification payload from stdin and sends only on a permission-prompt notification, formatted"blocked: <message>".--if-listeningno-ops unless a listener marker underCOURIER_HOMEis fresher than 15 minutes. Built for harness "I'm blocked" pings (see Harness-specific integrations) but usable standalone from any script.
COURIER_HOME and state
COURIER_HOME (optional env var) points all state — session file, .env,
ledger, claims file, media/, listener markers — at one directory, so a
user-scope server works the same regardless of which repo a session is
running in. Unset falls back to the server's cwd (fine for single-repo dev).
Build / run / validate
- Build:
cargo build - Spike (throwaway login test):
cargo run --bin spike - Tests:
cargo test - First-run auth is interactive (phone → code Telegram sends → optional 2FA) and cannot be automated. After first run, the saved session makes it non-interactive.
Verification discipline
Before claiming any milestone done, run its validator from docs/build-plan.md fresh, read the output, and quote the proving line. Never "should work."
Where things are
- docs/spec.md — scope, user stories, non-goals, decision log.
- docs/build-plan.md — ordered milestones, each with "done when" + validator. This is the roadmap. Start at the first unchecked milestone.
- Definition of done: the v1 exit criteria at the bottom of build-plan.md — work toward it; a milestone counts only when its validator passes.
Harness-specific integrations
This file describes courier's contract; it does not assume any particular agent harness.
- Claude Code specifics — skills (
/inbox,/listen) and the project'sCLAUDE.md— live inCLAUDE.mdand.claude/skills/. - Blocked-permission pings. A session frozen at a permission prompt
can't call MCP tools. The fix runs outside the agent entirely: wire
courier notify --from-hook --if-listeninginto whatever hook mechanism your harness offers for "a prompt is blocking the session" events. The Claude Code Notification-hook snippet is in README.md; port the samecourier notifyinvocation to your harness's equivalent hook. - Any MCP client gets the same four-tool contract described above.
The per-message discipline — act, then reply, then mark_handled, one
message at a time, never batch, never mark before acting — is not a
Claude Code convention; it's how courier's ledger is meant to be driven,
restated here for harnesses that can't read
.claude/skills/*/SKILL.mdfiles directly.
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

