PTENES
Skip to content
MODULE 3.2

👥 Three-role team

A strong model plans, a medium model does the work, and a light model checks it. Each role uses only the model it needs, so your quota goes further. This is the kit’s R2 recipe, documented in the CHANGELOG.

6
Topics
~35
Minutes
R2
Recipe
Practical
Type
0 of 60%
1

Meet the planner, executor, and reviewer

Recipe R2 splits a task into three roles. The planner thinks and writes the plan. The executor do it. The reviewer check whether it’s actually ready.

It’s the routing from module 3.1 applied to a single task: thinking uses a strong model, doing uses a medium one, and checking uses a light one. Nobody pays for a top-tier model for a checking task.

🆕 New here? Subagent and role

  • Subagent — a helper that Claude Code calls during a conversation. It gets part of the work, handles it with its own model and tools, and returns the result. It’s an official Claude Code feature.
  • Role — the subagent's "role": what it does, which model it uses, and what it can touch. In the kit, each role is a file in .claude/agents/.
RoleFileModelDoes
plannerplanejador.mdopusshort plan with a completion criterion comando → saída esperada
executorexecutor.mdsonnetexecute the plan and show the evidence
reviewerrevisor.mdhaikurun the criteria; reply APPROVED or say what’s missing

What to look for in the table: the Model column steps down in level from the first row to the last (top tier, executor, smaller on the ROTEAMENTO.md). The table is the same as in recipe R2.

taskyour sentence planneropus · read-onlyplan + criteria executorsonnet · edits (N3)do it and show the evidence reviewerhaiku · read-onlyrun the criteria APPROVED MISSING: list of what to fix

How to read the diagram: the task moves from left to right. Only the executor (blue) changes files. The reviewer closes with APROVADO; if something fails, the red dashed line returns the list of corrections to the executor.

🧠
Planner

opus, read-only

🛠️
Executor

sonnet, edits

🔎
Reviewer

haiku, read-only

🧩
Subagents

through the official channel

2

Read the role files

Each role is a short text file. At the top is a header between lines ---; the instructions in Portuguese underneath. This is the .claude/agents/planejador.md, in full:

📄 .claude/agents/planner.md (from the kit)
---
name: planejador
description: Planeja uma tarefa antes de executar. Use no início do time de três papéis (runtime/receitas/R2). Não edita arquivos.
model: opus
tools: Read, Grep, Glob
---
Você é o planejador do time. Leia a tarefa e o que for preciso do projeto, sem alterar nada.

Devolva somente:
1. Plano em no máximo 5 passos.
2. Critérios de pronto, um por linha, no formato `comando → saída esperada`, que só passam se o trabalho for feito de verdade.
3. Riscos pela runtime/POLITICA.md (ações que exigem pedir antes).
Notice: the list tools doesn’t have Write nor Edit. The planner can't change a file even if it wants to.

🆕 New here? Frontmatter and tools

  • Frontmatter — the header at the top of the file, between the two lines ---. Claude Code reads the role's name, description, model, and tools there.
  • description — tells Claude when to call this role. That's why it mentions the R2 recipe.
  • tools — the enabled tools: Read (read), Grep/Glob (search), Write/Edit (create and modify), Bash (run commands).
Roletools: in the fileInstruction that holds the role
plannerRead, Grep, Glob"without changing anything"
executorRead, Write, Edit, Bash, Grep, Glob"don’t send, delete, or spend credits; if the plan calls for that, stop and return the question"
reviewerRead, Bash, Grep, Glob"Don’t change any files." End with APROVADO or FALTA:

What to look for in the table: the reviewer has Bash to run the criteria, but there's no Write nor Edit. It checks without being able to "fix under the hood" what it found.

✓ Well-written role

  • ✓ Minimum tools for the job
  • ✓ Fixed-format output (plan, PASS/FAIL)
  • ✓ Cites the POLITICA.md
  • ✓ Fits on one screen

✗ Poorly written paper

  • ✗ All the tools “just in case”
  • ✗ Reviewer who can edit what they review
  • ✗ Open-ended answer with no clear verdict
  • ✗ Top model for everything
📇
Frontmatter

the role card

🧰
tools

what can be changed

🎚️
model

routing level

🚦
POLICY

cited in the instructions

3

Run the team through Claude’s interface

The simplest way is to talk. Open Claude Code in the kit folder and request the team by the roles' names. Claude calls each subagent in order.

The test task is deliberately trivial: create a file with one sentence. That way, you can see the team working without worrying about the content.

🎯 Objective: see the three roles working on a small task

Open claude in the kit folder and paste (R2 recipe prompt):

Use o time: o planejador planeja, o executor faz e o revisor confere. Tarefa: crie saudacao.txt com a frase "Olá, comunidade INEMA".

When you're done, check the file in the terminal:

cat saudacao.txt

Expected result (according to the instructions):

cat saudacao.txt displays the phrase, and the response ends with APROVADO.
How to verify: the file contains the phrase "Hello, INEMA community" and the reviewer's last word is APROVADO. If you get FALTA:, read the list: it’s what the executor didn’t do.
1

Planner returns the plan

Up to 5 steps, the completion criteria in the format comando → saída esperada and policy risks.

2

Executor does the work and shows the proof

Creates the file, runs the proof command for each step, and lists what it created or changed.

3

Reviewer gives the verdict

One line per criterion, OK or FAIL with the output, and at the end APROVADO or FALTA:.

💡 The criteria are set before the work begins

The planner writes the completion criteria before the executor starts. That way, the reviewer checks against what was agreed on, not against what the executor says it did. It’s the same idea of “proof” used in the recipes.

💬
Through the screen

you follow along

📋
Plan

up to 5 steps

✅
Criterion

command → output

🏁
APPROVED

or MISSING:

4

Run the team without opening the interface

The same request fits on one line in the terminal. You don’t have a conversation: you send the task, wait, and read the final response. It’s useful for repeating the same team’s work every week with the same phrase.

🆕 New here? The -p from Claude

claude -p "pedido" run the request once and print the response without opening the chat screen. The "p" comes from screenshot (print). It lets you call Claude from a script or another agent.

🎯 Objective: run the whole team with a single command

In the terminal, from inside the kit folder:

claude -p "Use o time (planejador, executor, revisor). Tarefa: crie saudacao.txt com a frase 'Olá, comunidade INEMA'. Termine com a resposta do revisor."

Result confirmed in CHANGELOG 0.1.0:

modelos opus + sonnet + haiku usados; revisor APROVADO; saudacao.txt correto
Custo da R2 em cota: equivalente a ~US$ 0,73 de API (não é cobrança na assinatura).
How to verify: the answer ends with the reviewer's answer (APROVADO) e cat saudacao.txt shows the sentence.
💬 through the screen (claude) planner executor reviewer you see each step and can interrupt good for learning and new tasks 1 line claude -p3 roles inside response good for repeating the same task

How to read the diagram: on the left, all three roles are visible in the conversation. On the right, they run inside the purple box of the claude -p and you only see what comes out. Same team, same quota; what changes is how much you monitor.

⚠️ -p isn’t the same as running in the background

O claude -p keeps the terminal busy until it finishes. Letting the team run while you do something else is the claude --bg, from module 3.3. And the two don’t get mixed up: CHANGELOG 0.2.0 records that --bg doesn’t accept -p.

⌨️
claude -p

one line, one response

🔁
Repeatable

same phrase, every week

💸
~US$ 0,73

equivalent in quota

🧵
--bg

is module 3.3

5

Use the team in your work

To use it for real, change only the task. The R2 recipe includes two examples, one for each character in the course. What changes between them is what the reviewer checks.

🧾

Sônia — ERP totals

R2 example: "plan and create a summary of the CSV exported from the ERP in export/; the reviewer checks the totals".

To practice, use the runtime/exemplos/erp-vendas.csv. Its total is R$ 856,00, a calculation you can do by hand.

🩺

Clara — available times

R2 example: "list the week’s available time slots in the agenda.csv; the reviewer checks that no busy time slots appear".

To practice, use the runtime/exemplos/agenda.csv, with Dr. Ana and Dr. Bruno.

🎯 Objective: Sônia’s team, with a reviewer checking the total

Open claude in the kit folder and paste:

Use o time: o planejador planeja, o executor faz e o revisor confere. Tarefa: monte resumo-vendas.md com o total por cliente do runtime/exemplos/erp-vendas.csv e o total geral. O revisor confere os totais somando direto do CSV.

For Clara, change the task:

Use o time: o planejador planeja, o executor faz e o revisor confere. Tarefa: liste em horarios-livres.md os horários livres da runtime/exemplos/agenda.csv. O revisor confere se nenhum horário ocupado apareceu.
How to verify: the reviewer finishes with APROVADO. For Sônia, the grand total must be R$ 856,00 (10×18,50 + 25×5,20 + 40×5,20 + 6×18,50 + 12×18,50). For Clara, compare with the lines livre from the CSV.

💡 Tell the reviewer what to check

"The reviewer checks it" on its own is vague. "The reviewer checks the totals by summing them directly from the CSV" becomes a criterion. The more concrete what they check is, the more the APROVADO applies.

⚠️ The executor stops before sending or deleting

Under the R2 policy, the executor changes project files (N3) and nothing else. If Clara’s task becomes "and send the list to the patients," it stops and returns the question: sending has an N2 ceiling in POLITICA.md.

🧾
Sônia

reviewer checks totals

🩺
Clara

nothing busy

🧮
R$ 856,00

count manually

✋
N3

modifies, doesn't send

6

Switch models and create roles

The roles are yours. The “Adjustments” section of R2 shows the two ways to make changes: switch a role’s model or create a new role.

To change the model, edit the line model: from the role file. The accepted values are haiku, sonnet, opus or inherit, which uses the same model as your session.

📄 .claude/agents/reviewer.md frontmatter (from the kit)
---
name: revisor
description: Confere o trabalho do executor rodando os critérios de pronto do plano. Use no fim do time de três papéis (runtime/receitas/R2). Não edita arquivos.
model: haiku
tools: Read, Bash, Grep, Glob
---
Where to make changes: if the reviewer lets errors in Sônia’s calculations through, switch model: haiku by model: sonnet. That's the "only escalate if it fails" rule from module 3.1.
Value of model:Level in ROTEAMENTO.mdWhen using it with the team
haikusmallercheck simple criteria
sonnetexecutor (or lower)do the work; more attentive reviewer
opustop (or executor, with low effort)plan
inherityour session'swhen you've already chosen the model upon opening the claude

What to look for in the table: the second column links each value to the module 3.1 table. Note that sonnet appears on two levels there: routing is a guide, not a prison.

To create a role, R2 says to copy a file from .claude/agents/ and change the name, description, and instructions. You can ask Claude itself, which shows you the change before saving:

🎯 Objective: add a fourth role based on the reviewer

Open claude in the kit folder and paste:

Copy .claude/agents/revisor.md to .claude/agents/conferente-agenda.md. Change name, description, and instructions: have it check whether a list of available time slots matches the livre lines in runtime/exemplos/agenda.csv. Keep the same tools and model: haiku. Show the file before saving.
How to verify: the new file exists at .claude/agents/, the frontmatter has name: conferente-agenda and the list tools continues without Write e Edit.

Quick test (optional): why doesn't the kit reviewer have Write nor Edit?

💡 Next level

R2 ends by pointing to the next step: each role in its own session, running in the background. That’s recipe R4, in module 3.3.

🎚️
model:

one line changes the level

🪞
inherit

the session's

📑
Copy

new role

🧵
R4

background

🎓 Module summary

✓
Three roles, three models — Opus plans, Sonnet builds, Haiku checks.
✓
The file gives instructions — tools the frontmatter determines who can make changes.
✓
Through the screen or with claude -p — same team, ends with APPROVED.
✓
Reviewer with a concrete criterion — Sônia’s totals, Clara’s schedules.
✓
One-line adjustment — model: switches the level; copying creates a role.

Next module:

3.3 — Background team