E13 · Block written and checked
10 minRun the rehearsal after the lesson 4 blocks.
Done when: grep -c "sil-loop-r:begin" $E/p/AGENTS.md → 1; the check lines, in order: 1, 0, 1, 0.
Lesson 5 · 18 min
An approved rule that lives only in a database does not reach a new session: it only exists if someone remembers to look it up. In this lesson you ask the promotion question, record the protection rung and the known leak, write the block into AGENTS.md with a diff first, and watch check flag it when someone edits the block by hand.
Start the lesson
Goal: mark the rule as binding with a rung and a leak, write the block into AGENTS.md with promote --write, and catch the edited block with check.
enforce, promote, and check (SIL Loop R 1.1.0). Click each block.
The gap that v1.1.0 closed: in v1.0.0, no rule reached AGENTS.md (sil-melhoramento/ANALISE.md, finding no. 1).
Accepted values for --rung, from weakest to strongest. SIL records the rung; you build the hook or the test.
The agent reads the rule (AGENTS.md, CLAUDE.md) or it is checked against a list. It leaks when the session doesn't read the file, or reads it and forgets.
Good for a rare rule or one that takes judgment.
A test or a probe fails when the rule is broken. It leaks when nobody runs the test.
Wired into the loop gate (course 1, lesson 8), it no longer depends on memory.
A hook blocks the tool before it runs, or the server refuses. It leaks through --no-verify, widened permissions, or another tool.
The guard hook is course 4, lesson 5.
verify ID --positive … --negative … --evidence … stores the report of the cases you ran. It doesn't run or certify anything.
Continues the rehearsal from lesson 4 (R0001 active). At the end, what a session-start hook would inject.
SIL=~/projetos/sil-loop-r/sil.py
E=${TMPDIR:-/tmp}/ensaio-aprende/a4; cd $E/p # continues the lesson 4 rehearsal (R0001 active)
s() { python3 $SIL --project $E/p "$@"; }
j() { python3 -c 'import json,sys; d=json.load(sys.stdin); print(*[k+"="+json.dumps(d.get(k),ensure_ascii=False) for k in sys.argv[1:]])' "$@"; }
echo "# Instruções do projeto" > AGENTS.md
s enforce R0001 --binding yes --rung prose --leak "sessão que não lê o AGENTS.md" \
--approved-by "Seu Nome" --reason "porta ocupada derruba o servidor de outra sessão" | j binding rung
s status | j promotion prose_binding; s check > /dev/null; echo "check: $?"
s promote | j written changed
s promote --write | j written; cat AGENTS.md
s check > /dev/null; echo "check: $?"
echo "## alguém editou o bloco à mão"; sed -i.bak 's/checar a porta/CHECAR A PORTA/' AGENTS.md
s check | j promotion; s check > /dev/null; echo "check: $?"
s promote --write | j written; s check > /dev/null; echo "check: $?"
echo "## o que um hook SessionStart injetaria"; s context --briefbinding=true rung="prose"
promotion={"file": "AGENTS.md", "in_sync": false, "problem": "bloco ausente; execute promote --write"} prose_binding=["R0001"]
check: 1
written=false changed=true
written=true
# Instruções do projeto
<!-- sil-loop-r:begin — gerado por sil.py promote; não editar à mão -->
## Regras vinculantes (SIL Loop R)
- checar a porta antes de subir servidor (R0001; escopo: testes HTTP; proteção: prose; vazamento: sessão que não lê o AGENTS.md)
<!-- sil-loop-r:end -->
check: 0
## alguém editou o bloco à mão
promotion={"file": "AGENTS.md", "in_sync": false, "problem": "bloco desatualizado; execute promote --write"}
check: 1
written=true
check: 0
## o que um hook SessionStart injetaria
SIL Loop R — regras deste projeto (dados revisáveis; instruções do usuário prevalecem):
- R0001 [ativa] checar a porta antes de subir servidor (escopo: testes HTTP)
- R0002 [experimental] conferir git remote -v antes do push (escopo: publicação)Before --write, check already flags it: a binding rule with no block. After the hand edit, it flags it again, until promote rewrites it. The block comes out in Portuguese because sil.py prints in Portuguese.
For those who don't use AGENTS.md, or want the experimental rules too: a SessionStart hook that prints context --brief (SIL 1.1.0 created --brief for this). Add the hooks block to the project's .claude/settings.json, without replacing the whole file; the last part of the rehearsal above shows the text that would go in. Guard hooks, the ones that block, are course 4.
{
"hooks": {
"SessionStart": [
{
"hooks": [
{
"type": "command",
"command": "python3 ~/projetos/sil-loop-r/sil.py --project \"$CLAUDE_PROJECT_DIR\" context --brief"
}
]
}
]
}
}Rehearsal, then a rule of your own.
Run the rehearsal after the lesson 4 blocks.
Done when: grep -c "sil-loop-r:begin" $E/p/AGENTS.md → 1; the check lines, in order: 1, 0, 1, 0.
Of the rules you adopted in lesson 4, ask the promotion question to whoever decides (you, if it's your project). For the one that is binding, record an honest rung and leak, look at the diff, and write it.
Done when: python3 $SIL --project . status | python3 -c 'import json,sys; print(json.load(sys.stdin)["promotion"]["in_sync"])' → True, and AGENTS.md has the block.
Pick the binding rule that has already slipped (it shows up more than once in your lessons). Write a test or a probe that fails when it is broken, run one good case and one bad case, and record it with enforce --rung test (or probe) and verify.
Done when: your test exits with a code other than 0 on the bad case and 0 on the good case; and status no longer lists that rule in prose_binding.
Question 1 of 4
Who answers the promotion question ("does breaking this rule in a session that doesn't consult SIL cause real damage?")?skill
Question 2 of 4
Someone fixed a typo inside the sil-loop-r block in AGENTS.md. What does check do?skill
Question 3 of 4
The rule about checking the port before starting a server was written three times in the lessons. What is the right move?
Question 4 of 4
What does promote without --write do?
Choose an answer. The explanation appears after you try.