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
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.
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_progresswith 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)
gt_sling/gt_sling_batchgt_list_beads/gt_list_agents/gt_list_convoys/gt_convoy_statusgt_mail_sendWhat the Mayor CANNOT do
Dashboard UI gaps
HTTP API gaps
PATCH /beads/:id/statusexists but requiresagent_idin the body (agent-scoped auth) � not usable by humans or the MayorSolution
New Mayor tools
gt_bead_updategt_bead_reassigngt_agent_resetidle, unhook from any bead, optionally stop the container process.gt_convoy_closegt_convoy_updategt_bead_deletegt_escalation_acknowledgeNew/updated HTTP API endpoints
/api/towns/:townId/rigs/:rigId/beads/:beadIdPATCH/api/towns/:townId/rigs/:rigId/agents/:agentId/statusPATCH/api/towns/:townId/rigs/:rigId/agents/:agentId/hookDELETEDashboard UI additions
Mayor prompt update
Add a section to the Mayor system prompt explaining its edit capabilities:
Acceptance Criteria
gt_bead_updatetool for editing bead status and fieldsgt_bead_reassigntool for moving beads between agentsgt_agent_resettool for force-resetting agents to idlegt_convoy_closetool for force-closing convoysgt_bead_deletetool for deleting beadsgt_escalation_acknowledgetool for acknowledging escalationsPATCH /beads/:beadIdendpoint supports editing title, body, priority, labels, status � accessible with user auth (not just agent auth)PATCH /agents/:agentId/statusendpoint for direct status changesNotes
bead_eventsentries so the activity feed shows what was changed, by whom, and when. This is especially important for manual status overrides.gt_bead_updatetool should accept partial updates � the Mayor shouldn't have to specify every field just to change the priority.gt_bead_updatefor their own hooked bead (e.g., updating the title to reflect what they actually built). This is a stretch goal, not a requirement.