Commit Graph

878 Commits

Author SHA1 Message Date
Steve Yegge
fc38fb35d7 feat(doctor): add orphaned-attachments check (gt-h6eq.3)
Add doctor check to detect handoff beads for agents that no longer exist.
This happens when a polecat worktree is deleted but its handoff bead remains.

- Check: orphaned-attachments
- Warning if: Handoff bead exists for agent that no longer has worktree
- Supports polecats (rig/name), crew (rig/crew/name), mayor, witness, refinery
- Suggests re-sling to active agent or close the molecule

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:50:31 -08:00
Steve Yegge
e50e714462 bd sync: 2025-12-23 11:47:59 2025-12-23 11:50:31 -08:00
Steve Yegge
90722ee65f feat: add hook status to gt status command (gt-h6eq.6)
Add HookInfo struct and hook discovery to show which agents have work
attached to their hooks. Updates both JSON and text output:

- New HookInfo type with agent, role, has_work, molecule, and title fields
- RigStatus now includes Hooks slice
- StatusSum includes ActiveHooks count
- discoverRigHooks() scans polecats, crew, witness, and refinery
- getAgentHook() retrieves hook status from handoff beads
- Text output shows active hooks per rig with agent and molecule info

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:49:28 -08:00
Steve Yegge
00c64a075c feat: add gt mol attach-from-mail command (gt-h6eq.7)
Allows agents to self-pin work from mail messages. The command:
1. Reads a mail message by ID
2. Extracts molecule ID from the body (attached_molecule:, molecule_id:, etc.)
3. Attaches the molecule to the agent's pinned bead (hook)
4. Marks the mail as read

Includes unit tests for the molecule ID extraction logic.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:44:34 -08:00
Steve Yegge
8be2146a48 docs: update role templates with hook-first startup protocol (gt-h6eq.9)
Updated all role prompt templates to document the startup hook protocol:
- polecat.md.tmpl: Added gt mol status check, self-pin from mail protocol
- witness.md.tmpl: Added gt mol status check, self-pin from mail protocol
- refinery.md.tmpl: Added gt mol status check, self-pin from mail protocol
- crew.md.tmpl: Added new Startup Protocol section with hook-first flow
- deacon.md.tmpl: Added gt mol status check, self-pin from mail protocol
- mayor.md.tmpl: Expanded startup protocol with hook-first flow

Each template now includes:
1. Check hook first (gt mol status)
2. If empty, check mail for attached work
3. Self-pin protocol (gt mol attach-from-mail) if needed
4. Role-specific fallback behavior

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:44:14 -08:00
Steve Yegge
e11833922b bd sync: 2025-12-23 11:43 2025-12-23 11:43:31 -08:00
Steve Yegge
949e1228a6 feat: add gt hooks command to list Claude Code hooks
Add a command to list all hooks in the workspace. Scans for .claude/settings.json
files and displays hooks by type (SessionStart, PreCompact, UserPromptSubmit, etc).

Features:
- Scans town root, rigs, polecats, crew, witness, and refinery directories
- Shows hook type, location, status, and agent that owns it
- Supports --verbose flag to show hook commands
- Supports --json flag for machine-readable output

(gt-h6eq.5)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:42:48 -08:00
Steve Yegge
26a7e54205 feat(doctor): add hook-singleton check (gt-h6eq.1)
Add doctor check to ensure each agent has at most one handoff bead.
Detects when multiple pinned beads exist with the same "{role} Handoff"
title, which can cause confusion about which handoff is authoritative.

- Check: hook-singleton
- Error if: Multiple pinned beads with same '{role} Handoff' title
- Fix: Automatically closes duplicates (keeps oldest) when run with --fix

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:42:35 -08:00
Steve Yegge
d0616870dd beads: add merge request for gt-h6eq.8 2025-12-23 11:42:12 -08:00
Steve Yegge
f2266db12d Add stale-attachments doctor check (gt-h6eq.4)
Implements a new doctor check that detects attached molecules that
haven't been updated in too long, which may indicate stuck work.
The check:
- Finds all pinned beads with attachments across rigs
- Checks the attached molecule's UpdatedAt timestamp
- Reports molecules in_progress with no activity for >1 hour
- Provides actionable fix hints for stuck polecats

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:41:43 -08:00
Steve Yegge
9fa4a42030 feat: add audit trail for detach operations (gt-h6eq.8)
Add DetachMoleculeWithAudit() function that logs detach operations
to .beads/audit.log in JSONL format. Each entry captures:
- timestamp
- operation type (detach, burn, squash)
- pinned_bead_id
- detached_molecule
- detached_by (agent identity)
- reason (optional)
- previous_state

Updated callers:
- runMoleculeDetach: logs "detach" operation
- runMoleculeBurn: logs "burn" operation with reason
- runMoleculeSquash: logs "squash" operation with digest ID

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:40:06 -08:00
Steve Yegge
d3657902a6 bd sync: 2025-12-23 11:39:01 2025-12-23 11:39:01 -08:00
Steve Yegge
78a20f0aad feat(doctor): add hook-attachment-valid check (gt-h6eq.2)
Add doctor check to verify that attached molecules exist and are not closed.
Detects when a hook's attached_molecule field points to a non-existent or
closed issue, which can leave agents with stale work assignments.

- Check: hook-attachment-valid
- Error if: Hook's attached_molecule field points to non-existent or closed issue
- Fix: Automatically detaches invalid molecules when run with --fix

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 11:34:50 -08:00
Steve Yegge
a473a35fe9 docs: Plugins ARE molecules - remove YAML/markdown format
- Updated molecules.md to reflect actual JSONL storage format
- Updated architecture.md molecule sections with ASCII diagrams
- Replaced markdown "## Step:" format with tree diagrams
- Changed plugin system from directory-based to molecule-based
- Plugins now use labels for metadata (tier, phase, role)
- Mol Mall distributes molecules.jsonl fragments

Related: gt-u818, gt-9za0

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 05:15:32 -08:00
Steve Yegge
91992c7582 bd sync: 2025-12-23 05:14:52 2025-12-23 05:14:52 -08:00
Steve Yegge
26004cd515 bd sync: 2025-12-23 05:07:23 2025-12-23 05:07:23 -08:00
Steve Yegge
eb423c111b docs: add pinned beads architecture design
Formalizes the pinned bead system for all Gas Town roles:
- One hook per agent (enforced, not multiple)
- Title-based discovery mechanism ({role} Handoff)
- Mail as delivery vs hook as authority
- Proposed gt doctor checks for hook validation
- Dashboard visibility recommendations

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 05:04:18 -08:00
Steve Yegge
1ff8c5ba6c bd sync: 2025-12-23 04:52:40 2025-12-23 04:52:40 -08:00
Steve Yegge
84aa69207a fix: add Pin/Unpin methods and call bd pin in pinToHook (gt-o3is)
Adds Pin() and Unpin() methods to the beads wrapper that call bd pin/unpin.

Updates pinToHook() to call b.Pin() after AttachMolecule() to set the
pinned boolean field and assignee on the work issue. This should enable
bd hook to show pinned work.

NOTE: There's a known issue where bd pin via subprocess doesn't actually
set the pinned field even though it reports success. The handoff bead
attachment remains the primary mechanism until this is resolved.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:51:17 -08:00
Steve Yegge
cab3b2ec50 bd sync: 2025-12-23 04:47:17 2025-12-23 04:51:17 -08:00
Steve Yegge
9afe57db4d bd sync: 2025-12-23 04:41:40 2025-12-23 04:51:17 -08:00
Steve Yegge
15afde2989 bd sync: 2025-12-23 04:41:08 2025-12-23 04:51:17 -08:00
Steve Yegge
46ce96ae62 merge: resolve conflict in tmux.go (keep SwitchClient) 2025-12-23 04:48:14 -08:00
Steve Yegge
42d8944f71 feat: default crew name to 'max', support town-level override
- Add DefaultCrewName constant ('max') to config package
- Add default_crew_name field to MayorConfig for town-level override
- Update gt rig add to resolve crew name: --crew flag > town config > default
- Update help text to reflect new default

Priority: --crew flag > MayorConfig.DefaultCrewName > config.DefaultCrewName ('max')
2025-12-23 04:47:07 -08:00
Steve Yegge
e9729a3225 docs: fix command name in account-management.md (gt crew at) 2025-12-23 04:38:27 -08:00
Steve Yegge
84c7d48ef4 feat: add crew, witness, refinery, mayor as sling targets
Adds support for slinging work to four new target types:

- crew (e.g., beads/crew/dave): Human-managed persistent workers
  - No worktree recreation
  - No auto-session start
  - Sends work assignment mail

- witness (e.g., gastown/witness): Per-rig lifecycle manager
  - Suggests --wisp for ephemeral work
  - Pins to witness hook

- refinery (e.g., gastown/refinery): Per-rig merge queue
  - Accepts protos, issues, and epics
  - Pins to refinery hook

- mayor (e.g., mayor/): Town-level coordinator
  - Uses town-level beads
  - Human-managed like crew
  - Sends work assignment mail

Updated help text with new target formats and examples.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:37:29 -08:00
Steve Yegge
8f2b324a9d bd sync: 2025-12-23 04:16:41 2025-12-23 04:17:04 -08:00
Steve Yegge
3ee23f5c63 fix: add missing gt account status command
The help text documented this subcommand but it wasn't implemented.
Adds status command showing currently resolved account with source
(GT_ACCOUNT env var or default).

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:16:32 -08:00
Steve Yegge
ba2db2bc11 feat: implement account management for multi-account Claude Code (gt-3133)
Adds support for managing multiple Claude Code accounts in Gas Town:

- accounts.json config parsing in mayor/ directory
- gt account list/add/default commands
- GT_ACCOUNT env var support with priority resolution
- --account flag on gt spawn and gt crew at commands
- CLAUDE_CONFIG_DIR injection into tmux sessions

Priority order: GT_ACCOUNT env var > --account flag > default from config

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:05:14 -08:00
Steve Yegge
a9ee102606 bd sync: 2025-12-23 04:04:38 2025-12-23 04:04:38 -08:00
Steve Yegge
5f2e16f789 refactor: remove shell respawn loops from witness and deacon (gt-zxgu)
Shell loops bypassed the proper lifecycle architecture. Now:

- Witness: Launches Claude directly, daemon/deacon health-scan handles restart
- Deacon: Launches Claude directly, daemon detects exit and restarts
- Daemon: ensureDeaconRunning() now checks if Claude is running (pane cmd)
         and restarts it if session exists but Claude has exited
- gt deacon restart: Now does stop+start instead of Ctrl-C

This enforces proper lifecycle flow through LIFECYCLE mail and daemon
heartbeat rather than bypassing it with shell loops.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 04:02:17 -08:00
Steve Yegge
46a5e38fa2 feat: add restart subcommands to witness and refinery (gt-9kc2)
- Add `gt witness restart <rig>` command (stop + start)
- Add `gt refinery restart [rig]` command (stop + start)
- Add self-cycling documentation to refinery template
- Clarify that restarts are daemon-managed, not shell loops

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 03:56:31 -08:00
Steve Yegge
d51fe0268d bd sync: 2025-12-23 03:48:18 2025-12-23 03:48:29 -08:00
Steve Yegge
13f68c20d9 docs: account management design for multi-account Claude Code (gt-3133)
Design doc for Gas Town account management feature enabling users to
switch between multiple Claude Code accounts (e.g., personal vs work).

Key decisions:
- Uses CLAUDE_CONFIG_DIR env var as core mechanism
- Config stored in ~/gt/mayor/accounts.yaml (follows town config pattern)
- NOT in Beads (config, not work items)
- NOT molecules (mechanical, not cognitive)
- Extensible for API keys, per-role defaults, federation

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 03:39:58 -08:00
Steve Yegge
d118381cfc bd sync: 2025-12-23 03:39:46 2025-12-23 03:39:46 -08:00
Steve Yegge
389430f41d bd sync: 2025-12-23 03:24:54 2025-12-23 03:24:54 -08:00
Steve Yegge
44bbeb6c7c refactor: split builtin_molecules.go into category files (gt-nmtp)
Split 1620-line file into 4 organized files:
- builtin_molecules.go (77 lines) - type, registry, seeder
- molecules_patrol.go (567 lines) - Deacon, Witness, Refinery patrol
- molecules_work.go (446 lines) - EngineerInBox, QuickFix, Research, PolecatWork, ReadyWork
- molecules_session.go (545 lines) - CrewSession, PolecatSession, Bootstrap, VersionBump, InstallGoBinary

Benefits:
- Easier to find/edit specific molecules
- Smaller diffs on changes
- Clear categorization by purpose

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 02:44:28 -08:00
Steve Yegge
290c077ce4 bd sync: 2025-12-23 02:44:10 2025-12-23 02:44:10 -08:00
Steve Yegge
d059af2146 docs: Christmas Ornament pattern and activity feed vision
Added to molecular-chemistry.md:
- Dynamic Bonding section with Christmas Ornament pattern
- WaitsFor directive documentation
- Activity feed examples
- Variable substitution syntax
- Mol Mall integration notes

Added to architecture.md:
- Christmas Ornament pattern summary
- Activity feed section
- bd activity command documentation

This design enables mol-witness-patrol to dynamically bond
inspection arms per-polecat, with real-time work state visibility.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 02:39:25 -08:00
Steve Yegge
17021cbfd3 bd sync: 2025-12-23 02:14:46 2025-12-23 02:15:00 -08:00
Steve Yegge
9190d3ba08 docs: update vision.md phase terminology table (gt-62hm)
Updated the Steam Engine metaphor table to use consistent phase terminology:
- Proto = Solid (crystal) - frozen templates
- Mol = Liquid - flowing durable instances
- Wisp = Vapor (gas) - transient traces
- Digest = Distillate - compressed records

This aligns with the Core Innovation 3 section terminology.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 02:14:44 -08:00
Steve Yegge
be5509fb18 gt down --all: also kill tmux server 2025-12-23 02:04:17 -08:00
Steve Yegge
18fb0e05fe feat(handoff): add -s/-m flags for ergonomic handoff mail
Agents naturally expect `gt handoff -s "Subject" -m "Message"` to work
like `gt mail send`. Now it does:

- Added --subject/-s and --message/-m flags to gt handoff
- Added --self flag to gt mail send for sending to self
- Handoff auto-sends mail to self before respawning pane

This makes agent-initiated handoff more ergonomic - they can include
context in a single command instead of two separate steps.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 01:51:47 -08:00
Steve Yegge
5459e8e6b1 Deacon startup: auto-bond mol-deacon-patrol on gt prime
- Add auto-spawn logic to outputDeaconPatrolContext()
- Deacon now auto-spawns mol-deacon-patrol if no active patrol
- All three patrol roles now have consistent auto-bond behavior:
  Deacon, Witness, Refinery

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 01:47:41 -08:00
Steve Yegge
3aff6e9021 bd sync: 2025-12-23 01:47:09 2025-12-23 01:47:09 -08:00
Steve Yegge
0dac49636c Witness startup: auto-bond mol-witness-patrol on gt prime (gt-lx3n)
- Add outputWitnessPatrolContext() function in prime.go
- Witness now auto-spawns mol-witness-patrol if no active patrol
- Fixed catalog ID parsing (strip trailing colon) for both witness and refinery
- Created mol-witness-patrol template with 10 steps (gt-qflq)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 01:43:49 -08:00
Steve Yegge
5a3e1a366e bd sync: 2025-12-23 01:19:57 2025-12-23 01:43:49 -08:00
Steve Yegge
78507ff326 refactor(cmd): split molecule.go into focused files
Split the 1929-line molecule.go into 5 focused files:
- molecule.go (376): command definitions, init(), loadMoleculeCatalog
- molecule_status.go (673): status, progress, current commands
- molecule_list.go (432): list, show, export, parse, instances
- molecule_lifecycle.go (359): instantiate, catalog, burn, squash
- molecule_attach.go (128): attach, detach, attachment

No functional changes - pure refactoring for maintainability.

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-23 01:38:34 -08:00
Steve Yegge
d8079ffd57 Merge remote-tracking branch 'origin/polecat/nux' 2025-12-23 01:15:57 -08:00
Steve Yegge
8455351641 Merge remote-tracking branch 'origin/polecat/furiosa' 2025-12-23 01:15:55 -08:00