feat(loop): a constitution the autonomous loops cannot edit - #186
Merged
Conversation
The loops' safety rests on one property: green CI means the work is sound. An
agent optimising for green has two routes - do the work, or weaken the thing
that measures the work - and the second is always cheaper. So the files that
constrain the loops have to be outside their reach, or there is no fixed point.
`scripts/gate/constitution-check.sh` refuses any change to CHARTER.md,
CODEOWNERS, scripts/gate/, or .github/workflows/ unless the PR author is on a
human allowlist. It fails closed: an identity not on the list is treated as a
loop, so a new loop is constrained the moment it exists.
The logic is a script rather than inline YAML so it is testable, and the
workflow runs its 24 cases on every PR - including the case that a loop cannot
edit the check itself.
The gate lives in scripts/gate/ and not .loop/: .loop/ is gitignored local
scratch ("not product"), and a gate has to be committed to be enforceable.
This is one of three independent locks. The others are the loop credential's
scope and branch protection requiring the `constitution` check - which must be
added to the required list once this lands, since a check that never reports is
what stops a PR deleting the job.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The autonomous loops' safety rests on one property: green CI means the work is sound. An agent optimising for green has two routes — do the work, or weaken the thing that measures the work. The second is always cheaper. So the files that constrain the loops must be outside their reach, or the system has no fixed point.
What
scripts/gate/constitution-check.shrefuses any change toCHARTER.md,CODEOWNERS,scripts/gate/, or.github/workflows/unless the PR author is on a human allowlist.It fails closed: an identity not on the list is treated as a loop, so a new loop identity is constrained the moment it exists, with no edit here required. The allowlist living inside a protected path is deliberate — a loop cannot add itself.
The logic is a script rather than inline YAML so it is testable. The workflow runs its 24 cases on every PR, including that a loop cannot edit the check itself, and that
dependabot[bot]and unknown actors are refused.Also lands the verified pieces of the loop gate:
sandbox-run.shtoken-scope-check.shprotection.jsonruleset-repo-guard.json19879637, already appliedOne required follow-up
constitutionmust be added to the required status checks. Apull_requestrun uses the workflow from the PR's own merge commit, so a PR that deletes this job runs without it. What stops that is a required check which never reports blocking the merge:gh api -X PATCH repos/automators-com/flowproof/branches/main/protection/required_status_checks \ -f 'contexts[]=constitution'Until that is run, this gate is advisory.
Why
scripts/gate/and not.loop/.gitignoremarks.loop/as local scratch — "Field-hardening loop scratch state (local bookkeeping, not product)". A gate has to be committed to be enforceable. Worth noting the same constraint applies to the gap ledger from the design: it needs a tracked home too.Testing
loop-bot, allowsAminChirazibash -nclean on all five scripts-D warnings, andcargo fmtall cleanNo engine code touched, so the
what changedfilter should skip the E2E jobs.🤖 Generated with Claude Code