Skip to content

feat: Create Bead UI with AI enrichment and mayor notification #2771

@jrf0110

Description

@jrf0110

Summary

Users currently create beads exclusively by talking to the mayor, who calls gt_sling or gt_sling_batch on their behalf. There is no direct UI surface for a user to create a bead themselves — and the old "Sling Work" button (which opened a simple title/body dialog) is likely broken or vestigial at this point.

This feature gives users a first-class UI surface for creating beads directly, while keeping the mayor in the loop to help plan and enrich the work.

Proposed Experience

  1. "New Bead" button/drawer — a clean right-side panel with a full MDXEditor markdown editor, replacing or supplementing the old Sling Work button
  2. Workers AI enrichment — as the user types, a debounced call to a Workers AI endpoint auto-suggests a title and labels based on the content. Suggestions appear as ghost text / clickable chips; the user can accept, modify, or ignore them
  3. "Start immediately" checkbox (default: unchecked) — when unchecked, the bead is created as open without dispatching a polecat. When checked, the bead is dispatched immediately
  4. Mayor notification — when a bead is created without "start immediately", the mayor is automatically notified: "I notice you just created a new bead titled 'X'. Would you like me to explore the codebase and flesh out a plan, or decompose it into a convoy?"
  5. Mayor response in bead drawer — the mayor's reply surfaces as a conversation thread inside the bead detail drawer (via a message bead with parent_bead_id)

Implementation Plan

Bead 1 — Backend: createBead tRPC + Workers AI enrichment endpoint

  • New createBead tRPC procedure that creates an open bead without dispatching
  • New enrichBead tRPC procedure backed by Workers AI (AI binding already configured) — accepts markdown body, returns suggested { title, labels }
  • notifyMayorOfNewBead(beadId, rigId, title, body) on the Town DO — calls sendMayorMessage() with bead context

Bead 2 — UI: CreateBeadDrawer with MDXEditor

  • New CreateBeadDrawer.tsx — right-side panel (620px, matches existing drawer pattern)
  • MarkdownEditor.tsx — thin MDXEditor wrapper (https://mdxeditor.dev/editor/docs/getting-started), dynamically imported for SSR
  • AI enrichment: debounced 1.5s, updates title/labels fields as ghost suggestions
  • "Start immediately" checkbox with hint text when unchecked
  • Replaces (or fixes) the existing Sling Work entrypoint on the rig detail page

Bead 3 — UI: Held bead treatment + mayor response surface

  • Visual distinction for open/unassigned user-created beads ("Waiting" state)
  • "Start now" quick action in bead detail drawer
  • Mayor response rendered as conversation thread in bead drawer (child message beads with parent_bead_id)

Bead 4 — Mayor system prompt update

  • Handle new bead notification gracefully: acknowledge, offer planning options (flesh out body, create staged convoy, start immediately)
  • Mayor replies via message bead with parent_bead_id so it surfaces in the drawer
  • Keep responses concise (3-5 sentences)

Design Decisions

  • Workers AI model: @cf/meta/llama-3.1-8b-instruct (fast, cheap, good enough for title/label suggestions)
  • AI enrichment is purely suggestive — never auto-applies without user interaction
  • No new bead status needed — held beads are just open with no assignee
  • Mayor response surface: message bead with parent_bead_id rendered in the bead drawer

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions