v4: system prompt 87 lines, mode emoji in topic title, bot/ split begins

MA
7mo ago
+372-389

Stacked on #211 (simplify-v3 β†’ system-prompt.md rename).

Three changes, one PR

1. System prompt trimmed 170 β†’ 87 lines

You said it was still too long. Dropped SSH (rarely used), shrank Scheduling + Self-update + Browser, folded "If running as Codex" into "How you work". The new "How the system works" 5 bullets at the top carry the whole model; everything else is convention/detail. The agent has the full system in ~one screen.

2. Mode visibility β€” emoji prefix in topic title

You called out that the user doesn't know which mode they're in. Now every /goal topic title gets a mode emoji prefix:

  • πŸ›Ÿ copilot (default)
  • πŸš€ autopilot

User sees the mode in the topic list at a glance. /autopilot and /copilot rename the topic via editForumTopic so the prefix swaps. The /goal ack explicitly tells the user the mode and how to switch.

3. Codex approval check β€” there is no bug

You asked whether codex still gates approvals in /goal mode. Answer: no. Codex is launched with -a never -s danger-full-access (telegram_bot.py:4560). Codex's native approval gates are OFF. Copilot vs autopilot is enforced purely at the prompt level β€” the LLM reads the mode in the system prompt + goal prompt and follows it. Both CLIs behave the same.

In copilot mode the LLM drafts, calls agency-report to post a card with buttons, and waits for the user's tap. The tap IS the approval. In autopilot mode it acts directly. Neither flow involves codex's -a mechanism.

4. Bot split begins

agent/bot/ folder created. First module extracted: bot/markdown.py (243 LOC) β€” MDV2 escaping, expandable blockquote rendering, streaming view, message chunking. Pure helpers, no Bot state. Re-imported as module-level names in telegram_bot.py so internal callers stay unchanged.

This sets the pattern. Follow-up PRs will move:

  • bot/streaming.py β€” StreamingMessage + token humanizing
  • bot/goal.py β€” goal helpers (record, mode, agency prompt, topic decoration)
  • bot/miniapp_url.py β€” Mini App URL/tunnel resolution
  • bot/providers.py β€” _GhProvider, _CodexProvider
  • bot/terminal.py β€” ShellSession

Bot class + lane state stay in telegram_bot.py for now.

Tests

33 pass (4 new for _decorate_topic_title idempotency).

Test plan

  • pytest 33 cases pass
  • Syntax check all touched files
  • Real test on a box: /goal X in a forum β†’ verify πŸ›Ÿ X title. /autopilot β†’ topic renames to πŸš€ X.
  • Verify editForumTopic permission (bot must be admin with manage_topics)

πŸ€– Generated with Claude Code


Summary by cubic

Trimmed the system prompt to 87 lines and made goal topics show mode via emoji so users can see copilot/autopilot at a glance. Started splitting bot code by extracting MarkdownV2 and chunking helpers into agent/bot/markdown.py.

  • New Features

    • Mode in topic titles: πŸ›Ÿ copilot, πŸš€ autopilot.
    • /goal creates topics with the emoji; /autopilot and /copilot rename via editForumTopic. The /goal ack states the mode and how to switch.
  • Refactors

    • agent/system-prompt.md trimmed 170 β†’ 87 lines (removed SSH, tightened Scheduling/Browser/Self-update, folded Codex notes into β€œHow you work”). Copilot vs autopilot is prompt-enforced; Codex approval gates are disabled.
    • Extracted MarkdownV2 escaping, expandable blockquotes, streaming view, and message chunking to agent/bot/markdown.py; re-exported in telegram_bot.py to avoid call-site changes.
    • Added tests for _decorate_topic_title idempotency; 33 tests pass.