Skip to content

chore: carry the sibling retro's guardrails into this repo - #11605

Merged
MarkusNeusinger merged 3 commits into
mainfrom
chore/sibling-retro-guardrails
Sep 5, 2026
Merged

chore: carry the sibling retro's guardrails into this repo#11605
MarkusNeusinger merged 3 commits into
mainfrom
chore/sibling-retro-guardrails

Conversation

@MarkusNeusinger

Copy link
Copy Markdown
Owner

Summary

  • Carries the session retro that landed in the sibling repository as kurrentschrift#538 into this repository's own conventions and anchors. CLAUDE.md now says what the Edit/Write rule outranks (an auto-mode reminder that arrives later in the context and prescribes sed/heredoc editing), and the delegation rule adds the second line a brief has to carry: all git stays inside the agent's own worktree.
  • Adds .claude/guardrails.md, the long version of the working rules — three sections only, the ones that apply here: the two lines every delegate brief carries, the ! bash runbook pattern for a prod pair the harness classifier refuses (this repository's own origin-gate README as the worked case, rollback as its own script), and why a one-token substitution is not an exemption from the Edit/Write rule. tests/unit/test_agent_instructions.py pins the split so a rule cannot end up living only where no session loads it.
  • Closes the gap #11216 left in /open-pr: that PR wrote the review_on_push: false cadence into CLAUDE.md and agentic/commands/pull_request.md, but the skill still carried "Copilot reviews every push round" as a gotcha and had no merge conditions at all. Plus three smaller transfers — branch-named scratchpad files, /verify-frontend § 3b (measure the result, not the plan), and /write-docs on shortening a text that carries claims.

What landed where

Rule from the retro Landed in
Edit/Write outranks the auto-mode reminder CLAUDE.md § Development Workflow
A delegate's git stays in its own worktree CLAUDE.md § Important Rules (delegation bullet)
Rule → incident → recipe, off the hot path .claude/guardrails.md (new) + pointer section in CLAUDE.md
Merge-on-request conditions (four, on the head SHA) /open-pr § 3e
mergeable vs. mergeStateStatus, DIRTY gets no CI /open-pr § 3e
One Copilot review per PR, re-request only after a rework /open-pr § 3b, and the contradicting gotcha corrected
Commit-message / PR-body files named after the branch /open-pr § 2
A numeric UI rule is measured, not planned /verify-frontend § 3b (new)
Shortening drops qualifiers first /write-docs § "Shortening a text that carries claims"

Not transferred, with the reason:

  • The /verify-api versioned-contract duty. It presumes a tool that pushes shared state at the API while both sides must agree how the data is computed, with the SERVER answering 409 on a mismatch. This repository's shared-state writes go straight to Postgres from the pipeline (sync_to_postgres), and its admin surface is /debug reads plus a cache invalidate — the mechanism has nothing to attach to here.
  • The sibling's measurement guardrails (frozen rulers, pinned BLAS threads, rescue-path register). Domain-specific to that repository; skipped as instructed.
  • .github/copilot-instructions.md was left untouched. The Edit/Write rule and the delegation rule do not exist in it at all — that file deliberately carries a subset aimed at review, and the sync duty is "a rule that exists in both". Adding either would be introducing a rule, not mirroring one. Flagging it here rather than deciding it unilaterally.

Two judgement calls I made myself: /write-docs drops the sibling's "regenerate app/prerender/ in the same push" clause, because this site serves crawlers through the live @seo_proxy rather than a committed prerender directory; and .claude/guardrails.md attributes the incidents to the sibling repository where that is where they happened, rather than restating them as local history.

Plan

N/A — sibling transfer of an already-merged retro.

Test plan

  • uv run --extra test pytest tests/unit/test_agent_instructions.py — 30 passed, including the three new guardrails pins
  • uv run --extra test pytest tests/unit — 1929 passed
  • uv run --extra dev ruff check . and ruff format --check . — clean
  • uv run python -m tools.changelog check --base origin/main — fragment well-formed, no [Unreleased] bullet added
  • Read .claude/guardrails.md end to end: every claim about infra/cloudflare/README.md (§ "Arming, in full", § "Rolling back") matches what that file actually says
  • /open-pr § 3e reads correctly against this PR's own head SHA — the check-runs dedupe query returns one row per check name

The session retro that landed in kurrentschrift found this repository
asymmetric on four of its lessons. Transferred here, in this repository's
own conventions and against its own anchors.

The precedence gap. Auto mode hands a delegated agent a reminder that
prescribes editing files with sed, heredocs and short scripts. It arrives
later in the context than CLAUDE.md, so it reads as the more recent
instruction, and three agents in one day followed it — two of them for the
single-token substitution that fills a PR number into a changelog fragment,
the same fragment format this repository uses. A fourth ran `git checkout -b`
in the SHARED checkout, which moves a ref the owner's own tree sits on.
CLAUDE.md now states both as precedence, because an agent cannot infer
precedence from the order its messages arrived in.

The companion file. `.claude/guardrails.md` is new here: CLAUDE.md is loaded
into every session and pays its cost on every turn, so it keeps the one-liners
and the narrative moves next door. Three sections, only the ones that apply
here — the two lines every delegate brief carries, the `! bash` runbook
pattern for a prod pair the harness classifier refuses (with this repository's
own origin-gate README as the worked case, rollback as its own script), and
why a one-token substitution is not an exemption from the Edit/Write rule.
The measurement rules of the sibling do not apply and are not carried.

What "ready to merge" means. `review_on_push` has been false since
2026-09-03, and #11216 wrote that into CLAUDE.md and the /pull_request
command — but /open-pr still carried the opposite as a gotcha and had no
merge conditions at all. It now says what to require on the head SHA:
non-Copilot checks completed and green (deduped by name, newest wins), a
Copilot review that actually exists on the PR rather than a check run that
can complete as cancelled, and zero unresolved threads. mergeable=UNKNOWN is
transient; CONFLICTING gets no CI at all, which reads as "checks pending".
Merging stays the owner's call.

Three smaller ones. /open-pr names commit-message and PR-body files after
the branch and consumes them in the step that wrote them, because the
scratchpad is shared by every agent of one session. /verify-frontend § 3b
generalises the ~13 px legibility floor into the rule it is an instance of:
a numeric rule is measured on the page, not on the plan. /write-docs gains
the claim-by-claim diff duty for any text a reader relies on, because
shortening drops qualifiers before it drops sentences.

tests/unit/test_agent_instructions.py grows a fifth pin: every section of the
companion file maps to a binding one-liner in CLAUDE.md, and the companion
has to say that CLAUDE.md outranks it — so a rule cannot end up living only
where no session loads it.

Not transferred: the versioned-contract duty for /verify-api. It presumes a
tool that pushes shared state at the API while both sides must agree how the
data is computed, and answers 409 on a mismatch. This repository's shared-state
writes go straight to Postgres from the pipeline, so the mechanism has nothing
to attach to here.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UEScQMZFvxxNNyNJYryfa3
Copilot AI balanced review requested due to automatic review settings September 5, 2026 12:58
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UEScQMZFvxxNNyNJYryfa3

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

The scratch-file workflow and check-run deduplication can fail or permit merging while a newer check remains queued.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR transfers agent-workflow guardrails from the sibling repository and adds regression checks for their documentation structure.

Changes:

  • Adds detailed guardrail rationale and updates core agent instructions.
  • Revises PR, frontend verification, and documentation skills.
  • Adds structural tests and a changelog fragment.
File summaries
File Description
CLAUDE.md Adds guardrail precedence and delegation rules.
.claude/guardrails.md Documents incidents and operational recipes.
.claude/skills/open-pr/SKILL.md Revises PR review and merge procedures.
.claude/skills/verify-frontend/SKILL.md Requires browser-measured numeric UI verification.
.claude/skills/write-docs/SKILL.md Adds claim-preservation guidance.
tests/unit/test_agent_instructions.py Tests the guardrail companion structure.
changelog.d/sibling-retro-guardrails.md Records the workflow changes.
Review details
  • Files reviewed: 7/7 changed files
  • Comments generated: 7
  • Review effort level: Balanced

💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread .claude/skills/open-pr/SKILL.md Outdated
Comment thread .claude/skills/open-pr/SKILL.md Outdated
Comment thread .claude/skills/open-pr/SKILL.md Outdated
Comment thread tests/unit/test_agent_instructions.py
Comment thread .claude/guardrails.md Outdated
Comment thread .claude/guardrails.md Outdated
Comment thread CLAUDE.md Outdated
@codecov

codecov Bot commented Sep 5, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

Seven review findings, all of them real, all applied.

The format claim. CLAUDE.md's rules mostly carry no date, so describing the
compact form as "rule, reason, date" promised metadata that is not there —
in the new pointer section and in the companion file's opening. Both now say
what the format actually is.

The rollback claim. The origin-gate rollback block does resolve the serving
revision and its image; what it avoids is looking up the SECRET, which is the
thing an incident may have disabled. The companion file said "it looks
nothing up", which is stronger than the runbook.

The scratchpad recipe was three ways wrong. It reached for a `$SCRATCH` this
skill never sets, it built a filename out of a branch name that can carry a
slash — `release/v1.2.3` names a directory that does not exist — and it
promised the fix covered PR bodies, while the mandated `/pull_request` builds
its body inline with a quoted heredoc and has no collision to avoid. It now
leads with `mktemp -d`, substitutes the separators when a name is derived, and
says where the rule does and does not bite.

The merge-readiness dedupe picked the wrong run. A check run carries no
`created_at`, and `started_at` stays null until the run begins, so
`max_by(.started_at)` hands the row to the OLD completed attempt while the
retry is still queued — the exact misread the step exists to prevent. It
dedupes on `.id`, which grows with creation and is always set.

And the pin under-asserted. A companion section that elaborates several
obligations now registers all of them: a single "opus by default" anchor
stayed green while the worktree line or the Edit/Write precedence was deleted
from CLAUDE.md and left living only where no session loads it.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01UEScQMZFvxxNNyNJYryfa3
@MarkusNeusinger
MarkusNeusinger merged commit be6615c into main Sep 5, 2026
12 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the chore/sibling-retro-guardrails branch September 5, 2026 13:14
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.

2 participants