Commit Graph

260 Commits

Author SHA1 Message Date
Steve Yegge
caef0e04b2 Unify gt prime to call bd prime and mail check
gt prime now internally runs:
- bd prime (beads workflow context)
- gt mail check --inject (mail injection)

This allows a single SessionStart hook to provide complete agent context.
Also added PreCompact and UserPromptSubmit hooks to settings.json.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:13:19 -08:00
Steve Yegge
6f0d838939 Merge remote-tracking branch 'origin/main' 2025-12-19 18:28:38 -08:00
Steve Yegge
6e0f1a96d1 Merge remote-tracking branch 'origin/polecat/Nux' 2025-12-19 18:28:02 -08:00
Steve Yegge
71918a1be4 Merge remote-tracking branch 'origin/polecat/Immortan'
# Conflicts:
#	internal/refinery/engineer.go
#	internal/refinery/engineer_test.go
2025-12-19 18:27:51 -08:00
Steve Yegge
4c05af3351 bd sync: merge consolidation 2025-12-19 18:27:27 -08:00
Steve Yegge
23cf29df9c Merge remote-tracking branch 'origin/polecat/Slit'
# Conflicts:
#	internal/daemon/lifecycle_test.go
#	internal/refinery/engineer.go
2025-12-19 18:27:12 -08:00
Steve Yegge
3dca0eb4c9 Add mol-bootstrap molecule for Gas Town installation
Defines a multi-step workflow for bootstrapping a new Gas Town installation:
- locate-harness: Interactive harness location selection
- create-harness: Directory structure creation
- setup-rigs: Rig configuration and cloning
- build-gt: Go binary compilation
- install-paths: PATH configuration
- init-beads: Beads database initialization
- sync-beads: Remote sync and doctor fixes
- verify: Installation verification

Note: Requires bd to support 'molecule' issue type (see gt-qn4l)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:26:24 -08:00
Steve Yegge
4cecebd91e Merge remote-tracking branch 'origin/polecat/Ace-deacon' 2025-12-19 18:10:17 -08:00
Steve Yegge
f54162eae3 bd sync: 2025-12-19 18:09:46 2025-12-19 18:09:46 -08:00
Steve Yegge
9ac76f9b3f feat: add Deacon role context template
Creates deacon.md.tmpl for the health-check orchestrator role:
- Architecture position (between daemon and Mayor/Witnesses)
- Wake cycle instructions (heartbeat, mail check, health scan)
- Session patterns for all agent types
- Lifecycle request handling (cycle, restart, shutdown)
- Responsibilities and escalation protocols

Updates templates package to include deacon in role list.

Closes: gt-5af.1

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 18:09:35 -08:00
Steve Yegge
b69520b911 bd sync: 2025-12-19 18:00:52 2025-12-19 18:00:52 -08:00
Steve Yegge
c442ae1cd4 Merge branch 'main' of github.com:steveyegge/gastown 2025-12-19 18:00:15 -08:00
Steve Yegge
89520a5854 Merge remote-tracking branch 'origin/polecat/Scabrous'
# Conflicts:
#	docs/architecture.md
#	docs/harness.md
#	internal/beads/builtin_molecules.go
#	internal/cmd/mail.go
#	internal/cmd/molecule.go
#	internal/cmd/mq.go
#	internal/git/git.go
#	internal/mail/router.go
2025-12-19 17:59:36 -08:00
Steve Yegge
40691126e4 Add bootstrap documentation for new Gas Town installations
Documents the full process for bootstrapping a Gas Town from a harness
repository, including Go installation, gt binary build, rig population,
and beads initialization.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:55:23 -08:00
Steve Yegge
316b134553 bd sync: 2025-12-19 17:53:01 2025-12-19 17:53:01 -08:00
Steve Yegge
d0ac62230b bd sync: 2025-12-19 17:49:22 2025-12-19 17:49:22 -08:00
Steve Yegge
a8df0ac93b bd sync: 2025-12-19 17:42:46 2025-12-19 17:42:46 -08:00
Steve Yegge
3a5f542cc9 Merge remote-tracking branch 'origin/polecat/Doof' 2025-12-19 17:42:05 -08:00
Steve Yegge
869d6fbffb bd sync: 2025-12-19 17:35:51 2025-12-19 17:35:51 -08:00
Steve Yegge
50accc9cb2 feat(mail): add deacon/ identity support
Add deacon/ as a town-level mail identity alongside mayor/.
Both addressToIdentity() and identityToAddress() now handle
deacon/deacon/ consistently with trailing slash preservation.

Tested with bd mail send deacon/ and bd mail inbox --identity deacon/

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:54 -08:00
Steve Yegge
33455e6d9c feat(deacon): add heartbeat mechanism for daemon coordination (gt-5af.6)
Add deacon package with heartbeat read/write helpers:
- Heartbeat struct with Timestamp, Cycle, LastAction, health counts
- WriteHeartbeat/ReadHeartbeat for persistence to deacon/heartbeat.json
- IsFresh/IsStale/IsVeryStale for age checks
- ShouldPoke to determine if daemon should wake the Deacon
- Touch/TouchWithAction convenience functions

The Deacon writes heartbeat on each wake cycle. The Go daemon reads it
to decide whether to poke the Deacon (only if very stale >5 minutes).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:53 -08:00
Steve Yegge
178bebee40 refactor: update lifecycle mail targets from daemon/ to deacon/ (gt-5af.5)
Update all code and documentation to use deacon/ instead of daemon/
for lifecycle mail targets:

- internal/cmd/handoff.go: getManager() returns deacon/ for Mayor/Witness
- internal/daemon/lifecycle.go: ProcessLifecycleRequests uses deacon/ inbox
- docs/architecture.md: update all references in lifecycle docs
- scripts/mayor-respawn-daemon.sh: use BD_IDENTITY=deacon for mail commands

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:26:16 -08:00
Steve Yegge
5102cee9ad feat(cmd): add gt deacon start/stop/status commands (gt-5af.2)
Add CLI commands for managing the Deacon session, following the same
pattern as the Mayor commands:
- gt deacon start: Start the Deacon tmux session
- gt deacon stop: Stop the session with graceful shutdown
- gt deacon status: Check if session is running
- gt deacon attach: Attach to session (auto-starts if needed)
- gt deacon restart: Restart Claude within the session

The Deacon is the hierarchical health-check orchestrator that monitors
Mayor and Witnesses, handles lifecycle requests, and keeps Gas Town running.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 17:25:24 -08:00
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