Commit Graph

283 Commits

Author SHA1 Message Date
Steve Yegge
da12531d3d feat: add gt up/down commands and daemon doctor check
New commands:
- `gt up` - Idempotent boot command that brings up all services:
  Daemon, Deacon, Mayor, and Witnesses for all rigs
- `gt down` - Graceful shutdown of all services

Doctor improvements:
- New daemon check verifies daemon is running
- Fixable with `gt doctor --fix` to auto-start daemon

The system can run degraded (any services down) but `gt up` ensures
a fully operational Gas Town with one idempotent command.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 02:26:09 -08:00
Steve Yegge
1554380228 feat(deacon): improve timing and add heartbeat command
Timing changes for more relaxed poke intervals:
- Daemon heartbeat: 60s → 5 minutes
- Backoff base: 60s → 5 minutes
- Backoff max: 10m → 30 minutes
- Fresh threshold: <2min → <5min
- Stale threshold: 2-5min → 5-15min
- Very stale threshold: >5min → >15min

New command:
- `gt deacon heartbeat [action]` - Touch heartbeat file easily

Template rewrite:
- Clearer wake/sleep model
- Documents wake sources (daemon poke, mail, timer callbacks)
- Simpler rounds with `gt deacon heartbeat` instead of bash echo
- Mentions plugins as optional maintenance tasks
- Explains timer callbacks pattern

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 02:12:21 -08:00
Steve Yegge
348a7d0525 feat(deacon): make deacon the system heartbeat with auto-start
Robustness improvements for the Deacon:

- Add DeaconTheme (purple/silver ecclesiastical theme)
- Apply theme to deacon sessions like mayor/witness
- Daemon now auto-starts deacon if not running
- Daemon pokes deacon instead of directly poking mayor/witnesses
- Deacon is responsible for monitoring mayor and witnesses

The daemon is a "dumb scheduler" that keeps the deacon alive.
The deacon (Claude agent) has the intelligence to understand
context and take remedial action when agents are unhealthy.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 02:00:54 -08:00
Steve Yegge
a37fac2c3c docs(refinery): Add sequential rebase protocol to template
Adds documentation for the critical pileup processing protocol:
- Process ONE branch at a time
- Rebase each on current main before merging
- Push immediately after each merge
- Main moves forward, next branch must rebase on NEW main

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 01:57:47 -08:00
Steve Yegge
a000b40ed4 fix: crew workers now get proper crew context via templates
Updated crew manager's createClaudeMD() to use the templates package
instead of hardcoded content. This ensures crew workers get the
comprehensive crew.md.tmpl context instead of a minimal stub.

Changes:
- Import templates package in crew/manager.go
- createClaudeMD now renders crew template with proper RoleData
- Added createClaudeMDFallback for graceful degradation
- Fallback uses correct gt commands instead of outdated town commands

The crew.md.tmpl template provides:
- Full Gas Town architecture explanation
- Crew-specific responsibilities and differences from polecats
- Complete command reference with gt/bd commands
- Session cycling and handoff instructions
- Context-aware workspace paths

Closes: gt-unrd

Generated with Claude Code

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 01:51:26 -08:00
Steve Yegge
d154533d49 feat(refinery): Convert Refinery from Go polling to Claude agent
The Refinery now runs as a Claude agent in a tmux session instead of
a Go-based polling loop. This aligns it with how polecats work and
enables intelligent MR processing.

Changes:
- Modified refinery.Start() to spawn Claude session (not gt refinery --foreground)
- Added gt refinery attach command for interactive access to refinery session
- Updated refinery.md.tmpl with comprehensive Claude agent instructions
- Added startup directive in gt prime for refinery role

The --foreground mode is preserved for backwards compatibility but the
default behavior now launches a Claude agent that can review diffs,
run tests, handle conflicts, and notify workers via mail.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 01:45:20 -08:00
Steve Yegge
1a25259932 feat(cmd): add gt agents command for session switching
Adds a popup menu showing core Gas Town agents (Mayor, Deacon,
Witnesses, Refineries, Crew) grouped by rig with color coding.
Polecats are hidden by default (use -a to include).

Usage:
  gt agents      - show popup menu
  gt agents list - text output
  gt ag -a       - include polecats

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 01:21:31 -08:00
Steve Yegge
b9c99e854a Consolidate @AGENTS.md into CLAUDE.md pattern
- Replace @AGENTS.md with stub AGENTS.md
- Stub redirects to CLAUDE.md for full context

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 00:40:40 -08:00
Steve Yegge
f43c01de4e docs: update public positioning for Gas Town
- Rewrite vision.md with enterprise cognitive processing framing
- Expand README with comprehensive project overview
- Remove internal strategic references from merge-queue-design.md
- Position Gas Town as "IDE of 2026" for AI agent orchestration

Key messaging:
- Enterprise-grade cognitive processing machine
- Molecules as structured workflow guardrails
- Nondeterministic idempotence for crash recovery
- Beads as unified control/data plane
- Hierarchical auditability and observability

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-20 00:21:18 -08:00
Steve Yegge
71d313ed60 Fix mail read auto-ack and add Mayor startup directive
- Remove auto-ack on mail read so handoff messages persist
- Add STARTUP PROTOCOL directive for Mayor and Polecat roles
- Agents now get explicit instructions to check in on startup

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 22:38:10 -08:00
Steve Yegge
7978b395cd Merge remote-tracking branch 'origin/polecat/polecat-02' 2025-12-19 22:18:06 -08:00
Steve Yegge
be7369ee2e Merge remote-tracking branch 'origin/polecat/polecat-01' 2025-12-19 22:18:02 -08:00
Steve Yegge
5622abbdfe feat(spawn): Replace tmux injection with persistent mail-based work assignment (ga-yp3)
- gt spawn now sends work assignment to polecat inbox instead of tmux injection
- Add --identity flag to gt mail inbox and gt mail check
- Add --force flag to gt spawn to override existing unread mail
- Update polecat template with startup protocol for reading inbox
- Fix pre-existing lint issue in start.go

The new flow is more reliable:
1. Spawn sends work assignment mail to polecat inbox
2. Polecat starts and runs gt prime
3. gt prime automatically runs gt mail check --inject
4. Polecat reads work assignment from inbox

Benefits:
- Persistence across session restarts
- No racing against Claude initialization
- Audit trail in beads
- Edge case handling for existing unread mail

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 22:07:38 -08:00
Steve Yegge
7b76ffee4c Add mol-polecat-work built-in molecule
Defines the standard polecat work lifecycle molecule with 8 steps:
- load-context: Load context and verify assignment
- implement: Do the work, file discovered issues
- self-review: Review changes for bugs and issues
- verify-tests: Run tests, add new ones as needed
- rebase-main: Rebase against main
- submit-merge: Submit to merge queue
- update-handoff: Update handoff state
- request-shutdown: Request witness termination

This molecule enables nondeterministic idempotence for polecat work.
Crash recovery is automatic - restart reads molecule state and continues
from the last completed step.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 22:01:17 -08:00
Steve Yegge
900a440ce8 feat(namepool): Add themed name pools for polecats
Polecats now get themed names from the Mad Max universe by default
(furiosa, nux, slit, etc.) instead of generic polecat-01, polecat-02.

Changes:
- Add NamepoolConfig to config/types.go for per-rig theme configuration
- Update namepool.go with three built-in themes:
  - mad-max (default): furiosa, nux, imperator, etc.
  - minerals: obsidian, quartz, ruby, etc.
  - wasteland: rust, chrome, fury, etc.
- Add gt namepool commands: themes, set, add, reset
- Update manager.go to load namepool config from rig settings

Configuration in .gastown/config.json:
```json
{
  "namepool": {
    "style": "minerals",
    "max_before_numbering": 50
  }
}
```

Issue: beads-rs0

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 21:59:03 -08:00
Steve Yegge
c7e83b1619 Add persistent theme config and fix crew session theming
- Fix crew sessions missing theme application (ConfigureGasTownSession)
- Add theme persistence to .gastown/config.json
- gt theme <name> now saves to config
- gt theme apply reads from config, falls back to hash-based default
- Improve rig detection using GT_RIG env var and path parsing
- gt theme shows whether theme is configured or default

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 20:43:34 -08:00
Steve Yegge
52194a5496 fix(rig): check witness/state.json instead of witness/rig (gm-2ej)
Witnesses don't have git clones like other agents. The detection was
checking for witness/rig which doesn't exist. Now correctly checks for
witness/state.json which is created by AddRig.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 20:23:42 -08:00
Steve Yegge
3e77fadb49 Strengthen molecule documentation: data/control plane blur, operational molecules
Key additions:
- Explain that beads is BOTH data and control plane (intentional blur)
- Add 'Operational Molecules' section with mol-polecat-work, mol-rig-activate, mol-graceful-shutdown examples
- Emphasize 'nondeterministic idempotence' as THE key property enabling autonomous operation
- Show that molecules aren't just for work - they're for any multi-step cognitive process

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 20:11:48 -08:00
Steve Yegge
5cf42f3f8f Add graceful shutdown mode to gt shutdown
gt shutdown --graceful sends ESC to all agents, requests handoff,
waits for them to save state (default 30s), then terminates.

Phases:
1. Send ESC to interrupt agents
2. Send shutdown message requesting handoff
3. Wait for agents to complete (configurable with --wait)
4. Kill all sessions in correct order

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:39:08 -08:00
Steve Yegge
3705b2b5ac Add gt shutdown command to stop all agents
Stops agents in the correct order:
1. Deacon first (so it doesn't restart others)
2. All polecats, witnesses, refineries, crew (gt-* sessions)
3. Mayor last

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:36:32 -08:00
Steve Yegge
5eb1b475d6 Add gt start command to boot Gas Town
Starts Deacon and Mayor in the correct order. Other agents
(Witnesses, Refineries, Polecats) start lazily as needed.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:29:28 -08:00
Steve Yegge
08face5ac3 Add Deacon role to gt prime
Deacon now gets role-specific context plus shared beads/mail context
like all other roles.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-19 19:24:07 -08:00
Steve Yegge
ac16446f83 Remove duplicate DeleteRemoteBranch method
Duplicate introduced during rebase.

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

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