Multi-agent and Orchestration|INEMA.CLUB-PRO

Lesson 8 · 20 min

Design your loop's team

A team of agents fits on one page: the decision from lesson 1 and, for each role, level, tools, what it writes, isolation, input, return, who verifies it, and cap. Written this way, a script checks whether a field is missing or whether two roles write to the same place without isolation. In this lesson you write your loop's time.md, check it, and run it.

Start the lesson
Dark board with blank white cards pinned in a tree, connected by threads, under a desk lamp.

In this lesson you will

  1. 1The eight fields of each role
  2. 2File owner: who writes where, and isolated how
  3. 3A checker that flags missing fields and collisions
  4. 4The course map and your plan with dates

Goal: write your loop's time.md (role, level, tools, file owner, isolation, return, verification, cap) and run it.

01From request to team

Each step uses a lesson from the course. Click to see which one.

Click each block in the diagram to see what it does.

Start with the smallest team that does the job. A new role only comes in when you can say what it returns and who checks it.

02The time.md and the checker

Copy the template, swap in your loop's roles, and run the checker. No model is called.

time.md · template with four roles
# Time do loop — [nome do loop]

Decisão (aula 1): híbrido — plan and review at the center; run in parallel only the independent items.

## papel: planejador
- nível: topo
- ferramentas: Read, Grep, Glob
- escreve em: nada
- isolamento: nenhum (read-only)
- entrada: goal.md
- retorno: plan in up to 5 steps + comando → saída criteria (the orchestrator is the one who writes to plans/)
- verificado por: you (human gate before running)
- teto: 1 round

## papel: executor
- nível: executor
- ferramentas: Read, Write, Edit, Bash, Grep, Glob
- escreve em: src/ tests/novos/
- isolamento: worktree
- entrada: approved plan
- retorno: list of changed files + test output
- verificado por: avaliador
- teto: 3 rounds, 600 s each

## papel: avaliador
- nível: menor
- ferramentas: Read, Bash, Grep, Glob
- escreve em: nada
- isolamento: sandbox read-only
- entrada: goal.md + diff + test output
- retorno: OK/FALHA per criterion + APROVADO or FALTA
- verificado por: script verificar.mjs
- teto: 1 round per delivery

## papel: revisor-codex
- nível: executor
- ferramentas: codex exec -s read-only
- escreve em: nada
- isolamento: sandbox read-only
- entrada: same briefing + real diff
- retorno: up to 6 lines, the last one APROVADO or FALTA
- verificado por: you reconcile (aceito, rejeitado with evidence, em aberto)
- teto: 2 rounds
confere-time.py · save next to time.md
# confere-time.py — checks time.md: every role has the 8 fields, and no
# file has two owners without isolation (the collision from lessons 5 and 6).
# Usage: python3 confere-time.py time.md
import re, sys

CAMPOS = ["nível", "ferramentas", "escreve em", "isolamento", "entrada",
          "retorno", "verificado por", "teto"]
NIVEIS = {"menor", "executor", "topo", "super"}
texto = open(sys.argv[1], encoding="utf-8").read()
papeis = re.findall(r"^## papel: *(.+?)\n(.*?)(?=^## |\Z)", texto, re.M | re.S)
problemas = 0
donos = {}
for nome, corpo in papeis:
    campos = dict(re.findall(r"^- ([^:]+): *(.+)$", corpo, re.M))
    faltam = [c for c in CAMPOS if not campos.get(c, "").strip()]
    if faltam:
        print(f"{nome}: falta {', '.join(faltam)}"); problemas += 1
    if campos.get("nível") and campos["nível"] not in NIVEIS:
        print(f"{nome}: nível '{campos['nível']}' não é menor/executor/topo/super"); problemas += 1
    escreve = campos.get("escreve em", "nada")
    if escreve != "nada" and campos.get("isolamento", "nenhum").startswith("nenhum"):
        for alvo in escreve.split():
            donos.setdefault(alvo, []).append(nome)
    if escreve != "nada" and "ferramentas" in campos and not re.search(r"Write|Edit|Bash|workspace-write", campos["ferramentas"]):
        print(f"{nome}: escreve em {escreve}, mas as ferramentas só leem"); problemas += 1
for alvo, quem in donos.items():
    if len(quem) > 1:
        print(f"colisão: {alvo} tem {len(quem)} donos sem isolamento ({', '.join(quem)})"); problemas += 1
print(f"papéis: {len(papeis)} · problemas: {problemas}")
sys.exit(1 if problemas or not papeis else 0)
Terminal · check
cd ~/treino-multi
python3 confere-time.py time.md; echo "saída: $?"
Example from the repository
papéis: 4 · problemas: 0
saída: 0

The template passes. The planner writes "nada": the orchestrator is the one that saves the plan to disk. In the first version of the template, the planner said "escreve em: plans/" with read-only tools, and the checker flagged the contradiction.

03Final practice

Your team on paper, checked, and one real round.

E17 · The time.md for your loop

30 min

Run the matrix (lesson 1) for the loop you want to build. Write the time.md with the roles the decision calls for, replace [nome do loop], and run the checker.

Done when: python3 confere-time.py time.md; echo "saída: $?" → papéis: N · problemas: 0 and saída: 0, with N equal to the number of roles you wrote.

E18 · One round of the team

45 min

Pick a small task from your project. Write the goal with 2 or 3 criteria and commit it. The executor runs through gera-avalia.sh in a worktree (git worktree add) and the Codex reviewer reads the diff through the bridge. Reconcile the findings in revisao.md.

Done when: ./gera-avalia.sh goal.md "[request]" ends with → APROVADO and saída: 0; tail -1 revisao-codex.txt | grep -cE '^-? ?(APROVADO|FALTA:)' → 1; grep -cE "^(aceito|rejeitado|aberto):" revisao.md equals the number of findings.

04The course map

Four deliverables, in order. Click an exercise to see its "done when".

Day 1Decide

lesson 1

2 exercises

decisao.md with 3 tasks of your own and no warnings.

View the lesson
Days 1 and 2Delegate and check

lessons 2, 3 and 4

2 exercises

Read-only subagent, fan-out with a cap, and a generator × evaluator loop that approves.

View the lesson
Day 3Isolate

lessons 5 and 6

3 exercises

Lost write proven, worktree and sandbox per role, queue locked with flock.

View the lesson
Days 4 and 5Your team

lessons 7 and 8

2 exercises

time.md checked and one real round with a reconciled cross-review.

View the lesson
By the end of the courseA team of agents sized to the work, written on one page, checked by script and run once for real.
18 exercises
Tap an exercise to see what to do and the "done when".
  1. 1/5

    Decide

    The matrix before any agent. If everything comes out "direto", the rest of the course becomes a reserve for when you need it.

  2. 2/5

    Delegate and check

    Requires day 1. Each piece first with a fake agent, then one small real call.

  3. 3/5

    Isolate

    Requires days 1 and 2. All without quota: throwaway repository, codex sandbox, fake claude on the PATH.

  4. 4/5

    Your team

    Requires everything before. The Codex review on one day; the team round on the next.

  5. 5/5

    The whole course

    Decide, delegate and check, isolate, and build your team. Only move on to the next deliverable when the "done when" of the previous one is true.

Mandatory order: a team without isolation repeats the lost write, and a team without an evaluator goes back to trusting the generator's "done".

05Generate your plan with dates

Pick the start date and how much time you have per week. The plan lists the 18 exercises in order.

06Lesson quiz

Question 1 of 4

The matrix from lesson 1 said "direct" for your loop. What does time.md look like?skill

07In three sentences

One pageDecision and, per role: level, tools, where it writes, isolation, input, return, verification and cap.
Checked by scriptA missing field, a meaningless level and two owners without isolation show up before you run anything.
Run onceExecutor in a worktree, evaluator by code, cross-review reconciled.

Keep going here