v6: steering semantics, new-topic spawn, 2-option cards, source-aware images

MA
7mo ago
+38-10

Stacked on #213 (v5). System-prompt-only PR. 127 lines (was 87).

Four new sections

Steering and interrupts

The audit (running this branch through Explore) confirmed: when a new message lands mid-turn — user reply, scheduled heartbeat firing, button-tap dispatch — the bot SIGKILLs the running agent process and starts a fresh turn. The old turn's session log persists via --resume so the next turn sees both contexts. It's steering, not queuing.

Doctrine added so the agent works durably:

  • Persist intermediate state (notebook.md, agency.db); don't rely on long-running in-memory work that gets killed.
  • Agent-tool sub-agents die with the parent (same process group).
  • For work that must survive a preempt: nohup bash -c 'claude -p "X" | tg-send' >/dev/null 2>&1 & (detaches, result lands in the topic when done).

Spawning new topics for new goals

When the user surfaces a distinct new goal mid-conversation, agent spawns a fresh topic:

tg-schedule "+1 minute" --fresh --name "šŸ›Ÿ <new goal>" "[goal] <start prompt>"

Doctrine on when to spawn (a separate ongoing concern) vs not (small follow-ups, refinements).

Your own schedule is editable

Agent has full access. atq lists heartbeats, atrm <id> removes, tg-schedule '+INTERVAL' --repeat '+INTERVAL' "..." re-schedules. If the user says "every 30 min instead of every hour", agent makes it happen directly.

Cards default to TWO drafted options

New canonical card:

[image — billboard: source avatar + WHAT, 1-second readable]
<emoji> <verb-led action>
<one sentence: why this moves the goal>

ā–¾ šŸ…°ļø Drafted option 1 — warm
ā–¾ šŸ…±ļø Drafted option 2 — terse

[šŸ…°ļø Send option A] [šŸ…±ļø Send option B]
[šŸ” More options] [ā­ Skip]

Single-option cards remain available for status confirms / one-shot merges, but drafts/replies/posts default to two.

Source-aware images

The card image should make platform + action obvious in 1 second — Gmail avatar, GitHub octocat, X bird, Slack swatch. Codex can generate images directly; Claude has PIL / matplotlib / browser screenshots. Use whichever is faster.

Test plan

  • 33 tests pass
  • On a box: /goal in a forum, observe topic title šŸ›Ÿ prefix, see first heartbeat queued (atq)
  • Send a message mid-turn — verify the in-flight process is killed and the new turn picks up both contexts
  • Tap Yes on a 2-option card — verify --button "šŸ…°ļø Send option A" routes correctly

šŸ¤– Generated with Claude Code


Summary by cubic

Defines v6 steering behavior, two-option cards, and source-aware images in the system prompt to make turns resilient to interrupts and decisions faster to approve. Adds new-topic spawning and editable schedules so goals stay organized and on cadence.

  • New Features
    • Steering and interrupts: a new message mid-turn SIGKILLs the current process and starts a fresh turn with --resume; persist work (e.g., notebook.md, agency.db), use nohup for tasks that must survive, and only parallelize via Agent sub-processes when safe.
    • New-topic spawning: when a distinct new goal appears, create a fresh lane with tg-schedule "+1 minute" --fresh --name "šŸ›Ÿ <title>" "[goal] <prompt>"; keep small follow-ups in the current topic.
    • Editable schedule: list with atq, remove with atrm <id>, and re-schedule heartbeats via tg-schedule '+INTERVAL' --repeat '+INTERVAL'.
    • Two-option cards by default: draft A/B variants with buttons [šŸ…°ļø Send option A] and [šŸ…±ļø Send option B] (plus More/Skip); render via agency-report --block ... --button ...; single-option cards remain for simple confirms.
    • Source-aware images: card images must reveal platform + action in 1 second (e.g., Gmail avatar, GitHub, X, Slack); use PIL/screenshots or generator as fastest path.