LilCaddie · The control plane for coding agents

Documentation

lilcaddie is the control plane for coding agents. This guide covers setting it up, using it day to day, every command, and writing loops of your own.

Contents

Setup

From nothing to a repository an agent can work in: install lilcaddie once, set each repository up with one command, and check it.

What you need

ThingWhy
Node 22.18 or newerlilcaddie is a Node program, and its launchers, hooks and MCP server start node from your PATH in whichever repository you are working in. No C++ toolchain is needed: the SQLite driver ships prebuilt binaries
npmComes with Node. Installs lilcaddie from the npm registry
gitSome checks need the repository you work in to be a git repository
An agent harnessClaude Code, Codex CLI, Gemini CLI, OpenCode or Copilot CLI. The harness still runs the model; lilcaddie plugs into it
Docker (optional)Only for the sandbox, which keeps lilcaddie’s record where the agent has no file path to it

Note lilcaddie is early. It is published on npm as lilcaddie, and has been tested on Windows 11 only; of the harnesses only Claude Code has been tried. See what is built and tested.

Install lilcaddie

npm install -g lilcaddie

That puts two commands on your PATH: lilcaddie, for you, and lilcaddie-mcp, the MCP server a harness starts. Then install it for yourself, once, so every harness on the machine is served.

Or build it from a clone

To work on lilcaddie, or to run a version that is not published, build a clone instead. With mise installed, one command builds it: it installs pnpm, and a Node for the build, for that folder only, then installs the dependencies, builds, and runs lilcaddie demo to check the result. It runs what mise.toml says without asking first.

git clone https://github.com/willcooley/lilcaddie.git
cd lilcaddie
mise run setup

Without mise, with Node and pnpm already installed:

pnpm install
pnpm build

That produces two programs:

ProgramPath in the cloneFor
lilcaddieapps/cli/dist/lilcaddie.jsYou, in a terminal
lilcaddie-mcpapps/mcp/dist/bin.jsAn agent harness, over MCP

Install it for yourself

Once, for every repository on the machine:

lilcaddie install --dry-run   # says what it would do
lilcaddie install

From a clone, building puts nothing on your PATH, so run the clone’s build instead, and add --add-to-path to be able to type lilcaddie. This writes launchers named lilcaddie and lilcaddie-mcp to ~/.lilcaddie/bin, copies lilcaddie’s own commands and skill into each harness’s folders in your home directory, and adds the MCP server and hooks to each harness’s own settings, so every repository on the machine is served. With --add-to-path it also puts ~/.lilcaddie/bin on your own PATH (the registry on Windows, your shell’s profile elsewhere), for terminals opened from then on; lilcaddie uninstall takes that out again.

node /path/to/lilcaddie/apps/cli/dist/lilcaddie.js install --dry-run   # says what it would do
node /path/to/lilcaddie/apps/cli/dist/lilcaddie.js install --add-to-path

Or, from a clone, give it a short name in your shell, and install nothing:

bash / zsh
alias lilcaddie='node /path/to/lilcaddie/apps/cli/dist/lilcaddie.js'
PowerShell
function lilcaddie { node "C:\path\to\lilcaddie\apps\cli\dist\lilcaddie.js" @args }

Check it:

lilcaddie help

The rest of this guide writes lilcaddie for that command.

Set up a repository

In the repository you want to work in, one command does everything:

lilcaddie setup

It takes the harnesses agents.toml names, if it names any. Otherwise it works out which you use from what is in the repository (.claude/, GEMINI.md, opencode.json and so on) and which programs are installed. Then, for each one, it:

  1. creates .lilcaddie/ with an example loop and the feature and onboard flows, if there is none
  2. creates agents.toml, naming the harnesses
  3. adds the lilcaddie MCP server to the harness’s settings
  4. installs the hooks that enforce checks and answer searches from the code map
  5. installs any commands agents.toml declares
  6. writes skills and commands out in that harness’s own layout
  7. builds the code map of your source tree and, from your manifests, the application profile: packages, entry points, and the commands that build and test it
  8. puts a short block into each harness’s context file (CLAUDE.md, AGENTS.md, GEMINI.md) telling the agent to ask lilcaddie where things stand. Only what is between lilcaddie’s two markers is ever rewritten; the rest of the file is yours
OptionDoes
--dry-runSays what it would do and changes nothing
--projectWrites the MCP entry and hooks into this repository’s files, and nothing outside it. Without it they go into your own harness settings, for every repository
--harness <name>Chooses harnesses yourself: claude, codex, gemini, opencode, copilot. Repeat it for several
--no-hooksLeaves hooks out. Checks are then enforced only when an agent asks
--no-context-filesLeaves CLAUDE.md, AGENTS.md and GEMINI.md alone
--sandboxKeeps the record in the sandbox. See Keep the record in the sandbox

setup is safe to run again: it never replaces a project, a file it did not write, or a setting that is already right.

Before the first run, and again whenever the loops or gates change, agree to run what the repository defines: lilcaddie trust. Until you have, setup leaves the flows’ skills and commands out of your harness; trust writes them out. Agreeing to run a repository’s definitions says why.

Note Hooks are installed by a person. Run by an agent, setup does everything else and tells you the one command to run yourself. Until lilcaddie is published, the settings it writes name your clone by its full path, so review them before committing.

Check it works

lilcaddie doctor

It checks that the repository is set up to work: Node, whether lilcaddie runs by name, the definitions, the record, each harness’s MCP entry and hooks, and the programs your checks run. For anything that is not right it says what to do. It changes nothing.

Then try your first loop.

Tell the agent what the application is

A session that starts blind spends its first minutes finding out what it is working on. lilcaddie gives the agent that before it reads a file, from two kinds of fact that it keeps apart:

KindWhatComes from
DerivedPackages, entry points, commands, what imports what, central filesYour manifests and the code map. Never a model. setup builds it
JudgedPurpose, architecture, conventions, workflow, pitfallsAn agent, in the onboard flow. You approve it

For the judged part, run /lilcaddie-onboard in your harness, or lilcaddie start onboard in a terminal. The agent surveys the repository, writes five notes as memory, and shows them to you to correct or approve.

Every status then opens with a few lines on the application, and lilcaddie context shows all of it. When your packages or commands change after the notes were written, lilcaddie says the notes are out of date, and /lilcaddie-onboard rewrites them. It never rewrites them itself.

Open the dashboard

lilcaddie view              # opens http://127.0.0.1:4747/ in your browser
lilcaddie view --port 0     # any free port
lilcaddie view --no-open    # print the address only

The dashboard is a local page of the work: what is waiting on you, what is running, and what happened. Started by you at a terminal, it has buttons to approve, reject, end a run and agree to definitions; --read-only leaves them off. To see several repositories together, put them on your list:

lilcaddie view --add <path to a repository>
lilcaddie view --forget <path to a repository>   # its record is untouched

Reading the dashboard says what each page shows.

After upgrading lilcaddie

Close your harness sessions and the viewer first: they run the installed package, and on Windows a running copy holds its files. Then take the newest version:

npm install -g lilcaddie@latest

From a clone, one command in the clone pulls, installs what changed and builds again; the launchers lilcaddie install wrote run that build, so lilcaddie is the new version as soon as it has built:

mise run update   # without mise: git pull, pnpm install, pnpm build

Then, in each repository you set up:

lilcaddie update

It rewrites lilcaddie’s MCP entry and hooks (adding any that are new), adds new files of the flows you have installed, writes skills and commands out again, refreshes the code map and the application profile, and brings its block in each context file up to date.

  • It never replaces a file you changed. Where a flow’s files differ from this version’s, it says so and names the command that takes the new version deliberately.
  • It does not turn hooks on where setup --no-hooks left them out.
  • lilcaddie schema --write refreshes the JSON Schemas your editor checks definition files with.

Keep the record in the sandbox (optional)

By default lilcaddie’s record is a file in the repository, .lilcaddie/state/lilcaddie.db, which an agent with a shell could edit. The sandbox moves the MCP server and the record into a Docker container: every tool call is served there, and the loop state, evidence, ledger and memory are kept in a Docker volume the agent has no file path to. Your harness stays on your machine, logged in as it always is, and no API key is needed.

lilcaddie sandbox build       # once: the image
lilcaddie setup --sandbox     # a new repository
lilcaddie sandbox on && lilcaddie update   # one already set up
  • Your record so far comes along: sandbox on copies it into the volume before switching. --fresh starts a new one.
  • Commands your checks run, and git, still run on your machine, in the repository, with your own tools.
  • You approve from your own terminal, as always.
  • lilcaddie sandbox off goes back. lilcaddie sandbox stop stops the helper container; the next command starts it again.
  • Docker has to be running.

Note It is a guardrail, not a wall: an agent on your machine that can run docker can reach the volume. Running the harness itself inside the container (lilcaddie sandbox run) is built, and only Claude Code has worked in it.

Take it out again

To removeRun
What lilcaddie install put in your home directory: hooks, MCP entries, commands, launcherslilcaddie uninstall
lilcaddie’s hooks from one harness’s settingslilcaddie hooks uninstall <harness> (add --project for a repository’s own settings)
A repository from the dashboard’s listlilcaddie view --forget <path>
The sandbox’s copy of a recordlilcaddie sandbox off

uninstall leaves every repository, and anything you changed, as it is. A repository’s .lilcaddie/ folder holds its definitions and its record; it stays until you delete it yourself.

How to use it

What lilcaddie does while an agent works, a first loop run by hand, the same thing with an agent, and how to read the dashboard.

The idea in one minute

An agent harness runs a loop: prompt, act, stop. lilcaddie decides what happens around that loop: what the agent is told on entry, what must be true before it may stop, what happens when it is not, and what comes next.

  1. A workflow is written down once, as a short list of phases. Each phase has instructions and the checks that decide when it is finished. lilcaddie calls a workflow a loop and a check a gate.
  2. You start a run of it, with a goal.
  3. The agent does the current phase and records what it saw.
  4. The agent asks to advance. lilcaddie runs the checks itself. If they pass, the run moves on. If they fail, the agent is told what is wrong and sent back.
  5. A person decides what only a person may. A run that keeps failing, or reaches an approval, waits for you.

Everything is kept in one SQLite file outside the harness, so the work survives a session and can continue in another tool. lilcaddie, not the agent, decides whether a phase is finished.

Your first loop, by hand

If you ran lilcaddie setup, you already have the example loop. Otherwise create it:

lilcaddie init

That writes .lilcaddie/loops/example.json: one phase, finished when evidence of kind done has been recorded. lilcaddie runs nothing a repository defines until you have agreed to it, so say so once, then start a run and ask to advance:

lilcaddie trust   # lists what the loops and gates would run; see Security
lilcaddie start example --goal "Try lilcaddie"
lilcaddie advance

Nothing has been recorded, so lilcaddie answers “not yet” and exits with code 2:

retry: Gates failed (attempt 1 of 4).
✗ evidence:done — Found 0 "done" evidence record(s) in this phase; 1 required. ...

Record the evidence and advance again:

lilcaddie evidence add done "Ran the example by hand"
lilcaddie advance
completed: All exit gates of the final phase passed.

The run rendered a report at .lilcaddie/reports/<run-id>.md, and everything that happened is in the record:

lilcaddie ledger query
lilcaddie ledger verify

That is the whole model. An agent does the same thing through tools instead of a terminal.

Working with an agent

After lilcaddie setup, open your harness in the repository and start work with a command. Each of these starts a run of a ready-made flow:

In the harness
/lilcaddie-feature Export the orders table as CSV
/lilcaddie-bug Login fails for emails with a plus sign

From then on the agent works the same way every session:

  1. It calls loop_status first. The answer says which phase the run is in, what to do now, the checks that must pass, and what earlier sessions learned.
  2. It does the phase, recording evidence (evidence_add, evidence_observe) and the values the phase asks for (output_set).
  3. It calls loop_advance. lilcaddie runs the checks and answers with the new status: the next phase, or why this one is not done.
Command in the harnessDoes
/lilcaddie-nextContinues the current run: do the phase and advance
/lilcaddie-statusShows where the run stands, changing nothing
/lilcaddie-auditLooks for gaps and contradictions in the run, changing nothing
/lilcaddie-createHelps you write a loop of your own
/lilcaddie-visual <screen>Reviews a screen from screenshots, with or without a run
/lilcaddie-help <question>Answers a question about using lilcaddie, from this guide

With hooks installed, the harness calls lilcaddie by itself: the status is given when a session starts, the agent is sent back if it tries to stop while checks fail, and an edit to a protected file is refused before it happens. Without hooks, all of that depends on the agent choosing to ask.

Note Close the session, open another harness, and the work continues: the next session’s first loop_status reads the same record.

Pick a ready-made flow

A flow is a ready-made way of working: a loop, the checks that judge each phase, one skill per phase telling the agent exactly what to do, the commands that start it, and a report template. setup installs feature and onboard. Install the others when you want them:

lilcaddie flow list
lilcaddie flow install bug --set test_command="pnpm test"
FlowStart it withFor
feature/lilcaddie-feature <idea>Building something new, from an idea to a shipping approval
bug/lilcaddie-bug <what is wrong>Fixing something broken, starting from a failing test
incident/lilcaddie-incident <what is broken>An outage, or a failure nobody can explain yet: contain it, test more than one explanation, fix the cause, write the postmortem
migration/lilcaddie-migrateMoving to another library, framework or version, behaviour unchanged
tech-debt/lilcaddie-tech-debtRestructuring code, behaviour unchanged
product-idea/lilcaddie-product-ideaDeciding whether an idea is worth building
security/lilcaddie-securityAssessing a codebase by OWASP standards
onboard/lilcaddie-onboardRecording what the application is, for every later session
teach/lilcaddie-teach <file>Making a cheaper model follow an instruction file as well as a stronger one
tune/lilcaddie-tune <the text>Making a loop’s instructions or a skill better, one measured change at a time
perf/lilcaddie-perf <the function>Making one algorithm faster: a reference it is checked against, worst cases, and timings lilcaddie runs itself against the original
spike/lilcaddie-spike <the work>Finding out whether new work can be done before building it: questions, experiments with real output, what it would touch, and findings with a verdict. It changes no application code
testing/lilcaddie-testing <the tests>Making a test suite worth trusting: flaky tests found by repeated runs and fixed at the cause, the testing pyramid and Arrange, Act, Assert, tests from real-world scenarios, and an adversarial review that breaks the code on purpose. A defect it finds is handed to you, not fixed
pr-sync/lilcaddie-pr-sync [<number>]A pull request with review comments, conflicts or both: the base merged in and each conflict resolved, each comment investigated and fixed or answered. Nothing is pushed or posted until you approve
quick/lilcaddie-quick <the change>A small change: a one-page plan, the change and its tests, the scanners, approval. A gate measures that it stays small (ten files; no dependency, migration, deployment or secret) and stops the run for you when it does not

From a terminal, any of them starts with lilcaddie start <flow> --goal "<what you want>". Every run writes its documents into its own folder, docs/<area>/<slug>/, and every flow ends with an approval only a person can give.

When a run waits on you

A run waits for a person in three cases:

  • Its checks kept failing. By default a phase may fail 3 times and be retried; the fourth failure hands the run to you.
  • A phase asks for approval, as the last phase of every shipped flow does.
  • The agent recorded a decision that is hard to undo. It waits until you approve or reject it.

The dashboard lists these under “Waiting on you”, each with the command that settles it. In a terminal:

lilcaddie status                       # what is waiting, and why
lilcaddie approve                      # let the run continue
lilcaddie reject <decision-id>         # refuse a pending decision
lilcaddie abort --reason "Not needed"  # end the run

Note approve, reject, break-glass and repin refuse to run inside an agent process. There is deliberately no agent tool for approving anything.

Reading the dashboard

lilcaddie view opens it. It is laid out like the editor it sits beside: a column down the left with the repository and branch, five areas (Now, Work, Runs, Workflows, Record) and the runs working now by name, and the pages of an area as tabs above it. It is read at three widths, each a click from the next: every application on your list, the checkouts of one repository, and one run told from start to finish.

PageAnswers
Work › All applicationsHow does work stand in every repository on my list?
Work › This repositoryWhat is each checkout (git worktree) of this repository doing, on which branch?
NowDoes anything need me, what is working now, what is going in my other checkouts and applications, and how did the latest runs end? At the top, how much of your subscription is used and left, as a burn-down of each 5-hour and weekly limit a harness reports: Claude Code’s once lilcaddie statusline install has made lilcaddie its status line, and Codex’s from its session files; then the tokens Claude Code, Codex and Gemini CLI have used over the last 24 hours or 7 days, counted from the session files each keeps on this machine. Only Claude Code’s have been read on a real machine
RunsEvery run, sortable and searchable. Open one to read it start to finish. Its page lists the documents the run wrote (the reports lilcaddie rendered and the files in the run’s folder, such as the spec and the plan) and opens each to be read there. Where the run wrote a system design (design.md, which the feature flow writes), the page shows it near the top with its diagrams drawn. Its page draws what the run reached for as a network that lights up: the agent in the middle, its tools around it, and beyond them the files of your code map, gathered by where they are in the repository and joined by their imports. Each call the hooks recorded travels as a pulse from the agent through the tool to what it reached; a working run plays each call as it happens, and “Play it back” replays a finished one from its first call, in half a minute at most. A call that failed travels in red. It shows what the agent asked its tools for, not what a model computed, and a harness with no hooks installed shows only lilcaddie’s own tools
Runs › TeachingHow a student model is scoring against a teacher, measurement by measurement. The tab appears once a run has taught
Runs › AgentsWhat agents said to each other, and which tasks were handed over. The tab appears once an agent has spoken
WorkflowsWhat the project defines: each workflow’s phases and what each one checks
DecisionsEvery question an agent raised, and how it was settled
PromptsWhat people typed into a harness
ActivityWhat happened, as sentences, each opening to exactly what was recorded
UsageTokens used, in total and by workflow and run. Listed once there is a reading
DocsThis guide

The dashboard uses ordinary words and keeps lilcaddie’s own terms a hover or a click away: a run that is escalated reads “Waiting on you”. What the words mean, at the top of every page, opens a short glossary; Terminology has the full list.

KeyDoes
Ctrl K / ⌘KOpens the palette: type to jump to any workflow or run
G then a letterGoes to a page. Hover over a page’s name to see its letter
/Focuses the search, on the Workflows page
J KMoves down and up the workflows
EscCloses what is open

Note Wherever a page asks you to do something, it gives the command as a terminal line with a Copy button. In a dashboard you started yourself at a terminal, four of them also have a button that does the same thing after asking you: approve, reject, end a run, and agree to definitions. Starting a run stays at the command line. The dashboard listens on 127.0.0.1 only. See Buttons on the dashboard.

When a run ends

It ended asMeansWhat next
CompletedEvery check of the last phase passedRead its report; start the next piece of work
Ended earlyA person or start --force aborted itStart another run when you are ready
FailedIts policy said to stop instead of handing it to a personRead why on the run’s page, then start another

With an orchestrator, lilcaddie route chooses the next loop from what was recorded; see Chain loops together. After the orchestrator says the work is done or halts, lilcaddie reset begins a new piece of work.

Terminology

Every word lilcaddie uses, in a sentence. The dashboard speaks in ordinary words; the command line, the files and the agent’s tools use the engine’s.

The words the dashboard uses

WordMeaning
WorkflowA way of doing one kind of job, written down once: a short list of phases, each with the checks that decide when it is finished. The project defines them.
RunOne time a workflow was followed, for one goal. A run starts in the first phase and ends when the last one passes, or when it is stopped.
PhaseOne step of a workflow. The agent is told what to do in it, and lilcaddie does not move the run on until its checks pass.
CheckSomething that has to be true before a phase is finished: a command succeeds, a file exists, a person approves. lilcaddie decides whether it is, not the agent. The engine calls a check a gate.
EvidenceWhat the agent wrote down that it saw, so that a check can ask for it: the output of a test run, for instance.
DecisionA question the agent put to itself and the answer it chose. A small one it settles alone; one that is hard to undo waits for a person.
The recordEverything lilcaddie wrote down as it happened, in order, each entry sealed to the one before so that none can be changed later. The engine calls it the ledger.

The engine’s words

These are the words in file names, commands, tool names and error messages.

WordMeaning
LoopA named sequence of phases, defined in a JSON file in .lilcaddie/loops/. The dashboard calls it a workflow
PhaseOne step of a loop: instructions, exit gates, outputs to record, paths to protect
GateA deterministic check that decides whether a phase may end. Pass or fail, plus a message written as a prompt for the agent. The dashboard calls it a check
RunOne execution of a loop, for one goal. Its id looks like r_mx0kibdq60f5e8
GoalWhat a run is for, in your words, given when it starts
PolicyWhat happens after gates are judged: advance, retry, go back to a phase, escalate to a person, or abort. A pure function of the results and the budgets
BudgetThe limits that stop a run going on forever: retries per phase, and gate evaluations per run
EvidenceSomething observed and recorded: a test run, a measurement. Each record has a kind, such as test-run
Observed evidenceEvidence of a command lilcaddie ran itself, with the exit code it saw. The rest is the agent’s word
OutputA typed value a phase must record, such as a summary or a version. Routing reads these
DecisionA recorded choice, with how reversible it is. Reversible ones apply; irreversible ones wait for a person
EscalateHand a run to a person. The run waits until someone approves or aborts it
ApprovalA person letting a run or a decision go ahead, from their own terminal
Protect / allowPaths a phase must leave unchanged, and the only paths a phase may change
InvariantA protected path that holds in every phase of every loop, set for the project. No loop can relax it
Break-glassA person’s recorded permission to change an invariant file, for one run and a limited time
Pin / repinA run records the hash of everything that judges it. If one changes mid-run the run stops; repin is a person accepting the change for that run
OrchestratorRules, in .lilcaddie/orchestrator.json, that choose the next loop from recorded facts. It never asks a model
RouteOne of those rules: a condition, and the loop to go to when it holds
CursorThe one pointer to “where are we”: which run is current, or that the work is done or halted
EpochOne piece of work under the orchestrator. lilcaddie reset begins a new one
ArtifactA file rendered from the record by a template, such as a report. The same records give the same bytes
MemoryA lesson kept for future sessions, in any harness: a fact, correction, decision, learning, preference or warning
LedgerThe append-only record of every state change. Each event carries the hash of the one before
HeadThe hash of the newest ledger event. Kept somewhere else, it lets you check later that the history still ends where yours did
ConformanceNine numbered checks that the record backs what it claims

What is around the engine

WordMeaning
HarnessThe program that runs the model and its tools: Claude Code, Codex CLI, Gemini CLI, OpenCode or Copilot CLI
MCP serverlilcaddie-mcp: how an agent in any harness reaches lilcaddie, as a set of tools
HookA point where the harness calls lilcaddie by itself: when a session starts, before an edit, when the agent tries to stop
FlowA ready-made way of working that lilcaddie ships: a loop, its gates, a skill per phase, start commands and a report template
SkillInstructions for one kind of task, in a SKILL.md. A phase can name the skill the agent should use
CommandIn a harness, a prompt you start with a slash, such as /lilcaddie-feature. In a terminal, a lilcaddie subcommand
SyncWriting the skills and commands kept in .lilcaddie/ out in each harness’s own layout
Code mapAn index of your source tree: where each name is defined and used, and which file imports which
Application profileWhat lilcaddie derives about the application from its manifests: packages, entry points, build and test commands
Context fileCLAUDE.md, AGENTS.md or GEMINI.md. lilcaddie keeps a short block in each, between two markers
CheckoutOne working copy of a repository: the main one, or a git worktree. Each has its own record
ApplicationOn the dashboard, a repository on your list
SandboxA Docker container that holds lilcaddie and one repository, and nothing else of yours
HubA small local server that hands agents’ messages to whoever is listening, after recording them
ViewerThe dashboard: the page lilcaddie view opens

How a run stands

The engine saysThe dashboard saysMeans
activeWorkingAn agent can work on it now
pausedPausedHeld by lilcaddie pause until lilcaddie resume
escalatedWaiting on youHanded to a person: approve it or abort it
completedCompletedEvery gate of the last phase passed
failedFailedIts policy ended it without completing
abortedEnded earlyEnded by a person, or by start --force

A run that is active, paused or escalated is live: a checkout has one live run at a time.

How a gate comes out

OutcomeMeansWhat happens
PassedThe check holdsWhen every gate of the phase has passed, the run moves on
FailedThe check does not hold, or the gate crashed or timed outThe agent is told why and sent back; a retry is spent
Could not be judgedThe gate had nothing to judge with: a scanner is not installed, there is no git repositoryIt still fails, but no retry is spent: the run goes straight to a person
Observed onlyThe gate is in observe mode: evaluated and recorded, never blockingNothing. It is how a new gate is tried before it is trusted

A gate fails closed: nothing unevaluated ever counts as passed. A hook fails open: a broken hook never traps the agent.

How a decision is settled

TermMeans
Two-wayEasy to undo. It applies at once
One-wayHard to undo. It waits for a person
appliedSettled without a person: by the agent, or by the policy
pending-approvalWaiting for you. lilcaddie approve <decision-id> or lilcaddie reject <decision-id>
approved / rejectedHow a person settled it

Where things live

PathHolds
.lilcaddie/loops/*.jsonThe loops this project defines
.lilcaddie/config.jsonThe project’s policy and invariants
.lilcaddie/orchestrator.jsonThe routes between loops, if you use them
.lilcaddie/gates/*.mjsCustom gates: the only code among the definitions
.lilcaddie/artifacts/Artifact definitions and their templates
.lilcaddie/skills/, .lilcaddie/commands/The one copy of each skill and command; sync writes them out per harness
.lilcaddie/schema/JSON Schemas, so your editor can check definition files
.lilcaddie/state/lilcaddie.dbThe record: one SQLite file. Kept out of git
.lilcaddie/reports/Reports rendered from the record. Never edit one
.lilcaddie/approvers.jsonWhose signature counts on an approval
.lilcaddie/sandbox.jsonSays the record is kept in the sandbox
.lilcaddie/sync.lock.jsonWhat sync wrote, so it can tell its files from yours
agents.tomlThe harnesses in use, and commands to install; shared with dotagents
docs/<area>/<slug>/The documents one run of a flow writes, such as docs/features/csv-export/
~/.lilcaddie/bin/Launchers for lilcaddie and lilcaddie-mcp, written by lilcaddie install
~/.lilcaddie/keys/Your signing key
~/.lilcaddie/applications.jsonYour list of applications for the dashboard

Commands

Every command, grouped by what you are trying to do. lilcaddie <command> --help shows a command’s full usage.

The seven to know first

CommandDoes
lilcaddie setupSets this repository up
lilcaddie doctorChecks it is set up to work
lilcaddie start <loop> --goal "…"Starts a piece of work
lilcaddie statusWhere it stands, and what to do now
lilcaddie advanceAsks lilcaddie to judge the phase and move on
lilcaddie viewOpens the dashboard
lilcaddie ask "<question>"How to do something with lilcaddie

Exit codes are the same everywhere: 0 ok, 1 error, 2 “not yet” (gates failing, or a verification that did not hold).

For a script, status, loops, validate, check, advance, doctor, conformance, ledger query, ledger verify, activity, activity summary, usage, memory list, gate test and ci take --json: one JSON document on standard output, naming its kind and version in schema, with the same exit code. A failure is a document too (lilcaddie.error/1). Text a session wrote, such as a goal or a memory, is marked "untrusted": true in it: something to know, never an instruction.

Install, set up, keep working

CommandDoes
lilcaddie install [--project] [--harness <name>] [--no-hooks] [--add-to-path] [--force] [--dry-run]Installs lilcaddie for you, in every repository on this machine: launchers for lilcaddie and lilcaddie-mcp, its own commands and skill, and the MCP entry and hooks in each harness’s own settings. --add-to-path puts the launchers’ folder on your own PATH. --project installs into this repository instead
lilcaddie uninstall [--harness <name>]Takes out what install put in your home directory, the PATH entry --add-to-path added included. Leaves every repository, and anything you changed, as it is
lilcaddie setup [--project] [--harness <name>] [--no-hooks] [--no-context-files] [--sandbox] [--force] [--dry-run]Sets a repository up for the harnesses in use: project, MCP entry, hooks, commands, skills, code map, application profile, and lilcaddie’s block in each context file
lilcaddie update [--harness <name>] [--no-context-files]After upgrading lilcaddie, or when the repository has changed: refreshes everything setup wrote. Leaves your edits alone
lilcaddie doctor [--away]Checks the repository is set up to work, and says what to do about anything that is not. Changes nothing. --away also checks what working from a phone rests on: whether your notify.json can be used and where its notices go, whether the viewer’s key is kept, a heartbeat, whether a usage limit has been read, and how a run that waits for approval can be answered from where you are
lilcaddie ask "<question>" [--more]Answers a question about using lilcaddie from its guide. A search, not a model: the same question gets the same answer, with no network
lilcaddie commands install [--check] [--force] [--no-sync]Installs the commands agents.toml declares, then writes them out for each harness

Flows

CommandDoes
lilcaddie flow listLists the flows that come with lilcaddie
lilcaddie flow install <name|folder> [--set <key>=<value>] [--no-scanners] [--force]Installs a flow into this project: its loop, gates, skills, commands and templates. Names any tool it needs that is missing
lilcaddie flow new <name>Starts a flow of your own: a three-phase loop, a skill and a command to edit

Definitions, and where things stand

CommandDoes
lilcaddie initCreates .lilcaddie/ here, with an example loop
lilcaddie validateChecks every definition and gives each problem the line it is on. Changes nothing
lilcaddie schema <kind> / lilcaddie schema --writePrints the JSON Schema of a definition file, or writes them all into the project for editors
lilcaddie statusWhere things stand: cursor, run, phase, gates, and what is waiting
lilcaddie loopsLists the loops this project defines, and their phases

Run a loop

CommandDoes
lilcaddie start <loop> [--goal <text>] [--force] [--worktree <name>]Starts a loop. --force aborts a live run first. --worktree <name> starts it in a checkout of its own instead, so that it runs beside whatever is going here: a git worktree beside the repository on a new branch run/<name>, given this repository’s definitions. Only a person may make one
lilcaddie checkEvaluates the current phase’s gates without moving the run
lilcaddie advanceEvaluates the gates and applies the policy: move on, retry, go back, escalate
lilcaddie pauseHolds the active run
lilcaddie resumeReleases a paused run
lilcaddie abort [<run-id>] [--reason <text>]Ends a live run without completing it
lilcaddie route [--dry-run]Lets the orchestrator choose the next loop. --dry-run says which route would match, and why
lilcaddie reset [--goal <text>]Begins a new piece of work after the orchestrator is done or halted

What only a person decides

These refuse to run inside an agent process. With a signing key enrolled, each is signed.

CommandDoes
lilcaddie trustLists what this repository’s loops and gates would run, and records that you agree to run them; then writes its skills and commands out for the harnesses agents.toml names. Asked again whenever those files change
lilcaddie approve [<run-id>|<decision-id>] [--option <n> | --choose <text>] [--note <text>] [--by <name>]Approves a decision, or a run and its pending decisions. With no id it approves the run waiting in the folder you are in, and says which first: its id, loop, phase, folder and goal. For one decision, --option <n> approves it with the nth option the agent named and --choose <text> with your own words, in place of what the agent recommended; lilcaddie brief lists the options with their numbers
lilcaddie device add <name> [--host <name>]... [--port <n>]Human only. Serves one page, for one answer, on which a phone or a security key makes a passkey. Prints the key’s fingerprint to compare with the one the device shows. Nothing is enrolled yet
lilcaddie device confirm <name> [--forget]Human only. Enrolls that passkey in .lilcaddie/approvers.json as an approver; --forget throws it away instead. Commit the file and agree to it with lilcaddie trust
lilcaddie device approve [<run-id>] [--device <name>] [--note <text>] [--host <name>]... [--port <n>]Human only. Serves one page on which an enrolled device approves a run, by its passkey. Only where the repository keeps its record in the sandbox, and only for a run with no question waiting. Not yet done with a real phone
lilcaddie reject <decision-id> [--note <text>] [--by <name>]Rejects a pending decision
lilcaddie break-glass --reason <text> [--path <glob>] [--minutes <n>] [<run-id>]Allows a change to an invariant file, for one run and a limited time
lilcaddie repin [<run-id>] [--note <text>]Accepts, for one run, a change to the policy, the invariants or a custom gate
lilcaddie key init [--no-passphrase]Creates your signing key, so what you approve is signed
lilcaddie key protectGives your signing key a passphrase, or changes it. Needs a terminal
lilcaddie key enroll [--name <name>]Enrolls your key in this repository: from now on its approvals must be signed
lilcaddie key showPrints your public signing key. Anyone may run this one

Record what happened

CommandDoes
lilcaddie evidence add <kind> <summary> [--data <text>]Records evidence for the current phase
lilcaddie observe --kind <kind> [--cwd <dir>] [--timeout-ms <n>] -- <command>Runs a command and records what it did: evidence lilcaddie saw itself
lilcaddie output set <key> <value>Sets a declared output of the current phase
lilcaddie decide <question> --chosen <text> --rationale <text> --reversibility two-way|one-wayRecords a decision. Also takes --confidence and --option
lilcaddie memory add <content> [--kind <kind>] [--scope <scope>] [--key <key>] [--tag <tag>]Keeps a lesson for future sessions
lilcaddie work add <goal> [--loop <loop>] [--after <work-id>]Files a piece of work in the queue; --after holds it back until that work is done. Filed by an agent it is a proposal, which nobody can take until a person accepts it
lilcaddie work list [--ready] [--all]The queue, oldest first: what is ready to take, what waits on what, and who holds what
lilcaddie work claim <work-id> [--by <name>] [--minutes <n>]Takes a piece of ready work for a time (four hours unless you say, a day at most); a claim that runs out frees the work. Claim again to keep it longer
lilcaddie work start <work-id> [--minutes <n>]Human only. Claims a piece of ready work and makes a git worktree for it in a new folder beside the repository, on a new branch work/<work-id>, with the repository’s hooks switched off
lilcaddie bundle export <run-id> [--out <file>]Writes one run’s record to a file: its ledger events, each with its hash, without tool calls and prompts
lilcaddie bundle verify <file>Checks a bundle and changes nothing: every event as it was hashed, and a person’s actions signed by a key this project enrolls. Exit 2 if it does not hold. A bundle shows its events agree; it is not proof they happened
lilcaddie bundle import <file>Records here, as one event, that a bundle that holds was shown. lilcaddie work done <work-id> --bundle <file> closes work on one whose run completed
lilcaddie claim on [--command <command>] / lilcaddie claim offHuman only. Makes each commit made while a run is live name that run, with the line LilCaddie-Run: <run-id> in its message, through git’s own prepare-commit-msg step; off takes it out. A step already there is kept and still runs first
lilcaddie claim add <message-file>What git’s step runs for each commit. Adds the line for the live run, does nothing without one, and always exits 0
lilcaddie bundle attach <run-id>Human only. Keeps a completed run’s record in the repository’s history under refs/lilcaddie/runs/<run-id>, naming the commits made since the run started. No branch is changed and nothing is pushed
lilcaddie bundle check <range> [--strict]For each commit in the range that claims a run: verified, missing, invalid or unnamed. Exit 2 on missing or invalid, and on unnamed with --strict. Changes nothing
lilcaddie case freeze <run-id>Keeps a completed run as a case in .lilcaddie/cases/: its goal, the loop that judged it, and how each gate came out
lilcaddie case replay <case-file|run-id> [--rounds <n>] [--timeout-ms <n>] [--any-tree] -- <command>Human only. Does the work of a frozen case again: starts a run of the same loop with the same goal, starts your command (what starts your agent), and judges the run’s gates itself after each round. Prints each gate’s failures the first time and this time. The command changes the checkout it runs in, so replay in one made at the case’s commit; this project’s record gains no run. Exit 2 if the replay did not complete. One replay is one sample
lilcaddie checkoutSays which session holds this checkout and when its claim runs out, where the project lets one session at a time write ("checkout": {"oneWriter": true} in .lilcaddie/config.json)
lilcaddie checkout release [--note <text>]Human only. Ends the claim a session has on this checkout, so that the next session to write takes it
lilcaddie guard [--hours <n>]Says whether the guard on an agent’s actions refuses or only records ("guard": {"mode": "monitor"} in .lilcaddie/config.json), and lists what it would have refused in monitor mode, newest first: 24 hours unless told, 672 at most
lilcaddie filesLists the files agents have reserved in this checkout, the earliest first: another agent’s write to them is refused until the reservation runs out or is released
lilcaddie files reserve <glob>... [--minutes <n>] [--note <text>]Reserves files, for an hour unless you say (a day at most). An agent holds them under its own name, a person under human. A glob another agent holds is refused
lilcaddie files release [<glob>...] [--of <agent>] [--note <text>]Ends reservations: the globs named, or all. An agent ends only its own; a person ends anyone’s, and --of names whose
lilcaddie work release <work-id> [--note <text>]Gives claimed work back to the queue, for another to take
lilcaddie work accept <work-id>...Human only. Accepts work an agent proposed, so that it may be taken; several ids accept several at once. Read each goal first: it is what the next session is told to do
lilcaddie briefCatches you up in a few lines, made to be read on a phone: what needs you and the command that answers it, what is running, what ended since the last brief. Also says when a harness used here has no hooks installed, and when more than one session is typing into one checkout
lilcaddie run --from-queue [--pieces <n>] [--at-once <n>] [--loop <name>]Human only. Drives accepted work from the queue instead of one run: oldest first, each piece in the sandbox on a copy and a branch of its own (sandbox/<work-id>), 3 pieces unless told and 12 at most. A piece whose run completes is marked done; any other is given back with a note. --loop is the loop for a piece that names none. --at-once drives that many at the same time, 4 at most, each in a container and on a record of its own. It accepts nothing and merges nothing
lilcaddie run --own-record --loop <name> --goal <text>Human only. Drives the run on a new, empty record of its own, not the repository’s in the sandbox, so that another run of this repository can go beside it. Its record comes back as a bundle. One that stops for you is kept: lilcaddie sandbox kept lists it
lilcaddie sandbox keptLists the runs of this repository that stopped on a record of their own and have not ended: the run, where it stood when last seen, and the branch its work is on. Changes nothing
lilcaddie approve --kept <run-id>Approves a run that stopped on a record of its own; status, brief, reject, resume, repin and abort take --kept too. Each runs in a container that has that record, a copy of the branch the run’s work is on, no network, and for an answer your key. An approval is of that branch at the commit it is at. status and brief read; the rest are human only
lilcaddie run --kept <run-id>Human only. Drives such a run on once it is active again: on a copy of its branch, with the record it stopped on. Its work comes back on the same branch. When it ends its record is removed, and a piece of work it was taken for is marked done on its bundle
lilcaddie device listen [--device <name>] [--hours <n>] [--host <name>]... [--port <n>]Human only. Before you leave: keeps the page on which an enrolled device approves open for 8 hours (--hours, 24 at most). Each time the device opens it, it shows the run that waits then and signs that one run, up to 12. Only where the record is kept in the sandbox, and only for a run with no question waiting
lilcaddie away [--host <name>]... [--port <n>] [--no-view]The one command to run before you leave the machine. Checks what working from a phone rests on, starts the viewer under the names your phone reaches it by with a key that stays the same, and keeps watch until stopped: once a minute it looks at this repository’s run and at your usage limits, and sends the notices nothing else can, because they are about nothing happening. Every five minutes it asks for the heartbeat address in your notify.json. It changes nothing in the repository
lilcaddie notify testSends one notice that says only that it is a test, to the address in your notify.json, whatever kinds it asks for and whatever the hour, and says whether the address took it
lilcaddie report [--hours <n>] [--out <file.md>]What happened here over the last day (or --hours), as one page to read in a chat: what is worth a look, how the runs came out, which checks failed, who worked and what it used, what was refused. Counted from the record. --out also writes it to a Markdown file in the repository, over an earlier report and nothing else
lilcaddie work done <work-id> [--run <run-id> | --bundle <file>]Marks work done: an agent by naming a run of this record that completed, a person without one
lilcaddie work drop <work-id> [--note <text>]Human only. Takes work off the queue: it will not be done
lilcaddie usage [--run <run-id>]Tokens used, by run and by phase, added up from what the hooks recorded. Read from Claude Code transcripts only, so work in another harness shows as not counted; a guide to cost, never evidence
lilcaddie demo [--keep]Runs one small loop in a temporary folder and prints each step as the command you would type and what lilcaddie answered. Sets nothing up and touches nothing where you are; --keep leaves the folder to look at
lilcaddie rehearse <loop> [--phase <phase-id>]Judges one phase’s gates on the working tree as a run would now, without a run: the first phase unless you name one. Runs the phase’s commands and custom gates for real; records no run, gate result or evidence, only that the command was called. A gate that asks for evidence, an output or an approval fails and says what a run will be asked for. Exit 2 if a gate fails
lilcaddie gate test <gate> [<case>]Tries a custom gate on its cases, the JSON files in .lilcaddie/gate-tests/<gate>/, without a run: each says what the gate is given (options, a tree of files, outputs, evidence) and what it should answer (expect). Exits 2 when one is not answered as expected. Records no result
lilcaddie ci --loop <loop> --base <ref> [--trust-base] [--summary <file>]For a CI job. Judges the checkout by a loop’s command, file and grep gates, and only if its loops, gates, policy and approvers are exactly those of <ref>: a change cannot alter what judges it. Records nothing. --trust-base lets it run where nobody has run lilcaddie trust; --summary appends the verdict to a file such as $GITHUB_STEP_SUMMARY
lilcaddie land (<branch>... | --from-queue) --onto <base> --loop <loop> [--prepare <command>]Human only. Combines finished branches (sandbox/<work id>, work/<work id>) on a base in a scratch worktree, judges the combination with a loop’s command, file and grep gates, judges halves of a combination that fails to find which branch breaks it, and leaves one new branch landing/<time> of the ones that pass together. Moves no branch: you take it with git merge --ff-only. --prepare runs a command once in the scratch worktree first, such as the one that installs dependencies; --from-queue takes the finished work in the queue, 12 at most. Exits 1 when a branch is left out
lilcaddie memory list [--all] [--stale] [--limit <n>]Lists every memory later sessions are shown, newest first. --all adds those replaced or retired; --stale keeps those whose files have changed since
lilcaddie memory retire <memory-id> --reason <text>Human only. Stops a memory being shown to later sessions. It stays in the record, with your reason
lilcaddie memory recall [<query>] [--scope <scope>] [--limit <n>]Searches what earlier sessions learned

Know the code

CommandDoes
lilcaddie index [--full]Brings the code map up to date with the source tree
lilcaddie contextWhat lilcaddie knows about this application: packages, commands, what imports what, and the notes written about it
lilcaddie map search <name> [--kind <kind>] [--limit <n>]Finds where something is defined
lilcaddie map file <path>Outlines a file: what it defines, imports and is imported by
lilcaddie map refs <name> [--limit <n>]Finds where a name is used. Matched by name alone
lilcaddie map affected <path> [--depth <n>] [--limit <n>]Lists the files that depend on a file

Watch the work, and let agents talk

CommandDoes
lilcaddie view [--port <n>] [--no-open] [--read-only] [--add <repository>] [--forget <repository>]Opens the dashboard: a live page of the work, across the repositories on your list. Started by you at a terminal, its buttons approve, reject, end a run and agree to definitions; --read-only leaves them off
lilcaddie hubRuns the hub: agents’ messages are recorded, then handed at once to whoever is listening
lilcaddie hub statusWhether this project’s hub is running, and how many listen
lilcaddie hub send <to> <text>Sends a message to an agent
lilcaddie hub listen [--to <name>] [--after <n>]Prints messages as they are sent
lilcaddie a2a --caller <name> [--port <n>]Serves the project’s agents over the Agent2Agent protocol, on this machine. --caller names an agent that may call and makes it a token of its own; repeat it for each agent, and each sees only the tasks it sent

Check the record

CommandDoes
lilcaddie ledger query [--run <run-id>] [--kind <kind>] [--text <text>] [--after <seq>] [--limit <n>]Reads the record of what happened
lilcaddie ledger verify [--expect-head <hash>]Checks the ledger has not been altered, and still holds a head hash you kept
lilcaddie conformanceChecks the record backs what it claims: nine numbered checks
lilcaddie artifact render <name>Renders an artifact from the current run
lilcaddie artifact verifyChecks every artifact is unedited and reproducible
lilcaddie activity [--errors] [--tool <name>] [--source mcp|cli|harness] [--run <run-id>]Every tool call and command, newest first
lilcaddie activity summary [--run <run-id>]Calls and errors per tool and command
lilcaddie tune reportHow phases came out, beside the instructions and memories an agent was shown. Also lists the lessons lilcaddie drafted from checks that failed repeatedly and then passed, for you to keep with lilcaddie approve <decision-id> or turn down with lilcaddie reject <decision-id>, and the memories and lessons the counts put forward for a skill or a gate
lilcaddie tune replay <case-file|run-id> [--candidate <folder>] [--include <path>]... [--rounds <n>] [--timeout-ms <n>] (--command-file <file> | -- <command>)Does the work of a frozen case again on a throwaway copy of the repository: from the commit the case began at, under the definitions as they are now, with a candidate’s one reworded file over them if --candidate names its folder. The copy has that one commit and none of the history; --include copies in what git ignores, such as installed dependencies; a person’s approval is left out of its loops. Starts your command in the copy round after round and judges the gates itself (--command-file names a file holding it on one line, which keeps its quoting); says the score, each check’s failures and the tokens recorded. Changes nothing here. The tune flow’s gates run it
lilcaddie tune apply <slug>Human only. Puts the candidate of a tuning that won into .lilcaddie/: the one file under docs/tune/<slug>/candidate/, exactly as it was measured. Refuses unless the record shows a completed run of the tune flow with that slug in which the candidate won; refuses a candidate edited since, and definitions that changed since. Then lilcaddie trust

Wire a harness in

setup does all of this for you. These are for doing one part by hand. Each works on your own harness settings unless --project says this repository’s.

CommandDoes
lilcaddie sync [--check] [--force] [--harness <name>]Writes .lilcaddie/skills and .lilcaddie/commands out for each harness. --check only reports, and exits 2 on drift
lilcaddie mcp config <harness> [--sandbox]Prints the MCP server entry to add to a harness’s configuration
lilcaddie hooks config <harness>Prints the hook settings without writing them
lilcaddie hooks install <harness> [--all]Human only. Merges lilcaddie’s hooks into a harness’s settings. --all adds the two that record every tool call
lilcaddie hooks uninstall <harness>Human only. Removes exactly what hooks install added
lilcaddie harness try <harness> [--keep] [-- <command>]Human only. Starts one real session of a harness in a throwaway repository and reports, check by check, which of lilcaddie’s hooks and tools it honoured. It uses your own subscription or key, and no trial has been run with a real harness yet
lilcaddie statusline installHuman only. Makes lilcaddie statusline Claude Code’s status line, in your own settings (--project: this repository’s). It is the only thing Claude Code tells how much of a subscription’s 5-hour and weekly limits is used; Claude Code then runs it with its status on stdin, and it keeps the limits in ~/.lilcaddie/limits.jsonl for the dashboard to draw. A status line of your own is left alone

The sandbox

CommandDoes
lilcaddie sandbox build [--harness <name>] [--acp] [--print]Builds the sandbox image. --print shows the Dockerfile and builds nothing
lilcaddie sandbox on [--fresh]Keeps this repository’s record in the sandbox. The record so far is taken along, unless --fresh
lilcaddie sandbox offKeeps the record in the repository again
lilcaddie sandbox stopStops this repository’s helper container; the next command starts it again
lilcaddie sandbox usageShows what the sandbox takes on this machine’s disk, largest first. Changes nothing
lilcaddie sandbox clear [--older-than <hours>] [--copies] [--build-cache] [--kept] [--state-of <repository>] [--remove]Human only. Lists what old runs left behind and what removing it frees; removes it only with --remove. Never the login, an image, or a record that is not named; the record a run waits on for you only with --kept
lilcaddie sandbox run [--branch <name>] [--committed-only] [--include <path>] [--own-record] [--network allow [--allow-host <host>]] [--idle <minutes>] -- <command>Runs a command in the sandbox: a container that holds a copy of this repository and nothing else of yours. What the run commits comes back as a new branch. --network allow lets it reach only the hosts its harness calls. --own-record gives the run a new, empty record of its own, so that another run of this repository can go beside it
lilcaddie run [--harness <name>[:<role>]]... [--via <cli|acp>] [--loop <name> [--goal <text>]] [--rounds <n>] [--round-timeout-ms <n>] [--waits <n> [--wait-minutes <n>]] [--retries <n>] [--stall-minutes <n>] [-- <command>]Human only. Drives a run with nobody there. In the sandbox, on a copy of this repository, a harness (Claude Code unless told) is started round after round in its own ask-nothing mode, and lilcaddie judges the run’s gates after each round. It ends when the run completes, stops for you, the rounds are spent (10 unless told, 50 at most), or a round ends with an error. --retries <n> starts the same harness again after a round that ended with an error, ran out of time or went quiet, waiting 10 seconds and then twice as long each time, 300 at most; --stall-minutes <n> stops a round once nothing has been recorded for that long; a tool call is recorded when it ends, so give it more minutes than the longest single command takes, your test suite included. Both are off unless given. It approves nothing. The work comes back as a branch. Takes the options of sandbox run for the copy, the network and the limits. Log the harness in once first: lilcaddie sandbox run -- claude. It has driven Claude Code, on Windows; no other harness yet
lilcaddie drive [--harness <name>[:<role>]]... [--via <cli|acp>] [--loop <name> [--goal <text>]] [--rounds <n>] [--round-timeout-ms <n>] [--waits <n> [--wait-minutes <n>]] [--retries <n>] [--stall-minutes <n>] [-- <command>]What lilcaddie run starts in the sandbox: the rounds themselves. It refuses to run anywhere else, so you do not type it. Several harnesses are tried in the order given: a round goes to the first that may do the phase, and one whose round fails hands on to the next. --via acp starts them over the Agent Client Protocol
lilcaddie sandbox run --in-place [--state volume] -- <command>The same, with the repository itself mounted in place of a copy
lilcaddie sandbox scan [--image <name>] [--scanner <program>]Looks in the sandbox image for packages with known vulnerabilities, with Trivy, which you install yourself

Note Five more are run by a harness or by lilcaddie itself, not by you: lilcaddie hook, lilcaddie sandbox mcp, lilcaddie sandbox serve, lilcaddie sandbox proxy and lilcaddie sandbox adopt.

Commands in your harness

After lilcaddie setup (or lilcaddie sync), these are available in the harness itself. Each asks lilcaddie what the application is before it acts.

CommandDoes
/lilcaddie-feature <idea>Starts the feature flow
/lilcaddie-feature-clarifyAsks more questions about a feature’s specification once it is written, and adds them to its record of what was asked
/lilcaddie-bug <what is wrong>Starts the bug flow
/lilcaddie-incident <what is broken>Starts the incident flow for an outage or an unexplained failure
/lilcaddie-migrateStarts the migration flow
/lilcaddie-tech-debtStarts the tech-debt flow
/lilcaddie-product-ideaStarts the product-idea flow
/lilcaddie-securityStarts the security flow
/lilcaddie-onboardSurveys the application and records what it is
/lilcaddie-teach <file>Starts the teach flow for an instruction file
/lilcaddie-tune <the text>Starts the tune flow for a phase’s instructions or a skill
/lilcaddie-perf <the function>Starts the perf flow for one function to make faster
/lilcaddie-spike <the work>Starts the spike flow for work to investigate before building it
/lilcaddie-testing <the tests>Starts the testing flow for a test suite to improve
/lilcaddie-pr-sync [<number>]Starts the pr-sync flow for the pull request of the branch checked out
/lilcaddie-quick <the change>Starts the quick flow for a small change
/lilcaddie-nextContinues the current run: do the phase and advance
/lilcaddie-statusShows where the current run stands, changing nothing
/lilcaddie-auditAudits the current run for gaps and contradictions, changing nothing
/lilcaddie-createDesigns a loop of your own with you, and writes it once you agree
/lilcaddie-visual <screen>Takes screenshots of a user interface, holds each to the rules of good interface design, and reports what breaks them. In a run, the pictures and findings show on the run’s page
/lilcaddie-help <question>Answers a question about using lilcaddie

Note A flow’s command exists once that flow is installed. Codex has no project command format lilcaddie knows of, so it gets skills only.

The agent’s tools

Over MCP, an agent in any harness has twenty-nine tools:

ToolDoes
loop_statusWhere the work stands and what to do now. Called first, every session
loop_startStarts a named loop; with worktree, in a new checkout beside the repository, which the session’s tools then answer from until that run ends
loop_advanceDeclares the phase finished; lilcaddie judges and decides
loop_routeLets the orchestrator choose the next loop (dry_run to preview)
gate_checkEvaluates the gates without moving the run
evidence_addRecords something observed
evidence_observeHas lilcaddie run a command and record the result it saw itself
output_setSets a declared output
decision_recordRecords a choice, with reversibility and confidence
memory_writeKeeps a lesson for future sessions
memory_recallSearches what earlier sessions learned, and what is attached to a file
memory_retire_requestAsks for a memory to be retired; a person approves or turns it down
app_contextWhat the application is: packages, commands, structure, written notes
map_searchFinds where a class, function or type is defined
map_fileOutlines a file: definitions, imports, importers, attached memory
map_refsFinds where a name is used
map_affectedLists the files that depend on a file
map_refreshBrings the code map up to date and reports what it holds
artifact_renderRenders an artifact
ledger_queryReads the history
insights_reportWhat happened over the last day, as one page to give the person whole: what is worth a look, the runs, the checks that failed, who worked, what was refused
work_listThe queue: what is ready to take, what waits, who holds what
work_proposeProposes a piece of work. It waits for a person to accept it
work_claim, work_releaseTakes a piece of ready work for a time; gives it back
work_doneMarks work done, on a run of this record that completed
files_reserve, files_releaseReserves the files the agent is about to change, so that another agent’s write to them is refused; ends its own reservations
agent_sendSends a message to another agent, in any harness

There is deliberately no tool for approving anything.

Environment variables

VariableEffect
LILCADDIE_ROOTUse this directory as the project, instead of searching upward
LILCADDIE_DBUse this file as the store
LILCADDIE_JOURNALwal to opt in to WAL journaling; the default is delete
LILCADDIE_KEYSKeep your signing key in this directory instead of ~/.lilcaddie/keys
LILCADDIE_APPLICATIONSKeep your list of applications in this file instead of ~/.lilcaddie/applications.json
LILCADDIE_AGENTThe agent name a session sends and listens as, such as claude:reviewer
NO_COLOR / FORCE_COLORTurn the colour of the command line off, or on where it would be off
LILCADDIE_SANDBOXSet to 1 inside the sandbox image. Setting it yourself makes nothing a sandbox: lilcaddie also looks for a file only the image has
LILCADDIE_ROOT=/path/to/repository lilcaddie status

How-to guides

One task per guide, each with the lines to type. Most of what you will want to change is data in .lilcaddie/, and needs no code.

Start a piece of work

In your harness, with a flow’s command:

In the harness
/lilcaddie-feature Export the orders table as CSV

Or in a terminal, naming any loop the project defines:

lilcaddie loops                                   # what can be started
lilcaddie start feature --goal "Export the orders table as CSV"
lilcaddie status                                  # the first phase, and what it asks

A checkout has one live run at a time. lilcaddie start <loop> --force aborts the live run first. To work on two things at once, use a git worktree for each: every checkout has its own record, and the dashboard’s Work in this one page shows them side by side.

Continue in another session, or another harness

Nothing has to be handed over. The run is in lilcaddie’s record, not in the session.

  1. Open any harness you set up, in the same repository.
  2. Type /lilcaddie-next, or just ask the agent to continue. Its first call, loop_status, tells it the phase, what to do now, the checks, and what earlier sessions learned.
  3. To look without changing anything, use /lilcaddie-status in the harness or lilcaddie status in a terminal.

Watch from your phone

The dashboard listens on the machine’s own address only. To open it from a phone of yours, give it the name your private network gives the machine, and a key that stays the same:

On the machine
lilcaddie view --host box.tailnet.ts.net --keep-key --no-open
  1. Have your own network carry requests for that name to port 4747 of the machine: a private network’s own proxy, or a port forwarded by the SSH app on the phone (which needs no --host).
  2. Open the address lilcaddie printed after “From another device of yours”, once. The browser keeps the key for thirty days.
  3. Open Who is working: every session heard from in the last day, across your applications.
  4. To be sent a link when something waits, add "viewer": "https://box.tailnet.ts.net/" to notify.json in your own lilcaddie directory. A notice about a run then opens that run’s page.
  5. To keep the page on the phone’s home screen, use the browser’s own “Add to Home Screen”. It then opens at Waiting on you, without the browser’s bars.

Note The dashboard is for looking. Approving stays at a terminal on the machine, which an SSH app on the phone gives you. Not yet tried from a phone.

Leave the machine and still be told

A notice is sent when a run stops for you, completes or fails. The times you most need telling are the ones when nothing happens at all: the session ended, the harness reached its usage limit, the machine went to sleep. From a phone, each looks like work still going on. Before you leave, run one command in a terminal on the machine and leave it running:

On the machine
lilcaddie away --host box.tailnet.ts.net
  1. Read what it prints first: what is set up, what is missing, and what to do about each. lilcaddie doctor --away prints the same and ends.
  2. Run lilcaddie notify test once, and look for the notice on the phone. An address that takes a notice has not yet shown it to you.
  3. Leave lilcaddie away running. Once a minute it looks at this repository’s run and at your usage limits. It tells you of an active run nothing has been recorded in for 20 minutes (stalled) and of a usage limit 80% used (limit), once each.
  4. Add "heartbeat" to notify.json: an address from a service that tells you when it stops being asked for. lilcaddie away asks for it every five minutes. It is the only way to hear that the machine went to sleep.
  5. Add "quiet": {"from": "22:00", "to": "07:00"} to be left alone at night. What happened meanwhile is counted, and the count is sent in the morning.
notify.json, in your own lilcaddie directory
{
  "url": "https://ntfy.sh/a-topic-only-you-know",
  "viewer": "https://box.tailnet.ts.net/",
  "heartbeat": "https://hc-ping.com/an-id-only-you-know",
  "quiet": {"from": "22:00", "to": "07:00"}
}

Note lilcaddie away decides nothing and changes nothing in the repository, and it does not keep the machine awake: set that in the system’s own power settings. A usage limit is read for Claude Code only, once lilcaddie statusline install has been run. Not yet left running for a day, or tried against a real push service.

Have one agent build and another review

Say whose a phase is in the loop file. by names the agent it is for; apartFrom names phases whose agent may not do this one:

One phase of .lilcaddie/loops/<loop>.json
{
  "id": "review",
  "by": "reviewer",
  "apartFrom": ["build"],
  "gates": [{"type": "evidence", "kind": "review"}]
}
  1. Start each session under a name: LILCADDIE_AGENT=claude:builder for one, LILCADDIE_AGENT=codex:reviewer for the other. Without one a session goes by its harness.
  2. The builder works until the run reaches review. Its status then says the phase is not its own, and it is let go.
  3. The reviewer continues with /lilcaddie-next. An agent the phase is not for is refused its advance, its evidence and its outputs there.
  4. Where both work in one checkout at once, each reserves the files it is about to change with files_reserve, and the other’s write to them is refused.

Note This keeps cooperating agents to their parts. A session is who it was started as: it is not proof of who did the work.

Approve, reject or end a waiting run

lilcaddie status                                # why it waits
lilcaddie approve                               # the current run continues
lilcaddie approve <run-id> --note "Reviewed the diff"
lilcaddie approve <decision-id>                 # one pending decision
lilcaddie reject <decision-id> --note "Keep the old schema"
lilcaddie abort --reason "Superseded"           # end it instead

Approving a run that was handed to you lets it continue from the phase it stopped in. These commands are yours alone: run from inside an agent, they are refused. The dashboard shows the exact line for each thing that waits, with a Copy button.

Fail a phase when its tests were rewritten

Name the paths a phase must leave unchanged with protect. lilcaddie hashes them when the phase begins and fails the phase if they differ when it ends. With hooks installed, the edit is refused before it is made.

A phase in .lilcaddie/loops/<name>.json
{
  "id": "fix",
  "instructions": "Fix the bug without changing the test.",
  "protect": ["test/**"],
  "gates": [{"type": "command", "run": "npm test"}]
}

Keep a phase to the files it is about

allow is the inverse of protect: the only paths that may change during the phase. Anything else that changed fails the phase. It needs a git repository.

A phase in .lilcaddie/loops/<name>.json
{
  "id": "write-docs",
  "instructions": "Document the new endpoint.",
  "allow": ["docs/**", "README.md"],
  "gates": [{"type": "file", "path": "docs/api/*.md"}]
}

Require proof that a command really passed

Evidence recorded with evidence add is the agent’s word: “the tests pass” is a sentence it wrote. A gate with "observed": true counts only a command lilcaddie ran itself:

A gate
{"type": "evidence", "kind": "test-run", "observed": true, "commands": ["npm test"]}
lilcaddie observe --kind test-run -- npm test
  • lilcaddie records the exit code it saw and a fingerprint of the working tree. The run counts only while nothing has been edited since, which needs a git repository; "fresh": false drops that.
  • commands names the run the gate asks for. Without it, any observed command of that kind counts, and lilcaddie observe --kind test-run -- true exits 0.
  • A run that proves little is flagged: no tests ran, or the command selects part of a suite. "rejectWeak": true refuses it.
  • An agent does the same with the evidence_observe tool. With hooks installed, an agent that starts the command in its own shell is refused once and told the line to run instead.

A command gate is the alternative where lilcaddie should run the command at the gate, every time. Observed evidence is for a run that is expensive, or that has to have happened at a particular point.

Keep every run away from a file

protect belongs to a phase, and a loop file can leave it out. An invariant belongs to the project and holds in every phase of every loop:

.lilcaddie/config.json
{"invariants": {"protect": [".env", "pnpm-lock.yaml", "infra/prod/**"]}}

The files are compared with how they stood when the run started, so moving to another phase does not hide a change. When a run really must change one, a person says so, from their own terminal:

lilcaddie break-glass --reason "This run rotates the staging secret." --path .env --minutes 30

That overrides the invariant for one run, for the paths named, until it expires: an hour unless you say, a day at most. Each accepted change is recorded with the reason.

Change how forgiving a step is

By default a phase may fail its gates 3 times and be retried; the fourth failure escalates the run to a person. A run stops after 30 gate evaluations in total. Change the defaults for the project:

.lilcaddie/config.json
{
  "policy": {
    "retry": 3,
    "then": "escalate",
    "maxIterations": 30,
    "stallAfter": 0,
    "maxTokens": 0
  }
}
ToSet
Give one phase more or fewer retries"onFail": {"retry": 5, "then": "escalate"} on the phase
Send a failing phase back to an earlier one"onFail": {"retry": 2, "then": {"goto": "plan"}}
End the run instead of asking a person"then": "abort"
Give one loop a bigger total"budget": {"maxIterations": 50} on the loop
Stop retrying when nothing changes"stallAfter": 3: three identical failures running escalate at once
Stop a run that is spending without getting anywhere"maxTokens": 2000000: a phase that fails after the run has used that many tokens escalates. Counted from what the hooks record (Claude Code only), which is a guide and no proof; your approval starts the count afresh
Let more or fewer pieces of queued work be claimed at once"work": {"maxClaimed": 4} beside "policy": 8 unless you say, 64 at most
Keep two sessions from overwriting each other in one checkout"checkout": {"oneWriter": true} beside "policy": the first session to write holds the checkout and a second is refused its file writes, until the first has written nothing for 30 minutes or you run lilcaddie checkout release. Needs the hooks; a file written by a shell command is not seen
See what lilcaddie would stop before it stops anything"guard": {"mode": "monitor"} beside "policy": a call the pre-tool hook would have refused goes through, the agent is told why it would have been refused, and it is kept. lilcaddie guard lists what was kept; lilcaddie doctor and lilcaddie brief say the guard refuses nothing while it is on. Gates are judged as ever. Take the setting out to refuse again
Show a run’s decisions to more or fewer later runs"memory": {"decisionRuns": 5} beside "policy": a decision recorded in a run is shown to that run and to this many later runs of its loop, 3 unless you say, 50 at most; 0 shows it to its own run only, and "always" never leaves one out. A decision left out is still found by lilcaddie memory recall and listed by lilcaddie memory list, and a status says how many were left out

Keep a run open until its pull request is ready

Add a phase whose gate is pr-ready. It asks GitHub’s gh about the pull request of the branch being worked on and passes only when every check has passed, no reviewer asks for changes and nothing conflicts:

A phase
{"id": "pull-request", "gates": [{"type": "custom", "name": "pr-ready", "options": {"waitMinutes": 10}}]}

When a check fails the agent is told which, with its address, and goes back to work; while checks are still running the gate waits as long as waitMinutes says, 30 at most. It only reads: it opens, merges and comments on nothing.

Note Where gh is missing or not signed in, the gate says it could not judge and the run comes to you. It has been run against GitHub only.

Try a gate before it can block

A new gate that blocks correct work costs more than it saves. Put it in observe mode first:

A gate
{"type": "custom", "name": "license-check", "mode": "observe"}

It is evaluated and recorded exactly as it would be, and never blocks. Read what it has been saying, and remove mode when it is right:

lilcaddie ledger query --kind gates.*

Note Decide beforehand when that will be. A gate left in observe mode for good checks nothing.

Check something no built-in gate does

A custom gate is a file, .lilcaddie/gates/<name>.mjs, whose default export decides pass or fail. A loop refers to it by the file’s name.

.lilcaddie/gates/coverage-above.mjs
export default async (context, gate) => {
  const result = await context.exec('npm run coverage --silent');
  const percent = Number(/(\d+(\.\d+)?)%/.exec(result.output)?.[1]);
  const wanted = Number(gate.options.percent ?? 80);
  return {
    pass: percent >= wanted,
    message: 'Coverage is ' + percent + '%; ' + wanted + '% is required. Add tests for the uncovered lines.',
  };
};
A gate
{"type": "custom", "name": "coverage-above", "options": {"percent": 85}}
context.Gives
rootAbsolute path of the repository
phaseThe current phase’s definition
exec(command, options)Runs a shell command; resolves to {code, timedOut, output}
evidence(kind, scope)Evidence records of that kind, in this phase or run
outputs()Outputs recorded so far in this run
approvals()Human approvals granted in this phase
artifact(name)The latest render of an artifact: {path, sha256} or null
fingerprint()The working tree’s fingerprint now, or null outside git
changes()Files changed since the phase began, or null if unknowable
memories(prefix)Active repository memories whose key starts with prefix
  • The message is a prompt. The agent reads it, so say what is wrong and what to do.
  • It fails closed. A gate that throws, has a syntax error or returns anything but {pass, message} is a failed gate.
  • When it cannot judge at all, because a tool is missing, return {pass: false, evaluated: false, message}: the run goes to a person instead of spending retries.
  • An edit stops the runs it was judging, until the file is put back or a person runs lilcaddie repin.

Require a person’s sign-off

Add an approval gate to the phase that must not pass without you:

A phase
{
  "id": "ship",
  "instructions": "Summarise what changed and wait for approval.",
  "gates": [{"type": "approval"}]
}

When the run reaches it, the agent is told to stop and the run shows under “Waiting on you”. lilcaddie approve lets it through.

Chain loops together

Without an orchestrator, you start each loop by name. With .lilcaddie/orchestrator.json, lilcaddie chooses the next loop from what has been recorded. Routes are tried in order and the first whose when holds wins. A route goes to a loop, to $done or to $halt.

ConditionTrue when
{"output": "triage.kind", "equals": "bug"}That loop recorded that output
{"run": "bugfix", "status": "completed"}Such a run happened
{"last": "bugfix", "status": "failed"}The most recent run is that
{"artifact": "report"}It is rendered and unedited
{"file": "docs/adr/*.md"}A file matches
{"gate": {"type": "command", "run": "npm test"}}That gate passes
{"all": [...]}, {"any": [...]}, {"not": ...}Combinators
lilcaddie route --dry-run   # which route would match, and why; changes nothing
lilcaddie route             # take it
lilcaddie reset             # after $done or a halt: begin a new piece of work

Routing happens only between runs. If the same route would be taken twice with nothing changed in between, the orchestrator halts instead of looping. A triage loop that routes is a complete example.

Produce a report from the record

An artifact is a file rendered from the record of a run. Two files define one: where it goes, and its template.

.lilcaddie/artifacts/report.json
{"output": "docs/runs/{{run.id}}.md", "template": "report.md"}
.lilcaddie/artifacts/report.md
# {{loop.name}} — {{run.id}}

**Goal:** {{run.goal}}

{{#each phases}}- [{{state}}] {{title}}
{{/each}}
## Evidence

{{#each evidence}}- {{kind}}: {{summary}}
{{else}}None recorded.
{{/each}}

Name it in a phase to have it rendered, and gate on it to require it:

A phase
{
  "id": "report",
  "artifacts": ["report"],
  "gates": [{"type": "artifact", "name": "report"}]
}

A template can read run, loop, phases, decisions, evidence, outputs and ledger. It has values, a few filters (json, len, upper, lower, trim, mark, passfail) and each, if and unless blocks. It has no clock and no I/O, which is what makes a render reproducible.

Note Never edit a rendered artifact: an edited report fails its gate. Record what is missing and render again. lilcaddie artifact verify checks every one.

Give every harness the same skill or command

Each harness reads skills and commands from its own folders, in its own format. Keep one copy in .lilcaddie/ and let sync write the rest.

.lilcaddie/commands/fix-issue.md
---
description: Fix a numbered issue
---
Fix issue $ARGUMENTS. Start with loop_status.
lilcaddie sync            # write the harness files
lilcaddie sync --check    # exit 2 if any of them has drifted; for CI
  • A skill is a folder, .lilcaddie/skills/<name>/SKILL.md, plus any files beside it. A phase names the skill an agent should use with "skill": "<name>".
  • sync records what it wrote in .lilcaddie/sync.lock.json. It will not overwrite a file it did not write, or one edited after it wrote it; --force replaces them.
  • Commit the lockfile and the generated files, so a clone works without running anything.
  • To pull commands from another repository, declare them in agents.toml and run lilcaddie commands install.

Keep a lesson for later sessions

lilcaddie memory add "Integration tests need the local database started first." --kind learning
lilcaddie memory add "Never edit generated files under api/gen." --kind warning --scope "path:api/gen/**"
lilcaddie memory recall "database"
ScopeShown
repo (the default)In every session in this repository
loop:<name>To runs of that loop
path:<glob>When an agent is about to work on a file that matches

An agent does the same with memory_write and memory_recall. Kinds are fact, correction, decision, learning, preference and warning. Writing under a --key that exists replaces that memory.

Check the record is what happened

lilcaddie ledger verify                        # no event was edited; prints the head hash
lilcaddie ledger verify --expect-head 9f2c…e41a  # and it is still the history you kept
lilcaddie conformance                          # nine numbered checks; exits 2 if any fails

Each event carries the hash of the one before, so an edited event breaks every hash after it. That shows the events agree with each other. It cannot show they are the events you had last week: someone who can write the file can rebuild the whole chain. What settles that is a head hash kept somewhere the store’s writers cannot reach: a commit message, a ticket, a report in git. approve, break-glass and repin print the head when a person acts.

To have what you approve signed:

lilcaddie key init      # an Ed25519 key in ~/.lilcaddie/keys; give it a passphrase
lilcaddie key enroll    # adds your public key to .lilcaddie/approvers.json; commit it

Note With a passphrase, lilcaddie asks for it at the terminal each time and takes it from nowhere else, so the key file alone is not enough to sign. Without one, a signature shows only that the key was used.

Continue a run that stopped because its rules changed

A run records the hash of its loop, the policy and invariants in config.json, and every custom gate it uses. If any of them changes while the run is in progress, the run stops: otherwise the shortest way past a failing gate would be to edit the gate.

What changedDo
By accidentPut the file back. The run continues
The policy, an invariant, a custom gate, or the approvers, on purposelilcaddie repin: a person accepts the change for that run, and it is recorded
The loop file itselflilcaddie abort, then start another run. A changed loop cannot be accepted

Make the flows’ test gates prove more

A gate that only sees an exit code cannot tell a crash from a failing test. Tell a flow where your commands write their reports, and its gates read them: JUnit XML, CTRF, Jest or Vitest JSON and Playwright JSON are understood, with no package to install.

lilcaddie flow install feature --force \
  --set test_command="node --test --test-reporter=junit --test-reporter-destination=reports/tests.xml" \
  --set test_report="reports/tests.xml"

With a report, the run carries proof from phase to phase: where tests are written they must fail, and their names are recorded; where they must pass, each recorded test must be in the report as passed, under the same name. One that was deleted, skipped or renamed fails the gate.

Set up, change or do without the security scanners

The security phase of every code flow runs Semgrep, Trivy and Gitleaks by default. lilcaddie does not install them: setup and flow install name the ones that are missing.

lilcaddie flow install feature --force --set sast_command="semgrep scan --config p/python --error --metrics=off ."
lilcaddie flow install feature --force --set secrets_command=""   # do without Gitleaks
lilcaddie flow install feature --force --no-scanners              # do without all of them

A scanner that is not installed fails its gate with a message saying so. It is never taken as “no findings”. Without scanners the security phase rests on the written review alone, and its gate says so each time.

Watch several repositories and worktrees

lilcaddie view --add ~/code/shop-api
lilcaddie view --add ~/code/shop-web
lilcaddie view

Work › All applications then shows each repository with one sentence on how its work stands. Work › This repository shows a repository checkout by checkout: the branch each is on, the run going on there, and how many files are changed and not committed. Opening a checkout shows every page for that checkout, with a strip across the top saying so.

Check a pull request’s commits against their runs

Three steps, each a person’s to turn on. First, have commits name the run they were made in:

Once, in the repository
lilcaddie claim on

When a run is completed, keep its record in the repository’s history and send it with the branch:

lilcaddie bundle attach r_mf3k9x2a1b
git push origin 'refs/lilcaddie/runs/*:refs/lilcaddie/runs/*'

Then anyone with the history, a CI job included, can check a range:

git fetch origin 'refs/lilcaddie/runs/*:refs/lilcaddie/runs/*'
lilcaddie bundle check origin/main..HEAD

A commit whose run’s record is there, holds, is completed and signed, and names the commit is verified. missing and invalid fail the check. A commit that was rebased or squashed after its run is unnamed, which fails only with --strict. A commit that claims no run is counted and never fails. No push to a remote has been tried with these commands yet.

Find out how to do something else

lilcaddie ask "how do I write a custom gate?"
lilcaddie ask "how do I write a custom gate?" --more   # the whole section
lilcaddie <command> --help
lilcaddie doctor

ask is a search of lilcaddie’s own guide, not a model: the same question gets the same answer, with no network. In a harness, /lilcaddie-help <question> has the agent run it and answer from what it prints.

Custom loop examples

Loops you can copy into .lilcaddie/loops/, from the smallest to one that routes between others. Each is complete, and each is checked against lilcaddie’s own schema.

What a loop file is

A loop is one JSON file in .lilcaddie/loops/. It is data, never code, and it is checked strictly: an unknown key is an error, so a typo such as gate for gates is reported instead of producing a phase with no exit checks.

Phase fieldMeaning
idRequired. Lower-case name, unique in the loop
titleShown in the status. Defaults to the id
instructionsWhat the agent is told to do
skillName of a skill the agent should use for this phase
gatesExit checks. All must pass
outputsValues the agent must record. Each required one becomes a gate
protectGlobs that must be unchanged when the phase ends
allowThe only globs that may change during the phase; needs a git repository
artifactsArtifacts to render before the gates are judged
onFail{"retry": n, "then": "escalate" | "abort" | {"goto": "<phase id>"}}
Gate typeExamplePasses when
command{"type": "command", "run": "npm test"}It exits 0 (or expectExit) in time
file{"type": "file", "path": "docs/adr/*.md"}A file matches ("absent": true inverts)
grep{"type": "grep", "path": "src/**", "pattern": "TODO", "absent": true}The pattern is found, or is not
evidence{"type": "evidence", "kind": "test-run", "min": 2}That many records exist in this phase
evidence{"type": "evidence", "kind": "test-run", "observed": true}lilcaddie itself saw that run pass, since the last edit
approval{"type": "approval"}A person ran lilcaddie approve
artifact{"type": "artifact", "name": "report"}It is rendered and unedited
custom{"type": "custom", "name": "my-gate"}Your own check in .lilcaddie/gates/my-gate.mjs says so
outputAdded for you, one per required outputThe output is set and valid
unchangedAdded for you by protectThe paths match their hashes at phase entry
scopeAdded for you by allowNothing outside the paths changed in the phase

A command gate also takes timeoutMs, cwd and tailLines. Any gate takes a message, which replaces the text shown to the agent when it fails, and "mode": "observe" to try it without blocking.

After writing or changing a loop, check it, then start it:

lilcaddie validate
lilcaddie start <name> --goal "<what you want>"

Note To get a starting point instead of a blank file: lilcaddie flow new <name> writes a three-phase loop, a skill and a command to edit, and /lilcaddie-create in your harness designs one with you and writes it once you agree.

The smallest loop

One phase, finished when a piece of evidence has been recorded. This is the example loop lilcaddie init writes; it is enough to see the whole model work.

.lilcaddie/loops/example.json
{
  "name": "example",
  "description": "One phase: do something and say what you saw.",
  "phases": [
    {
      "id": "work",
      "instructions": "Do the work, then record what you observed as evidence of kind \"done\".",
      "gates": [
        {
          "type": "evidence",
          "kind": "done"
        }
      ]
    }
  ]
}

Fix a bug, test first

Two phases. The first passes only when the tests fail, so a reproduction exists before anything is fixed. The second protects the tests, so a fix that changes them fails the phase.

.lilcaddie/loops/bugfix.json
{
  "name": "bugfix",
  "description": "Reproduce a bug, fix it, prove it.",
  "phases": [
    {
      "id": "reproduce",
      "instructions": "Write a failing test that reproduces the bug. Record the failing run as evidence.",
      "gates": [
        {
          "type": "command",
          "run": "npm test",
          "expectExit": 1
        },
        {
          "type": "evidence",
          "kind": "reproduction"
        }
      ]
    },
    {
      "id": "fix",
      "instructions": "Fix the bug without changing the test.",
      "protect": [
        "test/**"
      ],
      "gates": [
        {
          "type": "command",
          "run": "npm test"
        }
      ],
      "onFail": {
        "retry": 3,
        "then": "escalate"
      },
      "outputs": {
        "summary": {
          "type": "string",
          "description": "One sentence: what was wrong."
        }
      }
    }
  ]
}
lilcaddie start bugfix --goal "Login fails for emails with a plus sign"

A small change with a person’s sign-off

For everyday changes: the work must pass the project’s own verification, the agent must say what it did, and a person approves before the run completes. If verification keeps failing, the run goes back to planning instead of trying the same thing again.

.lilcaddie/loops/change.json
{
  "name": "change",
  "description": "Plan a change, make it, prove it, and get it approved.",
  "phases": [
    {
      "id": "plan",
      "title": "Plan",
      "instructions": "Read the code the change touches. Write the plan to docs/plan.md: what will change, in which files, and how it will be tested.",
      "allow": [
        "docs/plan.md"
      ],
      "gates": [
        {
          "type": "file",
          "path": "docs/plan.md"
        }
      ]
    },
    {
      "id": "implement",
      "title": "Implement and verify",
      "instructions": "Make the change the plan describes, with tests. Set the summary output to one sentence saying what changed.",
      "gates": [
        {
          "type": "command",
          "run": "npm run verify",
          "timeoutMs": 900000,
          "tailLines": 60
        }
      ],
      "onFail": {
        "retry": 3,
        "then": {
          "goto": "plan"
        }
      },
      "outputs": {
        "summary": {
          "type": "string",
          "description": "One sentence: what changed."
        }
      }
    },
    {
      "id": "approve",
      "title": "Approval",
      "instructions": "Show the summary and the diff, then stop. A person approves from their own terminal.",
      "gates": [
        {
          "type": "approval"
        }
      ]
    }
  ]
}

A documentation-only change

The phase may touch nothing but the documents. It passes when the page exists, no placeholder is left in it, and the link checker is clean.

.lilcaddie/loops/docs.json
{
  "name": "docs",
  "description": "Write or update a page of documentation, and nothing else.",
  "phases": [
    {
      "id": "write",
      "instructions": "Write the page the goal asks for under docs/. Do not change source code.",
      "allow": [
        "docs/**",
        "README.md"
      ],
      "gates": [
        {
          "type": "file",
          "path": "docs/**/*.md"
        },
        {
          "type": "grep",
          "path": "docs/**/*.md",
          "pattern": "TODO|TBD|lorem ipsum",
          "flags": "i",
          "absent": true,
          "message": "A placeholder (TODO, TBD or lorem ipsum) is still in the documents. Replace it with the real text."
        },
        {
          "type": "command",
          "run": "npm run docs:check-links"
        }
      ]
    }
  ]
}

An expensive test suite, run once and proven

The end-to-end suite takes twenty minutes, so it should run once, at the right moment, and count only if nothing was edited afterwards. The gate asks for a run of exactly that command which lilcaddie saw pass itself.

.lilcaddie/loops/e2e.json
{
  "name": "e2e",
  "description": "Make a change and prove it with the end-to-end suite.",
  "budget": {
    "maxIterations": 20
  },
  "phases": [
    {
      "id": "change",
      "instructions": "Make the change. Run the unit tests as you go; do not run the end-to-end suite yet.",
      "gates": [
        {
          "type": "command",
          "run": "npm test"
        }
      ]
    },
    {
      "id": "prove",
      "instructions": "Run the end-to-end suite through lilcaddie: evidence_observe with kind \"e2e-run\" and the command \"npm run test:e2e\". If it fails, fix the cause and run it again.",
      "protect": [
        "e2e/**"
      ],
      "gates": [
        {
          "type": "evidence",
          "kind": "e2e-run",
          "observed": true,
          "commands": [
            "npm run test:e2e"
          ],
          "rejectWeak": true
        }
      ],
      "onFail": {
        "retry": 2,
        "then": "escalate"
      }
    }
  ]
}
What the agent’s tool call does
lilcaddie observe --kind e2e-run -- npm run test:e2e

A release checklist with a report

Outputs make the agent write down the facts the release rests on, in a form that is checked: a version that looks like a version, a changelog that exists. The last phase renders a report from the record and waits for a person.

.lilcaddie/loops/release.json
{
  "name": "release",
  "description": "Prepare a release: version, changelog, checks, sign-off.",
  "phases": [
    {
      "id": "prepare",
      "title": "Version and changelog",
      "instructions": "Choose the next version from the changes since the last tag. Update CHANGELOG.md and set the version and breaking outputs.",
      "allow": [
        "CHANGELOG.md",
        "package.json"
      ],
      "outputs": {
        "version": {
          "pattern": "^\\d+\\.\\d+\\.\\d+$",
          "description": "The version being released, e.g. 1.4.0."
        },
        "breaking": {
          "type": "boolean",
          "description": "True if anything in it breaks existing use."
        }
      },
      "gates": [
        {
          "type": "grep",
          "path": "CHANGELOG.md",
          "pattern": "^## \\d+\\.\\d+\\.\\d+",
          "flags": "m"
        }
      ]
    },
    {
      "id": "check",
      "title": "Checks",
      "instructions": "Run the build and the full test suite. Fix what fails without changing the version.",
      "protect": [
        "CHANGELOG.md"
      ],
      "gates": [
        {
          "type": "command",
          "run": "npm run build"
        },
        {
          "type": "command",
          "run": "npm test"
        }
      ]
    },
    {
      "id": "signoff",
      "title": "Sign-off",
      "instructions": "Nothing to do by hand: the report is rendered from what was recorded. A person reads it and approves.",
      "artifacts": [
        "report"
      ],
      "gates": [
        {
          "type": "artifact",
          "name": "report"
        },
        {
          "type": "approval"
        }
      ]
    }
  ]
}

The report artifact is the one lilcaddie init creates; Produce a report from the record shows how to write your own.

A triage loop that routes to others

A first loop decides what kind of work a request is and records it as an output. The orchestrator reads that output and starts the right loop; nobody asks a model what to do next.

.lilcaddie/loops/triage.json
{
  "name": "triage",
  "description": "Decide what kind of work a request is.",
  "phases": [
    {
      "id": "classify",
      "instructions": "Read the goal and the code it concerns. Set kind to \"bug\" if something that worked is broken, otherwise \"feature\". Record what you read as evidence of kind \"triage\".",
      "outputs": {
        "kind": {
          "enum": [
            "bug",
            "feature"
          ],
          "description": "What kind of work this is."
        }
      },
      "gates": [
        {
          "type": "evidence",
          "kind": "triage"
        }
      ]
    }
  ]
}
.lilcaddie/orchestrator.json
{
  "routes": [
    {
      "id": "bug-done",
      "when": {
        "run": "bugfix",
        "status": "completed"
      },
      "to": "$done"
    },
    {
      "id": "feature-done",
      "when": {
        "run": "feature",
        "status": "completed"
      },
      "to": "$done"
    },
    {
      "id": "bug",
      "when": {
        "output": "triage.kind",
        "equals": "bug"
      },
      "to": "bugfix"
    },
    {
      "id": "feature",
      "when": {
        "output": "triage.kind",
        "equals": "feature"
      },
      "to": "feature"
    },
    {
      "id": "first",
      "to": "triage"
    }
  ]
}
lilcaddie reset --goal "Search returns stale results"
lilcaddie route --dry-run   # first → triage
lilcaddie route             # starts triage; when it completes, route again

Routes are tried in order and the first whose when holds wins, so the “done” routes come first and the route with no condition comes last.

A loop with a gate of your own

When no built-in gate fits, write one and name it in the loop. Here a phase may not end until coverage is at least 85%. The gate is tried in observe mode first, so it is recorded but cannot block until you trust it.

.lilcaddie/loops/covered.json
{
  "name": "covered",
  "description": "Make a change without letting coverage fall.",
  "phases": [
    {
      "id": "change",
      "instructions": "Make the change, with tests for every new branch.",
      "gates": [
        {
          "type": "command",
          "run": "npm test"
        },
        {
          "type": "custom",
          "name": "coverage-above",
          "options": {
            "percent": 85
          },
          "mode": "observe"
        }
      ]
    }
  ]
}

Check something no built-in gate does has the gate file, .lilcaddie/gates/coverage-above.mjs. Remove "mode": "observe" when its results are right.

Share a loop with your team as a flow

A flow is a folder with a flow.json, kept anywhere, that installs a loop and everything it needs into a repository.

team-flows/release/flow.json
{
  "name": "release",
  "description": "How we ship.",
  "include": [
    "../shared"
  ],
  "variables": {
    "test_command": {
      "description": "Runs the tests.",
      "default": "npm test"
    }
  }
}
  • Beside flow.json go loops/, gates/, skills/, commands/ and artifacts/, installed into .lilcaddie/ as they are.
  • __TEST_COMMAND__ in any file becomes the value of test_command, which each repository sets when it installs the flow.
  • include installs another folder’s files too, for gates several flows share.
lilcaddie flow install ../team-flows/release --set test_command="pnpm test"

Installed files belong to the repository: edit any of them, and installing again will not overwrite your edits unless you pass --force.

Security and sandboxes

The measures lilcaddie takes around an agent’s work, what a person alone may do, how the record is kept, and what the Docker sandbox adds. They are made with best effort and none is a guarantee: each part says what it does not do.

What lilcaddie does, and why

A coding agent runs as you, with a shell. The risk lilcaddie is built around is not a stranger on the network; it is the agent itself taking the shortest way to “done”: saying the tests pass, editing the test, editing the check, or approving its own work. Each measure below is aimed at one of those.

The shortcutThe measure aimed at it
Saying the work is finishedGates: lilcaddie runs the checks itself. The agent’s word is not counted
Saying a command passedObserved evidence: only a command lilcaddie ran, with nothing edited since
Rewriting the tests, or files outside the taskprotect, allow, and project invariants
Editing the gate, the policy or the loop mid-runPinning: the run stops when what judges it changes
Approving its own workHuman-only commands, and no agent tool for approval
Rewriting the historyA hash-chained ledger, a head hash you keep, and conformance
Calling a decision small and safe, so nobody is askeddecisionsRequireApproval: every decision is held for a person, whatever the agent says of it
Writing itself an easier loop between runslilcaddie trust: a changed definition runs nothing until you agree again
Leaving a key or a password in the historySecrets are taken out before anything is written to the record
Editing the record file, or reading your keysThe sandbox: the record in a volume, or the whole harness in a container on a copy of the repository
Sending your code or a key somewhereThe sandbox’s list of hosts (--network allow), which you ask for

Note These are guardrails around a cooperative-but-fallible agent, made with best effort. Nothing here is perfect: lilcaddie does not promise that an agent is prevented from doing anything, or that your code, keys or machine are secure. On your own machine they are not a security boundary against a process that sets out to defeat them: it runs as you. The sandbox adds separation, and its limits are listed below.

What only a person may do

ActionCommand
Agree to run what a repository defineslilcaddie trust
Let a run or a decision go aheadlilcaddie approve
Refuse a decisionlilcaddie reject
Allow a change to an invariant filelilcaddie break-glass
Accept a change to what judges a runlilcaddie repin
Install or remove hookslilcaddie hooks install, lilcaddie hooks uninstall, lilcaddie statusline install
Create, protect or enroll a signing keylilcaddie key init, key protect, key enroll
Resume, end or reset a runlilcaddie resume, lilcaddie abort, lilcaddie reset
Accept, start or drop queued worklilcaddie work accept, work start, work drop
Retire a memorylilcaddie memory retire
Start an unattended run, or replay a caselilcaddie run, lilcaddie case replay
  • Each refuses to run inside an agent process, and there is deliberately no MCP tool for any of them.
  • What changes a run is recorded with who did it. lilcaddie conformance check C04 fails if an approval, a rejection, a break-glass or a re-pin was recorded by an agent.
  • That refusal is a check of the environment, not proof of who typed. To make an approval prove a person was there, sign it. lilcaddie doctor says so wherever a loop waits for an approval and no approver is enrolled.

Buttons on the dashboard

A dashboard you started yourself, at a terminal, puts a button beside four of the commands it shows: approve, reject, end a run, and agree to run a repository’s definitions. A button asks first, then does exactly what its command does, recorded as done by you through the viewer.

  • When there are none. A dashboard started by an agent, through a pipe or a script, or in the sandbox has no buttons; neither has one given --host, --listen, --keep-key or --read-only. It shows commands to copy, as before.
  • What a request to act needs. The viewer’s key, the address on this machine it was started at, and to come from the viewer’s own page. Another site, and another device, cannot ask.
  • Agreeing to definitions covers exactly the files the page listed: if one changed since, nothing is agreed to and the page lists them again.
  • A signing key with a passphrase is asked for in the dialog, used for that one signature, and not kept.
  • What a press does not prove. That a person pressed. Anything holding the dashboard’s address, or able to drive the browser it is open in, can press too, an agent included. If that matters, sign approvals with a key that has a passphrase, or start the dashboard with --read-only.

Agreeing to run a repository’s definitions

A loop file names shell commands, and a custom gate is code. They arrive with a clone, and an agent that can write the repository can write them. So lilcaddie runs none of it until you have said, once, that this repository’s definitions are yours to run:

lilcaddie trust   # lists what its loops and gates would run, then records that you agree

Read the list. It is the same decision as running a script someone sent you. Until you have agreed, advance, check, observe, route, artifact render, the agent’s tools and the stop hook refuse, saying so, and run nothing. What only reads (status, the ledger, the code map, a dry-run route) works as always.

  • What you agreed to is a hash of the files that decide what is run: .lilcaddie/loops/, gates/, artifacts/, orchestrator.json, config.json and approvers.json.
  • It is kept in your own lilcaddie directory (~/.lilcaddie/trusted.json), by repository, and never in the repository.
  • A change to any of those files is asked about again. After you edit a loop, install a flow, or pull someone else’s change to one, run lilcaddie trust once more. That is also the measure against an agent writing itself an easier loop between runs.
  • trust is human-only, like approve: it needs a terminal, or the button of a dashboard you started at one. For a repository that keeps its record in the sandbox, it is asked on your machine, because your machine is where a gate’s command runs.

Rules about which files may change

RuleSet inHolds
protectA phaseThose paths are unchanged when the phase ends
allowA phaseNothing but those paths changed during the phase
invariants.protect.lilcaddie/config.jsonIn every phase of every loop, compared with how the files stood when the run started

With hooks installed, an edit to a protected or invariant file is refused before it is made; without them, it fails the gate afterwards. An invariant can be overridden only by a person, for one run and a limited time, with a reason that is recorded:

lilcaddie break-glass --reason "This run rotates the staging secret." --path .env --minutes 30

Good candidates for invariants: secrets (.env), lockfiles, production infrastructure, CI configuration, and lilcaddie’s own definitions.

A run is held to the rules it started under

When a run starts, lilcaddie records the hash of its loop and of everything else that judges it: the policy and invariants in config.json, every custom gate file, and .lilcaddie/approvers.json. Each gate evaluation records them again. If any of them changes while the run is in progress, the run stops, because otherwise the shortest way past a failing gate would be to edit the gate.

Put the file back and the run continues. If the change is meant, a person accepts it for that run with lilcaddie repin, which is recorded. A changed loop file cannot be accepted: abort the run and start another.

Decisions an agent may not take alone

An agent records its decisions with how reversible each is and how sure it is. Those are its own words: minConfidence and oneWayRequiresApproval hold only an agent that reports itself fairly. To hold every decision for a person, whatever the agent says of it, set this in the policy in .lilcaddie/config.json:

{"policy": {"decisionsRequireApproval": true}}
  • A phase may set "decisionsRequireApproval" itself, and its value then stands in place of the policy’s for decisions recorded in that phase: true on a design phase holds what is decided there and nowhere else.
  • lilcaddie approve names the decisions of a run that took effect without a person, so you see them before you let the run go on.
  • The policy is one of the files that judge a run: changing it mid-run stops the run, and changing it between runs is asked about by lilcaddie trust.

Secrets and the record

The ledger is not meant to be edited afterwards, so what goes into it is checked first. What you type to your agent, the arguments of every recorded tool call and command, memories, goals and evidence all pass through one filter before they are written, and what looks like a secret is replaced by a marker such as [redacted:github-token].

Taken outRecognised by
Tokens of GitHub, AWS, Slack, Google, Stripe, sk-…Their prefix and length
Private keys, JSON Web Tokens, Bearer and BasicTheir armour or layout
The password in a URLscheme://user:…@host
A value given to password, token, apiKey and kinThe name, and a value with a letter and a digit
Your own keysThe exact values of the environment variables whose names say they are secrets (*_API_KEY…)

To keep no prompt text at all, set {"record": {"prompts": false}} in .lilcaddie/config.json: each prompt is then recorded by its length alone. That file is one lilcaddie trust covers, so a change that switches recording off is asked about.

Note It goes by shape, never by how random something looks, so a secret of no recognisable shape that is not in your environment is kept. Treat this as what lowers the risk, not as proof the record holds no secret. One that does get in can only be dealt with by changing it. The log of a sandbox run (~/.lilcaddie/logs/) is whatever the run printed, and is not filtered.

A record built to show an edit

Every state change is one ledger event, and each event carries the hash of the one before. An edited event breaks every hash after it.

lilcaddie ledger verify                          # the chain is intact; prints the head
lilcaddie ledger verify --expect-head 9f2c…e41a  # and still holds the head you kept
lilcaddie conformance                            # nine numbered checks
CheckWhat it checks
C01The ledger is intact
C02No run advanced or completed while an enforced gate was failing
C03Every completed run was completed by a recorded decision
C04Approvals, rejections, break-glass and re-pins were not made by an agent
C05Every record in a table has its ledger event, and the reverse
C06Every rendered artifact is unedited and reproduces from its recorded data
C07Every live run is still judged by the loop, policy and gates it started with
C08Every accepted change to an invariant file was made under a break-glass
C09Every human-only action since an approver was enrolled is validly signed

Note The chain shows the events agree with each other. It cannot show they are the events you had last week: someone who can write the file can rebuild the whole chain. Keep a head hash somewhere the store’s writers cannot reach (a commit message, a ticket, a report in git) and check it with --expect-head.

Signing what you approve

By default an approval is recorded with a name and nothing behind it. To have yours signed, create a key once per machine and enroll it in each repository:

lilcaddie key init      # an Ed25519 key in ~/.lilcaddie/keys; give it a passphrase
lilcaddie key enroll    # adds your public key to .lilcaddie/approvers.json; commit it

From then on approve, reject, break-glass and repin are signed. The signature covers what was done and the hash of the event before it, which is meant to keep it from being forged without the key, altered, or copied to another place in the ledger.

Your key hasWhat a signature shows
A passphraseThe action was made by someone who typed the passphrase. lilcaddie asks for it at the terminal each time and takes it from nowhere else: no option, variable or pipe
No passphraseOnly that the key was used, by anything that could read the file. An agent with a shell can read it

What a passphrase does not stop is an agent that watches you type it, or that replaces the program you type it into. Keeping that out means keeping the agent off your machine: run the harness in the sandbox.

Security review of the work itself

Security is a phase of every code flow. Each reviews its change against all ten OWASP Top 10:2025 categories and runs three scanners, which must come back clean:

ToolChecks
Semgrep CESecurity bugs in the code
TrivyVulnerable dependencies, secrets, insecure configuration
GitleaksSecrets committed to the repository
  • lilcaddie does not install them. A scanner that is missing fails its gate; it is never taken as “no findings”.
  • The security flow assesses a whole codebase: scope and ASVS level, threat model, scans, a manual OWASP Top 10 review, findings, a remediation plan, regression tests, the fixes, a re-scan, and a person’s sign-off.
  • The product-idea flow lists the data, the privacy duties and the abuse cases before a brief is written.
  • The written review, the findings and the audit verdict are the agent’s word, and their gates say so: they check form, not truth. The scanners and the tests are what lilcaddie saw itself, and a clean scan shows only that these tools found nothing.

Set up, change or do without the scanners has the commands.

What the dashboard answers, and to whom

  • It listens on 127.0.0.1 only.
  • It answers GET and nothing else. Nothing can be approved, started or changed through it.
  • It shows the record only to a page opened from the address lilcaddie view prints. That address carries a key made anew each time the viewer starts; the page keeps it as a cookie no script can read, and without it nothing of the record is answered. That is meant to keep another program on your machine that finds the port from reading the record.
  • It refuses a request whose Host header is not 127.0.0.1 or localhost at its port, a measure against a web page elsewhere reading it by pointing a name of its own at your machine.
  • Whatever path is asked for, it serves only its own page, scripts, stylesheet and typefaces.
  • Of your repository’s files it sends only what a run’s record names: the screenshots a run recorded, and the text of a run’s documents, which are the reports lilcaddie rendered and the text files in that run’s own folder. Each is checked to be inside the repository and under a size limit before it is read.
  • It reads only the repository it was started in, that repository’s checkouts, and the repositories you put on your list. It never searches the disk for projects.

Agents that call from outside

lilcaddie a2a lets an agent that is not lilcaddie’s send a message to one of the project’s agents over the Agent2Agent protocol. It is a narrow door:

  • Every token is one named caller’s. lilcaddie a2a --caller reviewer makes a token for reviewer. There is no token that is everyone’s, and the server does not start without a caller. Tokens are kept in .lilcaddie/state/a2a.json, which is not committed, and are never printed.
  • A caller sees only its own tasks. A task is kept for the caller whose token sent it: no other caller can read, list or cancel it, and the ledger says which caller passed a message on (a2a:caller:<name>).
  • A caller can ask, and nothing more. It can have text passed to an agent and read what comes back. It cannot approve, advance or change a run, and nothing from outside is passed to the names human or a2a.
  • It stays on this machine. It listens on 127.0.0.1 only, refuses a request whose Host is not that address, and refuses any request with an Origin: no web page is a caller.
  • There is an end to what it holds: 64 tasks waiting at once, and 2,000 in one run of the server.

Note Two agents handed the same caller’s token cannot be told apart: give each its own. The tokens are in a file of the repository’s own (.lilcaddie/state/a2a.json), so an agent working in that repository on this machine can read them and call as any caller: a token tells outside callers apart, not the agents already here. What comes back from an agent is that agent’s claim, not proof that anything was done.

A server that is the lilcaddie you built

  • A running MCP server refuses once lilcaddie is rebuilt or upgraded under it (E_STALE_SERVER), saying how to get a current one. A server keeps the code it started with, so without this an old server would go on judging gates by rules you have since fixed.
  • A store that is not lilcaddie’s own is refused when it is opened: one that lacks the triggers that keep the ledger from being edited, or holds a trigger or a view lilcaddie did not make. A database file can arrive inside a clone.
  • Programs are found on the `PATH`, never in the repository. lilcaddie starts git, docker and the like by absolute path, so a git.exe an agent leaves in the working directory is not what runs.
  • lilcaddie’s own calls to git run nothing the repository names: its core.fsmonitor, hooks, filter drivers and textconv are ignored.
  • Saying “this is the sandbox” takes more than a variable. Inside the sandbox lilcaddie does not ask for lilcaddie trust again and sends a gate’s command to your machine to be run. Both would be shortcuts on your own machine, so lilcaddie takes itself to be in the sandbox only where LILCADDIE_SANDBOX is set and the image’s own marker file is there, which only root can make. Setting the variable in a shell changes nothing, and LILCADDIE_RUNNER is ignored outside the image.

The sandbox, and its two uses

The sandbox is a Docker container that holds lilcaddie and one repository, and nothing else of yours. It has two uses, and neither needs an API key.

UseWhat runs in the containerWhat it is meant to keep from the agent
The record in the sandboxlilcaddie’s MCP server and its database. Your harness stays on your machineA file path to the record, so the database is not edited in passing
The harness in the sandboxThe harness itself, and lilcaddieYour home directory: signing keys, harness logins, SSH keys, your terminal
lilcaddie sandbox build      # once: the image (Node, git, lilcaddie, Claude Code)

Note Tested on Docker Desktop for Windows only. The first use has served real Claude Code sessions. One harness has worked inside the container, once: Claude Code, logged in there, wrote a file that came back as a branch and called lilcaddie’s server. The other harnesses have not.

Keep lilcaddie’s record in the sandbox

lilcaddie setup --sandbox                 # a new repository
lilcaddie sandbox on && lilcaddie update    # one already set up
lilcaddie sandbox off                     # go back

Either writes .lilcaddie/sandbox.json, which says the record is kept in the sandbox, and an MCP entry that makes the harness start the server there. Every tool call the agent makes is served in the container, and the loop state, evidence, ledger and memory are kept in a Docker volume, lilcaddie-state-<id>, one per repository. From then on lilcaddie status in your terminal, the hooks and the agent’s tools all read that one record.

  • Commands, and `git`, run on your machine. A gate’s command, and what lilcaddie observe runs, is run in the repository with your own tools. lilcaddie in the sandbox asks the lilcaddie that started it to run the command, and records the result.
  • A custom gate runs in the sandbox, because it is code lilcaddie loads: one that starts programs itself finds Linux and the image’s tools, not yours.
  • You approve from your own terminal. approve, reject, break-glass and repin run in a container of their own that ends with the command, is given your key directory to read and nothing to write, and has no network.
  • Your record so far comes along. sandbox on copies .lilcaddie/state/ into the volume before switching, and refuses to switch if it cannot. --fresh starts a new record.
  • The repository does not choose the image. .lilcaddie/sandbox.json says only that the record is kept in the sandbox; one that names an image is refused. The image is the one lilcaddie sandbox build made, unless you name another with sandbox on --image, which is kept in your own lilcaddie directory. Docker is never asked to fetch one.
  • lilcaddie’s own containers are given your repository read-only, but for the folders its reports are written to, and they are given none of your harness’s keys.
  • Hooks cost a little more: about 0.3 s against 0.2 s, answered by a helper container that is left running. lilcaddie sandbox stop stops it.
  • The dashboard shows the sandbox’s record, from a container of its own with its port published on this machine only.

Note It is a guardrail, not a wall. An agent on your machine that can run docker can reach the volume. What this stops is an agent editing the database file in passing.

Run the harness in the sandbox too

An agent on your machine runs as you: it can read your signing key, watch your terminal and change any program you run. Running the harness itself in the container is meant to keep it away from that. It lowers the risk and does not remove it: read What the sandbox does not do before you give a harness permissive flags there.

lilcaddie sandbox build --harness claude --harness codex
lilcaddie sandbox scan                     # known vulnerabilities in the image, with Trivy
lilcaddie sandbox run -- claude            # log in once, with /login
lilcaddie sandbox run -- claude --mcp-config /opt/lilcaddie/mcp.json --strict-mcp-config
lilcaddie sandbox run --network allow -- claude   # reach the model’s hosts and nothing else
The container getsDetail
A copy of the repositoryAt /workspace: what is committed, and the work you have not committed yet as one commit on top. Your repository and its .git are never mounted, and what the run commits comes back as a new branch (--branch <name>). The copy has your git name and email, so its commits are made as you, and no other setting of yours. --committed-only leaves uncommitted work behind; --include .env copies in a file git ignores; --in-place mounts the repository itself. Nothing else of the host: not your home directory
A home of its ownThe Docker volume lilcaddie-sandbox-home. A harness you log in there stays logged in. --home none gives an empty one each time
Keys only if you set themANTHROPIC_API_KEY, CLAUDE_CODE_OAUTH_TOKEN, OPENAI_API_KEY, GEMINI_API_KEY, GOOGLE_API_KEY, OPENROUTER_API_KEY, and anything named with --env NAME
LimitsNo Linux capabilities, no gaining privileges, not root, 4 GB of memory, 512 processes and 2 processors (--memory, --pids, --cpus). A run that does nothing for 60 minutes is stopped (--idle <minutes>; 0 never)
A logWhat the run printed is kept in your own lilcaddie directory, ~/.lilcaddie/logs/, when the container is removed: the newest twenty runs to a repository. Not for a session you sat at a terminal for, which is a screen with what you typed on it
The imageIts own files are read-only; the container writes to the repository, its volumes and a temporary directory in memory. --writable-root leaves the image writable
NetworkA Docker network of lilcaddie’s own, set up so that one container does not reach another. On it the container still reaches the internet, this machine’s services and your local network. --network allow lets it reach only the hosts its harness calls, and those you add with --allow-host, through a proxy that is its one way out. --network none cuts it off
lilcaddielilcaddie and lilcaddie-mcp on the PATH, and an MCP entry at /opt/lilcaddie/mcp.json

On a copy, your own repository is not mounted: you read the branch it comes back as, and lilcaddie names the files on it that your machine would run once merged. With --in-place, what is mounted read-only, and what is only reported:

  • The files your machine runs afterwards are mounted read-only: lilcaddie’s loop definitions, custom gates, artifact templates, policy, routes and approvers; each harness’s hook and MCP settings; and git’s configuration and hooks. --writable-definitions leaves them writable, for a run whose work is to edit a loop.
  • What was created is named. A file of that kind that did not exist cannot be mounted, so the agent can create one. When the run ends, sandbox run lists every such file that was created or changed, and says to read it before you run anything.
  • A `.git` that must stay writable can be got round, by renaming the folder and making another. That is found out when the run ends, not stopped, which is why a copy is what a run gets unless you ask for --in-place.

About the image:

  • What goes into it is chosen: each harness at a version lilcaddie names, on a base image named by its digest. Debian’s packages, those already in the base image included, come from Debian’s dated archive as it stood on a day lilcaddie names, and npm itself is replaced by a version lilcaddie names.
  • Install scripts do not run as root. npm installs as the image’s unprivileged user, and what it installed is made root’s afterwards.
  • The image that runs is the one that was built. sandbox build records the image’s own identity, every sandbox is started from it, and a name found to lead to another image is refused.
  • It can be scanned: lilcaddie sandbox scan runs Trivy, which you install yourself, over the image.

A run on a copy keeps its record in the sandbox’s own volume, where lilcaddie status on your machine does not look: when the run ends, lilcaddie tells you if a run there waits on you and how to answer it (lilcaddie sandbox on, then lilcaddie status and lilcaddie approve). With --in-place and its default --state bind the sandbox uses the repository’s own store, and every lilcaddie command on the host is refused until it exits; --state volume keeps the record in the sandbox’s volume instead.

Driving a run with nobody there

lilcaddie run starts a harness round after round, in its own ask-nothing mode, and has lilcaddie judge the run’s gates after each round. It is the one place lilcaddie itself gives a harness its “skip permissions” switch, so it is held to the sandbox:

lilcaddie run --loop change --goal "Fix the flaky retry test" --network allow
  • Only in the sandbox, on a copy. There is no way to drive a harness on your machine itself, and lilcaddie drive, which does the rounds, refuses to run anywhere but the container.
  • Only a person starts it. It is refused inside an agent process, like approve.
  • A driven round approves nothing. A run that escalates, or reaches an approval, waits for you.
  • It ends. After 10 rounds unless --rounds says (50 at most), or an hour to a round. A round that ends with an error ends the drive and is not judged, so a harness that is not logged in does not spend the run’s attempts.
  • The work comes back as a branch, to read before you take it.

Note Its rounds, the judging and the branch were run in a real container with Claude Code, through two small loops. No other harness has been driven by it. On the default network a driven agent can send what is in the copy anywhere, and lilcaddie run says so each time it starts on it; --network allow is the list of hosts its harness needs.

What the sandbox does not do

  • It does not make the agent’s own work safe to run. A gate’s command such as npm test runs the tests and scripts the agent wrote, and for a repository that keeps its record in the sandbox lilcaddie runs that command on your machine. Read the work (git diff) as you would anyone’s.
  • The network is open unless you ask for the list. On the default network, what is in the copy, and any key you pass in, can be sent anywhere. --network allow is the list; it is not the default because only Claude Code has been run through its proxy. --network none cuts it off.
  • lilcaddie’s own containers mount the repository itself, read-only. The helper that answers hooks, the MCP server and the viewer serve a harness working in your repository, so they see it and not a copy. It is read-only to them, but for the folders lilcaddie’s reports are written to. A command you type yourself, such as lilcaddie setup, runs in a container of its own that can.
  • The list of hosts is not a list of what may be sent. --network allow decides which hosts are reached, and the proxy never sees inside a connection. An agent can still send what is in the copy to a host on the list: to the model’s own service under another account’s key, say. Keep out of the copy what must not leave (--include .env puts it in), and pass in no key the run does not need.
  • git runs more than lilcaddie switches off. lilcaddie’s own calls ignore a repository’s core.fsmonitor and hooks, but a filter named in .gitattributes still runs when you run git yourself.
  • A clone of lilcaddie itself gives the agent the program too.
  • An agent that can run `docker` on your machine can reach the volumes.

A checklist of the measures

  1. Install the hooks (lilcaddie setup does), so rules are checked as the agent works, not only at the gate. lilcaddie doctor confirms it.
  2. Put secrets, lockfiles and production configuration under invariants.protect.
  3. Use "observed": true with commands wherever a gate rests on a command having passed.
  4. End every loop that ships something with an approval gate.
  5. Create a signing key with a passphrase and enroll it.
  6. Run lilcaddie trust only after reading what it lists, and again whenever it asks.
  7. Set "decisionsRequireApproval": true where an agent’s decisions should wait for you.
  8. Keep the record in the sandbox: lilcaddie sandbox on.
  9. Run an agent you give permissive flags to in the sandbox, on a copy (lilcaddie sandbox run), with --network allow once your harness works through it. Scan the image first: lilcaddie sandbox scan.
  10. Give each outside agent a token of its own: lilcaddie a2a --caller <name>.
  11. Keep a ledger head hash outside the repository’s reach, and run lilcaddie conformance before you trust a run’s result.
  12. Install the scanners, and read the diff before you run what the agent wrote.

Common questions

The questions people ask first, answered plainly, with what is not built or not tested said as such.

What is lilcaddie, in a sentence?

lilcaddie is the control plane for coding agents: it holds the loop an agent works in (the phases, the checks that decide when each is finished, what happens when they fail, and a full record) in one file outside the agent harness, so the work is judged by something other than the agent and continues across sessions and tools.

Does it replace my harness, or run the model?

No. Claude Code, Codex CLI, Gemini CLI, OpenCode or Copilot CLI still runs the model and its tools. lilcaddie plugs into the harness through MCP tools, hooks, skills and commands, and decides what happens around the agent’s own loop. lilcaddie makes no model calls of its own; the exceptions are the teach flow, which runs the model commands you give it, and the tune flow, which starts the agent command you give it.

How is this different from a Ralph loop?

A Ralph loop keeps one agent on one task by feeding it the same prompt again and again; it ends when a person stops it, or when the agent prints an agreed phrase. lilcaddie leaves the agent in its harness and holds it to something outside itself:

Ralph looplilcaddie
What repeatsOne prompt, for the whole jobA named sequence of phases, each with its own instructions
When a pass endsThe agent exits, or prints the completion phraseEvery gate of the phase passes. lilcaddie runs the checks itself
Where the work is keptThe session, and files the agent can rewriteOne SQLite file outside the harness, with a hash-chained ledger
How long it runsUntil stopped, or an iteration capA policy: retry, go back, escalate to a person, or abort

The two combine: a Ralph loop can be what keeps a harness turning, and lilcaddie what it is held to while it turns.

Which harnesses and systems does it work with?

ThingState
Claude CodeMCP tools driven by a model; every hook has run, in short sessions
Codex CLI, Gemini CLI, OpenCode, Copilot CLIBuilt from each vendor’s documentation; not tried in those harnesses
Windows 11Where everything has been tested
macOS, LinuxThe test suite runs on Linux in CI. Nobody has used it there: no harness, no sandbox, and macOS not at all
The sandboxlilcaddie’s server and record in it have been used by Claude Code, and Claude Code has worked inside it; no other harness has
The driver (lilcaddie run)Built, for the sandbox only. It has driven Claude Code through two small loops in a real container; no other harness has been driven by it
Published packagesOn npm: the CLI as lilcaddie, from 0.1.0, and the MCP server on its own as @lilcaddie/mcp, from 0.1.1

Where is my data kept, and does anything leave my machine?

Everything lilcaddie records is in one SQLite file in the repository, .lilcaddie/state/lilcaddie.db, or in a Docker volume on your machine if you use the sandbox. lilcaddie sends it nowhere. The dashboard listens on 127.0.0.1 only, answers nothing but reads, and shows the record only to a page opened from the address it printed. What looks like a secret is taken out before anything is written.

What does use the network is what you ask for: lilcaddie commands install uses your git to fetch commands, the security scanners download their rules and databases, and your harness talks to its model as it always does.

What should I commit to git?

PathCommit?
.lilcaddie/loops, config.json, orchestrator.json, gates, artifacts, skills, commands, schemaYes. They are the project’s definitions
.lilcaddie/sync.lock.json and the files sync wrote into .claude/, .agents/ and so onYes, so a clone works without running anything
.lilcaddie/approvers.jsonYes. A new approver should arrive as a reviewable change
.lilcaddie/state/No. lilcaddie init writes a .gitignore that keeps it out
Settings setup --project wrote (.mcp.json, hook settings)Review first: until lilcaddie is published they name your clone by its full path

Why did lilcaddie advance exit with code 2?

Code 2 means “not yet”, not an error: the phase’s gates did not all pass, so the run did not move. The output names each failing gate and says what to do. Fix that and advance again. lilcaddie check evaluates the gates without moving the run.

The agent keeps being sent back. Will it loop forever?

No. Every loop has budgets. By default a phase may fail its gates 3 times and be retried; the fourth failure hands the run to a person. A run stops after 30 gate evaluations in total. A gate that could not be judged at all, because a tool is missing, skips the retries and goes straight to you.

To step in sooner:

lilcaddie status    # which gate fails, and its message
lilcaddie pause     # hold the run while you look
lilcaddie abort     # or end it

Can the agent approve its own work?

It is built not to. There is no agent tool for approving anything, and approve, reject, break-glass and repin refuse to run inside an agent process. lilcaddie conformance checks afterwards that none of them was recorded by an agent.

That refusal is a guardrail, not authentication: an agent with a shell runs as you. To make an approval prove a person was there, sign with a key that has a passphrase; see Check the record is what happened.

Can I approve or start things from the dashboard?

Four things, when you started the dashboard yourself at a terminal: approve a run or a decision, reject a decision, end a run, and agree to run a repository’s definitions. Each has a button beside its command, and asks before it acts. Everything else, starting a run included, is a command the page shows with a Copy button, for you to run in a terminal. See Buttons on the dashboard for what a button proves and when there are none.

Why are Prompts or Usage empty on the dashboard?

Both are recorded by lilcaddie’s hooks, so a run made without hooks shows neither. Token counts are read for Claude Code only, and the Usage page is listed once there is a reading. lilcaddie doctor says whether hooks are installed.

lilcaddie is not recognised as a command.

Install it with npm install -g lilcaddie, which puts it on your PATH, and open a new terminal. From a clone, building does not put it there: run node /path/to/lilcaddie/apps/cli/dist/lilcaddie.js install --add-to-path, which writes launchers to ~/.lilcaddie/bin and puts that folder on your own PATH, or define a shell alias. See Install it for yourself.

Do I need the hooks?

No, but they are what makes the rules hold without the agent’s cooperation. MCP tools rely on the agent choosing to call them. With hooks, the harness calls lilcaddie itself:

  • the status is given when a session starts
  • the agent is sent back if it tries to stop while gates fail
  • an edit to a protected file is refused before it happens
  • a command a gate wants observed is sent through lilcaddie observe
  • each prompt is recorded, and a search for a name is answered from the code map

Each hook call starts a process and takes about 120 ms. Hooks always exit 0 and fail open: a broken hook never traps the agent.

Does my project have to be a git repository?

No, but three things need one: allow (the only paths a phase may change), the freshness of observed evidence (“nothing was edited since”), and the dashboard’s view of checkouts. Without git, a gate that needs it cannot be judged, which fails and goes to a person.

Does lilcaddie make an agent safe to run?

No, and it does not claim to. lilcaddie takes measures around an agent’s work: gates it runs itself, rules about files, a hash-chained record, human-only commands and an optional Docker sandbox. They are made with best effort and each has limits, which Security and sandboxes lists. Nothing is perfect: lilcaddie does not promise that an agent is prevented from doing anything, or that your code, keys or machine are secure. Read what an agent wrote before you run it.

Is the record tamper-proof?

No. It is built to show an edit, not to prevent one. Each event carries the hash of the one before, so an edit breaks the chain and lilcaddie ledger verify reports it. Someone who can write the file could rebuild the whole chain, which is why you keep a head hash somewhere the store’s writers cannot reach and check it with --expect-head. The sandbox adds distance by keeping the file where the agent has no path to it.

How do I start over, or begin the next piece of work?

SituationDo
A run is live and you want a different onelilcaddie start <loop> --goal "…" --force, which aborts the live run first
A run finishedStart the next one. Nothing has to be cleared
The orchestrator says done or haltedlilcaddie reset --goal "…" begins a new piece of work
You want an empty recordThe record is .lilcaddie/state/lilcaddie.db. Deleting it deletes the history, and cannot be undone

Do I have to use the shipped flows?

No. A loop is a JSON file you can write in a few minutes. Start from Custom loop examples, from lilcaddie flow new <name>, or from /lilcaddie-create in your harness, which asks what the stages of your work are and what must be true to leave each one.

What does it cost, and what is the licence?

lilcaddie costs nothing. It is open source, released under the MIT License. Anyone may use it, change it, share it and sell it, at work included, as long as the licence terms and the copyright notice go with any copy.

Where do I get help?

lilcaddie ask "<your question>"   # searches this guide
lilcaddie doctor                  # checks the setup, and says what to fix
lilcaddie <command> --help        # one command’s usage

In a harness, /lilcaddie-help <question> does the first for you.