Commit Graph

2987 Commits

Author SHA1 Message Date
Steve Yegge
88c6279906 Improve crew resume prompt with gt prime reminder
Add explicit "Run gt prime" to the crew resume prompt and mention
checking in-progress issues for better context recovery.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:22:52 -08:00
Steve Yegge
d8f01171c8 feat(deacon): design and beads for Deacon health orchestrator
- Update gt-5af with full Deacon design (AI agent, not just Go daemon)
- Create 8 implementation tasks as children of gt-5af
- Add AGENTS.md for agent onboarding
- Fix crew restart timing (add debounce, delay for Claude init)
- Add SendKeysDelayedDebounced to tmux for better prompt injection

Deacon will monitor Mayor/Witnesses proactively and handle lifecycle
requests from Mayor/Witnesses/Crew reactively.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:19:28 -08:00
Steve Yegge
4b9f1aa2bd Merge remote-tracking branch 'origin/polecat/Nux' 2025-12-19 17:14:27 -08:00
Steve Yegge
b3b99e55ef bd sync: 2025-12-19 16:58:10 2025-12-19 16:58:10 -08:00
Steve Yegge
6479dddb9b feat(mail): add interrupt vs queue delivery semantics (gt-6k8)
Add delivery modes to mail messages:
- queue (default): message stored for periodic checking
- interrupt: inject system-reminder directly into session

New features:
- --interrupt flag on gt mail send for urgent/lifecycle messages
- --quiet flag on gt mail check for silent non-blocking checks
- gt mail wait command to block until mail arrives (with optional timeout)

Interrupt delivery injects a system-reminder via tmux send-keys,
useful for stuck detection, nudges, and urgent notifications.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:30:53 -08:00
Steve Yegge
4868a09e8e feat(polecat): add bounded name pooling for polecats (gt-frs)
Implement reusable name pool for polecat workers:
- Pool of 50 names (polecat-01 through polecat-50)
- Prefers lower-numbered slots for allocation
- Overflow uses rigname-N format when pool exhausted
- Pool names are reusable, overflow names are not
- State persisted to .gastown/namepool.json

Changes:
- Add NamePool type with Allocate/Release/Reconcile
- Integrate with polecat.Manager (auto-loads/saves)
- Update gt spawn to use AllocateName() from pool
- Remove legacy polecatNames list and generatePolecatName()
- Add comprehensive tests for name pooling

Benefits:
- Tmux sessions survive polecat restarts (same name)
- Users can stay attached and see work continue
- Bounded resource usage for common case
- Scales beyond 50 with overflow naming

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:29:51 -08:00
Steve Yegge
22977d15ba feat(daemon): verify requesting_cycle before kill (gt-y5o)
Before killing an agent session, the daemon now verifies that the
agent has set requesting_<action>=true in its state.json file.
This ensures agents have completed pre-shutdown tasks (git clean,
handoff mail, etc) before being terminated.

- Added verifyAgentRequestingState() for state file verification
- Added identityToStateFile() to map identity to state.json path
- Added comprehensive tests in lifecycle_test.go

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:28:59 -08:00
Steve Yegge
f9c973c23d feat(daemon): implement proper rig discovery from rigs.json
Replace tmux session scanning with proper rig discovery:
- Primary: Load rigs from mayor/rigs.json via rig manager
- Fallback: Scan town directory for .beads or config.json
- Handle rigs without running witnesses gracefully

Closes gt-oc2

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:28:31 -08:00
Steve Yegge
c9f2a646d9 Merge main, keeping main's manager.go and our FailureType tests 2025-12-19 16:26:38 -08:00
Steve Yegge
2ca679ad86 fix(mq): gt mq list shows all priorities, not just P0 (gt-72so)
The ListOptions struct defaults Priority to 0 (Go zero value), which
caused bd list to filter to only P0 merge requests. This fix explicitly
sets Priority: -1 to disable priority filtering.

Root cause: beads.ListOptions{Type: "merge-request"} created opts with
Priority=0, passing --priority=0 to bd, filtering out P1-P4 MRs.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:18:54 -08:00
Steve Yegge
0716c4d48a test(daemon): add unit tests for daemon package (gt-99a)
Add comprehensive unit tests for:
- Config and state serialization (DefaultConfig, LoadState, SaveState)
- Session name pattern matching (isWitnessSession)
- Lifecycle request parsing (parseLifecycleRequest)
- Identity to session mapping (identityToSession)

Tests document a bug where parseLifecycleRequest always matches 'cycle'
because "LIFECYCLE:" prefix contains "cycle". Filed as gt-rixa.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:18:01 -08:00
Steve Yegge
1c56eed44b beads: close gt-bxi8 (bd schema issue, not gt) 2025-12-19 16:17:36 -08:00
Steve Yegge
3190ff52e2 feat(beads): add Release function and gt release command
Implement step recovery mechanism for stuck molecule steps (MVP):
- Add Release() and ReleaseWithReason() to beads wrapper
- Create gt release command to move in_progress → open
- Clears assignee so step can be claimed by another worker
- Optionally adds reason as note for tracking

Usage:
  gt release <id>           # Release single issue
  gt release <id> -r "why"  # Release with reason

This enables nondeterministic idempotence - stuck steps can be
safely recovered and retried by releasing and reclaiming.

Closes gt-g44u.4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:16:26 -08:00
Steve Yegge
debe47cc62 fix(doctor): add beads database check to detect empty issues.db
Add a new doctor check that detects when issues.db is empty but
issues.jsonl has content. This situation can cause "table issues has
no column named pinned" errors when running bd mail send.

The check:
- Detects empty database file alongside non-empty JSONL
- Can auto-fix by deleting the empty database and triggering rebuild
- Works for both town-level and rig-level beads

Run 'gt doctor --fix' to automatically fix this issue.

Fixes gt-bxi8

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:06:12 -08:00
Steve Yegge
8b7fc4bbc6 chore: sync beads after closing gt-1qti 2025-12-19 16:03:39 -08:00
Steve Yegge
0c90aa5936 feat(beads): add mol-install-go-binary molecule (gt-g44u.2)
Add a single-step molecule for building and installing the gt binary.

The molecule contains one step:
- install: Build with `go build -o gt ./cmd/gt` and install with
  `go install ./cmd/gt`

Added InstallGoBinaryMolecule() function and test.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 16:02:51 -08:00
Steve Yegge
4b72a83803 docs: comprehensive molecule architecture and vision
- Add detailed Molecules section to architecture.md covering:
  - Core concepts (molecule, atom, bond, polymer, instance)
  - Prose-based format with ## Step: definitions
  - Composition via Includes directive
  - Nondeterministic idempotence explanation
  - Step states and recovery mechanism
  - Built-in molecules (engineer-in-box, quick-fix, research)
  - Molecule vs template distinction

- Create vision.md capturing the broader strategic vision:
  - Git as blockchain foundation
  - Work as universal protocol
  - Entity chains (work history = CV)
  - Skill vectors and capability matching
  - Federation and world chain concept
  - The OS metaphor for work
  - Phase roadmap from v1 to platform of platforms

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:55:58 -08:00
Steve Yegge
269dd9c0d3 bd sync: 2025-12-19 15:51:32 2025-12-19 15:51:32 -08:00
Steve Yegge
d1a63ffce6 bd sync: 2025-12-19 15:41:32 2025-12-19 15:41:32 -08:00
Steve Yegge
2e4d247f7d fix(mayor): remove respawn loop from mayor attach
The while true loop didn't work properly. Now gt mayor attach just runs claude directly.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:30:13 -08:00
Steve Yegge
06d8963318 fix(crew): improve Claude detection and add auto-prime hook
- IsClaudeRunning: remove UI marker check that caused false positives
  when Claude output remained in scrollback after exit
- Add .claude/settings.json with SessionStart hook for gt prime

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:28:14 -08:00
Steve Yegge
479baec64a feat(beads): update ReadyWithType to use bd --type flag (gt-ktf3)
Uses server-side filtering for merge-request type queries.
Also syncs beads updates from MQ swarm session.
2025-12-19 15:24:26 -08:00
Steve Yegge
3942152d92 fix(crew): exec claude when already in target session 2025-12-19 15:11:49 -08:00
Steve Yegge
f106752149 fix(crew): detect when already in target session, skip attach 2025-12-19 15:09:07 -08:00
Steve Yegge
8e56a075a7 feat(crew): add resume prompt when restarting Claude
When `gt crew at` detects Claude has exited (shell running), or when
`gt crew restart` is used, now sends a crew-specific prompt after priming:

"Read your mail, act on anything urgent, else await instructions."

This gives crew workers clear direction on resume without requiring
manual prompting.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 15:06:14 -08:00
Steve Yegge
8738fd74a1 feat(mq): add gt mq integration land command (gt-h5n.5)
Implements the 'gt mq integration land <epic>' command that merges an
integration branch to main.

Features:
- Verifies all MRs targeting integration branch are merged (unless --force)
- Merges with --no-ff for clear merge commit
- Runs tests before push (unless --skip-tests)
- Deletes integration branch (local and remote)
- Closes epic with merge commit info
- Rollback on test/push failure
- Dry-run mode (--dry-run)

Also adds to git package:
- MergeNoFF: merge with --no-ff flag
- DeleteRemoteBranch: delete branch on origin
- Reset: reset HEAD with optional --hard

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:49:09 -08:00
Steve Yegge
8c51347b7c bd sync: closed gt-3x1 and children 2025-12-19 14:48:58 -08:00
Steve Yegge
e11bc92361 chore: sync beads after closing gt-3x1.4 2025-12-19 14:48:54 -08:00
Steve Yegge
7a6f87ebb7 feat(refinery): implement merge failure handling with labels and notifications
Add comprehensive failure handling for merge queue:
- Add FailureType enum with conflict, tests_fail, build_fail, flaky_test, push_fail
- Add handleFailure function that updates beads issue with labels and assignee
- Add notifyWorkerFailure for type-specific failure notifications
- Add retry logic for flaky tests (configurable via retry_flaky_tests)
- Add pushWithRetry with exponential backoff for transient push failures
- Add label support to beads UpdateOptions (AddLabels, RemoveLabels, SetLabels)

Failure actions by type:
- conflict: needs-rebase label, assign to worker
- tests_fail/build_fail: needs-fix label, assign to worker
- flaky_test: retry once, then treat as tests_fail
- push_fail: retry with backoff, needs-retry label

Closes gt-3x1.4

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:30 -08:00
Steve Yegge
a216092c38 feat(refinery): implement Beads-native merge queue processing (gt-3x1)
Replace branch discovery with Beads queue in Engineer:
- ProcessMR: full merge execution (fetch, conflict check, merge, test, push)
- handleSuccess: close MR and source issue, notify worker
- handleFailure: reopen MR, assign to worker, send failure notification
- Helper functions: gitRun, gitOutput, runTests, pushWithRetry, checkConflicts

The Engineer now:
- Polls for merge-requests via bd ready --type=merge-request
- Claims MRs by setting status to in_progress
- Processes merges with conflict detection and test execution
- Closes MRs and source issues on success
- Assigns back to workers on failure with appropriate notifications

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:24 -08:00
Steve Yegge
349205eda1 feat(refinery): implement handleSuccess for merge queue
Implement success handling for the merge queue Engineer:
- Add handleSuccess method that handles successful merge completion
- Update MR body with merge_commit SHA and close_reason
- Close MR with 'merged' reason
- Close source issue with reference to MR ID
- Delete source branch if delete_merged_branches is configured
- Add DeleteRemoteBranch method to git package
- Add git client to Engineer struct
- Add tests for new functionality

Closes gt-3x1.5

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:48:13 -08:00
Steve Yegge
8b853ac4d2 bd sync: merge queue swarm launched, molecules complete 2025-12-19 14:47:08 -08:00
Steve Yegge
959912b6d4 feat(refinery): implement merge execution with test and push retry (gt-3x1.3)
Implement the actual merge execution in Engineer.ProcessMR:
- ExecuteMerge function: checkout target, merge with --no-ff, run tests
- pushWithRetry: exponential backoff retry logic (3 retries, 1s base delay)
- runTests: execute configurable test command
- gitRun/gitOutput: helper methods for git operations

When tests fail, resets to HEAD~1 before returning failure.
When push fails after retries, resets to HEAD~1 before returning failure.
Conflict detection during merge triggers automatic merge --abort.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:46:39 -08:00
Steve Yegge
f37cae33df bd sync: 2025-12-19 14:45:05 2025-12-19 14:46:36 -08:00
Steve Yegge
9a55153450 feat(molecule): add gt molecule seed command (gt-dd8s)
Adds the gt molecule seed subcommand that creates built-in molecule
definitions (engineer-in-box, quick-fix, research) in the beads database.

- Brings molecule.go from main (with list, show, parse, instantiate, instances)
- Adds builtin_molecules.go with 3 built-in workflow templates
- SeedBuiltinMolecules() writes directly to JSONL to bypass bd CLI type validation
- Molecules use well-known IDs (mol-engineer-in-box, mol-quick-fix, mol-research)
- Command is idempotent - skips molecules that already exist

Note: bd CLI does not yet support molecule as a valid issue type.
Filed beads-1 to add molecule type support. Until then, use bd --no-db.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:42:10 -08:00
Steve Yegge
5e563564e3 chore: sync beads after gt-vc1n close 2025-12-19 14:26:47 -08:00
Steve Yegge
4d0492fdf6 feat(tmux): add per-rig color themes and dynamic status line (gt-vc1n)
Add tmux status bar theming for Gas Town sessions:

- Per-rig color themes auto-assigned via consistent hashing
- 10 curated dark themes (ocean, forest, rust, plum, etc.)
- Special gold/dark theme for Mayor
- Dynamic status line showing current issue and mail count
- Mayor status shows polecat/rig counts

New commands:
- gt theme --list: show available themes
- gt theme apply: apply to running sessions
- gt issue set/clear: agents update their current issue
- gt status-line: internal command for tmux refresh

Status bar format:
- Left: [rig/worker] role
- Right: <issue> | <mail> | HH:MM

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 14:17:39 -08:00
Steve Yegge
e859938545 feat(polecat): add beads environment and sync for worktrees
CRITICAL FIX: Polecats (git worktrees) now get proper beads environment:
- BEADS_DIR: Points to rig canonical beads directory
- BEADS_NO_DAEMON=1: Prevents daemon from corrupting worktree beads
- BEADS_AGENT_NAME: Identity for beads conflict resolution

Also adds:
- bd sync on spawn (before and after issue assignment)
- bd sync on session stop (before killing)
- gt polecat sync command for manual beads sync
- Polecat role prompt explaining two-level beads architecture
2025-12-19 13:11:03 -08:00
Steve Yegge
8f1b7b0bc6 feat: add crew worker identity context for max
Updated CLAUDE.md to include:
- Crew worker role and identity (gastown/max)
- Gas Town architecture diagram showing crew position
- Key commands for mail, beads, and work management
- Session end checklist with handoff protocol

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:57:02 -08:00
Steve Yegge
f6d7da3284 feat(mq): add integration status command (gt-h5n.6)
Implement 'gt mq integration status <epic>' command that displays:
- Integration branch name and creation date
- Commits ahead of main
- Merged MRs (closed, targeting integration branch)
- Pending MRs (open, targeting integration branch)

Also adds git helpers for BranchCreatedDate and CommitsAhead.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:53:04 -08:00
Steve Yegge
8de4010d2c Merge polecat/Dementus: harness design documentation (gt-cr9) 2025-12-19 12:50:46 -08:00
Steve Yegge
8f0723d846 fix(docs): correct mermaid diagram to show polecats as worktrees not clones
The rig-level mermaid diagram incorrectly labeled polecats as git clone
when they are actually git worktrees from Mayor's clone. This now matches
the ASCII diagram which correctly describes them as worktrees.

🤖 Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:49:29 -08:00
Steve Yegge
1447632a32 Merge polecat/Crow: eliminate state.json, use beads assignee (gt-qp98) 2025-12-19 12:47:56 -08:00
Steve Yegge
403872bcca Merge polecat/Corpus: auto-target integration branch for epic children (gt-h5n.7) 2025-12-19 12:47:28 -08:00
Steve Yegge
bbff3b2144 refactor(polecat): eliminate state.json, use beads assignee for state
Replace polecat state.json with beads assignee field for state management:

- Remove state.json read/write from polecat.Manager
- Add loadFromBeads() to derive state from issue.assignee field
- Update AssignIssue() to set issue.assignee in beads
- Update ClearIssue() to clear assignee from beads
- Update SetState() to work with beads or gracefully degrade
- Add ListByAssignee and GetAssignedIssue to beads package
- Update spawn to create beads issues for free-form tasks
- Update tests for new beads-based architecture

State derivation:
- Polecat exists: worktree directory exists
- Polecat assigned: issue.assignee = 'rig/polecatName'
- Polecat working: issue.status = open/in_progress
- Polecat done: issue.status = closed or no assignee

Fixes: gt-qp98

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:47:15 -08:00
Steve Yegge
9660fd414b feat(mq): auto-target integration branch for epic children
When 'gt mq submit' is called:
1. Parse source issue from branch
2. Check if issue has a parent epic
3. Check if integration/<epic> branch exists
4. If yes: set target=integration/<epic>
5. If no: set target=main

The --epic flag still works for explicit targeting.

Closes gt-h5n.7

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:47:12 -08:00
Steve Yegge
848e2dbf90 docs: update paths from ~/ai/ to ~/gt/ (gt-dq3)
- Update mermaid diagram in architecture.md
- Add Harness section to Core Concepts
- Update federation-design.md examples
- Add PGT/GGT historical context section to harness.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:46:16 -08:00
Steve Yegge
9e66f1880c Merge polecat/Smeg: document harness concept (gt-1j6)
Kept existing harness.md from main as it is more comprehensive.
Polecat/Smeg version was redundant.
2025-12-19 12:45:42 -08:00
Steve Yegge
4048cdc373 fix(lint): resolve all errcheck warnings
Fix ~50 errcheck warnings across the codebase:

- Add explicit `_ =` for intentionally ignored error returns (cleanup,
  best-effort operations, etc.)
- Use `defer func() { _ = ... }()` pattern for defer statements
- Handle tmux SetEnvironment, KillSession, SendKeysRaw returns
- Handle mail router.Send returns
- Handle os.RemoveAll, os.Rename in cleanup paths
- Handle rand.Read returns for ID generation
- Handle fmt.Fprint* returns when writing to io.Writer
- Fix for-select with single case to use for-range
- Handle cobra MarkFlagRequired returns

All tests pass. Code compiles without errors.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:44:42 -08:00
Steve Yegge
3a477f673c feat(daemon): add adaptive backoff for heartbeat pokes
Implements per-agent backoff tracking to reduce noise for busy agents:
- AgentBackoff type tracks interval, miss count, and last activity
- BackoffManager manages state across all agents
- Geometric backoff strategy (1.5x factor, 10min cap)
- Integrates with keepalive to skip pokes when agents are fresh
- Resets backoff immediately when activity detected

Closes gt-8bx

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 12:44:05 -08:00