Skip to content

Operational State in Gas Town

Managing runtime state through events and labels.

Gas Town tracks operational state changes as structured data. This document covers:

  • Events: State transitions as beads (immutable audit trail)
  • Labels-as-state: Fast queries via role bead labels (current state cache)

For Boot triage and degraded mode details, see Watchdog Chain.

Operational state changes are recorded as event beads. Each event captures:

  • What changed (event_type)
  • Who caused it (actor)
  • What was affected (target)
  • Context (payload)
  • When (created_at)
Event TypeDescriptionPayload
patrol.mutedPatrol cycle disabled{reason, until?}
patrol.unmutedPatrol cycle re-enabled{reason?}
agent.startedAgent session began{session_id?}
agent.stoppedAgent session ended{reason, outcome?}
mode.degradedSystem entered degraded mode{reason}
mode.normalSystem returned to normal{}
Terminal window
# Mute deacon patrol
bd create --type=event --event-type=patrol.muted \
--actor=human:overseer --target=agent:deacon \
--payload='{"reason":"fixing convoy deadlock","until":"gt-abc1"}'
# System entered degraded mode
bd create --type=event --event-type=mode.degraded \
--actor=system:daemon --target=rig:greenplace \
--payload='{"reason":"tmux unavailable"}'
Terminal window
# Recent events for an agent
bd list --type=event --target=agent:deacon --limit=10
# All patrol state changes
bd list --type=event --event-type=patrol.muted
bd list --type=event --event-type=patrol.unmuted
# Events in the activity feed
bd activity --follow --type=event

Events capture the full history. Labels cache the current state for fast queries.

Labels use <dimension>:<value> format:

  • patrol:muted / patrol:active
  • mode:degraded / mode:normal
  • status:idle / status:working (for persistent agents only - see note)

Note on polecats: The status:idle label does NOT apply to polecats. Polecats have no idle state - they’re either working, stalled (stopped unexpectedly), or zombie (gt done failed). This label is for persistent agents like Deacon, Witness, and Crew members who can legitimately be idle between tasks.

  1. Create event bead (full context, immutable)
  2. Update role bead labels (current state cache)
Terminal window
# Mute patrol
bd create --type=event --event-type=patrol.muted ...
bd update role-deacon --add-label=patrol:muted --remove-label=patrol:active
# Unmute patrol
bd create --type=event --event-type=patrol.unmuted ...
bd update role-deacon --add-label=patrol:active --remove-label=patrol:muted
Terminal window
# Is deacon patrol muted?
bd show role-deacon | grep patrol:
# All agents with muted patrol
bd list --type=role --label=patrol:muted
# All agents in degraded mode
bd list --type=role --label=mode:degraded
TypeStorageExample
Static configTOML filesDaemon tick interval
Operational stateBeads (events + labels)Patrol muted
Runtime flagsMarker files.deacon-disabled

Static config rarely changes and doesn’t need history. Operational state changes at runtime and benefits from audit trail. Marker files are fast checks that can trigger deeper beads queries.

Terminal window
# Create operational event
bd create --type=event --event-type=<type> \
--actor=<entity> --target=<entity> --payload='<json>'
# Update state label
bd update <role-bead> --add-label=<dim>:<val> --remove-label=<dim>:<old>
# Query current state
bd list --type=role --label=<dim>:<val>
# Query state history
bd list --type=event --target=<entity>
# Boot management
gt dog status boot
gt dog call boot
gt dog prime boot

Events are the source of truth. Labels are the cache.