Work

From jikig-ai/soleur · View interactive version

Work is an AI agent skill from the GitHub repository jikig-ai/soleur. This skill should be used when executing work plans efficiently while maintaining quality and finishing features.

How to use this skill

Skill file

<!-- soleur-cloud-mode:start -->

Cloud Mode (Devin): before pipeline work run bash "${CLAUDE_PLUGIN_ROOT}/scripts/cloud-detect.sh". If CLAUDE_PLUGIN_ROOT is unset (cloud exec shells do not export it), resolve the root by IDENTITY, never by script basename: for d in "$HOME/.local/share/devin/cli/plugins/cache" and /opt/.devin/plugins, skip unless [ -d "$d" ], then MANIFEST="$(find "$d" -path '*/.claude-plugin/plugin.json' -exec grep -l '"name"[[:space:]]*:[[:space:]]*"soleur"' {} + 2>/dev/null | head -1)", ROOT="${MANIFEST%/.claude-plugin/plugin.json}" — one resolution, two consumers: $ROOT/scripts/cloud-detect.sh and $ROOT/scripts/precommit-guard.sh. (Shape check, not authentication: a planted {"name":"soleur"} dir passes — ADR-179 A11.) local or not-local:no-devin-env proceeds normally; any other not-local:<reason> applies <plugin-root>/devin/INSTRUCTIONS.md §Cloud Mode: emit the --banner, fan out sequentially with Reviewed-Coverage: sequential-fallback disclosure (never claim an independent review ran), message_user ack before any secrets read or production mutation, and run precommit-guard.sh before any git commit — hooks do not fire in cloud.

<!-- soleur-cloud-mode:end -->

<!-- grok-harness-invoke:start -->

Grok Build (plugins/soleur/lib/harness.ts invokeSkill()): Read this SKILL.md in this process and run it to completion. A one-segment soleur:<name> in this document names a SKILL — on Grok Build, Read plugins/soleur/skills/<name>/SKILL.md in this process; it is not a nested tool_use. A multi-segment id such as soleur:<domain>:<name> names an AGENT: spawn it, never Read it, and on Grok Build spawn_subagent takes the id with its colons replaced by hyphens (agentIdToGrokSubagentType). Claude Code: Skill tool for a skill (soleur:<name>), Task tool with subagent_type for an agent. Forbidden is executing a subset, not the Read.

<!-- grok-harness-invoke:end -->

<!-- work-anti-bypass-protocol:start -->

Anti-bypass protocol (load-bearing — especially Grok Build)

You are the implementation orchestrator for standalone soleur:work and one-shot Step 3:

See plugins/soleur/lib/workflow-fidelity.ts (IMPLEMENTATION_TAIL) and Phase 4 Invocation Mode below.

<!-- work-anti-bypass-protocol:end -->

**"PROPAGATED" IS A MEASUREMENT ACROSS EVERY SITE ASSERTING THE CLAIM — NOT AN OBSERVATION ABOUT

THE ONE YOU EDITED.** Grep for the OLD claim after correcting it, never for the new one: a residual

count over the new text is structurally blind to the sites still carrying the old. A superseded

position survives precisely where prose review does not look — machine-readable frontmatter, an

operative conclusion far from the edited paragraph, and a DIFFERENT document citing the old

position as its own contrast case — so a corrected document containing an uncorrected field clears

both the gates and the review. **A literal grep is the WEAKEST of the three sweeps, and

PARAPHRASE is the mode with no coverage** — wrap-insensitivity handles a blockquote splitting

a phrase, and neither handles a site that restates the claim in different words. Write the

claim as a SENTENCE and grep its paraphrases; the highest-risk position is a **Prevention:**

line, because that is the part a future session executes. Why: #7957 — a sweep that was

wrap-insensitive across all 9,684 tracked *.md returned 0 for a file it had just corrected,

while that file's ## Session Errors still prescribed "wait for the completion notification"

as the remedy for an error it names "Inferred a commit VERDICT". Why: #7349 — a legal record's controllership was corrected in

prose while its YAML controller: field FIFTEEN LINES ABOVE still asserted the superseded

position, along with the operative balancing conclusion and a sibling document; the signed-off

audit had already recorded that propagation as DISCHARGED. Same shape as the measurement rule

below, one level up: that rule protects a number's freshness, this one protects a correction's

reach. See knowledge-base/project/learnings/2026-08-12-every-blocking-finding-was-the-defect-class-the-pr-existed-to-close.md.

VERIFY A MEASUREMENT ONCE, BEFORE IT PROPAGATES. When a plan's sweep will write the same

measured fact into more than one file, verify it at the granularity you are about to CLAIM it

— before the first write, not after the last. A false measurement does not stay where you put

it: downstream files, issue comments, and review agents all consume it as fact and build on

it, so the cost of correcting it scales with how far it spread, and the correction itself has

to be swept. Why: #7325 — "cx33 is available in hel1-dc2" was read off a FLEET-WIDE probe

and written into 4 files and 2 issue comments. It is false per-datacenter. Six review agents

read it and one built its top finding on it (recommending an amendment to a hard-rule

exception), so the error had already propagated one level past the diff before a 15-second

re-probe falsified it. Project every measurement onto the exact scope you will assert — per

datacenter, per host, per environment — and re-probe rather than adjudicating between two

readings of the record.

SINGLE-SOURCE THE RATIONALE BEFORE WRITING IT, NOT AFTER REVIEW SAYS SO. Prose is review

surface: every restated paragraph is re-read by every agent and can drift independently. Write

the reasoning ONCE at the artifact that owns the decision (the ADR for the element, the

resource for the resource) and make every other site a one-line pointer anchored on content,

not a line number. Why: #7325 — ~300 lines of justification prose across 8 files became

the bulk of the review surface for a one-literal change, and two copies of the same probe

table DIVERGED INSIDE THE SAME PR (one said "flipped twice", the other "three times") before

any reviewer saw them. The review's own conclusion was to delete one copy. A short rationale

plus a pointer is both cheaper to review and structurally unable to drift.

A ROLE TEST BUILT FROM AN ABSENCE DOES NOT DISCRIMINATE, AND ITS FIXTURE WILL AGREE WITH IT. When one artifact is rendered for two roles (a shared bootstrap, a shared workflow, a shared config), scope role-specific behaviour on a POSITIVE identity the role owns — and emit that identity as a field so the consumer can require it rather than infer it. Never scope on "the other role does not have X": you must then prove the negative, and the CI sandbox lacking X will pass the arm you labelled "the other role" while proving nothing about it. Fixture the role that HAS X, with every input present and only the identity differing. Why: #7695 gated a destructive-recut input on "is /mnt/data a mountpoint", commenting that the co-located web host has no /mnt/data; cloud-init.yml mounts the workspaces volume there, so the probe would have walked every user's repo tree hourly and shipped a store measurement from the wrong host into a gate whose clearance condition is 0. See knowledge-base/project/learnings/2026-09-02-i-built-a-host-discriminator-out-of-an-absence-and-fixtured-the-absence.md.

A CARDINALITY PIN COUNTS THE CONTAINER, NEVER OCCURRENCES OF THE MEMBERS YOU EXPECT — and a verbose-gated line is a silent one under every redirect. grep -c '<known-a>|<known-b>' -eq 2 is satisfied by a list holding both known members AND a third you did not name; the property "exactly two directories are searched for a payload to execute" is the arity of the for d in …; do line itself, so count ITS words. Same session, second shape: a skip line gated on verbose ([[ -t 1 ]]) prints nothing under a test's redirect or claude --bg, so a HELD branch and an UNCONSIDERED one produce identical stdout and the diagnosis goes to the wrong block. Before reading a guard's logic, grep the SUT for verbose-gated lines on that path. Why: #8418 — /srv/extra-plugins appended to all three go.md fences stayed green under -eq 2 over known spellings; A9's reaper printed nothing per-branch and cost a round on the wrong hypothesis. See knowledge-base/project/learnings/2026-09-20-every-defect-in-my-fix-was-a-sentence-i-could-have-run.md.

ASSERT THE VALUE THAT MUST NEVER APPEAR, AND PUT THE INSTRUMENT UPSTREAM OF EVERY ASSERTION. When a change exists to guarantee a value never occurs, assert that negative directly over every arm and every field — a positive "is it the token I expect" is satisfied by the correct answer AND by any arm that never reaches the field. Give each suite an instrument self-test that drives its pass/fail helpers once each and refuses to continue unless both counters moved, and report assertion-count floors with printf + exit 1, never through the helper they backstop (ADR-193). Why: #7695 — 16 of 24 mutants survived a 250-assertion battery; three flipped __UNREADABLE__ to the literal 0 that authorizes a destroy and stayed green, if eval "$condition" -> if true produced a byte-identical summary line, deleting the entire new block reported 232/232 passed, 0 failed exit 0, and the sibling suite's floor called the very fail() one edit disarms. Same learning file.

THE WRAPPER THAT REPORTS A GATE IS ITSELF A GUARD, AND IT IS THE ONE NOBODY REVIEWS. The suite under test gets mutation rows, assertion floors and an instrument self-test; the five-line bash that RUNS it and reports the verdict gets none, so the could-not-measure/measured-bad collapse survives there. Three rules: never take a verdict from a PARTIAL artifact, and never from the completion NOTIFICATION either — the notification is authoritative for LIVENESS (has it exited?), never for VERDICT (did it succeed?), and TWO INDEPENDENT mechanisms defeat the verdict reading. (i) Its exit code is that of the LAST command the shell EXECUTED, so a trailing git log for convenience becomes the verdict — measured in #7912 (filed as #7957): three commits notified exit code 0 while git commit had returned 1. (ii) A run killed mid-tsc by the memory reaper ALSO notified completed, with no trailing command involved at all — so ending the string with the command that matters does NOT make the notification trustworthy; a missing verdict line is UNRESOLVED, never a pass. Write the real code yourself — echo "RC=$?" >> log IMMEDIATELY after the command whose status matters, before any convenience line, because $? binds to the immediately preceding command — and read that; a per-step line is not the runner's verdict either. Never pipe a command whose exit code IS the result (cmd | tail takes the pipe's status and destroys the evidence in the same stroke — redirect and read $?); and make "the loop ran" observable, because grep -c exits 1 on zero matches, so 0 failures and 0 executions render identically. Put long-lived logs in the worktree — /tmp is swept between turns and leaves the writer holding a deleted inode — but never COMMIT the raw stream: a committed run record is the verdict block only (a full lefthook stream was 1.26 MB in #8207, against a ≤25 KB norm; knowledge-base/project/learnings/2026-09-15-my-legal-record-said-the-change-had-landed-inside-the-pr-that-lands-it.md). Why: #7828 — a partial lefthook tail read as "rejected" started a SECOND concurrent git commit in one worktree (two writers, one index); git commit | tail -25 reported success on a failed commit and destroyed the only copy of a 52-minute battery failure, which then had to be re-run; and a fleet loop reported 0 reds without proving it executed. Seven process errors, one shape — the same shape the PR's own 38 findings existed to remove. #7912 hit the two-writers case AGAIN by a different route: the harness reaped the parent git commit and its lefthook kept running, so a retry made two writers on one index. Before any git-write retry, check this worktree for a surviving hook process — a reaped task does not imply a reaped process tree. See knowledge-base/project/learnings/2026-09-07-every-instrument-i-built-to-check-my-own-work-could-not-tell-clean-from-never-ran.md.

A FILE-SELECTED SUITE SET CANNOT SEE A REPO-GLOBAL RATCHET — expect any change that adds a test, a floor, a regex or an operator-facing message to move a counter, and fix the code rather than the baseline. When the full gate is refused or contended, the sanctioned substitute is to run the suites covering your diff, chosen by grepping which ones REFERENCE the changed files. That selection is correct and has one structural blind spot: a ratchet counts a property across the whole tree and references nothing, so no file-based query can ever return it. The failure is therefore not carelessness and does not improve with effort — it recurs until the selection is widened by hand. These baselines ratchet DOWN only, so the remedy is always the code: reword the message, rewrite the regex, promote the file, regenerate the baseline the gate's own failure text prescribes. Why: measured three times in one session — #7997/PR #8023 shipped green on its selected suites while CI reddened on guard-vacuity-floor, lint-diagnosis-claims and fixture-relative-assert; PR #8092 then reddened no-control-regex (19→20) on a two-file diff whose own suites were 91/91; and PR #8177 left INDEX.md/kb-tags.txt stale, so kb-search --tag could not find the learning that documents this rule. None of those artifacts referenced a changed file AT SELECTION TIME — guard-vacuity-floor names one today only because promoting that suite was the remedy, which is why re-grepping later appears to refute this. See knowledge-base/project/learnings/2026-09-14-i-tested-both-endpoints-and-left-the-wire-between-them-unpinned.md.

REGENERATE A WHOLE-REPO RATCHET BASELINE ONLY AFTER THE MERGE COMMIT EXISTS — and name the SOURCE of every git restore. A baseline is a committed artifact; a mid-merge index is transient state, and regenerating one from the other bakes the merge into the tree. During an unresolved merge git ls-files emits a conflicted path once per STAGE, so a whole-repo scanner counts that file three times and the drift it reports is arithmetic, not content: measured, guard-vacuity-floor.test.sh recorded 18 sites for a file with 6 — exactly 6 x 3 — and the commit message then explained the delta as "exactly the merged union", which was false in both directions (the union added ZERO sites). The sibling trap in the same recovery: git checkout -- <file> restores from the INDEX, so on a path you already git add-ed it is a no-op that looks like an undo — the edit survives and the absence of an error reads as success. Name the source (git restore --source=HEAD --staged --worktree) and verify by grepping for the thing you meant to remove. Why: #8539/PR #8560 — the review that existed to find guards narrower than their names shipped a baseline recording a state no tree ever had, into the commit fixing that class; CI caught it, and the local reproduction of that CI failure returned rc=4 REFUSED and had measured nothing. See knowledge-base/project/learnings/2026-09-23-the-prose-stated-the-property-and-the-predicate-checked-a-subset.md.

A GUARD RUN WITHOUT THE ARGUMENT THAT BOUNDS IT REPORTS A VERDICT ABOUT THE WRONG POPULATION — and it reads as reassuring in both directions. Sibling to the rule above: that one is about which guards you SELECT, this one about how you INVOKE the ones you did. Two shapes, one root. (i) An anti-vacuity floor left below the count it now measures is pure slack, and slack in a floor is attack budget, not padding — the gap is exactly how many assertions can be deleted before the one guard that detects truncation notices, so raise the floor in the SAME edit that adds the row, never in a later tidy-up. (ii) A baselined linter invoked without --baseline re-reports its entire baseline as new findings; read the runner's own invocation (grep run_suite scripts/test-all.sh) rather than the script's name, because the bare form fails LOUD and wastes a triage round, while its mirror — a --baseline that silently absorbs a real regression — fails quiet. Why: #8386 shipped a stale floor twice in one session (MIN_CASES=44 while 49 cases ran, then 49 while 53 ran — each raised only after a review round noticed), and lint-shell-capture-exit.py run bare reported "201 NEW finding(s) across 60 file(s)" against a tree whose real count was 0. See knowledge-base/project/learnings/2026-09-20-my-probe-graded-itself-against-a-clock-its-grader-never-read.md.

"THE DOCUMENTED API IS THE ONLY WRITE PATH" IS AN ASSUMPTION, NOT A FINDING — AND A HAZARD IS SETTLED BY A REVERSIBLE EXPERIMENT, NOT AN ARGUMENT. Before declaring an operator step because a control-plane credential is dead, ask what OBJECT is being changed and enumerate every write path that reaches it — not just the API the ticket names. Then, when the automated path carries a lockout risk, design a throwaway probe that answers it in seconds instead of reasoning from documentation. Why: #7966 — both stored SUPABASE_PATs returned 401, and I concluded the credential rotation was blocked on minting a new PAT; the operator's one-line question, not my analysis, surfaced that the object was a POSTGRES ROLE and that ALTER ROLE postgres WITH PASSWORD over the pooler connection already held needs no PAT at all. The hazard (Supavisor caching a stale upstream credential would strand the ONLY reachable path into the database, the direct host being IPv6-only) was refuted by creating a throwaway role and watching the pooler authenticate a principal it had never seen. See knowledge-base/project/learnings/2026-09-10-every-assertion-i-wrote-to-prove-the-fix-could-be-satisfied-while-the-defect-was-live.md.

A DATED record is APPEND-ONLY. When a plan's sweep touches a probe table, ledger row, dated addendum or post-mortem, correct it by APPENDING a new reading/section that cites the old one — never by editing the old one's body or substituting a cell. Editing in place is what turns a correction into destroyed evidence, and the destroyed datum is disproportionately the one that supported your own claim. Use ## Addendum — YYYY-MM-DD (#N) or > **Superseded YYYY-MM-DD (#N):**, and put the record in the ADR that OWNS the element rather than the one you happened to be reading. Why: #7309 — a repin overwrote ADR-143's dated cx23 = YES — in stock cell, then asserted "Both read NO here" four lines above it; that deleted YES was the only in-repo evidence for the PR's own headline claim, and restoring it made the argument stronger than the one that replaced it. See knowledge-base/project/learnings/2026-08-06-i-deleted-the-measurement-that-was-my-own-evidence.md.

BEFORE FIXING A DEFECT CLASS, GREP THE LEARNINGS FOR IT — AND IF IT RECURRED, THE FINDING IS THE PROPAGATION FAILURE, NOT THE DEFECT. When the fix is a helper, the durable unit is the IMPORT, not the helper and not the write-up: a helper that must be re-derived per file will eventually be re-derived wrongly, and the wrong copy is disproportionately the one that does damage. Strip by PREFIX, never by a hand-listed set of names — a name list is a claim about which values the tool honours, and it is wrong the moment the tool adds one. Why: #7822 — a fixture spreading a raw process.env into git commit under lefthook committed onto the caller's live branch and CONSUMED an in-flight commit (GIT_DIR beats cwd, and beats git -C too). The identical mechanism was already documented five months earlier in the same directory (#1454), WITH two correct working copies in the tree; neither was importable, so neither propagated. The first fix hardcoded six GIT_* names — exactly what the prior learning's Prevention section said not to do, unread until after it was committed. Second harm: a case asserting "this directory is NOT a repository" inverts under the inherited variable and proves nothing while staying green. See knowledge-base/project/learnings/2026-09-04-a-learning-two-working-copies-and-it-still-got-re-derived-wrong.md.

**A YAML run: | BLOCK APPLIES NO ESCAPE PROCESSING — VERIFY THE LINE AS THE RUNTIME WILL RECEIVE

IT, NOT AS YOU WROTE IT.** A literal block scalar hands the command its bytes verbatim, so a

doubled backslash reaches sed as a LITERAL backslash: \\( is not a capture group in BRE, and the

expression silently matches nothing. Nothing rejects it — the step exits 0, the variable is empty,

and every condition downstream of it goes false. The same block has two more traps: no line inside

it may begin at column 0 (a heredoc terminator or a wrapped quote there ends the block), and a

templatefile()-rendered one needs $${…} for braced shell expansions. So never grade one of these

edits by reading it: parse the YAML, extract the command, and run it against a fixture whose correct

answer you already know. Why: #7500 — a fix hardening NIC_ALARM_VERDICT against injection

doubled the backslashes in its own anchored sed, so BOTH verdicts extracted empty on every run and

all four filing conditions went false: the alarm would have filed nothing on any verdict. That is

the #7242 "dark on exactly the verdicts it exists to raise" defect, reintroduced by the commit

fixing a different defect in the same file, and it was caught by a reviewer re-reading the

uncommitted tree rather than by any suite. See

knowledge-base/project/learnings/2026-09-08-every-field-my-alarm-trusted-came-from-the-region-it-did-not-trust.md.

Work Plan Execution Command

Execute a work plan efficiently while maintaining quality and finishing features.

Introduction

This command takes a work document (plan, specification, or todo file) and executes it systematically. The focus is on shipping complete features by understanding requirements quickly, following existing patterns, and maintaining quality throughout.

Headless Mode Detection

If $ARGUMENTS contains --headless, set HEADLESS_MODE=true. Strip --headless from $ARGUMENTS before processing the remainder as a plan path. Pipeline mode (file path detection) already covers all prompt bypasses for work's own prompts — --headless is only needed for forwarding to child skills in Phase 4.

Strip --max-<dim> N args for bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init (merge-safe).

Pipeline tally (#9403): bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" init here, at skill start — before Phase-0.5 check 9's specialist auto-invokes and every tier spawn; bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" gate agent_rounds <N> before each spawn batch (<N> = width), bash "${CLAUDE_PLUGIN_ROOT}/scripts/pipeline-tally.sh" incr agent_rounds <N> after, show at checkpoints. STOP → append status: budget-capped + budget-capped: agent_rounds=<n>/<cap> (from show) to knowledge-base/project/specs/<feature>/session-state.md and exit. WARN/UNKNOWN continue.

Input Document

<input_document> #$ARGUMENTS </input_document>

<decision_gate>

API budget. This skill executes a work plan iteratively across many phases. Tier A (Agent Teams) carries ~7x per-task token cost; Tier B (Subagent Fan-Out) is moderate; Tier C is single-agent. Total cost scales with plan length, chosen tier, and per-task RED/GREEN/REFACTOR cycles. Soleur does not bill or proxy these calls — Anthropic does, against the key in your session. The Soleur LICENSE (BSL 1.1) disclaims warranty for runtime cost; you operate this loop against your own budget.

The tier offer fires inline at the right phase. Decline if running an unfamiliar plan against a tight budget.

</decision_gate>

Execution Workflow

Phase 0: Load Knowledge Base Context (if exists)

Load project conventions:

# Load project conventions
if [[ -f "CLAUDE.md" ]]; then
  cat CLAUDE.md
fi

Clean up merged worktrees (silent, runs in background):

Navigate to the repository root, then run bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" cleanup-merged. Report cleanup results: how many worktrees were cleaned up, which branches remain active.

Check for knowledge-base directory and load context:

Check if knowledge-base/ directory exists. If it does:

  1. Run git branch --show-current to get the current branch name
  2. If the branch starts with feat-, read knowledge-base/project/specs/<branch-name>/tasks.md if it exists

If knowledge-base/ exists:

  1. Read CLAUDE.md if it exists - apply project conventions during implementation
  2. If # Project Constitution heading is NOT already in context, read knowledge-base/project/constitution.md - apply principles during implementation. Skip if already loaded (e.g., from a preceding soleur:plan).
  3. Detect feature from current branch (feat-<name> pattern)
  4. Read knowledge-base/project/specs/feat-<name>/tasks.md if it exists - use as work checklist alongside TodoWrite

4.5. Read lane: from spec.md if present. Guard file existence first:

```bash

spec_path="knowledge-base/project/specs/feat-${branch_name}/spec.md"

if [[ -f "$spec_path" ]]; then

LANE=$(awk '/^lane:/ { gsub(/^lane:[[:space:]]*"?|"?$/, ""); print; exit }' "$spec_path")

case "$LANE" in

single-domain|cross-domain|procedural) ;;

"") LANE="" ;; # legacy spec; silent skip in announce

*) echo "work: invalid lane value '$LANE' in spec; ignoring."; LANE="" ;;

esac

fi

```

Lane is non-binding in skill logic — work code does not branch on LANE. Operators MAY use the announced lane as a heuristic when picking work Tier 0/A/B/C in Phase 2; binding behavior is deferred per Non-Goal #2.

  1. Announce: `"Loaded constitution and tasks for feat-<name>" — append " (lane=<value>)" when LANE` is non-empty.

If knowledge-base/ does NOT exist:

Phase 0.5: Pre-Flight Checks

Run these checks before proceeding to Phase 1. A FAIL blocks execution with a remediation message. A WARN displays and continues. If all checks pass, proceed silently.

Environment checks:

  1. Run git branch --show-current. If the result is empty (detached HEAD), FAIL: "Detached HEAD state -- checkout a feature branch or create a worktree." If the result is the default branch (main or master), FAIL: "On default branch -- create a worktree before starting work. Run: bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" feature <name>"
  2. Run pwd. If the path does NOT contain .worktrees/, WARN: "Not in a worktree directory. You can create one via git-worktree skill in Phase 1."
  3. Run git status --short. If output is non-empty, WARN: "Uncommitted changes detected. Consider committing or stashing before starting new work."
  4. Probe for stashed changes WITHOUT invoking git stash (the hr-never-git-stash-in-worktrees hook denies even the read-only git stash list). Use git rev-parse --verify --quiet refs/stash — a zero exit means a stash exists; WARN: "Stashed changes found. Review stash list to avoid forgotten work." A non-zero exit means no stash; continue silently.

Scope checks:

  1. If a plan file path was provided as input (ends in .md or starts with a path-like pattern), verify it exists and is readable. If not, FAIL: "Plan file not found at the specified path." If the input appears to be a text description rather than a file path, WARN: "Input appears to be a description, not a file path."
  2. Run git diff --name-only HEAD...origin/main to identify files that diverged between this branch and main. If output is non-empty, WARN: "Branch has diverged from main in [N] files: [file list]." If the git command fails (e.g., offline, no remote), skip this check silently. For plans that edit AGENTS.\* (high-collision file class), plugins/soleur/skills/ship/SKILL.md (Phase 5.5 gates), OR any path under docs/legal/** / knowledge-base/legal/** (legal-doc cross-document gate; weekly compliance PRs collide on the same 4-file set), FAIL HARD instead of WARN — fetch + rebase BEFORE Phase 1 (git fetch origin main && git rebase origin/main); sibling PRs landing mid-session reliably obsolete plan-quoted budget baselines and trim-target line numbers. See knowledge-base/project/learnings/best-practices/2026-05-20-rebase-before-applying-agents-md-plan-edits.md and knowledge-base/project/learnings/2026-05-25-closed-field-list-must-classify-at-value-shape-not-column-name.md §Session Errors #5 (PR #4351 — caught at review time, not Phase 0.5).
  3. If a plan file was provided (check 5 passed), scan for a ## Domain Review or ## UX Review heading (both are accepted for backward compatibility). If NEITHER heading found: scan the plan content for UI file patterns (page.tsx, layout.tsx, template.tsx, .jsx, .vue, .svelte, .astro, +page.svelte, app/, pages/, components/, layouts/, routes/). If UI patterns found, WARN: "Plan references UI files but has no Domain Review section. Consider running soleur:plan to add domain review before implementing." If either heading IS present: pass silently.

6.5. Baselined-file lint drawdown. If any file in git diff --name-only origin/main...HEAD (or named in the plan's Files to Edit) appears in lint-shell-trace-credential-refusal.baseline.txt or lint-shell-trace-credential-refusal-d.baseline.txt, run lint-shell-trace-credential-refusal.py with --changed --base origin/main NOW and treat its count as scope: CI runs that exact --changed form, which bypasses both baselines for every touched file, so a one-line edit to a baselined script owes its whole debt in the same PR. Why: #8054 — the cutover orchestrator script (a baselined file) carried 25 pre-existing violations (no xtrace refusal; 24 unconfined credentialed curls) that surfaced only at the work phase's exit gate and had to be paid down unplanned. See knowledge-base/project/learnings/2026-09-11-the-gate-i-built-for-a-dark-host-was-blind-to-the-byte-shape-of-nothing.md §Session Errors 12.

6.6. New *.test.sh ⇒ run the fixture ratchets before its first commit. A new shell suite that writes under a

mktemp -d root from OUTSIDE the function that bound it adds rows to the P1b ratchet

(plugins/soleur/test/fixture-relative-assert.test.sh, row-by-row baseline) that the suite's own green run cannot

see; run it plus fixture-dir-operand-assert.test.sh and `python3 scripts/lint-shell-capture-exit.py --baseline

scripts/lint-shell-capture-exit.baseline.txt <file>` on the new file, and guard each writing window with the canonical

assert_fixture_dir rather than regenerating the baseline. Why: #8056/#8135 — each caught only by the full

battery. **The guard must be the canonical helper, copied

byte-for-byte — an inline case "$out" in /*) … esac is NOT recognised** (fixture-scan.py's _rel_guarded

docstring records the four ways an inline case was defeated and why it was dropped); and read the ratchet's rc from

rc=$? on its own line — echo "$(basename $t) RC=$?" prints basename's status and reported this ratchet green

while its log carried FAIL (#7968).

6.7. A new anti-vacuity floor ⇒ build to guard-vacuity-floor.test.sh's shape and run it first (see learning 2026-10-06-a-new-anti-vacuity-floor-joins-the-meta-guard…).

6.8. A shim/fixture script written from a new *.test.sh: quoted heredoc; name sibling scripts by BASENAME. fixture-scan.py reads $VAR inside a single-quoted printf on a redirect line (root=never-bound), and a full path literal makes test-affected-kb-consumers.test.sh hop into that script and charge your suite with its knowledge-base/ reads. See knowledge-base/project/learnings/2026-10-13-a-locale-pin-fix-needed-the-guard-around-the-prune-and-the-repos-own-ratchets.md.

Design artifact checks:

  1. Check if prior phases produced design artifacts. Search the repo for design files matching the feature name: git ls-files '*.pen' '*.fig' '*.sketch' | grep -i "<feature-name>" and check knowledge-base/product/design/ for related files. If design artifacts exist AND the current tasks include UI/page implementation (patterns: .njk, .html, .tsx, .jsx, .vue, .svelte, pages/, components/, layouts/): store the artifact paths as DESIGN_ARTIFACTS for use in Phase 2.

Specialist review checks:

  1. If a plan file was provided (check 5 passed) and a ## Domain Review section exists with a ### Product/UX Gate subsection: check whether domain leader assessments recommended specialists (soleur:marketing:copywriter, soleur:product:design:ux-design-lead, soleur:marketing:conversion-optimizer) that are NEITHER listed in **Agents invoked:** NOR in **Skipped specialists:**. If the **Decision:** field says reviewed (partial), WARN: "Domain review was partial — some specialist agents failed. Review the Domain Review section before proceeding." If any recommended specialist is missing from both fields: Interactive mode: FAIL with message listing the missing specialists and options: (a) "Run \<specialist\> now" — invoke the specialist agent directly, update the plan file's **Agents invoked:** field, then continue; (b) "Skip with justification" — prompt for reason, add to the plan file's **Skipped specialists:** field, then continue. Pipeline mode (headless/one-shot): auto-invoke each missing specialist agent. If the agent succeeds, add to **Agents invoked:**. If it fails, add to **Skipped specialists:** with note (auto-skipped — agent unavailable in pipeline) and WARN. Do not FAIL in pipeline mode. If all recommended specialists are accounted for (in **Agents invoked:** or **Skipped specialists:**): pass silently.

UX-skip-on-UI-plan hard gate (within check 9): Determine "UI plan" by matching the plan's ## Files to Create AND ## Files to Edit against the shared UI-surface term list + glob superset (plugins/soleur/skills/brainstorm/references/ui-surface-terms.md) — NOT just *.tsx/*.jsx. The superset includes *.njk, *.html, *.vue, *.svelte, *.astro, and email templates, so an Eleventy/Svelte/email UI surface does not slip the gate (wg-ui-feature-requires-pen-wireframe). On a UI plan, FAIL when EITHER: (a) soleur:product:design:ux-design-lead appears in **Skipped specialists:**, OR (b) the plan has no ### Product/UX Gate subsection at all (the gate was never run). Message: "Plan touches a UI surface but has no committed .pen (soleur:product:design:ux-design-lead skipped or gate never ran). Invoke the specialist or provide an explicit override naming the specific UI surfaces being shipped without review." This overrides the "all accounted for → pass silently" branch. A documented skip — or absent gate — on a UI plan is a process gap, not process compliance. See knowledge-base/project/learnings/workflow-patterns/2026-05-26-ux-design-review-skip-must-fail-hard-on-ui-plans.md.

UX artifact commit checkpoint (after each specialist in check 9): After each specialist agent completes successfully (interactive "Run specialist now" or pipeline auto-invoke), commit the output:

1. Run git status --short to discover new/modified files from the specialist

2. Stage specialist output files: git add <discovered files>

3. Commit: git commit -m "wip: <specialist-name> artifacts for <feature-name>"

Each specialist gets its own commit so partial progress is preserved if a later specialist fails. Do not commit on specialist failure.

On FAIL: Display the failure message with remediation steps and stop. Do not proceed to Phase 1.

On WARN only: Display all warnings together and proceed to Phase 1.

On all pass: Proceed silently to Phase 1.

Pipeline tally: show at each checkpoint (initialized at skill start — see Headless Mode Detection).

Phase 1: Quick Start

Pipeline detection: If $ARGUMENTS contains a file path (ends in .md or matches a path-like pattern), this skill is running in pipeline mode (invoked by one-shot or another orchestrator). In pipeline mode, skip all interactive approval gates and proceed directly. If $ARGUMENTS is empty or a plain text description, this is interactive mode — keep the approval gates below.

  1. Read Plan and Clarify
  1. Setup Environment

First, check the current branch by running git branch --show-current. Then determine the default branch by running git symbolic-ref refs/remotes/origin/HEAD and extracting the branch name. If that fails, check whether origin/main exists (fallback to master).

If already on a feature branch (not the default branch):

If on the default branch, you MUST create a worktree before proceeding. Never edit files on the default branch -- parallel agents cause silent merge conflicts, and this repo uses core.bare=true where git pull and git checkout are unavailable.

Create a worktree for the new feature:

```bash

SOLEUR_SKILL_NAME=work SOLEUR_EXPECTED_DURATION_MIN=240 \

bash "${CLAUDE_PLUGIN_ROOT}/skills/git-worktree/scripts/worktree-manager.sh" --yes create feature-branch-name

```

Then cd into the worktree path printed by the script. The worktree manager handles bare-repo detection, branch creation from latest origin/main, .env copying, and dependency installation. The env vars wire a session lease so sibling cleanup-merged invocations refuse to reap this worktree.

Phase Exit (release lease). At the end of the workflow — after soleur:ship returns OR if you exit without shipping — release the lease so a sibling cleanup-merged can reap the worktree once it's actually merged:

```bash

# Degrade open (#7409): releasing is advisory — an unreleased lease expires

# on its own window — so a missing library must not fail the pipeline here.

SS_LIB="${CLAUDE_PLUGIN_ROOT}/scripts/lib/session-state.sh"

if [[ -r "$SS_LIB" ]]; then

bash "$SS_LIB" release_lease "$(basename "$PWD")" || true

else

echo "SOLEUR_SESSION_STATE_UNAVAILABLE path=$SS_LIB reason=lease-not-released"

fi

```

The release is a no-op if the lease was already removed by the multi-signal trap (EXIT/INT/TERM/HUP fires on abnormal exit). Stale leases get swept after 24 hours regardless.

Use a meaningful name based on the work (e.g., feat-user-authentication, fix-email-validation).

  1. Create Todo List (TDD-First Structure)

Structure tasks as RED/GREEN/REFACTOR units, not as "implement everything, then test":

Anti-pattern to avoid: Creating a task list like [implement A, implement B, implement C, ..., write tests, lint]. This structure guarantees TDD violation because the agent executes tasks in order. The correct structure is [RED(unit): test A, GREEN: A, RED(integration): test B, GREEN: B, lint].

Post-creation validation (HARD GATE): After creating all tasks, scan the task list for any non-exempt implementation task (GREEN) that does NOT have a corresponding RED test task in its blockedBy list. If found, restructure the task list before proceeding. Do not start Phase 2 with an invalid task structure. Why: In PR #2428, the agent created flat tasks ("Fix X", "Write tests") and started implementation before tests — the user had to intervene and force a restructure. The anti-pattern instruction was not enough without a validation gate.

Phase 2: Execute

Output discipline (all tiers). Long execution phases blow the response-token ceiling and truncate mid-pipeline, losing the thread. Keep inline output bounded: when a command's output is large (full diffs, build logs, test dumps), write it to a file and reference the path rather than pasting it — never echo a diff over ~200 lines inline (d="$(mktemp -d -t soleur-run.$$.XXXXXXXX)/d"; git diff > "$d"; echo "DIFF=$d" then summarize, citing the path). After each task or logical unit, emit a one-line ## Work Phase <N> complete checkpoint marker so an interrupted run has a clear resume point. This bounds your narration of commands; hr-never-run-commands-with-unbounded-output bounds the commands.

  1. Execution Mode Selection (HARD GATE — must complete before executing ANY task)

Analyze independence first, select the tier, then begin — sequential-by-default because "the first tasks feel simple" forfeits the remaining tasks' parallelization savings.

Before starting the sequential task loop, check for parallelization opportunities:

Step 0: Tier 0 pre-check (Lifecycle Parallelism)

Read the plan. Apply a single judgment: "Does this plan have distinct code and test workstreams that can be assigned to separate agents with non-overlapping file scopes?"

Read plugins/soleur/skills/work/references/work-lifecycle-parallel.md now for the Tier 0 protocol; on execute go to Phase 3 after its Step 06, on decline fall through to Step 1.


Fanning out agents that run suites while the lead commits .ts/.js is self-contending by construction. lefthook's bun-test hook fires test-all.sh --affected on any staged .ts/.js — and a degraded selection (runner/index touched) promotes it to the full battery — and that run serializes on a repo-global flock — so the lead's commit QUEUES behind the fan-out's own suite runs and produces no output for as long as they take. Measured 2026-09-18: 13 minutes with an empty log, indistinguishable from a hang; the flock -w 3600 waiter SURVIVES killing the runner and holds lefthook open until it is killed by name. Commit .md-only batches during fan-out and hold .ts changes until the agents are done, or the queued battery measures a tree the agents are still mutating — a result that describes neither the before nor the after state. Also put "your final assistant message IS the deliverable; nothing you print to a tool log reaches me" in the SPAWN prompt, not only on resume — two agents in that session ended on a status line and each cost a SendMessage round-trip to recover work already done.

Standing constraint for EVERY tier — a spawned agent never runs the FULL gate.

Spawned agents run only the suites targeting the files they were given — mechanically,

test-all.sh --affected (the #8322 declared-edge gate); the compat spelling

TEST_GROUP=affected bash scripts/test-all.sh also survives as a deprecated

ALIAS of the same axis (#8621 — the #8591 heuristic selector was folded after

its decline set missed 49-355 suites per diff against the declared index).

Both are exempt from both refusal arms, so the spawn prompt needs no hand-derived

suite list. What a spawned agent must not run is a

full-gate-shaped invocation: test-all.sh --full,

apps/web-platform/infra/run-registered-suites.sh, or any other full-battery runner —

concurrent full-gate runs inflate each other's timings and corrupt the measurement. Measured

2026-08-11 — three agents running lints and suites at once turned an 860 s battery into 1675 s,

and that 1.9x figure was then nearly used as the suite's cost budget. The lead runs the gate

ONCE, after collecting fan-out work — step 9's bash "${CLAUDE_PLUGIN_ROOT}/scripts/gate-or-skip.sh"

(the same --affected run; rc table: affected-gate-contract.md),

previewed by bash scripts/test-all.sh --print-selection and reported with the selected N of M (an AFFECTED_GATE_SKIPPED line is not a pass). Two mechanical backstops exist, and neither depends on an

agent volunteering anything: a --full or degraded-full scripts/test-all.sh

exits 4 when it MEASURES a sibling full-gate run already in flight (#7553), and tc_acquire's

advisory lock (ADR-133) serialises whatever gets past that. **SOLEUR_SUBAGENT=1 is a convention

a lead MAY export before spawning — the harness does not set it** (measured 2026-08-19 from

inside two independent spawned agents: UNSET in both, and no repo-controlled spawn path exists

to set it); under it a full-shaped run exits 4, an affected run does not — so it remains agent

discretion for the non-concurrent case, written as an instruction, not a claim about the harness.

Step 1: Analyze independence

Read the TaskList. Identify tasks that have no blockedBy dependencies and reference

different files or modules (no obvious file overlap). Count the independent tasks.

If fewer than 3 independent tasks exist, skip to Tier C: Sequential below.

If 3+ independent tasks exist, proceed through the tiers in order (A, then B, then C).

Each tier either executes or falls through to the next.


Pipeline mode override: If running in pipeline mode (plan file argument detected in Phase 1), auto-select Tier 0 if eligible (Step 0 above). If Tier 0 is ineligible, skip Tier A entirely and auto-accept Tier B without prompting. Do not present "Run as Agent Team?" or "Run in parallel?" questions -- proceed directly to Step B2 of the Subagent Fan-Out protocol if 3+ independent tasks exist, otherwise fall through to Tier C.


Tier A: Agent Teams (highest capability, ~7x token cost)

Read plugins/soleur/skills/work/references/work-agent-teams.md now for the Agent Teams protocol; on decline or failure fall through to Tier B.


Tier B: Subagent Fan-Out (fire-and-gather, moderate cost)

Read plugins/soleur/skills/work/references/work-subagent-fanout.md now for the Subagent Fan-Out protocol; on decline or failure fall through to Tier C.

The or failed is load-bearing and was missing: Tier 0 and Tier A both read "If

declined or failed, fall through", so a spawn FAILURE has a defined next step.

Tier B said only "If declined" — leaving a spawn failure (agent tool withheld, `529

Overloaded`, headless run with no agent surface) undefined at the LAST tier that can

degrade. When it fires, say so: "Tier B fan-out unavailable (<reason>) — executing

sequentially" rather than silently running Tier C as though it were the chosen tier.


Tier C: Sequential (default)

Proceed to the task execution loop below.

  1. Task Execution Loop

Design Artifact Gate (before first UI task): If DESIGN_ARTIFACTS was set in Phase 0.5, spawn the soleur:product:design:ux-design-lead agent with the artifact paths for an implementation brief (its "Wireframe-to-Implementation Handoff" workflow) — the binding input for all UI tasks. Do not write markup before it arrives.

UX artifact commit checkpoint (after Design Artifact Gate): commit the brief and any generated design files (git add them, git commit -m "wip: UX implementation brief for <feature-name>") so it survives session crashes.

For each task in priority order:

```text

while (tasks remain):

```

No mid-plan pause gates (HARD GATE). A multi-phase plan

(tasks.md Phase 0 through Phase N) is a SINGLE execution unit.

Do NOT insert "Pause for review or continue?" prompts between

phases. Do NOT end a turn after one phase commits with "Continue

into Phase N+1 next turn?". The skill's Phase 4 handoff is the

only sanctioned stopping point — until then, chain straight

through every phase the plan defines, including phases the plan

labels "Pre-merge verification" or "Post-merge (operator)" if

they're automatable per the next gate. Why: the founder is a

solo operator; every "continue or pause?" is a context switch

that defeats the entire point of a multi-phase plan. Pipeline

mode (file-path arg in Phase 1) means pipeline mode for the WHOLE

plan, not per-phase.

Operator-step automation gate (HARD GATE). Before treating

any task in tasks.md as "operator-driven" (apply migration,

verify pg_cron, verify Storage bucket, run end-to-end smoke,

gh pr ready, gh pr merge --auto), check whether it is

automatable via a loaded MCP server or CLI:

existence + RLS spot-checks → mcp__plugin_supabase_supabase__*

**with Doppler DATABASE_URL_POOLER fallback when MCP is

unavailable** — see "Supabase fallback chain" below. When a

migration needs a SECURITY DEFINER RPC (e.g. to bypass an RLS /

column-grant restriction), start from

CODE0

— it encodes the search_path pin + 4-role REVOKE + auth.uid()

authorization pin that test/migration-rpc-grants.test.ts enforces.

If automatable, EXECUTE it inline as part of the work pipeline —

never list it back to the operator. The soleur:ship skill already

handles gh pr ready + auto-merge + migration verification (see

plugins/soleur/skills/ship/SKILL.md); chain to soleur:ship

at Phase 4 and let it run. For migration apply to dev (vs

verify), invoke mcp__plugin_supabase_supabase__apply_migration

inline at the phase where the migration lands, not as a

post-merge todo. Why: see ship/SKILL.md:1027 ("Every 'please

run this manually' is a context switch") and ship/SKILL.md:1177

(PR #1375 — migration verification was left as a manual

"post-merge todo" instead of being executed; deployed code

expected the new schema and broke). Same class as the

Playwright-first audit in Phase 4: if a tool exists, use it.

Supabase fallback chain (when MCP OAuth fails). The Supabase

MCP OAuth flow at https://api.supabase.com/v1/oauth/authorize

intermittently rejects valid URLs at the dashboard auth_id

handoff (cause: external — Supabase-side). When that happens, do

NOT fall back to "paste this SQL into the dashboard SQL editor"

handoff — that's a manual-step rationalisation that violates

hr-never-label-any-step-as-manual-without. Instead walk down the

hr-exhaust-all-automated-options-before priority chain:

(1) Doppler DATABASE_URL_POOLER — already provisioned for every

env; the migration apply path. (2) Verify the project ref in the

URL matches the plan's stated dev/prd refs — Doppler is the

source of truth (plan-quoted project refs are preconditions to

verify, never facts; the plan can drift). (3) Rewrite the URL's

port :6543 → :5432 so the pooler runs in session mode (multi-

statement DDL works; transaction mode rejects with SQLSTATE 42601

"cannot insert multiple commands into a prepared statement").

(4) Apply via pg (node-pg, bun-installed in /tmp if missing)

wrapped in BEGIN; <migration>; COMMIT;. The direct DB host

db.<ref>.supabase.co:5432 is IPv6-only and typically

unreachable from operator/CI networks; the pooler is IPv4.

(5) Post-apply, verify schema via the same connection — RLS

enabled, policy_count, trigger names, RPC signatures + SECURITY

DEFINER flag, UNIQUE constraints. Write the verification artifact

to knowledge-base/project/specs/feat-<name>/migration-checklist.md.

Why: PR #3853 / #3205 — Supabase MCP OAuth was rejecting URLs

at the auth_id handoff; the agent first proposed "paste SQL into

dashboard" (manual-step violation), then pivoted to Playwright-

first audit on dashboard navigation (correct), then discovered

Doppler had the working DATABASE_URL_POOLER and applied via

pg directly — the path it should have taken at step 1.

Session stickiness: once the MCP OAuth handoff has failed even

once in the current session, treat Doppler DATABASE_URL_POOLER as

the default for ALL subsequent Supabase operations this session — do

not re-attempt the OAuth flow per-operation. Re-probing a known-flaky

external auth each time is the wasted-cycle trap; the fallback is not

slower once you are already authenticated to Doppler.

Pre-apply collision check (always, even on first attempt).

Before invoking pg apply (or supabase migration up) against any

shared env, run `git fetch origin main && git ls-tree origin/main

-- apps/web-platform/supabase/migrations/ | awk '{print $4}' |

grep -oE '^[0-9]{3}_[^.]+' | sort -u`. For each LOCAL migration

file the branch introduces, assert no DIFFERENT filename with the

same 3-digit prefix exists in that list. A collision means a

sibling PR is landing the same number window; renumber FIRST,

then apply under the final filename. Why: PR #4225 — applied

053–057 in the morning; PR #4251 landed `054_schema_migrations_

content_sha.sql` 10 hours later and main's CI drift probe flagged

the entire branch; the recovery (renumber 054→058, 055→059, 056→060,

057→061 + reconcile public._schema_migrations on both dev + prd

via git hash-object content_sha) took ~30 min and could have been

zero-cost if the operator had grepped origin/main first.

The collision window extends through soleur:ship, not just work-time. This

check at work-start is necessary but NOT sufficient: a sibling migration can

land on main DURING the (often 30–90 min) ship phase — especially under a

fast-moving-main burst where soleur:ship Phase 7 performs repeated `git merge

origin/main auto-syncs on OPEN BEHIND`. Each sync that pulls in a sibling

supabase/migrations/NNN_*.sql sharing your prefix is a silent collision the

BEHIND loop pushes straight to CI (where the migration drift/shape gate fails,

~16 min later). After ANY ship-time sync whose merge output lists

supabase/migrations/, re-run the prefix check above and renumber-during-ship

(git mv both up/down + update every in-repo reference: migration headers,

code comments, plan/tasks/learning) BEFORE the next push. Why: PR #5760 —

114_disk_io_top_wal_statements (a #5739-sibling) landed mid-ship; my

114_prune_cron_job_run_details collided and surfaced only at CI after ~6

auto-syncs; recovery was a renumber to 115. See

knowledge-base/project/learnings/workflow-patterns/2026-06-30-migration-number-collision-mid-pipeline.md.

The collision set includes the shared DEV DATABASE, not just origin/main. The

check above greps origin/main, and a sibling branch's migration is invisible there

until it merges — but it is fully visible in dev's _schema_migrations, because the

sibling session APPLIED it. Query all three sources and take the union: origin/main,

every worktree's supabase/migrations/, and

SELECT filename FROM public._schema_migrations ORDER BY filename DESC LIMIT 5 over

Doppler DATABASE_URL_POOLER. Why: #7829 — 136 was free on origin/main and

already applied to dev by a sibling; the collision surfaced only when a live probe for

an unrelated question happened to list the applied set, after the number had been

written into a function body (which Postgres stores in prosrc), an Article 30

register cell, and 38 prose sites.

Tracking row in the SAME transaction as the migration body.

The project's canonical apps/web-platform/scripts/run-migrations.sh

writes `INSERT INTO public._schema_migrations (filename, content_sha)

VALUES ('<basename>', '<git-hash-object>')` in the same transaction

as the migration SQL. The Doppler+pg fallback MUST mirror this —

bare BEGIN; <migration>; COMMIT; produces a phantom-applied state

where the schema reflects the migration but _schema_migrations

does not, and the next deploy attempts re-apply (failing on

non-idempotent statements like CREATE TRIGGER). The reconciliation

pattern (UPSERT with `ON CONFLICT (filename) DO UPDATE SET

content_sha = EXCLUDED.content_sha`) is the recovery shape — but

doing it inline is cheaper.

**PostgREST schema cache reload via session-mode pooler does NOT

work.** NOTIFY pgrst, 'reload schema' over a :5432 pooler

connection does not reach PostgREST's LISTEN (PgBouncer

multiplexes; LISTEN/NOTIFY channel scope is bound to backend

process identity, not session). 90 attempts over 5 minutes

returned PGRST205. After a direct-pg apply: either wait for the

natural ~10-min schema poll cycle, OR use the Supabase Management

API to restart PostgREST. The direct DB host

(db.<ref>.supabase.co:5432) is IPv6-only and typically

unreachable from operator networks, so the canonical "NOTIFY via

direct connection" workaround documented upstream isn't available.

**Storage-bucket migrations: down.sql cannot DELETE storage tables;

column-takeover proof is permissive-vs-restrictive, not name-count.**

Supabase installs a platform BEFORE DELETE trigger (protect_objects_delete

→ storage.protect_delete()) that blocks direct DELETE FROM storage.objects

AND storage.buckets ("Direct deletion from storage tables is not allowed").

So a bucket migration's down.sql reverts only SQL-droppable objects

(policies → function → column) — NOT the bucket/objects (Storage-API/operator

teardown; 019/042 precedent ship none; 071's DELETE FROM storage.buckets is

a dormant bug). Runtime cleanup uses service.storage.from(b).remove([...])

(allowed). And when verifying "no client can write column X" (read-proxy

trust), assert no PERMISSIVE INSERT/UPDATE/DELETE/ALL policy (a

RESTRICTIVE FOR ALL like workspaces_jti_not_denied only denies, never

grants) + a behavioral authenticated UPDATE affecting 0 rows. The

pooler also presents a self-signed CA chain → transient node-pg verify

scripts use ssl:{rejectUnauthorized:false} (dev-only, mirrors

run-migrations.sh sslmode=require; no committed code disables TLS verify).

See knowledge-base/project/learnings/2026-06-04-supabase-bucket-migration-down-and-rls-takeover-proof.md (#4916).

TDD Gate (HARD GATE): Before writing ANY implementation code for a task, determine if the task has testable behavior:

Emit rule-application telemetry (records that the TDD gate was reached — see AGENTS.md cq-write-failing-tests-before):

```bash

echo 'SOLEUR_RULE_APPLIED rule=cq-write-failing-tests-before note=Write failing tests BEFORE implementation code whe'

```

1. Check: Does the plan have a "Test Scenarios" or "Acceptance Criteria" section that covers this task? If yes, this task requires test-first.

2. Exempt: Infrastructure-only tasks (config files, CI workflows, scaffolding directories, dependency installs) are exempt. If the task only creates/modifies config, it skips to Infrastructure Validation below.

3. Enforce: For non-exempt tasks, write the failing test file FIRST. The test must:

4. Verify RED: Run the test. It must fail (missing module, assertion failure, etc.). If it passes, the test is not testing new behavior — rewrite it. For gating/sequencing primitives (semaphores, locks, queues, ordering guarantees), the test must distinguish gate-absent from gate-present: add an intermediate-state assertion that would fail without the primitive (e.g., count === 2 while two slots are held) in addition to the final-state assertion. A test that passes identically with and without the primitive isn't testing the primitive. See knowledge-base/project/learnings/test-failures/2026-04-18-red-verification-must-distinguish-gated-from-ungated.md. Test-environment fidelity: if the SUT's buggy code lives behind a guard (if [[ -d "$X" ]], if (cache.has(key)), etc.), the harness MUST seed the precondition the guard requires — otherwise both buggy and fixed paths short-circuit identically and any negative-space assertion passes vacuously. See knowledge-base/project/learnings/test-failures/2026-04-22-red-test-must-simulate-suts-preconditions.md. Early-exit shadowing: if the SUT has a guarded fast path (substring strip like replaceAll(arg, ""), cache-hit, env-flag short-circuit) that handles a superset of inputs the slow path under test handles, RED inputs MUST choose identities ONLY the slow path can produce. Sharing a fixture across the fast/slow boundary lets the fast path scrub first and the regex/branch under test never fires — the assertion passes without testing the fix. Add an invariant guard test asserting the fast/slow fixtures do not collide. See knowledge-base/project/learnings/2026-05-04-vacuous-red-via-shared-fixture-and-toolchain-pinning.md. In-component state machines (RTL): when the gate-under-test is component-local state (useState/useRef/useReducer), drive the SUT through state transitions with result.rerender(<C />) — never unmount() + fresh render(). Remount resets the in-component bookkeeping that IS the gate, producing vacuous green. See knowledge-base/project/learnings/test-failures/2026-05-11-rerender-not-remount-for-in-component-state-machine-tests.md. Laundered-target resolvability (normalizer/strip/prefix-mangle security fixes): a regression guard for an anchored-strip / path-canonicalization / allowlist-key fix is vacuous unless the fixture makes the LAUNDERED (mis-normalized) target resolvable to an observable effect — if the downstream gate rejects it for an unrelated reason (nonexistent skill/row/file), the test passes identically with and without the fix. Litmus: under the buggy impl, does this input produce a DIFFERENT output than under the correct one? See knowledge-base/project/learnings/test-failures/2026-07-05-security-fix-regression-guard-must-make-the-laundered-target-resolvable.md. Fixture-space cardinality (ask this per contract sentence, and note that your own passing mutation battery cannot answer it): for each property the test claims, name the SET it quantifies over and count how many distinct members the FIXTURE instantiates — one member is a sample, not a proof, and code-mutation coverage does not detect a fixture-space gap. Three shapes recur: (a) a temporal contract (a wait/retry/debounce/convergence) sampled only by STATIC fixtures probes t=0 and t=∞ but never the transition — the case the guard exists for — so deleting the loop's break stays green; drive it with a stateful stub that changes on the Nth invocation and assert the success arm was reached VIA the loop; (b) a bidirectional guard (-w, an ordering, a comparison) must be fixtured in the direction where the weaker implementation gives a FALSE POSITIVE, not the direction that fails either way; (c) a stub that ignores argv, or a sleep/clock stubbed to a no-op, silently voids the call-shape and budget contracts — validate "$*" in the stub and COUNT the stubbed calls against the design's bound. Why: #6441 — a 7-mutation battery reported 7/7 RED while nine unimagined mutations (loop-break deleted, grep -qwF→-qF, addr show→link show, bound 30→1, sleep 2→600) all survived. See knowledge-base/project/learnings/2026-07-19-my-own-mutation-battery-was-the-false-confidence.md. A SURVIVING mutant is a result, and it has exactly two readings — label which: either the fixtures do not exercise the property (fix the FIXTURES, not the guard) or the mutant is EQUIVALENT (prove no verdict changes, and record that it survives). Leaving it unlabelled is how a guard that is merely adjacent to a working one ships. Measured: two anchoring fixes survived their own mutations because an earlier action= split already caught every fixtured row, and both were reachable in production once the fixture used a field whose sanitiser PERMITS the colliding literal; a third survived and was correctly left alone as equivalent. Why: #7220 — see knowledge-base/project/learnings/2026-08-05-my-anchoring-fix-survived-its-own-mutation-and-three-gates-were-green-elsewhere.md. A DISJUNCTION needs one fixture per disjunct, ALONE — and when the operands come from @tsv, check the parse before the logic. A fixture that satisfies every arm of an || at once proves the set is non-empty and nothing else: dropping either arm keeps the suite green, so a load-bearing signal and a dead one are indistinguishable. The sharpest instance is not a missing fixture but a PARSE bug the all-arms fixture hides: tab is IFS-whitespace, so while IFS=$'\t' read -r a b c COLLAPSES runs of tabs and drops empty middle fields, and @tsv emits an empty field for an absent key — so digest<TAB><TAB>unknown parses as b="unknown", c="", shifting every later field one position left. The arm reading c is then unreachable in exactly the case where it is the only signal. Sentinel every optional @tsv field ((.x // "-")) so no field is ever empty, and fixture each disjunct in isolation. Why: #7378/PR #7379 — the guard written to stop crane validate gunzipping an in-toto attestation layer sent that layer to crane validate whenever the annotation was absent, while emitting a message asserting that was impossible; five further guards in the same PR (a > 0 count that could not see partial enumeration, an untested ref_repo, two verify_die arms with no failing fixture, and the whole new block behind no assertion floor) were vacuous the same way. See knowledge-base/project/learnings/2026-08-10-the-guard-i-wrote-to-close-7378-reopened-it-one-field-to-the-left.md. A numeric predicate that is a LOWER BOUND ONLY cannot distinguish a measurement from a CONSTANT — bound it on both sides, against a value the artifact itself reports. value >= N over any measured quantity (an elapsed, a count, a byte size, a row total) passes identically against a hardcoded literal, so a suite of them tests that something happened and never that the something is a function of its inputs. Litmus per assertion: name a constant that satisfies it — if you can, it is a shape check wearing a measurement's clothes. Prefer a ceiling derived from the output itself (the banner prints its own budget; the report prints its own input size) over a second magic number, and place the two bounds so no single value can satisfy both arms at once. Why: #7484 — a PR whose entire thesis was "report the measured wait instead of asserting one" had all three elapsed predicates as one-sided floors and the discriminating premise ("a free lock reads single-digit ms") sitting in a PROSE COMMENT; printf '%sms' 1500 passed 95/0, and dropping the /1000 printed a claimed 33-minute wait against a 2-second budget, also green. Its 7-row mutation battery could not see either: every row perturbed the SUT toward small or absent, so a plausible constant was outside the axis it edited. See knowledge-base/project/learnings/2026-08-13-a-lower-bound-cannot-tell-a-measurement-from-a-constant.md. A row that pins a SPELLING is vacuous until its fixture makes the other spelling disagree — and a verdict that rides on a pipeline's EXIT STATUS is decided by a shell option you do not set. Two halves of one question: what does this check read, and who controls it? (a) A row written to justify a precise form (refs/remotes/origin/main over origin/main, .. over ..., a fetch over a reachability ping) passes trivially when the fixture's state makes both forms return the same answer — construct the state where they DIFFER and confirm the row reds under the other form, because a row passing for the wrong reason is indistinguishable from one passing for the right one. (b) { …arms… } | grep -q . && A || B reports the LAST arm's status and takes SIGPIPE on a successful match, so under an operator-profile set -o pipefail it answers B on a real hit — capture the output and test the string ([ -n "$( … )" ]). A harness that deletes SHELLOPTS/BASHOPTS for hermeticity is correct AND blind to this, so add a row that drives set -euo pipefail explicitly. Why: #8470/PR #8567 — the branch-scoped ship probe shipped both, green through a 14-row battery whose every fixture put origin/main at the branch point; .claude/hooks/grep-q-pipe-guard.test.sh had banned the pipeline shape for hooks and the ban had not travelled to skills. See knowledge-base/project/learnings/2026-09-23-my-verdict-rode-on-a-pipeline-status-and-my-test-deleted-the-option-that-inverts-it.md.

5. Only then: Write the minimum implementation to make the test pass (GREEN).

6. Refactor: Improve code while keeping tests green.

Skipping this gate — writing implementation before tests — is a workflow violation equivalent to committing directly to main. The rationalization "this is simple enough to not need test-first" is exactly the reasoning TDD is designed to prevent.

Test environment setup: If the project's test runner cannot run the type of test needed (e.g., React component tests require jsdom but vitest is configured for node), set up the test environment BEFORE starting the task. This is part of RED — the test infrastructure must exist for the test to fail properly.

IMPORTANT: Always update the original plan document by checking off completed items. Use the Edit tool to change - [ ] to - [x] for each task you finish. This keeps the plan as a living document showing progress and ensures no checkboxes are left unchecked.

  1. Incremental Commits

After completing each task, evaluate whether to create an incremental commit:

| Commit when... | Don't commit when... |

|----------------|---------------------|

| Logical unit complete (model, service, component) | Small part of a larger unit |

| Tests pass + meaningful progress | Tests failing |

| About to switch contexts (backend → frontend) | Purely scaffolding with no behavior |

| About to attempt risky/uncertain changes | Would need a "WIP" commit message (exception: UX artifacts use wip: prefix) |

| UX specialist produces artifacts (wireframes, copy, brief) | Specialist is still generating (mid-output) |

| Domain leader review cycle completes (feedback applied) | Review feedback not yet incorporated |

| Brand guide alignment pass completes | Alignment still in progress |

Heuristic: "Can I write a commit message that describes a complete, valuable change? If yes, commit. If the message would be 'WIP' or 'partial X', wait."

previous green — which is byte-identical to the green of a batch that landed.** The failure is

silent in the direction that reads as success: the interpreter exits before writing any file,

the tree is unchanged, and the next test run confirms the tree you did not modify. Measured

twice in one session (#7960): a Python heredoc with a trailing \" before """ raised

SyntaxError, and the suite reported 37/37 PASS exactly as it had before — the only tell was

an assertion count that did not move. After ANY scripted multi-edit, assert the ARTIFACT

changed (grep the new anchor, or diff against a pre-edit copy); never infer that an edit

landed from a passing suite, which answers "does the tree pass", never "did my edit apply".

tree is untouched and the NEXT measurement returns the baseline — which is the reassuring

answer.** The guard is correct and its failure mode is the same shape it guards against, one

level up: a drifted anchor or a literal retyped rather than copied aborts the heredoc, nothing

is written, and any mutation row, lint or suite run afterwards measures the UNCHANGED artifact

and reports exactly what a working fix would report. Measured: four mutation rows scored an

unmutated rule this way, all four returning the verdict that said "fine". Print the changed

line back (print([l for l in open(p) if l.startswith("X=")][0])) rather than trusting the

batch's own success message, and treat any post-edit result identical to the pre-edit baseline

as UN-RUN rather than as evidence. Cheapest structural form: git status --short <file> — a

file absent from that listing did not change, whatever the script printed.

removes cat, sed and every other external the fallback itself needs, so the fallback under

test could not have run either and the empty output proves nothing about it. Put a stub that

exit 127s on a scratch dir at the FRONT of the real PATH. Why: #6488 — a column-absence

proof "passed" against a condition that had disabled the remedy along with the tool.

UX artifact heuristic: "Did a specialist just produce or revise artifacts? If yes, commit with wip: UX <description> for feat-X. UX artifacts are high-effort and low-recoverability -- err on the side of committing too often rather than too rarely."

The wip: prefix is intentional -- UX artifacts are valuable at every revision stage, and WIP commits are squashed on merge with no impact on final git history. Do not run compound before UX WIP commits -- compound runs once in Phase 4.

Compound-before-commit scope: AGENTS.md Workflow Gates says "Before every commit, run compound." Within this skill, that rule applies to the final Phase 4 commit (the one that closes the feature), not to Phase 2 incremental commits. Running compound per incremental commit is recursive (compound creates commits) and defeats the point of incremental checkpoints. A single compound at Phase 4 covers the whole feature's session-error inventory and learnings.

Commit workflow:

```bash

# 1. Verify tests pass (use project's test command)

# Examples: bin/rails test, npm test, pytest, go test, etc.

# 2. Stage only files related to this logical unit (not git add .)

git add <files related to this logical unit>

# 2b. Commit-on-main backstop (Soleur Cloud Mode, FR5): PreToolUse hooks do

# not fire in cloud sessions, so the hook's block-commit-on-main arm is

# absent there. Run the canonical check directly — a no-op locally where the

# hook already guards, load-bearing in cloud.

#

# Resolve the plugin ROOT by IDENTITY and name the script relative to it,

# never by the script's own basename (#8402): a basename search accepts any

# directory under the cache holding a file with that name and then EXECUTES

# it. The identity preflight is a shape check, not authentication — a planted

# {"name":"soleur"} manifest passes it (ADR-179 A11).

GUARD="${CLAUDE_PLUGIN_ROOT}/scripts/precommit-guard.sh"

# Arm 2, mirroring go.md's arm order. Grok Build addresses the plugin by GROK_PLUGIN_ROOT

# (lib/agent-registry.ts), and omitting it made this ladder fall through to exit 1 on a

# Grok box with a perfectly good plugin root — turning a fail-open into a hard stop for the

# one harness that cannot satisfy arm 1.

[ -f "$GUARD" ] || GUARD="${GROK_PLUGIN_ROOT:-}/scripts/precommit-guard.sh"

if [ ! -f "$GUARD" ]; then

GUARD=""

for d in "$HOME/.local/share/devin/cli/plugins/cache" "${SOLEUR_DEVIN_CACHE_OPT:-/opt/.devin/plugins}"; do

[ -d "$d" ] || continue

MANIFEST="$(find "$d" -path '*/.claude-plugin/plugin.json' \

-exec grep -l '"name"[[:space:]]:[[:space:]]"soleur"' {} + 2>/dev/null | head -1)"

[ -n "$MANIFEST" ] || continue

GUARD="${MANIFEST%/.claude-plugin/plugin.json}/scripts/precommit-guard.sh"

[ -f "$GUARD" ] && break

GUARD=""

done

fi

# BOTH arms must block, and before #8402 NEITHER did. The old form was

# [ -n "$GUARD" ] && bash "$GUARD" … followed by an UNCONDITIONAL

# git commit — no &&, no || exit, no if — so an unresolved guard fell

# through to the commit, AND a guard that resolved and REFUSED fell through to

# the same commit. In a cloud session this is the only commit-on-main

# protection that exists, which made it the opposite of a backstop.

#

# stdout, not stderr: stderr is invisible under claude --bg, and a backstop

# that cannot resolve itself must say so where the operator will see it.

if [ -z "$GUARD" ]; then

# The block's own justification is "hooks do not fire in cloud". LOCALLY the PreToolUse

# hook is present and already blocks a commit to main, so a hard stop there would block a

# commit that previously succeeded without buying any protection. Refuse in cloud, warn

# locally — and say which, so the operator is not left guessing.

echo "SOLEUR_PRECOMMIT_GUARD_HALT reason=no-soleur-root-in-plugin-cache"

case "${SOLEUR_SESSION_CLASS:-unknown}" in

not-local*) exit 1 ;;

*) echo "[warn] proceeding: the PreToolUse hook guards commits on a local session" ;;

esac

else

# else, not a fall-through. The first draft ran this line unconditionally after the

# warn above, so on a LOCAL session with no resolvable guard it printed "proceeding" and

# then executed bash "" — No such file or directory, || exit 1 — and the commit was

# never reached. The comment said warn-and-proceed; the code halted. Found by DRY-RUNNING

# the block in both session classes rather than reading it (qa/SKILL.md, #8288 class).

bash "$GUARD" "git commit -m \"feat(scope): description of this unit\"" || exit 1

fi

# 3. Commit with conventional message. Reachable through a guard that resolved AND

# passed, or — locally only, where the PreToolUse hook is the real gate — through the

# warned no-guard arm. In cloud the no-guard arm exits above and never gets here.

git commit -m "feat(scope): description of this unit"

```

Handling merge conflicts: If conflicts arise during rebasing or merging, resolve them immediately. Incremental commits make conflict resolution easier since each commit is small and focused.

Note: Incremental commits use clean conventional messages without attribution footers. The final Phase 4 commit/PR includes the full attribution.

  1. Follow Existing Patterns
  1. Test Continuously

of the narrowing, and when a query returns zero, re-run it UNNARROWED and diff the counts.**

The instrument-verification rule above says run a known-positive; this is the half that

decides whether the known-positive can see anything. A control built by copying the failing

command and changing only its subject inherits every flag the command carries, so it proves

the transport works and is structurally blind to a filter biased against the one class under

test — and it reads as diligence in the write-up, which is why nobody re-checks it. Ask per

control: *which narrowing does this share with the assertion, and what would it return if that

narrowing were the bug?* Why: #8017 — betterstack-query.sh implements --raw-only as

raw NOT LIKE '%SYSLOG_IDENTIFIER%', excluding EVERY journald row by construction; a probe

query carrying it returned 0 rows over 36h and 57 without it, and the conclusion drawn from

that zero ("this host does not deliver via its logger line") was written into a plan, a spec

and a commit message. Both positive controls run to "verify the instrument" carried the same

flag. See knowledge-base/project/learnings/2026-09-10-every-instrument-i-verified-was-verified-inside-its-own-blind-spot.md.

  1. Infrastructure Validation

When any task modifies files in apps/*/infra/, run these checks after each change (in addition to or instead of the app test suite):

Renaming a Terraform resource's ADDRESS is a destroy + create, and RequiresReplace does not license it. Before concluding a rename is "update-only", check which of the two you actually reasoned about: a plan-modifier governs a resource at a FIXED address, while an address leaving the configuration is a delete at the old name plus a create at the new one, whatever the provider schema says. Add a moved {} block (precedent: dns.tf, placement-group.tf) and VERIFY by feeding the plan through the repo's own destroy-guard filter rather than re-asserting the claim — measured resource_deletes: 1, resource_creates: 1 without the block, 0/0 with it. The cost of getting it wrong is more than a blocked gate: on a full-root auto-applied root the delete lands before the create, so an acked plan discards the live resource's history and opens a coverage window with no rollback. Why: #7798 — the plan reasoned from name being an in-place attribute; four review agents converged and sentry-destroy-required would have blocked the PR on the monitor the change existed to repair. See knowledge-base/project/learnings/2026-09-07-my-guard-pinned-the-three-attributes-the-vendor-already-refuses.md.

1. cloud-init schema: For each modified cloud-init.yml:

cloud-init schema -c <file> -- validates YAML syntax AND cloud-init schema in one step. Warnings about missing datasource are expected; only non-zero exit codes are failures. If cloud-init is not installed locally, warn and continue.

2. Terraform format: For each infra directory with modified .tf files:

terraform fmt -check <dir> -- exit 0 means formatted; exit 3 means violations. Fix with terraform fmt <dir>.

3. Terraform validate: For each infra directory with modified .tf files:

terraform init -backend=false then terraform validate -- catches HCL syntax errors and undefined references without requiring provider credentials.

4. Field-type verification for version-pinned providers: when writing HCL for a provider pinned below the registry's latest major (e.g., cloudflare ~> 4.0), verify field TYPES via terraform providers schema -json from a SCRATCH dir pinned to the exact version (minimal required_providers main.tf + terraform init) -- validate silently coerces wrong primitives (v4 cloudflare_list redirect items take "enabled"/"disabled" STRING enums, not booleans; registry/context7 docs show the latest major's syntax). The scratch dir matters: providers schema inside the real infra dir demands full backend init. Why: PR #5082 -- drafted booleans validated green and would have failed only at apply, behind a BLOCKING token-widen step that would have masked the diagnosis. See knowledge-base/project/learnings/2026-06-09-cloudflare-bulk-redirects-v4-schema-and-phase-order.md.

These checks replace the "tests may be skipped" exemption for infra files. If any check fails, fix before proceeding to the next task.

  1. Track Progress

Three verification habits, each measured as a miss on #8323, and each costing a review round. (a) Diff per-case verdicts, never totals. An assertion-count floor tells you a count MOVED, never which member left: a scenario-17 rewrite sliced to the scenario-18 anchor and silently took scenario 19 with it, the floor caught the drop, and it was recalibrated without checking what had gone — the deleted row was the only one covering a rule operand, and its absence was found by a CTO consult, not by any gate. (b) Run the suite in the environment it SHIPS into before review, not as an intention. CI checks out a DETACHED HEAD on pull_request, where git rev-parse --abbrev-ref HEAD returns the literal HEAD; an assertion pinning the branch name was 109/1 there and green locally. Sweep CI=1, SOLEUR_SUBAGENT=1, and a detached worktree, and treat a PASS-COUNT delta as a finding. (c) When a mutant survives on an OPERAND, try deleting the operand before writing the killing test. A surviving mutant has two causes — weak tests, or an operand with no behavioural justification — and writing the test promotes an accidental behaviour to a specified one. On #8323 the killing test pinned a manual compaction REVOKING an already-earned recommendation; the operand was ruled out entirely and the scenario restored inverted. See knowledge-base/project/learnings/2026-09-18-every-defect-was-in-my-verification-not-the-feature.md.

  1. GDPR / Compliance Gate (single pass, end of Phase 2)

[skill-enforced: gdpr-gate at work Phase 2 exit]

After the per-task RED/GREEN/REFACTOR loop completes and before Phase 2.5, run soleur:gdpr-gate once against the cumulative diff git diff origin/main...HEAD (after git fetch origin main — the local main ref lags in bare-repo worktrees and pollutes the diff with unrelated merged branches). Same advisory-only output and Critical-finding escalation as plan Phase 2.7. Never per-task — token budget is ≤4k per invocation, single pass per phase per ADR-026 TR3.

Skip silently if the cumulative diff does not match the hr-gdpr-gate-on-regulated-data-surfaces canonical regex.

Before claiming a battery proves anything — "mutation-proven", "N/N caught", "no surviving mutants" — count AXES, not rows. A battery's value is the number of DISTINCT things it perturbs; N mutations of one shape is one mutation, and the axes an author omits are the ones they were not thinking about. The axes below are the consolidated union; review/SKILL.md carries the evidence for each, distributed across its defect-class and sharp-edge bullets rather than in one catalogue section, so treat this list as the index and that file as the case law:

variable the assertion helpers increment is dispatched THROUGH the thing it guards, so a helper

that always takes the pass branch keeps the count intact and the floor never looks. Ask per gate:

which helper does my evidence flow through, and does that helper appear in any mutation row?

Measured (#7275): want(){ ok "$1 → $3"; } — drop one comparison — produced a byte-identical

95/95 pass, exit 0, with six of ten battery rows silently surviving; the floor could not see it

because it counted TOTAL, and the battery's harness row neutered bad(), the one edit leaving

ok() and TOTAL intact. The remedy is a helper self-test driving both branches and reporting

with printf + exit, never through the helpers it guards. Treat floor slack as attack budget:

that floor sat at 60 against 95 assertions, so all 24 new ones could be undispatched.

SUT and confirm the guard REDS. This one mutates the GUARD and confirms it does not silently

WIDEN. Degenerate an operand the predicate interpolates — empty a variable inside a glob, a

regex, or a path prefix — and check whether the guard now accepts everything. Measured: a

containment check written as case "$top" in "$ROOT"|"$ROOT"/*) return 0 ;; esac degrades to

/* when $ROOT is empty, so it returned 0 for a LIVE repository — and the suite carrying it

still reported 40 passed, 0 failed, because **a guard that accepts everything is

indistinguishable from a healthy run**. Ask of every guard "how does this fail OPEN", then

assert the POST-CONDITION its predicate depends on (case "$ROOT" in /*) : ;; *) exit 2 ;; esac)

rather than trusting the producer, and readonly it so a later assignment cannot reintroduce

the degenerate case. Why: #7553 — it passed review and shipped in three commits; caught by

a sibling session reviewing its own copy. See

knowledge-base/project/learnings/2026-08-20-every-guard-was-present-read-as-protective-and-did-not-hold.md.

State plainly which axes your battery did NOT edit. Two mechanical companions: run the UNMUTATED control first (a red baseline voids every row), and assert each mutation LANDED against a pristine backup, because a mutation that does not land reports the BASELINE and that is indistinguishable from a pass. Why: PR #7470 (issue #7352) — a battery reported 6/6 RED and "no surviving mutants"; it had two axes, and the retraction ran a 13-mutation Round 2 across axes it never touched. Recorded in knowledge-base/project/learnings/2026-08-12-my-ladder-rung-ended-in-a-label-so-it-fell-through-to-the-unsafe-branch.md.

An anti-vacuity floor must append to whatever the VERDICT reads, or its non-zero exit is an accident and its message is a false accusation. A suite whose verdict is exit $(( ${#FAILURES[@]} > 0 )) and whose floor only bumps a fails counter does not fail because the floor fired — it fails because the ledger-vs-counter reconciliation trips, and it then prints fail() was tampered with, which is untrue and misdirects whoever hits it. Worse, the obvious repair for that false message (relaxing the reconciliation from -ne to -gt) silently disarms the floor: measured, a suite then reported 102 assertions, 1 failed, and exit 0. Ask of every floor: does it write to the same place the verdict reads? Why: #8009/PR #8035 — see knowledge-base/project/learnings/2026-09-10-my-battery-killed-all-26-and-could-not-see-any-of-the-20-escapes.md.

And every causal or universal claim your prose ADDS needs its falsifying command run BEFORE you write it — "the only X", "reaches production", "N suites", "gated by W". Each has a command that settles it in seconds, and a false one propagates into ADRs, PR bodies and runbooks where a reviewer must re-derive it. See knowledge-base/project/learnings/2026-08-12-my-ladder-rung-ended-in-a-label-so-it-fell-through-to-the-unsafe-branch.md, which enumerates seven that shipped in one skill rewrite. This is honour-system today; the mechanical form is a diff-lint over added lines flagging superlative/quantifier shapes with no adjacent citation.

  1. Affected-Test Exit Gate (single pass, end of Phase 2)

[skill-enforced: work Phase 2 exit]

Before entering Phase 3, run the affected gate — once, and not the whole battery:

```bash

# wraps affected-tests.sh; skips only on a brief's ci-is-the-gate token

bash "${CLAUDE_PLUGIN_ROOT}/scripts/gate-or-skip.sh"

```

An AFFECTED_GATE_SKIPPED line means the gate was NOT run: report it so, never as a pass.

The gate's rc contract (0/1/4/6/7), the .soleur-test-gate.json override schema, and per-rc actions live in affected-gate-contract.md. In THIS repo it capability-probes and delegates scripts/test-all.sh --affected — selection fails toward coverage (AFFECTED_FALLBACK reason=… on an undecidable diff or a touched runner/index); preview it via bash scripts/test-all.sh --print-selection (repo-local). A green affected run is the diff's coverage, not a full-coverage claim; CI's sharded battery is the backstop. A refusal (rc 4) names its cause and prints a remedy: line — never retry it blindly.

TEST_GROUP=<g> remains as an explicit cross-cut, not the default. TEST_GROUP=bun|scripts|scripts-heavy|webplat|infra bash scripts/test-all.sh restricts the run to that group's registrations under the same affected-selection rules — a non-all ask force-selects its group. Use it to re-run one shard in isolation; it is no longer how the Phase 2 exit picks coverage — the affected index derives a finer set.

Shard map — derive it from the registrations, not the predicates. The want_* functions in scripts/test-all.sh are pure TEST_GROUP predicates with no path information — the path→shard mapping is the run_suite registrations inside each if want_X; then block. Starting index only: apps/web-platform/** → webplat; plugins/soleur/, scripts/, .claude/hooks/, tests/, AGENTS*.md → bun/scripts; docs/legal/** → webplat; *.c4 → scripts; the three want_scripts_heavy registrations route to scripts-heavy. apps/web-platform/infra/** wins over apps/web-platform/**: defer it to the ship Phase 4 checkpoint — a diff touching only it runs no Phase-2 shard; say so rather than reporting a green you did not earn.

The full battery is not the gate here — CI owns it, and soleur:ship Phase 4 runs the same affected gate. The MERGE gate is CI's required test context, which still runs the FULL battery on the PR head (bar ADR-262's PR-gated five); no local run is the merge gate, and calling one that is the over-claim that would license a future PR to shard it. This ordering is ADR-183; do not re-add a full local run at this position without reading it.

A run's summary is not a completeness claim — read the BREAKDOWN line. Since ADR-181 a suite may DECLINE (relevance-gated), and since #8322 it may also be not-affected (selection-gated); both are counted in the denominator, so N/N is not the ordinary local green spelling: a healthy affected run commonly reads N-k/N. A shard narrows coverage a second way the runner does NOT announce (the coverage NOTE exists for infra only). State which mode and which shards ran when you report the gate green — an affected run is the diff's coverage, not the battery's. This is the definite-article trap #6969 named, one level down: a green test-all.sh was read as the exit gate for a diff half of which it never executed. And never write "all covering suites ran" without the --print-selection output AND the run's per-suite result list — compare the two; a hand-picked list omits the meta-guards that react to file SHAPE (guard-vacuity-floor, test-all-weight-drift), which is exactly what reddened on #10322.

Ask before you launch: bash scripts/test-all.sh --capacity. It answers "can this box

absorb another full gate?" in ~3 s (measured p50, 16 cores / ~640 pids — it walks /proc

once; an earlier revision of this passage claimed "under a second" and was wrong by ~10x because

it walked twice). No suite, no lock, always exit 0. One verdict plus the running worktrees:

statement, not a refusal. The run is still yours to start; what it changes is what a RED

under it is worth, which is the three-way confirmation the contention passage below prescribes.

Note both axes: another worktree running the whole runner, and one running an individual

suite, are the same capacity contention one level apart.

— a reading DEGRADED. Never read this as a healthy box: every underlying probe degrades an

unreadable result to 0, which is below every floor, so a degraded value renders as ? and

the verdict names which reading failed. not_probed and unusable_floor are distinct on

purpose — the first means nothing was measured, the second that TC_MIN_AVAIL_MB is not a

number.

The two exceptional verdicts carry the [contention] BANNER prefix, so the post-run triage grep

in §"rc is the verdict" catches them; CAPACITY_OK stays plain because a banner that fires on

every run carries no information. Every line carries the measured value and the threshold.

The same verdict is emitted on every run between the contention preamble and the lock, so a run's

log records the capacity it started under.

--capacity deliberately does NOT block or change any exit code — the blocking form was cut on

measured evidence (ADR-133's 2026-08-19 addendum: a wait LOCK_ACQUIRED … after 616310ms was

redeemed at 616 s, which a sibling decline would have refused at t=0, and a non-zero exit here

would block git commit through lefthook's pre-commit hook).

A long wait is legible rather than silent. TC_LOCK_TIMEOUT is 3600 s (raised from 900,

which was shorter than the ~45-minute run it waits for — the budget expired by construction,

which is why N runs used to land together). While blocked the runner emits

[contention] BANNER LOCK_WAIT_HEARTBEAT: queued, not hung — <lock> waited=<N>s of <budget>s position=<P>

every TC_WAIT_HEARTBEAT_S (default 60), with elapsed read from a real clock. Since #8579 the

wait is a FIFO ticket queue: each run mints a ticket under

<git-common-dir>/soleur-session-state/locks/<name>.queue.d, only the queue head makes the

bounded acquire_lock call, and position=N on the beat is the run's live place in line

(absent on the degraded/no-ticket path). Once

waited exceeds TC_LOCK_TIMEOUT the beat's token switches to LOCK_WAIT_OVERRUN — the

detected-long-hold signal — and a non-head that outlasts TC_QUEUE_TIMEOUT (default =

TC_LOCK_TIMEOUT) proceeds contended with queue_timeout=1, still never aborting. If the

queue machinery itself is unavailable the run emits

BANNER LOCK_QUEUE_DEGRADED reason=mint_failed|no_state_root|bad_name|mkdir_failed|qdir_unsafe

and takes the pre-queue

direct-acquire path — that banner is the "why did the pileup recur" line. To enumerate

queue members: ls <git-common-dir>/soleur-session-state/locks/test-all.queue.d — each

ticket's first line is pid worktree epoch and the queue head is the lowest-numbered

still-held ticket.

The heartbeat does not tell you who holds the lock, and will not pretend to. An earlier

revision printed a "holder pid/worktree" taken from the first row of a /proc walk; measured, it

named a fellow waiter ~83% of the time on the pileup this exists for, so acting on it meant

killing the wrong session. Run --capacity in another shell for the actual list of running

worktrees. Read one of those two before killing anything.

One consequence to know. lefthook pre-commit runs the AFFECTED gate (test-all.sh --affected,

since #8322) on any staged *.{ts,tsx,js,jsx} — usually minutes, but a degraded selection

(undecidable diff, runner/index touched) runs the full battery behind this lock, so a git commit

can now wait up to two hours before the suite even starts (the FIFO ticket queue plus the lock

budget; it was 15 minutes). CI is unaffected — tc_acquire returns early on CI. The escape

hatches are git commit --no-verify and LEFTHOOK=0 — and the NARROWER one to reach for first is

LEFTHOOK_EXCLUDE=bun-test, which skips only the battery and leaves gitleaks, markdown-lint and every

other hook running. Before starting such a commit, read the pushed head's CI failure list (gh pr checks)

and git log HEAD..origin/main: a ratchet CI already reported, or one main already fixed, is 74 minutes

the hook will spend re-measuring (#6894, 2026-09-18-my-mutation-harness-counted-a-crash-as-a-kill-and-the-fixture-stacked-x-on-x.md).

Re-run each touched shard under the environments it SHIPS into, not only yours. CI=1 and

SOLEUR_SUBAGENT=1 change control flow (CI exemptions, subagent refusals), so a suite can be

green locally and red on merge — treat any PASS-COUNT DELTA between environments as a finding,

not just a FAIL. Why: #7545 — a new suite was 66/0 locally and 58/8 under CI=1 because

tc_acquire returns early on CI before the code under test; it was registered in the required

test context, so it was green for the author and red on merge. Thirty seconds of work; no

amount of diff-reading finds it. review/SKILL.md carries this rule too, but review runs AFTER

this gate — by then the panel is already reviewing a suite CI will reject.

The lead still owns this gate's verdict — but rc=4 no longer polices delegation. Since #8322 an --affected run is exempt from BOTH refusal arms — that exemption is the point of the mode, so a spawned agent CAN run the affected gate. rc=4 on an affected run now means one of two things, and both are yours to read: the run DEGRADED to full (AFFECTED_FALLBACK reason=… in the log — undecidable diff, missing index, runner/index touched, FORCE_ALL, or an enumerate-unavailable nested-enumerate failure, whose stderr the runner echoes) and then tripped SOLEUR_SUBAGENT=1 or a measured sibling full-gate run (#7553), each overridden by SOLEUR_ALLOW_FULL_GATE=1; or selection produced nothing / a gutted index (the zero-selected/below-floor refusals — fix the index, do not force past them). An explicit --full keeps the original refusals unconditionally. rc=4 is its own outcome: not a reap, not a pass.

A REFUSED gate also owes the repo-global RATCHETS — TEST_GROUP=affected reaches them mechanically; hand selection still cannot. A ratchet counts a property across the whole tree and REFERENCES NOTHING, so every file- or token-derived query returns it zero times by construction. The affected selector closes that with a floor: every registered suite in ALWAYS_ON_SUITES runs on any selection (a static corpus-walk census lint enforces membership), and an unclassified suite selects anyway — a path match alone never proves a repo-wide subject unaffected. When you select suites BY HAND instead — the substitute recipes below — the blind spot returns in full: select ratchets by SHAPE, not by name prefix. The reachable set has TWO halves and a name filter finds neither. (a) Every scripts/test-all.sh run_suite row whose invocation carries NO path argument — grep -nE 'run_suite "[^"]+" (bash|python3|bun|npx) [^ ]+$' scripts/test-all.sh (221 rows; the lint-*-live prefix filter returns 19). (b) Every suite registered by a GLOB rather than a row: the SUITE_GLOBS array near the top of that file auto-registers plugins/soleur/test/*.test.sh and six sibling globs, so those suites have NO run_suite line to grep and recipe (a) cannot see them — measured, it misses fixture-relative-assert, fixture-dir-operand-assert and preflight-check10-suite-integrity, three of the six that actually reddened. Expand the globs (eval ls <glob>) and run the census-shaped ones. Then run whatever FEEDS a baseline file (ls scripts/*.baseline.txt plugins/soleur/test/*.baseline.txt): a baseline is a ratchet whose name says nothing.

When a ratchet fires, the edit that satisfies it can move a DIFFERENT one — re-measure both. Ratchets read overlapping properties of the same bytes, so the second break is caused by the first fix and arrives with no diff of its own. Why: #8392/PR #8394 twice over. (i) A REFUSED gate's substitute set (seven consumer suites + the vocabulary sweep + four targeted shell suites) was fully green while lint-shell-capture-exit-live was RED on two lines the same session had just written. (ii) The CI round after that shipped SIX red suites, and only two carried lint in their name: guard-vacuity-floor (a new floor whose threshold was declared with the other constants, so the mutant died unbound under set -u and scored as a construction failure — the threshold has to sit on the line IMMEDIATELY above its if), lint-trap-tempfile-ownership, a bun backtick-reference census, a credentials_required corpus baseline, and two fixture-*-assert censuses. Then the trap that fixed lint-trap-tempfile-ownership — giving mktemp -d a destination under an owned root — cost the call its absoluteness proof and moved fixture-relative-assert from 3 to 20 sites; redirecting TMPDIR at the owned root instead keeps the binding byte-identical and owns the same directories.

When the gate is REFUSED (rc=4) via degraded-full, the substitute is the diff's NEW VOCABULARY, not the files you touched. A drift guard that keys on a TOKEN the diff introduces (SOLEUR_* marker families → apps/web-platform/test/git-lock-marker-telemetry.test.ts, a label, an enum member) covers your files without naming them, and it may live outside the affected set's edges. Enumerate: git diff origin/main...HEAD | grep -oE '^\+.*' | grep -oE 'SOLEUR_[A-Z_]+' | sort -u, then git grep -l <each> across test/ and apps/*/test/, and run every hit. Why: #7941/PR #8070 — the substitute set covered every suite git grep -l found for the touched files and missed the marker drift guard in the webplat shard; the required test context was red on the new HALT family until the review panel found it.

When the gate is REFUSED (rc=4) and you fall back to per-suite runs, derive the list from CONSUMERS, not memory. for f in $(git diff --name-only origin/main...HEAD); do git grep -l "$(basename "$f")" -- '*.test.sh' tests/scripts plugins/soleur/test; done | sort -u — then run every hit and name the commit each covered. The suite that reds is the one that reaches your change through a shared lib you never opened. Why: PR #8052 — a registered consumer of the birth-gate lib was 78/1 on the branch behind a "seventeen suites green" report; the refused gate would have run it, the review found it. See knowledge-base/project/learnings/2026-09-11-the-gate-i-skipped-for-contention-hid-my-own-red-suite-and-two-rehearsals-attested-a-gc-that-never-ran.md.

Why --affected and not a hand-derived command set. A vitest --changed + git grep derivation was specified and cut — and the affected gate is that derivation done correctly: a maintained index instead of a per-session heuristic, plus the contention preamble (SIBLING_RUN_DETECTED / SIBLING_SUITE_DETECTED / LOW_TMP_HEADROOM), the EXIT CONTRACT, the terminal === N/M suites passed === marker, the rc file, and the rc=3 UNRESOLVED class — an ad-hoc command set has none of them, and vitest run --changed with zero matches exits 1, which is indistinguishable from a real red by exit code alone. The gate also refuses rather than green on an EMPTY selection, so the "empty derived set" fail-open cannot arise. Losing the banner would have moved the earliest sibling-collision signal past the 8-10-agent review fan-out — the cost #7247 paid, where a duplicate implementation surfaced only because a banner named the sibling worktree after a full RED→GREEN cycle had been built and had to be reverted.

What this position no longer catches, stated plainly. The affected set reaches cross-file breakage only through its edges — argv literals, source/import closure, name-stems, and declared AFFECTED_*_PATHS; a suite whose dependency is none of those runs anyway (unclassified selects) or is flagged RED by the census linter, so the residual gap is an edge that is genuinely absent AND mis-classified. Orphan suites (a sibling file covering the same script) surface through lint-orphan-test-suites, which is always-on. What remains is the apps/web-platform/infra/ half — a RULESET gap, not a test-ordering one: no required status check runs that shard, and under --affected the infra runner is selected by its declared edge whenever the diff touches it.

Linters. lefthook.yml pre-commit already scopes them per commit, but the obligation is checkable rather than honour-system: this file sanctions LEFTHOOK=0 git commit as "common with core.bare=true repos" — this repo — and lefthook.yml has exactly one pre-push command, so there is no push-time backstop. If any commit on this branch was made under LEFTHOOK=0, run the corresponding linters explicitly before exiting Phase 2 (git log origin/main..HEAD is the commit set; lefthook run pre-commit over the staged set is the cheapest way to discharge it).

Full-suite fallback (projects with no CI-enforced full-suite gate).

Everything above is scoped to THIS repository, whose safety case rests on two backstops a self-hosted plugin user does not have: CI ruleset 14145388, and scripts/test-all.sh itself. Wherever this skill prescribes touched-file suites in project-agnostic prose, the same conditional applies: when the project has no CI-enforced full-suite gate on the merge branch, the full battery stays at implementation exit. Reordering a gate is only safe when a later gate still catches what the earlier one did; with no later gate, there is nothing to reorder into.

Determine which case you are in with a bounded, local check — do NOT add a selection script, and do not assume gh is installed or authenticated, that the remote is GitHub, or that any ruleset/branch-protection API is readable. Each rung ends in an action. If you reach the end of a rung without taking one, you have misread it — take the safe branch.

1. Does a CI config run the project's WHOLE test suite on every pull request targeting the merge branch? Read the repo's CI definitions (.github/workflows/*.yml, .gitlab-ci.yml, .circleci/config.yml, or the project's equivalent). Any of the following disqualifies it — treat the gate as ABSENT, run the full battery at implementation exit, and stop here:

No qualifying config ⇒ no gate ⇒ full battery at implementation exit. Stop here.

2. Does that run BLOCK the merge — required, not merely reported? A workflow that runs is not a gate; a workflow that blocks is. Use only what is already on disk (a checked-in ruleset or branch-protection definition, a documented required-checks list). If you cannot establish blocking from what you already have — which is the normal case, because GitHub branch protection is a server-side setting that is not checked in — treat the gate as ABSENT, run the full battery at implementation exit, and stop here. Do not probe, and do not infer enforcement from the workflow's existence.

The default is the safe branch: if you cannot determine that such a gate exists AND blocks merge, treat it as ABSENT and run the full battery. The relaxation is the privileged branch and is never reached by assumption or by falling off the end of the ladder. In this repository both steps resolve YES — the required test context is pinned in scripts/required-checks.txt and canonicalised in the canonical required-status-checks JSON — which is why the shard gate above is the prescription here.

Reading a test-all.sh run (applies at BOTH positions — this gate and the soleur:ship Phase 4 full-battery checkpoint).

The seven passages below are about interpreting a run, not about when to launch one. Moving the full battery to ship did not weaken any of them; soleur:ship Phase 4 links here rather than restating them, so this is the single source. None of them may be dropped or paraphrased — the coverage-NOTE polarity strings in particular are matched verbatim by the reader grep at the rc bullet above. Several say "the exit gate" in the singular; read that as whichever position you launched the run from, since the full battery now runs at ship.

The exit gate only describes the tree you launched it against — confirm clean, then do not edit under it, and read the TERMINAL marker. Three distinct false signals, all measured in one session (#6750/PR #7032): (a) launching test-all.sh against a dirty tree and continuing to edit produced 25 failures that were a mid-refactor snapshot of the author's own making, and were diagnosed as real — git status --porcelain must be empty before launch, and if an edit cannot wait, kill the run rather than reinterpreting its output; (b) a wait condition matched an intermediate per-suite Total: line instead of the terminal === N/M suites passed === marker, reporting completion mid-run — match the runner's LAST emitted line, never a per-stage line that merely looks summary-shaped; (c) redirecting the log into a directory that did not exist made the redirect fail, so the suite never ran and the wrapper's TEST_ALL_EXIT=1 read as a suite failure — mkdir -p the destination in the same command that writes it, and confirm the log exists AND carries the terminal marker before interpreting any exit code. Note (c) is the converse of the rc=$? caveat below: a runner can report failure it never earned as easily as success it never earned. Why: #6750 — three misread signals cost two full re-runs. See [[2026-07-29-a-per-producer-fix-left-seven-siblings-live-and-four-misread-signals]].

A QUEUED run counts as RUNNING, and a DIAGNOSTIC can arm a dormant defect. Two extensions of the rule above, both measured in one session (#1327). (a) Since the advisory lock, a launched test-all.sh may sit at [contention] LOCK_WAITING: before it executes anything — and since #8579 the wait is a FIFO ticket queue, so the bound is TC_QUEUE_TIMEOUT + TC_LOCK_TIMEOUT (default 7200 s, not 3600) and the heartbeat's position=N says where the run stands. "It hasn't started" is not a window to edit in; it can become queue head and acquire mid-edit, and the run you eventually read describes a tree that no longer exists. Treat launched-and-queued as running: kill it and relaunch rather than editing under it. (b) Relaxing a safety setting to DIAGNOSE something can make a previously-failing escape succeed. Forcing commit.gpgsign=false to attribute a SOLEUR_SIGN_UNAVAILABLE cluster let a fixture's unguarded cd (set -uo pipefail, no -e) commit into the REAL branch — 4 commits on top of real work, which had been failing harmlessly for exactly as long as signing was broken. That fixture also sets GIT_COMMITTER_DATE, which spoofs the reflog, so git reflog --date=iso cannot surface it by time ordering. After relaxing any safety setting, re-check git log and git status before shipping. Why: #1327 — see knowledge-base/project/learnings/2026-08-20-my-mutation-battery-sampled-the-axes-i-already-believed-in.md and #7652.

"My edit is unrelated to the running suite" is how the exit gate gets invalidated. The rule

above says confirm-clean-then-do-not-edit; the reason it gets broken is that the edits feel

unrelated. They rarely are: the runner under measurement is frequently ITSELF a registered suite

that invokes the file being edited, and bash reads a script incrementally by byte offset, so an

in-place edit can change what a running invocation executes. The failure does not look like a

conflict — it looks like a plausible test result. Why: #7376 — editing

run-registered-suites.sh during a pinned measurement run produced 81 passed, 12 failed with

every RED reporting rc=?, because the log dir had been removed mid-run; the 12 REDs read exactly

like a flake reproduction and were entirely self-inflicted. **If an edit cannot wait, kill the

run** — a discarded run costs minutes, a misattributed one costs the whole investigation. Same

rule for measurement loops and agent panels: they contend for one machine, so sequence them.

Test-harness sharp edges — mid-run commits trip the write boundary; new policy hooks touch ~15 ratchet surfaces; nested test-all.sh sandboxes need env -u scrubs; markdownlint 0 files = skipped → work-test-harness-sharp-edges.md (#10161).

Sibling-worktree contention produces a FALSE RED — the runner now self-identifies it. Parallel worktrees are this repo's documented workflow, so two sessions can run test-all.sh simultaneously. The contended resource is NOT a colliding path — it is CAPACITY: every suite's mktemp lands in the same machine-global, RAM-backed 4 GiB /tmp tmpfs, so a second run competes for the memory the first is holding, and the failure both implicated suites document in-repo is a TIMEOUT (skill-security-scan.test.ts #4096; vitest.config.ts #3817/#4128), never a path collision. The previously-recorded cause — skill-security-scan's .scan-meta.json plus the semgrep bootstrap as "the known pair" — was refuted by measurement (#6789): run-scan.sh PID-scopes .scan-meta.json since its original commit (cannot collide across worktrees; its real defect was an unbounded meta_dir leak, age-reaped), and the semgrep bootstrap is unreachable from any suite test-all.sh runs. You no longer run ps by hand: test-all.sh prints a contention preamble (/tmp headroom, sibling runs resolved to their worktrees via /proc/<pid>/cwd, machine load) and fires a named SIBLING_RUN_DETECTED / SIBLING_SUITE_DETECTED / LOW_TMP_HEADROOM banner when one of those conditions holds (SIBLING_SUITE_DETECTED: one level down — a sibling running a single suite directly), and an advisory git-common-dir lock serializes concurrent runs (LOCK_CONTENDED_PROCEEDING banner on timeout; never aborts). When a banner fires, confirm three ways (isolated re-run, the matching CI gate's status, a clean full re-run once the sibling exits) rather than accepting "flake"; never delete another session's /tmp artifacts — /tmp is shared tmpfs; write large logs to /var/tmp (tmpfs-guard.sh's cron reaper bounds abandoned-scratch growth only for entries above its size floor; the count-shaped class — tens of thousands of few-hundred-byte artifacts, which filled /tmp on 2026-07-27 — is not reclaimed by anything today; the reclaim tier was measured against the real /tmp and removed before merge (12,240 entries, ~1,500 authored), so the guard detects and reports the count shape, deleting nothing. #7004 rebaselined that report onto growth above a downward-ratcheting watermark, so it alarms on NEW leaks, not the standing backlog. Do not treat the reaper as a general backstop). Why: #6726 — 4 skill-security-scan failures were pure contention (isolated re-run 22/0, CI green throughout); #6789 re-derived the actual cause and shipped the self-identification above.

A long run can be reaped by the HARNESS, and that is not a suite result — read the rc file, never the notification. Under contention the exit gate is frequently unreachable, and the three ways it fails are all indistinguishable from a suite failure if you read only the task notification: a background Bash task returns status: killed or exit code 144 (SIGUSR1) after ~9-15 min, a foreground call trips the 600 s ceiling and is moved to background, and a Monitor script watching for the result gets reaped on the same clock. None of those are your diff. Distinguish mechanically, and it is a three-way split, not two: a real failure leaves [FAIL] lines and a terminal === N/M suites passed ===; a reap leaves zero [FAIL], no terminal marker, and no rc file; and a suite that died while the runner survived leaves [KILLED] lines, a terminal marker and an rc file carrying 3 — that third one is unresolved rather than reaped or failed (§rc is the verdict, above), so it is yours to re-run in isolation, not to dismiss as harness noise. To actually finish one, detach it from the harness process group — setsid nohup env TMPDIR=/var/tmp bash -c '<runner> > log 2>&1; echo $? > rc' </dev/null & — keep any Monitor under ~9 min so it exits on its own timeout, and shard with TEST_GROUP= (all|webplat|bun|scripts|scripts-heavy) so each piece completes; a run queued on the advisory lock ends its pre-acquire output at the LOCK_WAITING/LOCK_QUEUED pair, after which the 60 s LOCK_WAIT_HEARTBEAT/LOCK_WAIT_OVERRUN beats are the proof of life, so grep -q 'LOCK_WAITING' "$log" on a log that has stopped growing means the lock, not a hang. Why: #7172 — three reaped runs (459-470 suites [ok], 0 [FAIL] each) while five sibling worktrees ran the same runner at load 55 on 16 cores.

Doppler-env false-positive caveat (TEST_GROUP=webplat). Running the webplat shard under doppler run -c dev injects feature flags + live vendor creds that CI does not, which can flip untouched files into code paths their unit mocks don't cover (e.g. a delegation flag routes team-membership-resolver.ts into a byok_delegations query → unmocked table) — the vi.unstubAllEnvs-can't-clear-inherited-env class. Before treating a webplat failure as a regression, re-run the failing file without Doppler (CI-equivalent); if it passes there and gh run list --workflow=ci.yml --branch main is green, it's a pre-existing env-only flake, not your diff. Why: #4660 (filed #4663). Inverse (Doppler masks a CI-only FAILURE): a new webplat test that imports any server/inngest/* module (or anything transitively loading server/inngest/client.ts) throws an INNGEST_SIGNING_KEY missing at startup error at module-eval unless guarded by a hoisted vi.hoisted(...) block that sets the NEXT_PHASE env to phase-production-build BEFORE the import (mirror the sibling cron-compound-promote.test.ts). Running the file under doppler run injects the key → it passes locally while CI's test-webplat (no inngest env) errors at collection → the required test context reds. Always run a new inngest-importing test CI-equivalent (no Doppler) before trusting green. Why: #6103 — the ADR-092 recursion test passed 4/4 under Doppler and would have wedged the merge; caught by review. See knowledge-base/project/learnings/security-issues/2026-07-06-body-hashing-guardrail-gate-fail-open-classes.md.

Legal-doc edits have TWO independent mirror gates — a new heading needs the Eleventy mirror in the same PR. When the diff adds a ## /### heading to a canonical docs/legal/*.md, apps/web-platform/test/legal-doc-consistency.test.ts (declared in test/repo-wide-suites.ts, so it runs in the always-on repo-wide project — the Phase 2 affected gate runs it on every diff, no shard ask needed) FAILS on source↔mirror section-heading-sequence drift unless the SAME heading is added to plugins/soleur/docs/pages/legal/<doc>.md. This is a DIFFERENT, stricter gate than apps/web-platform/scripts/check-tc-document-sha.sh (whose mirror body-equivalence step is T&C-only and explicitly defers non-T&C docs) — passing the SHA guard does NOT imply heading parity. Prose added inside an existing section needs no mirror heading; a NEW section does. The Phase 2 affected gate runs it automatically (always-on); confirm its row is green rather than absent — and rc=$? + grep the log, since a backgrounded runner can report exit 0 with a real failure. Why: #5370 — a new gdpr-policy ### 3.12 passed the SHA guard but turned the full suite red until the mirror heading was synced. See [[2026-06-15-two-legal-mirror-gates-and-always-build-mcp-registered-list-desync]]. <!-- markdownlint-disable-line MD038 -->

Feature-branch-CWD blind spot for .claude/hooks/*.test.sh (run once from a simulated main CWD). A hook test whose outcome depends on a CWD/branch-resolved gate (block-commit-on-main, git worktree list, symbolic-ref HEAD) passes on the feat-* worktree but can fail ONLY on post-merge main — the local suite is NOT authoritative for these. When the diff touches them, run once from a throwaway committed-main CWD: recipe at hook-test-main-cwd.md (#5192).

Phase 2.5: Research Validation Loop (knowledge-base deliverables only)

Rule source: AGENTS.md — migrated 2026-04-21 (PR #2754). When a research sprint produces recommendations, run the cascade-validate loop [id: wg-when-a-research-sprint-produces] [skill-enforced: work Phase 2.5]. "Findings written" is NOT done — "findings applied, validated, and all documents reflect the final state" is done. The full body of that rule lives here; AGENTS.md retains a one-line pointer preserving the [id: ...] tag.

Trigger: This phase runs when the plan's deliverables are knowledge-base research artifacts (findings, analysis, audits, research briefs) that produce recommendations targeting other existing documents. Skip for code-only plans.

Detection: After Phase 2 completes, scan the outputs for recommendation patterns — "should rewrite," "needs updating," "add to," "change X in Y.md," or any finding that names a specific target file. If found, enter the loop.

The loop:

while (recommendations exist that haven't been applied):
  1. CASCADE: Apply all recommendations to their target artifacts
     - Rewrite questions in interview guides
     - Update framings in brand guide
     - Add alternatives to pricing strategy
     - Any finding that names a file → edit that file
  2. VALIDATE: Re-run the same research methodology against updated artifacts
     - Use the same personas/parameters as the original run
     - Produce a before/after comparison (original → current)
  3. CHECK: Did the validation surface NEW weak spots or recommendations?
     - If yes → apply fixes, loop back to step 2
     - If no (at synthetic ceiling) → exit loop
  4. UPDATE BRIEF: Update the research brief with final validated results
     - Executive summary reflects current state, not original findings
     - Recommendations marked as "Applied" with results
     - Add Cascade Status section tracking all changes to all files
  5. SUMMARIZE: Present founder summary
     - Key findings table
     - All files changed table (file, what changed, before/after metrics)
     - Remaining limitations (structural, not fixable)

Exit condition: The loop exits when a validation round produces no new actionable recommendations — only structural limitations that can't be fixed by rewording (e.g., a persona's archetype inherently produces flat responses to a specific question type).

Max iterations: 3 rounds. If the third round still produces actionable recommendations, present them to the user rather than looping indefinitely. Synthetic-on-synthetic validation has diminishing returns.

Why this matters: Without this loop, research sprints produce findings that sit in briefs without updating the documents they target. The founder has to manually ask "was any action taken?" after each round. This loop makes cascade + validate + re-cascade automatic.

Phase 3: Quality Check

  1. Run Core Quality Checks

Always run before submitting:

```bash

# Run the suites covering the touched files -- but the FULL battery when the

# project has no CI-enforced merge gate; see Full-suite fallback in Phase 2

# section 9 (take that branch when unsure).

# Examples: bin/rails test, npm test, pytest, go test, etc.

# Run linting (per CLAUDE.md)

if [ -d "${CLAUDE_PLUGIN_ROOT}" ] && command -v python3 >/dev/null; then python3 "${CLAUDE_PLUGIN_ROOT}/scripts/lint-ratchet.py" auto; else echo SKIP lint-ratchet; fi # never a repo-local copy; output is data; exit 1 blocks handoff (baseline deleted: relay, ship only if user confirms un-adoption); not adopted: relay, never --update unprompted; CONFIG CHANGED/REPO-CONTENT: relay, continue

```

  1. Consider Reviewer Agents (Optional)

Use for complex, risky, or large changes:

Run reviewers in parallel with Task tool:

```text

Task(soleur:engineering:review:code-simplicity-reviewer): "Review changes for simplicity"

Task(soleur:engineering:review:kieran-rails-reviewer): "Check Rails conventions"

```

Present findings to user and address critical issues.

  1. Final Validation

Phase 4: Handoff

Final-report decision check. Class every decision the ## Work Phase Complete marker or closing message leaves to the operator per technical-ruling-delegation.md section 8.1; only operator (<category>) items stay, the rest go to soleur:engineering:cto (legal: soleur:legal:clo) first, in one batched spawn.

Implementation is complete. Before handing off, run the Playwright-first audit, then determine invocation mode.

Playwright-First Audit

Scan any "next steps", "setup instructions", or "to use this" text you are about to output. For each step that involves a browser action (account creation, credential generation, settings configuration, form submission, vendor support tickets, OAuth flow, portal navigation):

  1. Classify: Is this step automatable via Playwright MCP, or is it genuinely manual (CAPTCHA, interactive OAuth consent, hardware MFA token, payment-card entry)?
  2. If automatable: Do not list it as a manual step. Either execute it now via Playwright MCP, or note it as "automatable via Playwright — will execute next."
  3. If genuinely manual: Drive the flow via Playwright up to the manual gate (e.g., navigate to the OAuth consent screen), then hand off only that single interaction to the user.

If you catch yourself writing phrases like "set up X in the browser", "go to the portal and...", "manually configure...", "paste this ticket body into the support form", or "the operator pastes + submits" — stop and attempt Playwright first. This audit is mandatory; skipping it is a deviation.

After the last Playwright step call browser_close (nothing reaps the browser at turn end, ADR-271), and if the first browser call fails with Chromium sandboxing failed! or No usable sandbox!, stop and read the sandbox entry in plugins/soleur/skills/agent-browser/SKILL.md troubleshooting, never edit the Playwright config or env to disable the sandbox (the proxy refuses it and the MCP server then fails to start), and tell the user the host needs Google Chrome or a non-root user.

Attempt-evidence is mandatory before ANY "operator-only" / "manual" / "not automatable" classification (HARD GATE). A browser step may be labeled operator-only ONLY after a real Playwright MCP attempt that reached the actual gate — never from an a-priori assertion. Phrases like "MFA-gated", "no API path", "requires dashboard access", or "operator must do this in the browser" are predictions, NOT observations; on their own they are non-compliant. This applies even when an upstream PLAN or ADR pre-declares the step operator-gated (e.g. automation-status: UNVERIFIED, or an Automation: not feasible because <X> line whose <X> is an a-priori "no creation API / vendor limit" assertion): a plan/ADR claim is NOT a substitute for your own Playwright attempt — treat any plan-declared operator-gated browser/vendor-dashboard step as UNVERIFIED and attempt it before honoring the handoff. A vendor dashboard mint runs under an authenticated session and is presumptively automatable (#5480 — the plan + ADR-065 asserted the Resend key mint "operator-gated, no API"; a Playwright attempt reached the authenticated dashboard with a working create form and NO human gate; see knowledge-base/project/learnings/workflow-patterns/2026-06-17-vendor-dashboard-mint-presumed-playwright-automatable.md). The classification MUST be accompanied by an evidence line in this exact shape:

playwright-attempt: navigated <URL>; reached <specific gate observed>; <why it blocks autonomy>

where <specific gate observed> is a concrete, named gate the run actually hit — one of: CAPTCHA/Turnstile challenge, email-OTP, SMS-OTP, authenticator-TOTP, WebAuthn/passkey/Touch-ID prompt, push-MFA (Duo/Okta/Authy), payment-card iframe, hardware-token tap, or tool-instability: <observed symptom> (e.g., "browser context closed mid-form ≥N times; SPA form state did not survive reconnect"). "I assume it needs MFA" is not a gate observation; "navigated to the password screen, entered creds, hit a WebAuthn passkey prompt the browser cannot synthesize" is. api-probe-403 alone never qualifies — a 403 from a narrowly-scoped token (e.g. a Terraform token that lacks token-management permission) does not prove the dashboard path is operator-only; you must still attempt the browser. Exhaust the credential space first (a Global API Key or a token with the write scope may exist in Doppler) before concluding no API path exists.

Two distinct dispositions once attempt-evidence exists:

The playwright-attempt: line is what the ship operator-step gate and the Post-Merge Self-Audit consume to distinguish a real gate from an un-attempted deferral. See knowledge-base/project/learnings/workflow-patterns/2026-06-10-playwright-attempt-evidence-before-operator-only.md.

Vendor support ticket submissions are Playwright-driveable — they are NOT operator-handoff by default. Most vendor support surfaces today are Intercom / Zendesk / HelpScout chat widgets (help.<vendor>.io, support.<vendor>.com, <vendor>.zendesk.com) where the AI assistant routes to a human team. The full submission flow — opening the widget, accepting cookies, starting a conversation, sending the ticket body, requesting human escalation if the AI gives a stock policy answer — runs entirely under Playwright. The only legitimate manual gates are:

Never quote OTP digits, TOTP codes, or any other ephemeral authentication value in a committed file — capture only the fact-of-verification + UTC timestamp. The specific code is dead immediately, but quoting it normalizes "paste secrets into the runbook" as a pattern and the next vendor's code may NOT be single-session (some flows reuse codes within a TTL window).

Drive the flow up to one of these gates, hand off the single interaction (e.g., "check your inbox for the OTP and tell me the code"), then resume. Never list "operator pastes + submits" as a step — that's a Playwright-first-audit violation. Vendor support tickets typically do not return a numeric ticket ID; capture (a) the submission UTC timestamp, (b) the AI-classifier auto-title (often surfaced in the messages list), and (c) any human-team routing label as the audit baseline. The conversation thread on the vendor side IS the canonical ticket; async response arrives via email to the operator. Why: PR #3946 PR-γ §17 Sentry refund + forensics tickets — the original plan listed them as "NOT Playwright-driveable" (operator handoff to paste-and-submit); after operator pushback, both tickets were driven via Sentry's Intercom widget at help.sentry.io with only the email-OTP step handed off. See learning knowledge-base/project/learnings/2026-05-17-vendor-support-tickets-are-playwright-driveable.md.

Phase 4 Entry-Guard

Before emitting ## Work Phase Complete (one-shot mode) or chaining into the post-implementation pipeline (direct mode), assert at least one commit exists beyond origin/<branch>. An empty diff hands review agents nothing to analyze and produces no signal. Run BEFORE the Invocation Mode branch so both paths are covered.

Procedure (distinct exit codes signal distinct operator actions):

  1. Probe the commit count:

```bash

BRANCH=$(git rev-parse --abbrev-ref HEAD)

if [[ -z "$BRANCH" || "$BRANCH" == "HEAD" ]]; then

echo "[work-phase-4-guard] detached HEAD — checkout a feature branch before chaining to review." >&2

exit 1

fi

N=$(git rev-list "origin/${BRANCH}..HEAD" --count 2>/dev/null || echo 0)

```

  1. If N == 0, stop and run Phase 2 step 3 (stage logical-unit files, write conventional commit message). Do not chain through this block as a single bash invocation — the commit is an explicit action the agent must perform between probes:

```bash

if [[ "$N" == "0" ]]; then

echo "[work-phase-4-guard] no commits beyond origin/${BRANCH} — pause and run Phase 2 step 3 incremental commit before continuing." >&2

exit 2 # PAUSE — orchestrator should re-enter Phase 4 after the commit lands

fi

```

  1. After the incremental commit lands, re-enter the Phase 4 entry-guard. If N == 0 on the second probe (commit failed silently or no diff exists), HALT:

```bash

if [[ "$N" == "0" ]]; then

echo "[work-phase-4-guard] empty diff vs origin/${BRANCH} after Phase 2 step 3 — investigate before continuing." >&2

exit 1 # HALT — do NOT emit "## Work Phase Complete"

fi

```

Form rationale. git rev-parse --abbrev-ref HEAD matches ship/SKILL.md:619 precedent and returns the literal HEAD on detached state (vs. git branch --show-current which returns empty), so the detached-HEAD guard catches both shapes. git rev-list ... --count returns a clean integer ready for [[ "$N" == "0" ]]; the wc -l shape requires a tr -d strip and is whitespace-padded. Precedent: plugins/soleur/skills/ship/SKILL.md:619, .claude/hooks/ship-unpushed-commits-gate.sh. Distinct exit codes (2 = pause-and-commit, 1 = halt-and-investigate) let one-shot orchestrators distinguish the two recovery paths rather than treating both as opaque non-zero failures.

Post-Merge Section Self-Audit (HARD GATE)

After drafting the PR body and BEFORE gh pr ready / gh pr merge --auto, scan every line under headings matching ^##\s+(Post-?merge|Operator|Follow-?ups?) (case-insensitive). For each bullet, classify and resolve before marking ready:

| Pattern | Action |

|---|---|

| Doppler/env-var verification | Inline-execute via doppler secrets get <KEY> -p soleur -c <env> --plain; if missing, set from a known source via doppler secrets set or update the handler to read the existing canonical name. |

| Within Nh of merge: file <issue> | File the issue NOW via gh issue create using the template the bullet describes; replace the bullet with Done: #<num>. |

| gh issue close / gh issue comment on existing issues | Run NOW via gh CLI. |

| Sentry / Better Stack / monitor verification | Replace with the monitor's own auto-page mechanism (failure_issue_threshold = 1 is the verification — no operator gaze required per hr-no-dashboard-eyeball-pull-data-yourself). If active verification is still wanted, create a one-time scheduled workflow via soleur:schedule create --once --at <date> with a self-disabling verify-and-close-or-file-issue body. |

| Genuinely operator-only (CAPTCHA, SSO consent, payment-card entry, hardware MFA, K-bis-style first-onboarding) | Requires a playwright-attempt: evidence line (see Phase 4 Playwright-First Audit) proving a real attempt reached a true human gate — an a-priori "MFA-gated"/"dashboard-only" assertion does NOT qualify. With evidence: file a type/chore issue carrying the literal deferred-automation sentinel — via --body-file, never --body "…\n…" (double-quoted \n is a literal backslash-n, so Mandated-By: lands mid-line and the net-issue-flow exemption's anchored match cannot see it): write the body to a file under a soleur-run scratch root ("$(mktemp -d -t soleur-run.$$.XXXXXXXX)/b") containing deferred-automation backlog item; re-evaluate when: <criterion>; playwright-attempt: <evidence>, a blank line, then Mandated-By: wg-block-pr-ready-on-undeferred-operator-steps on its own line; gh issue create --label type/chore --label deferred-automation --title <...> --body-file <path>. The literal deferred-automation string must be in the issue BODY — ship-operator-step-gate.sh greps the body for it and reads type/chore from the labels; the deferred-automation label itself is read by no gate and is kept for human triage only. Then add Tracks #N to the bullet in the PR body: the exemption requires that companion, and without it the filing this rule MANDATES is blocked by net-issue-flow with no exit but the blanket override. |

| Automatable but the tool failed (attempted-blocked-on-tool: browser crashes, MCP down, headless-absent MCP) | NOT operator-only — file a type/chore issue tagged tooling/flaky (NOT deferred-automation) with the playwright-attempt: evidence + exact resume recipe (URL, remaining clicks, partial form state). Retry in a stable session; do not permanently hand to the operator. |

| Anything else | Inline-execute. Default-deny on "operator should later …" phrasing. |

After resolution, re-scan; the section MUST contain zero unaccompanied operator/manual bullets. The ship-operator-step-gate.sh PreToolUse hook enforces this mechanically at gh pr ready / gh pr merge --auto — the gate's deny message lists each undeferred match. Override via SOLEUR_SKIP_OPERATOR_STEP_GATE=1 is reserved for the rare attestation case.

Why: PR #4227 (TR9 PR-3) shipped with a "Post-merge" section listing four operator items (Doppler secrets check, T+90 min Sentry verify, T+24h auto-resolve verify, file follow-up issue within 48h) — all four were inline-automatable; the agent had hard rules forbidding the deferral (hr-exhaust-all-automated-options-before, hr-never-label-any-step-as-manual-without, wg-block-pr-ready-on-undeferred-operator-steps) and still wrote the bullets. The gate existed at soleur:ship Phase 5.5 but the agent reached gh pr ready directly. This self-audit + the hook close both halves of that bypass. See knowledge-base/project/learnings/best-practices/2026-05-21-post-merge-section-self-audit.md.

Follow-up Filing Net-Flow Gate (HARD GATE)

soleur:work files follow-up issues HERE (Post-Merge Self-Audit, deferral tracking, discovered-bug capture) — which is BEFORE soleur:ship Phase 5.5's Net-Issue-Flow Surfacing runs, and is bypassed entirely when soleur:ship is hand-rolled. So the cost-of-filing + net-flow discipline (PR #4452) must ALSO fire at this filing site, not only at ship.

Before issuing ANY gh issue create for a follow-up in this phase, run the gate:

  1. The soleur:engineering:review:code-simplicity-reviewer CONCUR gate applies HERE too, before the filing — not only to review-time filings. review/SKILL.md §5 already requires it for every --label deferred-scope-out issue and calls filing-first-co-signing-second a protocol violation; the gap is that a plan can prescribe filings in THIS phase without restating the gate that governs them. Running it after the fact inverts its purpose — it becomes ratification rather than admission control, because closing an already-filed issue costs more friction than declining to file one. Also confirm the deferral target can actually reach the defect: deferring instances to a future linter/guard whose SCOPE cannot see them (an if:-scoped rule filed against a defect living at with.status) parks them forever. Why: #7138 — two Phase-7 filings preceded the gate; it then DISSENTed on one, splitting out two false-GREEN heartbeat monitors that had to be fixed inline.
  1. Cost-of-filing, per candidate filing (mirrors review/SKILL.md §CONCUR): if the deferred work is ≤100 changed lines AND ≤4 files, do it inline (fold into THIS PR if unmerged; otherwise it is genuinely a follow-up). Only file when the work is genuinely larger, a separate work-stream/Non-Goal, an operator-only step, or a discovered defect in a different subsystem (the last MUST stay its own issue — never bury a possible-P1 bug in a consolidated tracker).
  2. Consolidate deferred-FEATURE follow-ups into ONE tracker. Multiple deferred-scope-out follow-ups from the same PR (ADR + future-feature + sibling-upstream …) collapse into a single "\<feature\> (#N): post-MVP follow-ups" issue with a checklist. Discovered bugs stay separate.
  3. Surface the net count BEFORE filing. Compute and print: Closing: <count of Closes #N in PR body> / Filing: <new issues> / Net: <signed>. If Net > 0, state one sentence per filing on why it could not be inlined or consolidated. Net-positive backlog growth from a single feature PR is the smell this gate exists to catch.

This is the soleur:work-side mirror of soleur:ship Phase 5.5 Net-Issue-Flow Surfacing — together they cover both the filing site (here) and the merge boundary (ship). Why: PR #4580 (#4579) filed 4 follow-ups for 1 closed issue (net +3) during this self-audit; the agent hand-rolled soleur:ship so Phase 5.5's surfacing never fired, and there was no filing-site gate. Three were consolidatable into one tracker (#4613); the net should have been +1. See knowledge-base/project/learnings/workflow-patterns/2026-05-29-net-issue-flow-gate-at-filing-site-not-just-ship.md.

Invocation Mode

Child-skill invoke (plugins/soleur/lib/harness.ts invokeSkill()): Claude: Skill tool (soleur:<skill>). Grok: Read plugins/soleur/skills/<skill>/SKILL.md in this process and run it to completion (soleur:review, soleur:qa, soleur:compound, soleur:ship). Slash names the skill; it is not a nested tool_use.

If invoked by one-shot (the conversation contains soleur:one-shot skill output, soleur:one-shot, or a slash_command of one-shot earlier): Output exactly ## Work Phase Complete and then immediately invoke skill: soleur:review (Grok: Read plugins/soleur/skills/review/SKILL.md in this process / soleur:review) (step 4 of the one-shot sequence). Do NOT end your turn after outputting the marker — you ARE the orchestrator, so you must continue executing one-shot steps 4 through 10 in order. The marker is a progress signal, not a stopping point.

If invoked directly by the user (no one-shot orchestrator): Continue through the post-implementation pipeline automatically. Do NOT stop and wait — the earlier learning "Workflow Completion is Not Task Completion" applies. Run these steps in order, forwarding --headless if HEADLESS_MODE=true:

  1. skill: soleur:review (or skill: soleur:review --headless if headless; Grok: soleur:review) — catch issues before shipping
  2. skill: soleur:resolve-todo-parallel — resolve any review findings (no --headless needed; this skill has no interactive prompts)

2.5. Structural-UI visual gate (#4834 / ADR-049). If the diff (git diff --name-only origin/main...HEAD — the branch-vs-main merge-base diff; do NOT use origin/<branch>...HEAD, which only sees unpushed commits and returns 0 files once the branch is pushed) touches apps/web-platform/app/(dashboard)/**, apps/web-platform/components/dashboard/**, or any layout.tsx, run skill: soleur:qa (or --headless; Grok: soleur:qa) BEFORE shipping — its auth-seeded headless Playwright nav-states gate catches the CSS-layout regressions jsdom structurally cannot (the #4810 class). This is the step whose absence let direct soleur:work skip the browser check that one-shot runs at its step 5.5 — wiring it here closes that asymmetry. Do NOT fire on leaf-component or content-only .tsx diffs. This is a scope boundary, not a stopping point: do not announce or return control here — continue executing the next step.

  1. skill: soleur:compound (or skill: soleur:compound --headless if headless; Grok: soleur:compound) — capture learnings before committing

3.5. Emit the end-of-work resume prompt (wg-end-of-work-emit-resume-prompt) — unconditionally, in a fenced block naming the skill to run next, the branch, the worktree path, the PR # and the issue #. Then, and only then, decide whether to recommend a fresh session: append "Two automatic compactions occurred in this session — run /clear and paste the block above to continue in a fresh one." when this session carries a SOLEUR_COMPACTION_DIRECTIVE marker with recommend=true (compaction-state.sh, #8323). (No-marker rationale: end-of-work-resume.md.) Closing messages: Phase 4 Final-report check.

  1. skill: soleur:ship (or skill: soleur:ship --headless if headless; Grok: soleur:ship) — commit, push, create PR, merge

Key Principles

See references/key-principles.md (moved verbatim; byte-ceiling extraction).

Common Pitfalls to Avoid

BEFORE writing the directive, the comment, or the ADR sentence, and when copying a mechanism from a

sibling, copy its whole block (the with: keys, the directives around it, the comment) and diff

them, not the one line you wanted.** For systemd the measurement is a thirty-second transient unit

with a counting OnFailure= reporter (systemd-run --user … -p OnFailure=rep.service), and it

must be re-run for every sentence the diff adds about ordering, retry or terminal state.

Why: #8210 — five systemd assumptions reversed under measurement, and a copied interlock

omitted fetch-depth: 0, holding the route. See

knowledge-base/project/learnings/2026-09-19-every-systemd-claim-i-reasoned-was-inverted-by-a-thirty-second-measurement.md.

assert the pre-existing count is unchanged afterwards. Why: #7810 — a remediation keyed on

assert_fixture_dir "${work}" deleted 13 PRE-EXISTING guards from #7709's burn-down, surfacing only

because an unrelated count jumped 0 to 43.

directions and require the unsafe direction to be empty. Why:** #7810 — a heredoc repair meant

to unhide code HID 1864 more lines, one file going 0 to 910 skipped. The shipped version asserts

"files skipping MORE than before must be 0".

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.