PTENES
Skip to content
MODULE 4.2

📚 The agent proposes, you approve

The agent makes a mistake, learns, and wants to change how it works. Great, as long as the new rule only takes effect with your approval. This module shows the four places where the kit stores what it learns and how to review everything once a week.

6
Topics
~35
Minutes
4
Files
Practical
Type
0 of 60%
1

Understand why the agent doesn’t change its own rules

An agent that rewrites its own rules may accidentally loosen exactly the rule that was holding it back. One line saying "you may pay small bills" and the module 4.1 policy no longer applies.

That's why the AGENTS.md from the kit says, explicitly: "You don’t change these rules. To propose a change, add a line to the 'Lessons' table in the runtime/POLITICA.md. The human approves."

🆕 New here? The four learning files

  • Learning Table — at the end of the runtime/POLITICA.md. Where the agent writes its proposals.
  • Lessons — section ## Lessons of the AGENTS.md. Only rules you've approved, one per line.
  • FALHAS.md — runtime/FALHAS.md. One line for each thing that broke.
  • LIMITES.md — runtime/LIMITES.md. One line for each thing the environment wouldn't let you do.
1 · agent proposes row in the Learning table 2 · you decide approved or rejected 3 · incorporates ## Lessons from AGENTS.md the agent starts following the approved rule prohibited shortcut

How to read the diagram: the lower blue path always passes through the amber box, which is you. The upper red arc is the agent writing directly to Lessons without going through you. That's the shortcut that the AGENTS.md prohibits.

✓ The agent can

  • ✓ Add a row to the Learning table
  • ✓ Note the failure in FALHAS.md
  • ✓ Note the block in LIMITES.md
  • ✓ Suggest the lesson when you correct it

✗ The agent can’t

  • ✗ Mark its own proposal as approved
  • ✗ Write to Lessons without your approval
  • ✗ Raise an action’s limit in POLITICA
  • ✗ Delete a failure log entry that bothers you
✍️
Proposes

the agent

👍
Approves

you

📌
Incorporates

becomes a Lesson

🔒
Rules

only change with your yes

2

Fill in the Learning table

The table is at the end of the runtime/POLITICA.md, under the heading “Learning (propose → approve → incorporate)”. It’s empty in the kit: just the heading, waiting for the first proposal.

Each line has four columns. The second asks for evidence: "I thought it was better" doesn't count; "this happened on this day, with this result" does.

📄 runtime/POLITICA.md, Learning section (as provided in the kit)
O agente **não muda as próprias regras**. Ele acrescenta uma linha aqui; você decide.

| data | o que aconteceu (com evidência) | proposta (1 linha) | status: proposto / aprovado / recusado |
|---|---|---|---|
datewhat happened (with evidence)proposal (1 line)status
exampleClara asked for “available times tomorrow,” and the agent replied with today’s date; the response included times that were already bookedBefore checking the calendar, repeat the date in AAAA-MM-DD and wait for confirmationproposed
exampleIn the distributor’s report, the agent wrote “can I issue the invoice?” instead of leaving the invoice ready for SôniaFor payments, provide the finished text and a list of what to check; never offer to executeproposed

What to look for in the table: the two lines are examples of what it would look like, written for this course; they don’t come with the kit. Notice that the proposal fits on one line and says what to do, not how to feel.

1

proposed

The agent wrote it. No one has decided yet. Nothing changes in its behavior.

2

approved

You changed the status. The proposal goes to Lessons (topic 3) and takes effect.

3

rejected

It stays in the table. That way, the agent won’t suggest the same thing again next week.

💡 Don't delete the rejected item

The rejected line is memory. It shows the agent, and you three months from now, that the idea has already been considered and why it wasn’t included.

📅
date

when it happened

🔎
evidence

the fact, not the opinion

➡️
proposal

one line

🏷️
status

proposed / approved / rejected

3

Promote the approved item to Lessons

A POLITICA.md close the section like this: "Approved → becomes a rule in CLAUDE.md/AGENTS.md". In the kit, the place is the section ## Lessons of the AGENTS.md.

Why in the AGENTS.md and not in the CLAUDE.md? Because the CLAUDE.md from the kit starts by pulling the AGENTS.md. A rule written in one place applies to both Claude and Codex.

📄 AGENTS.md (end of file, as provided)
## Lessons

Rules approved by the human, one per line:
📄 CLAUDE.md (entire file, as provided)
@AGENTS.md

## Self-learning

When the human corrects you, or you notice a mistake you made: propose the lesson as a row in the “Learning” table in `runtime/POLITICA.md`. Once approved, it goes into `## Lessons` in `AGENTS.md`.

🆕 New here? What the @AGENTS.md

In the CLAUDE.md, a line with @ and a filename asks Claude Code to read that file alongside it. Codex reads the AGENTS.md directly. Result: both agents read the same Lessons.

POLITICA.md "approved" row AGENTS.md ## Lessons Codex reads directly CLAUDE.md → Claude by the @AGENTS.md line

How to read the diagram: everything goes through the amber box. You write the rule once in the AGENTS.md, and both blue arrows point to the same rule for both agents. There’s no "Claude-only" version that can get out of date.

Example of what it would look like (not included in the kit)

If Clara approves the first proposal in topic 2, the end of the AGENTS.md looks like this:

## Lessons

Rules approved by the human, one per line:
- Before checking the calendar, repeat the date in YYYY-MM-DD format and wait for confirmation.

💡 Who writes the line in Lessons

It can be you, manually, or the agent, after your explicit request ("I approve line X; copy it to Lessons"). What matters is the order: first your yes, then the copy.

📌
## Lessons

one rule per line

🔗
@AGENTS.md

Claude reads along

🤝
Two agents

same rules

🔁
Self-learning

corrected → proposes

4

Record each failure on one line

When something breaks and you fix it, the temptation is to move on. The runtime/FALHAS.md asks thirty seconds beforehand: one line with the date, what broke, the smallest fix, and whether the problem was with the prompt or infrastructure.

The kit already includes a real entry from when it was tested. It's the best example of the format:

📄 runtime/FALHAS.md (as provided in the kit)
| data | o que quebrou | menor correção | prompt \| infra |
|---|---|---|---|
| 2026-10-05 | `doctor.mjs` dizia "codex sem login" com o Codex logado | ler stdout **e** stderr (`codex login status` responde no stderr) | infra |
What to look for: the fix wasn't "rewriting the doctor." It was also reading the command's other output. That's what "smallest fix" means.

🆕 New here? stdout and stderr

Every terminal command has two text outputs: the normal one (stdout) and the warnings and errors one (stderr). On the screen, both appear together, but a program that reads only one of them misses the other. That’s what happened with doctor.mjs.

prompt

  • ✓ The request led to the error
  • ✓ The model misunderstood
  • ✓ A limit was missing from the request
  • ✓ Typical fix: add one sentence to the instructions

infrastructure

  • ✓ Machine, network, login, software version
  • ✓ Script that reads from the wrong place
  • ✓ Service is down or slow
  • ✓ Typical fix: add a safeguard (time limit, retry, check)

💡 Why just one line

After about ten lines, the pattern emerges on its own: “half are login infrastructure issues,” “every prompt failure is data.” Long text hides the pattern. If you need details, write them in another file and link to it in the line.

📅
date

when it broke

💥
what broke

the observed symptom

🩹
smallest fix

the missing safeguard

⚖️
prompt | infra

or both

5

Record what the environment blocked

Not every problem is a failure. Sometimes nothing broke: the environment simply didn’t allow it. The sandbox blocked the network, the tool doesn't have the feature, the site requires a login. This goes in the runtime/LIMITES.md.

In the kit, it comes with only the header. The last column, status, says whether the limit is still open or whether you’ve accepted living with it.

📄 runtime/LIMITES.md (as provided in the kit)
| data | o que tentei | o que barrou | contorno | status |
|---|---|---|---|---|
SituationGoes toWhy
O doctor.mjs read only one output and got it wrongFALHAS.mdit was a defect, and it was fixed
The Codex sandbox blocks the network, including the local networkLIMITES.mdis an environment rule; recipe R1 says to note
You used reverse engineering in a testLIMITES.mdthe POLICY says: documented lab
You corrected the agent, and it learnedLearning tableit’s a rule change; it needs your approval

What to look for in the table: the question that distinguishes them is "did it break, or was it blocked?" If it broke and you fixed it, FALHAS. If it was blocked, LIMITES. If the way of working changed, Aprendizado.

The example the kit itself provides

Recipe R1 warns: the Codex sandbox blocks network access. If a test needs to start a server, add the setting below to the bridge and note it in LIMITES.md:

-c sandbox_workspace_write.network_access=true

The line would record: what you tried (starting the test server), what blocked it (sandbox without network access), the workaround (this adjustment), and the status.

⚠️ A workaround isn’t a license

Opening the sandbox network is like loosening a fence. That's why it goes in a file you review. An undocumented workaround becomes, three months later, an open door no one remembers opening.

🧱
what blocked it

environment rule

↪️
workaround

what you did

🏷️
status

open or accepted

🧪
lab

also noted

6

Do the weekly review with the agent

The three files only help if someone reads them. Once a week, ask the agent to read everything and turn recurring themes into proposals. It does the tedious part. You do the part that matters: decide.

These are two requests. The first only generates proposals. The second, which you write after reading, approves whatever you want.

🎯 Objective: the agent turns the week into proposals without approving anything

Open claude (or codex) in the project folder and paste:

Read runtime/FALHAS.md, runtime/LIMITES.md, and the Aprendizado table in runtime/POLITICA.md. Look for recurring issues or ones that are still open. For each case, add a row to the Aprendizado table with the date, evidence, a one-line proposal, and a proposed status. Do not mark anything as approved, and do not change AGENTS.md or CLAUDE.md. At the end, list the rows you added.
How to verify: the new rows appear only in the Learning table, all with status proposto. The section ## Lessons of the AGENTS.md stays the same.
✍️ After reading: your approval request (replace what's between < >)
Na tabela Aprendizado de runtime/POLITICA.md, mude para aprovado a linha <data e proposta> e para recusado a linha <data e proposta>. Copie só a proposta aprovada, em uma linha, para ## Lessons do AGENTS.md.
1

The agent reads and proposes

First request. It cross-checks FALHAS, LIMITES, and the old proposals.

2

You read every line

Key question: does this rule loosen any POLITICA limit? If so, reject it.

3

You approve or reject

Second request, in your own words. Only what gets approved goes into Lessons.

4

Git records the change

Since everything is a text file, each new rule stays in the history with a date. You can see when and why it was added.

Quick test (optional): during review, the agent suggested "you can send reminders to patients without asking." What does Clara do?

🗓️
Weekly

a fixed time

📥
Request 1

proposals only

✅
Request 2

your decision

🕰️
Git

rules history

🎓 Module summary

✓
The agent doesn't change its own rules — it proposes a line.
✓
Learning Table — date, evidence, proposal, status.
✓
An approved lesson becomes a Lesson in AGENTS.md — and it applies to Claude and Codex.
✓
It failed: FALHAS. It was blocked: LIMITES. — one line each.
✓
Weekly review in two requests — the agent proposes; you decide.

Next module:

4.3 — Guard and dashboard