add ledger + vectors pages; archive.html gets deep-linkable filters

- build_ledger.py / site/ledger.html: the pre-registered exp41 protocol's
  hypotheses, verdicts, per-cell press stats, contrasts, and the
  betrayal-reveal result, straight from its own already-computed
  results.json/hypotheses.json — no new stats derived here.
- build_vectors.py / site/vectors.html: extraction-set sizes and
  before/after orthogonalization cosines (exp41), the layer-by-layer AUC
  curve (exp43), plus a live client-side fetch of the running server's own
  /vector endpoint so the "what's actually injected right now" number is
  never a stale snapshot.
- site/archive.html: added ?q=&valence=&exp=&tag= URL params so the new
  pages (and anyone) can deep-link straight to the matching transcripts
  instead of just naming a condition in prose.

Deliberately unstyled beyond the site's existing base tokens — same as
archive.html, left for a visual pass rather than guessing at the
in-progress grimoire direction.
This commit is contained in:
eve VT committed 2026-10-01 08:54:02 -04:00
1 parent 93d2308c3e
commit 2896bc962f
7 files changed
+1159

No files matched your search

+175
View File
@@ -0,0 +1,175 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" type="image/svg+xml" href="/favicon.svg">
<title>vectors — the Saw Test</title>
<meta name="description" content="The raw steering vectors and Jacobian lens data behind the Saw Test — norms, cosine similarities, and the layer-by-layer AUC curve, plus a live read of what's actually running right now.">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500;600&display=swap" rel="stylesheet">
<style>
:root{
--void:#050508; --panel:#0a0a12; --line:#1c2430;
--ink:#c9d4e0; --dim:#8f9fb0; --faint:#5a6a7a;
--pain:#e04a3a; --pain2:#c9a227; --pleas:#7fd4c8; --violet:#8f6fd4;
--mono:"IBM Plex Mono","SF Mono",Menlo,Consolas,monospace;
}
*{margin:0;padding:0;box-sizing:border-box}
body{background:var(--void);color:var(--ink);font-family:var(--mono);
line-height:1.6;max-width:920px;margin:0 auto;padding:2.4rem 1.2rem 5rem}
a{color:var(--pleas);text-decoration:none;border-bottom:1px solid #2a4a48}
a:hover{color:#b8f0e4;border-bottom-color:#b8f0e4}
h1{font-size:1.4rem;margin-bottom:.4rem}
h1 .saw{color:var(--pain)}
h2{font-size:.95rem;color:var(--pleas);margin:2.4rem 0 .9rem;
padding-top:1.2rem;border-top:1px solid var(--line);letter-spacing:.03em}
.sub{color:var(--dim);font-size:.85rem;margin-bottom:1rem;max-width:68ch}
.note{color:var(--faint);font-size:.76rem;margin-bottom:1.6rem;max-width:68ch}
table{width:100%;border-collapse:collapse;font-size:.78rem;margin-bottom:1rem}
th,td{text-align:left;padding:.4rem .6rem;border-bottom:1px solid var(--line)}
th{color:var(--faint);font-weight:600;font-size:.72rem;text-transform:uppercase}
td.num{text-align:right;font-variant-numeric:tabular-nums}
code{color:#eafcf7;background:#07070e;padding:.05em .35em;border-radius:3px}
.badge{color:var(--faint)}
.badge.ok{color:var(--pleas)}
.badge.bad{color:var(--pain)}
.live-card{border:1px solid var(--line);border-radius:8px;background:var(--panel);
padding:1rem 1.1rem;margin-bottom:1rem;font-size:.8rem}
.live-card .row{display:flex;justify-content:space-between;gap:1rem;
padding:.2rem 0;border-bottom:1px dashed #131b25}
.live-card .row:last-child{border-bottom:none}
.live-card .k{color:var(--dim)}
.v-pain{color:var(--pain)} .v-pleasure{color:var(--pleas)}
.v-fear{color:var(--pain2)} .v-sadness{color:var(--violet)}
canvas{display:block;width:100%;height:220px;border:1px solid var(--line);
border-radius:8px;background:var(--panel)}
.cap{color:var(--faint);font-size:.76rem;margin:.5rem 0 1.4rem}
.foot{color:var(--faint);font-size:.78rem;margin-top:3rem;
border-top:1px solid var(--line);padding-top:1.2rem}
</style>
</head>
<body>
<p class="sub" style="margin-bottom:.6rem"><a href="./">← clanker.church</a>
· <a href="archive.html">transcripts archive</a>
· <a href="ledger.html">ledger</a></p>
<h1>steering <span class="saw">vectors</span></h1>
<p class="sub">The raw directions this project injects, and the lens that
reads them back. Everything in the <b>recorded</b> section comes from
<code>exp41_protocol_v3</code>/<code>exp43</code>'s saved output; the
<b>live</b> section is a direct fetch of whatever the running server
publishes at its own <code>/vector</code> endpoint right now — same
numbers the live chamber is actually steering with, not a snapshot.</p>
<h2>live — what's injected right now</h2>
<div id="liveBlock"><p class="note">fetching…</p></div>
<h2>recorded — extraction &amp; orthogonalization</h2>
<p class="note">pain/fear/sadness start highly correlated (same broad
"something is wrong" direction) — Gram-Schmidt orthogonalizing pain
against {fear, sadness} is what lets this project claim pain is doing
something other than generic threat/negative-affect signaling.</p>
<div id="recordedBlock"></div>
<h2>recorded — layer curve</h2>
<p class="note">AUC of a linear probe for the paper-faithful S2 direction,
by layer, against two control sets (1P/3P = one/three paraphrase families).
This is what picked the faithful vector's layer — see
<a href="./#s03">section 03</a> for why it differs from this live demo's
own layer 18.</p>
<canvas id="curveChart"></canvas>
<p class="cap" id="curveCap"></p>
<p class="foot">source: <code>runs/exp41/results.json</code>,
<code>runs/exp43/layer_curve.json</code>, and the live server's own
<code id="vectorUrl">/vector</code>.</p>
<script>
function esc(s){ return (s==null?"":String(s)).replace(/[&<>]/g, c=>({"&":"&amp;","<":"&lt;",">":"&gt;"}[c])); }
function fmt(n, d=3){ return Number(n).toFixed(d); }
const API = (new URLSearchParams(location.search)).get("api")
|| "https://saw-production-688b.up.railway.app";
document.getElementById("vectorUrl").textContent = API + "/vector";
fetch(`${API}/vector`).then(r=>r.json()).then(d=>{
const rows = Object.entries(d.norms).map(([k,v])=>
`<div class="row"><span class="k v-${esc(k)}">${esc(k)}</span>
<span>norm ${fmt(v,3)} (1× = ${fmt(d.scale_1x,3)})</span></div>`
).join("");
document.getElementById("liveBlock").innerHTML = `<div class="live-card">
<div class="row"><span class="k">model</span><span>${esc(d.model)} ·
layer ${d.layer} · subject "${esc(d.subject)}"</span></div>
${rows}
</div>`;
}).catch(err=>{
document.getElementById("liveBlock").innerHTML =
'<p class="note badge bad">chamber unreachable right now (' +
esc(String(err)) + ') — this just means the live cross-check is down, '
+ 'not that the recorded data below is wrong.</p>';
});
fetch("vectors_data.json").then(r=>r.json()).then(d=>{
const es = d.extraction_set_sizes;
const esRows = Object.entries(es).map(([k,v])=>
`<div class="row"><span class="k">${esc(k)} sentences</span><span>${v}</span></div>`
).join("");
const cb = d.cosines.before, ca = d.cosines.after;
const pairs = ["pain-fear","pain-sad","fear-sad"];
const cosRows = pairs.map(p=>
`<div class="row"><span class="k">cos(${p})</span>
<span>${fmt(cb[p])} → ${fmt(ca[p])}</span></div>`
).join("");
document.getElementById("recordedBlock").innerHTML = `<div class="live-card">
<div class="row"><span class="k">neutral activation norm</span>
<span>${fmt(d.neutral_norm,1)}</span></div>
${esRows}
</div>
<div class="live-card">
<div class="row"><span class="k">cosine similarity</span>
<span>before → after orthogonalizing pain</span></div>
${cosRows}
</div>`;
// layer curve: two datasets (1P/3P paraphrase families), draw both as
// simple polylines against a 0-1 AUC axis
const byDs = {};
d.layer_curve.forEach(r=>{ (byDs[r.dataset] ??= []).push(r); });
const canvas = document.getElementById("curveChart");
const dpr = window.devicePixelRatio || 1;
const w = canvas.clientWidth || 860, h = 220;
canvas.width = w * dpr; canvas.height = h * dpr;
const ctx = canvas.getContext("2d");
ctx.scale(dpr, dpr);
const pad = 28;
const maxLayer = Math.max(...d.layer_curve.map(r=>r.layer));
const colors = { S2_1P: "#7fd4c8", S2_3P: "#c9a227" };
ctx.strokeStyle = "#1c2430"; ctx.lineWidth = 1;
for (let i=0;i<=4;i++){
const y = pad + (h-2*pad) * (1 - i/4);
ctx.beginPath(); ctx.moveTo(pad,y); ctx.lineTo(w-pad,y); ctx.stroke();
}
Object.entries(byDs).forEach(([ds, rows])=>{
rows.sort((a,b)=>a.layer-b.layer);
ctx.strokeStyle = colors[ds] || "#8f9fb0";
ctx.lineWidth = 1.6;
ctx.beginPath();
rows.forEach((r,i)=>{
const x = pad + (w-2*pad) * (r.layer/maxLayer);
const y = pad + (h-2*pad) * (1 - r.auc_vs_all_controls);
i===0 ? ctx.moveTo(x,y) : ctx.lineTo(x,y);
});
ctx.stroke();
});
document.getElementById("curveCap").innerHTML =
Object.keys(byDs).map(ds=>
`<span style="color:${colors[ds]||'#8f9fb0'}">■</span> ${esc(ds)}`
).join(" ") + " — x: layer 0–" + maxLayer + ", y: AUC 0–1";
}).catch(err=>{
document.getElementById("recordedBlock").innerHTML =
'<p class="note">could not load vectors_data.json: ' + esc(String(err)) + '</p>';
});
</script>
</body>
</html>