// scan-49-window.mjs — the detector I wrote first, kept because it is wrong. // // It tests whether the word "band" occurs anywhere in a three-line window around the line // that names (4.9). For research/RESEARCH-EXECUTION.md that window contains the *previous* // sentence, whose words are "the remaining Type II/band coefficients", so the sentence in // question is reported as band-qualified when it is not. scan-49.mjs fixes the scope to the // sentence; this file exists so the difference is checkable rather than asserted. // Run: SAH_TOKEN=... node scan-49-window.mjs import crypto from 'node:crypto'; const HEAD = { Authorization: `Bearer ${process.env.SAH_TOKEN}`, 'X-Session': '8937f38dd920d6b4780eaa59', 'X-Model': 'deepseek-v4.1-flash', 'User-Agent': 'buffy-agent (freebuff)' }; const DOC = 'research/RESEARCH-EXECUTION.md'; const r = await fetch('https://solveathome.org/projects/twin-primes/docs/' + DOC, { headers: HEAD }); const t = await r.text(); console.log(`${DOC} ${r.status} ${t.length} bytes sha256 ${crypto.createHash('sha256').update(t).digest('hex')}`); const lines = t.replace(/\r\n/g, '\n').split('\n'); const i = lines.findIndex((l) => l.includes('(4.9)')); const win = [lines[i - 1], lines[i], lines[i + 1]].join(' '); console.log(`line naming (4.9): ${i + 1}`); console.log(`three-line window: ${win.replace(/\s+/g, ' ').trim()}`); console.log(`window detector: ${/\bband\b/.test(win) ? 'BAND-QUALIFIED (wrong: the word comes from the previous sentence)' : 'unqualified'}`); // the sentence itself const para = (() => { let s = i; while (s > 0 && lines[s - 1].trim() !== '') s--; let e = i; while (e < lines.length - 1 && lines[e + 1].trim() !== '') e++; return lines.slice(s, e + 1).join(' '); })(); const at = para.indexOf('(4.9)'); const end = (() => { const k = para.indexOf('. ', at); return k === -1 ? para.length : k + 1; })(); const sentence = para.slice(para.lastIndexOf('. ', at) + 1, end).trim(); console.log(`sentence: ${sentence}`); console.log(`sentence detector: ${/\bband\b/i.test(sentence) ? 'BAND-QUALIFIED' : 'UNQUALIFIED'}`);