Implement three-tier config architecture (gt-k1lr tasks 1-5)

**Architecture changes:**
- Renamed `.gastown/` → `.runtime/` for runtime state (gitignored)
- Added `settings/` directory for rig behavioral config (git-tracked)
- Added `mayor/config.json` for town-level config (MayorConfig type)
- Separated RigConfig (identity) from RigSettings (behavioral)

**File location changes:**
- Town runtime: `~/.gastown/*` → `~/.runtime/*`
- Rig runtime: `<rig>/.gastown/*` → `<rig>/.runtime/*`
- Rig config: `<rig>/.gastown/config.json` → `<rig>/settings/config.json`
- Namepool state: `namepool.json` → `namepool-state.json`

**New types:**
- MayorConfig: town-level behavioral config
- RigSettings: rig behavioral config (merge_queue, theme, namepool)
- RigConfig now identity-only (name, git_url, beads, created_at)

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

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Steve Yegge
2025-12-22 01:22:27 -08:00
parent f16ce2d634
commit 97e0535bfe
20 changed files with 449 additions and 201 deletions

View File

@@ -1,7 +1,7 @@
// Package lock provides agent identity locking to prevent multiple agents
// from claiming the same worker identity.
//
// Lock files are stored at <worker>/.gastown/agent.lock and contain:
// Lock files are stored at <worker>/.runtime/agent.lock and contain:
// - PID of the owning process
// - Timestamp when lock was acquired
// - Session ID (tmux session name)
@@ -50,7 +50,7 @@ type Lock struct {
func New(workerDir string) *Lock {
return &Lock{
workerDir: workerDir,
lockPath: filepath.Join(workerDir, ".gastown", "agent.lock"),
lockPath: filepath.Join(workerDir, ".runtime", "agent.lock"),
}
}
@@ -167,7 +167,7 @@ func (l *Lock) ForceRelease() error {
// write creates or updates the lock file.
func (l *Lock) write(sessionID string) error {
// Ensure .gastown directory exists
// Ensure .runtime directory exists
dir := filepath.Dir(l.lockPath)
if err := os.MkdirAll(dir, 0755); err != nil {
return fmt.Errorf("creating lock directory: %w", err)
@@ -224,7 +224,7 @@ func FindAllLocks(root string) (map[string]*LockInfo, error) {
return nil
}
if filepath.Base(path) == "agent.lock" && filepath.Base(filepath.Dir(path)) == ".gastown" {
if filepath.Base(path) == "agent.lock" && filepath.Base(filepath.Dir(path)) == ".runtime" {
workerDir := filepath.Dir(filepath.Dir(path))
lock := New(workerDir)
lockInfo, err := lock.Read()