feat(linkedin-studio): N14 — foldIns-fangst + Step 11 retro + background-headless + språkregel-akkumulering [skip-docs]

Lukker sløyfen pluginen manglet: en rettelse operatøren gjør i utgave N
håndheves i N+1 i stedet for å bli gjenoppdaget. Maskineriet fantes
(foldIns-skjema + promote→ratify siden fix #1); det som manglet var wiring —
ingenting skrev til køen og ingen fase tømte den.

- Fangst (A2-F7): Steps 2.5/3a/5.5/6.5 appender rettelsen ordrett med trigger,
  decision "pending". Ubetinget og bevisst dum — å avgjøre ved fangst om noe
  "fortjener" en regel er nettopp slik køen holder seg tom og sløyfen dør.
- Step 11 retro (A2-F8), ≤5 min ETTER scheduling: promoter køen med eksplisitt
  JA/NEI (mekanisk → atomisk contract-gate-promotering, teller kun med grønn
  --ratify; dømmekraft → operatørens språkregelfil; NEI → rejected, beholdes),
  effort-oppsummering fra MÅLT phaseLog (aldri re-estimert), og ÉN
  friksjons-spørring som besvares tilbake til operatøren. Faser 18 → 19;
  resumption-tabellen ruter scheduling → Step 11, retro → complete.
- articles.NN.retro: additiv-valgfri (default null), schemaVersion forblir 1.
- Background-headless (A2-F6): --background kjører pakken i en bakgrunnsagent
  som skriver rapporten til disk; drafting-sesjonen leser fila. Samme isolasjon
  som fersk sesjon, uten copy-paste-sømmen. Inline fan-out = eksplisitt fallback.
- Språkregler (C-10): ${DATA}/language-rules/<lang>.md (opt-in, template).
  Leses TO ganger — av language-reviewer (fanger) og av Step 4 (forebygger).
  Shippet banliste forblir baseline; brukerfila utvider.
- references/fold-in-loop.md (A2-F9): loopen dokumentert domene-generelt in-tree,
  så en adopter uten ekstern skrivekontrakt har hele sløyfen. Refs 28 → 29.

Suiter (alle grønne): test-runner 197 → 217 (Section 16u: 18 ubetingede greps +
non-vacuity self-test; fase-sveip 16 → 17 faser; floor 179 → 198) · hooks 174 ·
trends 300 · brain 134 · editions 72 · specifics-bank 45 · contract-gate 33 ·
tests 35 · render 60.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01QxvWAjte7vPcF79QeSRvRJ
This commit is contained in:
Kjell Tore Guttormsen 2026-07-25 12:39:16 +02:00
commit f0532dce3f
9 changed files with 711 additions and 30 deletions

View file

@ -61,12 +61,19 @@ They get **NOTHING** about: prior versions or version numbers, what was
deliberately omitted, the pivot narrative, who has read it, what an editor said,
how a persona voted, or what the author intended. Two layers enforce this:
1. **Layer 1 — fresh session (strongest).** For the publish-ready gate, the
operator runs *this command in a brand-new Claude Code session*. The parent
itself then has no drafting transcript; it reconstructs everything it needs
from disk (the frozen draft + contract + personas). This is the recommended
path and the one KTG asked for.
2. **Layer 2 — subagent isolation.** Each archetype is a `Task` subagent, which
1. **Layer 1 — fresh session (strongest, manual).** The operator runs *this
command in a brand-new Claude Code session*. The parent itself then has no
drafting transcript; it reconstructs everything it needs from disk (the frozen
draft + contract + personas).
2. **Layer 1b — background run (`--background`, equal isolation, no seam).** The
drafting session spawns this package as a **background agent** with its own
context window, which writes the consolidated report to a file; the drafting
session then reads that file from disk. The background agent gets only the
cold-contract inputs — it cannot see the parent's transcript — so the
isolation matches a fresh session, with **no copy-paste** of the report back
into the drafting session and no manual session switch. See "Background run"
below. This is the default recommendation for the Step 6.5 gate.
3. **Layer 2 — subagent isolation.** Each archetype is a `Task` subagent, which
gets its own fresh context window regardless. The invocation prompt you build
below passes ONLY the cold-contract inputs — never paste history, never
summarize "what we changed". If you find yourself about to tell a reviewer
@ -91,11 +98,33 @@ how a persona voted, or what the author intended. Two layers enforce this:
--persona <name> (persona modes only; default: the primær)
--article NN (optional; persist into edition-state.json)
--output <path> (default: <serie>/review/NN-headless-<stamp>.md)
--background (run the package in a background agent
that writes --output; caller reads the file)
```
No `--type` (or `--type all`) runs the **whole package in parallel**. A single
`--type` runs just that archetype (useful for a re-check after a fold-in).
### Background run (`--background`)
With `--background`, do **not** fan the archetypes out here. Spawn **one**
background agent that runs Steps 15 of this command itself, and let it write the
report:
- Launch it with `run_in_background: true` and a prompt carrying **only** the
cold-contract inputs — draft path, contract path, persona names + block path,
`--type`, and the absolute `--output` path — plus the instruction to write the
consolidated report to `--output` and return that path.
- **Never** put drafting history, version notes, or "what we changed" in that
prompt. The background agent has its own context window; the only way session
framing reaches it is if you type it in.
- When it completes, `Read` the report at `--output` and continue at Step 5
(surface + persist). The drafting session sees the *report*, not the reviewers'
reasoning, and the reviewers never see the drafting session — the same
independence a fresh session gives, with **no copy-paste seam** between them.
- If background execution is unavailable, say so plainly and fall back to the
inline fan-out (Step 3) — never silently downgrade the isolation.
## Step 1 — Resolve inputs (from disk, not from memory)
1. **Draft.** Use `--draft`. It must be a long-form draft `.md` (the same
@ -219,18 +248,20 @@ Headless review complete (COLD).
- Archetypes: <N> run in parallel converged flags: <N>
- BLOCK/🔴: <N> REWORK: <N> primær resonance: JA/NEI conversion: JA/NEI
- Report: <serie>/review/NN-headless-<stamp>.md (surfaced via SendUserFile)
- Isolation: background agent (report read from disk) | fresh session | inline fan-out (fallback)
- Persisted: edition-state.json articles.NN.headlessReview (or: standalone, not persisted)
Operator gates the fold-in. For maximum independence, run this command in a FRESH session.
Operator gates the fold-in. For maximum independence with no manual seam, run with --background.
```
## Relationship to the pipeline + the in-session gates
- **Step 6.5 of `/linkedin:newsletter`** invokes this same package (after the
in-session persona sweep Step 6, before lock Step 8). The pipeline may fan the
reviewers out inline, but the **strongest** isolation is the operator running
`/linkedin:headless-review` in a fresh session and pasting the consolidated
report back. Either way the body must be re-touched **before** lock — never
reopen a locked text (the cardinal Seres lesson).
reviewers out inline, but the recommended path is `--background`: full
isolation, the report read from disk, and no manual step between the review and
the fold-in. A fresh session remains available and is equally cold. Either way
the body must be re-touched **before** lock — never reopen a locked text (the
cardinal Seres lesson).
- **Deliberate redundancy.** `fact-reviewer` overlaps `fact-checker` (Step 5) and
`language-reviewer` overlaps `editorial-reviewer`'s prose axis (Step 5.5) **on
purpose**. The in-session gates ran with framing-bias; the cold re-read catches