The loopctl Knowledge Base
A complete, plain-language guide to loopctl — the Rust framework for building agents: programs where an AI model does multi-step work by calling tools you write.
This knowledge base is written for end users. Every concept is explained at first use, every abbreviation is decoded (full list in the Glossary), and every claim is grounded in the source code of the crate.
Start here
Section titled “Start here”New to loopctl? Read these four pages in order — they build on each other:
- What is loopctl? — the problem it solves, a working example in 20 lines, the five ideas behind the design.
- The big idea — the brain/hands split, the two buffers, who decides what. The most important page here.
- Anatomy of a run — one full run traced through every layer, step by step.
- The codebase map — every folder and file, one line each.
The reference sections
Section titled “The reference sections”Reading paths
Section titled “Reading paths”“I want to build an agent today” What is loopctl → The big idea → Tools → Recipes (start with 1–3) → Gotchas.
“Something went wrong — why?” Errors → Termination → the subsystem page for your symptom (compaction, fallback, detection…) → Gotchas.
“I’m reading the source code” Codebase map → File reference — every file has a page.
“I want to understand how it works, conceptually” Big idea → the Principles section (in order — each page is standalone) → back to any engine or safety page, which will now read like an old friend.
“I’m going deep on the engine” Big idea → Sans-IO → state machines → State machine → Driver loop → the four mechanism pages (LLM turn, dispatch, cancellation, compaction) → Termination.
“I’m evaluating loopctl for production” What is loopctl → Safety section (all of it) → Production hardening recipe → Gotchas.
About this knowledge base
Section titled “About this knowledge base”- Grounded in source: written against the loopctl codebase (v0.3.0) — every default value, threshold, and behavior stated here comes from the code or its tests.
- Plain by design: no unexplained jargon; short sentences; every diagram can be read on its own.
- Honest about limits: where the crate drops images, where defaults surprise (zero retries!), where heuristics are heuristics — it’s all in the open, mostly in Gotchas.
Companion resources: the crate’s API documentation on docs.rs (item-level reference), its README (feature matrix), and TESTING.md in the repository.