extraction: message-granular proposition anchors; factory budget back to 4096

This commit is contained in:
amosblomqvist
2026-10-13 08:26:31 +03:00
parent d653ba0e91
commit 664c1bfed2
10 changed files with 560 additions and 112 deletions
+14 -5
View File
@@ -231,11 +231,20 @@ export interface ExtractedProposition {
/** Verbatim phrasings the session used. */
aliases: string[];
/* Submit-schema slim (owner, 2026-09-28): `messages` and `evidence`
* are GONE. Provenance is chat-level (the run's source key); the
* verbatim-quote fields were never persisted and weak models burned
* their retries on them ("propositions.0: must be object" — the
* stringified-payload collapse). The extractor reports propositions
* + structure, nothing else. */
* are GONE. The verbatim-quote fields were never persisted and weak
* models burned their retries on them ("propositions.0: must be
* object" — the stringified-payload collapse). The extractor reports
* propositions + structure, nothing else. */
/** OPTIONAL, SESSION PATH ONLY (owner, 2026-10-13): the message id of
* the ONE teacher passage this proposition came from — the extractor
* copies it from the view's "TEACHER [id]" label (core/coverage.ts
* messageViewLines) and the submit seam validates it against the
* CURRENT batch. The merger stamps it into the node's provenance
* point {chatId, messageId} (new nodes AND link-appends); chains
* stay chat-level. Notes imports and legacy/core callers have none:
* undefined → messageId "" (chat-level), so NO persisted shape or
* format version changes (GraphNode / ProvenancePoint untouched). */
messageId?: string;
}
/** One proposed argument (extractor redesign, 2026-09-30). Endpoints are
+17 -8
View File
@@ -11,8 +11,10 @@
* same-source digest (digest-aware, 2026-09-30
* evening: the extractor continues its own source,
* references existing ids verbatim, assembles
* cross-stretch itself). Fully trusted: no stage
* re-checks it.
* cross-stretch itself). Session propositions carry
* their passage's messageId (2026-10-13) — the
* merger's provenance anchor. Fully trusted: no
* stage re-checks it.
* auditor (LLM) → AuditVerdicts: identity links (local id → an existing
* node, or create) via graph-exploration tools —
* links ONLY (owner, 2026-09-28 evening: the auditor
@@ -109,11 +111,14 @@ export interface MergeSource {
coverage?: CoverageEntry[];
}
/** The run's chat-level provenance point (submit-schema slim, 2026-09-28:
* propositions no longer carry message ids — the model never reported
* them reliably anyway — so every birth from a run shares one point). */
function pointOf(chatId: string): ProvenancePoint[] {
return [{ chatId, messageId: "" }];
/** The run's provenance point. Chat-level by default (submit-schema slim,
* 2026-09-28 — the run's source key is the whole point); since the anchor
* restore (owner, 2026-10-13) a SESSION birth may carry its passage's
* message id — the extractor-copied messageId, validated at the submit
* seam against the current batch. Chains, notes imports, and
* legacy/core callers lacking an anchor keep "" (chat-level). */
function pointOf(chatId: string, messageId?: string): ProvenancePoint[] {
return [{ chatId, messageId: messageId ?? "" }];
}
const samePoint = (a: ProvenancePoint, b: ProvenancePoint): boolean =>
@@ -166,7 +171,11 @@ export function mergeFindings(
// extractor's findings verbatim; the auditor's links join here by id.
for (const p of findings.propositions) {
if (mapping.has(p.id)) continue; // duplicate id WITHIN this submit — first resolution stands
const points = pointOf(chatId);
// The anchor (2026-10-13): a session proposition may carry its
// passage's messageId — it rides BOTH the create and the link-append
// line (each re-encounter anchors to ITS passage); absent (notes,
// legacy/core callers) → "", chat-level as before.
const points = pointOf(chatId, p.messageId);
const linkTo = linkOf.get(p.id);
let graphNodeId: string;
if (linkTo !== undefined && existingIds.has(linkTo)) {
+6 -3
View File
@@ -321,8 +321,11 @@ export interface GraphSettings {
* carries the whole graph + instructions, so a smaller budget means
* more, smaller runs — each paying that fixed overhead).
*
* FACTORY DEFAULT 4096 (the pre-setting constant, config.ts's
* EXTRACTION.chunkTokens — vision-extraction-coverage.md, 2026-09-15).
* FACTORY DEFAULT 4096 (owner, 2026-10-13: halved back from the
* digest-era 8192 — the labeled passages + message anchors made
* smaller batches worth their overhead again; the pre-setting
* constant was 4096, vision-extraction-coverage.md, 2026-09-15).
* Only the FACTORY moves: an explicit user value always wins.
*
* FLOOR 500 (EXTRACTION_CHUNK_TOKENS_FLOOR, the implementer's call
* per the owner's dispatch): every run pays the graph-carrying
@@ -402,7 +405,7 @@ export const FACTORY_SETTINGS: FactorySettings = {
sessionNameSerif: true,
mdRendering: { headingWeight: 900, boldColor: null, italicColor: null },
},
graph: { enabled: true, rendering: true, extractionChunkTokens: 8192 },
graph: { enabled: true, rendering: true, extractionChunkTokens: 4096 },
compaction: { thresholdTokens: 150_000 },
};