1188 Commits

Author SHA1 Message Date
diesel
e2e43b8bf5 chore: sync formula and recovery work
Some checks failed
CI / Check for .beads changes (push) Has been skipped
CI / Check embedded formulas (push) Failing after 17s
CI / Test (push) Failing after 1m20s
CI / Lint (push) Failing after 22s
CI / Integration Tests (push) Failing after 34s
CI / Coverage Report (push) Has been skipped
Windows CI / Windows Build and Unit Tests (push) Has been cancelled
- Update mol-deacon-patrol formula
- Fix sling helpers, doctor branch check
- Update startup session and tests
- Remove obsolete research doc

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 14:23:10 -08:00
splendid
2a789c8440 fix(prime): update sling prompts to use gt prime --hook
Polecats weren't getting full role context (including IDLE POLECAT
HERESY guidance) because start prompts said `gt hook` instead of
`gt prime --hook`. The SessionStart hook already runs `gt prime --hook`,
but manual nudge messages were inconsistent.

Changed:
- sling_helpers.go: nudge message now says `gt prime --hook`
- startup.go: assigned beacon now says `gt prime --hook`
- startup_test.go: updated test expectation

Fixes: hq-iqyu9

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 14:16:55 -08:00
dementus
149da3d2e2 feat(templates): recover local override support for role templates
Cherry-picked from lost commit 123d0b2b. Adds ability to override
embedded role templates at town or rig level:
- Town: <townRoot>/templates/roles/<role>.md.tmpl
- Rig: <rigPath>/templates/roles/<role>.md.tmpl

New APIs:
- NewWithOverrides(townRoot, rigPath string)
- HasRoleOverride(role string) bool
- RoleOverrideCount() int

Recovered by: gt-vjhf

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:49:35 -08:00
slit
01e336edb6 fix(done): use ResolveHookDir for dispatcher lookup (sc-g7bl3)
When a polecat runs gt done after work is complete, it should notify the
dispatcher (the agent that slung the work). This notification was failing
silently when the polecat's worktree was deleted before gt done finished.

The issue was that getDispatcherFromBead() used ResolveBeadsDir(cwd) which
relies on the polecat's .beads/redirect file. If the worktree is deleted
(e.g., by Witness cleanup), the redirect file is gone and bead lookup fails.

Fix: Use ResolveHookDir(townRoot, issueID, cwd) instead. ResolveHookDir uses
prefix-based routing via routes.jsonl which works regardless of worktree
state. This ensures dispatcher notifications are sent reliably even when
the worktree is cleaned up before gt done completes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:48:09 -08:00
coma
a1f843c11d fix(convoy): ensure custom types before convoy creation
Add EnsureCustomTypes call to createAutoConvoy (sling) and
executeConvoyFormula (formula) to ensure the 'convoy' type is
registered before attempting to create convoy beads.

This fixes "validation failed: invalid issue type: convoy" errors
that occurred when convoy creation was attempted before custom types
were configured in the beads database.

Fixes: hq-ledua

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:37:49 -08:00
furiosa
afdadc77ff fix(hook): enable cross-prefix bead hooking with database routing
When agents hook beads from different prefixes (e.g., rig worker hooking
hq-* bead), the status check now uses ResolveHookDir to find the correct
database for fetching the hooked bead.

Also adds fallback scanning of town-level beads for rig-level roles when
no hooked beads are found locally.

Fixes: gt-rphsv

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:27:18 -08:00
nux
c66dc4594c fix(hook): enable cross-prefix bead hooking with database routing
The `gt hook` command was failing to persist hooks for beads from different
prefixes (e.g., hooking an hq-* bead from a rig worker). The issue was that
`runHook` used `b.Update()` which always writes to the local beads database,
regardless of the bead's prefix.

Changes:
- Use `beads.ResolveHookDir()` to determine the correct database directory
  for the bead being hooked, based on its prefix
- Execute `bd update` with the correct working directory for cross-prefix routing
- Call `updateAgentHookBead()` to set the agent's hook_bead slot, enabling
  `gt hook status` to find cross-prefix hooked beads
- Add integration test for cross-prefix hooking scenarios

This matches the pattern already used by `gt sling` for cross-prefix dispatch.

Fixes: gt-rphsv

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 12:18:43 -08:00
furiosa
5ab01f383a fix(version): suppress staleness warning for fork builds
When the gt binary is built from a local fork (e.g., ~/src/gastown),
the staleness check would incorrectly warn about being stale because
it compared against the rig's repo HEAD. This confused agents.

The fix detects fork builds by checking if the binary's embedded
commit exists in the target repo. If not, the binary was built from
a different repo and we report "fork build" instead of "stale".

Changes:
- Add IsForkBuild field to StaleBinaryInfo
- Add commitExistsInRepo helper to detect fork scenarios
- Update gt stale command to show "Binary built from fork" status
- Update doctor check to report fork builds as OK

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 11:10:35 -08:00
furiosa
eaff7c3936 fix(statusline): limit max rigs displayed to prevent overflow
When many rigs are registered, the tmux statusline would truncate or
overflow. This adds a configurable maximum (default 5) with an overflow
indicator showing how many rigs are hidden (e.g., "+3").

Running rigs are prioritized (shown first) due to existing sort order.

Configure via GT_MAX_RIGS_DISPLAY env var:
- Default: 5 rigs shown
- Set to 0 for unlimited
- Set to any positive number for custom limit

Fixes: h-4wtnc

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:34:37 -08:00
diesel
9c1601df82 fix(hook): remove unused workspace import after rebase 2026-01-26 10:34:36 -08:00
onyx
6202d783c2 perf(git): cache git rev-parse results within sessions
Multiple gt commands call git rev-parse --show-toplevel, adding ~50ms
each invocation. Results rarely change within a session, and multiple
agents calling git concurrently contend on .git/index.lock.

Add cached RepoRoot() and RepoRootFrom() functions to the git package
and update all callers to use them. This ensures a single git subprocess
call per process for the common case of checking the current directory's
repo root.

Files updated:
- internal/git/git.go: Add RepoRoot() and RepoRootFrom()
- internal/cmd/prime.go: Use cached git.RepoRoot()
- internal/cmd/molecule_status.go: Use cached git.RepoRoot()
- internal/cmd/sling_helpers.go: Use cached git.RepoRoot()
- internal/cmd/rig_quick_add.go: Use git.RepoRootFrom() for path arg
- internal/version/stale.go: Use cached git.RepoRoot()

Closes: bd-2zd.5
2026-01-26 10:34:36 -08:00
furiosa
04ddb2c3bd fix(sling): use --no-daemon consistently in bd calls (h-3f96b)
storeDispatcherInBead and storeAttachedMoleculeInBead were calling
bd show/update without --no-daemon, while all other sling operations
used --no-daemon. This inconsistency could cause daemon socket hangs
if the daemon was in a bad state during sling operations.

Changes:
- Add --no-daemon --allow-stale to bd show calls in both functions
- Add --no-daemon to bd update calls in both functions
- Add empty stdout check for bd --no-daemon exit 0 bug

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:34:36 -08:00
nux
5a0dac8f93 feat(crew): add crew configuration to rigs.json for cross-machine sync
Add CrewRegistryConfig to RigEntry allowing crew members to be defined
in rigs.json and synced across machines. The new `gt crew sync` command
creates missing crew members from the configuration.

Configuration example:
  "rigs": {
    "gastown": {
      "crew": {
        "theme": "mad-max",
        "members": ["diesel", "chrome", "nitro"]
      }
    }
  }

Closes: gt-tu4
2026-01-26 10:34:36 -08:00
diesel
1d2b29b994 perf(goals): optimize gt goals from 6s to <50ms via direct SQLite (gt-aps.3)
Replace bd subprocess spawns with direct SQLite queries:
- queryEpicsInDir: direct sqlite3 query vs bd list subprocess
- getLinkedConvoys: direct JOIN query vs bd dep list + getIssueDetails loop
- computeGoalLastMovement: reuse epic.UpdatedAt vs separate bd show call

Also includes mailbox optimization from earlier session:
- Consolidated multiple parallel queries into single bd list --all query
- Filters in Go instead of spawning O(identities × statuses) bd processes

177x improvement (6.2s → 35ms) by eliminating subprocess overhead.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:34:35 -08:00
obsidian
55048333c6 perf(rpc): use bd daemon protocol to reduce subprocess overhead
Replace bd subprocess calls in gt commands with daemon RPC when available.
Each subprocess call has ~40ms overhead for Go binary startup, so using
the daemon's Unix socket protocol significantly reduces latency.

Changes:
- Add RPC client to beads package (beads_rpc.go)
- Modify List/Show/Update/Close methods to try RPC first, fall back to subprocess
- Replace runBdPrime() with direct content output (avoids bd subprocess)
- Replace checkPendingEscalations() to use beads.List() with RPC
- Replace hook.go bd subprocess calls with beads package methods

The RPC client:
- Connects to daemon via Unix socket at .beads/bd.sock
- Uses JSON-based request/response protocol (same as bd daemon)
- Falls back gracefully to subprocess if daemon unavailable
- Lazy-initializes connection on first use

Performance improvement targets (from bd-2zd.2):
- gt prime < 100ms (was 5.8s with subprocess chain)
- gt hook < 100ms (was ~323ms)

Closes: bd-2zd.2
2026-01-26 10:33:59 -08:00
furiosa
c4b74ee7bf fix(handoff): don't kill pane processes before respawn (hq-bv7ef)
The previous approach using KillPaneProcessesExcluding/KillPaneProcesses
killed the pane's main process (Claude/node) before calling RespawnPane.
This caused the pane to close (since tmux's remain-on-exit is off by default),
which then made RespawnPane fail because the target pane no longer exists.

The respawn-pane -k flag handles killing atomically - it kills the old process
and starts the new one in a single operation without closing the pane in between.
If orphan processes remain (e.g., Claude ignoring SIGHUP), they will be cleaned
up when the new session starts or by periodic cleanup processes.

This fixes both self-handoff and remote handoff paths.

Fixes: hq-bv7ef

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:33:59 -08:00
furiosa
43f6b63792 fix(plugin): don't record false success when gt plugin run only prints instructions
The `gt plugin run` command was recording a "success" run even though it
only prints plugin instructions for an agent/user to execute - it doesn't
actually run the plugin.

This poisoned the cooldown gate: CountRunsSince counted these false
successes, preventing actual executions from running because the gate
appeared to have recent successful runs.

Remove the recording from `gt plugin run`. The actual plugin execution
(by whatever follows the printed instructions) should record the result.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:32:51 -08:00
furiosa
c9e877cdd6 fix(version): add file-based caching to prevent bd version contention
Under high concurrency (17+ agents), the bd version check spawns
multiple git subprocesses per invocation, causing timeouts when
85-120+ git processes compete for resources.

This fix:
- Caches successful version checks to ~/.cache/gastown/beads-version.json
- Uses cached results for 24 hours to avoid subprocess spawning
- On timeout, uses stale cache if available or gracefully degrades
- Prints warning when using cached/degraded path

Fixes: https://github.com/steveyegge/gastown/issues/503

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:32:51 -08:00
furiosa
beb863897f feat(goals): show assignee for each bead in gt goals output
Add assignee display to both list and single-goal views. In list view,
assignee appears on the second line when present. In single-goal view,
it appears as a dedicated field after priority. JSON output also includes
the assignee field.

Closes: gt-libj

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:32:51 -08:00
propane
d12408703b fix(statusline): filter in_progress beads by identity in getCurrentWork
The getCurrentWork function was returning ANY in_progress bead from the
workspace rather than only beads assigned to the current agent. This caused
crew workers to see wisps assigned to polecats in their status bar.

Changes:
- Add identity parameter to getCurrentWork function
- Add identity guard (return empty if identity is empty)
- Filter by Assignee in the beads query

This complements the earlier getHookedWork fix and ensures both hooked
AND in_progress beads are filtered by the agent's identity.

Fixes gt-zxnr (additional fix).

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:32:51 -08:00
propane
abf72fb412 fix(statusline): ensure crew sessions have correct hook display
Root cause: tmux statusline showed wrong hook for all java crewmembers
because GT_CREW env var wasn't set in tmux session environment.

Changes:
- statusline.go: Add early return in getHookedWork() when identity is empty
  to prevent returning ALL hooked beads regardless of assignee
- crew_at.go: Call SetEnvironment in the restart path so sessions created
  before GT_CREW was being set get it on restart

Fixes gt-zxnr.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-26 10:32:50 -08:00
furiosa
4c5f0f4e11 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-26 10:31:39 -08:00
diesel
0960fd8bf1 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-26 10:31:38 -08:00
diesel
43d76df0fa 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-26 10:31:38 -08:00
gastown/crew/kerosene
4e3941bcb0 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-26 10:31:38 -08:00
gastown/crew/octane
39401e3606 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-26 10:31:16 -08:00
nux
9cf012c0d5 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-26 10:31:16 -08:00
furiosa
36b3c3b00a 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-26 10:31:16 -08:00
rictus
a8406554a0 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-26 10:31:16 -08:00
kerosene
996cf4a670 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-26 10:31:16 -08:00
nux
33e509ea39 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-26 10:31:15 -08:00
furiosa
8957aec489 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-26 10:30:54 -08:00
0c398df67b 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-26 10:29:53 -08:00
riker
9308de59a9 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-26 10:29:53 -08:00
riker
5971f4c470 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-26 10:29:53 -08:00
539a75e4e6 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-26 10:29:53 -08:00
mayor
809b0eb028 fix(hook): fall back to GT_ROLE when cwd detection fails
gt hook status failed with "cannot determine agent identity (role: unknown)"
when run from rig root directories like ~/gt/beads. The cwd-based detection
only recognizes specific agent directories (witness/, polecats/foo/, etc.)
but not rig roots.

Now falls back to GT_ROLE env var when detectRole returns unknown, matching
the pattern used by GetRoleWithContext and other role detection code.

Fixes gt-6pg

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:20:19 -08:00
aleiby
31bd120077 fix(startup): unify agent startup with beacon + instructions in CLI prompt (#977)
All agents now receive their startup beacon + role-specific instructions via
the CLI prompt, making sessions identifiable in /resume picker while removing
unreliable post-startup nudges.

Changes:
- Rename FormatStartupNudge → FormatStartupBeacon, StartupNudgeConfig → BeaconConfig
- Remove StartupNudge() function (no longer needed)
- Remove PropulsionNudge() and PropulsionNudgeForRole() functions
- Update deacon, witness, refinery, polecat managers to include beacon in CLI prompt
- Update boot to inline beacon (can't import session due to import cycle)
- Update daemon/lifecycle.go to include beacon via BuildCommandWithPrompt
- Update cmd/deacon.go to include beacon in startup command
- Remove redundant StartupNudge and PropulsionNudge calls from all startup paths

The beacon is now part of the CLI prompt which is queued before Claude starts,
making it more reliable than post-startup nudges which had timing issues.
SessionStart hook runs gt prime automatically, so PropulsionNudge was redundant.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:08:57 -08:00
David Van Couvering
92ccacffd9 feat(sling): add --no-merge flag to skip merge queue (#939)
When contributing to upstream repos or wanting human review before merge,
the --no-merge flag keeps polecat work on a feature branch instead of
auto-merging to main.

Changes:
- Add --no-merge flag to gt sling command
- Store no_merge field in bead's AttachmentFields
- Modify gt done to skip merge queue when no_merge is set
- Push branch and mail dispatcher "READY_FOR_REVIEW" instead
- Add tests for field parsing and sling flag storage

Closes: gt-p7b8

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:08:34 -08:00
Harrison
a86c7d954f fix(costs): read token usage from Claude Code transcripts instead of tmux (#941)
* fix(costs): read token usage from Claude Code transcripts instead of tmux

Replace tmux screen-scraping with reading token usage directly from Claude
Code transcript files at ~/.claude/projects/*/. This enables accurate cost
tracking by summing input_tokens, cache_creation_input_tokens,
cache_read_input_tokens, and output_tokens from assistant messages.

Adds model-specific pricing for Opus 4.5, Sonnet 4, and Haiku 3.5 to
calculate USD costs from token counts.

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

* fix(costs): correct Claude project path encoding

The leading slash should become a leading dash, not be stripped.
Claude Code encodes /Users/foo as -Users-foo, not Users-foo.

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

* fix(costs): make --by-role and --by-rig fast by defaulting to today's costs

When using --by-role or --by-rig without a time filter, the command was
querying all historical events from the beads database via expensive bd list
and bd show commands, taking 10+ seconds and returning no data.

Now these flags default to today's costs from the log file (same as --today),
making them fast and showing actual data. This aligns with the new log-file-based
cost tracking architecture.

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:06:22 -08:00
Artem Bambalov
0e0547b3e1 fix(mail): prevent message type failures (#960) 2026-01-25 18:05:11 -08:00
Artem Bambalov
0ff092ae9f fix: allow vars with formula-on-bead slings (#966) 2026-01-25 18:05:08 -08:00
Artem Bambalov
072c4649de fix: always send handoff mail (#973)
* fix: always send handoff mail

* fix: remove trailing slash from mayor in detectSenderFromCwd

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

---------

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:04:07 -08:00
baldvin-kovacs
8a8603e6df Fix gt ready using wrong beads path for rigs (#963)
The ready command was incorrectly using RigMayorPath() which resolves to
<rig>/mayor/rig, causing BEADS_DIR to be set to a non-existent path like
/home/baldvin/gt/jbrs/mayor/rig/.beads instead of the actual database at
/home/baldvin/gt/jbrs/.beads.

This caused \"bd ready --json\" to fail with \"no beads database found\" when
called by gt ready, even though the database existed at the rig root.

Fix by using r.BeadsPath() which returns the rig root path. The beads
redirect system at <rig>/.beads/redirect already handles routing to
mayor/rig/.beads when appropriate.

Also updated getFormulaNames() and getWispIDs() calls to use the correct
path consistently.

Co-authored-by: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-25 18:01:27 -08:00
aleiby
7926d7b3e8 fix(handoff): prevent self-kill during gt handoff (#881) (#882)
gt handoff was calling KillPaneProcesses which killed Claude Code
(the pane process) before RespawnPane could be called. This caused
handoff to silently fail with no respawn.

Add KillPaneProcessesExcluding function that allows excluding specific
PIDs from being killed. The self-handoff path now excludes the current
process and its parent (Claude Code) so gt handoff survives long enough
to call RespawnPane. The -k flag on respawn-pane handles final cleanup.

Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 18:00:49 -08:00
max
0c791a4d40 fix(handoff): don't KillPaneProcesses on self-handoff
For self-handoff, calling KillPaneProcesses kills the gt handoff
process itself before it can execute RespawnPane, leaving the pane
dead with no respawn. The fix is to rely on respawn-pane -k which
handles killing and respawning atomically.

The remote handoff path is unaffected - it correctly calls
KillPaneProcesses because the caller is in a different session.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 15:56:15 -08:00
mayor
2ee5e1c5ad feat(dolt): add gt dolt command for server management
Add `gt dolt` command with subcommands to manage the Dolt SQL server:
- start/stop/status: Control server lifecycle
- logs: View server logs
- sql: Open interactive SQL shell
- list: List available rig databases
- init-rig: Initialize new rig database
- migrate: Migrate from old .beads/dolt/ layout

The command detects both servers started via `gt dolt start` and
externally-started dolt processes by checking port 3307.

Closes: hq-05caeb

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 15:34:37 -08:00
mayor
b316239d12 chore(gastown): scorched-earth SQLite removal from codebase
Remove all bd sync references and SQLite-specific code from gastown:

**Formulas (agent priming):**
- mol-polecat-work: Remove bd sync step from prepare-for-review
- mol-sync-workspace: Replace sync-beads step with verify-beads (Dolt check)
- mol-polecat-conflict-resolve: Remove bd sync from close-beads
- mol-polecat-code-review: Remove bd sync from summarize-review and complete-and-exit
- mol-polecat-review-pr: Remove bd sync from complete-and-exit
- mol-convoy-cleanup: Remove bd sync from archive-convoy
- mol-digest-generate: Remove bd sync from send-digest
- mol-town-shutdown: Replace sync-state step with verify-state
- beads-release: Replace restart-daemons with verify-install (no daemons with Dolt)

**Templates (role priming):**
- mayor.md.tmpl: Update session end checklist to remove bd sync steps
- crew.md.tmpl: Remove bd sync references from workflow and checklist
- polecat.md.tmpl: Update self-cleaning model and session close docs
- spawn.md.tmpl: Remove bd sync from completion steps
- nudge.md.tmpl: Remove bd sync from completion steps

**Go code:**
- session_manager.go: Remove syncBeads function and call
- rig_dock.go: Remove bd sync calls from dock/undock
- crew/manager.go: Remove runBdSync, update Pristine function
- crew_maintenance.go: Remove bd sync status output
- crew.go: Update pristine command help text
- polecat.go: Make sync command a no-op with deprecation message
- daemon/lifecycle.go: Remove bd sync from startup sequence
- doctor/beads_check.go: Update fix hints and Fix to use bd import not bd sync
- doctor/rig_check.go: Remove sync status check, simplify BeadsConfigValidCheck
- beads/beads.go: Update primeContent to remove bd sync references

With Dolt backend, beads changes are persisted immediately to the sql-server.
There is no separate sync step needed.

Part of epic: hq-e4eefc (SQLite removal)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 14:08:53 -08:00
dennis
30e65b5ca7 refactor(convoy): replace SQLite queries with bd dep list commands
Replace direct sqlite3 CLI calls in getTrackedIssues and isTrackedByConvoy
with bd dep list commands that work with any beads backend (SQLite or Dolt).

- getTrackedIssues: Use bd dep list --direction=down --type=tracks --json
- isTrackedByConvoy: Use bd dep list --direction=up --type=tracks --json

This enables convoy commands to work with the Dolt backend.

Fixes: hq-e4eefc.2

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 13:33:38 -08:00
george
b178d056f6 refactor: remove bd daemon code from gastown
Remove all code that calls bd daemon commands, as bd daemon functionality
has been removed from beads:

- Delete internal/beads/daemon.go (CheckBdDaemonHealth, StopAllBdProcesses, etc.)
- Delete internal/beads/daemon_test.go
- Delete internal/doctor/bd_daemon_check.go (BdDaemonCheck health check)
- Remove bd daemon health check from gt status
- Remove bd daemon stopping from gt down
- Remove bd daemon cleanup from gt install
- Remove BdDaemonCheck registration from gt doctor

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-25 13:33:02 -08:00