feat(linkedin-studio): N15 — do-next-kontrakt (recordDoNext + skrivere/lesere + forrige-utgave-kalibrering) [skip-docs]

Måling som ikke endrer neste utgave er teater: report/analyze/ab-test/48h-monitor
endte alle i chat (grep do.next = 0 i hele repoet). N15 gjør kanalen til en kontrakt.

- recordDoNext i hooks/scripts/state-updater.mjs (TDD, 17 nye tester): seksjonen
  Do-Next Directives, rader "[dato] (kilde) direktiv — evidence: peker".
  Levetid = erstatt-per-kilde + 60-dagers aldersgulv, maks 3 per skriv, additiv
  scalar last_donext_date, $-sikre replacement-funksjoner. CLI: --record-do-next.
- Skrivere: report Step 7b, analyze Step 6b, ab-test 2c.6 (kun Adopt),
  post-feedback-monitor (kun 48h-sjekken); analytics-interpreter emitterer nå
  anbefalinger på do-next-form (imperativ + evidens).
- Lesere: post/quick/batch/create Step 0 + newsletter Step 1, som i tillegg
  kalibrerer på forrige utgaves MÅLTE tall via queue-id-match (queue.json →
  analytics/posts) med eksplisitt honest-miss — aldri estimert.
- Guards: test-runner Section 16v (15 ubetingede sjekker, floor 198 → 213),
  $-safety-batteriet dekker recordDoNext (coverage-gate fanget den nye eksporten).

Suiter: test-runner 232/0, hooks 191/0, trends 300/0, brain 134/0, editions 72/0,
specifics-bank 45/0, contract-gate 33/0, tests 35/0, render 60/0.

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 15:23:35 +02:00
commit b45fdad911
16 changed files with 713 additions and 6 deletions

View file

@ -336,6 +336,40 @@ Delegate interpretation to the `analytics-interpreter` agent (report mode) — i
3. **Test carousel format**: Your one carousel got 3x more shares than text posts. Create a carousel for your top-performing topic this week.
```
## Step 7b: Persist them as do-next directives (the measurement→creation contract)
A recommendation that only lands in chat dies there — the next post is drafted in a fresh
session that never saw it. **Persist the 23 recommendations above as do-next directives**, so
`/linkedin:post`, `/linkedin:quick`, `/linkedin:batch`, `/linkedin:create` and
`/linkedin:newsletter` read them at their Step 0 and the next piece is actually shaped by this
report. This step is not optional when a report produced recommendations.
Each directive is an **imperative the next draft can act on** plus an **evidence pointer**
the measured number it came from, so the create surface can tell a directive backed by 12 posts
from one backed by 2:
```bash
node --input-type=module -e "
import { writeState, recordDoNext } from '${CLAUDE_PLUGIN_ROOT}/hooks/scripts/state-updater.mjs';
writeState(content => recordDoNext(content, {
recordDate: 'YYYY-MM-DD',
source: 'report',
directives: [
{ directive: 'Plan 2 AI-agent posts this week', evidence: 'weekly 2026-W22: 3 AI posts avg 2400 impressions vs 1200 baseline (n=12)' },
{ directive: 'Move Tuesday posts to 08:00', evidence: 'weekly 2026-W22: Tuesday -40% impressions' }
]
}));
"
```
**Lifetime (do not hand-manage it):** `recordDoNext` replaces this source's own previous rows on
every write and drops any row older than 60 days, so the section stays a live steering signal
rather than a growing backlog. Directives from other sources (`ab-test`, `analyze`,
`48h-monitor`) are left alone — never clear the section by hand.
Then confirm in one line what was persisted, e.g. "2 do-next directives written to state — the
next post/newsletter will read them at Step 0."
## Step 8: Offer Deep Dive Options
After presenting the report, ask: