Skip to content

Mayor edit capabilities + manual bead/agent/convoy editing #996

@jrf0110

Description

@jrf0110

Parent

Part of #204 (Phase 4: Hardening)

Problem

The Mayor can create work and read state, but cannot edit, close, fail, reassign, or delete anything. Users have no UI for manually fixing wonky state (stuck beads, stale hooks, wrong priorities). When things go wrong � a bead is stuck in in_progress with a dead agent, a convoy has the wrong merge mode, a polecat is hooked to the wrong bead � the only options are deleting and recreating, or hitting the HTTP API directly with curl.

Current State

Mayor tools (read/create only)

Tool Capability
gt_sling / gt_sling_batch Create beads, convoys
gt_list_beads / gt_list_agents / gt_list_convoys / gt_convoy_status Read state
gt_mail_send Send mail

What the Mayor CANNOT do

  • Edit bead status (open/in_progress/closed/failed)
  • Edit bead fields (title, body, priority, labels)
  • Reassign a bead to a different agent
  • Unhook an agent from a bead
  • Force-reset an agent to idle
  • Close or fail a convoy
  • Delete beads, agents, or convoys
  • Acknowledge or resolve escalations

Dashboard UI gaps

  • No bead status change control (can only delete)
  • No bead field editing (title, body, priority, labels)
  • No agent status editing
  • No agent unhook button
  • No convoy metadata editing (merge_mode, feature_branch)

HTTP API gaps

  • PATCH /beads/:id/status exists but requires agent_id in the body (agent-scoped auth) â�� not usable by humans or the Mayor
  • No endpoint for editing bead fields (title, body, priority, labels, metadata)
  • No endpoint for setting agent status directly
  • No endpoint for editing convoy metadata

Solution

New Mayor tools

Tool What it does
gt_bead_update Edit bead status, title, body, priority, labels. Accepts any combination of fields.
gt_bead_reassign Unhook current agent, hook a different agent (or create a new polecat and hook it).
gt_agent_reset Force-reset an agent to idle, unhook from any bead, optionally stop the container process.
gt_convoy_close Force-close a convoy (and optionally its tracked beads).
gt_convoy_update Edit convoy metadata (merge_mode, feature_branch).
gt_bead_delete Delete a bead.
gt_escalation_acknowledge Acknowledge an escalation.

New/updated HTTP API endpoints

Endpoint Method Purpose
/api/towns/:townId/rigs/:rigId/beads/:beadId PATCH Edit bead fields (title, body, priority, labels, status, metadata). User-auth or admin-auth, not agent-scoped.
/api/towns/:townId/rigs/:rigId/agents/:agentId/status PATCH Set agent status directly. Admin/Mayor only.
/api/towns/:townId/rigs/:rigId/agents/:agentId/hook DELETE Already exists � ensure it's accessible from the Mayor tool and dashboard UI.

Dashboard UI additions

  • Bead detail drawer: status dropdown, editable title/body/priority fields, "Reassign" button, "Unhook Agent" button
  • Agent card: "Reset to Idle" button, "Unhook" button
  • Convoy detail: "Force Close" button (already exists), editable merge_mode dropdown

Mayor prompt update

Add a section to the Mayor system prompt explaining its edit capabilities:

## Surgical Editing

You can directly edit town state when things go wrong:
- gt_bead_update to change bead status, title, body, or priority
- gt_bead_reassign to move a bead to a different agent  
- gt_agent_reset to force-reset a stuck agent to idle
- gt_convoy_close to force-close a stuck convoy
- gt_bead_delete to remove beads that shouldn't exist

Use these tools when the user reports stuck state, when you detect problems
during delegation, or when you need to clean up after failures. You are the
town coordinator � you have full authority over the control plane.

Acceptance Criteria

  • Mayor has gt_bead_update tool for editing bead status and fields
  • Mayor has gt_bead_reassign tool for moving beads between agents
  • Mayor has gt_agent_reset tool for force-resetting agents to idle
  • Mayor has gt_convoy_close tool for force-closing convoys
  • Mayor has gt_bead_delete tool for deleting beads
  • Mayor has gt_escalation_acknowledge tool for acknowledging escalations
  • PATCH /beads/:beadId endpoint supports editing title, body, priority, labels, status â�� accessible with user auth (not just agent auth)
  • PATCH /agents/:agentId/status endpoint for direct status changes
  • Dashboard bead detail drawer has status dropdown and editable fields
  • Dashboard agent card has "Reset to Idle" and "Unhook" buttons
  • Mayor system prompt documents the new editing capabilities
  • All edit operations log bead events for auditability

Notes

  • No data migration needed â�� cloud Gastown hasn't deployed to production
  • The Mayor should have the same edit authority as a Kilo admin. It's the town coordinator â�� restricting its ability to fix state defeats the purpose of having a coordinator.
  • All edits should produce bead_events entries so the activity feed shows what was changed, by whom, and when. This is especially important for manual status overrides.
  • The gt_bead_update tool should accept partial updates â�� the Mayor shouldn't have to specify every field just to change the priority.
  • Consider whether polecats should also get gt_bead_update for their own hooked bead (e.g., updating the title to reflect what they actually built). This is a stretch goal, not a requirement.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestkilo-auto-fixAuto-generated label by Kilokilo-triagedAuto-generated label by Kilo

    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