Skip to content

General Purpose Bot, @Forge_General_Purpose_Bot

5th Telegram bot in the fleet. Built 2026-04-30 to fill the "do anything in one chat thread" gap. The remote-bridge bot already does spawn-by-default opus, but it opens a separate tmux/claude.ai/code window. This bot keeps everything in the Telegram thread itself: ask it anything, it figures it out, replies in chat.

Identity

Layer Behavior
Model Opus 4.7 (claude-opus-4-7), 180s timeout per iter
Iter cap 8 (vs 4 for capture/coordinator), because raw-tool exploration legitimately chains many calls
Tool surface 80 tools = all 70 coordinator tools + 10 raw escape hatches
Persona general in forge_telegram_brain.py
Context log forge/data/general-purpose-context.jsonl
Quota invoker forge_telegram_brain[general]

Raw escape-hatch tools (in forge/scripts/forge_general_purpose_tools.py)

Tool Purpose
run_bash(cmd, timeout, cwd) Arbitrary bash on Console. No sandbox. rc/stdout/stderr capped 6KB; overflow at /tmp/forge-general/.
run_ssh(host, cmd, timeout) SSH to a known fleet alias. BatchMode + ConnectTimeout=10.
read_file(path, max_bytes, encoding) Bytes-aware read with size cap.
write_file(path, content, mode) mode: overwrite | append | create. Auto-mkdir parents.
edit_file(path, old, new, count) Literal string replace; count=0 for replace_all.
list_dir(path, hidden) Sorted ls with kind/size/name.
search_files(pattern, root, glob, max_results) Recursive grep wrapper.
http_request(url, method, headers, json_body, body, timeout) Generic HTTP client.
ha_call(domain, service, data) Home Assistant service call shortcut. Reads ~/.forge-secrets/home-assistant.env.
ha_state(entity_id) Read one HA entity.

Layout

Path Role
forge/scripts/forge_telegram_general_purpose_bot.py Long-poller, voice transcribe, react UX, brain dispatch
forge/scripts/forge_general_purpose_tools.py Raw tool definitions + handlers
forge/scripts/forge_telegram_brain.py Persona-aware facade. Added general persona, MODEL_BY_PERSONA, MAX_ITERS_BY_PERSONA
/etc/systemd/system/forge-general-purpose.service Unit (template at /tmp/forge-general-purpose.service until installed)
~/.forge-secrets/telegram-general-purpose.env Token + auth (chmod 600). Token field empty, fill from @BotFather.
forge/logs/telegram-general-purpose.log Service log
forge/data/general-purpose-context.jsonl Persistent chat history (last 12 turns auto-loaded by brain)

Install steps (Justin owns these)

  1. @BotFather: /newbot → name Forge_General_Purpose_Bot, get token.
  2. Drop the token into ~/.forge-secrets/telegram-general-purpose.env (line TELEGRAM_BOT_TOKEN=...).
  3. Install systemd unit:
    sudo cp /tmp/forge-general-purpose.service /etc/systemd/system/forge-general-purpose.service
    sudo systemctl daemon-reload
    sudo systemctl enable --now forge-general-purpose.service
    
  4. Tail to verify: tail -f forge/logs/telegram-general-purpose.log
  5. Send a test DM to @Forge_General_Purpose_Bot: e.g. "what's HA say about light.kitchen?"

When to use vs the other bots

Ask Right bot
"log my workout, save a note, ping me at 3pm" Capture (single-shot multi-intent)
"draft an email to X about Y" Coordinator (deep tool surface, voice library)
"spawn an opus to refactor the brain" Remote-bridge (spawns tmux, runs in Real Brain)
"SSH into Finn and check why mounts are flaky, then fix it" General Purpose (raw bash/ssh, in-thread)
"hit the HA API and toggle the kitchen scene" General Purpose (ha_call)
"read forge/scripts/foo.py, find the bug in the cron handler, edit it, and restart the timer" General Purpose (read_file + edit_file + run_bash)

Cost discipline

Opus 4.7 burns subscription quota fast. Per-message cost ≈ 4-8x a coordinator (sonnet) message because (a) Opus is more expensive per token, and (b) iter cap is 8 vs 4. Use this bot for asks where the alternative is opening a Remote Control window. Don't use it as a default capture path.

The quota tracker logs every call with invoker=forge_telegram_brain[general], so usage is visible via /quota and the nightly aggregator.

Safety posture

  • Single authorized user via TELEGRAM_AUTHORIZED_USER_ID (7110798439). Same gate as the other 4 bots.
  • Bot is god-mode by design: full bash, full SSH, full file write. Telegram auth is the only gate. If the token leaks, attacker has full Console + SSH access.
  • System prompt instructs the brain not to echo ~/.forge-secrets/ contents into chat unless Justin asks explicitly.
  • Email-send still requires per-batch confirmation (inherits coordinator's email tools).
  • Em-dash sanitize at outbound boundary (same as other bots, via forge_telegram_format.sanitize_for_telegram).

[Claude Code, 2026-04-30]