A contract and its spirit
A coding agent begins every session knowing nothing about the project it has been opened in. Whatever it needs to know about how work is done there has to be written where it will read it, and in my repositories that place is a file at the root called AGENTS.md, which the agent reads before anything else. More than two dozen of my repositories have one. I call it a standing contract because it holds for every session, as distinct from a commission, which is written for one piece of work.
The earliest contracts I wrote were closer to philosophy than to rules. They tried to capture the spirit of a project, and something harder to name: the character of a collaboration that had begun to work. Sometimes a run of sessions simply flows, and the agent seems to understand not only the task but the way I think about it. I wanted to know what that consisted of, and how to make it outlast the sessions that produced it. Part of the answer became an operator profile, a document distilled from many sessions that describes how I work, with each statement marked as high, medium, or low confidence. It is candid about its own status (“Do not romanticize this document. Use it to reduce friction, preserve continuity, and avoid wasting turns”), and it says where the spirit belongs: “Symbolic or philosophical motifs are welcome at the edges; the center must still hold a working tool.” Beside it I keep an archive of notes from exchanges that went well, as a record of what good collaboration looked like when it happened.
That approach works, and it has a cost. A contract that captures the spirit of a project can leave the hard rules unstated, which does little harm at first and more as the project grows, because what nobody wrote down begins to drift. I have also gone too far the other way, into contracts so full of rules that the agent had no room left for judgment. Most of what I have learned about writing these files concerns how to hold both.
Three things to hold
I now think of a contract as holding three things at once. The first is the spirit of the interaction: the defaults and the manner that made the collaboration work. The second is behavior fidelity, meaning that the agent works the same way from one session to the next and from one agent to the other. The third is technical adherence, which matters wherever the work meets a structure that does not forgive deviation.
- The spirit of the interactionCarried byA working posture, an operator profile distilled from past sessions, and notes on exchanges that went well.What goes wrongOn its own, it leaves hard rules unstated, and a growing project drifts.
- Behavior fidelityCarried byGround rules, modes of work kept apart, a definition of done, and one contract for both agents.What goes wrongOverdone, it leaves the agent no room for inference.
- Technical adherenceCarried bySchemas, validators, tests, checklists for every join, and generated starting points with drift checks.What goes wrongStated without tooling, it fails where a structure tolerates no deviation.
The contract in my course-engineering workbench shows all three. It opens with a working posture, a list of defaults to fall back on when nothing more specific applies: “review before generation,” “additive over destructive change,” “traceability over convenience,” “verbatim fidelity when wording matters,” “diagnostics over guessing.” That list is the spirit, stated as practice. Fidelity follows. The contract names six modes of work (extraction, review, editorial, transformation, generation, and validation) and asks that they be kept apart unless I say otherwise, so that an agent asked to extract does not quietly begin to edit. It maps the directories, each with a phrase on what belongs there and some with a caution, as with raw exports: “raw snapshots, do not casually edit.” Its 12 ground rules are concrete (“Treat the raw export as evidence,” “Mark inference clearly,” “When uncertain, emit diagnostics and keep unresolved cases visible”), and the last two govern how behavior moves between the workbench and the course builds made from it. Technical adherence has a section of its own, reminders about the platform such as which file in a course package routes the content and which files define the objects, and a ground rule to “Preserve joins and relationships across files.”
Defining done
The contract also says what done means, and I would not leave that out of any contract for work with real consequences. In a workflow with real checks and balances, and real measures of success, an agent left to decide when it has finished will decide in any number of arbitrary ways. The workbench’s definition is short. A task is “closer to done” when the changed files are known, when evidence can be told apart from inference, when raw exports remain protected, when outputs are in their proper place, when the important joins and asset paths have been checked, and when “the result is reviewable by a human without guessing what happened.” Even the wording leaves room: the list says when a task is closer to done, not when it is finished. Real conditions bring complexity that no list anticipates, and a definition of done should constrain what the agent claims without pretending to settle every judgment.
A contract for a single course build adds what the workbench does not need, a paragraph on the build’s current status, and uses it to say what the materials are not: “not an approved syllabus, approved week-by-week blueprint, or import-ready Brightspace package truth.” The next sentence tells the agent to treat them as design evidence. Commissions carry the same idea down to a single piece of work. One written for a course build names the single completion claim the agent may make when its gates pass, and then 10 it must not make, among them that anything is approved, live, or ready for students.
A permission and its limit
One habit runs through all of these files: a permission is written together with its limit. The plainest examples are in my investing lab, whose contract and continuity guide have grown by accretion, most of their paragraphs being dated directions of mine. The data sources that need a free key have “an onboarding roadmap, not authorization to register accounts, send owner identity, store keys, accept terms or buy subscriptions.” Credential storage is “an accepted future direction, not permission to create accounts, submit contact details, write secrets, schedule tasks or purchase subscriptions now.” Each grants something real, and each sits next to a larger thing an agent could infer from it: approving a plan is close to approving its first step, and approving a direction is close to approving the purchase that would complete it. The second half of each sentence closes that gap in advance.
When a rule changes, the old one is not erased. An addendum in one agent’s instructions says of an earlier paragraph that it is “historical, not current operating authority,” and leaves the paragraph where it was, so the file records both the rule and its history. A contract can even say what it is not. The public repository for one of my tools carries an agent guide that describes itself as help for maintainers and optional assistants, “not a runtime requirement, not an authorship statement, and not something the pipeline uses,” because the tool runs without AI and the file should not suggest otherwise.
The project around the contract
For all that, I have come to think the contract is only part of what an agent needs, and often not the larger part. The setup of the project, its infrastructure, and the breadcrumbs of prose left throughout it are as essential as the contract, and in many cases they do work the contract cannot.
- Instructions, general to specificBase instructionsEnvironment overlayRepository contractSkillsCommission
- The way inInventoryStart hereVerified workflowsChecklistsOperator profile
- The trailSession notesDecision logPlansDated addenda
The breadcrumbs begin at the door. The workbench names an order of reading: an inventory of what lives in the repository and why, then a start-here file that asks the reader to choose the mode of work before touching anything, then a note of verified workflows that marks each runnable command as covered by tests, checked by hand, or still dependent on judgment. Checklists stand at the points where mistakes happen: before touching an export, before editing XML or a manifest (with a list of the joins to identify first), before revising course prose, before generating a package, before committing, and before ending the session. The last of these asks for a working note covering what was done, what is open, what must not change casually, and where to begin, so that the next session, mine or an agent’s, starts where this one stopped. Durable decisions go into a decision log, where they can be found later by someone who was not there.
The infrastructure carries the rest. Course builds are never made inside the workbench; a script generates each one as a clean copy of the current master, and a second script reports when a build and the master have drifted apart. One canonical contract serves both agents. Codex reads AGENTS.md directly, Claude Code loads it through a short CLAUDE.md that imports it, and the skills (short operating notes for recurring tasks) live in one folder that both tools read; older documents that say “Codex” are covered by a single sentence telling the reader to take that as “your assistant.” Above the repositories sits a layer that applies everywhere. My Codex setup compiles a shared base of instructions and an overlay for each environment into the file the tool reads, and one rule in the base is the general form of every permission above: “Ask before any action that is irreversible, high-blast-radius, privacy-sensitive, or likely to change system or application behavior.”
What a contract cannot hold
A contract states rules; it does not enforce them, and that matters most where tolerance is lowest. A Brightspace course package is a manifest, a set of XML files, and the joins between them, and it does not forgive deviation from its schema: a package that departs from it simply does not work. That is exactly the kind of structure an agent is tempted to improve on, and it is where a stated rule has sometimes failed to stop drift. So the rules that cannot bend are held by things that check: schemas and validators, tests, the checklist of joins, a second agent commissioned to find faults, and commits and pushes that happen only on my word. After one course build in which lanes that were only stated had not kept material apart, the direction I recorded at its close called for “enforced source, design, review, generated, raw-export, scratch, and archive lanes.”
The opposite failure is quieter. A contract that tries to fix everything leaves the agent no room for inference, and inference, a kind of creativity within reasonable limits, is much of what makes an agent worth working with. The balance I aim for is determinism where the structure is unforgiving and latitude where judgment helps. The package schema is not open to interpretation; the order of a plan, the shape of a review document, or the first design of an interactive should be. In that division of labor the contract sets the posture and the limits, the infrastructure holds what cannot bend, and the breadcrumbs carry the reasons from one session to the next.
What I would tell a colleague starting out begins with their own history rather than with a template. Anyone who has worked with AI for a while, even briefly, has had a stretch of work where the collaboration went well, a long-running project that was satisfying and stable. I would ask them to recall what that work was and what about the interaction made it succeed, and then to look beneath it for the conditions they may never have set up on purpose but which the success depended on. Those conditions are the first draft of a contract. The second step is to decide what must remain absolute, the few things that are not negotiable, and to stop there. A contract that tries to harness everything limits both the quality of the work and the agent’s capacity for inference, which is to say its creativity.