From fb6ffa92e5071bbea02585a8f46b99db4bbc0634 Mon Sep 17 00:00:00 2001 From: markov-kernel Date: Sun, 4 Jan 2026 11:35:14 +0100 Subject: [PATCH] fix: deploy SessionStart hooks in gt install for Mayor role MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When users run `claude` directly at the town root instead of `gt mayor start`, Claude wasn't receiving the Mayor delegation protocol because `gt prime` never ran. Root cause: `gt install` created CLAUDE.md but not the .claude/settings.json with SessionStart hooks that run `gt prime`. This adds `claude.EnsureSettingsForRole(absPath, "mayor")` to `gt install` to ensure the Mayor always gets proper Claude settings with hooks that enforce the delegation protocol. Fixes #84 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- internal/cmd/install.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/internal/cmd/install.go b/internal/cmd/install.go index d4c63985..a69ed3aa 100644 --- a/internal/cmd/install.go +++ b/internal/cmd/install.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/cobra" "github.com/steveyegge/gastown/internal/beads" + "github.com/steveyegge/gastown/internal/claude" "github.com/steveyegge/gastown/internal/config" "github.com/steveyegge/gastown/internal/deps" "github.com/steveyegge/gastown/internal/formula" @@ -189,6 +190,15 @@ func runInstall(cmd *cobra.Command, args []string) error { fmt.Printf(" ✓ Created CLAUDE.md\n") } + // Ensure Mayor has Claude settings with SessionStart hooks. + // This ensures gt prime runs on Claude startup, which outputs the Mayor + // delegation protocol - critical for preventing direct implementation. + if err := claude.EnsureSettingsForRole(absPath, "mayor"); err != nil { + fmt.Printf(" %s Could not create .claude/settings.json: %v\n", style.Dim.Render("⚠"), err) + } else { + fmt.Printf(" ✓ Created .claude/settings.json\n") + } + // Initialize town-level beads database (optional) // Town beads (hq- prefix) stores mayor mail, cross-rig coordination, and handoffs. // Rig beads are separate and have their own prefixes.