Commit Graph

1835 Commits

Author SHA1 Message Date
Steve Yegge
cf70114592 docs: Add operational state design (Boot, events, degraded mode)
New doc covering:
- Events as state transitions (type: event beads)
- Labels-as-state pattern for fast queries
- Boot: daemon entry point dog for Deacon triage
- Degraded mode (no-tmux operation)

Related issues:
- gt-rwd5j: Implement Boot
- bd-ecmd: Add type: event
- bd-irah: Add refs field
- bd-31ae: Document labels-as-state

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 15:17:26 -08:00
Steve Yegge
9f165d7c82 Fix SQL injection vulnerability in convoy.go (gt-frvun)
Add input validation for convoyID before using it in SQL query.
Issue IDs must match ^[a-zA-Z0-9_-]+$ to prevent injection attacks.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 14:14:46 -08:00
Steve Yegge
d98daed901 Add gt convoy create/status/list commands (gt-frvun)
Implements CLI for convoy management in Gas Town:
- gt convoy create <name> [issues...] - Creates convoy in town beads (hq-* prefix)
- gt convoy status [id] - Shows convoy progress and tracked issues
- gt convoy list - Lists all convoys with optional status filter

Convoys track issues across rigs using the 'tracks' relation type
and auto-close when all tracked issues complete.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 13:58:07 -08:00
Steve Yegge
e383243161 bd sync: 2025-12-30 13:56:30 2025-12-30 13:56:30 -08:00
Steve Yegge
80cbada427 bd sync: 2025-12-30 13:43:48 2025-12-30 13:43:48 -08:00
Steve Yegge
6b9ba2362b bd sync: 2025-12-30 13:43:44 2025-12-30 13:43:44 -08:00
Steve Yegge
bb0d248f4d bd sync: 2025-12-30 13:33:39 2025-12-30 13:33:39 -08:00
Steve Yegge
31de4c81d3 bd sync: 2025-12-30 12:56:26 2025-12-30 12:56:26 -08:00
Steve Yegge
9ebc733623 fix: stop writing Gas Town context to polecat CLAUDE.md
Same fix as crew: polecat manager was overwriting project CLAUDE.md with
Gas Town polecat context. Gas Town context is now injected ephemerally via
SessionStart hook (gt prime) only.

Removed installCLAUDETemplate function and associated tests.
2025-12-30 12:01:27 -08:00
Steve Yegge
6c3e59d015 fix: stop writing Gas Town context to CLAUDE.md
gt crew add was overwriting project CLAUDE.md with Gas Town crew context.
This caused Gas Town internals to leak into project repos when workers
committed and pushed.

Gas Town context is now injected ephemerally via SessionStart hook (gt prime)
only, never written to tracked files.
2025-12-30 11:58:07 -08:00
Steve Yegge
7f94074de0 Add federation architecture doc (gt-6r18e) 2025-12-30 11:09:44 -08:00
Steve Yegge
0b331cbf64 bd sync: 2025-12-30 11:08:56 2025-12-30 11:09:07 -08:00
Steve Yegge
3c56f2c1dd Refactor Deacon patrol to detect→dispatch pattern (gt-0x5og.4)
Major changes to mol-deacon-patrol.formula.toml v4:
- Add DOG_DONE message handling in inbox-check step
- Add dog-pool-maintenance step for idle dog availability
- Change orphan-check to detect-only (dispatches to dogs via sling)
- Change session-gc to detect-only (dispatches to dogs via sling)

The Deacon now stays lightweight by detecting issues and dispatching
heavy work to dogs rather than executing inline. This prevents context
bloat and keeps patrol cycles fast.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 11:02:49 -08:00
Steve Yegge
f1b7b953b8 bd sync: 2025-12-30 11:01:44 2025-12-30 11:01:44 -08:00
Steve Yegge
f64cec2853 bd sync: 2025-12-30 10:53:30 2025-12-30 10:57:34 -08:00
Steve Yegge
d21dd0a0b0 bd sync: 2025-12-30 10:41:14 2025-12-30 10:57:34 -08:00
Steve Yegge
3dec0d0072 bd sync: 2025-12-30 10:41:05 2025-12-30 10:57:34 -08:00
Steve Yegge
75ee851813 bd sync: 2025-12-30 10:36:59 2025-12-30 10:57:34 -08:00
Steve Yegge
3fa1911f27 bd sync: 2025-12-30 10:36:11 2025-12-30 10:57:34 -08:00
Steve Yegge
4db2696a9f bd sync: 2025-12-30 10:35:50 2025-12-30 10:57:34 -08:00
Steve Yegge
5b28ba2e4b bd sync: 2025-12-30 10:34:05 2025-12-30 10:57:34 -08:00
Steve Yegge
637f38edca Remove os.Exit() from library code (gt-fm75)
Refactor to return errors instead of calling os.Exit() directly:
- Add SilentExitError type for commands that signal status via exit code
- Update mail.go runMailPeek() and runMailCheck() to return errors
- Change Execute() to return int exit code instead of calling os.Exit()
- Move os.Exit() call to main() where it belongs

This improves testability, enables graceful shutdown, and follows Go
conventions for library code.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:54:29 -08:00
Steve Yegge
7fdee48807 Add gt sling support for deacon/dogs target (gt-0x5og.3)
Extends gt sling to dispatch work to dogs (Deacon helper workers):
- gt sling <work> deacon/dogs - Auto-dispatch to idle dog from pool
- gt sling <work> deacon/dogs/alpha - Dispatch to specific dog
- Pool management: --create flag to spawn dogs if pool is empty
- Dog state tracking (marks dog as working on dispatch)

New functions:
- IsDogTarget: Detect dog target patterns
- DispatchToDog: Find/spawn dog and prepare for work
- generateDogName: Create unique names for new dogs

Dogs are reusable workers for infrastructure tasks.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:53:40 -08:00
Steve Yegge
5b9983f261 Sync beads from main (gt-m5w4g.2) 2025-12-30 10:48:00 -08:00
Steve Yegge
96ffbf0188 Implement Witness-Refinery protocol handlers (gt-m5w4g.2)
Add internal/protocol/ package with handlers for:
- MERGE_READY (witness→refinery): worker done, branch ready
- MERGED (refinery→witness): merge succeeded, cleanup ok
- MERGE_FAILED (refinery→witness): merge failed, needs rework
- REWORK_REQUEST (refinery→witness): rebase needed due to conflicts

Package structure:
- types.go: Protocol message types and payload structs
- messages.go: Message builders and body parsers
- handlers.go: Handler interface and registry for dispatch
- witness_handlers.go: DefaultWitnessHandler implementation
- refinery_handlers.go: DefaultRefineryHandler implementation
- protocol_test.go: Comprehensive test coverage

Also updated docs/mail-protocol.md with:
- MERGE_FAILED and REWORK_REQUEST message type documentation
- Merge failure and rebase required flow diagrams
- Reference to internal/protocol/ package

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:48:00 -08:00
Steve Yegge
9968aceddb Add @group dynamic resolution in mail router (gt-tgy1v)
Implements @group address resolution for mail routing:
- @rig/<rigname>: All agents in a rig
- @town: All town-level agents (mayor, deacon)
- @witnesses, @dogs, @refineries: Role-based groups
- @crew/<rig>, @polecats/<rig>: Role+rig scoped groups
- @overseer: Human operator (uses overseer.json)

Resolution uses `bd list --type=agent` queries with
description filtering. Fan-out at send time creates
individual messages for each resolved recipient.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:47:05 -08:00
Steve Yegge
32d23d1e38 Add gt dog CLI commands for managing Deacon helper workers (gt-0x5og.1)
Implements dog management commands:
- gt dog add <name>: Create dog in kennel with multi-rig worktrees
- gt dog remove <name>: Retire dog, cleanup worktrees
- gt dog list: Show the pack with status
- gt dog call [name]: Wake idle dog(s)
- gt dog status [name]: Show detailed dog state

Dogs are reusable workers managed by the Deacon for infrastructure tasks.
Each dog gets worktrees into all configured rigs (gastown, beads, etc.).

Includes internal/dog package with Manager and state handling (from gt-0x5og.2).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:45:31 -08:00
Steve Yegge
fa2997c5ca Implement Polecat-Witness protocol handlers (gt-m5w4g.3)
Add protocol message parsing and handlers for polecat→witness communication:
- POLECAT_DONE: Parse completion messages, create cleanup wisps
- HELP: Parse help requests, assess if Witness can help or escalate to Mayor
- MERGED: Parse refinery merge confirmations
- LIFECYCLE:Shutdown: Handle daemon-triggered shutdowns
- SWARM_START: Parse batch work initialization

Files added:
- internal/witness/protocol.go: Message classification and parsing
- internal/witness/handlers.go: Handler implementations with wisp/mail integration
- internal/witness/protocol_test.go: Unit tests for all parsing functions

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:44:34 -08:00
Steve Yegge
907eba7194 Instrument gt commands to emit events to activity feed (gt-7aw1m)
Add events.LogFeed calls to the following gt commands:
- nudge.go: Log TypeNudge events when nudging agents
- unsling.go: Log TypeUnhook events when removing work from hooks
- up.go: Log TypeBoot events when starting Gas Town services
- down.go: Log TypeHalt events when stopping Gas Town services
- stop.go: Log TypeKill events when stopping polecat sessions
- polecat_spawn.go: Log TypeSpawn events when spawning polecats

Also add helper functions to events package:
- UnhookPayload: Creates payload for unhook events
- KillPayload: Creates payload for kill events
- HaltPayload: Creates payload for halt events

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:43:34 -08:00
Steve Yegge
3cd849e981 docs: Add gt swarm documentation (gt-1z4m)
Add comprehensive documentation for the gt swarm feature:
- New docs/swarm.md with full guide to swarm lifecycle, commands, and workflows
- Update reference.md with swarm CLI commands in "Swarm Management" section
- Add architecture note explaining swarm coordination model

The swarm package was fully implemented but undocumented.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:41:02 -08:00
Steve Yegge
c6a9201b5e Add infrastructure formulas for dog tasks (gt-0x5og.5)
Create five formulas for dog-executed infrastructure tasks:
- mol-convoy-cleanup: Archive convoy, notify overseer
- mol-dep-propagate: Cross-rig dependency resolution
- mol-digest-generate: Daily digest for overseer
- mol-orphan-scan: Find and reassign orphaned work
- mol-session-gc: Clean stale sessions

Each formula follows the standard TOML structure with:
- Description and dog contract
- Step-by-step workflow with dependencies
- Variable definitions
- Squash configuration for digests

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:39:36 -08:00
Steve Yegge
ddf5b5a9f4 Add Dog infrastructure package for Deacon helper workers (gt-0x5og.2)
Dogs are reusable workers managed by the Deacon for cross-rig infrastructure
tasks. Unlike polecats (single-rig, ephemeral), dogs have worktrees into
multiple rigs and persist between tasks.

Key components:
- internal/dog/types.go: Dog struct, State enum, DogState JSON schema
- internal/dog/manager.go: Manager with Add/Remove/List/Get/Refresh operations
- internal/dog/manager_test.go: Unit tests

Features:
- Multi-rig worktrees: Each dog gets a worktree per configured rig
- State tracking: .dog.json with idle/working state, last-active, work assignment
- Worktree refresh: Recreate stale worktrees with fresh branches
- Branch cleanup: Remove orphaned dog branches across all rigs

Directory structure: ~/gt/deacon/dogs/<name>/
  - <rig>/ (worktree into each rig: gastown/, beads/, etc.)
  - .dog.json (state file)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 10:38:18 -08:00
Steve Yegge
5204dd0eb4 feat: Allow remove and restart to take multiple crew names 2025-12-30 10:29:53 -08:00
Steve Yegge
f492aac19b feat: Allow starting multiple crew members at once
gt crew start beads/grip beads/fang beads/wolf now works
2025-12-30 10:23:45 -08:00
Steve Yegge
afb7b85b35 bd sync: 2025-12-30 10:21:48 2025-12-30 10:21:48 -08:00
Steve Yegge
79a6b249a6 bd sync: 2025-12-30 10:20:59 2025-12-30 10:21:37 -08:00
Steve Yegge
be979c66a2 feat: Use base36 encoding for shorter polecat branch names 2025-12-30 10:20:51 -08:00
Steve Yegge
08d966a601 Add patrol hygiene: inbox cleanup for Witness/Refinery/Deacon (gt-h5e0)
Each patrol formula now includes:
- Explicit archive instructions after processing messages
- New patrol-cleanup step for end-of-cycle inbox hygiene
- Deacon: log rotation and state.json pruning

Changes:
- mol-witness-patrol v2: POLECAT_STARTED archive, patrol-cleanup step
- mol-refinery-patrol v3: MERGE_READY archive after merge, patrol-cleanup step
- mol-deacon-patrol v3: log-maintenance step, patrol-cleanup step

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 09:59:09 -08:00
Steve Yegge
a7831ba11d Add human escalation path with severity levels (gt-1z3z)
Implements structured escalation channel for Gas Town:
- gt escalate command with CRITICAL/HIGH/MEDIUM severity levels
- Mayor startup check for pending escalations
- Escalation beads with tag for audit trail
- Mail routing to overseer with priority mapping
- Documentation in docs/escalation.md

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 09:58:14 -08:00
Steve Yegge
ab30b974a4 Design wisp squash architecture: cadences, templates, retention (gt-cekg)
Adds comprehensive design for how wisps squash to digests:
- Cadences: patrol wisps squash per-cycle, work wisps on completion
- Templates: structured formats for patrol and work digests, formula-defined
- Retention: 30d active, 1yr archive, weekly/monthly rollups
- Activity feed integration for observability

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 07:07:28 -08:00
Steve Yegge
3889d31713 Add static mailing list support (list:name syntax) (gt-2rfvq)
Implement static mailing list expansion for the mail system:

- Add list:name address syntax (e.g., list:oncall)
- Load lists from ~/gt/config/messaging.json
- Fan-out delivery: each list member gets their own message copy
- Clear error handling for unknown list names
- Add tests for list detection, parsing, and expansion
- Update gt mail send help text with list:name documentation
- Show recipients in output when sending to a list

Example:
  gt mail send list:oncall -s "Alert" -m "System down"
  # Expands to: mayor/, gastown/witness
  # Creates 2 message copies

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 06:57:37 -08:00
Steve Yegge
dd3391bb68 bd sync: 2025-12-30 06:47:27 2025-12-30 06:47:27 -08:00
Steve Yegge
c1e2257497 bd sync: 2025-12-30 06:45:27 2025-12-30 06:45:46 -08:00
Steve Yegge
800e218b7c bd sync: 2025-12-30 02:07:44 2025-12-30 06:45:46 -08:00
Steve Yegge
5329865332 bd sync: 2025-12-30 02:06:28 2025-12-30 06:45:46 -08:00
Steve Yegge
4389d4fcd2 bd sync: 2025-12-30 01:54:04 2025-12-30 06:45:46 -08:00
Steve Yegge
9acb275526 bd sync: 2025-12-30 01:52:52 2025-12-30 06:45:46 -08:00
Steve Yegge
b0c00b78e3 bd sync: 2025-12-30 01:51:51 2025-12-30 06:45:46 -08:00
Steve Yegge
437d42c7fa ZFC #4: Replace daemon identity parsing with agent self-registration
Implements role-based lifecycle configuration where agent types self-register
via role beads instead of hardcoded identity string parsing in the daemon.

Changes:
- Add RoleConfig struct with lifecycle fields (session_pattern, work_dir_pattern,
  needs_pre_sync, start_command, env_vars)
- Add ParseRoleConfig/FormatRoleConfig/ExpandRolePattern to beads package
- Add role bead ID helpers (RoleBeadID, MayorRoleBeadID, etc.)
- Refactor daemon to use single parseIdentity function as ONLY place where
  identity strings are parsed
- Daemon now looks up role beads to get lifecycle config, with fallback to
  defaults when role bead is missing or has no config
- Updated all role beads (mayor, deacon, witness, refinery, crew, polecat)
  with structured lifecycle configuration fields
- Add comprehensive unit tests for RoleConfig parsing and expansion

This makes the daemon ZFC-compliant by trusting what agents self-report in
their role beads rather than encoding agent-specific knowledge in Go code.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 02:13:14 -08:00
Steve Yegge
ede5406d36 ZFC #5: Move merge/conflict decisions from Go to Refinery agent
Remove decision-making logic from Go code and document agent responsibility:

- ProcessMR() now returns error indicating agent handles processing
- Foreground mode deprecated with message directing to background mode
- Retry() no longer calls ProcessMR (agent picks up retried MRs)
- Added ZFC compliance section to refinery role template
- Marked unused helper functions as deprecated (runTests, getMergeConfig, pushWithRetry)

The Refinery agent (Claude) now:
- Runs git commands directly (fetch, checkout, merge, push)
- Detects conflicts and decides: retry, notify polecat, escalate
- Runs tests and decides: proceed, rollback, retry
- Makes all engineering decisions based on command output

Go code provides only primitives: queue listing, status, mail notifications.

(gt-sxa64)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 02:12:43 -08:00