Settings creation was scattered across multiple places (createPatrolHooks,
ensurePatrolHooks, inline code). Now unified via claude.EnsureSettingsForRole().
Changes:
- Add "deacon" to autonomous roles in claude/settings.go
- Remove ensurePatrolHooks() from cmd/deacon.go, use EnsureSettingsForRole
- Remove createPatrolHooks() from rig/manager.go (no longer needed at rig add)
- Add EnsureSettingsForRole call in crew_lifecycle.go
- Add doctor check for stale/missing Claude settings files
- Wire up claude-settings check in cmd/doctor.go
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add Claude Code Stop hook that automatically records session costs when
sessions end. The hook calls `gt costs record` which now can derive the
session name from GT_* environment variables (GT_RIG, GT_POLECAT, GT_CREW,
GT_ROLE).
Changes:
- Add deriveSessionName() to infer tmux session name from environment
- Add Stop hook to settings-autonomous.json and settings-interactive.json
- Add unit tests for deriveSessionName function
When a Gas Town session ends, the Stop hook fires and records the session
cost as a bead event. Costs then appear in `gt costs --today` output.
Closes: gt-ntzhc
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Major redesign based on design review:
1. REMOVED: Claude Code internal parsing (ZFC violation)
- Deleted internal/claude/sessions.go (parsed ~/.claude/projects/)
- This coupled us to Claude Code's undocumented internal format
2. ADDED: Event-based session discovery
- gt prime now emits session_start events to ~/gt/.events.jsonl
- Events include role, session_id, topic, cwd
- Discovery reads our own event stream (ZFC-compliant)
3. ADDED: --talk flag for actual seances
- gt seance --talk <session-id> spawns: claude --fork-session --resume <id>
- --fork-session creates a new session (read-only, no grave disturbance)
- You literally talk to your predecessor: "Where did you put X?"
4. ADDED: One-shot prompt mode
- gt seance --talk <id> -p "Where is the config?"
- Uses claude --print for quick questions
The name "seance" is now literal - you commune with the dead (past sessions).
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Parses Claude Code ~/.claude/projects/ to find Gas Town sessions.
Sessions are identified by the [GAS TOWN] beacon in startup messages.
Features:
- Filter by role (crew, polecat, witness, etc.)
- Filter by rig name
- Show recent N sessions
- JSON output for scripting
- Sorts by most recent first
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add special handling for 'deacon' target in gt nudge command
- Maps 'deacon' to gt-deacon session, gracefully handles if not running
- Add gt nudge deacon session-started to SessionStart hooks
- Updated settings-autonomous.json, settings-interactive.json, and
ensurePatrolHooks() template
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Create internal/claude package with embedded settings templates
- settings-autonomous.json: gt prime && gt mail check --inject (SessionStart)
- settings-interactive.json: gt prime only (SessionStart)
- Update witness.go: EnsureSettings before session, remove broken gt prime injection
- Update refinery/manager.go: EnsureSettings before session, remove broken NudgeSession
- Update session/manager.go: EnsureSettings for polecats, remove broken issue injection
All autonomous roles (polecat, witness, refinery) now get proper SessionStart hooks
automatically when their sessions are created. No more timing-based gt prime injection.