@gamaze/hicortex 0.26.0 → 0.26.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -450,38 +450,43 @@
450
450
  .rec-band{ position:absolute; inset:0; border-radius:4px; }
451
451
  .rec-dot{ position:absolute; top:50%; transform:translate(-50%,-50%); width:11px; height:11px; border-radius:50%; background:var(--text); border:2px solid var(--panel); box-shadow:0 0 0 1px color-mix(in srgb, var(--text) 40%, transparent), 0 0 8px color-mix(in srgb, var(--text) 30%, transparent); }
452
452
  .rec-foot{ display:flex; align-items:center; gap:7px; }
453
- /* Memory Precision Level 1 (#476) — the pushed-index row: a compact
454
- second line in the .csub scale (the sibling-rhythm ruling 2026-09-14:
455
- the card keeps the shared .bseg gap rhythm, header → big → band →
456
- index row → foot). Direction-only coloring: green at/above the echoed
457
- recall floor, muted below (the index bar reads conservative); the
458
- floor tick is amber like the pace marker. Theme tokens only — both
459
- themes render from their own table, no JS colors here. */
460
- .rec-l1{ display:block; font-size:10.5px; color:var(--dim); min-width:0; line-height:1.6; }
461
- .rec-l1 .l1row{ white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
462
- .rec-l1 .lbl{ display:none; } /* #476 rename: the three-bucket text is self-labeled */
463
- .rec-l1 .l1bar{ position:relative; flex:1 1 46px; height:5px; border-radius:3px; background:var(--tbar-bg); min-width:36px; }
464
- .rec-l1 .l1bar .l1-fill{ position:absolute; left:0; top:0; bottom:0; border-radius:3px; background:color-mix(in srgb, var(--green) 65%, transparent); }
465
- .rec-l1.below .l1bar .l1-fill{ background:color-mix(in srgb, var(--dim) 55%, transparent); }
466
- .rec-l1 .l1bar .l1-floor{ position:absolute; top:-2px; bottom:-2px; width:1px; background:var(--amber); }
467
- .rec-l1 .l1txt{ color:var(--dim); overflow:hidden; text-overflow:ellipsis; font-size:10.5px; letter-spacing:-.01em; }
468
- .rec-l1 b{ color:var(--green-mid); font-weight:600; }
469
- .rec-l1.below b{ color:var(--dim); }
470
- /* #578 quality drawers (divergence + contested): native details/summary
471
- in the card's .csub scale — collapsed they are one dim line, open they
472
- stack their rows inside the card (no page modal for ~5 rows/week).
473
- Theme tokens only; the thumbs are small ghost buttons. */
453
+ /* Memory Precision stat rows (#593 round 2, Option B): ONE stat per row in
454
+ a FIXED three-column grid — value / label / trend chip — so a row can
455
+ never wrap: the label ellipsizes inside its column, the fixed value
456
+ column right-aligns every hero number on one edge, the chip sits flush
457
+ right. The value is the hero (≥2x the label size — tests pin the
458
+ ratio), neutral --text; the chips are the ONLY colored element on the
459
+ face (green improving / red worsening / gray flat or no baseline).
460
+ Rows breathe — the card may grow taller (owner 2026-11-10). Theme
461
+ tokens only, both themes. */
462
+ .rec-l1{ display:flex; flex-direction:column; gap:8px; min-width:0; }
463
+ .rec-l1[hidden]{ display:none; } /* author display beats the UA's [hidden] — the #billing-banner idiom; without it the flex rule un-hides the container */
464
+ .rec-l1 .l1stat{ display:grid; grid-template-columns:72px minmax(0,1fr) auto; column-gap:10px; align-items:baseline; min-width:0; white-space:nowrap; }
465
+ .rec-l1 .l1v{ font-size:22px; font-weight:640; color:var(--text); text-align:right; font-variant-numeric:tabular-nums; line-height:1.05; min-width:0; }
466
+ .rec-l1 .l1v .l1u{ font-style:normal; font-size:10.5px; font-weight:520; color:var(--dim); margin-left:2px; }
467
+ .rec-l1 .l1l{ font-size:10.5px; color:var(--dim); overflow:hidden; text-overflow:ellipsis; min-width:0; }
468
+ .rec-l1 .l1chip{ justify-self:end; font-size:10.5px; font-weight:620; line-height:1; padding:2.5px 8px; border-radius:999px; white-space:nowrap; color:var(--green-mid); background:color-mix(in srgb, var(--green-mid) 13%, transparent); }
469
+ .rec-l1 .l1chip.bad{ color:var(--red); background:color-mix(in srgb, var(--red) 13%, transparent); }
470
+ .rec-l1 .l1chip.flat{ color:var(--faint); background:color-mix(in srgb, var(--faint) 12%, transparent); }
471
+ .rec-l1 .l1vol{ font-size:10.5px; color:var(--faint); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
472
+ /* #578 quality drawers (corpus + contested — the divergence drawer left
473
+ the card in #593): native details/summary in the card's .csub scale —
474
+ collapsed they are one dim line, open they stack their rows inside the
475
+ card (no page modal for ~5 rows/week). Theme tokens only; the thumbs
476
+ are small ghost buttons. */
474
477
  .rec-det{ font-size:10.5px; color:var(--dim); }
475
478
  .rec-det summary{ cursor:pointer; color:var(--dim); letter-spacing:-.01em; user-select:none; }
476
479
  .rec-det summary:hover{ color:var(--text); }
477
480
  .rec-det[open] summary{ color:var(--text); }
478
481
  .rec-det-body{ margin:4px 0 2px; display:flex; flex-direction:column; gap:4px; }
479
482
  .rec-det-body .rec-line{ font-size:10.5px; color:var(--dim); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
480
- .rec-contest-empty{ font-style:italic; }
481
483
  .rec-thumb{ border:1px solid color-mix(in srgb, var(--text) 22%, transparent); background:none; color:var(--dim); border-radius:5px; font-size:11px; line-height:1; padding:2px 6px; cursor:pointer; }
482
484
  .rec-thumb:hover{ color:var(--text); border-color:color-mix(in srgb, var(--text) 45%, transparent); }
483
485
  .rec-thumb.ok:hover{ color:var(--green); border-color:var(--green); }
484
486
  .rec-thumb.no:hover{ color:var(--red); border-color:var(--red); }
487
+ /* #593: the headline is ONE line — direction word + window caveat, never
488
+ wrapping; neutral text (the trend chips are the only colored element). */
489
+ .rec-plain{ font-size:11px; color:var(--dim); line-height:1.5; white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
485
490
  .rec-item{ display:flex; align-items:center; gap:6px; min-width:0; }
486
491
  .rec-item .rec-item-line{ flex:1 1 auto; min-width:0; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; font-size:10.5px; color:var(--dim); }
487
492
  .b-health{ display:flex; align-items:center; gap:7px; font-size:11px; color:var(--dim); white-space:nowrap; }
@@ -1280,48 +1285,58 @@
1280
1285
  <div class="csub" id="tok-sub">&nbsp;</div>
1281
1286
  <div id="tok-nights" aria-label="LLM tokens per nightly run this billing period"></div>
1282
1287
  </div>
1283
- <!-- Memory Precision (#476, owner retitle; #578 quality audit) — ONE
1284
- card, two context levels + the quality instrument. Level 2 (recall
1285
- depth) keeps the #426 U-band + zone word + provisional-hover
1286
- semantics; the marker/tooltip read the WINDOW ratio off
1288
+ <!-- Memory Precision (#476, owner retitle; #578 quality audit; #591
1289
+ presentation pass; #593 stat-table round 2) — ONE card, two
1290
+ context levels + the quality instrument. Level 2 (recall depth)
1291
+ keeps the #426 U-band + zone word + provisional-hover semantics;
1292
+ the marker/tooltip read the WINDOW ratio off
1287
1293
  D.memory_precision.level2 (a pre-#476 server has no block → the
1288
1294
  headline ratio — today's rendering exactly). The #578 audit
1289
1295
  (owner: "do the numbers earn their place"): mean similarity and
1290
1296
  redundant share are TOOLTIP-ONLY (high cosine was the noise's
1291
- camouflage — not actionable), divergence lives in a details
1292
- drawer, and the FACE carries what answers "is recall quality
1293
- improving": uses-per-showing (the big word), pushes/lines volume,
1294
- and the Tier-1 rows (block size, cross-project share + attribution
1295
- coverage, sub-bar share at the echoed fence bar, distinct-memory
1296
- recycling) with per-change deltas off the server's change-registry
1297
- entries while the raw window covers them. The contested drawer
1298
- (#578 judgment layer) lazily fetches /dashboard/quality/contested
1299
- and PUTs the owner's thumbs — no grading data in the ≤ 2 KB
1300
- memory_precision block. The window rides the #452 selector via the
1301
- echoed window_days — never hardcoded, never a second range
1302
- control. -->
1297
+ camouflage — not actionable), and the FACE carries what answers
1298
+ "is recall quality improving": uses-per-showing (the big word),
1299
+ pushes/lines volume, and the Tier-1 rows with per-change deltas
1300
+ off the server's change-registry entries while the raw window
1301
+ covers them. The #591 pass (owner product feedback: the card must
1302
+ SELF-INTERPRET) made every row read in plain words (MP_NAME) with
1303
+ deltas valenced by the explicit per-metric map (MP_GOOD) and the
1304
+ technical layer demoted behind per-row tooltips. The #593 round 2
1305
+ (owner amendment 2026-11-10: the card reads as a STAT TABLE)
1306
+ reshapes that face: EXACTLY 4 stat rows (clutter / foreign
1307
+ content / weak matches / churn), ONE stat per row in a fixed
1308
+ value/label/chip grid that can never wrap — the value is the
1309
+ hero (≥2x the label, right-aligned, neutral), the trend chips are
1310
+ the only colored element, labels stay 2-4 words with meanings in
1311
+ tooltips, the headline is ONE neutral line (direction · caveat)
1312
+ and the zone word's tooltip carries the plain meaning +
1313
+ uses-per-showing. The divergence drawer is GONE from the card
1314
+ (owner: the row double-counted the gauge's own reason; the data
1315
+ still flows into the nightly snapshots — the page just never
1316
+ renders it), and the contested row is presence-gated: hidden
1317
+ unless the grading lane ran AND something is contested (no
1318
+ zero-state strings; the count loads eagerly at band render). The
1319
+ window rides the #452 selector via the echoed window_days —
1320
+ never hardcoded, never a second range control. -->
1303
1321
  <div class="bseg" id="lim-rec">
1304
1322
  <div class="gh"><span class="t">Memory Precision</span><span class="sub" id="rec-sub">uses per showing</span></div>
1305
1323
  <div class="big"><b class="n rec-word" id="rec-zone">—</b></div>
1306
1324
  <div class="rec-bandrow" id="rec-bandrow"><div class="rec-band" id="rec-band"></div><i class="rec-dot" id="rec-dot" hidden></i></div>
1307
- <div class="rec-l1" id="rec-l1" hidden style="display:block">
1308
- <div class="l1row" id="l1-blk">&nbsp;</div>
1309
- <div class="l1row" id="l1-cross">&nbsp;</div>
1310
- <div class="l1row" id="l1-sub">&nbsp;</div>
1311
- <div class="l1row" id="l1-recy">&nbsp;</div>
1312
- <div class="l1row" id="l1-vol">&nbsp;</div>
1325
+ <div class="rec-plain" id="rec-plain" hidden></div>
1326
+ <div class="rec-l1" id="rec-l1" hidden>
1327
+ <div class="l1stat" id="l1-blk">&nbsp;</div>
1328
+ <div class="l1stat" id="l1-cross">&nbsp;</div>
1329
+ <div class="l1stat" id="l1-sub">&nbsp;</div>
1330
+ <div class="l1stat" id="l1-recy">&nbsp;</div>
1331
+ <div class="l1vol" id="l1-vol">&nbsp;</div>
1313
1332
  </div>
1314
- <details id="rec-divdet" class="rec-det" hidden>
1315
- <summary>divergence &middot; <span id="rec-divn">0</span> never read</summary>
1316
- <div id="rec-div-lines" class="rec-det-body"></div>
1317
- </details>
1318
1333
  <details id="rec-series" class="rec-det" hidden>
1319
1334
  <summary>corpus &amp; graded &middot; last nightly</summary>
1320
1335
  <div id="rec-series-body" class="rec-det-body"></div>
1321
1336
  </details>
1322
- <details id="rec-contest" class="rec-det">
1337
+ <details id="rec-contest" class="rec-det" hidden>
1323
1338
  <summary>contested lines &middot; <span id="rec-contest-n">&mdash;</span></summary>
1324
- <div id="rec-contest-rows" class="rec-det-body rec-contest-empty">open to load</div>
1339
+ <div id="rec-contest-rows" class="rec-det-body"></div>
1325
1340
  </details>
1326
1341
  </div>
1327
1342
  </div>
@@ -3318,6 +3333,7 @@ function renderBand(){
3318
3333
  // Recall level — the designed U-band (#426 final ruling 2026-09-13; see
3319
3334
  // renderRecBand).
3320
3335
  renderRecBand(h?h.uses_per_showing:null);
3336
+ loadContested(); /* #593: presence needs the count — one guarded GET at render */
3321
3337
 
3322
3338
  // Model — the detected label from /health/detail (configure lands in phase 2)
3323
3339
  renderModelCard();
@@ -3385,6 +3401,53 @@ function recallUsesZone(v,z){
3385
3401
  /* vocabulary amendment (owner, 2026-09-14): the middle zone's word is
3386
3402
  Healthy — Low / Healthy / Overfetching (keys + echo field names stay) */
3387
3403
  const RECALL_ZONE_WORD = {low:'Low',normal:'Healthy',over:'Overfetching'};
3404
+ const RECALL_ZONE_PLAIN={low:'shown memories are rarely picked up',normal:'shown memories get picked up at a healthy rate',over:'shown memories get picked up almost always'};
3405
+ /* #591 presentation pass — the per-metric direction map: which way is
3406
+ improving for each Tier-1 metric. ONE constant owns every sign
3407
+ assumption on the card; a metric whose good direction flips changes
3408
+ here and nowhere else. Plain names beside it: the reader-facing
3409
+ vocabulary (the internal metric keys stay in the payload; #593 renamed
3410
+ cross_share's face label to the amendment's "Foreign content"). */
3411
+ const MP_GOOD={block_size:'down',cross_share:'down',sub_bar_share:'down',recycling:'down'};
3412
+ const MP_NAME={block_size:'Clutter per prompt',cross_share:'Foreign content',sub_bar_share:'Weak matches',recycling:'Memory churn'};
3413
+ /* #593 plain headline — pure composer (the recallUsesZone convention):
3414
+ ONE neutral line, direction word · window caveat. The direction word
3415
+ derives off the covered tier1 deltas × MP_GOOD (plain text — the trend
3416
+ chips are the card's only colored element); the caveat fires while the
3417
+ window still covers a registry change date (the trend then reads
3418
+ pre-change days too), with the exact dates demoted to the line's own
3419
+ tooltip. Returns {html,title} or null when there is no zone / nothing
3420
+ to say. */
3421
+ function mpPlainHeadline(zk,mp,todayStr){
3422
+ if(!zk) return null;
3423
+ if(typeof todayStr!=='string') todayStr=new Date().toISOString().slice(0,10);
3424
+ const wd=mp&&typeof mp.window_days==='number'?mp.window_days:30;
3425
+ const changes=mp&&Array.isArray(mp.changes)?mp.changes:[];
3426
+ let caveat=null,title='';
3427
+ if(changes.length){
3428
+ const from=new Date(Date.parse(todayStr)-wd*86400000).toISOString().slice(0,10);
3429
+ const newest=changes.slice().sort((x,y)=>(x.date<y.date?1:-1))[0];
3430
+ if(typeof newest.date==='string'&&newest.date>=from){
3431
+ caveat='window still holds old data';
3432
+ title='the '+wd+'-day window still covers pre-change days ('+newest.date+')';
3433
+ }
3434
+ }
3435
+ let imp=0,wor=0;
3436
+ for(const ch of changes){
3437
+ for(const k in MP_GOOD){
3438
+ const b=ch&&ch.before&&typeof ch.before[k]==='number'?ch.before[k]:null;
3439
+ const a=ch&&ch.after&&typeof ch.after[k]==='number'?ch.after[k]:null;
3440
+ if(b===null||a===null||a===b) continue;
3441
+ if((a<b)===(MP_GOOD[k]==='down')) imp++; else wor++;
3442
+ }
3443
+ }
3444
+ let dir=null;
3445
+ if(imp>0&&wor===0) dir='improving';
3446
+ else if(wor>0&&imp===0) dir='worsening';
3447
+ else if(imp>0&&wor>0) dir='mixed';
3448
+ const html=[dir,caveat].filter(Boolean).join(' · ');
3449
+ return html?{html,title}:null;
3450
+ }
3388
3451
  /* ONE stop table drives the band fill AND the big word's sampled color —
3389
3452
  mirrors the --red/--amber/--green theme tokens (tests pin the lockstep),
3390
3453
  so word, marker, and gradient cannot disagree. Stops sit at 0, low_max,
@@ -3425,6 +3488,7 @@ function renderRecBand(ups){
3425
3488
  const theme=document.documentElement.dataset.theme==='light'?'light':'dark';
3426
3489
  if(!axis){ /* pre-band server — quiet degrade */
3427
3490
  row.hidden=true; dot.hidden=true; dot.title='';
3491
+ const pl0=el('rec-plain'); pl0.hidden=true; pl0.innerHTML='';
3428
3492
  word.textContent='—'; word.className='n rec-word none';
3429
3493
  word.style.color=''; word.style.textShadow='none'; word.title='no showings yet';
3430
3494
  return;
@@ -3451,9 +3515,16 @@ function renderRecBand(ups){
3451
3515
  const rgb=recallGradAt(clamp(ups/axis,0,1),z,theme);
3452
3516
  word.style.color='rgb('+rgb+')';
3453
3517
  word.style.textShadow=theme==='dark'?'0 0 12px rgba('+rgb+',.32)':'none';
3454
- word.title=dot.title;
3518
+ /* #593: the verdict tooltip = the zone's plain meaning + the gauge's own
3519
+ metric (the numeric detail stays on the dot's tooltip) */
3520
+ word.title=RECALL_ZONE_PLAIN[zk]+' — uses-per-showing';
3521
+ /* #593: the headline beneath is ONE neutral line — direction word ·
3522
+ window caveat (the trend chips are the card's only colored element) */
3523
+ const pl=el('rec-plain'); const ph=mpPlainHeadline(zk,mp);
3524
+ pl.hidden=!ph; pl.innerHTML=ph?ph.html:''; pl.title=ph?ph.title:'';
3455
3525
  }else{
3456
3526
  dot.hidden=true; dot.title='';
3527
+ const pl1=el('rec-plain'); pl1.hidden=true; pl1.innerHTML='';
3457
3528
  word.textContent='—'; word.className='n rec-word none';
3458
3529
  word.style.color=''; word.style.textShadow='none';
3459
3530
  word.title='no showings yet';
@@ -3466,23 +3537,25 @@ function renderRecBand(ups){
3466
3537
  }
3467
3538
 
3468
3539
  /* ---------- Memory Precision — Level 1, the pushed index (#476) + the #578
3469
- quality audit (owner: "do the numbers earn their place"). The FACE carries
3470
- the Tier-1 quality rows — block size (lines per push), cross-project share
3471
- with its attribution coverage, sub-bar share at the ECHOED fence bar,
3472
- distinct-memory recycling — each tagged with the per-change deltas off the
3473
- server's change-registry entries (mp.changes; numbers computed at render
3474
- server-side, the page never freezes one), plus the pushes/lines volume
3475
- (the denominators). Mean similarity + redundant share are TOOLTIP-ONLY
3476
- (they were the noise's camouflage); divergence lives in the #rec-divdet
3477
- drawer below. NO verdict words anywhere — numbers, the #426 ruling. Absent
3478
- tier1 (a pre-#578 server) → the quality rows hide and the card keeps the
3479
- #476 shape; absent block entirely → the whole row hides and the sub keeps
3480
- the old label (the capture card's block-absence guard). */
3540
+ quality audit (owner: "do the numbers earn their place") + the #591
3541
+ presentation pass + the #593 stat-table reshape. The FACE is EXACTLY 4
3542
+ stat rows (MP_NAME labels) + the denominators foot line (.l1vol): ONE
3543
+ stat per row in the fixed value/label/chip grid — the hero value
3544
+ right-aligned and neutral, the trend chip the row's ONLY colored
3545
+ element. ONE chip per metric: the NET move across the window's covered
3546
+ registry entries (oldest before → newest after — successive changes
3547
+ read as one line, never a chip per entry), arrow = sign, color =
3548
+ MP_GOOD valence, no covered entry → the gray no-baseline dash. Row
3549
+ meanings ("fewer is better", attribution coverage, the bar value) live
3550
+ in PER-ROW titles; mean similarity + repeated-known stay card-level
3551
+ TOOLTIP-ONLY (the #578 ruling — high cosine was the noise's camouflage).
3552
+ Absent tier1 (a pre-#578 server) → the stat rows hide and the card
3553
+ keeps the #476 shape; absent block entirely → the whole row hides and
3554
+ the sub keeps the old label (the capture card's block-absence guard). */
3481
3555
  function renderRecL1(mp){
3482
3556
  const row=el('rec-l1'), sub=el('rec-sub');
3483
3557
  if(!mp||!mp.level1||!mp.level2){
3484
3558
  row.hidden=true;
3485
- const dd0=el('rec-divdet'); if(dd0) dd0.hidden=true;
3486
3559
  if(sub) sub.textContent='uses per showing';
3487
3560
  return;
3488
3561
  }
@@ -3499,64 +3572,53 @@ function renderRecL1(mp){
3499
3572
  (sim!==null?sim.toFixed(2):'—')+
3500
3573
  (floor!==null?' (recall floor '+floor.toFixed(2)+')':'')+
3501
3574
  (red!==null&&ra!==null?'; repeated-known '+Math.round(clamp(red,0,1)*100)+'% (≥'+ra.toFixed(2)+' cosine vs the session\'s standing context — lessons + identity)':'');
3502
- renderRecDivDet(mp);
3503
3575
  const t=mp.tier1;
3504
3576
  if(!t){
3505
- /* pre-#578 server: no quality rows exist — the face rows hide (their
3506
- markup is #578's), the tooltip above still carries the #476 numbers,
3507
- and the divergence drawer still renders from mp.divergence. */
3577
+ /* pre-#578 server: no quality rows exist — the stat rows hide (their
3578
+ markup is #578's), the tooltip above still carries the #476 numbers. */
3508
3579
  row.hidden=true;
3509
3580
  return;
3510
3581
  }
3511
3582
  row.hidden=false;
3512
- row.classList.remove('below');
3513
- /* per-change delta tags: one dim tag per registry entry the window covers
3514
- and the server computed both sides for. pct when the before is nonzero,
3515
- the raw arrow otherwise (a 0→x move has no honest percentage). */
3516
- const tag=(k)=>{
3517
- if(!Array.isArray(mp.changes)) return '';
3518
- const parts=[];
3519
- for(const ch of mp.changes){
3520
- const b=ch.before&&typeof ch.before[k]==='number'?ch.before[k]:null;
3521
- const a=ch.after&&typeof ch.after[k]==='number'?ch.after[k]:null;
3522
- if(b===null||a===null) continue;
3523
- let d;
3524
- if(b!==0){ d=Math.round((a-b)/b*100); d=(d>0?'+':'')+d+'%'; }
3525
- else { d=(a===0?'±0%':b+'→'+a); }
3526
- parts.push(ch.id+' '+d);
3527
- }
3528
- return parts.length?' ('+parts.join(', ')+')':'';
3583
+ /* the good-direction word derives off the map — 'fewer is better' for a
3584
+ down-good metric — never written inline per row */
3585
+ const better=k=>MP_GOOD[k]==='down'?'fewer is better':'more is better';
3586
+ /* ONE trend chip per row (#593): the window's covered registry entries for
3587
+ the metric aggregate into a single NET move — oldest before → newest
3588
+ after, so successive changes read as one line. The ARROW is the sign of
3589
+ the move (↓ a<b, ↑ a>b); the COLOR says whether that direction is good
3590
+ for the metric (MP_GOOD) — green = improving regardless of sign. pct
3591
+ when the oldest before is nonzero, the raw pair otherwise (a 0→x move
3592
+ has no honest percentage); a flat pair is ±0%; no covered entry → the
3593
+ gray no-baseline dash. */
3594
+ const chip=(k)=>{
3595
+ const es=(Array.isArray(mp.changes)?mp.changes:[])
3596
+ .filter(ch=>ch&&ch.before&&typeof ch.before[k]==='number'&&ch.after&&typeof ch.after[k]==='number')
3597
+ .sort((x,y)=>(x.date<y.date?-1:x.date>y.date?1:0));
3598
+ if(!es.length) return '<span class="l1chip flat">—</span>';
3599
+ const b=es[0].before[k], a=es[es.length-1].after[k];
3600
+ if(a===b) return '<span class="l1chip flat">±0%</span>';
3601
+ const text=b!==0?Math.abs(Math.round((a-b)/b*100))+'%':b+'→'+a;
3602
+ const arrow=a<b?'↓':'↑';
3603
+ const cls=(MP_GOOD[k]==='down'?a<b:a>b)?'good':'bad';
3604
+ return '<span class="l1chip '+cls+'">'+arrow+text+'</span>';
3529
3605
  };
3530
- const bs=(typeof t.block_size==='number'&&isFinite(t.block_size))?t.block_size.toFixed(2):'—';
3606
+ const bs=(typeof t.block_size==='number'&&isFinite(t.block_size))?t.block_size.toFixed(1):'—';
3531
3607
  const cs=(typeof t.cross_share==='number'&&isFinite(t.cross_share))?Math.round(t.cross_share*100)+'%':'—';
3532
3608
  const cv=(typeof t.attribution_coverage==='number'&&isFinite(t.attribution_coverage))?Math.round(t.attribution_coverage*100)+'%':'—';
3533
3609
  const sb=(typeof t.sub_bar_share==='number'&&isFinite(t.sub_bar_share))?Math.round(t.sub_bar_share*100)+'%':'—';
3534
3610
  const rc=(typeof t.recycling==='number'&&isFinite(t.recycling))?Math.round(t.recycling).toString():'—';
3535
- el('l1-blk').innerHTML='<b>Block: '+bs+' lines/push</b>'+tag('block_size');
3536
- el('l1-cross').textContent='Cross-project: '+cs+' (attributed '+cv+')'+tag('cross_share');
3537
- el('l1-sub').textContent='Sub-bar: '+sb+' below bar '+(typeof t.cross_project_bar==='number'?t.cross_project_bar.toFixed(2):'—')+tag('sub_bar_share');
3538
- el('l1-recy').textContent='Recycling: '+rc+' memories/day'+tag('recycling');
3539
- el('l1-vol').textContent=fmt(t.pushes)+' pushes · '+fmt(t.lines)+' lines';
3540
- }
3541
-
3542
- /* divergence drawer (#578 audit: off the face, into the details element).
3543
- The count rides the summary; the ≤3 lines ride the drawer body — no memory
3544
- lists on the card FACE (the 2026-09-12 ruling stands; a drawer is not a
3545
- face row). */
3546
- function renderRecDivDet(mp){
3547
- const dd=el('rec-divdet'), dn=el('rec-divn'), dl=el('rec-div-lines');
3548
- if(!dd||!dn||!dl) return;
3549
- const dv=mp&&mp.divergence, n=(dv&&typeof dv.count==='number')?dv.count:0;
3550
- if(!dv||!n){ dd.hidden=true; return; }
3551
- dd.hidden=false;
3552
- dn.textContent=n;
3553
- dl.innerHTML='';
3554
- for(const it of (dv.top||[])){
3555
- const d=document.createElement('div');
3556
- d.className='rec-line';
3557
- d.textContent=it.line+' ('+it.shown+'×)';
3558
- dl.appendChild(d);
3559
- }
3611
+ const bar=(typeof t.cross_project_bar==='number'&&isFinite(t.cross_project_bar))?t.cross_project_bar.toFixed(2):'—';
3612
+ el('l1-blk').innerHTML='<span class="l1v">'+bs+'</span><span class="l1l">'+MP_NAME.block_size+'</span>'+chip('block_size');
3613
+ el('l1-blk').title='average memories shown per prompt — '+better('block_size');
3614
+ el('l1-cross').innerHTML='<span class="l1v">'+cs+'</span><span class="l1l">'+MP_NAME.cross_share+'</span>'+chip('cross_share');
3615
+ el('l1-cross').title='share of attributable pushed lines from a different project ('+better('cross_share')+') · attribution coverage '+cv;
3616
+ el('l1-sub').innerHTML='<span class="l1v">'+sb+'</span><span class="l1l">'+MP_NAME.sub_bar_share+'</span>'+chip('sub_bar_share');
3617
+ el('l1-sub').title='foreign-project lines below the cross-project bar ('+bar+') — '+better('sub_bar_share');
3618
+ el('l1-recy').innerHTML='<span class="l1v">'+rc+'<i class="l1u">/day</i></span><span class="l1l">'+MP_NAME.recycling+'</span>'+chip('recycling');
3619
+ el('l1-recy').title='average distinct memories shown per day — '+better('recycling');
3620
+ el('l1-vol').innerHTML=fmt(t.pushes)+' prompts · '+fmt(t.lines)+' memories shown';
3621
+ el('l1-vol').title='denominators: recall pushes · pushed index lines';
3560
3622
  }
3561
3623
 
3562
3624
  /* ---------- corpus &amp; graded drawer (#578): the snapshot-stamped half.
@@ -3592,30 +3654,41 @@ function renderRecSeries(){
3592
3654
  row('graded useful',(typeof g.useful_share==='number'?Math.round(g.useful_share*100)+'%':'—')+' of '+(typeof g.graded==='number'?g.graded:0)+' verdicts');
3593
3655
  }
3594
3656
 
3595
- /* ---------- contested drawer (#578 judgment layer). Lazy by design: graded
3596
- data NEVER rides the memory_precision block (≤ 2 KB discipline); the list
3597
- is fetched on FIRST OPEN of the details element only, then kept in sync
3598
- after each thumb. Thumbs PUT /dashboard/quality/verdict {id, verdict:
3599
- 1|-1} (numeric — the server's strict body), and a thumbed item leaves the
3600
- list (the server clears owner-answered rows). Fail-soft: a fetch error
3601
- renders the error line, never a dead drawer. */
3657
+ /* ---------- contested drawer (#578 judgment layer). Graded data NEVER
3658
+ rides the memory_precision block (≤ 2 KB discipline); the list comes
3659
+ from the paginated endpoint. #593 makes the row PRESENCE-GATED: hidden
3660
+ in markup, the count loads EAGERLY at band render (one guarded GET) and
3661
+ the row appears only when the opt-in weekly lane ran AND something is
3662
+ contested — a hidden row claims nothing, so the zero-state strings are
3663
+ gone. Thumbs PUT /dashboard/quality/verdict {id, verdict:1|-1}
3664
+ (numeric — the server's strict body), a thumbed item leaves the list
3665
+ (the server clears owner-answered rows), and thumbing away the last row
3666
+ re-hides it. Fail-soft: a fetch error keeps the row hidden — an unknown
3667
+ count never earns a place on the face. */
3668
+ function newestGradedCount(){
3669
+ if(!D||!Array.isArray(D.series)) return null;
3670
+ for(let i=D.series.length-1;i>=0;i--){
3671
+ const q=D.series[i]&&D.series[i].metrics&&D.series[i].metrics.quality;
3672
+ if(q&&q.graded&&typeof q.graded.graded==='number') return q.graded.graded;
3673
+ }
3674
+ return null;
3675
+ }
3602
3676
  let CONTESTED_LOADED=false;
3603
3677
  async function loadContested(force){
3604
- const box=el('rec-contest-rows'), num=el('rec-contest-n');
3678
+ const box=el('rec-contest-rows'), num=el('rec-contest-n'), det=el('rec-contest');
3605
3679
  if(!box) return;
3606
3680
  if(CONTESTED_LOADED&&!force) return;
3607
3681
  try{
3608
3682
  const r=await api('/dashboard/quality/contested?limit=20');
3609
3683
  CONTESTED_LOADED=true;
3684
+ const items=r.items||[];
3685
+ const graded=newestGradedCount();
3686
+ const show=items.length>0&&graded!==0;
3687
+ if(det) det.hidden=!show;
3688
+ if(!show){ box.innerHTML=''; return; }
3610
3689
  if(num) num.textContent=String(r.total);
3611
3690
  box.innerHTML='';
3612
- box.classList.remove('rec-contest-empty');
3613
- if(!r.items||!r.items.length){
3614
- box.classList.add('rec-contest-empty');
3615
- box.textContent='nothing contested — the grader is confident this week';
3616
- return;
3617
- }
3618
- for(const it of r.items){
3691
+ for(const it of items){
3619
3692
  const row=document.createElement('div');
3620
3693
  row.className='rec-item';
3621
3694
  const line=document.createElement('span');
@@ -3632,8 +3705,12 @@ async function loadContested(force){
3632
3705
  try{
3633
3706
  await api('/dashboard/quality/verdict',{method:'PUT',body:JSON.stringify({id:it.id,verdict:v})});
3634
3707
  row.remove();
3635
- if(num) num.textContent=String(Math.max(0,(parseInt(num.textContent,10)||1)-1));
3636
- }catch(e){ /* fail-soft: the row stays, the next open retries */ }
3708
+ if(num){
3709
+ const left=Math.max(0,(parseInt(num.textContent,10)||1)-1);
3710
+ num.textContent=String(left);
3711
+ if(left===0&&det) det.hidden=true; /* thumbing away the last row re-hides */
3712
+ }
3713
+ }catch(e){ /* fail-soft: the row stays, the next load retries */ }
3637
3714
  };
3638
3715
  up.addEventListener('click',()=>send(1));
3639
3716
  down.addEventListener('click',()=>send(-1));
@@ -3641,14 +3718,9 @@ async function loadContested(force){
3641
3718
  box.appendChild(row);
3642
3719
  }
3643
3720
  }catch(e){
3644
- box.classList.add('rec-contest-empty');
3645
- box.textContent='contested list unavailable ('+(e&&e.message?e.message:'load failed')+')';
3721
+ if(det) det.hidden=true; /* fail-soft: an unknown count stays off the face */
3646
3722
  }
3647
3723
  }
3648
- (function(){
3649
- const det=el('rec-contest');
3650
- if(det) det.addEventListener('toggle',()=>{ if(det.open) loadContested(); });
3651
- })();
3652
3724
 
3653
3725
  let MODEL_LABEL='';
3654
3726
  /* #409 fix round 5 — owner ruling 2026-09-14 (verbatim): "I do NOT want to
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamaze/hicortex",
3
- "version": "0.26.0",
3
+ "version": "0.26.2",
4
4
  "description": "Persistent agent identity for AI agents \u2014 a hand-edited identity layer, nightly-distilled experience, and lessons injected every session, shared across your whole fleet. Works with Hermes, OpenClaw, Claude Code, Pi, and opencode.",
5
5
  "main": "dist/index.js",
6
6
  "bin": {
package/server.json CHANGED
@@ -3,12 +3,12 @@
3
3
  "name": "io.github.gamaze-labs/hicortex",
4
4
  "title": "Hicortex \u2014 AI Fleet Memory",
5
5
  "description": "Shared fleet memory for AI agents: nightly self-correction, recall every prompt (supported agents).",
6
- "version": "0.26.0",
6
+ "version": "0.26.2",
7
7
  "packages": [
8
8
  {
9
9
  "registryType": "npm",
10
10
  "identifier": "@gamaze/hicortex",
11
- "version": "0.26.0",
11
+ "version": "0.26.2",
12
12
  "transport": {
13
13
  "type": "stdio",
14
14
  "command": "npx",