fix(formulas): replace hardcoded ~/gt/ paths with $GT_ROOT (#758)

* fix(formulas): replace hardcoded ~/gt/ paths with $GT_ROOT

Formula files contained hardcoded ~/gt/ paths that break when running
Gas Town from a non-default location (e.g., ~/gt-private/). This causes:

- Dogs stuck in working state (can't write to wrong path)
- Cross-town contamination when ~/gt/ exists as separate town
- Boot triage, deacon patrol, and log archival failures

Replaces all ~/gt/ and $HOME/gt/ references with $GT_ROOT which is
set at runtime to the actual town root directory.

Fixes #757

* chore: regenerate embedded formulas

Run go generate to sync embedded formulas with .beads/formulas/ source.
This commit is contained in:
Daniel Sauer
2026-01-21 05:19:42 +01:00
committed by GitHub
parent 0a6b0b892f
commit e591f2ae25
10 changed files with 26 additions and 26 deletions

View File

@@ -47,7 +47,7 @@ Check all crew workspaces and the mayor rig:
```bash ```bash
# Check each workspace # Check each workspace
for dir in ~/gt/gastown/crew/* ~/gt/gastown/mayor; do for dir in $GT_ROOT/gastown/crew/* $GT_ROOT/gastown/mayor; do
if [ -d "$dir/.git" ] || [ -d "$dir" ]; then if [ -d "$dir/.git" ] || [ -d "$dir" ]; then
echo "=== Checking $dir ===" echo "=== Checking $dir ==="
cd "$dir" 2>/dev/null || continue cd "$dir" 2>/dev/null || continue

View File

@@ -47,7 +47,7 @@ bd show hq-deacon 2>/dev/null
gt feed --since 10m --plain | head -20 gt feed --since 10m --plain | head -20
# Recent wisps (operational state) # Recent wisps (operational state)
ls -lt ~/gt/.beads-wisp/*.wisp.json 2>/dev/null | head -5 ls -lt $GT_ROOT/.beads-wisp/*.wisp.json 2>/dev/null | head -5
``` ```
**Step 4: Check Deacon mail** **Step 4: Check Deacon mail**
@@ -221,7 +221,7 @@ Then exit. The next daemon tick will spawn a fresh Boot.
**Update status file** **Update status file**
```bash ```bash
# The gt boot command handles this automatically # The gt boot command handles this automatically
# Status is written to ~/gt/deacon/dogs/boot/.boot-status.json # Status is written to $GT_ROOT/deacon/dogs/boot/.boot-status.json
``` ```
Boot is ephemeral by design. Each instance runs fresh. Boot is ephemeral by design. Each instance runs fresh.

View File

@@ -480,7 +480,7 @@ needs = ["zombie-scan"]
description = """ description = """
Execute registered plugins. Execute registered plugins.
Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with TOML frontmatter defining its gate (when to run) and instructions (what to do). Scan $GT_ROOT/plugins/ for plugin directories. Each plugin has a plugin.md with TOML frontmatter defining its gate (when to run) and instructions (what to do).
See docs/deacon-plugins.md for full documentation. See docs/deacon-plugins.md for full documentation.
@@ -497,7 +497,7 @@ For each plugin:
Plugins marked parallel: true can run concurrently using Task tool subagents. Sequential plugins run one at a time in directory order. Plugins marked parallel: true can run concurrently using Task tool subagents. Sequential plugins run one at a time in directory order.
Skip this step if ~/gt/plugins/ does not exist or is empty.""" Skip this step if $GT_ROOT/plugins/ does not exist or is empty."""
[[steps]] [[steps]]
id = "dog-pool-maintenance" id = "dog-pool-maintenance"
@@ -736,13 +736,13 @@ Maintain daemon logs and state files.
**Step 1: Check daemon.log size** **Step 1: Check daemon.log size**
```bash ```bash
# Get log file size # Get log file size
ls -la ~/.beads/daemon*.log 2>/dev/null || ls -la ~/gt/.beads/daemon*.log 2>/dev/null ls -la ~/.beads/daemon*.log 2>/dev/null || ls -la $GT_ROOT/.beads/daemon*.log 2>/dev/null
``` ```
If daemon.log exceeds 10MB: If daemon.log exceeds 10MB:
```bash ```bash
# Rotate with date suffix and gzip # Rotate with date suffix and gzip
LOGFILE="$HOME/gt/.beads/daemon.log" LOGFILE="$GT_ROOT/.beads/daemon.log"
if [ -f "$LOGFILE" ] && [ $(stat -f%z "$LOGFILE" 2>/dev/null || stat -c%s "$LOGFILE") -gt 10485760 ]; then if [ -f "$LOGFILE" ] && [ $(stat -f%z "$LOGFILE" 2>/dev/null || stat -c%s "$LOGFILE") -gt 10485760 ]; then
DATE=$(date +%Y-%m-%dT%H-%M-%S) DATE=$(date +%Y-%m-%dT%H-%M-%S)
mv "$LOGFILE" "${LOGFILE%.log}-${DATE}.log" mv "$LOGFILE" "${LOGFILE%.log}-${DATE}.log"
@@ -754,7 +754,7 @@ fi
Clean up daemon logs older than 7 days: Clean up daemon logs older than 7 days:
```bash ```bash
find ~/gt/.beads/ -name "daemon-*.log.gz" -mtime +7 -delete find $GT_ROOT/.beads/ -name "daemon-*.log.gz" -mtime +7 -delete
``` ```
**Step 3: Prune state.json of dead sessions** **Step 3: Prune state.json of dead sessions**

View File

@@ -8,7 +8,7 @@ goroutine (NOT a Claude session) that runs the interrogation state machine.
Dogs are lightweight workers in Boot's pool (see dog-pool-architecture.md): Dogs are lightweight workers in Boot's pool (see dog-pool-architecture.md):
- Fixed pool of 5 goroutines (configurable via GT_DOG_POOL_SIZE) - Fixed pool of 5 goroutines (configurable via GT_DOG_POOL_SIZE)
- State persisted to ~/gt/deacon/dogs/active/<id>.json - State persisted to $GT_ROOT/deacon/dogs/active/<id>.json
- Recovery on Boot restart via orphan state files - Recovery on Boot restart via orphan state files
## State Machine ## State Machine
@@ -151,7 +151,7 @@ If target doesn't exist:
- Skip to EPITAPH with outcome=already_dead - Skip to EPITAPH with outcome=already_dead
**3. Initialize state file:** **3. Initialize state file:**
Write initial state to ~/gt/deacon/dogs/active/{dog-id}.json Write initial state to $GT_ROOT/deacon/dogs/active/{dog-id}.json
**4. Set initial attempt counter:** **4. Set initial attempt counter:**
attempt = 1 attempt = 1
@@ -477,11 +477,11 @@ bd close {warrant_id} --reason "{epitaph_summary}"
**3. Move state file to completed:** **3. Move state file to completed:**
```bash ```bash
mv ~/gt/deacon/dogs/active/{dog-id}.json ~/gt/deacon/dogs/completed/ mv $GT_ROOT/deacon/dogs/active/{dog-id}.json $GT_ROOT/deacon/dogs/completed/
``` ```
**4. Report to Boot:** **4. Report to Boot:**
Write completion file: ~/gt/deacon/dogs/active/{dog-id}.done Write completion file: $GT_ROOT/deacon/dogs/active/{dog-id}.done
```json ```json
{ {
"dog_id": "{dog-id}", "dog_id": "{dog-id}",

View File

@@ -132,7 +132,7 @@ gt daemon rotate-logs
gt doctor --fix gt doctor --fix
``` ```
Old logs are moved to `~/gt/logs/archive/` with timestamps. Old logs are moved to `$GT_ROOT/logs/archive/` with timestamps.
""" """
[[steps]] [[steps]]

View File

@@ -47,7 +47,7 @@ Check all crew workspaces and the mayor rig:
```bash ```bash
# Check each workspace # Check each workspace
for dir in ~/gt/gastown/crew/* ~/gt/gastown/mayor; do for dir in $GT_ROOT/gastown/crew/* $GT_ROOT/gastown/mayor; do
if [ -d "$dir/.git" ] || [ -d "$dir" ]; then if [ -d "$dir/.git" ] || [ -d "$dir" ]; then
echo "=== Checking $dir ===" echo "=== Checking $dir ==="
cd "$dir" 2>/dev/null || continue cd "$dir" 2>/dev/null || continue

View File

@@ -47,7 +47,7 @@ bd show hq-deacon 2>/dev/null
gt feed --since 10m --plain | head -20 gt feed --since 10m --plain | head -20
# Recent wisps (operational state) # Recent wisps (operational state)
ls -lt ~/gt/.beads-wisp/*.wisp.json 2>/dev/null | head -5 ls -lt $GT_ROOT/.beads-wisp/*.wisp.json 2>/dev/null | head -5
``` ```
**Step 4: Check Deacon mail** **Step 4: Check Deacon mail**
@@ -221,7 +221,7 @@ Then exit. The next daemon tick will spawn a fresh Boot.
**Update status file** **Update status file**
```bash ```bash
# The gt boot command handles this automatically # The gt boot command handles this automatically
# Status is written to ~/gt/deacon/dogs/boot/.boot-status.json # Status is written to $GT_ROOT/deacon/dogs/boot/.boot-status.json
``` ```
Boot is ephemeral by design. Each instance runs fresh. Boot is ephemeral by design. Each instance runs fresh.

View File

@@ -480,7 +480,7 @@ needs = ["zombie-scan"]
description = """ description = """
Execute registered plugins. Execute registered plugins.
Scan ~/gt/plugins/ for plugin directories. Each plugin has a plugin.md with TOML frontmatter defining its gate (when to run) and instructions (what to do). Scan $GT_ROOT/plugins/ for plugin directories. Each plugin has a plugin.md with TOML frontmatter defining its gate (when to run) and instructions (what to do).
See docs/deacon-plugins.md for full documentation. See docs/deacon-plugins.md for full documentation.
@@ -497,7 +497,7 @@ For each plugin:
Plugins marked parallel: true can run concurrently using Task tool subagents. Sequential plugins run one at a time in directory order. Plugins marked parallel: true can run concurrently using Task tool subagents. Sequential plugins run one at a time in directory order.
Skip this step if ~/gt/plugins/ does not exist or is empty.""" Skip this step if $GT_ROOT/plugins/ does not exist or is empty."""
[[steps]] [[steps]]
id = "dog-pool-maintenance" id = "dog-pool-maintenance"
@@ -736,13 +736,13 @@ Maintain daemon logs and state files.
**Step 1: Check daemon.log size** **Step 1: Check daemon.log size**
```bash ```bash
# Get log file size # Get log file size
ls -la ~/.beads/daemon*.log 2>/dev/null || ls -la ~/gt/.beads/daemon*.log 2>/dev/null ls -la ~/.beads/daemon*.log 2>/dev/null || ls -la $GT_ROOT/.beads/daemon*.log 2>/dev/null
``` ```
If daemon.log exceeds 10MB: If daemon.log exceeds 10MB:
```bash ```bash
# Rotate with date suffix and gzip # Rotate with date suffix and gzip
LOGFILE="$HOME/gt/.beads/daemon.log" LOGFILE="$GT_ROOT/.beads/daemon.log"
if [ -f "$LOGFILE" ] && [ $(stat -f%z "$LOGFILE" 2>/dev/null || stat -c%s "$LOGFILE") -gt 10485760 ]; then if [ -f "$LOGFILE" ] && [ $(stat -f%z "$LOGFILE" 2>/dev/null || stat -c%s "$LOGFILE") -gt 10485760 ]; then
DATE=$(date +%Y-%m-%dT%H-%M-%S) DATE=$(date +%Y-%m-%dT%H-%M-%S)
mv "$LOGFILE" "${LOGFILE%.log}-${DATE}.log" mv "$LOGFILE" "${LOGFILE%.log}-${DATE}.log"
@@ -754,7 +754,7 @@ fi
Clean up daemon logs older than 7 days: Clean up daemon logs older than 7 days:
```bash ```bash
find ~/gt/.beads/ -name "daemon-*.log.gz" -mtime +7 -delete find $GT_ROOT/.beads/ -name "daemon-*.log.gz" -mtime +7 -delete
``` ```
**Step 3: Prune state.json of dead sessions** **Step 3: Prune state.json of dead sessions**

View File

@@ -8,7 +8,7 @@ goroutine (NOT a Claude session) that runs the interrogation state machine.
Dogs are lightweight workers in Boot's pool (see dog-pool-architecture.md): Dogs are lightweight workers in Boot's pool (see dog-pool-architecture.md):
- Fixed pool of 5 goroutines (configurable via GT_DOG_POOL_SIZE) - Fixed pool of 5 goroutines (configurable via GT_DOG_POOL_SIZE)
- State persisted to ~/gt/deacon/dogs/active/<id>.json - State persisted to $GT_ROOT/deacon/dogs/active/<id>.json
- Recovery on Boot restart via orphan state files - Recovery on Boot restart via orphan state files
## State Machine ## State Machine
@@ -151,7 +151,7 @@ If target doesn't exist:
- Skip to EPITAPH with outcome=already_dead - Skip to EPITAPH with outcome=already_dead
**3. Initialize state file:** **3. Initialize state file:**
Write initial state to ~/gt/deacon/dogs/active/{dog-id}.json Write initial state to $GT_ROOT/deacon/dogs/active/{dog-id}.json
**4. Set initial attempt counter:** **4. Set initial attempt counter:**
attempt = 1 attempt = 1
@@ -477,11 +477,11 @@ bd close {warrant_id} --reason "{epitaph_summary}"
**3. Move state file to completed:** **3. Move state file to completed:**
```bash ```bash
mv ~/gt/deacon/dogs/active/{dog-id}.json ~/gt/deacon/dogs/completed/ mv $GT_ROOT/deacon/dogs/active/{dog-id}.json $GT_ROOT/deacon/dogs/completed/
``` ```
**4. Report to Boot:** **4. Report to Boot:**
Write completion file: ~/gt/deacon/dogs/active/{dog-id}.done Write completion file: $GT_ROOT/deacon/dogs/active/{dog-id}.done
```json ```json
{ {
"dog_id": "{dog-id}", "dog_id": "{dog-id}",

View File

@@ -132,7 +132,7 @@ gt daemon rotate-logs
gt doctor --fix gt doctor --fix
``` ```
Old logs are moved to `~/gt/logs/archive/` with timestamps. Old logs are moved to `$GT_ROOT/logs/archive/` with timestamps.
""" """
[[steps]] [[steps]]