Commit Graph

3046 Commits

Author SHA1 Message Date
diesel
8b2dc39e88 fix(handoff): prevent race condition when killing pane processes
KillPaneProcesses was killing ALL processes in the pane, including the
gt handoff process itself. This created a race condition where the
process could be killed before RespawnPane executes, causing the pane
to close prematurely and requiring manual reattach.

Added KillPaneProcessesExcluding() function that excludes specified PIDs
from being killed. The handoff command now passes its own PID to avoid
the race condition.

Fixes: gt-85qd

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
furiosa
fa9087c5d7 fix(molecules): cascade-close child wisps on molecule completion (gt-zbnr)
When deacon patrol molecules completed, their child step wisps were not being
closed automatically. This caused orphan wisp accumulation - 143+ orphaned
wisps were found in one cleanup session.

The fix ensures that when a molecule completes (via gt done or gt mol step done),
all descendant step issues are recursively closed before the molecule itself.

Changes:
- done.go: Added closeDescendants() call in updateAgentStateOnDone before
  closing the attached molecule
- molecule_step.go: Added closeDescendants() call in handleMoleculeComplete
  for all roles (not just polecats)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
kerosene
cce261c97b feat(deacon): make patrol loop explicit and continuous
The Deacon patrol formula now clearly documents the continuous loop:
1. Execute patrol steps (inbox-check through context-check)
2. Squash wisp, wait for activity via await-signal (15min max)
3. Create new patrol wisp and hook it
4. Repeat from step 1

Changes:
- Formula description emphasizes CONTINUOUS EXECUTION with flow diagram
- loop-or-exit step renamed to "Continuous patrol loop" with explicit
  instructions for creating/hooking new wisps after await-signal
- plugin-run step now clearly shows gt plugin list + gt dog dispatch
- Deacon role template updated to match formula changes
- Formula version bumped to 9

Fixes gt-fm2c: Deacon needs continuous patrol loop for plugin dispatch

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
diesel
0d065921b6 fix(goals): query epics from all rigs, not just default
gt goals was only querying the default beads location (town-level
with hq- prefix), missing epics from rig-level beads (j-, sc-, etc.).

Now iterates over all rig directories with .beads/ subdirectories
and aggregates epics, deduplicating by ID.
2026-01-25 11:15:29 -08:00
diesel
13303d4e83 fix(goals): filter out wisp molecules from gt goals output
Wisp molecules (gt-wisp-* IDs, mol-* titles) are transient operational
beads for witness/refinery/polecat patrol, not strategic goals that
need human attention. These are now filtered by default.

Add --include-wisp flag to show them when debugging.

Fixes gt-ysmj

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
gastown/crew/kerosene
a19452eb60 feat: add bd tree to Key Commands in gt prime output
- Add `bd tree <id>` to Key Commands in bd prime template (beads.go)
- Add `bd tree <issue>` to prime_output.go for mayor/polecat/crew roles
- Helps agents understand bead ancestry, siblings, and dependencies

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
gastown/crew/octane
9a53d85c43 feat(convoy): add epic filtering flags to convoy list
Add three new flags for filtering convoys by epic relationship:
- --orphans: show only convoys without a parent epic
- --epic <id>: show only convoys under a specific epic
- --by-epic: group convoys by parent epic

These support the Goals Layer feature (Phase 3) for hierarchical
focus management.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
nux
873d6e2c1a feat(goals): implement goals list with staleness computation
Implements gt goals command to show epics sorted by staleness × priority.

Features:
- List all open epics with staleness indicators (🟢/🟡/🔴)
- Sort by attention score (priority × staleness hours)
- Show specific goal details with description and linked convoys
- JSON output support
- Priority and status filtering

Staleness thresholds:
- 🟢 active: moved in last hour
- 🟡 stale: no movement for 1+ hours
- 🔴 stuck: no movement for 4+ hours

Closes: gt-vix

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
furiosa
c863e9ac65 feat(cmd): add gt goals command skeleton
Create goals.go with basic command structure for viewing strategic
goals (epics) with staleness indicators. Includes --json, --status,
and --priority flags. Implementation stubs return not-yet-implemented
errors.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
rictus
b37d8ecc79 feat(mayor): add delegation hierarchy guidance to role template
Add explicit guidance on the Mayor → Crew → Polecats delegation model:
- Crew are coordinators for epics/goals needing decomposition
- Polecats are executors for well-defined tasks
- Include decision framework table for work type routing

Closes: gt-9jd
2026-01-25 11:15:29 -08:00
kerosene
77e4f82494 feat: add overseer experience commands (gt focus, gt attention)
Implements the Overseer Experience epic (gt-k0kn):

- gt focus: Shows stalest high-priority goals, sorted by priority × staleness
- gt attention: Shows blocked items, PRs awaiting review, stuck workers
- gt status: Now includes GOALS and ATTENTION summary sections
- gt convoy list: Added --orphans, --epic, --by-epic flags

These commands reduce Mayor bottleneck by giving the overseer direct
visibility into system state without needing to ask Mayor.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
rictus
3e4cb71c89 feat(mayor): add delegation hierarchy guidance to role template
Add explicit guidance on the Mayor → Crew → Polecats delegation model:
- Crew are coordinators for epics/goals needing decomposition
- Polecats are executors for well-defined tasks
- Include decision framework table for work type routing

Closes: gt-9jd
2026-01-25 11:15:29 -08:00
slit
1eee064efa docs(crew): add coordinator role guidance to crew template
Adds clear guidance that crew members are coordinators, not implementers:
- Lists 4 key responsibilities: Research, Decompose, Sling, Review
- Clarifies "goal-specific mayor" model - own outcomes via delegation
- Documents when to implement directly vs delegate (trivial fixes, spikes, etc.)

Closes: gt-gig

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
nux
8b7a5e6f91 feat(sling): implement --convoy flag logic (gt-9o4)
Add --convoy flag to gt sling that allows adding an issue to an existing
convoy instead of creating a new one. When specified:
- Validates the convoy exists and is open
- Adds tracking relation between convoy and issue
- Skips auto-convoy creation

Changes:
- Add slingConvoy variable and --convoy flag registration
- Add addToExistingConvoy() helper function in sling_convoy.go
- Modify auto-convoy logic to check slingConvoy first

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
furiosa
37ac676232 feat(sling): register --epic and --convoy flags
Add flag variable declarations and Cobra flag registrations for:
- --epic: link auto-created convoy to parent epic
- --convoy: add to existing convoy instead of creating new

Closes: gt-n3o

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
0be6a39bb7 fix: enforce fresh context between molecule steps
Change molecule step completion instructions to use `gt mol step done`
instead of `bd close`. This ensures polecats get fresh context between
each step, which is critical for multi-step review workflows like
shiny-enterprise where each refinement pass should have unbiased attention.

The `gt mol step done` command already:
1. Closes the step
2. Finds the next ready step
3. Respawns the pane for fresh context

But polecats were being instructed to use `bd close` directly, which
skipped the respawn and let them run through entire workflows in a
single session with accumulated context.

Updated:
- prime_molecule.go: step completion instructions
- mol-polecat-work.formula.toml
- mol-polecat-code-review.formula.toml
- mol-polecat-review-pr.formula.toml

Fixes: hq-0kx7ra
2026-01-25 11:15:29 -08:00
riker
c3fb9c6027 fix(dog): properly set identity for dog sessions
Three fixes to make dog dispatch work end-to-end:

1. Add BuildDogStartupCommand in loader.go
   - Similar to BuildPolecatStartupCommand/BuildCrewStartupCommand
   - Passes AgentName to AgentEnv so BD_ACTOR is exported in startup command

2. Use BuildDogStartupCommand in dog.go
   - Removes ineffective SetEnvironment calls (env vars set after shell starts
     don't propagate to already-running processes)

3. Add "dog" case in mail_identity.go detectSenderFromRole
   - Dogs now use BD_ACTOR for mail identity
   - Without this, dogs fell through to "overseer" and couldn't find their mail

Tested: dog alpha now correctly sees inbox as deacon/dogs/alpha

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
riker
2590e3de3b fix(dog): spawn session and set BD_ACTOR for dog dispatch
Recovered from reflog - these commits were lost during a rebase/force-push.

Dogs are directories with state files but no sessions. When `gt dog dispatch`
assigned work and sent mail, nothing executed because no session existed.

Changes:
1. Spawn tmux session after dispatch (gt-<town>-deacon-<dogname>)
2. Set BD_ACTOR=deacon/dogs/<name> so dogs can find their mail
3. Add dog case to AgentEnv for proper identity

Session spawn is non-blocking - if it fails, mail was sent and human can
manually start the session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
ec9a07cec1 feat(dog): add 'gt dog done' command for dogs to mark themselves idle
Dogs can now reset their own state to idle after completing work:

  gt dog done        # Auto-detect from BD_ACTOR
  gt dog done alpha  # Explicit name

This solves the issue where dog sessions would complete work but remain in
"working" state because nothing processed the DOG_DONE mail. Now dogs can
explicitly mark themselves idle before handing off.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
1c8d0891e1 fix(session): increase ClaudeStartTimeout from 60s to 120s
Fixes intermittent 'timeout waiting for runtime prompt' errors that occur
when Claude takes longer than 60s to start under load or on slower machines.

Resolves: hq-j2wl

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 11:15:29 -08:00
eed6284e3c feat(security): add GIT_AUTHOR_EMAIL per agent type
Phase 1 of agent security model: Set distinct email addresses for each
agent type to improve audit trail clarity.

Email format:
- Town-level: {role}@gastown.local (mayor, deacon, boot)
- Rig-level: {rig}-{role}@gastown.local (witness, refinery)
- Named agents: {rig}-{role}-{name}@gastown.local (polecat, crew)

This makes git log filtering by agent type trivial and provides a
foundation for per-agent key separation in future phases.

Refs: hq-biot
2026-01-25 11:15:29 -08:00
35dbe8ee24 ci: disable block-internal-prs for fork workflow
We use PRs for human review before merging in our fork.
2026-01-25 11:15:29 -08:00
ad6322b414 feat(mayor): add escalation check to startup protocol
Mayor now checks `gt escalate list` between hook and mail checks at startup.
This ensures pending escalations from other agents are handled promptly.

Other roles (witness, refinery, polecat, crew, deacon) are unaffected -
they create escalations but don't handle them at startup.
2026-01-25 11:15:29 -08:00
mayor
2f0f0763cc fix(build): use GT_ROOT for build error path hint
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:23:52 -08:00
mayor
b1e8b11948 fix(build): error on raw go build, require make build
Raw `go build` produces unsigned binaries that macOS kills. Add a
BuiltProperly ldflag that make build sets, and check it at startup.
If missing, print an error directing users to use make build.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:23:07 -08:00
mayor
36c7222d5b fix(handoff): preserve tmux session by setting remain-on-exit before kill
When gt handoff killed pane processes before respawning, the pane would
be destroyed (since remain-on-exit defaults to off), causing respawn-pane
to fail with "can't find pane" error.

Fix: Set remain-on-exit=on before killing processes, so the pane survives
process death and can be respawned. This restores tmux session reuse on
handoffs.

Changes:
- Add SetRemainOnExit method to tmux package
- Call SetRemainOnExit(true) before KillPaneProcesses in:
  - Local handoff (runHandoff)
  - Remote handoff (handoffRemoteSession)
  - Mayor attach respawn (runMayorAttach)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:17:42 -08:00
Kody Wildfeuer
baf9311bfe feat(theme): add dark mode CLI theme support (#911)
Add the ability to force dark or light mode colors for CLI output,
overriding the automatic terminal background detection.

Changes:
- Add CLITheme field to TownSettings for persisting preference
- Add GetThemeMode() and HasDarkBackground() to ui package for
  theme detection with GT_THEME env var override
- Add ApplyThemeMode() to explicitly set lipgloss dark background
- Add 'gt theme cli' subcommand to view/set CLI theme preference
- Initialize theme in CLI startup (persistentPreRun)
- Add comprehensive tests for theme mode functionality

Usage:
- gt theme cli              # show current theme
- gt theme cli dark         # force dark mode
- gt theme cli light        # force light mode
- gt theme cli auto         # auto-detect (default)
- GT_THEME=dark gt status   # per-command override

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 22:15:48 -08:00
Clay Cantrell
377b4877cd Fix convoy check to query external rig databases for cross-rig tracking (#916)
Fixes #915

`gt convoy check` was failing to detect closed beads in external rig databases,
causing convoys to remain perpetually open despite tracked work being completed.

Changes:
- Modified getTrackedIssues() to parse external:rig:id format and track rig ownership
- Added getExternalIssueDetails() to query external rig databases by running bd show
  from the rig directory
- Changed from issueIDs []string to issueRefs []issueRef struct to track both ID and
  rig name for each dependency

The fix enables proper cross-rig convoy completion by querying the appropriate database
(town or rig) for each tracked bead's status.

Testing: Verified that convoy hq-cv-u7k7w tracking external:claycantrell:cl-niwe now
correctly detects the closed status and auto-closes the convoy.
2026-01-24 21:49:16 -08:00
Mad Dan
9dcddaf13d feat(polecat): add explicit lint/test step to decommission checklist (#934)
- Add quality gates (lint, format, tests) as step 1 before committing
- Support both npm and Go project types
- Add explicit warning: "DO NOT commit if lint or tests fail"
- Explain why manual checks are needed (worktrees may not trigger hooks)

Fixes hq-lint1

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:48:38 -08:00
aleiby
db60489d0f fix(mail): handle crew/polecat ambiguity in notification session lookup (#914)
When sending mail notifications, the canonical address format (rig/name)
doesn't distinguish between crew workers (session: gt-rig-crew-name) and
polecats (session: gt-rig-name). This caused notifications to fail for
crew workers in other rigs.

Solution: Try both possible session IDs when the address is ambiguous,
using the first one that has an active session.

Supersedes PR #896 which only handled slash-to-dash conversion.

Fixes: gt-h5btjg
2026-01-24 21:48:16 -08:00
Christian Sieber
63d60f1dcd fix(namepool): display correct theme from config.json (#890)
The 'gt namepool' command was showing 'mad-max' for all rigs because
it created the pool with defaults instead of loading config. This made
it impossible to see if a rig had custom theme settings.

Load config before creating the pool, matching the logic in manager.go
that actually spawns polecats. Theme and CustomNames come from
settings/config.json, not from the state file.

Co-authored-by: Claude <noreply@anthropic.com>
2026-01-24 21:48:12 -08:00
Artem Bambalov
533caf8e4b Detect and clean stale POLECAT_DONE messages (#913)
* fix(witness): detect and ignore stale POLECAT_DONE messages

Add timestamp validation to prevent witness from nuking newly spawned
polecat sessions when processing stale POLECAT_DONE messages from
previous sessions.

- Add isStalePolecatDone() to compare message timestamp vs session created time
- If message timestamp < session created time, message is stale and ignored
- Add unit tests for timestamp parsing and stale detection logic

Fixes #909

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* feat(mail): add --stale flag to gt mail archive

Add ability to archive stale messages (sent before current session started).
This prevents old messages from cycling forever in patrol inbox.

Changes:
- Add --stale and --dry-run flags to gt mail archive
- Move stale detection helpers to internal/session/stale.go for reuse
- Add ParseAddress to parse mail addresses into AgentIdentity
- Add SessionCreatedAt to get tmux session start time

Usage:
  gt mail archive --stale           # Archive all stale messages
  gt mail archive --stale --dry-run # Preview what would be archived

Co-Authored-By: GPT-5.2 Codex <noreply@openai.com>

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: GPT-5.2 Codex <noreply@openai.com>
2026-01-24 21:47:59 -08:00
Dale Navi
f635555f93 fix(hook): complete convoy hooking implementation (#897)
Two issues fixed:
1. gt hook <convoy-id> now runs bd update from town root, ensuring
   proper prefix-based routing for convoys (hq-*) in town beads.

2. gt hook show now also searches town beads for hooked items,
   allowing agents to find hooked convoys regardless of their
   current workspace location.

This enables the convoy-driver workflow where any agent can hook
a convoy and have it displayed via gt hook show.

Fixes: hq-y845
2026-01-24 21:47:14 -08:00
Christian Sieber
5bb74b19ed Revert erroneous addition of .beads to agent .gitignore template (#891)
Gas town agents need to ignore working-file directories like .logs,
.runtime, and .claude, but Beads provides its own .gitignore handling
in `bd init`, creating a .beads/.gitignore file which ignores the
relevant Beads working files while allowing .beads/issues.jsonl
to be tracked correctly. PR #753 broke this, causing new polecats
to attempt to merge their changed .gitignore into the project repo,
ultimately breaking bd sync and causing issues to become untracked.
2026-01-24 21:47:09 -08:00
aleiby
9db9fc2af8 fix(doctor): implement Fix for misclassified-wisps check (#878)
The misclassified-wisps check could detect issues that should be wisps
but couldn't fix them because bd update lacked an --ephemeral flag.

Now that beads supports `bd update <id> --ephemeral` (steveyegge/beads#1263),
implement the actual fix to mark detected issues as ephemeral.

Closes #852

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:47:04 -08:00
Julian Knutsen
3da0d5a7c8 fix(molecule): use Dependencies from bd show instead of empty DependsOn (#901)
* fix(molecule): use Dependencies from bd show instead of empty DependsOn

Bug: Molecule step dependency checking was broken because bd list
doesn't populate the DependsOn field (it's always empty). Only bd show
returns dependency info in the Dependencies field.

This caused all open steps to appear "ready" regardless of actual
dependencies - the polecat would start blocked steps prematurely.

Fix: Call ShowMultiple() after List() to fetch full issue details
including Dependencies, then check Dependencies instead of DependsOn.

Affected functions:
- findNextReadyStep() in molecule_step.go
- getMoleculeProgressInfo() in molecule_status.go
- runMoleculeCurrent() in molecule_status.go

Tests:
- Added TestFindNextReadyStepWithBdListBehavior to verify fix
- Added TestOldBuggyBehavior to demonstrate the bug
- Updated existing tests to use fixed algorithm

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* fix(molecule): use Dependencies from bd show instead of empty DependsOn

Bug: Molecule step dependency checking was broken because bd list
doesn't populate the DependsOn field (it's always empty). Only bd show
returns dependency info in the Dependencies field.

This caused all open steps to appear "ready" regardless of actual
dependencies - the polecat would start blocked steps prematurely.

Fix: Call ShowMultiple() after List() to fetch full issue details
including Dependencies, then check Dependencies instead of DependsOn.
Also filter to only check "blocks" type dependencies - ignore "parent-child"
relationships which are just structural, not blocking.

Affected functions:
- findNextReadyStep() in molecule_step.go
- getMoleculeProgressInfo() in molecule_status.go
- runMoleculeCurrent() in molecule_status.go

Tests:
- Added TestFindNextReadyStepWithBdListBehavior to verify fix
- Added TestOldBuggyBehavior to demonstrate the bug
- Updated existing tests to use fixed algorithm

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

---------

Co-authored-by: julianknutsen <julianknutsen@users.noreply.github>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:46:27 -08:00
aleiby
4e4824a6c6 fix(mail): validate recipient exists before sending (#886)
Add validateRecipient() to check that mail recipients correspond to
existing agents before sending. This prevents mail from being stored
with invalid assignees that won't match inbox queries.

The validation queries agent beads and checks if any match the
recipient identity. The only special case is "overseer" which is the
human operator and doesn't have an agent bead.

Tests create a temporary isolated beads database with test agents
to validate both success and failure cases. Tests are skipped if
bd CLI is not available (e.g., in CI).

Fixes gt-0y8qa

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:46:09 -08:00
Julian Knutsen
2fb787c7a2 fix(rig): remove route from routes.jsonl on rig remove (#910)
When a rig is removed with `gt rig remove`, the route entry in
routes.jsonl was not being cleaned up. This caused problems when
re-adding the rig with a different prefix, resulting in duplicate
entries and prefix mismatch errors.

The fix calls beads.RemoveRoute() during rig removal to clean up
the route entry from routes.jsonl.

Fixes #899

Co-authored-by: dementus <julianknutsen@users.noreply.github>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:46:05 -08:00
Basit Mustafa
70ca511ee2 fix: remove conflicting required+default in mol-session-gc formula (#919)
vars.mode had both required=true and default="conservative", which
causes formula validation to fail with:

  vars.mode: cannot have both required:true and default

This prevented gt doctor from dispatching cleanup work to dogs.

Remove required=true since the default value ensures the variable
is always populated.

Co-authored-by: mayor <ec2-user@ip-172-31-43-79.ec2.internal>
2026-01-24 21:46:01 -08:00
aleiby
71077e93dd fix(mail): filter by read status in ListUnread for beads mode (#936)
ListUnread() was returning all open messages in beads mode instead of
filtering out messages marked as read. This caused `gt mail inbox --unread`
to show all messages even when they had the "read" label.

The fix unifies the code path for legacy and beads modes - both now
filter by the msg.Read field, which is correctly populated from the
"read" label via ToMessage().

Note: `gt mail read` intentionally does NOT mark messages as read
(to preserve handoff messages). Users should use `gt mail mark-read`
to explicitly mark messages as read.

Fixes gt-izcp85

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:45:22 -08:00
Ben Tucker
6c86616273 fix(settings): set editorMode to normal for Claude sessions (#929)
This ensures Claude Code starts in normal editor mode rather than
potentially using vim mode, which can cause issues with automated
text input via tmux send-keys.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:45:19 -08:00
Basit Mustafa
3442471a93 fix(orphan): protect all tmux sessions, not just Gas Town ones (#924)
* Add hung-session-detection step to deacon patrol

Detects and surgically recovers Gas Town sessions where Claude API
call is stuck indefinitely. These appear "running" (tmux session
exists) but aren't processing work.

Safety checks (ALL must pass before recovery):
1. Session matches Gas Town pattern exactly (gt-*-witness, etc)
2. Session shows waiting state (Clauding/Deciphering/etc)
3. Duration >30min AND (zero tokens OR duration >2hrs)
4. NOT showing active tool execution (⏺ markers)

This closes a gap where existing zombie-scan only catches processes
not in tmux sessions.

Co-Authored-By: Claude <noreply@anthropic.com>

* fix(orphan): protect all tmux sessions, not just Gas Town ones

The orphan cleanup was killing Claude processes in user's personal tmux
sessions (e.g., "loomtown", "yaad") because only sessions with gt-* or
hq-* prefixes were protected.

Changes:
- Renamed getGasTownSessionPIDs() to getTmuxSessionPIDs()
- Now protects ALL tmux sessions regardless of name prefix
- Updated variable names for clarity (gasTownPIDs -> protectedPIDs)

The TTY="?" check is not reliable during certain operations (startup,
session transitions), so explicit protection of all tmux sessions is
necessary to prevent killing user's personal Claude instances.

Fixes #923

Co-Authored-By: Claude <noreply@anthropic.com>

---------

Co-authored-by: mayor <ec2-user@ip-172-31-43-79.ec2.internal>
Co-authored-by: Claude <noreply@anthropic.com>
2026-01-24 21:45:12 -08:00
Julian Knutsen
f276b9d28a fix(prime): show molecule instructions BEFORE bare bead instructions (#920)
When a hooked bead has attached_molecule (formula workflow), the polecat
was being told "run bd show <bead-id>" first, then seeing molecule context
later. The polecat would follow the first instruction and work directly
on the bead, ignoring the formula steps entirely.

Now checks for attached_molecule FIRST and gives different instructions:
- If molecule attached: "Work through molecule steps - see CURRENT STEP"
- If no molecule: "Run bd show <bead-id>"

Also adds explicit warning: "Skip molecule steps or work on base bead directly"
to the DO NOT list when a molecule is attached.

Co-authored-by: julianknutsen <julianknutsen@users.noreply.github>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:45:09 -08:00
kev
8941e7b049 fix: Updated setup brew command to use correct formula (#903) 2026-01-24 21:45:01 -08:00
Taeun Lee
44fbd6eac7 Update .gitignore (#922)
bd.sock.startlock which captures pid appears and disappears frequently.
2026-01-24 21:44:42 -08:00
joe
2a0420177e refactor(costs): rename wisp references to entries
- querySessionCostWisps → querySessionCostEntries
- Rename variables: wisps → costEntries, todayWisps → todayEntries
- Add comment explaining POSIX O_APPEND atomicity guarantee

Follow-up to code review feedback.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:29:57 -08:00
joe
dc3fd47a32 refactor(costs): decouple cost recording from Dolt database
Replace bd create --ephemeral wisp with simple file append to
~/.gt/costs.jsonl. This ensures the stop hook never fails due to:
- Dolt server not running (connection refused)
- Dolt connection stale (invalid connection)
- Database temporarily unavailable

The costs.jsonl approach:
- Stop hook appends JSON line (fire-and-forget, ~0ms)
- gt costs --today reads from log file
- gt costs digest aggregates log entries into permanent beads

This is Option 1 from gt-99ls5z design bead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 21:21:20 -08:00
beads/crew/emma
889c5863fa fix(stale): enable stale binary warning and fix source detection
- Add checkStaleBinaryWarning() call to persistentPreRun (was only in
  deprecated function)
- Fix GetRepoRoot() to look in correct location ($GT_ROOT/gastown/mayor/rig)
- Use hasGtSource() with os.Stat instead of shell test command

Agents will now see warnings when running gt with a stale binary.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 20:52:27 -08:00
mayor
d9f1fe9e48 fix(cmd): add more commands to beads version exempt list
Added handoff, costs, feed, rig, config, install, tap, dnd.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 16:23:24 -08:00
mayor
c4d8e26dcb fix(cmd): exempt most commands from beads version check
Gas Town has migrated to Dolt for beads storage. The bd version
check was blocking all commands when bd hangs/crashes.

Added crew, polecat, witness, refinery, status, mail, hook, prime,
nudge, seance, doctor, and dolt to the exempt list.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-24 15:35:13 -08:00