feat(linkedin-studio): N11 — serie-destillat + skjelett-sjekk + specifics-bank bruks-logging [skip-docs]

Every long-form gate agent sees ONE edition, so «the reader has heard this
before» was structurally invisible — and the specifics-bank dedupe actively
encouraged re-surfacing the same material. At series cadence that is the
fastest-growing defect class. N11 makes it visible BEFORE the skeleton is
approved, at two grains:

- Series grain — new scripts/editions package: each locked edition's spent
  anecdotes/arguments/hooks are written to <serie>/linkedin/series-distillate.json
  at Step 8 lock (distil-append), and the next skeleton is checked against it at
  Step 2.5 (distil-check) with the finding folded into the annotation gate the
  operator already reads. Advisory, never blocking: a deliberate callback is a
  legitimate move, an unnoticed retread is not.
- Material grain — specifics-bank usedIn log: record-usage stamps «used in
  edition NN» on the specifics an edition actually consumed (read from the bound
  slot-map, so abstrakt/ekstern stamp nothing). At lock, so it means published;
  idempotent under a pivot re-lock. Additive-optional, schema stays v1.

Placement deviates from the plan text (${DATA}) after premise-verification:
per-series state belongs in the series root beside edition-state.json, where
Step 0 already resolves the path and no slug→path map is needed. Operator
approved. The distillate module also lands in scripts/editions now rather than
at N12, since the AC required a testable roundtrip and N12 planned that package
anyway — N12 extends it instead of creating it.

Similarity is character-trigram Jaccard, not word overlap: the plugin is
language-general and inflection (migrere/migreringen) breaks word tokens.
Calibrated on real paraphrase pairs — retellings 0.44-0.55, unrelated 0.04-0.06,
same-topic-different-story 0.24 — so the default threshold sits in the gap at
0.40. Word-Jaccard scored a shortened hook paraphrase at 0.11.

TDD (Iron Law): tests written first and verified red before implementation, for
both the new package and the bank logging.

Suites: editions 27/0 (new suite line + guard, floor 27) · specifics-bank
28 -> 45 · test-runner 163 -> 173 (Section 16r: 9 unconditional greps +
non-vacuity self-test; anti-erosion floor 146 -> 155) · trends 300/0 ·
brain 134/0 · hooks 140/0 · tests 35/0 · render 60/0. tsc --noEmit clean.

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 06:29:01 +02:00
commit b54e450c3e
20 changed files with 2152 additions and 19 deletions

View file

@ -21,9 +21,10 @@ import {
defaultBankPath,
loadBank,
queryByTopic,
recordUsage,
saveBank,
} from "./bank.js";
import { validateBinding } from "./binding.js";
import { boundSpecificIds, validateBinding } from "./binding.js";
import { renderKilder } from "./kilder.js";
import type { LivedSpecifics } from "./binding.js";
import type { SpecificType, Verification } from "./types.js";
@ -72,7 +73,8 @@ function usage(msg: string): never {
' add --type <t> --content "<text>" --tags <a,b> [--source <s>] [--verification <v>] [--bank <path>]\n' +
" list [--bank <path>] [--json]\n" +
" validate-binding --edition <edition-state.json> [--article <id>] [--bank <path>] [--json]\n" +
" render-kilder --edition <edition-state.json> [--article <id>] [--bank <path>] [--out <path>]",
" render-kilder --edition <edition-state.json> [--article <id>] [--bank <path>] [--out <path>]\n" +
" record-usage --edition <edition-state.json> --edition-id <slug/NN> [--article <id>] [--bank <path>] [--json]",
);
process.exit(2);
}
@ -213,6 +215,32 @@ function main(): void {
return;
}
if (command === "record-usage") {
if (!flags.edition || flags.edition === "true") usage("record-usage needs --edition <path>");
const editionId = flags["edition-id"];
if (!editionId || editionId === "true") {
usage("record-usage needs --edition-id <slug/NN> — an unattributable use is worse than none");
}
const edition = loadEdition(flags.edition);
const { id, article } = resolveArticle(edition, flags.article);
const ids = boundSpecificIds(article.livedSpecifics ?? EMPTY_LS);
const res = recordUsage(loadBank(bankPath), { ids, editionId });
saveBank(bankPath, res.bank);
if (asJson) {
console.log(JSON.stringify({ article: id, editionId, ...res, bank: undefined }, null, 2));
return;
}
console.log(
`Usage recorded for article ${id} as "${editionId}": ` +
`${res.recorded.length} stamped, ${res.alreadyRecorded.length} already logged.`,
);
if (res.unknown.length > 0) {
console.log(`${res.unknown.length} bound id(s) absent from the bank: ${res.unknown.join(", ")}`);
}
return;
}
usage(command ? `unknown command: ${command}` : "no command given");
}