<!-- 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:
- FORBIDDEN: Pushing a branch and reporting "done" without
soleur:review→soleur:compound→soleur:ship. - FORBIDDEN: Treating
## Work Phase Completeas a turn boundary when you own the pipeline (see Invocation Mode below). - REQUIRED (Grok Build): Invoke
soleur:review,soleur:compound,soleur:shipvia slash commands — never hand-roll ship steps. - Deliverable: merged PR (standalone) or return to parent one-shot (pipeline mode).
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:
- Run
git branch --show-currentto get the current branch name - If the branch starts with
feat-, readknowledge-base/project/specs/<branch-name>/tasks.mdif it exists
If knowledge-base/ exists:
- Read
CLAUDE.mdif it exists - apply project conventions during implementation - If
# Project Constitutionheading is NOT already in context, readknowledge-base/project/constitution.md- apply principles during implementation. Skip if already loaded (e.g., from a precedingsoleur:plan). - Detect feature from current branch (
feat-<name>pattern) - Read
knowledge-base/project/specs/feat-<name>/tasks.mdif 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.
- Announce: `
"Loaded constitution and tasks forfeat-<name>"— append" (lane=<value>)"whenLANE` is non-empty.
If knowledge-base/ does NOT exist:
- Continue with standard work flow (use input document only)
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:
- 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>" - Run
pwd. If the path does NOT contain.worktrees/, WARN: "Not in a worktree directory. You can create one viagit-worktreeskill in Phase 1." - Run
git status --short. If output is non-empty, WARN: "Uncommitted changes detected. Consider committing or stashing before starting new work." - Probe for stashed changes WITHOUT invoking
git stash(thehr-never-git-stash-in-worktreeshook denies even the read-onlygit stash list). Usegit 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:
- If a plan file path was provided as input (ends in
.mdor 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." - Run
git diff --name-only HEAD...origin/mainto 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 underdocs/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. Seeknowledge-base/project/learnings/best-practices/2026-05-20-rebase-before-applying-agents-md-plan-edits.mdandknowledge-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). - If a plan file was provided (check 5 passed), scan for a
## Domain Reviewor## UX Reviewheading (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:
- 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 checkknowledge-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 asDESIGN_ARTIFACTSfor use in Phase 2.
Specialist review checks:
- If a plan file was provided (check 5 passed) and a
## Domain Reviewsection exists with a### Product/UX Gatesubsection: 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 saysreviewed (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.
- Read Plan and Clarify
- Read the work document completely
- Review any references or links provided in the plan
- Before proceeding, verify the plan does not contradict conventions in AGENTS.md and constitution.md: file format (markdown tables not YAML), kebab-case naming, directory structure (agents recurse, skills flat), required frontmatter fields, shell script conventions
- A budget you write as a LITERAL is stale the moment a sibling PR moves its base — write it as a delta, and measure the shell rather than assuming it. Two shapes from one session. (a) An assertion floor, byte cap or count copied into the diff as
47encodes today's base; when a sibling raises the base mid-flight the number is silently wrong and the rebase conflicts exactly where both PRs land. Derive it (main's floor + 1), state the increment in the comment, and re-read the base fromgit show origin/main:<file>at ship rather than at plan time — measured, one suite's floor moved 44 -> 46 -> 48 -> 49 over four days across three PRs, and the branch's own in-flight 47 was never a value that shipped, so a literal carried from it would have been wrong in a direction no local test could see. (b)set -edoes not fire on a failing NON-FINAL member of an AND-OR list (bash -c 'set -e; sh -c "exit 100" && true; echo reached'printsreached), sosetup_a && setup_blets a failingsetup_afall through into the code under test with its preconditions unmet — which then surfaces as whichever later guard trips, asserting a cause that never occurred. Split such pairs into separate statements so each failure aborts with its own rc. Why: #7291 — a floor literal and anapt-get update && apt-get installboth shipped, the second producing a hard FAIL naming a deterministic fixture defect that had not happened. Seeknowledge-base/project/learnings/2026-08-16-every-number-i-inherited-was-stale-and-the-panel-found-the-defect-class-inside-my-fix.md. - A format captured from the LOCAL toolchain is a claim about a version that may not be the one that ships — diff the pin before depending on it. When a change makes parsing, matching, or a guard newly dependent on another tool's OUTPUT FORMAT (a runner's summary line, a CLI's table, a compiler's diagnostic), the captures are taken with whatever is installed here, and CI installs whatever the repo PINS. Check them against each other (
.bun-version/.nvmrc/.tool-versionsvs<tool> --version) and, if they differ, re-capture under the pinned version in a scratch install before merging — a format difference turns every CI run into the fail-closed branch, on a version you never observed. State in the artifact which versions the format was verified on, so the next reader knows the claim's scope. Why: #7466 — every byte capture, fixture and terminator claim was measured on bun 1.3.11 while CI installs 1.3.14 from.bun-version; verified identical only because the shard runner's preamble happened to print the mismatch. Do not let the discovery depend on that. - A claim lifted from an ISSUE COMMENT — including one you wrote earlier in the same session — is a precondition, not a source. Cite the run log, API field or
gh pr view --json mergedAtthat proves it, never the comment: a quick summary of a run written into an issue becomes "fact" for every artifact that copies it. Why: #8171 — a sweep whose purpose was retiring false sentences copied three from its own #8010 comment (a poll message that never printed, a replace run called the birth, an authoring date called the merge date); review caught all three against the logs. Seeknowledge-base/project/learnings/2026-09-14-the-sweep-that-retired-false-sentences-wrote-new-ones-from-my-own-issue-comment.md. - A plan's PASTE-READY prose is inherited sentences — before pasting one into a runbook, ADR or issue comment, falsify its LABELS and MECHANISMS, not only its numbers.
gh issue view N --json titleevery#Nthe sentence labels (the title is the label's falsifier), and for every "X refuses/drives Y" sentence read the code path and name the line that performs the transition. Why: #7695/PR #8314 — "#7761/#8019 gate fixes" (#7761 is the Doppler-name root-exec fix) and "G3.7 refuses into terminalaborted" (G3.7 exits before any write) reached ADR-100, the runbook and a posted issue comment; only the count was caught by the existing number-re-derivation reflex. Seeknowledge-base/project/learnings/2026-09-18-three-sentences-i-pasted-from-the-plan-were-inherited-not-measured.md. - A RESUME BRIEF's "measured" facts and "DONE" markers are preconditions, not findings — and a vendor error string is read from its resolved issue, not from memory. The brief is written by the session that did the work, so it carries that session's blind spots in the most authoritative form a claim can take. Re-derive each number from the run log it cites, diff each DONE item against
git diff origin/main...HEADbefore ticking it, and before interpreting a vendor errorgh issue list --state all -L 200 --search "<literal error>"and read the resolution. Why: #8178/PR #8262 — a "measured" 2m37s budget shortfall came from the NEXT host's row, four ticked items were unmet, and an addendum re-affirmed aCLUSTER_DOESNT_EXISTreading #7867 had retracted. Seeknowledge-base/project/learnings/2026-09-18-the-measured-facts-my-resume-brief-handed-me-were-the-defects.md. - Plan-quoted numbers are preconditions to verify, not facts. When the plan quotes a current measurement (
bun test … reports X,wc -c < AGENTS.md = N, "cumulative ~Y words; ~Z headroom",git ls-files | wc -l), re-run the measurement at soleur:work start before depending on it. Plans authored hours-or-days earlier observe a moving target; parallel branches landing inmaininvalidate the measurement. PR #3501 plan claimed~186 word headroomagainst an actual15and required inline trim of the gate description. Seeknowledge-base/project/learnings/2026-05-10-handshake-schema-drift-and-stale-precondition-budgets.md. - A code SHAPE a plan justifies by "the linter needs it" is a claim to measure in BOTH directions — run the linter on that shape WITH the guard deleted, and require RED. A shape measured only with the guard present passes either way, so the sentence that reads as a constraint can be the edit that removes it; and a lint cited as a "second oracle" for a guard is an oracle only if deleting the guard reddens it. Why: #7898 §2 (PR #8073) — the plan prescribed splitting
local method="$1" path="$2""so the classifier can seepath"; measured with the allowlist deleted, the SPLIT is what made the classifier stop requiring it, and the plan's two "linter re-flags this" mutation rows were vacuous for the shipped shapes (a derived_si_hostoperand and everyvar="$(curl …)"site are outside Rule D's destination limb). Seeknowledge-base/project/learnings/2026-09-11-the-linter-i-cited-as-my-oracle-passed-with-the-guard-deleted.md. - A remedy PROPOSED BY AN ISSUE is a claim to MEASURE, not a fix to apply — and a correct diagnosis is what makes the proposed fix go unchecked. The rule above re-derives plan-quoted numbers; this is the same discipline applied to a remedy. An issue's diagnosis and its suggested repair are independent claims, and when the diagnosis is obviously right (a reproduced P1, a named file:line), the repair inherits its credibility and nobody runs it. Before implementing an issue's prescribed fix, expand/execute it in the failing condition and confirm it changes the outcome — for a path/anchor/env remedy that means printing what it actually expands to on the target surface, not on yours. Why: #7442 — the issue correctly diagnosed CWD-relative producers executing a customer's same-named file, then proposed the token with a
:-default arm pointing at the repository'splugins/soleurdirectory; the variable is unset in bash, so the default arm expands to that CWD-relative path — the defect itself. Measuring the remedy (~30s) is what caught it, and the same PR then shipped an unmeasured safety claim about its replacement that review falsified. Seeknowledge-base/project/learnings/2026-08-11-i-measured-the-issues-remedy-then-asserted-my-own-without-measuring.md. - A plan premise you REFUTED is only refuted against the SHA you checked — re-check refutations after the ship-time rebase, not just re-derive counts. The stale-number rule above runs one direction (the plan claimed X, X has since changed); this is the inverse, and it is the one that reads as diligence: you verify a plan-asserted defect does not exist, correctly decline to file it, and a sibling PR merging mid-session then CREATES it. The rebase that brings siblings in is exactly the event that can manufacture the condition you ruled out, so a refutation recorded at Phase 0 is stale by Phase 5 on a fast-moving
main. Cheapest gate: re-run the refuting command after the final rebase for any premise you declined to act on. Why: #7160 — a deferral claiming scripts/test-all.sh carried a stale "21 suites" header was correctly refuted (no numeric suite claim existed anywhere in the file), and #7146 merged that exact line an hour later. Seeknowledge-base/project/learnings/2026-08-03-my-guards-error-channel-was-published-before-its-writers-ran.md. - Before concluding from a measured delta, state the harness's NOISE FLOOR and check the SIGN — a delta smaller than the noise is UNRESOLVED, never zero. Re-deriving a plan-quoted number (rule above) fixes staleness, not statistical power — and fixing the known flaw in a harness is exactly when the unexamined one ships: interleaving A/B arms removes drift bias but adds no resolution, so a "corrected" harness feels trustworthy while still noise-dominated. Two gates before any measurement-driven decision: (a) compute the run-to-run spread and compare it to the effect — if
|delta| < spread, report "this harness cannot resolve it" and measure the PRIMITIVE that changed instead (25 reps of the onecp/diff/parse has negligible variance where a whole-suite run does not); (b) ask whether the SIGN is physically possible — a result showing strictly-less-work as slower is a broken instrument, not a finding. When the decision is right for a non-timing reason (coverage, correctness, blast radius), justify it that way and drop the number entirely. Why: #7001 — a plan-mandated fast path was removed on a 5-pair whole-suite A/B reading 6.86s WITH vs 6.60s WITHOUT; the real effect is ~89ms against a ~±590ms (1σ) floor needing ~160 pairs, and the sign was impossible. The removal was correct on coverage grounds alone. Seeknowledge-base/project/learnings/2026-07-27-my-ab-could-not-resolve-the-effect-i-concluded-from-it.md. - Name both A/B arms literally and check one against
main— every other rigor check protects the SUBJECT of a measurement, and nothing protects its REFERENT. Interleaving, noise floors, sign checks and rep counts all interrogate how well you measured the two things you chose; none asks whether either is the status quo. When a change is built in stages the natural comparison is stage-N vs stage-N+1 ("do these excludes earn their place?"), which is a legitimate question whose number has the identical shape to the one a PR body actually claims ("is this better than today?"). Before reading any delta, write outarm A = <literal command>,arm B = <literal command>, and answer which one runs onmainright now; if the answer is "neither", the result can support a claim about a choice INSIDE the change and none about the change. The status-quo arm usually has to invoke the real thing (exec -a ugrep "$CLAUDE_BIN" …), not a reconstruction of its flags. Why: #7165 — a carefully-run interleaved benchmark (noise floor stated, cold rep excluded, sign checked, and it even corrected the plan's figure downward) compared new-without-excludes to new-with-excludes and shipped a 2.25x regression as a win; the three-arm re-run showed today 243 ms vs new 548 ms, with the dominant term the single-threaded-engine swap rather than the.gitignoreloss the spec blamed. Seeknowledge-base/project/learnings/2026-08-03-my-ab-had-the-wrong-baseline-arm-so-i-shipped-a-regression-as-a-win.md. - A bare
x="$(cmd)"; rc=$?capture is only correct where errexit is OFF — writerc=0; x="$(cmd)" || rc=$?, which holds underset -etoo; and a guard that reads a state's SYMPTOM (MERGE_HEADexists) is wrong in both directions against one that reads its CAUSE (git said rc 1): enumerate every state that produces the observation before acting on it. A bare assignment's status IS the substitution's, so under an errexit host shell the shell dies at the assignment before the failure branch runs — the defect being fixed, by another route. Why: #8339/PR #8378 — the rc-capture fix keyed its--aborton MERGE_HEAD presence (aborting a merge the operator started during the fetch window, rc 128) and misdescribed a rebase conflict as "not a conflict, nothing to abort"; three of nine review seats converged on the one gap. Seeknowledge-base/project/learnings/2026-09-19-the-fix-keyed-on-the-symptom-of-the-state-and-the-old-tags-were-never-notifications.md. - A plan-quoted tool-flag VALUE/UNIT is a claim to verify against the PINNED tool's source/
--help— the unit is the highest-risk part. When the plan names a CLI/config flag value (--postgres-conn-max-idle-time 30, a timeout, a size, a percent), resolve the pinned version and read that version's flag registration for type + unit + default + validation before writing it — a wrong unit (minutes/seconds/ms, bytes/KB, count/%) passes typecheck AND the binary's own validation, so only the source catches it. The plan is authoritative for intent (e.g. "drain idle conns fast"), never the literal value. Why: #6258 — the plan'sSECS=30for--postgres-conn-max-idle-timewas seconds-intent, but the inngest v1.19.4 flag is an IntFlag in MINUTES (default 5) →30= 30 min, defeating the drain; corrected to1. Seeknowledge-base/project/learnings/best-practices/2026-07-09-plan-quoted-tool-flag-value-and-unit-are-claims-verify-against-pinned-source.md. - A vendor error that CLEARS ON RE-RUN is two hypotheses, and one follow-up probe cannot separate them — read the response HEADERS before writing down "transient". Vendors retire APIs behind scheduled BROWNOUTS: the endpoint serves the error for a window on a recurring schedule and 200 the rest of the time, so a re-probe minutes later returns clean whether it was restored or merely outside the next window. Both readings fit and the reassuring one gets recorded. Capture headers on the failing call (
curl -D <file>, never body-only) and treat a deprecation/sunset header on a successful response as the durable signal — it is served on 200s too, which is the half that is always observable. Never retry a410: a retry long enough to swallow a brownout necessarily also masks the permanent post-sunset case the check exists to catch. Why: #7590 — a 2026-07-17 session re-probed a410, got a clean plan, and wrote "the 410 was transient" intoversions.tf; the endpoint had been deprecated since 2026-05-14 and the 410 carriedx-sentry-deprecation-date+x-sentry-replacement-endpointall along. Measured in BOTH states inside one session on 2026-08-19 — 410 at ~20:5x, 200/200/200 at 21:23, same token, same host, no change on our side. Seeknowledge-base/project/learnings/integration-issues/2026-08-19-a-vendor-brownout-is-not-a-flake-and-the-header-said-so-all-along.md. - Plan hypotheses about a symptom's mechanism (and its route/file classifications) are starting points, not the work-list — trace the ACTUAL producer before coding. For a symptom-named bug (a 404, an empty state), grep the literal producer (
notFound(), the404response, the empty-state component) and walk the redirect/call chain to the exact determining condition, confirming or falsifying each plan hypothesis against code. Code-tracing is a valid substitute for a plan-prescribed live repro when the repro needs hard-to-synthesize state. Verify route classifications by reading the route's exported HTTP methods (a "read route" with no GET is a write route). Why: #4543 follow-up — the plan's two 404 hypotheses + its "redirect lands on /dashboard" reconciliation were all wrong; a 4-file trace (invite-actions→settings/team/page.notFound()→ null-org resolver →accept-invitenever set active workspace) found the real cause. Seeknowledge-base/project/learnings/bug-fixes/2026-06-01-symptom-root-cause-trace-the-actual-redirect-not-the-plan-hypothesis.md. - A short-circuit guard that returns early to skip a code path must sit AFTER any recovery mechanism that lives inside that path. Before adding a "detect bad state → skip the expensive path → show a fallback" branch where the plan prescribes a placement, grep for where the recovery for that bad state actually runs; if recovery is entangled inside the path you're skipping, the early-return amputates it and dead-ends the user. An honest "X is gone" fallback is a post-recovery-failure concept — placing it pre-recovery makes the message a lie in exactly the recoverable case. The placement-time companion to "trace the ACTUAL producer". Why: #5240 — the plan's pre-dispatch
.gitprobe (FR2/FR3) would have skipped the in-dispatchensureWorkspaceRepoClonedself-heal, dead-ending connected-repo resume; reverted + descoped. Seeknowledge-base/project/learnings/best-practices/2026-06-14-short-circuit-guard-must-sit-after-the-recovery-it-gates.md. - A fail-loud/short-circuit guard for state-class X must not nest under a precondition that only holds for a DIFFERENT state class — and a self-noticed plan-vs-goal gap gets fixed at write-time, not deferred to review. When the plan nests "flag bad-state X and refuse to proceed" inside an enclosing gate you inherited from an adjacent branch (a staleness/age check, an auth check, a size check) that belongs to a different state class, the guard silently narrows to "refuse only when X also satisfies the unrelated gate" — undercutting the plan's own stated goal. Ask: does the enclosing condition belong to the SAME class the guard protects? If you notice the gap while coding, fix it inline (a ≤10-line correctness fix is not an architecture fork — reserve CTO routing for genuine forks); implementing the plan's literal placement and waiting for review to catch it is the wasteful path. Why: #5907 — the non-regular-lock
UNREMOVABLEemit was nested under the regular-lock staleness gate, so a fresh non-regularconfig.lockslipped straight into the doomedgit configEEXIST write; 3 review agents converged on a gap noticed at write-time. Seeknowledge-base/project/learnings/best-practices/2026-07-02-fail-loud-guard-must-not-nest-under-a-different-state-class-gate.md. - A RIDER recorded against a pending event is only as live as its VEHICLE — and a probe that measures delivery cannot tell "not yet" from "the vehicle already departed." When a change ships inert and its delivery is booked onto a future event (a host replace, a migration window, a cutover), the rider has TWO operands and every gate reliably watches only the change. Before reading a follow-through's
not_deliveredas "still waiting", re-check the vehicle:gh issue view <N> --json stateplus its closing comment, because a CLOSED ordered path is the signal the rider is spent, not the probe. Better, state the falsification condition when recording it ("if #N closes without this delivering, the rider is spent") so it is checkable rather than implicit. Corollary for the correction sweep afterwards: index by CLAIM, not by literal — three engineering-corpus literals returned 0 acrossknowledge-base/legal/and that zero was read as "not relevant", while the claim as the legal corpus phrases it returned 4; the same bound missed the ORIGIN text on punctuation alone (backticks around the command;INERT UNTIL PROVISIONED≠… A PROVISIONING), and correcting every paraphrase while leaving the origin standing makes the repo self-contradictory where it was merely stale. Why: #7455 — the rider rode a step-6 replace that had fired ~45h BEFORE the shipper merged, so the change sat inert on a host born before it existed and the probe would have reportednot_deliveredaccurately for the full 90-day horizon. Seeknowledge-base/project/learnings/2026-08-13-a-rider-is-only-valid-while-its-vehicle-is-still-pending.md. - On resume, a
session-state.md### Decisionsentry is INTENT, not an accomplishment — verify each against the live artifact before treating it as done. The section is written in the past tense by a session that was still mid-flight, so a decision reading "met the intent via a correcting comment on #N" / "filed the follow-up" / "re-titled the issue" records what the author RESOLVED to do, and the step is exactly what a mid-task death (API timeout, compaction, crash) leaves undone — the resume then inherits the claim without the act. Cheapest gate: for every Decisions line naming an outward-facing artifact, probe it (gh issue view N --json comments --jq '[.comments[]|select(.body|test("<cite>"))]|length',gh issue view N --json title,ls <path>) and re-open it in the task list on a zero. This is the outward-facing sibling of the artifact rule below (which covers FILES the contaminated session wrote); a GitHub comment leaves no working-tree trace at all, so nothing else surfaces its absence. Why: #6497 —session-state.mdrecorded a #6416 correcting comment as met;gh issue view 6416showed ZERO comments citing #6497, and the resumed session nearly shipped the claim in its PR body. Seeknowledge-base/project/learnings/2026-07-16-a-mutation-battery-only-covers-what-you-mutate.md. - On resume, prior-session artifacts are UNVERIFIED — not work-in-progress to extend. When
session-state.mddocuments that the originating session's tool layer was contaminated/degraded (batched output, warnings prepended toReadresults), the contamination taints every FILE that session wrote, not just the status claims it retracted ("applied"/"GREEN"). Re-derive each artifact from its authoritative source: read the real migration/file it claims to mirror and rewrite it as a verbatim delta (diff to prove byte-identity), then re-establish status from scratch (apply + verify the live DB; re-run RED→GREEN). For SQL, a misreadRETURNStype is a free tripwire —CREATE OR REPLACEcannot change a function's return type, so any "applied GREEN" against a return-type-changed body is self-evidently false. Why: #4709 — 089 was authored against a misread of 088 (RETURNS voidvsinteger, dropped NULL-auth + 22023 gates); caught only by reading the real 088 body. Seeknowledge-base/project/learnings/2026-06-01-resumed-session-artifacts-from-contaminated-tool-layer-are-unverified.md. - Counts written into the artifact (workflow header, script comment, AC expected-N) must be derived from the as-written file, not from plan-prose estimates. Plan §Phase X says "~40 resources after expansion" → soleur:work runs the grep → the actual count goes into the workflow header comment AND into AC4's expected N. Cheapest gate: after writing the artifact, re-run the canonical count command against the as-written file (
grep -cE '^[[:space:]]+-target=' <workflow>,wc -l <list>, etc.) and copy the integer into every comment/AC reference. Plan-prose mental tallies drift by ±1-2 during expansion; multi-agent review reliably catches it (P3 polish) but the inline grep at write-time is free. Why: PR #4122 — workflow header carried "68 explicit targets" from plan §Phase 0.3 mental tally whilegrepreturned 67; caught bysoleur:engineering:review:code-quality-analyst+soleur:engineering:review:pattern-recognition-specialistat review. Seeknowledge-base/project/learnings/best-practices/2026-05-20-plan-time-pr-vs-issue-disambiguation-and-self-derived-counts.md. - Re-running the count is necessary but NOT sufficient — publish the COMMAND next to the number, because a prose predicate does not pin a count. Stating the filter ("N sites, where site =
<predicate>") reads like rigour and is not: the prose leaves per-line-vs-per-match, unique-vs-all, marker position, and language-correct-markers free, each worth 10–30%. A number pinned to prose rots exactly like a citation pinned to a line number — both name a referent without fixing it — so the fix is the same: anchor on content (the command), not on a description. If the figure is load-bearing, also show the conclusion survives the plausible range. Why: #6517/PR #6527 — a reviewer measured and adopted "403, where site = a line in a code file bearing a comment marker AND citing<path>.<src-ext>:<N>" as canonical; at soleur:work, 18 faithful readings of that exact prose returned 319–583 and never 403 (two independent resolvers also disagreed on the sibling counts). Shipped as~360+ agit grep … | wc -l; the conclusion was invariant across the whole range (0.17–0.31%), which is why the false precision survived a 5-agent panel — nothing depended on it. Seeknowledge-base/project/learnings/2026-07-16-advisory-first-precedent-is-a-claim-to-measure-and-a-coordinate-citation-carries-no-claim.mdSession Errors #3. - An AC recorded as "run separately" / "run at ship" is UNMET, not deferred — run the shard before Phase 2 exits. Repo-wide lints (
lint-shell-trace-credential-refusal,lint-trap-tempfile-ownership, …) live in thescriptsshard and read every file, so a hook or test file added under.claude/hooks/is in their corpus even though no unit suite names it. Why: PR #8354 — AC12 (TEST_GROUP=scripts) was left as "run separately"; the ship battery then went red on a variable namedS_PAT(read as a credential) and amktempwithout an owning trap, costing a fix commit, a main re-merge and a second CI cycle at the last gate. - Verify an AC by running its LITERAL command — a normalized variant verifies a different, weaker claim. When self-checking acceptance criteria, it is natural to "helpfully" widen the plan's grep (add
-i, alternate a second spelling, swap a space for.), and the widened form is a DIFFERENT predicate: it can pass while the AC's own bytes fail. The AC is the contract and the plan-quoted command is part of it, so paste it verbatim; if it fails, fix the artifact or amend the AC explicitly — never quietly satisfy a looser one. Same family ascq-assert-anchor-not-bare-token(anchor on what is actually asserted) and the plan-quoted-number rule above (re-derive, don't restate). Why: #6178/PR #6933 — AC9'sgrep -c 'function discovery'was self-reported satisfied after runninggrep -c 'function.discovery\|FUNCTION-DISCOVERY'; the literal command returned 0, and a checkedtasks.mdline already claimed every AC baseline had been re-confirmed. Seeknowledge-base/project/learnings/2026-07-25-i-added-the-field-that-closes-the-gap-and-nothing-read-it.md. - Discrete-enumeration re-lockstep (when applicable). When the plan asserts paraphrased lockstep across discretely-enumerated documents — e.g., "files in lockstep at sections (a)-(N)", "all 7 entries match in both files", "list is (i) through (v) on both sides" — run a fresh
grep -cE '^- \*\*\([a-z]\)\*\* '(or equivalent, using[a-z]NOT[a-N]) across each file BEFORE the first letter-inserting Edit. Counts AND letter-sets must match; anything else means the plan's lockstep claim is paraphrase-from-stale-read. PR #3755 (#3708): plan asserted DPD §(a)-(k) lockstep; canonical actually had §(l) DSAR; AC1 caught the §(l) collision but the cheaper gate is re-lockstep at soleur:work-start. Seeknowledge-base/project/learnings/2026-05-14-discrete-enumeration-relockstep-and-pr-introduced-asymmetry.md. - Sequential-section insertion anchor. When inserting a new
### N.M-numbered section, the Edit anchor MUST target the LAST### N.Mblock before the desired slot (not the lexically-adjacent one). Confirm withgrep -nE '^### [0-9]+\.[0-9]+ ' <file> | tail -3; the newMmust be greater than the picked anchor'sM. PR #3755 (#3708): §5.10 was anchored on §5.9-Resend's block start and landed BEFORE §5.9. One-grep prevention. Same learning file. - Write-boundary sentinel sweep (when applicable). If the plan introduces a sentinel/guard that asserts a property at write sites (e.g.,
assertWriteScopefor cross-tenant integrity, GDPR write-boundary checks), enumerate ALL write sites where the property applies — not just diff sites. Rungit grep -nE '\.from\("<table>"\)\.insert\(' <scope>(or the equivalent for the boundary type) at Phase 0 and verify every match is sentinel-gated, then file follow-up tasks for any uncovered sites BEFORE entering Phase 1. Seeknowledge-base/project/learnings/2026-05-12-type-widening-cascades-and-write-boundary-sentinels.md; hard rulehr-write-boundary-sentinel-sweep-all-write-sites. Why: PR-A2 #3603 — sentinel placed at assistant-row write but not user-row write atcc-dispatcher.ts:1008; same service-role-bypass surface. - Type-widening cross-consumer grep (when applicable). When the PR widens a producer-side shared type whose payload crosses an
unknown/any/jsonb boundary (compiler cannot enforce optionality at the consumer),git grep -nE '<field-name-pattern>' apps/across every consumer and verify each respects the new optionality. ForMessage-class fields the canonical grep isgit grep -nE '\bmessage\.usage\.(input_tokens|output_tokens|completed_actions)\b' apps/(adapt per field family). See learning2026-05-12-type-widening-cascades-and-write-boundary-sentinels.md; hard rulehr-type-widening-cross-consumer-grep. Why: PR-A2 #3603. - Id-shape/format-guard fixture blast-radius (when applicable). When the PR adds a shape/format guard (UUID allowlist, regex, length check) to an id that is DB-sourced AND flows through a shared resolver (
workspacePathForWorkspaceId, an active-workspace resolver, anyjoin(root, id)path builder), the guard THROWS on every test fixture that fabricated that id with a short non-UUID literal. Before sizing the change as "1 file", grep the fixture surface —git grep -nE '"(user-1|ws-[A-Za-z0-9]|owner-[A-Z]|[a-z]+-workspace)"' apps/web-platform/test/— and trace which hits reach the guarded function; size the fixture sweep at plan time, not at GREEN. The fix is realistic UUID fixtures (cq-test-fixtures-synthesized-only), never a looser guard. Why: #5344 — a "1 source + 1 test file" estimate broke ~34 fixture files. Seeknowledge-base/project/learnings/2026-06-15-id-shape-guard-test-fixture-blast-radius-and-syntactic-sast.md. - A PATH-shimmed fake that dispatches on
$1only puts the fixture seam ABOVE the code under test — assert the argv the SUT must send. When a suite stubs an external CLI (docker,gh,psql,curl), a stub that returns a fixture regardless of--filter/--format/subcommand cannot detect the SUT querying the WRONG thing, so the query shape ships unpinned: measured, switching a gate from.NetworkSettings.Portsto.HostConfig.PortBindingsand corrupting its label selector (so it matched zero rows and passed forever) BOTH left a 12/12 suite green. Make the fakeexit 64on a missing required flag, and key multi-entity output per id (FIXTURE_<id>) so an early-breakis detectable — a fake that answers identically for every entity makes "one clean, one dirty" fixtures impossible..claude/hooks/stub-argv-fidelity.test.shcodifies this class but scopes to.claude/hooks/withSTUB_CMDS="gh|jq|git", so a stub elsewhere is unguarded. Why: #7081 — 11 of 17 mutations survived. Seeknowledge-base/project/learnings/2026-07-30-every-green-signal-i-had-certified-a-gate-with-six-fail-open-paths.md. The same seam also sits above every property the VENDOR validates, so an external-API client needs one verification on the REAL request path. The rule above pins the argv the SUT sends; this is the half nothing local can reach. A fake that answers regardless of the request cannot observe request ENCODING, parameter FORMAT, header shape or auth form — and a mutation battery cannot either, because it perturbs the SUT and then scores it THROUGH that same fake, so every row is judged by an oracle blind to the class. Exercise the real path once, end to end, with the CLIENT's own argument construction; probing the endpoint with hand-written arguments probes the endpoint. Then teach the stub to reject what the vendor rejects, one exit code per contract violation. Why: #7706 —to_isoemitted a timestamp with no timezone designator, which the vendor answers with HTTP 400 on EVERY ref, window and source, so the tool could not complete one live query; green through 3 suites, 2 batteries reporting no survivors, 12 review agents, shellcheck and actionlint, and the plan's own live probes missed it because a hand-written curl carries theZby reflex. Seeknowledge-base/project/learnings/test-failures/2026-09-02-my-fake-curl-put-the-seam-above-everything-the-vendor-validates.md. And a PATH shim must resolve the real binary to an ABSOLUTE path BEFORE mutating PATH, with its unwind in atry/finally, not apromise.finally(). A shim thatexecs the tool by NAME re-enters itself — PATH still has the shim dir first — and recurses until the runner's timeout; the damage is not the failing row but that a test-framework timeout rejects the promise WITHOUT running a.finally()handler, so the PATH pollution outlives the row and every later test in the file inherits it. Measured (#8427): four unrelated must-PASS rows timed out at 16 s each, which reads as four regressions rather than one harness defect. - A finding names an INSTANCE; the fix is scoped to the CLASS — enumerate all sites {A,B,C} BEFORE writing it. When a review finding says "X can be added at site A", the work is not "fix A". It is: name the property X violates, enumerate every site that can reach the same sink, THEN fix. Record the enumeration AND the command that produced it (
git grep -nE '<syntactic anchor>', a directory walk, the array's own definition) — a remembered list is a snapshot, and the next one-line edit invalidates it. A mutation protocol validates a FIX; it never tells you the fix's POPULATION is right — this is the trap, because the protocol feels like the rigorous part and it is orthogonal to scope. Two tells that the population is wrong: (a) the fix lives INSIDE an array/window/branch while the sink is reachable from outside it; (b) you can describe the fix as "at site A" rather than "at every site that reaches S". Why: the preflight Check 10 work (merged 2026-08-10) — the/homere-bind was fixed insideBWRAP_ARGSand validated FOUR ways; three more mount-injection entry points existed outside that array (GIT_BIND,BWRAP_PROC, the exec line), and three separate one-line edits each re-opened the operator's credential surface with the whole suite green, verified against live bwrap reaching the Doppler token,~/.sshand the gh token store. Five review rounds each found a different instance of that one unperformed enumeration. Seeknowledge-base/project/learnings/2026-08-10-a-guard-that-cannot-be-driven-red-is-vacuous-four-rounds-four-instances.md. When the deliverable is itself a guard, the plan's## Guard Contract(plan Phase 2.12) already names the assembly — implement against THAT, not against the finding's example site. - Sweep-class fixes use grep-enumerated work-lists, not intuited ones. When a plan declares a multi-file sweep with a verification grep (e.g., AC5-style
git grep -nE '<pattern>' <scope> | grep -vE '<safe-form>' | wc -l = 0), run the grep ONCE at Phase 0 to enumerate the authoritative work-list (capture it viatargets="$(mktemp -d -t soleur-run.$$.XXXXXXXX)/t"and write the hits there — never a fixed/tmpname a sibling session would clobber), fix each line, then re-run the grep after each batch. The plan's narrative enumeration of "files X, Y, Z" is a starting hypothesis; the grep result is the work-list. Same applies to regex widenings: enumerate the configs/verbs/paths invoked by the IN-SCOPE runbooks, not the configs the incident occurred against — the incident is one data point; the trap-class config-set is the full union of every config the runbooks touch. Why: PR #4031 — initial sweep handled 9 named runbook hits but missed 2 buried in deeper sections of the same files; widened regex covered(prd|prd_terraform|dev|ci)per the plan's leak-footprint enumeration but missedprd_orchestrationwhich 2 in-scope runbooks operate against. Pattern-recognition + soleur:engineering:review:security-sentinel caught both at multi-agent review. Seeknowledge-base/project/learnings/best-practices/2026-05-18-sweep-class-fixes-grep-enumerated-not-intuited.md. - A plan-derived ANCHOR LIST ("keep these lines — a test asserts them") is a claim per line, not a fact — verify each by deleting it and running its cited consumer. A regex cross-reference of test literals against source lines false-positives on any literal a test uses for another purpose: a mutation REPLACEMENT string, a step NAME asserted from YAML, a fixture value. Two of 14 "kept" lines in #8361 were exactly that, and shipped as orphaned fragments until review mutation-checked them. Deleting the line on a copy and running the cited suite is a 30-second check per line; do it before committing, never after. See
knowledge-base/project/learnings/2026-09-19-a-sibling-merge-took-the-apply-workflow-over-githubs-byte-limit-and-nothing-in-repo-said-so.md. - A plan-prescribed cross-file drift guard ("all N files reference all M tokens") must be verified against each file's ACTUAL token usage before writing the assertion. A family of parsers is rarely homogeneous — a secondary member often shares only a subset (e.g. a wipe-gate that checks only
--postgres-uriand never parses redis). Rungrep -cF -- "$tok" "$file"for every (file, token) pair at Phase 0 and let the matrix define the per-file token set; asserting the full set on a file that uses a subset false-fails a correct codebase. The plan is authoritative for the guard's intent, never its exact token/file set (same class ashr-when-a-plan-specifies-relative-paths-e-g). Corollary: plan-quoted AC verify commands are preconditions to re-derive, not facts — agit diff origin/main | grep -c 'ssh 'proxy false-positives on self-referential prose + branch-divergence in cited-but-unedited files; scope it to the changed code files. Why: #5553 — the drift-guard spec required 4 tokens on all 3 ExecStart parsers, butinngest-wiped-volume-verify.shreferences only 2; scoped per-file at soleur:work. Seeknowledge-base/project/learnings/best-practices/2026-06-18-cross-file-drift-guard-verify-per-file-token-usage.md. - When you write a conditional gate in PROSE, every rung must end in an action and the safe branch must be reachable by READING, not by remembering. Three checks, because the failure is silent: (a) a rung ending in a classification ("that is the uncertain case") prescribes nothing, so the reader falls through to the document's default — end every rung in an executable verb and say so in the ladder's preamble; (b) the fail-safe sentence's predicate must be the UNION of what each rung can leave undetermined, or it reads as not firing for the case that actually reached it; (c) state the condition FIRST at each prescription site — a relaxed imperative with a parenthetical pointer to the conditional several hundred lines away makes the safe outcome depend on the reader following a link they have no reason to follow. Why: #7352 — a two-rung check for whether a project has a CI-enforced gate answered YES at rung 1, undeterminable at rung 2, took no branch, and handed self-hosted users the relaxed path the design forbade reaching by assumption. See
knowledge-base/project/learnings/2026-08-12-my-ladder-rung-ended-in-a-label-so-it-fell-through-to-the-unsafe-branch.md. - A plan's own
## BLOCKINGsection is a WORK-LIST, not context — check each finding off against the diff before review, and do not trust a subagent's summary for what that list contains. Two failures compose here and both are cheap to prevent. (a) The findings a plan marks blocking are written before implementation and read during it, so they are exactly the items an implementer treats as already-absorbed background; grep the plan for its blocking identifiers at Phase 0 and record a disposition per identifier, because "I read that section" is not a disposition. (b) A planning subagent's Session Summary is a CLAIM ABOUT A FILE — verify every identifier it cites exists in the artifact, since a summary that invents or renames findings sends you to check things that do not exist while the real ones go unchecked. Why: #7569 — the plan named F14/F15/F16/F18 as blocking, the summary reportedF2/F4/F7(none of which exist), and F15 — an unanchored--grepletting one row that merely QUOTED a marker suppress the alarm indefinitely — shipped unimplemented into review, which rediscovered it independently. Seeknowledge-base/project/learnings/2026-08-17-an-empty-read-is-three-states-and-my-guard-shipped-two-fail-opens.md. - When a gate cannot use the obvious discriminator, the replacement is probably a PROXY — name the property before you write the predicate. The shape recurs whenever a plan says "X cannot tell these apart" (an ack that sees identical counts, a status code shared by several outcomes, a timestamp that moves for two reasons): the fix reaches for a field that correlates with the hazard, and a proxy fails in both directions. It misses the hazard when the proxy reads clean for a legitimate reason, and it fires when the proxy is absent for a legitimate reason — the second landing on post-partial-failure states, which are exactly the states with no fixture. Write the property as one sentence first ("no two addresses at this name"), then check the predicate expresses THAT; and enumerate the system's states including after a half-completed operation, saying what the guard reports in each. A guard that blocks a state you would need to recover from is a defect even if nobody has reached it. Why: #7640 PR4b — see
knowledge-base/project/learnings/2026-09-03-my-guard-blocked-the-recovery-and-missed-the-hazard.md. - Technical rulings route to the CTO agent (legal posture: the CLO), NEVER the operator (HARD GATE — both modes). An architecture fork (the plan's mechanism blocked or contradicted by the code, traced from the ACTUAL producer), threshold or evidence bar, design A-vs-B, status flip or legal-posture call: spawn
soleur:engineering:cto(soleur:legal:clo) with the evidence (file:line), the options and "do NOT use AskUserQuestion", implement exactly what it returns, recordRuled by CTO agent(an ADR for an architecture decision); a "surface it, do not decide it" brief changes nothing technical. Operator-only list: technical-ruling-delegation.md. Why: #5325, #7347 — forks and legal calls were first offered to the operator. - Verify that every BINDING item LANDED — a prohibition sweep cannot detect an omission (HARD GATE). When a plan, review, or amendment list marks items binding, the post-implementation check must assert each one positively (grep the artifact for the thing that had to appear), not merely assert that forbidden things are absent. The two sweeps feel interchangeable and are not: "don't touch X / don't assert Y / don't publish Z" can pass 6-for-6 while a required edit was silently dropped, because nothing in a negative predicate quantifies over the obligations. Build the check from the binding list itself — one
grepper item, output the item id next to a hit/miss — and treat any miss as blocking. Applies with equal force when the implementation was delegated: the delegate's report names what it did, never what it forgot. Why: #7347 — a 6/6-green prohibition sweep (T&C untouched, §3.1(b)/(d) unasserted, "eleven processing activities" unchanged, no PR refs, pre-existing drift untouched, no forbidden term-classes) shipped a diff that had silently dropped two amendments recorded as binding by the PR's own plan review, plus a third closed-list fix applied in one document and not its sibling. Same learning file. - A delegation brief that hands over CONTENT without PLACEMENT delegates the placement decision — and bound the delegate's read scope or it stalls. Two halves of one lesson about brief shape, both measured on the same corpus in one session. (a) Per-site, not per-string. A brief supplying N fixed strings plus a list of target files leaves "which sentence goes in which section" to the delegate, and template-pasting is the predictable result — a section-scoped sentence lands in sections that are not in that scope, which on a published document is a false statement rather than a style nit. Label every block with target file + section + whether the mirror/sibling takes the same change; generate the site list FROM the binding-items list rather than restating it, or the two disagree and nothing compares them. (b) Bound the read scope. "Read all N target files, then edit" is the shape that hits the stream watchdog; scope the delegate to one document at a time, its own blocks only, with a commit after each, so a stall costs one unit rather than the run. Prefer resume over respawn when one does stall — a resume keeps the transcript. Why: #7347 — round 1 (ten strings, no placement) produced 10 P1s, 6-7 of them greps, and cost a four-agent panel plus a full re-implementation; round 2 (14 blocks, each labelled file + section + mirror) applied cleanly, and its only deviations were contract bugs rather than placement errors. Two subagents stalled on the wide-read shape. See
knowledge-base/project/learnings/2026-08-09-three-green-gates-and-the-published-page-was-still-wrong.md. - Emergent PRODUCT/SCOPE/PREFERENCE decisions classify via the taxonomy, and headless never pauses on them. For a mid-work decision that is NOT an architecture fork (those route to the CTO agent, above) — dropping/deferring operator-requested scope, a user-visible behavior choice, a money/compliance call — classify it Mechanical / Taste(user-legible) / User-Challenge per decision-principles.md (ADR-084). Mechanical + technical-taste: auto-decide silently. A user-legible Taste or a User-Challenge (both against the operator's stated direction) in a headless/one-shot run: keep the operator's stated direction as the default and persist it to
knowledge-base/project/specs/<branch>/decision-challenges.md(append, one Decision Classes row; alongsidesession-state.md) — never a mid-pipeline pause.shipPhase 6 renders that artifact into the PR body and files theaction-requiredissue the operator actually sees. The one exception to no-pause: a security/feasibility regression halts terminally before merge (see the reference doc). - A composite read fails as its WEAKEST arm, and a verdict must never rest on an instrument that was not shown to work. When a query
UNIONs two sources (or a check ANDs two probes), verify each answers INDEPENDENTLY before relying on the pair: aUNION ALLover a healthy arm and an absent one fails entirely, so the read errors on every attempt regardless of the data — and if the loop only inspects results whenrc == 0, "the read failed" becomes indistinguishable from "the read found nothing". The damage is downstream: the code then consults a CONTROL source, which is a DIFFERENT table whose health licenses nothing about yours, and emits a substantive verdict off a query that never ran. Track whether the read ever succeeded, report UNKNOWN when it did not, and carry the transport error so the next reader does not re-derive it. Why: #7855 — a round-trip probe's readback UNIONed an archive arm whose named collection does not exist for that source (669, measured), so it failed on every poll and the probe posted a public vendor data-loss accusation off it; the same PR's own header claimed the opposite behaviour. Seeknowledge-base/project/learnings/security-issues/2026-09-06-the-file-i-added-to-fix-a-p1-shipped-a-p1.md. - A workflow
run:body the diff adds or rewrites is a CODE PATH with zero behavioural rows unless you give it some — grep-shaped ACs pin its spelling, not its decisions. Extract the body with PyYAML, execute it under the runner's shell (bash --noprofile --norc -eo pipefail) with a stubbedgh, and pin what each arm DECIDES; precedentplugins/soleur/test/registry-host-replace-dispatch-verdict.test.sh. And when a test stub dispatches on ONE axis of the request (which SHA) and ignores the others (which range, which path), every wrong request reads the right fixture — make the stub refuse a request it did not expect (STUB_EXPECT_*+ exit 64), and red the row on any stub-miss line in stderr. Why: #8279/PR #8355 — the review P1 (an "unchanged since the watermark" sentence keyed onprs=instead ofcommits=) was the only untested path, and five URL-construction mutants survived a 98-row suite. Seeknowledge-base/project/learnings/2026-09-19-the-one-defect-lived-in-the-only-code-path-with-no-test-and-my-stub-answered-every-question.md. - Interactive mode only: If anything is unclear or ambiguous, ask clarifying questions now. Get user approval to proceed. Do not skip this - better to ask questions now than build the wrong thing.
- Pipeline mode: Skip clarifying questions and approval. Proceed directly to step 2.
- 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):
- Interactive mode only: Ask: "Continue working on
[current_branch], or create a new branch?" - Pipeline mode: Continue on current branch without asking.
- If continuing, proceed to step 3
- If creating new, follow the worktree creation instructions below
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).
- Create Todo List (TDD-First Structure)
Structure tasks as RED/GREEN/REFACTOR units, not as "implement everything, then test":
- For each feature requirement with Acceptance Criteria or testable behavior:
- Create a RED task: "RED(unit|integration|e2e|property): Write failing test for [feature]" — layer in title;
property=generated-input contract test (property-testing);e2etests carrypyramid-justified:or a## Test Pyramidblock - Create a GREEN task: "Implement [feature] to pass tests" — blocked by its RED task
- Group these as a TDD unit with
blockedBydependency (GREEN blocked by RED) - Infrastructure-only tasks (config files, CI, scaffolding, legal docs) are exempt from RED/GREEN pairing — create them as standalone tasks
- Place a final test-and-lint task at the end, blocked by all other tasks. If the project has no CI-enforced full-suite gate on the merge branch, make it "Run the full test suite and lint" — see Full-suite fallback in Phase 2 §9, and when in doubt this is the branch you take. Otherwise "Run the touched-file suites and lint".
- Keep tasks specific and completable
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.
- 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?"
- If yes (interactive mode): offer Tier 0 to the user
- If yes (pipeline mode): auto-select Tier 0 without prompting
- If declined or ineligible: fall through to Step 1 below
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.
- 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):
- Mark task as in_progress in TodoWrite
- Read any referenced files from the plan
- If task creates UI/pages: verify implementation brief exists (HARD GATE)
- TDD GATE: (see below)
- Look for similar patterns in codebase
- RED: Write failing test(s) for this task's acceptance criteria
- GREEN: Write minimum code to make the test(s) pass
- REFACTOR: Improve code while keeping tests green
- Run the touched-file suites after changes — full suite instead if the project has no CI-enforced merge gate; see Full-suite fallback in Phase 2 §9
- Mark task as completed in TodoWrite
- Mark off the corresponding checkbox in the plan file ([ ] → [x])
- Evaluate for incremental commit (see below)
```
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:
- Supabase migrations +
cron.jobqueries + Storage bucket
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