Long Run|INEMA.CLUB-PRO

Lesson 5 · 17 min

Handoff that checks it was saved

A handoff written by the agent itself certifies itself: it can say it tested what it did not test, and the file may not even have been written. Since 10/17/2026 the proof is out of the text: a script writes a stamp, commit and fingerprint of the files, and the hook checks in the transcript that the handoff was really saved.

Start the lesson
A metal relay baton resting on an open technical notebook, on a dark desk.

In this lesson you will

  1. 1What goes in the handoff and what does not
  2. 2State block: commit and sha256 written by the script
  3. 3--conferir: equal (0), divergent (2), no block (3)
  4. 4Test questions and the N/5 score on resume

Goal: write a handoff with the script, check its freshness with --conferir, and know when the hook nags, writes on its own, or warns that it did not save.

01From the request to a verified resume

Skills session-handoff and prime from the agente-claude-codex 1.8.3 kit, with hook-longrun 1.9.6.

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

Decision rule: still true after the task → persistent memory (CLAUDE.md, AGENTS.md). State of this task → handoff. Record of what happened → history (git, progress, failures, decisions).

02Four rules for a handoff that works

From the 10/17/2026 analysis of the kit.

1. Pointer, not running text

The resume map, the sources of the test questions, and the evidence are paths and commits. That survives compaction, a new session, and a model switch.

A long history buries what the next agent needs to do.

03Install the skills and rehearse --conferir

The skills come from the agente-claude-codex kit (1.8.3). The rehearsal runs in a throwaway repository in /tmp.

Terminal · install session-handoff and prime (Claude and Codex)
git clone https://github.com/inematds/agente-claude-codex ~/projetos/agente-claude-codex
cd ~/projetos/agente-claude-codex
cp -r skills/session-handoff/dist/claude/session-handoff skills/prime/dist/claude/prime ~/.claude/skills/
mkdir -p ~/.agents/skills
cp -r skills/session-handoff/dist/codex/session-handoff skills/prime/dist/codex/prime ~/.agents/skills/
mkdir -p ~/projetos/<seu-projeto>/handoffs/history   # the hook only asks for a handoff where this folder exists
Terminal · rehearsal of --conferir
rm -rf /tmp/ensaio-handoff && mkdir -p /tmp/ensaio-handoff/handoffs/history && cd /tmp/ensaio-handoff
git init -q && git config user.name ensaio && git config user.email ensaio@local
echo "def f(): return 1" > app.py && git add -A && git commit -qm base
H=~/.claude/skills/session-handoff/scripts/handoff-grava.py
cat > /tmp/corpo-handoff.md <<'EOF'
# Handoff — ensaio-conferir

## Estado aceito
- [confirmed] `app.py` devolve 1 (commit: base; teste: python3 -c "import app; print(app.f())" → 1)

## Não fazer
- Não mudar a assinatura de f().

## Próxima ação
Trocar o retorno de f() para 2 e rodar o mesmo teste, que deve imprimir 2.

## Perguntas-teste
1. Qual é a tarefa e o critério de pronto? (fonte: app.py)
2. Qual foi a última decisão e por quê? (fonte: git log)
3. O que não pode mudar? (fonte: app.py)
4. O que está pela metade? (fonte: app.py)
5. Qual é a próxima ação e por quê? (fonte: app.py)
EOF
python3 $H --assunto ensaio-conferir < /tmp/corpo-handoff.md
F=$(ls handoffs/history/*.md | head -1)
python3 $H --conferir $F; echo "saída: $?"
echo "def f(): return 2" > app.py
python3 $H --conferir $F; echo "saída: $?"
Example from the repository
snapshot: handoffs/history/2026-10-19T070502Z-ensaio-conferir.md
latest.md: 1 assunto(s) aberto(s): ensaio-conferir
commit 8900d4e ensaio <ensaio@local> (sem push)
retomar ESTE handoff numa sessão nova (Codex: /new no lugar de /clear):
  /clear
  /prime handoffs/history/2026-10-19T070502Z-ensaio-conferir.md
frescor: igual (1 arquivo(s) conferido(s); commit b89d8ad3ba51)
saída: 0
frescor: divergente — o handoff é pista, não fato; confira antes de agir
  - app.py: mudou (citado no handoff)
saída: 2

The stamp and the hashes change on every run. The snapshot: line is the one the hook reads in the transcript to know which handoff THIS session wrote.

04Practice

The first two do not use your quota. The third uses one of your sessions.

E10 · Skills installed

10 min

Install session-handoff and prime for Claude and for Codex and create handoffs/history/ in your long run's project.

Done when: python3 ~/.claude/skills/session-handoff/scripts/handoff-grava.py --help | grep -c conferir → 1 or more, and ls ~/.agents/skills lists prime and session-handoff.

E11 · Freshness equal and divergent

10 min

Run the whole --conferir rehearsal.

Done when: frescor: igual with saída: 0, and after changing app.py, frescor: divergente with - app.py: mudou and saída: 2.

E12 · A real handoff, resumed

20 min

In your long run's project, ask for /session-handoff at the end of a block of work. Open a new session and run /prime with the path the script printed.

Done when: the /prime summary shows the freshness line (igual) and Perguntas-teste: N/5; write down the N in the run's progress.md.

05Lesson quiz

Question 1 of 4

Who writes the state block (commit and sha256) of the handoff?skill

06In three sentences

The script records the proofReal timestamp, new file, commit, and sha256 of the files; [confirmed] only with a commit, test, or file.
The hook checksLooks for the write in the transcript, prompts up to 2 times, and warns when it wasn't saved; after 45 min idle it writes to a copy.
Resuming gets measured/prime runs --conferir, checks the proofs, and scores the test questions.

Going further

Previous lessonNext lesson