Commit Graph

357 Commits

Author SHA1 Message Date
Steve Yegge
741082a811 bd sync: 2025-12-21 14:50:46 2025-12-21 14:50:46 -08:00
Steve Yegge
38d155b941 bd sync: 2025-12-21 14:34:54 2025-12-21 14:34:54 -08:00
Steve Yegge
53e66e688b bd sync: 2025-12-21 14:16:19 2025-12-21 14:16:19 -08:00
Steve Yegge
4bab11e828 bd sync: 2025-12-21 14:10:03 2025-12-21 14:10:03 -08:00
Steve Yegge
3ed8708a3b bd sync: 2025-12-21 14:09:03 2025-12-21 14:09:03 -08:00
Steve Yegge
6b1e6cab17 bd sync: 2025-12-21 14:01:11 2025-12-21 14:01:11 -08:00
Steve Yegge
f98598ac65 bd sync: merge from main 2025-12-21 11:45:59 -08:00
Steve Yegge
50c5639258 bd sync: 2025-12-21 11:11:12 2025-12-21 11:11:12 -08:00
Steve Yegge
148aa57d07 bd sync: 2025-12-21 10:29:40 2025-12-21 10:29:40 -08:00
Steve Yegge
eae81690d6 bd sync: 2025-12-20 22:50:19 2025-12-20 22:50:19 -08:00
Steve Yegge
9391e3a439 bd sync: 2025-12-20 22:04:36 2025-12-20 22:04:36 -08:00
Steve Yegge
5e22ed590d bd sync: 2025-12-20 21:26:32 2025-12-20 21:26:32 -08:00
Steve Yegge
21d2dd2e05 bd sync: 2025-12-20 21:20:14 2025-12-20 21:20:14 -08:00
Steve Yegge
448c9a27eb bd sync: 2025-12-20 21:04:34 2025-12-20 21:04:34 -08:00
Steve Yegge
868b9af112 bd sync: merge divergent histories (161 local + 293 remote commits) 2025-12-20 21:04:32 -08:00
Steve Yegge
74730854e8 bd sync: 2025-12-20 21:03:19 2025-12-20 21:03:19 -08:00
Steve Yegge
fc1f50502f feat(polecat): Add shared beads redirect for polecats (gt-cxtu)
When creating a polecat worktree, create a .beads/redirect file pointing
to the rig-level shared beads database. This eliminates git sync overhead
between polecats - they all connect to the same daemon and database.

Architecture:
  gastown/
    .beads/              <- Shared database (created if missing)
    polecats/
      nux/
        .beads/
          redirect       <- Contains "../../.beads"

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:54:37 -08:00
Steve Yegge
8fab4d3790 chore: VC pattern analysis + Deacon simplification
- Add gt-zhpa epic: VC Pattern Integration (6 child tasks)
  Extracted validated ideas from ~/src/vc that map to Gas Town primitives

- Close gt-5af: Deacon epic as over-engineered
  Problem solved by hooks + gt prime

- Create lightweight successors:
  - gt-htto: Heartbeat convention
  - gt-bnch: Human escalation

- Disable beads MCP plugin for Gas Town
  CLI works; MCP adds complexity without value

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 20:41:33 -08:00
Steve Yegge
bc4cec1494 docs(crew): Work off main, no feature branches
Crew workers are trusted maintainers who push directly to main:
- Own their clones (no isolation needed)
- Fast work cycles (10-15 min) make branch overhead wasteful
- Branches go stale with context cycling
- Polecats use branches/MRs; crew does not need review

Also updated two-level beads docs (removed stale rig-level references).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:35:02 -08:00
Steve Yegge
5f206348a5 fix: Use correct beads paths for molecule and statusline
- molecule.go: Use findLocalBeadsDir() for project-level beads
- statusline.go: Use findMailWorkDir() for mail count (town beads)

Part of two-level beads architecture cleanup.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:30:45 -08:00
Steve Yegge
c16324b713 fix(mail): Use town beads for all mail (two-level architecture)
Replace complex address-based routing with simple town root lookup.
All mail goes to ~/gt/.beads/ (town beads), eliminating the broken
rig-level routing.

Two-level model:
- Town beads (~/gt/.beads/): ALL mail and coordination
- Clone beads (<rig>/crew/*/.beads/): Project issues only

Fixes: gt-4qey

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 18:28:14 -08:00
Steve Yegge
f6ff533891 feat(mail): Sort pinned messages first in inbox (gt-ngu1)
Add Pinned field to BeadsMessage and sort pinned messages before
unpinned ones in listBeads(). Within each group, sort by newest first.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 17:53:52 -08:00
Steve Yegge
4c060f4aaa refactor(mail): Remove bd mail dependency, use bd create/list/show (gt-9xg)
Replace `bd mail send/inbox/read/ack` commands with `bd create/list/show/close`.
This separates the orchestration layer (gt) from the data plane (beads).

Changes:
- router.go: Use `bd create --type=message` instead of `bd mail send`
- mailbox.go: Use `bd list --type=message` and `bd show` for inbox/read
- types.go: Parse metadata from labels (from:, thread:, reply-to:)
- mail.go: Fix findBeadsWorkDir to prefer rig-level beads, fix crew address format

Messages are now stored as beads issues with type=message. Metadata (sender,
thread, reply-to) is stored in labels for retrieval.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 17:52:15 -08:00
Steve Yegge
d242239aa1 bd sync: add gt-976 crew lifecycle + gt-977 work request to max 2025-12-20 17:20:02 -08:00
Steve Yegge
38fd52779f bd sync: add gt-975 molecule execution support 2025-12-20 16:57:30 -08:00
Steve Yegge
4f21002132 feat(polecat): refuse to lose uncommitted work during cleanup (gt-8v8)
Add comprehensive uncommitted work checks before any polecat cleanup:
- Check for uncommitted changes (modified/untracked files)
- Check for stashes
- Check for unpushed commits

Affected commands:
- gt polecat remove: now refuses if uncommitted work exists
- gt rig shutdown: checks all polecats before shutdown
- Witness cleanup: refuses to clean polecats with uncommitted work
- gt spawn: warns if spawning to polecat with uncommitted work

Safety model:
- --force: bypasses uncommitted changes check only
- --nuclear: bypasses ALL safety checks (will lose work)

New git helpers:
- StashCount(): count stashes in repo
- UnpushedCommits(): count commits not pushed to upstream
- CheckUncommittedWork(): comprehensive work status check

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:54:16 -08:00
Steve Yegge
2a9f31a02d feat(polecat): Add bulk removal with --all and multi-polecat support (gt-hcc0)
- Add --all flag to remove all polecats from a rig: `gt polecat remove gastown --all`
- Support multiple rig/polecat args: `gt polecat remove gastown/A gastown/B`
- Report summary of removed polecats and any failures
- Validate that --all is not used with rig/polecat format

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:52:43 -08:00
Steve Yegge
df20acf782 feat(spawn): Add handoff protocol to spawn priming (gt-8os8)
- Updated buildWorkAssignmentMail with handoff protocol section
- Added gt done command for polecats to signal completion
- Handoff protocol includes checklist: git clean, issue closed, beads synced, code pushed
- gt done verifies pre-flight checks before sending completion notification to Witness

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:52:40 -08:00
Steve Yegge
6cfab58e86 feat(witness): Implement Witness MVP for automated polecat lifecycle
Implements the core Witness functionality:

- gt witness start: Creates tmux session with Claude, theming, auto-priming
- gt witness stop: Kills tmux session and updates state
- gt witness status: Shows session state reconciled with tmux
- Shutdown handler: Verifies git clean state before cleanup, sends nudges
- Auto-spawn: Spawns polecats for ready work up to configurable capacity
- Health checks: Monitors polecat activity, nudges stuck workers, escalates

Also updates handoff to include polecat name in lifecycle requests.

Closes: gt-53w6, gt-mxyj, gt-5wtw, gt-cpm2, gt-es1i

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:52:02 -08:00
Steve Yegge
c01e965d37 feat(prompts): Add witness role template with refined protocols
- Add clearer heartbeat protocol with step-by-step checklist
- Add structured mail checking procedure by message type
- Add nudge decision criteria with signal strength levels
- Add escalation thresholds (when to escalate vs handle locally)
- Add pre-kill verification checklist
- Add session self-cycling protocol
- Uses {{ rig }} template placeholders

Closes gt-qrze

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:50:26 -08:00
Steve Yegge
c1dde066ff feat(handoff): Auto-submit MR to merge queue when polecat shuts down
When a polecat runs `gt handoff` (default: shutdown action), the current
branch is now automatically submitted to the merge queue if it follows
the polecat/<name>/<issue> naming convention.

This streamlines the polecat workflow:
- Work on assigned issue
- Commit changes
- Run `gt handoff` (automatically submits MR + retires)

The Refinery will process the merge request. If MR submission fails,
a warning is printed but handoff continues.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:50:23 -08:00
Steve Yegge
2f5bbf5fdb feat(molecule): Add molecule catalog with hierarchical loading
Implement MoleculeCatalog for loading molecules from multiple sources:
1. Built-in molecules (shipped with the gt binary)
2. Town-level: <town>/.beads/molecules.jsonl
3. Rig-level: <rig>/.beads/molecules.jsonl
4. Project-level: .beads/molecules.jsonl

Changes:
- Add internal/beads/catalog.go with MoleculeCatalog type
- Update gt molecule list to show source (builtin, town, rig, project, database)
- Update gt molecule show to check catalog first, then database
- Update gt molecule instantiate to check catalog first
- Add gt molecule export command to export built-in molecules to JSONL
- Add --catalog and --db flags to gt molecule list

The catalog enables organizations to share molecule templates
independently of work item tracking, and allows customization
at different levels of the workspace hierarchy.

Closes gt-0ei3.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:49:34 -08:00
Steve Yegge
5645f0bb78 feat(doctor): Add orphan session and process detection
Add two new health checks to gt doctor:

1. orphan-sessions: Detects Gas Town tmux sessions (gt-*) that do not
   match expected patterns (mayor, deacon, rig-witness, rig-refinery,
   rig-polecat). Validates rig names against actual workspace structure.

2. orphan-processes: Detects Claude/claude-code processes without a
   tmux parent. Walks process tree to find orphaned instances that
   may be consuming resources.

Both checks support --fix to clean up detected orphans:
- Kills orphaned tmux sessions
- Sends SIGINT (then SIGKILL) to orphaned processes

Closes gt-qsvq.

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:49:29 -08:00
Steve Yegge
3921b0e8d8 feat: Add gt done command for polecat work submission
Add `gt done` command as a convenience wrapper for polecats to signal
their work is ready for the merge queue. This addresses the missing
command referenced in polecat docs.

The command:
- Submits current branch to merge queue (same as gt mq submit)
- Auto-detects issue ID from branch name (polecat/<worker>/<issue>)
- Auto-detects integration branch if source issue has epic parent
- Provides polecat-friendly output messaging

Closes gt-qna4.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:49:29 -08:00
Steve Yegge
3e977a4017 fix: handoff wait timeout and refinery foreground race condition
- gt-dsfi: Add periodic warning messages to handoff wait instead of
  blocking forever with select{}. After 2 minutes, shows hints about
  checking daemon/witness status and how to abort.

- gt-n7z7: Skip tmux session existence check when in foreground mode.
  When background mode spawns foreground mode inside a tmux session,
  the foreground check would find its own session and return "already
  running". Now only checks PID when in foreground mode.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 16:49:29 -08:00
Steve Yegge
58cf789eee revert: let project beads config control sync-branch
The sync-branch setting is up to the project's .beads/config.yaml,
not something Gas Town should force. Projects can use bd doctor --fix
to configure sync-branch if they want multi-clone coordination.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 15:46:18 -08:00
Steve Yegge
317caace5e fix: auto-configure sync-branch for rig beads
New rigs now get sync-branch: beads-sync in their .beads/config.yaml
automatically. This enables multi-clone coordination for polecats,
crew members, and refinery.

Also added gt doctor check (beads-sync-branch) to verify existing rigs
have sync-branch configured, with --fix support.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 15:42:45 -08:00
Steve Yegge
ded1ffba0b docs: add two-level beads architecture documentation
Add clear explanations of the town-level vs rig-level beads architecture:
- Town beads (~/gt/.beads): HQ coordination, no sync-branch
- Rig beads (in git clones): project work, uses beads-sync branch
- Clarify that rig-level .beads at container is gitignored

Updated:
- docs/architecture.md: New 'Two-Level Beads Architecture' section
- CLAUDE.md: Enhanced existing section with table and sync-branch info
- templates/roles/*.tmpl: Added beads architecture to crew, polecat, mayor

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 15:37:52 -08:00
Steve Yegge
be0f77324f fix(refinery): avoid race condition in foreground mode
In foreground mode, skip the tmux session check since we are likely
running inside the session that background mode created. Only check
PID to avoid self-detection.

Fixes the issue where gt refinery start gastown --foreground would
detect its own tmux session as already running.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 15:16:56 -08:00
Steve Yegge
91a0f3b80f feat: rename harness to HQ throughout docs and code (gt-a41)
The "hq-" prefix for town-level beads revealed that "HQ" (headquarters)
is a better name than "harness" for the top-level Gas Town structure.

- Renamed docs/harness.md to docs/hq.md with updated content
- Updated all documentation references in architecture.md and bootstrap.md
- Updated CLI help text and user-facing messages in install.go
- Updated gitinit.go with HQGitignore constant and HQ terminology
- Updated molecule templates in builtin_molecules.go
- Kept InitGitForHarness function name for backwards compatibility

HQ is more intuitive (where the mayor sits), fits the Mad Max aesthetic,
matches the beads prefix (hq-*), and is self-documenting.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 14:24:49 -08:00
Steve Yegge
afee8bba17 docs: use hq- prefix for town-level beads
Updated beads-hygiene plugin spec to use 'hq-' (headquarters) instead
of 'stevetown-'. Short, visually distinct from rig prefixes, and
semantically clear.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:48:32 -08:00
Steve Yegge
42e393627d docs: Update docs to reflect molecule-first paradigm (gt-nam3)
- Add molecule-first paradigm note at top of architecture.md
- Update all spawn examples to include --molecule flag
- Add "Config vs Molecule" section with cognition principle
- Add policy-to-molecule escalation note in federation-design.md
- Update role templates (mayor, witness) with molecule usage

Key message: Gas Town spawns workers on molecules, not just issues.
The issue is seed data; the molecule defines the workflow.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:44:43 -08:00
Steve Yegge
39758e6cf3 docs: add beads-hygiene plugin spec
Detects and fixes cross-pollution between Gas Town's two-level beads
architecture (town-level vs rig-level). Workers sometimes get confused
about which database they're in, creating issues at the wrong level.

The plugin scans for:
- Prefix mismatches (wrong prefix for location)
- Cross-level dependency references
- Agent identity/context confusion
- Misfiled issues that should be moved

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:37:49 -08:00
Steve Yegge
1e62d37b1e Merge fix/spawn-beads-path: add gt nudge command
Key changes:
- Add gt nudge command for reliable Claude session messaging
- spawn.go now uses NudgeSession instead of SendKeysDebounced
- Fix templates test to match actual deacon template text

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:30:30 -08:00
Steve Yegge
11fe4dddc5 fix(handoff): Use actual rig name in lifecycle messages (gt-6vks)
The getManager() function was returning a literal "<rig>/witness" string
for polecats and refineries instead of substituting the actual rig name.

This caused LIFECYCLE messages to be sent to "@<rig>/witness" instead of
proper addresses like "@gastown/witness".

Fix:
- Add detectRigFromContext() to extract rig from current directory
- Update getManager() to use detected rig name
- Fallback to deacon/ if rig detection fails (safety)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:23:17 -08:00
Steve Yegge
d2fccd580c feat(daemon): Add slot-based notification deduplication (gt-wpg)
Implement replaceable notifications to prevent heartbeat stacking when
agents are busy. Only the latest notification per slot is delivered.

Changes:
- Add NotificationManager for tracking pending notifications
- Add SendKeysReplace() that clears input line before sending
- Integrate slot tracking into daemon heartbeat pokes
- Mark notifications consumed when agent shows activity

The system tracks pending notifications in state files and skips
sending if a notification for the same slot is still pending.
When agent activity is detected (keepalive), slots are marked
consumed allowing new notifications to be sent.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:19:40 -08:00
Steve Yegge
9509afa6b1 feat(nudge): Add gt nudge command for reliable Claude session messaging
Encapsulates tmux send-keys with: literal mode, 500ms debounce, separate Enter.
Tested and reliable. Updates spawn.go to use NudgeSession.

Related: gt-1hf, gt-lz2

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 13:19:39 -08:00
Steve Yegge
cc0ee19a8b spawn: add direct nudge after session start
Instead of relying solely on hooks or witness coordination, spawn now:
- Waits 3 seconds for Claude Code to fully initialize
- Sends a direct nudge to the polecat to check inbox
- Still notifies Witness as backup monitoring

This provides immediate feedback to polecats without waiting for
witness response.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 09:23:57 -08:00
Steve Yegge
a32c711e97 spawn: use town-level beads for Witness notification
The SPAWN notification to Witness was going to rig-level beads,
but gt mail inbox checks town-level first. This caused messages
to get lost.

Fixes part of gt-c6b.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 09:23:57 -08:00
Steve Yegge
cfb33241dd spawn: Use detectSender() for From field, document Deacon fallback 2025-12-20 09:23:57 -08:00