agentleFS
leoshenzhleoshenzh/codex-on-telegram/lib/AGENTS.md

codex-on-telegram / lib

AGENTS.md2 starsChanged 5 months agoMITView on GitHub

This repository is the shared Telegram bridge core used by local host wrappers such as ../claude-to-im. It should stay small, transport-focused, and reusable.

  • 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 31,542 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.

  • In this repository2 other files it gives its agents.

The file

We split this AGENTS.md into the rules it gives an agent

4 rules. About 0 are common, 1 is distinctive, and 3 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 3

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  • could be automatic: a setting could enforce it
  1. Distinctive:

    Do not reintroduce hidden session creation for read-only commands.

    line 59
  2. Very specific:

    Do not ship any change without tests and a rebuilt dist/.

    line 60
  3. Very specific:

    Keep plan.md in sync with scope and verification state.

    line 61
  4. Very specific:

    Verify with npm run typecheck, npm run test:unit, and npm run build.

    line 62

≈ “Common” is an estimate: at least 1 in 5 of the 40,246 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.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
AGENTS.md

AGENTS.md

Purpose

This repository is the shared Telegram bridge core used by local host wrappers such as ../claude-to-im. It should stay small, transport-focused, and reusable.

What this repo owns

  • src/lib/bridge/host.ts: host contracts
  • src/lib/bridge/bridge-manager.ts: bridge orchestration and message handling
  • src/lib/bridge/adapters/telegram-adapter.ts: built-in Telegram transport
  • src/lib/bridge/channel-router.ts: chat-to-session binding
  • src/lib/bridge/delivery-layer.ts: outbound send / retry / dedup
  • src/lib/bridge/permission-broker.ts: permission prompt and callback handling
  • src/lib/bridge/security/*: validation and rate limiting
  • src/lib/bridge/local-codex-sessions.ts: local Codex session discovery
  • src/__tests__/unit/*: thin-bridge safety and regression tests

Message flow

  1. Adapter receives a Telegram update.
  2. bridge-manager.ts consumes the queued update.
  3. Commands such as /new, /bind, /sessions, and /perm are handled directly.
  4. First normal messages in a Telegram DM, group, or topic can auto-create and bind a bridge session when no active binding exists.
  5. Normal messages are routed to the bound session.
  6. conversation-engine.ts streams runtime output.
  7. delivery-layer.ts sends the reply back through Telegram.
  8. Bridge-backed session titles should reflect the Telegram chat or topic name and sync back into the local Codex recent-task index when possible.

Current Telegram semantics

  • Group chats and Telegram topics are first-class routes, not private-chat fallbacks.
  • One Telegram group can hold separate bindings per topic.
  • Group commands with @botname suffix must resolve like the plain command.
  • Permission handling can flow through inline buttons, 1/2/3 quick replies, or /perm.
  • Built-in Telegram display names should prefer the group title for group traffic and the person/chat name for DMs.
  • Local Codex title sync should append a new session_index.jsonl record instead of rewriting the whole file.

Keep this repo focused

  • Telegram transport only
  • Shared bridge behavior only
  • Session routing, delivery, permission, security, and discovery only
  • Tests that stop false success and silent message loss

Do not add back

  • Discord
  • Feishu / Lark
  • QQ
  • Weixin
  • Host-specific login, QR, account, or device flows
  • Duplicate internal docs spread across the tree

Editing rules

  • Fix shared runtime bugs here; fix local machine boot logic in the consuming host repo.
  • Do not reintroduce hidden session creation for read-only commands.
  • Do not ship any change without tests and a rebuilt dist/.
  • Keep plan.md in sync with scope and verification state.
  • Verify with npm run typecheck, npm run test:unit, and npm run build.

Download now (ZIP)

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
What did you use it for? e.g. Reviewing pull requests in a Rails app

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.