Commit Graph

1763 Commits

Author SHA1 Message Date
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
Steve Yegge
cbb4641d26 bd sync: 2025-12-29 23:38:28 2025-12-29 23:38:38 -08:00
Steve Yegge
231d524103 bd sync: 2025-12-29 23:38:03 2025-12-29 23:38:38 -08:00
Steve Yegge
002a45ddd1 bd sync: 2025-12-29 23:38:00 2025-12-29 23:38:38 -08:00
Steve Yegge
2844edb541 Instrument gt commands to appear in activity feed (gt-7aw1m)
Phase 1 of activity feed improvements: gt commands now log events to
~/gt/.events.jsonl. This is the raw audit log that the feed daemon
(phase 2) will curate into the user-facing feed.

Instrumented commands:
- gt sling: logs sling events with bead and target
- gt hook: logs hook events with bead
- gt handoff: logs handoff events with subject
- gt done: logs done events with bead and branch
- gt mail send: logs mail events with to and subject

Event format follows the specification:
```json
{"ts":"2025-12-30T07:36:28Z","source":"gt","type":"mail",
 "actor":"gastown/crew/joe","payload":{...},"visibility":"feed"}
```

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:37:50 -08:00
Steve Yegge
fcea70efa1 bd sync: 2025-12-29 23:36:55 2025-12-29 23:36:55 -08:00
Steve Yegge
1bc7ae191a bd sync: 2025-12-29 23:34:59 2025-12-29 23:34:59 -08:00
Steve Yegge
5d3f500614 bd sync: 2025-12-29 23:34:50 2025-12-29 23:34:50 -08:00
Steve Yegge
17f993a041 bd sync: close gt-xd95b 2025-12-29 23:32:14 -08:00
Steve Yegge
0945428761 bd sync: 2025-12-29 23:32:02 2025-12-29 23:32:02 -08:00
Steve Yegge
91236ea268 feat: Add polecat workflow quality levels (basic/shiny/chrome)
Three pre-baked polecat workflows with increasing rigor:
- mol-polecat-basic: 3 steps, for trivial P4 fixes
- mol-polecat-shiny: 6 steps, standard quality with design/review
- mol-polecat-chrome: 16 steps, max rigor with strategic context reading,
  triple code review, and decomposed implementation phases

Added --quality (-q) flag to gt sling as shorthand:
  gt sling gt-abc gastown -q basic   # quick fix
  gt sling gt-abc gastown -q shiny   # standard
  gt sling gt-abc gastown -q chrome  # max rigor

Chrome explicitly requires reading ~/gt/docs/hop/CONTEXT.md and
~/gt/docs/PRIMING.md before design begins.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:19:32 -08:00
Steve Yegge
f99b98d94c bd sync: 2025-12-29 23:18:03 2025-12-29 23:18:03 -08:00
Steve Yegge
baa2ac08d4 bd sync: 2025-12-29 23:17:54 2025-12-29 23:17:54 -08:00
Steve Yegge
de7ad160e2 bd sync: 2025-12-29 23:17:36 2025-12-29 23:17:45 -08:00
Steve Yegge
9b59b8cc6b bd sync: 2025-12-29 23:17:08 2025-12-29 23:17:45 -08:00
Steve Yegge
540e51dc0f feat: add mol-polecat-chrome formula with parameterized context_docs (gt-c0fzm)
Adds a new workflow formula for polecat work that includes strategic
context reading before design. The context_docs variable allows
customization of which organizational documents to read.

Default: ~/gt/docs/hop/CONTEXT.md,~/gt/docs/PRIMING.md (Gas Town docs)
Override: gt sling formula --var context_docs="docs/ARCH.md,docs/STYLE.md"

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 23:17:29 -08:00
Steve Yegge
c6a48d34a5 bd sync: close code review gt-ddugk
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:48:17 -08:00
Steve Yegge
e2e25930c3 feat: Implement formula-on-bead mode in gt sling
When using `gt sling <formula> --on <bead>`, the command now properly
instantiates the formula as a molecule and bonds it to the target bead:

1. Cook the formula (ensures proto exists)
2. Create wisp with feature variable from bead title
3. Bond wisp to original bead (creates compound)
4. Hook the compound root (not bare bead) to target agent

This enables the "shiny" workflow (design→implement→review→test→submit)
to be applied to existing bugs/features, ensuring polecats complete all
phases including the code review step.

Example:
  gt sling shiny --on gt-abc gastown
  # Creates shiny molecule, bonds to gt-abc, slings compound to polecat

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:46:18 -08:00
Steve Yegge
a8401863a7 bd sync: 2025-12-29 22:28:41 2025-12-29 22:28:42 -08:00
Steve Yegge
3ce686f2ba bd sync: 2025-12-29 22:28:17 2025-12-29 22:28:20 -08:00
Steve Yegge
95831646ba Close merge request gt-powfg (already merged)
🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:14:24 -08:00
Steve Yegge
85ec39c487 fix: Add session health monitoring and auto-restart for crashed polecats (gt-i7wcn)
This fix addresses the issue where polecat sessions terminate unexpectedly
during work without recovery:

Changes:
- Add `checkPolecatSessionHealth()` to daemon heartbeat loop
  - Proactively validates tmux sessions are alive for polecats
  - Detects crashed polecats that have work-on-hook
  - Auto-restarts crashed polecats with proper environment setup
  - Notifies Witness if restart fails as fallback

- Add polecat support to lifecycle identity mapping
  - `identityToSession()` now handles polecat identities
  - `restartSession()` can restart crashed polecat sessions
  - `identityToStateFile()` handles polecat state files
  - `identityToAgentBeadID()` handles polecat agent beads
  - `identityToBDActor()` handles polecat BD_ACTOR conversion

- Add `gt session check` command for manual health checking
  - Validates tmux sessions exist for all polecats
  - Shows summary of healthy vs not-running sessions
  - Useful for debugging session issues

This provides faster recovery (within heartbeat interval) compared to
waiting for GUPP violation timeout (30 min) or Witness detection.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-29 22:13:24 -08:00
Steve Yegge
3d2918443e bd sync: 2025-12-29 22:13:09 2025-12-29 22:13:09 -08:00