Commit Graph

1785 Commits

Author SHA1 Message Date
Steve Yegge
e72882cdcb Add feed curator to daemon for activity feed curation (gt-38doh)
Implements the feed daemon goroutine that:
- Tails ~/gt/.events.jsonl for raw events
- Filters by visibility tag (keeps feed/both, drops audit)
- Deduplicates repeated done events from same actor
- Aggregates sling events when multiple occur in window
- Writes curated events to ~/gt/.feed.jsonl with summaries

The curator runs as a goroutine in the gt daemon, starting when
the daemon starts and stopping gracefully on shutdown.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 02:12:01 -08:00
Steve Yegge
8e96e12e37 Remove stats from .runtime/*.json observable state (gt-lfi2d)
Remove Stats fields from witness and refinery types that tracked
observable metrics (total counts, today counts). These are now
handled by the activity stream/beads system instead.

Removed:
- WitnessStats type and Stats field from Witness
- RefineryStats type and Stats field from Refinery
- LastCheckAt field from Witness
- Stats display from gt witness status
- Stats display from gt refinery status
- Stats increment code from refinery.completeMR()

Kept minimal process state:
- RigName, State, PID, StartedAt (both)
- MonitoredPolecats, Config, SpawnedIssues (witness)
- CurrentMR, PendingMRs, LastMergeAt (refinery)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 02:05:54 -08:00
Steve Yegge
04f0e46619 Add MQ summary to gt status output (gt-tvwnz)
Shows merge queue status under the Refinery section:
- pending: Open MRs ready to merge (no blockers)
- in-flight: MRs currently being processed
- blocked: MRs waiting on dependencies

Output appears as: MQ: 4 pending, 1 in-flight

Also adds MQ summary to JSON output in RigStatus.mq field.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 01:56:18 -08:00
Steve Yegge
1d4b27cf06 Wire witness patrol events to gt feed display
Add support for displaying gt events (from ~/gt/.events.jsonl) in the
gt feed TUI, including witness patrol activity:

- Add event symbols for patrol events (patrol_started, patrol_complete,
  polecat_checked, polecat_nudged, escalation_sent), merge events, and
  general gt events (sling, hook, handoff, mail, spawn, etc.)

- Create GtEventsSource that parses .events.jsonl format with proper
  extraction of rig/role from actor paths and human-readable message
  generation from event payloads

- Create CombinedSource that merges multiple event sources (bd activity
  and gt events) using fan-in pattern

- Update feed command to use combined source for TUI mode

- Add appropriate styling for new event types (nudges/escalations in
  red, patrol complete in green, etc.)

Example gt feed output now shows:
  09:45 ✓ witness: All polecats healthy
  09:44  witness: nudged nux (idle 10m)
  09:40 🎯 mayor: slung gt-rbncw to furiosa

(gt-rbncw)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 01:55:09 -08:00
Steve Yegge
4f9bf643bd feat: Wire MQ lifecycle events to gt feed display (gt-lak31)
- Add MQ event types and logging in mrqueue/events.go
- Have refinery emit merge_started, merged, merge_failed, merge_skipped events
- Create MQEventSource to read from mq_events.jsonl
- Add MultiSource to combine events from bd activity and MQ events
- Add color coding: green for merged, red for failed
- Update feed help with MQ event symbols

Events are stored in .beads/mq_events.jsonl and displayed in the feed TUI
with appropriate symbols and colors.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 01:45:04 -08:00
Steve Yegge
ff37dc3d60 bd sync: 2025-12-30 01:03:55 2025-12-30 01:03:55 -08:00
Steve Yegge
21158c4c12 bd sync: 2025-12-30 01:03:09 2025-12-30 01:03:09 -08:00
Steve Yegge
559ab84d49 bd sync: 2025-12-30 01:02:01 2025-12-30 01:02:23 -08:00
Steve Yegge
59f90f2bb2 bd sync: 2025-12-30 01:00:48 2025-12-30 01:02:23 -08:00
Steve Yegge
bf72f6c59a bd sync: 2025-12-30 00:49:28 2025-12-30 01:02:23 -08:00
Steve Yegge
44d783fca3 bd sync: 2025-12-30 00:48:24 2025-12-30 01:02:23 -08:00
Steve Yegge
a2d16b619a bd sync: 2025-12-30 00:46:35 2025-12-30 01:02:23 -08:00
Steve Yegge
c0832d000f bd sync: 2025-12-30 00:33:23 2025-12-30 01:02:23 -08:00
Steve Yegge
16076913ae fix: use rig-specific prefix for agent bead IDs (bd-otyh)
When spawning polecats in non-gastown rigs like beads, the agent bead ID
was incorrectly using the hardcoded "gt-" prefix instead of the rig's
configured prefix (e.g., "bd-" for beads).

Changes:
- Add GetPrefixForRig() in routes.go to look up prefix from routes.jsonl
- Update agentIDToBeadID() in sling.go to use rig's prefix via the new
  *WithPrefix functions instead of hardcoded "gt"
- Add unit tests for the new functionality

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 01:02:23 -08:00
Steve Yegge
3e64a4a630 bd sync: 2025-12-30 00:18:58 2025-12-30 01:02:23 -08:00
Steve Yegge
f9b554b683 bd sync: 2025-12-30 00:15:53 2025-12-30 01:02:23 -08:00
Steve Yegge
ebec23cfea bd sync: 2025-12-30 00:09:02 2025-12-30 01:02:23 -08:00
Steve Yegge
90bb64f7e4 bd sync: 2025-12-30 00:08:39 2025-12-30 01:02:23 -08:00
Steve Yegge
40d1e0c2a4 bd sync: 2025-12-29 23:58:14 2025-12-30 01:02:23 -08:00
Steve Yegge
910c6fc076 Remove stubbed ProcessMRFromQueue and mrqueue package (gt-u4fh)
The mrqueue package was aspirational 'beads-based MR automation' that was
never completed. The Refinery agent is prompt-driven and uses beads/mail
for coordination, not a Go-based polling queue.

Removed:
- internal/mrqueue/mrqueue.go (entire package)
- internal/cmd/mq_migrate.go (migration command for mrqueue)
- mrqueue submission from done.go and mq_submit.go
- Engineer.ProcessMRFromQueue() and related queue handlers
- Engineer.Run(), Stop(), processOnce() methods
- mrQueue field and stopCh from Engineer struct
- stopCh assertion from TestNewEngineer

Kept:
- Bead creation for merge-requests (audit record)
- Engineer struct and NewEngineer for potential future use
- Engineer.ProcessMR() (works with beads.Issue)
- Manager.ProcessMR() which is the working implementation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:59:29 -08:00
Steve Yegge
212d818305 fix: Capture stderr instead of suppressing in command execution
Several files were setting cmd.Stderr = nil, which hides potentially
critical error messages:

- prime.go: bd prime, gt mail check, and bd show commands now log
  stderr on failure for debugging
- orphans.go: git fsck now includes stderr in error messages
- patrol_helpers.go: bd list/show/catalog commands now log stderr

Daemon launch cases (up.go, daemon.go, daemon_check.go) correctly
use nil for I/O detachment but now have clarifying comments.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:52:02 -08:00
Steve Yegge
4e67f7e637 feat: Add convoy patrol steps to Deacon formula
Added three new patrol steps for convoy orchestration:
- check-convoy-completion: Watch for tracked issue closures, auto-close convoys
- resolve-external-deps: Propagate cross-rig dependency resolution
- fire-notifications: Notify Overseer/Witnesses of convoy and dep events

Updated health-scan to depend on fire-notifications (runs after convoy steps).

(gt-wthcc)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:50:24 -08:00
Steve Yegge
d8be33d13e fix: Witness cleanup uses gt polecat nuke for correct repo base
The witness template previously instructed using raw git commands:
- git worktree remove polecats/<name>
- git branch -d polecat/<name>

This failed because git worktree operations must run from the repo
that created the worktree (mayor/rig or .repo.git), not the rig root.

Now uses `gt polecat nuke` which handles repo base detection via
the repoBase() function and properly cleans up worktrees.

Fixes gt-gp6i

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:49:51 -08:00
Steve Yegge
a68cf54057 fix: Detect and auto-remove circular redirect files in beads (gt-csbjj)
Added multiple layers of protection against circular redirects:

1. ResolveBeadsDir now detects when a redirect points back to itself
   and auto-removes the errant redirect file with a warning

2. ensureBeadsRedirect now includes safety checks:
   - Prevents creating redirects inside mayor/rig/ (the canonical location)
   - Validates that the redirect target is not the same as the beads dir

3. Added test case for circular redirect detection

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:48:52 -08:00
Steve Yegge
de32cb0be2 Fix mail inbox detecting wrong identity from witness/refinery dirs
When GT_ROLE env var is not set, detectSender() now falls back to
cwd-based detection instead of immediately returning "overseer".
This allows running mail commands from witness/refinery directories
without GT_ROLE set (e.g., debugging sessions) and correctly detecting
the identity from the current working directory path.

(gt-od1g)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:43:20 -08:00
Steve Yegge
46868a5bab fix: Implement gt swarm dispatch command (gt-s94gq)
The dispatch command was documented in help text but never implemented.
Now it:
- Finds unassigned ready tasks in an epic
- Locates idle polecats (no hooked work)
- Slings the first available task to the first idle worker

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:35:21 -08:00
Steve Yegge
c47a7466d8 chore: Remove obsolete polecat formula files
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:19:12 -08:00
Steve Yegge
3aeaeaf845 feat: gt mol attach auto-detects agent from cwd when single arg provided
When called with 1 arg from an agent working directory, gt mol attach
now auto-detects the pinned bead ID from the current agent's hook.

Uses the same role detection infrastructure as gt mail and bd. (gt-t7ekm)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:19:12 -08:00
Steve Yegge
fdea399d6f docs: Add molecule navigation workflow documentation (gt-um6q)
- docs/molecules.md: Navigating Molecules section with bd mol current, bd close --continue
- docs/propulsion-principle.md: Molecule navigation as key enabler
- docs/polecat-wisp-architecture.md: Step execution examples with --continue workflow

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:14:10 -08:00
Steve Yegge
cf87569a14 fix: Connect gt done and mq submit to refinery mrqueue (gt-9mzd)
Root cause: gt done and mq submit created merge-request beads but did
not write to the .beads/mq/ directory that the refinery Engineer
polls for work.

Changes:
- done.go: Submit to mrqueue after creating MR bead
- mq_submit.go: Submit to mrqueue after creating MR bead
- mq_migrate.go: New command to migrate existing stale MR beads
- mrqueue.go: Follow beads redirects for shared queue location

The migration command allows recovery of existing stale MRs that were
never processed because they only existed as beads.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:09:45 -08:00
Steve Yegge
a31972f4ea fix: MCP beads tools work from polecat directories (gt-tnw)
Root cause: beads-mcp plugin's _find_beads_db_in_tree() didn't follow
.beads/redirect files. Fix implemented in beads repo (bd-7t9a).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 00:09:09 -08:00
Steve Yegge
efaa344d6f fix: Detect mayor role from any rig's mayor/ folder (gt-0nh8)
Previously gt prime only detected the Mayor role from town root (~/gt) or
~/gt/mayor/. Now it also detects Mayor from <rig>/mayor/ paths like
~/gt/gastown/mayor/rig, enabling mayor sessions to work correctly
regardless of which rig directory they're attached to.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:58:59 -08:00
Steve Yegge
c435058f98 fix: Use BeadsPath() for mq list to read from git-synced beads (gt-uhc3)
The mq list command was using r.Path (rig root) instead of r.BeadsPath()
which returns the mayor/rig clone path where beads are git-synced. This
caused the command to return empty results because it was looking at the
wrong .beads/ location.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:58:06 -08:00
Steve Yegge
fcbbdce1ed bd sync: 2025-12-29 23:57:16 2025-12-29 23:57:16 -08:00
Steve Yegge
ff98567569 bd sync: 2025-12-29 23:57:11 2025-12-29 23:57:14 -08:00
Steve Yegge
5626682b80 bd sync: 2025-12-29 23:49:17 2025-12-29 23:57:14 -08:00
Steve Yegge
c30884b36c bd sync: 2025-12-29 23:48:01 2025-12-29 23:57:14 -08:00
Steve Yegge
cd1d947a76 bd sync: 2025-12-29 23:47:49 2025-12-29 23:57:14 -08:00
Steve Yegge
1bf2b54773 Add witness activity events to gt feed (gt-nfdyl)
Implement activity event emission for witness patrol operations:
- patrol_started: When witness begins patrol cycle
- polecat_checked: When witness checks a polecat
- polecat_nudged: When witness nudges a stuck polecat
- escalation_sent: When witness escalates to Mayor/Deacon
- patrol_complete: When patrol cycle finishes

Also adds refinery merge queue events for future use:
- merge_started, merge_complete, merge_failed, queue_processed

New command: `gt activity emit <event-type>` allows agents to emit
events from CLI. Events write to ~/gt/.events.jsonl for gt feed.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:52:38 -08:00
Steve Yegge
65d4dbe222 Refinery emits activity events for MQ lifecycle (gt-ytsxp)
Add merge queue activity events to the refinery:
- merge_started: When refinery begins processing an MR
- merged: When MR successfully merged to main
- merge_failed: When merge fails (conflict, tests, push, etc.)
- merge_skipped: When MR skipped (superseded)

Events include MR ID, worker, branch, and reason (for failures).
Implemented in both Manager.ProcessMR and Engineer.ProcessMRFromQueue.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:48:25 -08:00
Steve Yegge
e362be3c41 fix: Use BeadsPath() for swarm status to read from git-synced beads (gt-1rxz5)
The swarm status was stale because bd commands were running from the rig
root path instead of the mayor/rig clone which has proper beads sync config.

Changes:
- Add Rig.BeadsPath() method to return mayor/rig path when available
- Update all bd commands in swarm.go to use BeadsPath()
- Update swarm manager to use separate beadsDir and gitDir paths
- beadsDir for bd commands (git-synced location)
- gitDir for git operations and mail (rig root)

This ensures swarm status reflects the latest beads data from the
git-synced beads-sync branch instead of stale local daemon data.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:46:59 -08:00
Steve Yegge
deb58838ad fix: Use SQLite columns for hook_bead instead of description text (gt-9v52)
Previously, UpdateAgentState embedded hook_bead in the description
text field, while bd slot commands read/write from the SQLite
hook_bead column. This caused gt sling to report hooks as occupied
when bd slot show showed them empty.

Fix: Change UpdateAgentState to use proper bd commands:
- `bd agent state` for agent_state (updates column directly)
- `bd slot set/clear` for hook_bead (updates column directly)

This ensures consistency between gastown and beads commands.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:46:10 -08:00
Steve Yegge
2fb616b0b7 feat: Add callbacks command for handling agent messages (gt-eph-5c8)
Implements `gt callbacks process` for Mayor/Deacon patrol to handle
callbacks from agents:

- POLECAT_DONE: Log polecat completion
- MERGE_COMPLETED: Close source issue, log merge
- MERGE_REJECTED: Log rejection reason
- HELP/ESCALATION: Forward to overseer
- SLING_REQUEST: Log sling request for spawn
- WITNESS_REPORT: Log rig health status
- REFINERY_REPORT: Log queue status

Also adds EventCallback to townlog for callback processing events.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:45:35 -08:00
Steve Yegge
070a8be738 bd sync: 2025-12-29 23:45:09 2025-12-29 23:45:09 -08:00
Steve Yegge
a582114415 bd sync: 2025-12-29 23:44:23 2025-12-29 23:44:23 -08:00
Steve Yegge
73112e29e4 bd sync: 2025-12-29 23:47 2025-12-29 23:44:00 -08:00
Steve Yegge
411d35a53a bd sync: 2025-12-29 23:43:52 2025-12-29 23:44:00 -08:00
Steve Yegge
9febd4e7dc bd sync: 2025-12-29 23:43:39 2025-12-29 23:44:00 -08:00
Steve Yegge
f9e820985d feat: Filter agent session molecule noise from activity feed
Agent session molecules (gt-gastown-crew-joe, gt-gastown-witness, etc.)
update frequently for status tracking, creating noisy entries in the
activity feed. This change:

- Adds IsAgentSessionBead() to identify agent session beads
- Filters out "update" events for agent sessions from the event feed
- Still updates the agent tree so status is visible there
- Still shows create/complete/fail/delete events for agents

The filtering happens in addEvent() in the TUI feed model. Agent session
updates are identified by parsing the bead ID pattern and checking for
known agent roles (mayor, deacon, witness, refinery, crew, polecat).

Resolves: gt-sb6m4

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:42:57 -08:00
Steve Yegge
e1fed7f72e bd sync: 2025-12-29 23:41:49 2025-12-29 23:41:49 -08:00