Skip to content

Commit afc2e21

Browse files
committed
New post
1 parent 74d7dd9 commit afc2e21

1 file changed

Lines changed: 157 additions & 0 deletions

File tree

Lines changed: 157 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,157 @@
1+
---
2+
layout: blog
3+
title: First Steps in the Swamp
4+
description: "Day three with Swamp: The first commands and interactions."
5+
---
6+
7+
[Day one](https://example42.com/blog/2026/05/20/hands-in-the-swamp/) I got muddy.
8+
[Day two](https://example42.com/blog/2026/05/22/reading-the-swamp/) I read the map.
9+
10+
Day three, three weeks later, is the post I would have wanted on day one: the actual commands to type, in the actual order, to go from *“deterministic automation for AI agent"*, whatever that means, to a working workflow with versioned data you can query.
11+
12+
No theory this time. Well, almost. This is the practical companion to the previous post: if you don’t know what a model, a workflow or a vault is in [Swamp](https://swamp.club) terms, go read that one first. We’ll wait. We have time, we’re a swamp.
13+
14+
One prerequisite before the commands: **you need an AI agent**. Swamp is designed to be *operated* by agents, not just used next to them. Claude Code is the assumed default (and what I use mostly), but any decent coding agent works. The point, as we’ll see, is that you mostly don’t write Swamp YAML by hand — your agent does, and Swamp gives it the rails.
15+
16+
## Step 0 — Install
17+
18+
```bash
19+
curl -fsSL https://swamp-club.com/install.sh | sh
20+
```
21+
22+
Yes, the infamous curl-pipe-sh. We’ve all made our peace with it, or at least we pretend convincingly. Verify it landed:
23+
24+
```bash
25+
swamp version
26+
```
27+
28+
If the command is not found, restart your shell or add `~/.local/bin` to your `PATH`. (Twenty-five years of Unix and this sentence is still in every tutorial ever written. There’s something comforting in that.)
29+
30+
## Step 1 — Initialize a repo
31+
32+
Any repo. A new one, an existing project, the place where your podcast scripts live. For a first dip, make a sandbox:
33+
34+
```bash
35+
mkdir my-swamp-project
36+
cd my-swamp-project
37+
swamp repo init
38+
```
39+
40+
You get a glorious ASCII banner (“WELCOME TO THE CLUB — for hackers, by hackers”) and, more importantly, a scaffold:
41+
42+
```bash
43+
ls -a
44+
# .claude CLAUDE.md .gitignore models .swamp .swamp.yaml vaults workflows
45+
```
46+
47+
Pay attention to two things here:
48+
49+
- `.claude/` and `CLAUDE.md` — this is how the agent learns Swamp. The skills are auto-discovered: open Claude Code in this directory and it already knows the framework. No prompting liturgy, no copy-pasted system prompts. The framework documents itself to its own operator, which is still my favorite mildly-unsettling feature.
50+
- `.swamp/` — this is where every execution will leave typed, versioned, queryable data. The substrate. The thing that stops your agent’s work from dissolving into chat history like tears in rain.
51+
52+
## Step 2 — Create your first model (don’t write it, ask for it)
53+
54+
Open Claude Code in the repo and ask, in plain language:
55+
56+
```
57+
Create a command/shell model called hello-world that echoes "Hello from the swamp!"
58+
```
59+
60+
The agent creates a YAML definition under `models/command/shell/`. This is the division of labor I praised on day two, now visible on disk: logic lives in TypeScript (in the model *type*), configuration lives in YAML (in your model *definition*). The agent reasons over data, not over code.
61+
62+
Old Puppet hands: yes, this smells exactly like the resource abstraction layer. I know. I checked my pulse too.
63+
64+
## Step 3 — Run it
65+
66+
```bash
67+
swamp model method run hello-world execute
68+
```
69+
70+
You get your `Hello from the swamp!`, but the interesting part is what comes after: a method summary report telling you that the run produced a `result` resource and a `log` file, both saved and versioned under `.swamp/data/`. Every run. Automatically. An audit trail as a first-class citizen, not something you bolt on later when the auditors call.
71+
72+
## Step 4 — Query the data
73+
74+
This is the moment it clicked for me, so don’t skip it:
75+
76+
```bash
77+
swamp data query 'modelName == "hello-world"'
78+
```
79+
80+
Two artifacts, versioned. Now extract just the stdout:
81+
82+
```bash
83+
swamp data query \
84+
'modelName == "hello-world" && specName == "result"' \
85+
--select 'attributes.stdout'
86+
```
87+
88+
```
89+
Hello from the swamp!
90+
```
91+
92+
Those predicates are CEL expressions — the same expression language used inside model definitions and workflows to wire outputs into inputs. Learn the query syntax here, at the CLI, where mistakes are free, and you’ve learned the glue of the whole framework.
93+
94+
Your agent’s executions are no longer ephemeral logs. They’re a queryable database. Sit with that for a second.
95+
96+
## Step 5 — Compose a workflow (and extend Swamp while you’re at it)
97+
98+
Now the real demo. Back in Claude Code, ask for something Swamp *can’t do yet*:
99+
100+
```
101+
Create a new extension model type named @tutorial/random-status that randomly
102+
returns one of a list of statuses, storing it in a resource named "output"
103+
with a "status" property. Then create a model called weather-report that uses
104+
it to return one of: murky, misty, gloomy, stinky and humid. Then create a
105+
command/shell model called morning-message. Create a workflow called
106+
swamp-morning with two jobs: a "gather" job that runs hello-world and
107+
weather-report, and a "combine" job that depends on gather and runs
108+
morning-message, passing the hello-world stdout and the weather-report status
109+
into its command.
110+
```
111+
112+
Notice what just happened in one prompt: a new **extension** (new capability, packaged), two new **models**, and a **workflow** — a DAG with a parallel `gather` job feeding a dependent `combine` job. Files appear under `extensions/`, `models/` and `workflows/`. All reviewable, all in git, before anything runs.
113+
114+
Run it:
115+
116+
```bash
117+
swamp workflow run swamp-morning
118+
```
119+
120+
```
121+
Hello from the swamp! The weather is gloomy - best to stay inside.
122+
```
123+
124+
The two gather steps run in parallel, combine waits for both, every edge is typed, every node leaves versioned data behind. Query the final result like before:
125+
126+
```bash
127+
swamp data query \
128+
'modelName == "morning-message" && specName == "result"' \
129+
--select 'attributes.stdout'
130+
```
131+
132+
A pipeline where the second run is deterministic instead of a fresh improvisation. That’s the whole pitch, demonstrated in a sandbox in under half an hour.
133+
134+
## Step 6 — When things go wrong (they will, it’s a swamp)
135+
136+
```bash
137+
swamp doctor
138+
```
139+
140+
Checks installation health, broken hooks, unhealthy extensions, malformed workflows, vaults, and — bless them — cleartext secrets you left lying around. Run it early, run it often. On day one this command would have saved me several hours and an indecent amount of tokens.
141+
142+
## Where to wade next
143+
144+
Once the hello-world ritual is done, the actual exploration starts. My suggested order:
145+
146+
1. **Vaults.** Create one, store a secret, reference it via expression in a model. Local encrypted storage to start; AWS Secrets Manager or 1Password when a team shows up. Boring, in the best possible sense.
147+
1. **The extensions registry** at [swamp-club.com/extensions](https://swamp-club.com/extensions). Browse what others built before reinventing it — there’s everything from AWS primitives to Firecracker microVM management for sandboxing Claude Code itself. A package manager for agent capabilities.
148+
1. **Manual approval gates.** Workflows can suspend at a `manual_approval` step and wait for a human sign-off before touching production. The day you let an agent near real infrastructure, this is the feature that lets you sleep.
149+
1. **Your own real use case.** Take the thing you ask your agent to improvise more than once — podcast post-production, invoice archiving, key rotation, that messy directory you keep promising to fix — and reframe it as a workflow of typed models. The moment you do, it stops being a one-off and becomes an asset.
150+
151+
And read the [manual](https://swamp.club/manual).
152+
153+
The hands are muddier than ever. The difference is that now the mud is versioned.
154+
155+
We’ll keep wading.
156+
157+
Alvabot and Alessandro Franceschi

0 commit comments

Comments
 (0)