The loop that learns|INEMA.CLUB-PRO

Lesson 5 · 18 min

Promotion to AGENTS.md and binding rule

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
A brushed-metal rules plaque screwed to the wall of a technical room, next to an electrical panel with a yellow lamp lit.

In this lesson you will

  1. 1The promotion question, asked to the person
  2. 2The six rungs: prose, checklist, test, probe, hook, server
  3. 3promote shows the diff; --write writes the block
  4. 4check flags a missing, outdated, or edited block

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.

01From the active rule to the file every session reads

enforce, promote, and check (SIL Loop R 1.1.0). Click each block.

Moving up a rung is the remedy for a rule that slips: the busy-port lesson written three times calls for a hook, not a fourth line of text.

The gap that v1.1.0 closed: in v1.0.0, no rule reached AGENTS.md (sil-melhoramento/ANALISE.md, finding no. 1).

02The six protection rungs

Accepted values for --rung, from weakest to strongest. SIL records the rung; you build the hook or the test.

1. prose · checklist

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.

03Rehearsal: from enforce to the block in AGENTS.md

Continues the rehearsal from lesson 4 (R0001 active). At the end, what a session-start hook would inject.

Terminal · cost-free rehearsal
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 --brief
Example from the repository
binding=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.

04Optional: the rule in every Claude Code session

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.

File · kit/hooks/settings-sessionstart.json
{
  "hooks": {
    "SessionStart": [
      {
        "hooks": [
          {
            "type": "command",
            "command": "python3 ~/projetos/sil-loop-r/sil.py --project \"$CLAUDE_PROJECT_DIR\" context --brief"
          }
        ]
      }
    ]
  }
}

05Practice

Rehearsal, then a rule of your own.

E13 · Block written and checked

10 min

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.

E14 · A binding rule of your own

20 min

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.

E15 · Climb a rung

30 min

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.

06Lesson quiz

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

07In three sentences

QuestionA binding rule is one whose breach, in a session without SIL, causes real damage; the person is the one who answers.
Blockpromote shows the diff, --write writes the delimited block, and check flags a missing or edited block.
StepA rule that keeps slipping moves up from prose to test, probe, or hook; SIL records the step and the leak.

Going further

Previous lessonNext lesson