Skip to content

The goal file

Let an agent work alone for hours, then reread the choices it made in your place and noted in its journal

Module
Module 06
Deliverable
objectif.md in version 1 and 2, plus ecarts.md (dated interventions, decisions made by the agent, deviations found, corrections made to the contract)
Access
preview

Before you read

What you will be able to do

You write the contract for a job an agent carries out alone, without asking you anything, then you reread every choice noted in its journal and fix the contract.

What you will do
  1. Action 1: Put your last request through the eight rules
  2. Action 2: Write the constraint that must never be dropped
  3. Action 3: Name the file that marks the end
  4. Action 4: Record the starting state with its commands
  5. Action 5: Search your contract for what allows a question
  6. Action 6: Compare three of the agent's choices with yours

Then the exercise: Un contrat pour un chantier déjà prévu, puis sa version 2 tirée des écarts (in French)

Time

43 min reading, 195 min exercise

Updated on

Before you start

Nothing in particular: the module stands on its own.

Words used in this module
  • agentA session of your coding tool, or a subagent, meaning a secondary session it launches for part of the work: it reads files, runs commands and modifies code.
  • jobThe work you hand to an agent for it to carry out without you, for an hour or more, in one or several sessions.
  • ticketA request of a few lines that says what you want, and counts on you to answer the questions.
  • contractThe text an agent receives at the launch of a job: what it must obtain, where to look, what it is forbidden to do, how to decide alone and note its choices, and which file marks the end.
  • goal fileThe file that contains the contract, and that the agent reads at launch.
  • instructionA numbered directive, in the part of a contract that tells the agent how to work; each contract numbers its instructions in its own way.
  • decision journalThe list, kept by the agent during the job, of the choices it made in your place, each with its reason and the fact that would show it was wrong.
  • stated assumptionA choice the agent makes because a piece of information is missing, and that it writes as such in the decision journal: it owns the choice and reports it, it is not a mere guess.
  • autonomy ruleThe part of the contract that forbids the agent to ask questions, and orders it to decide, note its choice and continue when a piece of information is missing.
  • guardrailA prohibition written in the contract: what the agent must not modify, what it must not publish, what it must not state without evidence.
  • stop conditionThe end file named in the contract, with what it must contain: when it exists, the agent has finished, in its own opinion.
  • deviationA difference between what the agent did in your place and what you would have done.

The lost night

Take an evening. You hand an agent several hours of work, described in ten lines, and you go to sleep. In the morning, you risk finding one of two things. Either the agent stopped at its first question, and it has been waiting for your answer since the day before. Or it asked nothing: it filled each gap with a choice of its own, and nothing tells you which ones.

In the first case, the night is lost. In the second, you have to find each choice before you rely on the result. Your ten lines said what you wanted. They did not say where to find what had to be known, what to do when a piece of information is missing, what was forbidden, or when to stop.

Before you let an agent work without you, write it a contract. The contract says what the agent must obtain, where to look, what it is forbidden to do, how to decide alone and note its choices, and which file marks the end.

An agent, here, is a session of your coding tool, or a subagent: a secondary session it launches for part of the work. It reads files, runs commands and modifies code. The job is the work you hand to it for it to carry out without you, for an hour or more, in one or several sessions. This module calls contract the text the agent receives at the launch of the job. It says what the agent must obtain, where to look, what it is forbidden to do, how to decide alone and note its choices, and which file marks the end. The file that contains this contract, and that the agent reads at launch, is the goal file of the title.

I am the author of this manual: "I" is me, including in most of the quotes. This module rests on four contracts that I launched on my personal projects. They are annotated further on, in excerpts; the third appears there in two versions. This "I" has two exceptions, which I point out each time. In the contract template, the skeleton to copy that this module gives further down, "me", "mine" and "my place" refer to the person who writes the contract, meaning you. The third contract, for its part, was written by sessions: in its quotes, "I" is the session.

When this module is useless

Do you stay in front of the screen while the agent works? Then you are the one who answers its questions, at the moment it asks them, and a written contract brings nothing that your presence does not already bring. Ask for what you want in one sentence, and stay there.

Is the work short? Allow about three quarters of an hour to write the contract for a two-hour job: that is an estimate, not a measurement. For half an hour of work, writing the contract may well take longer than the work itself.

In both cases, you can stop here. Come back to the contract template given further down, a skeleton to copy and fill in, the first evening you leave a session running without you.

A ticket or a contract

For a job the agent carries out without you, write a contract. Keep the ticket for work that you follow.

A ticket is a request of a few lines that says what you want, and counts on you to answer the questions. It assumes that whoever reads it will be able to ask you for a clarification, and it leaves the rest to their judgement.

A contract assumes nobody to talk to. It writes in advance what is allowed, what is forbidden, and what marks the end. The agent that reads it cannot ask you for a clarification: you are not in front of the screen, and each question would stop the session until you come back.

An agent that has only a ticket, and nobody to talk to, risks one of two things: it stops at the first doubt, or it fills the gap with a choice you will not see. In both cases, you lose control of the session. A complete contract tells the agent what to do instead: decide, write what it decided, and continue.

The eight rules of a contract

Apply the eight rules in every contract. When a rule is missing, nothing guarantees what the agent will do: it can decide alone without saying so, or stop on a question. The rules repeat the points of the contract, those of the rule in bold at the start. The result is rule 1, and the sources are rule 2. Rules 3 and 5 say how to decide alone: forbid questions, then give the order to decide. Noting its choices is rule 4, the prohibitions are rule 6, the end file is rule 8. Rule 7 is added to them: ask the agent to criticise the ideas of the job, yours included.

These rules come from my own use, and that is not a measurement. The contracts annotated further on show where they held, and where they were missing. They do not say your constraints specific to the job: the conditions the result must meet to be of any use. The contract template keeps a separate place for these constraints.

1. Write the result, not the steps

Say what you want to obtain, in one sentence, and leave the way to get there to the agent. A detailed procedure is executed to the letter: the agent does the third step even when the second step showed that the third no longer made sense.

Test your sentence: if it contains "start by", "then" or "next", it describes a procedure, not a result. The contract template, further down, keeps a section of steps for long jobs: each step there says its goal, and what it must hand back. Write the instruction of each step by the same rule 1: the expected result, never the procedure. And say what to do if a step loses its meaning: the template asks to skip it and note it in the journal.

2. Name the sources by their path

For each source, write its exact path (that of a file in the repository, or the full address of a page), what is found there and how to read it. "Look at the project documentation" points to nothing. An agent that does not know where to look does not necessarily stop: it can fill the gap with something plausible, and false.

3. Forbid questions

Write the prohibition in full: the agent asks you neither to approve a step before moving to the next one, nor to clarify what you meant. Without it, the agent can stop at the first doubt and wait. You discover its question when you come back, and the time that has passed is lost.

Your tool can also ask you to approve each action of the agent: a command, a change to a file. Before launching the job, turn off these approval requests in its settings; otherwise, it is the tool that waits for your answer. Turning off these requests makes you lose a protection. Some tools can refuse specific files or commands without asking anything: set them to refuse what your contract forbids. Then check that these refusals hold, once the approvals are turned off. In a trial session, ask the agent to modify a forbidden file, and see whether the tool blocks it. A refusal by the tool holds better than a written prohibition, which the agent can ignore. But it only covers what you have set: another command can sometimes reach the same file.

4. Require a decision journal

Ask for a decision journal: the list, kept by the agent during the job, of the choices it made in your place, each with its reason and the fact that would show it was wrong. Do not forget this last part: it is the one that tells you what to check when you come back.

Have it kept as the work goes, in a separate file: a session cut off before the end then leaves its journal behind. Without a journal, you can only validate or correct the result by rereading everything, line by line, without knowing where to look.

5. Give the order to decide

Write to the agent that, when a piece of information is missing, it decides, notes it and continues. The contract template, further down, words it like this: "make the most reasonable decision, document it as a stated assumption, and continue". Remember it as three verbs, in this order: decide, note it, continue. Rule 3 alone leaves the agent without an instruction when a piece of information is missing: it no longer has the right to ask, and nothing tells it to decide.

The choice made this way is a stated assumption: a choice the agent makes because a piece of information is missing, and that it writes as such in the decision journal. "Stated" means that the agent owns it and reports it: it is not a mere guess. In "decide, note it, continue", it is "note it" that matters most: it makes "decide" acceptable, since you find the choice when you come back.

Rules 3 and 5 of this module, taken together, form the autonomy rule. It is the part of the contract that forbids the agent to ask questions, and orders it to decide, note its choice and continue when a piece of information is missing.

6. Write the prohibitions

Write the guardrails of the contract, meaning its prohibitions: what the agent must not modify, what it must not publish, what it must not state without evidence. Name at least one path it does not touch, or the only folder where it has the right to write.

A prohibition can be checked afterwards: the forbidden file has changed or not, the statement has its evidence or not. A recommendation like "prefer…" cannot be checked. Without a prohibition, nothing stops the agent that improves what is next to its job.

7. Ask for criticism

Ask the agent to criticise the ideas of the job, yours included. Write: "if an idea is weak, say so and explain why". Add the sentence that goes with it: if the analysis concludes that nothing deserves to be done, the agent writes it frankly, rather than rolling out a plan to save face.

Without this request, the agent follows the slope of your question. You ask it how to launch a product, it explains how to launch it, even when the right answer is not to launch it.

8. Name the end file

Name the end file, the one that exists when the job is finished, with what it must contain: that is the stop condition. A percentage of progress or "when it is good" are not stop conditions. Have this file written last: when it exists, the agent has finished, in its own opinion. It is then up to you to check what it contains. A named end file says where to stop; it does not guarantee that the session gets that far.

Without a stop condition, nothing tells the agent when to stop: it can stop too early, or continue until the tool cuts it off. When you come back, nothing tells you whether the work is finished.

Action 1: Put your last request through the eight rules

Find, in a file or in your tool's history, the last request you made to an agent for more than an hour of work. If you have made none for work that long, take your last request, whatever it is: for short work, many "no" answers are not a fault. For each of the eight rules, write "yes" if the request applies it, "partly" or "no" otherwise. Next to each answer that is not "yes", note the decision the agent made alone, or the question it asked you. If nothing in the session shows it, write "I do not know".

Expected result: Eight answers: 'yes', 'partly' or 'no'. Next to each answer that is not 'yes', the decision the agent made alone or the question it asked you; 'I do not know' if nothing shows it.

The template

Copy this skeleton, and fill it in for your job. It follows the structure of the most complete of the four contracts. It starts with a usage note: a paragraph that says where to launch the session and which file marks the end. The end file of the template is its final report, described in section 3.

Section 0 of the template contains operating instructions: numbered directives, which tell the agent how to work. Each contract numbers its instructions in its own way: do not confuse them with the eight rules of this module.

In the template, "me", "mine" and "my place" refer to the person who writes the contract: you. The skeleton has two kinds of brackets. The ordinary brackets, like [source], are for you: replace them before launching. The ones that begin with "to fill in", like the one in section 2 of the skeleton, are for the agent: instruction 2 asks it to fill them in along the way. The template is under the MIT licence: you can copy it, modify it and redistribute it under the terms of that licence.

objectif.md
# [Title — the goal in one line]

> **Usage note.** This file drives an autonomous run from start to finish.
> [In which tool and which folder to launch the session, and why there.] The agent runs
> the steps one after another without asking me, writes the deliverables in `./[folder]/`, and
> stops after producing `[end file]`.

## 0. Mission

[The assigned role, in one sentence.]
[The final goal, in one sentence. What we want to obtain, not how.]

**Operating instructions:**
1. Before each step, go and find for yourself what you need to know in the sources of
   section 0 bis. What you do not find there, decide it according to instruction 6: never ask for it.
2. Fill in the brackets that begin with "to fill in" from what you find.
3. Cite your sources: when you deduce something from a project file, say which one, in one line.
4. Be critical, not eager to please. If an idea is weak, even mine, say so and explain why.
5. [The non-negotiable constraints, the ones that must never be dropped.]
6. Run the steps in a row, in full autonomy. No intermediate validation,
   no clarifying question. When a piece of information is missing, make the most
   reasonable decision, document it as a stated assumption, and continue. If a step
   loses its meaning, skip it and note it in the journal.
7. Keep a decision journal as the work goes, in `./[folder]/journal.md`:
   each choice made in my place, its justification, and the fact that would show it was wrong
   ("nothing" is not an answer).
   The final report copies it in full.

## 0 bis. Context sources to use

| Source | What is found there | How to read it |
|---|---|---|
| [source] | [what it brings] | [exact path or command] |

**Priorities between the sources:**
- [What takes precedence over what.]
- [What to ignore, and why.]

## 1. Known starting state

| Fact | Value | Command and date of the reading |
|---|---|---|
| … | … | … |

*Agent: check, complete and correct this section before you use it.*

## 2. The steps

### Step N — [name]
**Goal:** [in one sentence.]
> **Instruction**
> [What the step must hand back, and in what form. Not the procedure.]
> It starts from [to fill in: the result kept at the previous step].

## 3. Expected deliverables

Write the files as you go, in `./[folder]/`, and the report last.
The report can be read on its own, and first. It always contains:
decision journal, risks, what you are least certain of,
next concrete action.

## 4. Guardrails

- [What must not be stated without evidence.]
- [What must not be published.]
- [What must not be modified, with at least one path.]
- Modify nothing outside [the folders of the job] and `./[folder]/`, except section 1
  of this file and its brackets that begin with "to fill in".
- Autonomy does not mean eagerness to please. If the analysis concludes that nothing deserves
  to be done, write it frankly rather than rolling out a plan to save face.

Each rule has its place in this skeleton.

RuleWhere it goes in the template
1. The result, not the stepsThe mission, in section 0
2. The sources by their pathSection 0 bis
3 and 5. The autonomy ruleInstructions 1 and 6
4. The decision journalInstruction 7
6. The guardrailsSection 4
7. CriticismInstruction 4, repeated in section 4
8. The end fileThe usage note and section 3

The end file of this template is the final report. You write its name in the usage note, in place of [end file]. Section 3 says what it contains, and has it written last: that is rule 8.

Add other "to fill in" brackets wherever the agent will know a value better than you, like the name of the product it will have chosen at an earlier step.

Give more time to section 0 bis than to section 2: the sources replace the questions the agent will not ask. Section 1 describes the starting state of the job, what is done and what is not, and the agent checks it before using it.

Instruction 5 is empty, in brackets: it is yours. Write in it the constraints specific to your job, the ones whose violation makes everything else useless. A request like "generate a strong password" forgets a constraint of this kind: the characters the password is allowed to contain. This manual tells that oversight in a failure log page, meaning the account of an incident that happened, with its cause: here it is.

Action 2: Write the constraint that must never be dropped

Take the next job you plan to hand to an agent, and copy the template for it. Imagine a well-made result that you would throw away all the same. What would make you throw it away is a constraint for your instruction 5: write it, then look for the others in the same way.

Expected result: One sentence per constraint, in place of the bracket of instruction 5. Each one names a constraint that, if violated, would make the result unusable.

Action 3: Name the file that marks the end

For the same job, write the path of the file that will exist when the work is finished, and what it will have to contain. Put its path in the usage note of your copy, in place of [end file], and its content in section 3.

Expected result: A file path and the list of what it will contain. If you cannot name it, the job is not ready to start.

End of the preview

Still in this module:

  • Four annotated contracts~ 3,122 words
  • The eight rules in the four contracts~ 466 words
  • Six defects to look for before launching~ 293 words
  • Reread the agent's choices, then fix the contract~ 368 words
  • In practice~ 109 words

That is about 4,358 words, and the exercise with its deliverable template.