Chapter Three · Preparing the Repository
Preparing the Repository
The ground every pass of the loop runs on, laid once per codebase. Five topics write the instructions file the agent reads at the start of every session, give it the commands that turn its claims into evidence, decide what it may do without asking and what the worst command could reach, and set up the clean start every task begins from.
Before the first real task, a repository needs five things that most repositories do not have. A short file that briefs every session on what the code cannot say for itself. One command for each job the agent will need to check its own work. Rules for which of its actions run without asking. An environment in which the worst command it could run reaches nothing that matters. And a habit of starting every task from a clean, known-good point.
None of these is about a particular task, and all of them are done once per codebase and then maintained. That is why they come first. Each one turns a whole class of later mistakes into something that cannot happen, or that costs seconds when it does: the convention the agent never heard of, the test suite it could not run and quietly stubbed out, the force-push it was allowed to make, the staging database it could reach, the diff tangled with your own half-finished work.
You do all of it to Cragmoor's booking service in your first week, before the refund task arrives. By the end of the chapter the repository has an instructions file of about 50 lines, six commands, an allow-list, a container with no credentials in it, and a fresh branch named for the first task.