> ## Documentation Index
> Fetch the complete documentation index at: https://docs.gascity.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Tutorial 01 - Cities and Rigs

> Create a city, add a project as a rig, and sling your first work to an agent.

## Setup

Install at least one CLI coding agent (Gas City calls these "providers") and
put it on the PATH. Gas City supports many, including Claude Code (`claude`),
Codex (`codex`), Gemini (`gemini`), Grok Build (`grok`), OpenCode (`opencode`),
Groq (`groq`), and Cerebras (`cerebras`). Configure each with its token or API
key so it can run — the more the merrier.

Then install the Gas City CLI from Homebrew, which brings everything it needs
with it:

```shell theme={"dark"}
~
$ brew install gascity
...

~
$ gc version
```

Gas City stores work in Dolt, which needs an author identity before a city can
start. Git needs an identity first: the commands below copy it, and you commit
with git when you add a rig. If `git config --global user.name` or
`git config --global user.email` prints nothing, set it with
`git config --global user.name "Your Name"` or
`git config --global user.email "you@example.com"`, using your own name and
email. Then copy your git identity into Dolt wherever Dolt's name or email is
missing or empty:

```shell theme={"dark"}
~
$ [ -n "$(dolt config --global --get user.name)" ]  || dolt config --global --add user.name  "$(git config --global user.name)"
$ [ -n "$(dolt config --global --get user.email)" ] || dolt config --global --add user.email "$(git config --global user.email)"
```

> [!TIP]
>
> If you followed the [Quickstart](https://docs.gascity.com/getting-started/quickstart.md), you have done
> all of this and already have `~/my-city`. Skip the `gc init` command below and
> continue from [Looking inside](#looking-inside).

New to the vocabulary? Read [How Gas City Works](https://docs.gascity.com/getting-started/how-gas-city-works.md) first — the
canonical model for the six primitives (Agent, Bead, Formula, Rig, Pack, Event)
this tutorial puts into practice. The city is the local (root) pack; it imports
shared packs.

## Creating a city

A **city** is the directory holding the agents, formulas, rigs, orders, and
local settings the orchestrator needs to run multi-agent workflows on this
machine. Inside it, a **pack** is the portable part — the definitions worth
sharing with other cities. A city is a pack plus deployment details.

Create one with `gc init`, naming the default `gascity` template and your
coding agent:

```shell theme={"dark"}
~
$ gc init ~/my-city --template gascity --default-provider claude
[1/8] Creating runtime scaffold
[2/8] Installing hooks (Claude Code)
[3/8] Writing default prompts
[4/8] Writing pack.toml
[5/8] Writing city configuration
Created gascity config (Level 1) in "my-city".
[6/8] Checking provider readiness
[7/8] Registering city with supervisor
Registered city 'my-city' (/Users/you/my-city)
Installed launchd service: /Users/you/Library/LaunchAgents/com.gascity.supervisor.plist
[8/8] Waiting for supervisor to start city

~
$ gc cities
NAME     PATH
my-city  /Users/you/my-city
```

Use `--default-provider codex` (or `gemini`) for a different coding agent. Run
in a terminal without flags, `gc init ~/my-city` instead asks you for the
template and the agent.

Gas City created the city directory, registered it, and started it. A new city
takes a few minutes to finish setting up, and on a busy machine `gc status` can
stay partial for longer, showing agents as `unknown (partial status)`. That is
normal, and work you send still gets dispatched.

## Looking inside

Look inside the city:

```shell theme={"dark"}
~
$ cd ~/my-city

~/my-city
$ ls
agents  assets  city.toml  commands  doctor  formulas  orders  overlays  pack.toml  template-fragments
```

At the top level of the city directory:

* `pack.toml` — the portable pack definition layer
* `city.toml` — city-local deployment and runtime settings

This city comes with a city-local `mayor` agent. The mayor's prompt lives at
`agents/mayor/prompt.template.md`, and `pack.toml` defines the always-on mayor
session that uses it. Assuming you chose the default `gascity` config template
and Claude Code, `city.toml` keeps the shared runtime settings:

```shell theme={"dark"}
~/my-city
$ cat city.toml
[workspace]
provider = "claude"

[providers]
[providers.claude]              # registers your provider against a builtin preset
base = "builtin:claude"
ready_delay_ms = 0

[defaults]
[defaults.rig]
[defaults.rig.imports]
[defaults.rig.imports.gc]       # pack imported into every rig you add
source = "https://github.com/gastownhall/gascity-packs/tree/main/gascity/roles"
version = "sha:<pinned commit>"

[storage]
[storage.classes]               # where each kind of state lives
work = "work"
graph = "infra"
sessions = "infra"
messaging = "infra"
orders = "infra"
nudges = "infra"
[storage.bindings]
[storage.bindings.infra]
provider = "sqlite-beads"
path = ".gc/store"

# [mail]                        # commented-out mail retention settings follow
# ...
```

```shell theme={"dark"}
~/my-city
$ cat pack.toml
[pack]
name = "my-city"
schema = 2

[imports]
[imports.bd]
source = "https://github.com/gastownhall/gascity/tree/main/examples/bd"
version = "sha:<pinned commit>"
[imports.core]
source = "https://github.com/gastownhall/gascity/tree/main/internal/bootstrap/packs/core"
version = "sha:<pinned commit>"
[imports.gc]
source = "https://github.com/gastownhall/gascity-packs/tree/main/gascity"
version = "sha:<pinned commit>"

[[named_session]]
template = "mayor"
mode = "always"
```

The `[workspace]` section in `city.toml` sets shared runtime defaults such as
the provider. The `[providers.claude]` table registers your chosen provider
against the builtin `claude` preset. The `[defaults.rig.imports]` table lists
packs that every rig you add imports automatically. The `[storage]` section
keeps your work in the city's bead store and puts everything the city runs on
(sessions, mail, workflow steps, orders, and queued nudges) in a separate local
store under `.gc/store`, created the first time the city starts. The v2 formula compiler is
on by default, so nothing is written for it (you'll meet formulas in
[Tutorial 05](https://docs.gascity.com/tutorials/05-formulas.md)). The `[imports]` entries
in `pack.toml` are explicit pack composition, not hidden load-time behavior.
`core` and, for cities on the default `bd` beads provider, `bd` are bundled
system packs that resolve offline from the user-global pack cache. Their
`sha:<pinned commit>` version names the copy of each pack bundled with your
`gc` binary, not a commit you fetch or choose yourself. The `gc`
import is the public Gas City planning and implementation skills pack pinned
to the registry release embedded with this `gc` binary. If required builtin
imports go missing, `gc doctor --fix` restores them. The machine-local
workspace identity lives in `.gc/site.toml` instead, which is how `gc
cities`, `gc status`, and other commands still know this city is named
`my-city`.

The `mayor` session comes from the scaffolded `agents/mayor/` content and the
explicit `[[named_session]]` entry, so you can talk to it at any time. When
you add more agents later, Gas City creates `agents/<name>/`, with
`prompt.template.md` for the prompt and `agent.toml` for any per-agent
overrides.

Gas City also derives a worker template for each provider declared in
`city.toml`'s `[providers]` table — so `claude` is available as a template
name (and, once you add a rig, `<rig>/claude`) even though it is not a
hardcoded role. Provider-derived workers use the core pack's stock
pool-worker prompt and get `mol-do-work` as their default sling formula —
more on that in a moment. (The `mol-` prefix is v1 naming carried by the
formula's name; it doesn't change what the formula is — a reusable method.)

To check on the status of your city, use `gc status`:

```shell theme={"dark"}
~/my-city
$ gc status
my-city  /Users/you/my-city
  Controller: supervisor-managed (PID 83621)
  Authority: supervisor process PID 83621
  Suspended:  no

Agents:
  bd.dog                  scaled (min=0, max=2)
    bd.dog-1              stopped
    bd.dog-2              stopped
  core.control-dispatcher  stopped

0/3 agents running

Named sessions:
  mayor                   reserved-unmaterialized (always)

Store health:
  Path:        /Users/you/my-city/.beads/dolt
  Size:        9.0 MB
  Live rows:   10
  Ratio:       0.9 MB/row  (threshold 1.0 MB/row)
```

Once the city has rigs, `gc status` also lists them under `Rigs:`, and each
rig gets its own `<rig>/core.control-dispatcher`. While status is partial,
agents read `unknown (partial status)` and a line under the count gives the
reason, such as `(sessions: loading session snapshot timed out after 1s)`.

A named session shows `reserved-unmaterialized` until the orchestrator
materializes it; once the mayor session is up, its state reads `awake` (or
`active` — the two are equivalent).

The `bd.dog` pool is a background utility agent from the bundled `bd` pack you
saw imported in `pack.toml` (the `bd.` prefix is the import binding it arrived
through). It handles Dolt database housekeeping for the beads backend. `core.control-dispatcher` is platform
infrastructure: the orchestrator uses it to advance formula workflows. You don't
need to interact with either — ignore them for now.

## Adding a rig

> [!NOTE]
>
> If another Gas City workspace is already registered (check `gc cities`),
> commands inside `~/my-city` may resolve to that city and fail. Pass `--city ~/my-city` explicitly when that happens. These examples assume a single
> registered city.

In Gas City, a project directory registered with a city is called a "rig."
Rigging a project's directory lets agents work in it. A rig is a git
repository; make a small one to work with:

```shell theme={"dark"}
~
$ mkdir -p ~/my-project && cd ~/my-project
$ git init && git commit --allow-empty -m "initial commit"
$ cd ~/my-city

~/my-city
$ gc rig add ~/my-project
Adding rig 'my-project'...
  Prefix: mp
  Initialized beads database
  Generated routes.jsonl for cross-rig routing
Rig added.
```

Gas City derived the rig name from the directory basename (`my-project`) and
set up work tracking in it. The portable declaration lands in `city.toml`; the
path binding stays machine-local in `.gc/site.toml`:

```shell theme={"dark"}
~/my-city
$ cat city.toml
[workspace]
provider = "claude"

... # content elided

[[rigs]]
name = "my-project"
```

```toml theme={"dark"}
# .gc/site.toml — machine-local
[[rig]]
name = "my-project"
path = "/Users/you/my-project"
```

You can also see your city's rigs with `gc rig list`:

```shell theme={"dark"}
~/my-project
$ gc rig list

Rigs in /Users/you/my-city:

  my-city (HQ):
    Prefix: mc
    Beads:  initialized

  my-project:
    Path:   /Users/you/my-project
    Prefix: mp
    Beads:  initialized
```

## Slinging your first work

You assign work to agents by "slinging" it. Target the rig-scoped agent
explicitly to keep the work on this rig: `my-project/claude` here, or
`my-project/codex` or `my-project/gemini` if you chose that provider. Hop into
the rig directory to inspect the results:

```shell theme={"dark"}
~/my-city
$ cd ~/my-project

~/my-project
$ gc sling my-project/claude "Write hello world in python to the file hello.py"
Created mp-ff9 — "Write hello world in python to the file hello.py"
Attached workflow gcg-1025 (formula "mol-do-work") to mp-ff9
```

One command set the whole loop in motion: sling created a work bead, attached
a workflow from the agent's default formula (`mol-do-work` — read the bead, do
the work, close it), and the orchestrator spawned a session to run it.

![Work lifecycle after a sling: you run gc sling, the beads store creates a work bead and route, the orchestrator's reconcile tick spawns a session, the agent receives a primed prompt and finds its hooked work, edits the rig and runs commands, then updates the bead's progress and closes it when done — while the event bus records every step and gc bd show --watch streams live status back to you.](https://mintcdn.com/gascityinc-5c0069dd/-7xr7u3wfBmX5XrM/diagrams/excalidraw-rendered/work-lifecycle.svg?fit=max\&auto=format\&n=-7xr7u3wfBmX5XrM\&q=85\&s=f3e6102acc83bae048b9c18147044eed)

Watch the bead progress with `--watch`:

```shell theme={"dark"}
~/my-project
$ gc bd show mp-ff9 --watch
○ mp-ff9 · Write hello world in python to the file hello.py   [P2 · OPEN]
Owner: Chris Sells · Type: task
Created: 2026-04-07 · Updated: 2026-04-07

BLOCKS
  ← ○ mp-4tl: input convoy for mp-ff9 P2

Watching for changes... (Press Ctrl+C to exit)
```

The `BLOCKS` line is the input convoy sling created to track your bead. When
the agent finishes, the status flips from `OPEN` to `CLOSED` — and the file is
there:

```shell theme={"dark"}
~/my-project
$ ls
hello.py
```

Success! You dispatched work to an AI agent and got results back.

That was the simplest possible job: one agent, one task. The reason Gas City
exists is what happens when the job is bigger — you write a formula and the
orchestrator runs it as a graph, fanning ready steps out to many agents at once
and driving them to completion without you babysitting a session. You'll build
one of those in the Formulas tutorial.

## What's next

You've created a city, added a project as a rig, and slung work to an agent on
that rig. From here:

* **[Agents](https://docs.gascity.com/tutorials/02-agents.md)** — go deeper on agent configuration:
  prompts, sessions, scope, working directories
* **[Sessions](https://docs.gascity.com/tutorials/03-sessions.md)** — interactive conversations with
  agents, on-demand workers and persistent worker pools
* **[Formulas](https://docs.gascity.com/tutorials/05-formulas.md)** — write a method for how a job gets
  done and let the orchestrator run it as a graph: fan steps out across many
  agents, gate them on dependencies, retry failures, and drive the job to
  completion outside your session


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.