Skip to content

Harden /loop with "loop engineering" operating rules (trust levels, denylist, run-log) - #9

Merged
dominno merged 3 commits into
mainfrom
claude/loop-hardening
Jun 29, 2026
Merged

dominno merged 3 commits into
mainfrom
claude/loop-hardening

Conversation

@dominno

@dominno dominno commented Jun 29, 2026

Copy link
Copy Markdown
Owner

Summary

Integrates the most valuable, Claude-Code-fitting ideas from cobusgreyling/loop-engineering to make our recurring /loop safe to operate — addressing that project's own caveat that "unattended loops make unattended mistakes; token costs explode." Our /loop previously had no trust gating, budget, durable run-state, or escalation rubric.

We already covered much of "loop engineering" (skills, memory wiki, MCP connectors, CI, maker/checker critics); this PR fills the genuine gaps. Docs/config only — no product code touched.

Changes

  • .claude/loop.md — rewritten with:
    • Trust levels: L1 report-only → L2 assisted → L3 unattended (default L1).
    • Read-state-first / append-run-log step each iteration.
    • Denylist: auth, payments, secrets/.env, infra/deploy, CI config, DB migrations.
    • Escalation triggers + red-flag stop conditions (>3 fix attempts without progress, verifier == implementer session, no state file, notify-every-run, auto-merge without allowlist).
    • Budget & limits (per-run cap + kill switch, max iterations/item, max auto-PRs/day, self-stop on empty watchlist).
  • .claude/loop-checklist.md — new readiness rubric (10 sections + L0–L3) to gate raising a loop's trust level.
  • .claude/memory/loop-run-log.md — new append-only loop state (separate from the wiki's log.md), with the >500-line rotation rule.
  • CLAUDE.md — loop trust-level guidance + the maker/checker no-self-approve rule + an Agent isolation: worktree note for file-mutating loops.
  • Wired through skills-index.md, README tree, the adoption guide (with a "Recurring loops are hardened" section citing the source), and memory (topics/workflow.md + log ingest entry).

Deliberately skipped (not a fit)

Their loop-init/loop-cost/loop-audit npm CLIs and the multi-tool (Grok/Codex) primitives matrix — we're Claude-Code-only with our own scaffolding; borrowed the concepts, not the tooling.

Test plan

  • Docs/config only; diff touches .claude/*, CLAUDE.md, README.md, docs/adoption-guide.md.
  • New files present; cross-references (loop-checklist.md, loop-run-log.md) resolve.
  • CI verify will run on this PR (no source/test changes → expected green).

🤖 Generated with Claude Code


Generated by Claude Code

Integrate concepts from github.com/cobusgreyling/loop-engineering to make the
recurring loop safe to run (their own caveat: unattended loops make unattended
mistakes; token costs explode). Our /loop previously had no trust gating, budget,
run-state, or escalation rubric.

- .claude/loop.md: rewritten with TRUST LEVELS (L1 report → L2 assisted →
  L3 unattended), a read-state-first/append-run-log step, a denylist (auth,
  payments, secrets, infra, CI config, migrations), escalation triggers, red-flag
  stop conditions (>3 attempts, verifier==implementer, no state, notify-every-run,
  auto-merge w/o allowlist), and budget/limits.
- .claude/loop-checklist.md: new readiness rubric (10 sections + L0–L3) to gate
  raising a loop's trust level.
- .claude/memory/loop-run-log.md: new append-only loop state (separate from the
  wiki log), with the >500-line rotation rule.
- CLAUDE.md: loop trust-level + maker/checker no-self-approve rule + Agent
  isolation:worktree note. skills-index, README tree, adoption-guide (with source
  citation), and memory topics/workflow.md + log entry updated.

Docs/config only; no product code touched.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G
Copilot AI review requested due to automatic review settings June 29, 2026 13:39

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR hardens the repo’s recurring /loop watchdog operating procedure by adding trust gating, durable run state, a denylist, escalation/stop rules, and a readiness checklist—aimed at making unattended/recurring loops safer to operate without touching product code.

Changes:

  • Rewrites .claude/loop.md to introduce trust levels (L1–L3), denylist/escalation/stop rules, and a required read-state-first + append-run-log flow.
  • Adds new loop artifacts: .claude/loop-checklist.md (readiness rubric) and .claude/memory/loop-run-log.md (append-only durable loop state).
  • Wires the new loop hardening guidance into existing docs and indexes (README, CLAUDE.md, adoption guide, skills index, memory workflow topic, memory log).

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
README.md Updates the repo tree to include the hardened loop docs and new run-log/checklist files.
docs/adoption-guide.md Documents the hardened recurring-loop operating rules for adopters.
CLAUDE.md Adds trust-level guidance, run-log references, and maker/checker + worktree isolation notes.
.claude/skills-index.md Updates /loop routing guidance to reference the checklist and durable run-log.
.claude/memory/topics/workflow.md Records the loop hardening principles in the workflow topic page.
.claude/memory/loop-run-log.md Introduces a new append-only durable state file for /loop runs/iterations.
.claude/memory/log.md Logs the ingestion of the loop-hardening changes into the memory log.
.claude/loop.md Replaces the prior loop prompt with hardened operating rules and run-log requirements.
.claude/loop-checklist.md Adds a trust-level readiness checklist (L0–L3) to gate promotion.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread .claude/loop.md Outdated
Comment thread .claude/loop.md
Comment thread .claude/memory/loop-run-log.md
Comment thread .claude/memory/loop-run-log.md Outdated
Comment thread CLAUDE.md Outdated
Comment thread docs/adoption-guide.md Outdated
Comment thread .claude/loop-checklist.md Outdated
Comment thread .claude/loop-checklist.md Outdated
claude added 2 commits June 29, 2026 13:46
…n wording)

Resolve the 8 PR #9 review comments, in three groups:

- Budget made concrete & auditable: .claude/loop.md now defines a per-run cap
  (turn budget e.g. 25 turns, or token ceiling) declared with the trust level and
  checked each iteration; added a `budget: <used>/<cap>` line to the run-log entry
  template in both .claude/loop.md and .claude/memory/loop-run-log.md.
- Terminology standardized on "iteration" for log read/append granularity
  (CLAUDE.md, loop-checklist §5/§8/§9 + red flag, adoption-guide), keeping the
  intentional "per-run cap" for budget scope.
- Rotation note in loop-run-log.md now says to create the archive dir/file on
  demand (matching memory/log.md).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G
Standalone guideline (docs/loop-integration-guide.md) for integrating recurring
/loop automations into an existing project: what to copy (loop.md, loop-checklist,
loop-run-log), the L1→L2→L3 trust model, a step-by-step (scope, cadence, denylist,
budget, run-log wiring, promotion gates), loop-pattern recipes (daily-triage,
pr-babysitter, ci-sweeper, ...), worktree isolation for file-mutating loops, the
red-flag stop conditions, and local-vs-CI guidance. Cites loop-engineering.

Linked from the README docs tree and the adoption guide's hardened-loops section.
Added to PR #9 since it documents that PR's loop files.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Claude-Session: https://claude.ai/code/session_014xUCrJdREvUMjoVzSX5T8G
@dominno
dominno merged commit db7dc4d into main Jun 29, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants