Add a committed loop-autonomy contract + fingerprint dedupe to the CAD loop skills #49

Open
opened 2026-09-16 10:37:35 +00:00 by mathias · 0 comments
Owner

Source

Full read of erp-mafia/accounted on 2026-09-16 (AGPL Swedish accounting SaaS, ~1189 PRs merged in 7 months, bot-only review). Their .claude/loops.md is a committed contract that every one of their six scheduled agent loops must read first, and it solves problems our CAD loops solve ad hoc or not at all. Brain: wiki/homelab/decisions/propose-dont-merge-loop-contract.md.

What to adopt

  1. One committed autonomy contract, not per-skill prose. A two-column "loop may / loop may NOT" table, where the hard line is that gh pr merge (for us: pr_merge) is forbidden — loops open PRs, never merge, never push to main, never force-push over another author's commits, never act on flagged-author PRs.
  2. Mandatory idempotency, specified concretely. Before filing anything: compute a stable fingerprint (error signature, file:line, rule id — never a timestamp), search issues including closed ones for it, comment instead of filing on a match, reopen with a note if closed-and-recurring, and embed <!-- loop-fingerprint: <hash> --> in the body so future runs find it. Our CI-red edge (infra#366) and cad-stuck both file issues and both currently rely on title similarity.
  3. Anti-thrash as a rule: same fingerprint failed once → stop, label needs-human, comment what was tried. Never retry a failing action in a cycle.
  4. Per-run caps (≤5 PRs, ≤8 issues) with a requirement to log what was skipped, so cost is bounded structurally rather than by prompt wording.
  5. A separate verification-gate skill every loop must pass before opening a PR, encoding the repo's real gate commands plus the domain hard rules — with "the edit applied" explicitly named as not evidence. This is the feedback_verify_check_exit_not_grep lesson made into a reusable gate.
  6. An ignite/audit skill. Their loop-ignite exists because the human typed "check the pr comments" 323 times in four months and the loops built to replace that then sat un-started. It audits which loops are live, runs the dead ones once now, reschedules, and verifies the schedule exists before reporting. Slow (weekly/monthly) loops self-gate on a run marker stored in a tracking issue, because session-local crons cannot outlive the session. This is the same initiation gap cad-babysit works around manually.
  7. Keep a "why not X" section so nobody re-litigates it. Theirs records why cloud routines were retired after 19 days of silent no-ops.
  8. Closing rule: when a loop produces a bad result, fix the skill / the rule / the verifier — not just the one output.

Scope

Additive: a loops.md-style contract document in this repo referenced by the existing cad-* skills, plus a loop-verify-equivalent skill. No change to CAD dispatch itself.


Created via git-mcp on behalf of @mathias

## Source Full read of `erp-mafia/accounted` on 2026-09-16 (AGPL Swedish accounting SaaS, ~1189 PRs merged in 7 months, bot-only review). Their `.claude/loops.md` is a committed contract that every one of their six scheduled agent loops must read first, and it solves problems our CAD loops solve ad hoc or not at all. Brain: `wiki/homelab/decisions/propose-dont-merge-loop-contract.md`. ## What to adopt 1. **One committed autonomy contract**, not per-skill prose. A two-column "loop may / loop may NOT" table, where the hard line is that `gh pr merge` (for us: `pr_merge`) is *forbidden* — loops open PRs, never merge, never push to main, never force-push over another author's commits, never act on flagged-author PRs. 2. **Mandatory idempotency, specified concretely.** Before filing anything: compute a stable fingerprint (error signature, `file:line`, rule id — *never* a timestamp), search issues **including closed ones** for it, comment instead of filing on a match, reopen with a note if closed-and-recurring, and embed `<!-- loop-fingerprint: <hash> -->` in the body so future runs find it. Our CI-red edge (infra#366) and `cad-stuck` both file issues and both currently rely on title similarity. 3. **Anti-thrash as a rule**: same fingerprint failed once → stop, label `needs-human`, comment what was tried. Never retry a failing action in a cycle. 4. **Per-run caps** (≤5 PRs, ≤8 issues) with a requirement to log what was skipped, so cost is bounded structurally rather than by prompt wording. 5. **A separate verification-gate skill** every loop must pass before opening a PR, encoding the repo's real gate commands plus the domain hard rules — with "the edit applied" explicitly named as *not* evidence. This is the `feedback_verify_check_exit_not_grep` lesson made into a reusable gate. 6. **An ignite/audit skill.** Their `loop-ignite` exists because the human typed "check the pr comments" 323 times in four months and the loops built to replace that then sat un-started. It audits which loops are live, runs the dead ones once now, reschedules, and **verifies the schedule exists** before reporting. Slow (weekly/monthly) loops self-gate on a run marker stored in a tracking issue, because session-local crons cannot outlive the session. This is the same initiation gap `cad-babysit` works around manually. 7. **Keep a "why not X" section so nobody re-litigates it.** Theirs records why cloud routines were retired after 19 days of silent no-ops. 8. **Closing rule**: when a loop produces a bad result, fix the skill / the rule / the verifier — not just the one output. ## Scope Additive: a `loops.md`-style contract document in this repo referenced by the existing `cad-*` skills, plus a `loop-verify`-equivalent skill. No change to CAD dispatch itself. --- _Created via git-mcp on behalf of @mathias_
mathias added the risk/mediumsize/ltype/feat labels 2026-09-16 22:21:47 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: mathias/skills#49