agentleFS
littlebearappslittlebearapps/untether/AGENTS.md

untether

AGENTS.md72 starsChanged 37 days agoMITView on GitHub

Telegram bridge for AI coding agents. Control Claude Code, Codex, OpenCode, and Pi from your phone (Gemini CLI and Amp are deprecated and unsupported — when a sweep breaks them, xfail/skip the test rather than fixing the runner) or any device — agents run on your machine in the background while you're away from the terminal. Features interactive permissions, voice input, cost tracking, and live progress streaming. Engine parity roadmap: v0.36.1 Antigravity (#558), v0.36.2 Codex app-server (#960–#968), v0.36.3 OpenCode ACP…

The file

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

10 rules. About 0 are common, 3 are distinctive, and 7 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈3

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 7

    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:

    Every run MUST emit exactly:

    line 33
  2. Very specific:

    Use EventFactory for event construction.

    line 40
  3. Very specific:

    ALL writes go through TelegramOutbox (never call Bot API directly)

    line 46
  4. Very specific:

    Call answerCallbackQuery promptly to clear button spinners

    line 48
  5. Distinctive:

    Use stub subprocess runners with fake CLI scripts

    line 58
  6. Very specific:

    Use FakeTransport protocol doubles (not real Telegram clients)

    line 59
  7. Distinctive:

    Verify 3-event contract in all runner tests

    line 60
  8. Very specific:

    Never push to master/main, create v* tags or create GitHub releases — merging the dev→master PR is the release, and only Nathan approves it.

    line 83
  9. Very specific:

    Test local changes on the dev bot (untether-dev.service, @untether_dev_bot), never staging (untether.service, which runs a PyPI/TestPyPI …

    line 84
  10. Very specific:

    Every bug fix or significant change needs a GitHub issue, linked from CHANGELOG.md under the current ## vX.Y.Z (unreleased) heading.

    line 85

≈ “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

Untether — Agent Instructions

Telegram bridge for AI coding agents. Control Claude Code, Codex, OpenCode, and Pi from your phone (Gemini CLI and Amp are deprecated and unsupported — when a sweep breaks them, xfail/skip the test rather than fixing the runner) or any device — agents run on your machine in the background while you're away from the terminal. Features interactive permissions, voice input, cost tracking, and live progress streaming.

Engine parity roadmap: v0.36.1 Antigravity (#558), v0.36.2 Codex app-server (#960–#968), v0.36.3 OpenCode ACP (#969–#974). OpenCode support means the 1.x CLI (npm opencode-ai); 2.x (@opencode/cli) is refused before spawning (#970). Website: https://untether.cc · Help centre (user docs, synced flat from docs/ on master): https://littlebearapps.com/help/untether/<file-stem>/

Architecture

Telegram <-> TelegramPresenter <-> RunnerBridge <-> Runner (claude/codex/opencode/pi/gemini/amp)
                                       |
                                  ProgressTracker
  • Runners (src/untether/runners/) — engine-specific subprocess managers
  • RunnerBridge (src/untether/runner_bridge.py) — connects runners to Telegram presenter
  • TelegramPresenter (src/untether/telegram/bridge.py) — renders progress, inline keyboards, answers
  • Commands (src/untether/telegram/commands/) — command/callback handlers
  • Schemas (src/untether/schemas/) — msgspec structs for JSONL parsing

Key conventions

  • Python 3.12+, anyio for async, msgspec for JSONL, structlog for logging
  • Ruff for linting (uv run ruff check src/ tests/), pytest with 80% coverage threshold
  • Australian English in user-facing text (realise, colour, behaviour, licence)
  • Conventional commits: feat:, fix:, docs:, refactor:, test:, chore:
  • Feature branches: feature/*, fix/*, docs/*

Runner 3-event contract

Every run MUST emit exactly:

  1. StartedEvent — once, when session ID is known
  2. ActionEvent(s) — zero or more
  3. CompletedEvent — exactly once, always final

Exception (Claude live sessions, #776): after CompletedEvent a runner that keeps its process live may emit later turns as TurnEvent(started) → ActionEvent* → TurnEvent(completed) segments. Never a second CompletedEvent. See .claude/rules/runner-development.md.

Use EventFactory for event construction. Never construct event dataclasses directly.

Runner instances are shared across chats: bridge code reads the per-run RunStreamHandle (filled by publish_run_stream()), never runner.current_stream / runner.last_pid, which are diagnostics only (#510).

Telegram transport rules

  • ALL writes go through TelegramOutbox (never call Bot API directly)
  • Callback data max 64 bytes, format: prefix:action:id
  • Call answerCallbackQuery promptly to clear button spinners
  • Message limit 4096 chars; Untether splits long responses across multiple messages by default

Testing

uv run pytest                    # all tests
uv run pytest tests/test_*.py -x # specific file
  • Use stub subprocess runners with fake CLI scripts
  • Use FakeTransport protocol doubles (not real Telegram clients)
  • Verify 3-event contract in all runner tests

Commands

CommandDescription
/cancelStop the running agent (an idle live session is closed; pending /at runs and loops are dropped too)
/agentShow or set engine for this chat
/modelOverride the model for an engine
/planmodeSet Claude Code permission mode (on/plan-auto/auto/off)
/usageClaude subscription quota; token totals for Codex/OpenCode
/statsPer-engine session statistics (today/week/all-time)
/authCodex device re-authentication
/exportExport session transcript
/browseBrowse project files
/configInteractive settings menu
/steer / /queueClaude: steer a follow-up into the running session, or queue it (bare form sets the chat/topic default)
/verboseToggle verbose progress mode
/restartGracefully restart Untether

Branches, releases and test bots (never break these)

  • Work on feature/* / fix/* / docs/* branches → PR to dev (publishes an rc to TestPyPI). master always matches the latest PyPI release.
  • Never push to master/main, create v* tags or create GitHub releases — merging the dev→master PR is the release, and only Nathan approves it.
  • Test local changes on the dev bot (untether-dev.service, @untether_dev_bot), never staging (untether.service, which runs a PyPI/TestPyPI wheel). Never restart Untether from inside an active Untether session — config hot-reloads, and the restart drain drops the final message.
  • Every bug fix or significant change needs a GitHub issue, linked from CHANGELOG.md under the current ## vX.Y.Z (unreleased) heading.

Before committing

uv run ruff format --check src/ tests/
uv run ruff check src/ tests/
uv run pytest
uv lock --check

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.