Tutorial 01 — Hello, Gas City
Let’s say that you’re using Claude Code on a significant feature implementation. You’ve described the feature, pointed the agent at the right files, and it’s making progress. Then — mid-flight — the context window fills up. The session is either over or you’re at the mercy of the compactation to save the important details. This is the fundamental problem with AI coding agents: their memory is the context window, and context windows are finite. Gas City fixes this with beads — tracked work units that persist outside the agent. When the agent uses beads to record what’s done and what’s left, running out of context is no longer catastrophic. In fact, it can be beneficial to clear out the context before it rots. A fresh session queries beads and picks up right where the last one left off. The state is in the store, not in the agent’s head. This tutorial builds the simplest possible Gas City orchestration: a named agent (the “Mayor”) to capture the work, an anonymous coding agent to build it and the beads system that ties it all together.Starting your city
Before starting, follow the source-based installation guide. Oncegc is
available, initialize a city:
.gc/ runtime
directory, prompt templates, and a city.toml with a default mayor agent
configured.
Now start the city to launch the mayor:
Adding a project
A project (called a “rig”) is a git repo associated with a city. Let’s create a simple one:gc discovers the city automatically:
Create a Task
To give an agent something to do, you’ll want to create a bead that represents a task. You can do that manually or use the mayor to do that work. Creating a bead manually looks like this — run from inside the rig directory sobd targets
the right beads database:
open — available for claiming. No assignee
yet.
Two things to notice:We created this bead via the CLI. If you’d rather have a conversation instead of remembering the CLI args, you talk to the Mayor instead:
- The bead has an ID (
gc-1). Every bead in this city gets a unique ID.- The bead is stored on disk — not in the agent’s context window. Agents come and go. Beads persist.
gc session attach brings up the single
instance of that agent running in a tmux session. By using tmux, the mayor’s
session is long-lived — it persists even if you close your terminal. You can
detach from it any time with Ctrl-b d and reattach later with gc session attach mayor. This is how Gas City keeps agents running in the background while you do
other things.
Let’s get to work!
Now let’s use a CLI coding agent to pick up that work for our rig. Detach from the mayor’s session (Ctrl-b d) and start a coding agent in the rig directory.
Use gc prime to give the agent its behavioral prompt — it tells the agent how
to find and execute beads:
claude with your preferred agent (codex --prompt "$(gc prime)",
gemini, etc.). The gc prime command outputs instructions that teach any
agent how to use bd commands.
You can watch it build your app, or detach from the tmux session (Ctrl-b d)
and let it cook.
Check the bead status from another terminal any time you like:
Starting and stopping
When you’re done for the day, stop the city:gc start at a directory that is not bootstrapped yet, it now
fails fast and tells you to run gc init first. Bootstrap happens in
gc init; gc start is for starting an existing city.
What You Learned
This tutorial used four of Gas City’s five primitives:| Primitive | What You Used It For |
|---|---|
| Config | Default city configuration — one mayor, beads backend |
| Agent Protocol | gc init / gc start / gc stop / gc session attach — managed the mayor |
| Task Store (Beads) | bd create / bd list — tracked the work |
| Prompt Templates | gc prime — gave agents their behavioral prompts at startup |
What’s Next
At this point, you’ve got yourself a working orchestration system. You can use the mayor to create beads and hand them off to a coding agent on demand. But right now you’re doing the routing manually — you told the agent to check beads yourself. Ideally we’d like the agent to know it has outstanding work and to get to it without any nudging from us. The old intermediate numbered tutorials were removed instead of being left stale. For the next maintained walkthrough, jump to Tutorial 06 — Formulas, or browse the published list in the Tutorials index.Spec Changes Needed
This section tracks DX decisions from the tutorial that need to flow back
into gas-city-spec.md. Don’t delete until the spec is updated.
-
City-as-directory model. A city is a folder (
~/bright-lights), not a config file embedded in a project repo.gc init <path>creates and bootstraps a city at that directory;gc startstarts it. The spec currently assumes workspace.toml inside the project. -
gc rig add <path>— new command to associate a project with a city. Creates rig infrastructure (beads, routes). Not in the spec at all. -
gc rig list— new command to list rigs in a city. Not in the spec. -
gc session attach <name>— starts or reattaches to a named agent’s tmux session. Spec hasgc agent startbut notattach. -
Default agent naming:
<rig-name>-<process-name>— when a coding agent picks up a bead without an explicit agent name, the assignee defaults to<rig-name>-<cli-process-name>(e.g.hello-world-claude). Not in spec. - Mayor as overseer, not worker. The default config creates a mayor whose role is planning and coordination, not coding. Workers are separate agents started in rig directories. Spec doesn’t distinguish mayor from worker role.
-
gc prime [agent-name]— new command that outputs the agent’s behavioral prompt. Used inline to prime any CLI coding agent:claude "$(gc prime)". No AGENTS.md or CLAUDE.md is written into rigs — the prompt is passed directly at launch time via the agent’s prompt argument. -
gc init/gc startsemantics.gc init [path]creates and bootstraps a complete city (likegit init).gc start [path]starts an existing city. Spec doesn’t distinguish init from start. -
bd claimis implicit. Agents pick up beads by working on them; theopen → activetransition happens internally. No explicitbd claimcommand needed in the basic flow. -
City discovery via
.gc/walk-up. Commands find the city by walking up from cwd looking for a.gc/directory. No--cityflag needed in the common case. - Tutorial reordering. The original plan had Tutorial 02 = Ralph loop. New order: 02 = Named Crew + routing, 03 = Ralph Loop. The Ralph loop requires routing as a prerequisite so that beads land on the agent’s hook and the loop just clears context and picks up the next hooked bead.
- “Crew” terminology. Named agents assigned to rigs. New concept not in spec. Relates to the existing agent config but adds rig-scoped naming.
