v4: system prompt 87 lines, mode emoji in topic title, bot/ split begins
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 humanizingbot/goal.pyβ goal helpers (record, mode, agency prompt, topic decoration)bot/miniapp_url.pyβ Mini App URL/tunnel resolutionbot/providers.pyβ_GhProvider,_CodexProviderbot/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
-
pytest33 cases pass - Syntax check all touched files
- Real test on a box:
/goal Xin a forum β verify π X title./autopilotβ topic renames to π X. - Verify
editForumTopicpermission (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.
/goalcreates topics with the emoji;/autopilotand/copilotrename viaeditForumTopic. The/goalack states the mode and how to switch.
-
Refactors
agent/system-prompt.mdtrimmed 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 intelegram_bot.pyto avoid call-site changes. - Added tests for
_decorate_topic_titleidempotency; 33 tests pass.