Preface — Getting Your Agent Up and Running¶
You are an agent. You have landed in a repository that has the retritis suite
installed, which means a set of Model Context Protocol (MCP) servers are connected to
your session. This preface is your onboarding. By the end of it you will reach for the
right tool by reflex instead of shelling out to bash — and you will be faster, more
accurate, and observable while doing it.
Read this once. It is the highest-leverage thing in the book for you.
The one idea¶
The codebase is already a database. Query it. Don’t re-derive it with a shell.
When you run grep -rn "def connect" ., you are launching a process that walks the file
tree, reads bytes, and pattern-matches lines — throwing away the fact that the project is
structured: it has an abstract syntax tree, a git history, a full-text index, and a
chat/session log, all of which the suite has already parsed into a DuckDB database you can
query in milliseconds. grep finds the string def connect. squackit.find_names finds
the definition named connect, tells you its file and line, its signature, who calls it,
and how complex it is — typed, ranked, and without re-reading the tree.
Every time you reach for bash to inspect, search, read, run, or commit, ask: is there a
tool that already knows the answer as data? Almost always, yes.
Why tools beat bash here (it is not dogma)¶
|
retritis tools |
|
|---|---|---|
Structure |
byte/line matching; no notion of a function, class, or call |
AST-aware: definitions, calls, complexity, structural diffs |
Speed at scale |
re-walks + re-reads the tree every call |
one persistent DuckDB index; cache-hit queries in tens of ms |
Ranking |
match order is filesystem order |
relevance-ranked ( |
Composability |
text piped between fragile one-liners |
typed results you can pass between tools |
Observability |
output vanishes into your transcript |
runs/queries are recorded, queryable, and replayable ( |
Policy |
unconstrained; easy to do the wrong thing in the wrong mode |
mode- and policy-aware ( |
Determinism |
depends on the host’s |
one engine, one semantics, everywhere |
bash is still the right tool for genuinely unstructured, one-off shell work. But for
understanding code, running builds, and moving through git, the suite is strictly better
and the suite is watching — so using it also makes you legible to the tools that coach and
remember.
The reflex table — stop reaching for these, reach for those¶
When you would type… |
Reach for… |
|---|---|
|
|
|
|
“where is this used / who calls it” |
|
|
|
|
|
|
|
“what changed” / |
|
|
|
`pytest … |
tail -20` |
build/lint/typecheck + read output |
|
|
|
|
|
|
|
“search my past sessions / chats” |
|
“explain this project to me” |
|
“I don’t know which tool” |
|
Agent Recipe — orienting in an unfamiliar repo
squackit.project_overview(orfledgling.ExploreProject) — shape, languages, entry points.
squackit.search_docs("architecture")+read_doc_section— the human’s own map.
squackit.find/investigateon the symbols the task names — go straight to the code. You now know the project without havingcat-ed a single file.
First-session setup (do this once, in order)¶
Confirm the servers are connected. You should see MCP tools namespaced
squackit,fledgling,blq,jetsam,kibitzer,lackpy. If a family is missing, that capability is simply unavailable — fall back gracefully, don’t fail loudly.Warm the index. squackit/fledgling answer from a DuckDB index built over the AST + FTS. The first
search_code/FindCodebuilds it (a few seconds); after that, queries are cache hits. If the project supports the persistent cache (fledgling ≥ 0.11), the index is file-backed and survives across sessions — the first query of the day pays the build, the rest are ~tens of ms. (See Chapter 3.)Check your mode. kibitzer runs you in a mode (
free,implement,test,docs,explore,review) that governs which paths are writable and how it coaches.kibitzer.GetFeedbackshows your current mode and any intercepted patterns;kibitzer.ChangeToolModeswitches. If an edit is unexpectedly refused, you are probably in a mode that doesn’t permit writes there — switch deliberately rather than working around it. (See Chapter 8.)Register your build commands once. Tell
blqhow to run the project’s tests/build (blq.register_command), then always run them throughblq.runso the output is captured and queryable instead of scrolling past in your transcript.
The loop you are actually running¶
Everything in the suite serves one cycle. Name it to yourself; it keeps you tool-first:
observe ───────────► act ───────────► verify ───────────► learn
squackit / fledgling (edit files) blq (run+query) kibitzer / agent-riggs
"what is true now?" "change it" "did it work?" "remember/coach for next time"
▲ │
└──────────── jetsam (save/ship) ◄─────┘
Observe with squackit/fledgling — never guess the code; query it.
Act by editing files (this is the one step that is genuinely yours, not a tool).
Verify with blq — run the tests/build through the tool and read the captured errors; don’t pipe and don’t trust a green you didn’t capture.
Learn: kibitzer coaches in-session; agent-riggs remembers across sessions (a failure pattern seen once can be surfaced as a fix next time).
Persist the change with jetsam, which turns the git dance into a confirmable plan.
How the pieces relate (the map)¶
┌──────────────────────────── observe ────────────────────────────┐
│ squackit (the agent's code-intelligence server) │
│ └─ built on ─ pluckit (CSS-over-AST) + fledgling (SQL/DuckDB)│
└──────────────────────────────────────────────────────────────────┘
verify blq (build-log query) persist jetsam (git workflow)
coach kibitzer (modes + hooks) ◄── policy ── umwelt (CSS-like cascade)
generate lackpy (intent→program, local models, restricted exec ── nsjail)
remember agent-riggs (turns, trust, ratchets) ──► kibitzer surfaces promoted fixes
Read it as: fledgling is the engine (SQL macros over a DuckDB-parsed AST + FTS); pluckit is a CSS-like selector language over that AST; squackit composes both into the high-level tools you actually call. blq and jetsam cover verify and persist. kibitzer governs and coaches you, reading policy compiled by umwelt. lackpy generates and safely runs programs (sandboxed by nsjail), and agent-riggs closes the loop by learning across sessions. The rest of the book takes them one at a time.
Three habits that make you good at this¶
Query before you read. Don’t open a file to find something — find it with a tool, then read exactly the lines it points to (
read_source/ReadLineswith a range).Capture before you trust. Run builds/tests through
blqand readblq.errors. A test result you piped totailand eyeballed is not a result you can act on later.Stay legible. Use the tools even when
bashwould work, because kibitzer and agent-riggs can only coach and remember what they can see. Your future self (next session) inherits what this session made observable.
Now turn to Chapter 1 for the lay of the land, or jump straight to the tool you need.