Skip to content

agency: --spawn-topic flag, in-place by default, persistent ✓ buttons#103

Merged
MagMueller merged 1 commit intomainfrom
agency-spawn-topic-flag
May 7, 2026
Merged

agency: --spawn-topic flag, in-place by default, persistent ✓ buttons#103
MagMueller merged 1 commit intomainfrom
agency-spawn-topic-flag

Conversation

@MagMueller
Copy link
Copy Markdown
Contributor

@MagMueller MagMueller commented May 7, 2026

Three behavior changes from real-use feedback.

1. `--spawn-topic` opt-in (default = run in-place)

Was: every Yes-tap created a new forum topic. Cards posted inside an existing worker topic spawned more topics on Yes — recursive nesting.

Now: default is in-place dispatch in the same thread the card lives in. Pass `--spawn-topic` when you specifically want a fresh topic — primarily for the `/agency` loop's half-hourly cards (each cycle deserves its own thread). No auto-protection: an agent inside a worker topic can still set `--spawn-topic` to fork another topic; the flag is honored without override.

Schema: new `spawn_topic INTEGER NOT NULL DEFAULT 0` column on `suggestions`. Migration via `ALTER TABLE` with duplicate-column swallow in `init_schema`, so existing DBs upgrade idempotently on first `agency_db.conn()`.

2. Persistent ✓ buttons replace keyboard-strip + 🔥 reaction

Default kinds (Yes / Skip / Edit) used to strip the keyboard after a tap. That made every answered card visually identical to a fresh one — across a 30-card feed, "did I answer this one?" was unreadable. PR #102 added a 🔥 reaction as a workaround marker.

Now: the keyboard stays. `_agency_mark_picked` grows a `reset_others` flag — for default kinds it strips ✓ from every other button before marking the tapped one (only the latest pick is highlighted, user can re-tap to change their mind). Custom buttons keep additive behavior (multi-tap stacks for variant-pickers like "Send draft A" + "Send draft B").

Drops the `setMessageReaction` call from #102 — the ✓ on the button is the at-a-glance marker.

3. Docstring updates

`agency-report` docstring now describes the spawn semantics, image-is-optional rule, and the "variable expandable count" pattern. Local skill file (not in this repo) carries the longer guidance about smart button labels and the multi-variant pattern for high-uncertainty asks.

Test plan

  • Smoke-test default in-place — agency-report (no --spawn-topic) → tap Yes → agent runs in the SAME thread, no new topic created
  • Smoke-test --spawn-topic — agency-report --spawn-topic → tap Yes → fresh forum topic spawns
  • Persistent buttons — tap Yes, verify ✓ Yes shows; tap Skip, verify ✓ Skip shows + ✓ Yes cleared
  • Custom buttons stay additive — tap Send A, then Send B → both show ✓

Summary by cubic

Make topic spawning opt-in with --spawn-topic so Yes/Edit run in-place by default. Keep ✓ selections visible on buttons for quick at-a-glance state, and update docs for routing and image guidance.

  • New Features

    • Add --spawn-topic to agency-report; default is in-place dispatch in the current thread. Use for /agency cycle cards or tasks that need their own topic.
    • Persist the inline keyboard. Default buttons (Yes/Skip/Edit) use exclusive ✓ highlighting; custom buttons stay additive so multiple picks can stack.
    • Remove the 🔥 reaction; the ✓ mark now shows the chosen action.
    • Docstring explains spawn semantics and when to skip images.
  • Migration

    • Add spawn_topic INTEGER NOT NULL DEFAULT 0 to suggestions. Applied automatically in init_schema with idempotent ALTER TABLE. No manual steps.

Written for commit a0849cf. Summary will update on new commits.

Three coherent changes from real-use feedback.

1. Yes-tap routing — opt-in spawn, in-place by default
   ─────────────────────────────────────────────────────────
   New `--spawn-topic` flag on agency-report. Default off → Yes/Edit
   dispatch in the same thread the card lives in. Set the flag for the
   /agency loop's half-hourly cards (so each cycle's cards live in their
   own threads) and any case where the work warrants a dedicated topic.

   Schema: new spawn_topic INTEGER NOT NULL DEFAULT 0 column on
   suggestions, populated via agency_db.insert(spawn_topic=...).
   ALTER TABLE migration in init_schema with duplicate-column swallow
   so re-runs are idempotent.

   Bot side: _handle_agency_callback reads sugg_row["spawn_topic"];
   spawn=1 → createForumTopic + dispatch in new thread (existing path);
   spawn=0 → dispatch in target_thread (the thread the card lives in).
   No auto-protection: agents inside an existing worker topic can still
   set --spawn-topic and fork yet another topic; honoring the flag
   without override is the design.

2. Persistent ✓ buttons (no more keyboard strip)
   ─────────────────────────────────────────────────────────
   Default kinds (action / dismiss / refine) used to strip the
   keyboard after a tap as a "final decision" signal. That made every
   answered card visually identical to a fresh one, so across a
   30-card /agency feed "did I answer this one?" was unreadable.

   Now: the keyboard stays. _agency_mark_picked grows a reset_others
   flag — for default kinds it strips ✓ from every other button before
   marking the tapped one (only the latest pick is highlighted, user
   can re-tap to change their mind). Custom buttons keep additive
   behavior (multi-tap stacks for "Send draft A" + "Send draft B").

   Drops the universal 🔥 setMessageReaction call introduced in the
   previous commit — the ✓ on the button itself is the at-a-glance
   marker.

3. Image is optional
   ─────────────────────────────────────────────────────────
   Updated docstring + the agency SKILL.md (in this repo? no — in
   ~/.claude/skills/agency/SKILL.md, local-only) to clarify: skip the
   image when the card is text-only. placehold.co labels longer than
   ~6 words shrink to unreadable on phone — render a real chart with
   matplotlib + --image-file or skip the image entirely.

Doc updates in agency-report's docstring cover the routing behavior
and image-is-optional rule for any future contributor reading the
file directly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@MagMueller MagMueller merged commit 9780ba6 into main May 7, 2026
6 checks passed
@MagMueller MagMueller deleted the agency-spawn-topic-flag branch May 7, 2026 21:35
MagMueller pushed a commit that referenced this pull request May 8, 2026
Magnus reviewed 5 candidate styles posted as cards in TG and picked
Style A — bold uppercase letters wrapped with framing arrows. The
trailing " ✓" suffix shipped in #104 was visible-but-subtle: easy to
miss at phone scale next to a button label that already leads with a
colorful icon. Style A makes the picked button visibly heavier than
its siblings regardless of icon shape.

Picked transformation:
  ✅ Yes        →  ▶ ✅ 𝗬𝗘𝗦 ◀
  ⏭ Skip       →  ▶ ⏭ 𝗦𝗞𝗜𝗣 ◀
  ✏️ Edit       →  ▶ ✏️ 𝗘𝗗𝗜𝗧 ◀
  Send draft A →  ▶ 𝗦𝗘𝗡𝗗 𝗗𝗥𝗔𝗙𝗧 𝗔 ◀

Bold uppercase uses Mathematical Sans-Serif Bold (U+1D5D4 onward).
Emojis, digits, and punctuation pass through unchanged.

Restoring the original label on un-pick uses the suggestion's
buttons_json from agency.db (lossless). When buttons_json isn't
available we fall back to lossy un-bold (case collapses to upper) —
acceptable for the default Yes/Skip/Edit set since "YES" is fine.

Module-level helpers added: _agency_bold_upper, _agency_unbold,
_agency_pick_label, _agency_is_picked, _agency_strip_legacy_marks,
_agency_unpick_label. Legacy "✓ " prefix (#103) and " ✓" suffix
(#104) marks are still recognized + cleaned up on the next tap so
in-flight cards from before this change tidy up automatically.

Default kinds (action/dismiss/refine) keep reset_others=True so only
the latest pick is highlighted. Custom kinds stay additive so
variant-picker patterns ("Send draft A" + "Send draft B") still
stack visibly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
MagMueller added a commit that referenced this pull request May 8, 2026
Magnus reviewed 5 candidate styles posted as cards in TG and picked
Style A — bold uppercase letters wrapped with framing arrows. The
trailing " ✓" suffix shipped in #104 was visible-but-subtle: easy to
miss at phone scale next to a button label that already leads with a
colorful icon. Style A makes the picked button visibly heavier than
its siblings regardless of icon shape.

Picked transformation:
  ✅ Yes        →  ▶ ✅ 𝗬𝗘𝗦 ◀
  ⏭ Skip       →  ▶ ⏭ 𝗦𝗞𝗜𝗣 ◀
  ✏️ Edit       →  ▶ ✏️ 𝗘𝗗𝗜𝗧 ◀
  Send draft A →  ▶ 𝗦𝗘𝗡𝗗 𝗗𝗥𝗔𝗙𝗧 𝗔 ◀

Bold uppercase uses Mathematical Sans-Serif Bold (U+1D5D4 onward).
Emojis, digits, and punctuation pass through unchanged.

Restoring the original label on un-pick uses the suggestion's
buttons_json from agency.db (lossless). When buttons_json isn't
available we fall back to lossy un-bold (case collapses to upper) —
acceptable for the default Yes/Skip/Edit set since "YES" is fine.

Module-level helpers added: _agency_bold_upper, _agency_unbold,
_agency_pick_label, _agency_is_picked, _agency_strip_legacy_marks,
_agency_unpick_label. Legacy "✓ " prefix (#103) and " ✓" suffix
(#104) marks are still recognized + cleaned up on the next tap so
in-flight cards from before this change tidy up automatically.

Default kinds (action/dismiss/refine) keep reset_others=True so only
the latest pick is highlighted. Custom kinds stay additive so
variant-picker patterns ("Send draft A" + "Send draft B") still
stack visibly.

Co-authored-by: bux <bux@browser-use.com>
Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant