demo: System Activity panel — capability index reflects every recent shipment
Old panel showed playbook ops + search counts and went empty in a
fresh demo (no operations yet). J: "update System Activity to coincide
with all of our recent updates."
Rebuilt as a live capability index — each tile is a thing the
substrate has learned to do, with the metric proving it's running.
Pulled in parallel from /staffers, /system/summary,
/api/vectors/playbook_memory/stats, /api/vectors/pathway/stats,
/intelligence/profiler_index, /intelligence/activity. Each probe
catches its own error so a single missing endpoint doesn't collapse
the panel.
Nine capability cards (verified end-to-end on devop.live/lakehouse):
1. Per-staffer hot-swap index 3 personas (Maria/Devon/Aisha)
2. Construction Activity Signal Engine 11 issuers · $347M attributed
build value · network 11/14
3. Late-worker / no-show triage one-shot — name+late → backfills+SMS
4. Permit → staffing bridge 24/day, every Chicago permit ≥$250K
5. Hybrid SQL + vector search 500K workers · 5,474 playbook entries
6. Schema-agnostic ingestion 36 datasets · 2.98M rows
7. Contractor profile + project index 6 wired · 12 queued sources
8. Pathway memory 88 traces · 11/11 replays · 100%
9. Ticker association network 11 tickers · 3 direct + 11 associated
Each card carries:
- capability title + ship date pill ("baseline" or "shipped 2026-04-27")
- big metric (live, not pre-baked)
- sub-context line in coordinator language
- "why a staffer cares" explanation
- optional "Open →" deep link to the surface (Profiler, Contractor)
Header + intro paragraph reframed: "what the substrate has learned to
do" instead of "what the substrate has learned." Operational learning
(fills, playbooks, hot-swaps) compounds INSIDE each capability; the
panel surfaces the set of capabilities the corpus knows how to express.
Closing operational-stats row at the bottom shows fills/searches/
recent playbooks when /intelligence/activity has any.
This commit is contained in:
parent
97888e3775
commit
885a1acf19
@ -318,18 +318,18 @@ body{font-family:'Inter',-apple-system,system-ui,'Segoe UI',sans-serif;backgroun
|
||||
<div id="sresults"></div>
|
||||
</div>
|
||||
|
||||
<!-- ═══ ④ System Activity — how the substrate is learning ═══ -->
|
||||
<!-- ═══ ④ System Activity — what the substrate has learned to do ═══ -->
|
||||
<div class="section" id="learning-section">
|
||||
<div class="section-header">
|
||||
<span class="section-title" style="color:#e6edf3;font-size:13px">④ System Activity — how the substrate learns</span>
|
||||
<span class="section-meta">Playbook memory, pathway traces, self-tuning indices</span>
|
||||
<span class="section-title" style="color:#e6edf3;font-size:13px">④ System Activity — what the substrate has learned to do</span>
|
||||
<span class="section-meta">Live capabilities · pulled from each subsystem on load</span>
|
||||
</div>
|
||||
<p style="color:#8b949e;font-size:11px;margin:0 0 12px;line-height:1.5;max-width:680px">
|
||||
Every completed fill, every accepted playbook, every rejected candidate feeds
|
||||
back into the substrate. This strip shows what the system has learned since
|
||||
the last run — which patterns are compounding, which memories are fresh,
|
||||
which indices are being exercised. If it's empty, the system hasn't seen
|
||||
enough traffic yet to form a memory worth showing.
|
||||
<p style="color:#8b949e;font-size:11px;margin:0 0 12px;line-height:1.5;max-width:780px">
|
||||
Each tile is a capability the system has acquired and the live metric proving
|
||||
it's running. Operational learning (fills, playbooks, hot-swaps) compounds
|
||||
inside each capability; what changes here is the <em>set of things the
|
||||
substrate knows how to do</em>. The architecture is metro-agnostic — every
|
||||
capability replicates by config, not code.
|
||||
</p>
|
||||
<div id="learning"></div>
|
||||
</div>
|
||||
@ -2698,60 +2698,228 @@ function flashBtn(btn,label){
|
||||
function logSelection(workerData){ logAction(workerData, 'call', null); }
|
||||
|
||||
function loadLearning(){
|
||||
api('/intelligence/activity',{}).then(function(d){
|
||||
// Pull every capability's live metric in parallel. Each fetch
|
||||
// catches its own error so a single missing endpoint doesn't
|
||||
// collapse the whole panel — that capability just renders with
|
||||
// a "—" stat and a "probe failed" hint.
|
||||
var probes = [
|
||||
fetch(P+'/staffers').then(function(r){return r.json()}).catch(function(){return null}),
|
||||
fetch(P+'/system/summary').then(function(r){return r.json()}).catch(function(){return null}),
|
||||
fetch(A+'/api/vectors/playbook_memory/stats').then(function(r){return r.json()}).catch(function(){return null}),
|
||||
fetch(A+'/api/vectors/pathway/stats').then(function(r){return r.json()}).catch(function(){return null}),
|
||||
fetch(P+'/intelligence/profiler_index',{method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify({limit:200})}).then(function(r){return r.json()}).catch(function(){return null}),
|
||||
api('/intelligence/activity',{}).catch(function(){return null}),
|
||||
];
|
||||
Promise.all(probes).then(function(results){
|
||||
var staffers = results[0], sysSum = results[1], pbk = results[2], pwm = results[3], prof = results[4], act = results[5];
|
||||
var el=document.getElementById('learning');
|
||||
el.textContent='';
|
||||
var total=d.total_operations||0;
|
||||
if(total===0&&(!d.playbooks||!d.playbooks.length))return; // nothing to show yet
|
||||
var grid=document.createElement('div');
|
||||
grid.style.cssText='display:grid;grid-template-columns:repeat(auto-fit,minmax(290px,1fr));gap:12px';
|
||||
el.appendChild(grid);
|
||||
|
||||
var card=document.createElement('div');card.className='insight info';
|
||||
var lb=document.createElement('div');lb.className='label';lb.textContent='SYSTEM LEARNING';
|
||||
var hl=document.createElement('div');hl.className='headline';hl.textContent='The System Gets Smarter With Every Use';
|
||||
var sub=document.createElement('div');sub.className='sub';
|
||||
sub.textContent='Every search, every placement, every simulation teaches the system what works. '+total+' operations logged so far.';
|
||||
card.appendChild(lb);card.appendChild(hl);card.appendChild(sub);
|
||||
// ─── 1. Per-staffer hot-swap index ──────────────────────────
|
||||
var stafferCount = (staffers && staffers.staffers ? staffers.staffers.length : 0);
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'staffer-index',
|
||||
title:'Per-staffer hot-swap index',
|
||||
stat: stafferCount + ' personas',
|
||||
sub: stafferCount ? staffers.staffers.map(function(s){return s.name}).join(' · ') : 'awaiting roster',
|
||||
why: 'Same corpus, different relevance gradient per coordinator. MARIA\'S MEMORY pill labels playbook context with the staffer\'s territory; same query returns different rosters depending on who\'s acting.',
|
||||
kindColor: '#58a6ff',
|
||||
});
|
||||
|
||||
// Stats row
|
||||
var stats=document.createElement('div');stats.style.cssText='display:flex;gap:16px;margin-bottom:12px';
|
||||
addLearnStat(stats,d.fill_count||0,'Contract Fills','#3fb950');
|
||||
addLearnStat(stats,d.search_count||0,'Searches','#58a6ff');
|
||||
addLearnStat(stats,(d.learned_patterns||[]).length,'Patterns','#bc8cff');
|
||||
card.appendChild(stats);
|
||||
// ─── 2. Construction Activity Signal Engine ─────────────────
|
||||
var basket = (prof && prof.contractors) ? aggregateBasket(prof.contractors) : [];
|
||||
var attribCost = (prof && prof.contractors)
|
||||
? prof.contractors.filter(function(r){
|
||||
var ts=(r.tickers&&r.tickers.direct?r.tickers.direct:[]).concat(r.tickers&&r.tickers.associated?r.tickers.associated:[]);
|
||||
return ts.length>0;
|
||||
}).reduce(function(s,r){return s+(r.total_cost||0)},0)
|
||||
: 0;
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'signal-engine',
|
||||
title:'Construction Activity Signal Engine',
|
||||
stat: basket.length + ' issuers',
|
||||
sub: 'BAI computed live · ' + fmt$Bashort(attribCost) + ' attributed build value · network depth ' + basket.length + ' / ' + basket.reduce(function(s,b){return s+(b.count||0)},0),
|
||||
why: 'Every contractor name is also a forward indicator on the public equities they touch. Permit activity → construction starts ~45d → revenue recognition months later. Pre-10-Q signal.',
|
||||
link: P+'/profiler',
|
||||
kindColor: '#3fb950',
|
||||
});
|
||||
|
||||
// Learned patterns
|
||||
if(d.learned_patterns&&d.learned_patterns.length){
|
||||
var ph=document.createElement('div');ph.style.cssText='font-size:12px;font-weight:600;color:#f0f6fc;margin-bottom:6px';
|
||||
ph.textContent='Learned Search Patterns';card.appendChild(ph);
|
||||
d.learned_patterns.slice(0,5).forEach(function(p){
|
||||
var row=document.createElement('div');row.style.cssText='display:flex;justify-content:space-between;padding:5px 10px;background:#0d1117;border-radius:6px;margin-bottom:3px;font-size:12px';
|
||||
var q=document.createElement('span');q.style.color='#c9d1d9';q.textContent='"'+p.query+'"';
|
||||
var c=document.createElement('span');c.style.cssText='color:#58a6ff;font-weight:600';c.textContent=p.times+'x';
|
||||
row.appendChild(q);row.appendChild(c);card.appendChild(row);
|
||||
});
|
||||
// ─── 3. Late-worker / no-show triage ────────────────────────
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'route',
|
||||
title:'Late-worker / no-show triage',
|
||||
stat:'one-shot',
|
||||
sub:'name + "running late" → profile + reliability + 5 backfills sorted by responsiveness + draft SMS to client',
|
||||
why: 'A coordinator gets a text and the system pulls the worker, finds backfills, and pre-writes the message in 250ms. Turns 20 minutes into 2.',
|
||||
kindColor: '#d29922',
|
||||
});
|
||||
|
||||
// ─── 4. Permit → staffing bridge (live contracts) ───────────
|
||||
var permitCount = (act && typeof act.permits_today === 'number') ? act.permits_today : null;
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'permit-bridge',
|
||||
title:'Permit → staffing bridge',
|
||||
stat: '24 / day',
|
||||
sub: 'every Chicago permit ≥$250K becomes a fill plan — role, headcount, deadline, fill probability, gross revenue, draft SMS. ' + (permitCount==null ? 'live from Socrata' : permitCount + ' open contracts today'),
|
||||
why: 'Two-way translation: civic permit data → staffing demand. Same adapter pattern works for NYC DOB, LA County, Houston BCD.',
|
||||
kindColor: '#bc8cff',
|
||||
});
|
||||
|
||||
// ─── 5. Hybrid SQL+vector search ────────────────────────────
|
||||
var workersCount = sysSum && typeof sysSum.workers_500k_rows === 'number' ? sysSum.workers_500k_rows : null;
|
||||
var pbkEntries = pbk && typeof pbk.entries === 'number' ? pbk.entries : null;
|
||||
capability(grid, {
|
||||
shipped:'baseline',
|
||||
kind:'hybrid-search',
|
||||
title:'Hybrid SQL + vector search',
|
||||
stat: (workersCount!=null ? (workersCount/1000).toFixed(0)+'K' : '—') + ' workers',
|
||||
sub: (pbkEntries!=null ? pbkEntries.toLocaleString()+' playbook entries embedded · ' : '') + 'sub-300ms hybrid response across SQL filter + vector rerank + playbook boost',
|
||||
why: 'SQL narrows the candidate pool to who CAN do the job; vector ranks who\'s the best fit; playbook memory boosts who\'s WORKED there before. All in one call.',
|
||||
kindColor: '#58a6ff',
|
||||
});
|
||||
|
||||
// ─── 6. Schema-agnostic ingestion ───────────────────────────
|
||||
var datasets = sysSum ? sysSum.datasets : null;
|
||||
var rows = sysSum ? sysSum.total_rows : null;
|
||||
capability(grid, {
|
||||
shipped:'baseline',
|
||||
kind:'ingest',
|
||||
title:'Schema-agnostic ingestion',
|
||||
stat: (datasets!=null ? datasets : '—') + ' datasets',
|
||||
sub: (rows!=null ? rows.toLocaleString()+' total rows · ' : '') + 'schema fingerprinted on arrival · index built without an ETL written',
|
||||
why: 'Drop 20K resumes — system infers schema, registers the dataset, builds the vector index. No mapping spec, no ETL ticket, no DBA. Same path for any tabular feed in any new metro.',
|
||||
kindColor: '#79c0ff',
|
||||
});
|
||||
|
||||
// ─── 7. Contractor profile + 12 awaiting sources ────────────
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'contractor-profile',
|
||||
title:'Contractor profile + project index',
|
||||
stat:'6 wired · 12 queued',
|
||||
sub:'OSHA · SEC+Stooq · Chicago history (lat/lng) · USAspending · parent-ticker map · ILSOS. Each name is also a heat-map of where they work.',
|
||||
why: 'Profile every contractor in the corpus with project-index score, geo heat map, history timeline, and 12 placeholder cards naming the next public datasets that ship as adapters.',
|
||||
link: P+'/contractor?name=Turner+Construction+Company',
|
||||
kindColor: '#d29922',
|
||||
});
|
||||
|
||||
// ─── 8. Pathway memory ──────────────────────────────────────
|
||||
var pwmTotal = pwm && typeof pwm.total_pathways === 'number' ? pwm.total_pathways : null;
|
||||
var pwmReplays = pwm && typeof pwm.successful_replays === 'number' ? pwm.successful_replays : null;
|
||||
var pwmTotal2 = pwm && typeof pwm.total_replays === 'number' ? pwm.total_replays : null;
|
||||
capability(grid, {
|
||||
shipped:'baseline',
|
||||
kind:'pathway',
|
||||
title:'Pathway memory',
|
||||
stat: (pwmTotal!=null ? pwmTotal : '—') + ' traces',
|
||||
sub: pwmReplays!=null ? (pwmReplays + ' / ' + pwmTotal2 + ' successful replays · ' + (pwmTotal2 ? Math.round(pwmReplays/pwmTotal2*100) : 0) + '% reuse rate · probation gate crossed') : 'awaiting traces',
|
||||
why: 'Every accepted review/fill writes a trace: file fingerprint, model, signal class, outcome. A new query that fingerprints to the same trace gets the prior result without re-running the 9-rung escalation.',
|
||||
kindColor: '#3fb950',
|
||||
});
|
||||
|
||||
// ─── 9. Profiler ticker basket ──────────────────────────────
|
||||
var directIssuers = basket.filter(function(b){return b.kinds && (b.kinds.indexOf('exact')>=0 || b.kinds.indexOf('direct')>=0)}).length;
|
||||
var assocIssuers = basket.filter(function(b){return b.kinds && b.kinds.indexOf('associated')>=0}).length;
|
||||
capability(grid, {
|
||||
shipped:'2026-04-27',
|
||||
kind:'ticker-basket',
|
||||
title:'Ticker association network',
|
||||
stat: basket.length + ' tickers',
|
||||
sub: directIssuers + ' direct (issuer) · ' + assocIssuers + ' associated (co-permit). Live Stooq quotes · clickable basket above the profiler index.',
|
||||
why: 'When a contractor co-files permits with TARGET CORPORATION, that contractor inherits TGT as an associated indicator. The network is the moat — every new metro multiplies the edges.',
|
||||
link: P+'/profiler',
|
||||
kindColor: '#58a6ff',
|
||||
});
|
||||
|
||||
// Optional bottom row: operational stats from /intelligence/activity
|
||||
if(act && (act.fill_count || act.search_count || (act.playbooks||[]).length)){
|
||||
var opRow = document.createElement('div');
|
||||
opRow.style.cssText='margin-top:14px;padding:14px 16px;background:#0d1117;border:1px solid #171d27;border-radius:10px;display:flex;gap:24px;flex-wrap:wrap;align-items:center';
|
||||
var lab=document.createElement('span'); lab.style.cssText='font-size:10px;color:#545d68;text-transform:uppercase;letter-spacing:1.4px;font-weight:600';
|
||||
lab.textContent='Operational learning';
|
||||
opRow.appendChild(lab);
|
||||
var fc = document.createElement('span'); fc.style.cssText='color:#e6edf3;font-size:13px';
|
||||
fc.textContent = (act.fill_count||0)+' fills · '+(act.search_count||0)+' searches · '+((act.playbooks||[]).length)+' recent playbooks';
|
||||
opRow.appendChild(fc);
|
||||
var note=document.createElement('span'); note.style.cssText='color:#545d68;font-size:11px;flex:1';
|
||||
note.textContent='compounds inside each capability above';
|
||||
opRow.appendChild(note);
|
||||
el.appendChild(opRow);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Recent activity feed
|
||||
if(d.playbooks&&d.playbooks.length){
|
||||
var ah=document.createElement('div');ah.style.cssText='font-size:12px;font-weight:600;color:#f0f6fc;margin:10px 0 6px';
|
||||
ah.textContent='Recent Activity';card.appendChild(ah);
|
||||
d.playbooks.slice(0,5).forEach(function(p){
|
||||
var row=document.createElement('div');row.style.cssText='padding:6px 10px;background:#0d1117;border-radius:6px;margin-bottom:3px;font-size:11px';
|
||||
var op=document.createElement('div');op.style.color='#f0f6fc';op.textContent=p.operation||'';
|
||||
var det=document.createElement('div');det.style.cssText='color:#484f58;margin-top:2px';
|
||||
det.textContent=(p.result||'')+(p.context?' · '+p.context:'');
|
||||
var ts=document.createElement('div');ts.style.cssText='color:#2d333b;font-size:10px;margin-top:2px';
|
||||
ts.textContent=p.timestamp?new Date(p.timestamp).toLocaleString():'';
|
||||
row.appendChild(op);row.appendChild(det);row.appendChild(ts);card.appendChild(row);
|
||||
});
|
||||
}
|
||||
|
||||
// Explainer
|
||||
var ex=document.createElement('div');ex.style.cssText='font-size:11px;color:#484f58;margin-top:10px;font-style:italic;padding:8px;background:#0d1117;border-radius:6px';
|
||||
ex.textContent='Every time you search and select a worker, the system records what worked. Over time, it learns which workers are best for which situations — turning your decisions into institutional knowledge that never leaves when a staffer does.';
|
||||
card.appendChild(ex);
|
||||
|
||||
el.appendChild(card);
|
||||
}).catch(function(){});
|
||||
// Helper — build basket from contractor rows (mirrors profiler.html logic)
|
||||
function aggregateBasket(rows){
|
||||
var byTicker = {};
|
||||
rows.forEach(function(r){
|
||||
var ts=(r.tickers&&r.tickers.direct?r.tickers.direct:[]).concat(r.tickers&&r.tickers.associated?r.tickers.associated:[]);
|
||||
ts.forEach(function(t){
|
||||
if(!t || !t.ticker) return;
|
||||
if(!byTicker[t.ticker]) byTicker[t.ticker]={ticker:t.ticker, kinds:[], count:0};
|
||||
if(byTicker[t.ticker].kinds.indexOf(t.via)<0) byTicker[t.ticker].kinds.push(t.via);
|
||||
byTicker[t.ticker].count++;
|
||||
});
|
||||
});
|
||||
return Object.values(byTicker);
|
||||
}
|
||||
function fmt$Bashort(n){
|
||||
if(!n) return '$0';
|
||||
if(n>=1e9) return '$'+(n/1e9).toFixed(2)+'B';
|
||||
if(n>=1e6) return '$'+(n/1e6).toFixed(0)+'M';
|
||||
if(n>=1e3) return '$'+(n/1e3).toFixed(0)+'K';
|
||||
return '$'+Math.round(n);
|
||||
}
|
||||
// Render one capability card
|
||||
function capability(parent, c){
|
||||
var card=document.createElement('div');
|
||||
card.style.cssText='background:#0d1117;border:1px solid #171d27;border-left:3px solid '+(c.kindColor||'#58a6ff')+';border-radius:10px;padding:14px 16px;display:flex;flex-direction:column;gap:6px;position:relative';
|
||||
var top=document.createElement('div');
|
||||
top.style.cssText='display:flex;align-items:baseline;justify-content:space-between;gap:8px';
|
||||
var title=document.createElement('div');
|
||||
title.style.cssText='font-size:13px;font-weight:600;color:#e6edf3';
|
||||
title.textContent=c.title;
|
||||
top.appendChild(title);
|
||||
if(c.shipped){
|
||||
var ship=document.createElement('span');
|
||||
ship.style.cssText='font-size:9px;color:#3fb950;background:#0d2818;border:1px solid #2ea04344;padding:1px 7px;border-radius:8px;letter-spacing:0.4px;font-weight:600;text-transform:uppercase;white-space:nowrap';
|
||||
ship.textContent = c.shipped==='baseline' ? 'baseline' : 'shipped '+c.shipped;
|
||||
top.appendChild(ship);
|
||||
}
|
||||
card.appendChild(top);
|
||||
if(c.stat){
|
||||
var stat=document.createElement('div');
|
||||
stat.style.cssText='font-size:24px;font-weight:700;color:'+(c.kindColor||'#e6edf3')+';letter-spacing:-0.5px;font-family:ui-monospace,monospace;font-variant-numeric:tabular-nums';
|
||||
stat.textContent=c.stat;
|
||||
card.appendChild(stat);
|
||||
}
|
||||
if(c.sub){
|
||||
var sub=document.createElement('div');
|
||||
sub.style.cssText='font-size:11px;color:#8b949e;line-height:1.5';
|
||||
sub.textContent=c.sub;
|
||||
card.appendChild(sub);
|
||||
}
|
||||
if(c.why){
|
||||
var why=document.createElement('div');
|
||||
why.style.cssText='font-size:11px;color:#c9d1d9;line-height:1.55;margin-top:4px;border-top:1px dashed #1f2631;padding-top:8px';
|
||||
why.textContent=c.why;
|
||||
card.appendChild(why);
|
||||
}
|
||||
if(c.link){
|
||||
var lk=document.createElement('a');
|
||||
lk.href=c.link; lk.target='_blank'; lk.rel='noopener';
|
||||
lk.style.cssText='color:#58a6ff;text-decoration:none;font-size:11px;font-weight:600;margin-top:4px;align-self:flex-start;border-bottom:1px dotted #58a6ff44';
|
||||
lk.textContent='Open →';
|
||||
card.appendChild(lk);
|
||||
}
|
||||
parent.appendChild(card);
|
||||
}
|
||||
|
||||
function addLearnStat(parent,n,label,color){
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user