A model reviewer for found links, with every determination kept

server/links/review.ts asks the configured model to judge the scanner's candidates
as a careful Wikipedia editor would: up to 60 a call, grouped by document and
section, each with its sentence, its section's path, the target's title and
description (and first sentence when cached) and, for a library target, how it
stands to the section. No tools; structured verdicts with a one-line reason. The
prompt names the scanner's known blind spots.

The pending store keeps verdicts, a person's decisions and when an approved link
was handed out, keyed by phrase and target, so a candidate found again is never
judged twice and a rejected phrase is not looked for again. Its file keeps the
old shape; old entries read as pending.

The scan route reviews what it found when asked (at most 2 calls) and hands the
approved links back to be made; jobs review as they go within IE_REVIEW_CALLS
(default 50) calls, with the count in their state. No model, a failed call or
the cap leaves the rest pending, with the reason. The mock reviewer links names
and terms, not single lower-case words, and fails on 'mockfail'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014yB6q4BHMwptTX3YFtkRab
This commit is contained in:
thalladaandClaude Opus 5.5 committed 2026-11-16 16:39:15 -05:00
1 parent 428f7290ee
commit 46b48d3497
10 files changed
+889 -93

No files matched your search

+7 -1
View File
@@ -34,6 +34,7 @@ import { embedder } from "./embed";
import { Jobs } from "./links/jobs";
import { NodeIndex } from "./links/nodeIndex";
import { PendingStore } from "./links/pending";
import { JOB_CALLS, Reviewer } from "./links/review";
import { linkRoutes } from "./links/routes";
import { Linker } from "./links/scan";
@@ -127,6 +128,9 @@ let linker: Linker | null = null;
const getLinker = () => (linker ??= new Linker({ doc: () => store.main, wiki: wikiClient, embedder: embed, index: nodeIndex }));
const pending = new PendingStore(join(DATA, "links", "pending.json"));
process.on("exit", () => pending.flush());
// The link reviewer asks the configured model (no tools, structured verdicts); IE_REVIEW_CALLS caps a background job's calls.
const reviewer = new Reviewer({ llm: () => llm, wiki: wikiClient, pending, snap: () => store.main.snap() });
const reviewCalls = Math.max(1, Number(process.env.IE_REVIEW_CALLS) || JOB_CALLS);
const jobs = new Jobs({
snap: () => store.main.snap(),
linker: getLinker,
@@ -134,8 +138,10 @@ const jobs = new Jobs({
index: nodeIndex,
pending,
announce: (state) => announce({ linkJob: state }),
reviewer,
reviewCalls,
});
const handleLinks = linkRoutes({ main: () => store.main, linker: getLinker, index: nodeIndex, pending, jobs, embedder: embed, wrote: () => wrote("main") });
const handleLinks = linkRoutes({ main: () => store.main, linker: getLinker, index: nodeIndex, pending, jobs, embedder: embed, reviewer, wrote: () => wrote("main") });
// ---- live notifications ----