gateway

gateway is a cursor rule for Cursor from coddy-project/coddy-agent. It costs 0 tokens per session (7,129 once invoked), scanned A, original, MIT.

A gateway for connecting Coddy to messaging services, including Telegram. It manages message adapters, access rules, conversation sessions, and optional network proxies.

In plain words
What is it for?
Use it to build Telegram polling and message sending, control who can access chats, preserve chat-to-session links, and format Markdown for Telegram.
Why use it?
It lets conversations continue across restarts and keeps service-specific messaging code separate from the rest of the application.

Cursor rule for Cursor

Written for Cursor: installed under .cursor/. Also seen: mentions subagents; positional $N argument.

Good fit Use it to build Telegram polling and message sending, control who can access chats, preserve chat-to-session links, and format Markdown for Telegram.

Compare 6 cursor rules from other repositories ↓
Install with agentmods
npx agentmods add rules/coddy-project/coddy-agent/gateway
Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

Clone the repo
git clone --depth 1 https://github.com/coddy-project/coddy-agent

Made for: Cursor.

Wrote 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.

agentmods badge for gateway

README.md
[![agentmods](https://agentmods.dev/badge/rules/coddy-project/coddy-agent/gateway/github.svg)](https://agentmods.dev/rules/coddy-project/coddy-agent/gateway)
Your own site
<a href="https://agentmods.dev/rules/coddy-project/coddy-agent/gateway"><img src="https://agentmods.dev/badge/rules/coddy-project/coddy-agent/gateway/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.

agentmods 80×15 button for gateway

Your own site · 80×15
<a href="https://agentmods.dev/rules/coddy-project/coddy-agent/gateway"><img src="https://agentmods.dev/badge/rules/coddy-project/coddy-agent/gateway.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 0 Nothing until a file matches its globs; then the whole rule loads.
When invoked 7,129 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5.1 $0.00000 $0.07129
Opus 5.5 $0.00000 $0.02852
Sonnet 5.5 $0.00000 $0.01426
Haiku 4.5 $0.00000 $0.00713

Measured 5d ago against content hash b1b009fa1319, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

gateway scanned grade A with 0 findings 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 5d 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.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.cursor/rules/gateway.mdc · 138 lines

How it starts

The opening of the file, as written. The whole thing — 138 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Messenger Gateway (external/gateway)

Built with -tags gateway.telegram (Telegram only), -tags gateway.pachca (Pachca only) or -tags gateway (all adapters). Each bot is a subsystem of coddy serve of its own (serve.KindGateway for Telegram, serve.KindGatewayPachca), started by gateway.ServeTelegram / gateway.ServePachca (serve_<name>.go, with a _stub.go and a <Name>Available const per adapter); a bot enabled in a binary without its tag is refused at startup by name.

Package layout

Package Role
external/gateway Adapter interface, Hub, IncomingMessage, OutgoingMessage
external/gateway/access CanAccess, EffectiveAccess, EffectiveIsolation over access.Policy (admins, user groups, defaults, ChatOverride), which config.TelegramGatewayConfig and config.PachcaGatewayConfig both satisfy
external/gateway/sessionstore Store: maps stable chat/user keys to Coddy session IDs (Get mints, Reset replaces for /clear, Bind points a chat at an existing session for /resume); persisted to gateway_sessions.json
external/gateway/proxyutil BuildHTTPClient — HTTP/SOCKS5 proxy support for outbound adapter requests
external/gateway/telegram Bot (polling, dispatch, ACL), Sender (streaming output), commands.go (the inline keyboard for /model, the callback dispatcher, callbackValue for payloads over 64 bytes), resume.go (/resume: the session picker over HandleSessionList, the query matcher, the resume:s: / resume:p: callbacks), media.go (what a person sends besides text, below), isSettingsCommand (/model <id>, /think, /nothink, /reasoning, /agent, /plan, /ask with --once / --count=N go to the session as a message and the manager takes them; /permissions does not, the bot approves its chat agent itself), prompt.go (what the model is told about answering here), markdown.go (md → Telegram format)
external/gateway/pachca The Pachca integration bot: client.go (REST client, 429 policy), poll.go (the events history walk, the watermark in gateway_pachca_state.json), dispatch.go (addressing, ACL, commands, turns), sender.go (one streamed message, edits, splitting), commands.go (/model buttons, clicks), permission.go, wake.go, prompt.go, markdown.go
internal/pachcafake (untagged) The fake Pachca API the adapter's tests run on httptest: token info, profile, chats, messages with buttons and edits, the events history (newest first, cursor pages, delete), faults, and the person's side (UserPosts, UserClicks, StartThread)
tgfake (github.com/EvilFreelancer/tgfake, pinned in go.mod) The fake Bot API, kept in its own repository: every method the adapter calls, long-polled getUpdates, getFile and the file downloads, the /sim/* API (the person's photos, documents and albums through InjectMedia / /sim/media included) and the chat page, pkg/llmstub for a scripted model; Mini Apps too - web_app buttons, the menu button, signed launches (/sim/webapp/launch) and a phone frame on the page that plays Telegram's client for the app. Tests import pkg/server (as tgfake) and run it on httptest; scripts and CI start its binary of the same version (docs/contributing/tgfake.md)

Read the full file on GitHub · 138 lines

Changes

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.

  1. 5d ago Changed · +4 lines b1b009fa1319
  2. 10d ago Changed a885bcdf0da6
  3. 13d ago Changed · +19 lines 4000f161fbed
  4. 20d ago Changed · +1 lines 8f21ef11f0e2
  5. 26d ago Changed 93a9c98d8d78
  6. 28d ago Changed · -1 lines a864f15e7f4b
  7. 29d ago Changed · +4 lines ee1f79bc5bf0
  8. 1mo ago Changed · +14 lines 4fced6728abc
  9. 1mo ago Changed · +6 lines c024b4122f5c
  10. 1mo ago First seen · 91 lines · 0 tokens per session scan A bdcd8a42c018

Subscribe to this mod's changes

gateway is a cursor rule published in the GitHub repository coddy-project/coddy-agent (179 stars, last pushed today), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 7,129 tokens. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.