GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / AI agents and coordination / testcode / spider/20260914T143049Z-v5-linkify-frontdoor-brandfaithful

Spider — V5 Linkify Frontdoor Brandfaithful Page and 1 more file

A web page in Testcode that draws engine graph, genome spider and identity, and uses data from Elexon Balancing Mechanism Reporting Service (BMRS) and the spiders and data-federation-map-for-GlobalGrid2050-all-repos repositories.

377 lines of HTML and Python from testcode, tokens, in 2 files. Topic: AI agents and coordination. Section 1664 of 2044.

Cut 2026-12-06T03:07:51+00:00. A copy for reading; the repository at the stated commit is the source.

In the State lines below, domain stage, users and canonical status are rule-based first approximations from code and path evidence (rules explore-agent-rules-v1), not observed facts: the rules.

In this section

  1. Spider — V5 Linkify Frontdoor Brandfaithful Page render · testcode / spider/20260914T143049Z-v5-linkify-frontdoor-brandfaithful/index.html lines 1–328
  2. Budget Guard other · tokens / tools/budget_guard.py lines 1–49

Spider — V5 Linkify Frontdoor Brandfaithful Page

A web page in Testcode that draws engine graph, genome spider and identity, and uses data from Elexon Balancing Mechanism Reporting Service (BMRS) and the spiders and data-federation-map-for-GlobalGrid2050-all-repos repositories.

rendertestcode / spider/20260914T143049Z-v5-linkify-frontdoor-brandfaithful/index.html · lines 1–328 of 328 · version 2026-09-14 14:30 · Entry point · pattern deriveLinks (shared by 3 files)

What it does
It draws engine graph, genome spider and identity. Defines 23 functions or classes, including applyRootLinks, S, rebuildSelect, actionable, openUrl. Side effects: changes the web page (DOM); makes network requests; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'spider'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief). README: "The publication checkout is sparse: `index.html` and the complete `uk_renewables_pipeline/` tree."
Inputs & outputs
In: data source: spiders data; data source: data-federation-map-for-globalgrid2050-all-repos data; data source: Elexon BMRS; data source: stars data; JSON file nodes.json; JSON file edges.json; JSON file engine-graph.json; JSON file genome-spider.json. Out: web page; SVG drawing.
Downstream impact
It is itself an entry point (page); no other file was found loading it.
What it achieves
It applies root links (`applyRootLinks`), rebuilds select (`rebuildSelect`) and opens URL (`openUrl`). Ventus Global Grid 2050. It reads `./spider/identity.json`. It responds to change and click events.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
testcode · spider/20260914T143049Z-v5-linkify-frontdoor-brandfaithful · page
Uses
Estate Menu (script src), Live Sandbox — Federation Control Ledger Page (estate URL), Stars — Index Page (estate URL), ./spider/federation_radial.css
Used by
none found
Produces
applyRootLinks, S, rebuildSelect, actionable, openUrl, handleTap, handleTap_, drillInto, popTo, neighbours, deriveLinks, linkify
Defines here
applyRootLinks, S, rebuildSelect, actionable, openUrl, handleTap, handleTap_, drillInto, popTo, neighbours, deriveLinks, linkify, goLabel, distribute, bundled, reshapeNodes, loadJSON, loadRoot, placeholderScope, resolveRef, normaliseGenericGraph, loadManifestScope, wireReceiver
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
testcode@a8a215982b13d6e2f6019b40bf0bef5755719773 spider/20260914T143049Z-v5-linkify-frontdoor-brandfaithful/index.html:1-328 · blob 8a4847e95b5c03116bf9a7ffd14a2587c3aca1dc · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, network, storage · domain stage: agent_infra · users: ai_agent · canonical: unknown
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1, viewport-fit=cover" />
<title>Ventus Global Grid 2050 · The Spider Sandbox</title>
<style>
  :root{
    --bg:#0b0d12;--panel:#12151c;--panel2:#151923;--line:#262b36;--text:#eef2fb;--muted:#9aa3b5;--cyan:#00e5ff;
    --e-data:#00e5ff;--e-governance:#b47cff;--e-archive:#7da0c8;--e-external:#5f76a4;--e-repo:#b8ccff;--e-workflow:#00ffff;
    --safe-x:clamp(12px,2.3vw,28px);--shell:1040px;--card:220px;--gap:14px;
  }
  *{box-sizing:border-box}
  html,body{margin:0;min-height:100%}
  body{background:radial-gradient(1200px 700px at 50% -10%,rgba(0,229,255,.06),transparent 60%),var(--bg);color:var(--text);font-family:Inter,ui-sans-serif,system-ui,-apple-system,"Segoe UI",sans-serif;height:100dvh;overflow:hidden;display:flex;flex-direction:column}
  button,select{font:inherit}
  .top{border-bottom:1px solid var(--line);background:rgba(11,13,18,.92);backdrop-filter:blur(16px)}
  .bar,.controls,.crumbs,.hint{width:min(var(--shell),calc(100vw - var(--safe-x)*2));margin:0 auto}
  .bar{display:flex;align-items:center;gap:10px 14px;flex-wrap:wrap;padding:max(env(safe-area-inset-top),12px) 0 10px}
  .brand{display:flex;flex-direction:column;line-height:1.05;min-width:190px}
  .brand .ey{font-family:ui-monospace,SFMono-Regular,Menlo,monospace;font-size:.6rem;letter-spacing:.22em;text-transform:uppercase;color:var(--cyan)}
  .brand h1{margin:2px 0 0;font-size:1rem;font-weight:650}
  .pick{display:flex;align-items:center;gap:8px;flex:1 1 280px;min-width:0}
  .pick label,.grouplabel{font-family:ui-monospace,monospace;font-size:.58rem;letter-spacing:.16em;text-transform:uppercase;color:var(--muted);flex:none}
  select{flex:1 1 auto;min-width:0;background:var(--panel);color:var(--text);border:1px solid var(--line);border-radius:10px;padding:9px 32px 9px 12px;font-size:.85rem;cursor:pointer;appearance:none;background-image:linear-gradient(45deg,transparent 50%,var(--muted) 50%),linear-gradient(135deg,var(--muted) 50%,transparent 50%);background-position:calc(100% - 16px) center,calc(100% - 11px) center;b  … [line shortened here: 459 characters; full line on GitHub]
  select:focus-visible,button:focus-visible{outline:none;border-color:var(--cyan);box-shadow:0 0 0 2px rgba(0,229,255,.18)}
  .count{font-family:ui-monospace,monospace;font-size:.72rem;color:var(--muted);margin-left:auto;white-space:nowrap}
  .count b{color:var(--text);font-weight:600}
  .controls{display:flex;align-items:center;gap:8px 14px;flex-wrap:wrap;padding:8px 0 4px}
  .seg{display:inline-flex;border:1px solid var(--line);border-radius:999px;overflow:hidden;flex:none;background:rgba(18,21,28,.7)}
  .seg button{border:0;background:transparent;color:var(--muted);font-size:.72rem;padding:7px 13px;cursor:pointer;white-space:nowrap}
  .seg button[aria-pressed="true"]{background:rgba(0,229,255,.16);color:var(--text)}
  .seg button.gh[aria-pressed="true"]{background:rgba(184,204,255,.18)}
  .seg button.ext[aria-pressed="true"]{background:rgba(95,118,164,.28)}
  .seg button:disabled{opacity:.4;cursor:not-allowed}
  .viewbtn{border:1px solid rgba(255,255,255,.55);background:rgba(255,255,255,.08);color:#fff;border-radius:999px;padding:6px 12px;cursor:pointer;font-size:.86rem;line-height:1;display:inline-flex;align-items:center;gap:7px}
  .viewbtn[aria-pressed="true"]{border-color:var(--cyan);background:rgba(0,229,255,.16);box-shadow:0 0 22px rgba(0,229,255,.12)}
  .srctag{margin-left:auto;font-family:ui-monospace,monospace;font-size:.56rem;letter-spacing:.1em;text-transform:uppercase;color:var(--muted);border:1px solid var(--line);border-radius:999px;padding:2px 8px}
  .srctag.live{color:var(--cyan);border-color:rgba(0,229,255,.4)}
  .crumbs{display:flex;align-items:center;gap:6px;padding:2px 0 0;font-family:ui-monospace,monospace;font-size:.66rem;color:var(--muted);min-height:18px}
  .crumbs a{color:var(--cyan);cursor:pointer;text-decoration:none}
  .crumbs .sep{opacity:.5}
  .hint{padding:4px 0 8px;font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted)}
  .hint b{color:var(--text);font-weight:600}
  .stage{flex:1;min-height:0;position:relative;overflow:hidden}
  .overlay{position:absolute;inset:0}
  .overlay.column{overflow-y:auto;overflow-x:hidden;padding:16px var(--safe-x) max(env(safe-area-inset-bottom),22px)}
  .shell{width:min(var(--shell),100%);margin:0 auto;display:flex;flex-direction:column;gap:12px}
  .card{border:1px solid var(--line);border-radius:14px;background:linear-gradient(160deg,rgba(255,255,255,.055),rgba(255,255,255,.014));padding:10px 12px;display:flex;flex-direction:column;gap:6px;min-height:74px;box-shadow:0 16px 44px rgba(0,0,0,.12)}
  .card .row{display:flex;align-items:center;gap:7px}
  .badge{font-family:ui-monospace,monospace;font-size:.55rem;letter-spacing:.07em;border:1px solid var(--line);border-radius:6px;padding:2px 5px;color:var(--muted);flex:none}
  .name{font-size:.85rem;font-weight:650;line-height:1.15;overflow-wrap:anywhere}
  .dot{width:9px;height:9px;border-radius:50%;flex:none;margin-left:auto;box-shadow:0 0 8px currentColor}
  .reason{font-size:.68rem;color:var(--muted);line-height:1.25}
  .relrow{display:flex;align-items:center;gap:6px;flex-wrap:wrap}
  .reltag{font-family:ui-monospace,monospace;font-size:.55rem;letter-spacing:.05em;text-transform:uppercase;padding:1px 7px;border-radius:999px;border:1px solid currentColor}
  .arrow{font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted)}
  .go{font-family:ui-monospace,monospace;font-size:.6rem;color:var(--cyan);margin-left:auto}
  .is-center{border-color:var(--cyan);box-shadow:0 0 0 1px rgba(0,229,255,.22),0 0 26px rgba(0,229,255,.12)}
  .is-center .name{font-size:.95rem}
  .contents{align-self:flex-start;margin-top:3px;font-family:ui-monospace,monospace;font-size:.62rem;color:var(--cyan);border:1px solid rgba(0,229,255,.4);border-radius:999px;padding:4px 10px;background:rgba(0,229,255,.08);cursor:pointer}
  .inert{opacity:.34}
  .sect{font-family:ui-monospace,monospace;font-size:.6rem;letter-spacing:.14em;text-transform:uppercase;color:var(--muted);margin:16px 2px 4px}
  .branch{position:relative;padding-left:20px;display:flex;flex-direction:column;gap:9px}
  .branch::before{content:"";position:absolute;left:7px;top:-6px;bottom:14px;width:2px;background:var(--line)}
  .twig{position:relative;cursor:pointer}
  .twig::before{content:"";position:absolute;left:-13px;top:28px;width:13px;height:2px;background:var(--twig,var(--line))}
  .twig .card{border-left:3px solid var(--twig,var(--line))}
  .empty{color:var(--muted);font-size:.78rem;padding:6px 2px}
  .overlay.spider{overflow:auto;cursor:grab;background:radial-gradient(circle at center,rgba(0,229,255,.045),transparent 45%)}
  .overlay.spider.dragging{cursor:grabbing;user-select:none}
  .spiderCanvas{position:relative;min-width:100%;min-height:100%}
  .wirelabel{font:600 10px ui-monospace,SFMono-Regular,Menlo,monospace;letter-spacing:.06em;text-transform:uppercase;opacity:.9;pointer-events:none;paint-order:stroke;stroke:#0a0e14;stroke-width:3px;stroke-linejoin:round}
  .ver{font-size:.55em;color:var(--muted);font-weight:400;margin-left:6px;letter-spacing:.08em}
  .linknote{margin-top:4px;color:var(--cyan)}
  .inlink{color:var(--cyan);text-decoration:none;word-break:break-all}
  .inlink:hover{text-decoration:underline}
  .roads{display:flex;flex-wrap:wrap;gap:6px;margin-top:8px}
  .road{font-size:.68rem;padding:3px 9px;border-radius:999px;border:1px solid rgba(0,229,255,.35);color:var(--cyan);text-decoration:none;white-space:nowrap}
  .road.gh{border-color:rgba(184,204,255,.4);color:#b8ccff}
  .road.ext{border-color:rgba(95,118,164,.5);color:#9fb3d9}
  .road.none{border-style:dashed;border-color:rgba(255,255,255,.18);color:var(--muted)}
  .road.derived{border-color:rgba(255,196,0,.4);color:#e2b93b}
  .road:hover{text-decoration:underline}
  .alsoin{margin-top:6px;font-size:.7rem;color:var(--muted)}
  .alsoin a{color:var(--cyan);text-decoration:none;cursor:pointer}
  .alsoin a:hover{text-decoration:underline}
  .spiderGrid{position:absolute;inset:0;background-image:linear-gradient(rgba(255,255,255,.03) 1px, transparent 1px),linear-gradient(90deg,rgba(255,255,255,.03) 1px, transparent 1px);background-size:80px 80px;mask-image:radial-gradient(circle at center,black,transparent 78%);pointer-events:none}
  .wires{position:absolute;inset:0;width:100%;height:100%;pointer-events:none;overflow:visible}
  .spoke{stroke-width:1.8;fill:none;opacity:.88}
  .place{position:absolute;transform:translate(-50%,-50%);width:var(--card);cursor:pointer}
  .place.center{width:250px;cursor:default}
  .legend{position:sticky;left:14px;bottom:10px;display:flex;flex-wrap:wrap;gap:5px 12px;width:max-content;max-width:70%;pointer-events:none;padding:4px 0 10px 14px}
  .legend span{display:flex;align-items:center;gap:6px;font-family:ui-monospace,monospace;font-size:.58rem;letter-spacing:.05em;text-transform:uppercase;color:var(--muted)}
  .legend i{width:15px;height:0;border-top:2px solid;display:inline-block}
  .maphint{position:sticky;top:12px;left:14px;width:max-content;max-width:min(560px,calc(100vw - 32px));font-family:ui-monospace,monospace;font-size:.62rem;color:var(--muted);background:rgba(18,21,28,.8);border:1px solid var(--line);border-radius:999px;padding:5px 10px;backdrop-filter:blur(10px);z-index:5}
  @media (max-width:680px){:root{--safe-x:14px}.brand{min-width:100%}.bar{gap:8px}.count{width:100%;margin-left:0}.controls{gap:7px 10px}.seg button{padding:7px 10px;font-size:.68rem}.viewbtn{padding:6px 10px}.srctag{margin-left:0}.shell{gap:10px}.card{border-radius:12px}.name{font-size:.82rem}}
</style>
<link rel="stylesheet" href="./spider/federation_radial.css" />
<!-- The shared estate menu: FILE / EDIT / VIEW / SCOPE / GRID / ABOUT on every
     surface of the estate, so a reader can navigate from here to the homepage,
     Pipeline News versions, GridAtlas and the Repository federation. One
     additive line, exactly as spiders/species/seer-spider/estate-menu/
     INTEGRATION.md specifies for this page; the module renders its bar above
     this page's own header and pushes the page down by
     --gridatlas-menu-bar-clear rather than overlapping it. Nothing else on
     this page changes. -->
<script src="https://ventusltd.github.io/spiders/species/seer-spider/estate-menu/estate-menu.js" defer></script>
</head>
<body>
  <div class="top">
    <div class="bar">
      <div class="brand"><span class="ey">Ventus · Global Grid 2050</span><h1>The Spider Sandbox</h1></div>
      <div class="pick"><label for="focus">Focus</label><select id="focus"></select></div>
      <div class="count" id="count"></div>
    </div>
    <div class="controls">
      <span class="grouplabel">Show</span>
      <div class="seg" id="relSeg" role="group" aria-label="Relationship direction">
        <button data-mode="both" aria-pressed="true">Both</button>
        <button data-mode="out" aria-pressed="false">Outgoing</button>
        <button data-mode="in" aria-pressed="false">Incoming</button>
      </div>
      <button class="viewbtn" id="spiderToggle" aria-pressed="false" title="Toggle optional spider view"><span class="spider-glyph" aria-hidden="true">🕷</span><span id="viewLabel">Spider</span></button>
      <span class="grouplabel">Tap does</span>
      <div class="seg" id="actSeg" role="group" aria-label="Tap action">
        <button data-act="explore" aria-pressed="true">Explore</button>
        <button class="gh" data-act="github" aria-pressed="false">GitHub</button>
        <button class="ext" data-act="external" aria-pressed="false">External</button>
        <button data-act="status" aria-pressed="false" disabled title="Enables when the page reads live scanner data">Status</button>
      </div>
      <span class="srctag" id="srcTag" title="Data source for this view">snapshot</span>
    </div>
    <div class="crumbs" id="crumbs"></div>
    <div class="hint" id="hint"></div>
  </div>
  <div class="stage" id="stage"><div class="overlay column" id="overlay"></div></div>
<script>
const GH_BASE="https://github.com/Ventusltd/data-federation-map-for-globalgrid2050-all-repos";
const LIVE_PAGE="https://ventusltd.github.io/data-federation-map-for-globalgrid2050-all-repos/live_sandbox/federation_control_ledger/";
const EXT_HOME={"DuckDB":"https://duckdb.org","Parquet":"https://parquet.apache.org","GitHub Actions":"https://github.com/features/actions","Elexon BMRS API":"https://bmrs.elexon.co.uk","GitHub Pages":"https://pages.github.com"};
const PAGE_HOME={"globalgrid2050":"https://globalgrid2050.com/","globalgrid2050-hompage":"https://globalgrid2050.com/","data-federation-map-for-globalgrid2050-all-repos":LIVE_PAGE};
const ROOT_NODES=[
  {label:"data-federation-map-for-globalgrid2050-all-repos",type:"data",rag:"green",reason:"active federation repository",child:"data-federation"},
  {label:"data-gb-electricity",type:"data",rag:"red",reason:"contract finding surfaced"},
  {label:"data-interconnectors",type:"data",rag:"red",reason:"contract finding surfaced"},
  {label:"gb-electricity-ui",type:"ui",rag:"red",reason:"depends on verified data repos"},
  {label:"globalgrid2050",type:"source_archive",rag:"blue",reason:"source archive"},
  {label:"globalgrid2050-hompage",type:"homepage",rag:"green",reason:"homepage dependency surfaced"},
  {label:"pandapower",type:"unknown",rag:"grey",reason:"not fully classified"},
  {label:"Podcast-transcripts",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"pv-arc-protection-circuit",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"Solar-PV-Hybrid-and-off-grid",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"solar-repowering-whitepaper",type:"unknown",rag:"amber",reason:"workflow finding"},
  {label:"youengineer-code-review",type:"ui",rag:"amber",reason:"reference UI pattern source"},
  {label:"DuckDB",type:"external",rag:"blue",reason:"proof query engine"},
  {label:"Parquet",type:"external",rag:"blue",reason:"columnar proof store"},
  {label:"Elexon BMRS API",type:"external",rag:"blue",reason:"external electricity source"},
  {label:"GitHub Actions",type:"external",rag:"blue",reason:"static build runner"},
];
const ROOT_EDGES=[
  [0,12,"external"],[0,13,"external"],[0,5,"governance"],[0,15,"external"],[0,14,"external"],
  [1,4,"archive"],[1,5,"governance"],[1,14,"external"],[1,15,"external"],[1,12,"external"],[1,13,"external"],
  [2,4,"archive"],[2,5,"governance"],[2,14,"external"],[2,13,"external"],[2,1,"repo"],[2,3,"repo"],[2,15,"external"],[2,12,"external"],
  [3,1,"data"],[3,2,"data"],[3,5,"governance"],[3,15,"external"],
  [4,14,"external"],[4,15,"external"],
  [5,14,"external"],[5,0,"data"],[5,1,"data"],[5,2,"data"],[5,3,"repo"],[5,4,"archive"],[5,12,"external"],[5,13,"external"],[5,15,"external"],
  [6,15,"external"],
];
function applyRootLinks(nodes){nodes.forEach(n=>{n.gh=n.type==="external"?null:`https://github.com/Ventusltd/${n.label}`;n.ext=EXT_HOME[n.label]||PAGE_HOME[n.label]||null;});return nodes;}
applyRootLinks(ROOT_NODES);
const CHILD_NODES=[
  {label:"data-federation repo",type:"data",rag:"green",reason:"root of this child scope",gh:GH_BASE+"/tree/main"},
  {label:"live dashboard page",type:"ui",rag:"green",reason:"GitHub Pages browser UI in this repo",gh:GH_BASE+"/tree/main/live_sandbox/federation_control_ledger",ext:LIVE_PAGE},
  {label:"index.html",type:"ui",rag:"green",reason:"page shell for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/index.html"},
  {label:"app.js",type:"ui",rag:"green",reason:"board renderer and interaction logic",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/app.js"},
  {label:"style.css",type:"ui",rag:"green",reason:"board visual system",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/style.css"},
  {label:"data cartridge folder",type:"data",rag:"green",reason:"manifest, nodes, edges, layers, sectors",gh:GH_BASE+"/tree/main/live_sandbox/federation_control_ledger/data"},
  {label:"data/manifest.json",type:"data",rag:"amber",reason:"root cartridge manifest; key still flagged",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/manifest.json"},
  {label:"data/nodes.json",type:"data",rag:"green",reason:"repo and source nodes for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/nodes.json"},
  {label:"data/edges.json",type:"data",rag:"green",reason:"relationship lines for the board",gh:GH_BASE+"/blob/main/live_sandbox/federation_control_ledger/data/edges.json"},
  {label:"reports folder",type:"unknown",rag:"green",reason:"scan reports and evidence",gh:GH_BASE+"/tree/main/reports"},
  {label:"FEDERATION_MAP_LATEST.md",type:"unknown",rag:"green",reason:"latest human-readable scan report",gh:GH_BASE+"/blob/main/reports/FEDERATION_MAP_LATEST.md"},
  {label:"every-drop-is-the-ocean",type:"unknown",rag:"green",reason:"canonical doctrine and addenda",gh:GH_BASE+"/tree/main/every-drop-is-the-ocean"},
  {label:"GitHub Pages",type:"external",rag:"blue",reason:"static public hosting",ext:LIVE_PAGE},
  {label:"GitHub Actions",type:"external",rag:"blue",reason:"future scanner and validation runner",ext:EXT_HOME["GitHub Actions"],gh:GH_BASE+"/actions"},
];
const CHILD_EDGES=[[0,1,"repo"],[1,2,"repo"],[1,3,"repo"],[1,4,"repo"],[1,5,"data"],[3,5,"data"],[5,6,"data"],[5,7,"data"],[5,8,"data"],[0,9,"governance"],[9,10,"governance"],[0,11,"governance"],[1,12,"external"],[0,13,"external"],[3,13,"external"]];
const SCOPES={"root":{label:"Federation",nodes:ROOT_NODES,edges:ROOT_EDGES},"data-federation":{label:"data-federation internals",nodes:CHILD_NODES,edges:CHILD_EDGES}};
const RAG={green:"#00ff88",amber:"#ffcc00",red:"#ff5555",blue:"#3aa0ff",grey:"#9298a6"};
const ECSS={data:"#00e5ff",governance:"#b47cff",archive:"#7da0c8",external:"#5f76a4",repo:"#b8ccff",workflow:"#00ffff"};
const BADGE={data:"DB",ui:"UI",homepage:"WEB",source_archive:"SRC",unknown:"REPO",external:"EXT",/* 2026-09-14: the node types the registered graphs actually publish, so a card says what it is */repo:"REPO",element:"ELEMENT",canonical:"CANONICAL",copy:"COPY",fragment:"FRAGMENT",reference:"REFERENCE",extract:"EXTRACT",block:"BLOCK",auto:"BLOCK",app:"APP","function":"FUNCTION",cartridge:"CARTRIDGE",  … [line shortened here: 951 characters; full line on GitHub]
const REL={data:"data",governance:"governance",archive:"archive",external:"external",repo:"repo ref",workflow:"workflow"};
const SVGNS="http://www.w3.org/2000/svg";
let mode="both", action="explore", view="column", current=0, scopeKey="root", stack=[];
const sel=document.getElementById("focus"), overlay=document.getElementById("overlay"), elCount=document.getElementById("count"), elCrumbs=document.getElementById("crumbs"), elHint=document.getElementById("hint"), spiderToggle=document.getElementById("spiderToggle"), viewLabel=document.getElementById("viewLabel");
function S(){return SCOPES[scopeKey];}
function rebuildSelect(){sel.innerHTML="";S().nodes.forEach((n,i)=>{const o=document.createElement("option");o.value=i;o.textContent=n.label;sel.appendChild(o);});sel.value=current;}
sel.addEventListener("change",()=>{current=+sel.value;draw();});
document.querySelectorAll("#relSeg button").forEach(b=>b.addEventListener("click",()=>{mode=b.dataset.mode;document.querySelectorAll("#relSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x===b)));draw();}));
document.querySelectorAll("#actSeg button").forEach(b=>b.addEventListener("click",()=>{if(b.disabled)return;action=b.dataset.act;document.querySelectorAll("#actSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x===b)));draw();}));
spiderToggle.addEventListener("click",()=>{view=view==="spider"?"column":"spider";spiderToggle.setAttribute("aria-pressed",String(view==="spider"));viewLabel.textContent=view==="spider"?"Column":"Spider";draw();});
let rt;new ResizeObserver(()=>{clearTimeout(rt);rt=setTimeout(draw,80);}).observe(document.getElementById("stage"));
function actionable(n){return action==="explore" ? true : action==="github" ? !!n.gh : action==="external" ? !!n.ext : false;}
function openUrl(u){if(u)window.open(u,"_blank","noopener");}
function handleTap(i){LINK_NOTE="";return handleTap_(i);}
function handleTap_(i){const n=S().nodes[i];if(action==="explore"){current=i;sel.value=i;draw();}else if(action==="github"){openUrl(n.gh);}else if(action==="external"){openUrl(n.ext);}}
function drillInto(childKey){stack.push({key:scopeKey,current});scopeKey=childKey;current=0;mode="both";document.querySelectorAll("#relSeg button").forEach(x=>x.setAttribute("aria-pressed",String(x.dataset.mode==="both")));rebuildSelect();draw();}
function popTo(idx){const target=stack[idx];stack=stack.slice(0,idx);scopeKey=target.key;current=target.current;rebuildSelect();draw();}
function neighbours(idx){const out=[],inc=[];S().edges.forEach(([f,t,ty])=>{if(f===idx)out.push({other:t,type:ty});if(t===idx)inc.push({other:f,type:ty});});return {out,inc};}
let IDENTITY=null;let LINK_NOTE="";/* 2026-09-14 round 3: a stale-link note survives redraws (ResizeObserver calls draw() 80 ms after load, and setHint rewrote #hint) until the reader acts *//* 2026-09-14: label -> graphs it appears in, published as data; the page only reads it */
function alsoIn(node){if(!IDENTITY||!IDENTITY.labels)return "";const key=String(node.label||"").replace(/^#?\d+\s+/,"").trim().toLowerCase();const e=IDENTITY.labels[key];if(!e||!e.graphs)return "";const others=Object.keys(e.graphs).filter(g=>g!==scopeKey&&SCOPES[g]);if(!others.length)return "";return `<div class="alsoin">Also in: ${others.map(g=>`<a href="?graph=${encodeURIComponent(g)}&focus=${en  … [line shortened here: 496 characters; full line on GitHub]
const STARS="https://ventusltd.github.io/stars/";
const FAMILY_GRAPHS=new Set(["modular","generated-apps","periodic-table","structure","sense","decisions","engine-graph","proof-of-work"]);
const REPAIR={"https://github.com/Ventusltd/stars/blob/main/reports/VEDIC.md":"https://github.com/Ventusltd/stars/blob/main/reports/CLASSIFICATION.md"};/* known dead links repaired client-side until the graph builders publish the new name */
function deriveLinks(n,gid){if(n.gh&&REPAIR[n.gh])n.gh=REPAIR[n.gh];if(n.ext&&REPAIR[n.ext])n.ext=REPAIR[n.ext];/* 2026-09-14 round 3: the stars builders will publish these links per node (Alienware, 13:30 UTC); until then the page derives the same targets from the label, marked derived */if(n.gh||n.ext)return n;const L=String(n.label||"");let m;
 if(gid==="vedic"&&!n.gh){n.ext=n.ext||STARS+"reports/CLASSIFICATION.md";n.derived=true;}
 else if(gid==="random"&&!n.gh){n.ext=n.ext||STARS+"reports/RANDOM.md";n.derived=true;}
 else if((m=L.match(/^#(\d+)/))&&(!gid||FAMILY_GRAPHS.has(gid))){n.ext=STARS+"code.html?family="+m[1];n.derived=true;}
 else if(n.type==="decay"){n.ext="https://github.com/Ventusltd/star-maker/blob/main/CHEMISTRY.md";n.derived=true;}
 else if(n.type==="class"||n.type==="vedic"){n.ext=STARS+"reports/CLASSIFICATION.md";n.derived=true;}
 else if((m=L.match(/^([A-Z][a-z]?\d?)(?:\s*[·-]\s*|\s+[A-Z_]{3,}|\(|$)/))){n.ext=STARS+"table.html?block="+m[1];n.derived=true;}
 return n;}
const OWN_HOSTS=["ventusltd.github.io","globalgrid2050.com","www.globalgrid2050.com","ventusltd.com","www.ventusltd.com"];
function roads(node){/* 2026-09-14 round 4: the three roads out of every centre card, always visible: our own pages, GitHub, external. A road that does not exist says so instead of doing nothing. */const host=u=>{try{return new URL(u).hostname}catch(_){return ""}};const ext=node.ext||"",gh=node.gh||"";const own=ext&&OWN_HOSTS.includes(host(ext))?ext:(gh&&OWN_HOSTS.includes(host(gh))?gh:"");const o  … [line shortened here: 990 characters; full line on GitHub]
function linkify(s){return String(s||"").replace(/(^|[^"'>=])(https?:\/\/[^\s<"')]+)/g,(m,pre,u)=>`${pre}<a class="inlink" href="${u}" target="_blank" rel="noopener" title="${u}">${u.replace(/^https?:\/\//,"").slice(0,64)}${u.length>72?"…":""}</a>`);}
function cardInner(node,opts={}){const center=opts.center, rel=opts.rel, dim=opts.dim;let relHTML="";if(rel){const c=ECSS[rel.type]||ECSS.repo;relHTML=`<div class="relrow"><span class="arrow">${rel.dir==="out"?"→":"←"}</span><span class="reltag" style="color:${c}">${REL[rel.type]||rel.type}</span>${opts.go?`<span class="go">${opts.go}</span>`:""}</div>`;}let contents="";if(center&&node.child&&SCOP  … [line shortened here: 1,038 characters; full line on GitHub]
function goLabel(n){return action==="github"&&n.gh?"open ↗":action==="external"&&n.ext?"open ↗":"";}
function setHint(){const base={explore:"<b>Explore</b> — tap a card to re-centre. Use the spider only when you choose it.",github:"<b>GitHub</b> — tap a repo to open it. Cards with no repo are dimmed.",external:"<b>External</b> — tap an external system to open it. Others are dimmed."};elHint.innerHTML=(base[action]||"")+(view==="spider"?" &nbsp; <b>Spider view</b> — scroll or drag the large canvas  … [line shortened here: 530 characters; full line on GitHub]
function setCrumbs(){elCrumbs.innerHTML="";const trail=[...stack.map((s,i)=>({label:SCOPES[s.key].label,idx:i})),{label:S().label,idx:-1}];trail.forEach((c,k)=>{if(k)elCrumbs.insertAdjacentHTML("beforeend",`<span class="sep">›</span>`);if(c.idx===-1){const s=document.createElement("strong");s.textContent=c.label;s.style.color="var(--text)";elCrumbs.appendChild(s);}else{const a=document.createEleme  … [line shortened here: 504 characters; full line on GitHub]
function draw(){const nodes=S().nodes,focus=nodes[current];let {out,inc}=neighbours(current);let lo=mode==="in"?[]:out,li=mode==="out"?[]:inc;elCount.innerHTML=`<b>${out.length}</b> dependencies &nbsp;·&nbsp; <b>${inc.length}</b> dependents`;setHint();setCrumbs();overlay.innerHTML="";overlay.className="overlay "+view;if(view==="spider")drawSpider(focus,lo,li);else drawColumn(focus,lo,li);overlay.q  … [line shortened here: 523 characters; full line on GitHub]
function drawColumn(focus,out,inc){const nodes=S().nodes;const shell=document.createElement("div");shell.className="shell";shell.innerHTML=`<div class="focuswrap">${cardInner(focus,{center:true,dim:!actionable(focus),go:goLabel(focus)})}</div>`;const section=(title,items,dir)=>{const s=document.createElement("div");s.innerHTML=`<div class="sect">${title}</div>`;if(!items.length){const e=document.c  … [line shortened here: 1,220 characters; full line on GitHub]
function marker(defs,type){const m=document.createElementNS(SVGNS,"marker");m.id="arr-"+type;m.setAttribute("viewBox","0 0 10 10");m.setAttribute("refX","9");m.setAttribute("refY","5");m.setAttribute("markerWidth","8");m.setAttribute("markerHeight","8");m.setAttribute("orient","auto");const p=document.createElementNS(SVGNS,"path");p.setAttribute("d","M0,0 L10,5 L0,10 z");p.setAttribute("fill",ECSS  … [line shortened here: 457 characters; full line on GitHub]
function distribute(items,side,cx,cy,gap,xGap){const n=items.length;if(!n)return[];return items.map((it,k)=>{const y=cy+(k-(n-1)/2)*gap;const stagger=(n>5&&k%2?90:0);const x=cx+side*(xGap+stagger);return{...it,dir:side>0?"out":"in",x,y};});}
const BUNDLE_AT=40;/* 2026-09-14: above this many wires on one side the fan is a solid wedge at phone width (240 wires on "Data", Walker 1), so each relationship type becomes one bundle card that opens the column list */
function bundled(side){if(side.length<=BUNDLE_AT)return side;const g={};side.forEach(it=>{(g[it.type]=g[it.type]||[]).push(it);});return Object.keys(g).sort().map(t=>({type:t,other:-1,bundle:g[t]}));}
function drawSpider(focus,out,inc){out=bundled(out);inc=bundled(inc);const stage=document.getElementById("stage");const sw=stage.clientWidth,sh=stage.clientHeight;const maxSide=Math.max(out.length,inc.length,1);const gap=176;const xGap=Math.max(420,260+maxSide*38);const cw=Math.max(sw,Math.ceil(680+xGap*2+maxSide*120));const ch=Math.max(sh,Math.ceil(520+gap*(maxSide+1)));const cx=cw/2,cy=ch/2;cons  … [line shortened here: 3,745 characters; full line on GitHub]
function enableDragPan(el){/* 2026-09-14: pointer capture is taken only after the pointer has moved more than 6 px, so a plain mouse click on a card still reaches the card (before this, capture at pointerdown sent every click to the overlay and desktop mouse users could not tap cards in the spider view; touch taps were unaffected). */let down=false,captured=false,pid=null,sx=0,sy=0,sl=0,st=0;el.on  … [line shortened here: 994 characters; full line on GitHub]
const DATA_BASE="./spider/data/";
const CHILD_KEY="data-federation";
function reshapeNodes(fc){return (fc.features||[]).map(f=>{const p=f.properties||{};const cm=p.child_manifest||null;return {label:p.label||f.id,type:p.repo_type||p.scope_type||"unknown",rag:p.rag||p.status||"grey",reason:p.status_reason||"",child:(cm&&/data-federation/.test(cm))?CHILD_KEY:null};});}
async function loadJSON(path){const r=await fetch(DATA_BASE+path,{cache:"no-cache"});if(!r.ok)throw new Error(path+" "+r.status);return r.json();}
async function loadRoot(){try{const [nf,ef]=await Promise.all([loadJSON("nodes.json"),loadJSON("edges.json")]);const nodes=reshapeNodes(nf);if(!nodes.length)throw new Error("empty");applyRootLinks(nodes);SCOPES.root.nodes=nodes;SCOPES.root.edges=(ef.edges||[]).map(e=>[e[0],e[1],e[2]]);return "live";}catch(e){return "snapshot";}}
const CONTENTS_BASE="./spider/data/contents/";
const MONO_GH="https://github.com/Ventusltd/globalgrid2050";
const CONTENTS_KEY="globalgrid2050-contents";
async function loadContents(){try{const get=p=>fetch(CONTENTS_BASE+p,{cache:"no-cache"}).then(r=>{if(!r.ok)throw new Error(p+" "+r.status);return r.json();});const [mf,nf,ef]=await Promise.all([get("manifest.json"),get("nodes.json"),get("edges.json")]);if(!Array.isArray(nf)||!nf.length)throw new Error("empty nodes");BADGE.eye_app="EYE";BADGE.sense_app="SENSE";BADGE.served_surface="PAGE";REL.contai  … [line shortened here: 1,115 characters; full line on GitHub]

/* --- ventus-grid-engine receiver additions below. Nothing above this comment
   is changed in behaviour from spider_full_po_test.html, only DATA_BASE (was
   "../../live_sandbox/federation_control_ledger/data/") and CONTENTS_BASE
   (was "../../data/federation_map/contents/provenance=declared/repo=Ventusltd__globalgrid2050/")
   were repointed at the copies under ./spider/, and the stylesheet <link>
   now reads "./spider/federation_radial.css". The reference's own IIFE at
   its end is replaced by wireReceiver() below, which does the same
   loadRoot()+loadContents() call and then adds manifest-driven graphs on
   top, using the existing scope/card/FOCUS machinery unchanged. --- */
const RECEIVER_MANIFEST_PATH="./spider/manifest.json";
/* Snapshot fallback of spider/manifest.json's two receiver-owned slots, kept
   in sync with that file by hand. Exists for the same reason ROOT_NODES
   above exists: fetch() cannot load file:// resources at all in Chromium
   ("URL scheme file is not supported", confirmed while proving this page),
   so a file://-opened copy would otherwise never offer these two graphs even
   though the spider/manifest.json fetch is the source of truth whenever it
   IS reachable (e.g. served over http/https, including GitHub Pages). */
const MANIFEST_FALLBACK={graphs:[
  {id:"engine-graph",title:"Engine population",path:"./genome/engine-graph.json",source_spider:"genome-spider (population phase)",description:"The ventus-grid-engine population graph. Not owned by this page; may not exist yet."},
  {id:"genome-spider",title:"genome-spider output",path:"./spider/data/genome-spider.json",source_spider:"spiders/species/genome-spider",description:"Documented empty slot for spiders/species/genome-spider's own output, which did not exist when this receiver was built."}
]};
function placeholderScope(title,path){return {label:title,nodes:[{label:title+" — not yet emitted",type:"unknown",rag:"grey",reason:"Populated once "+path+" exists and is reachable from this page."}],edges:[]};}
function resolveRef(ids,r){return ids[r]!==undefined?ids[r]:r;}
function normaliseGenericGraph(raw,gid){
  const rawNodes=Array.isArray(raw.nodes)?raw.nodes:(Array.isArray(raw.features)?raw.features.map(f=>({id:f.id,...(f.properties||{})})):[]);
  const ids={};
  const nodes=rawNodes.map((n,i)=>{const id=n.id!==undefined?n.id:i;ids[id]=i;return deriveLinks({label:n.label||n.title||String(id),type:n.type||n.nodeKind||n.repo_type||"unknown",rag:n.rag||n.status||"grey",reason:n.reason||n.status_reason||n.path||"",gh:n.gh||null,ext:n.ext||null},gid);});
  const rawEdges=Array.isArray(raw.edges)?raw.edges:(Array.isArray(raw.links)?raw.links:[]);
  const edges=rawEdges.map(e=>Array.isArray(e)?[resolveRef(ids,e[0]),resolveRef(ids,e[1]),e[2]||"repo"]:[resolveRef(ids,e.from!==undefined?e.from:e.source),resolveRef(ids,e.to!==undefined?e.to:e.target),e.type||"repo"]).filter(e=>typeof e[0]==="number"&&typeof e[1]==="number");
  return {nodes,edges};
}
async function loadManifestScope(entry){
  try{const r=await fetch(entry.path,{cache:"no-cache"});if(!r.ok)throw new Error(entry.path+" "+r.status);const raw=await r.json();const g=normaliseGenericGraph(raw,entry.id);if(!g.nodes.length)throw new Error("empty");return {label:entry.title,nodes:g.nodes,edges:g.edges,live:true};}
  catch(e){return {...placeholderScope(entry.title,entry.path),live:false};}
}
async function wireReceiver(){
  let manifest=MANIFEST_FALLBACK;
  try{const r=await fetch(RECEIVER_MANIFEST_PATH,{cache:"no-cache"});if(r.ok){const live=await r.json();if(Array.isArray(live.graphs)&&live.graphs.length)manifest=live;}}catch(e){}
  /* Every graph the manifest lists, except the two the page builds itself.
     This read `g.id==="engine-graph"||g.id==="genome-spider"` - a hard-coded
     pair - so a manifest could add graphs for ever and the page would never
     request them; gridatlas-lineage sat in the live manifest and was never
     fetched (network trace, 2026-09-04). A receiver that "will constantly
     also receive cartridges like gridatlas" has to read what it is given. */
  const BUILT_IN=new Set(["federation","globalgrid2050-contents"]);
  const extra=(manifest.graphs||[]).filter(g=>g&&g.id&&g.path&&!BUILT_IN.has(g.id));
  for(const entry of extra){
    const scope=await loadManifestScope(entry);
    SCOPES[entry.id]=scope;
    SCOPES.root.nodes.push({label:entry.title,type:"unknown",rag:scope.live?"green":"grey",reason:entry.description||"",child:entry.id,gh:null,ext:null});
  }
  try{const ir=await fetch("./spider/identity.json",{cache:"no-cache"});if(ir.ok)IDENTITY=await ir.json();}catch(e){}
  const qp=new URLSearchParams(location.search);
  const want=qp.get("graph");
  let linkNote="";if(want){const key=want==="federation"?"root":want;if(SCOPES[key]){stack=key==="root"?[]:[{key:"root",current:0}];scopeKey=key;current=0;}else{linkNote=`The link asked for a graph named "${want}", which this page does not list; showing ${SCOPES.root.label}.`;}}
  /* ?focus=<node label> centres the graph on one module.
     ------------------------------------------------------------------------
     Written 202609050300 so the dashboards can link INTO the maths rather
     than at it: a File menu in GridAtlas or Pipeline News names a module and
     lands the reader on that node with its dependencies already drawn. The
     match is on the node's own label, exact first and then case-insensitively,
     so a link is written with the same string the graph publishes -- no second
     naming scheme to drift. An unknown focus is IGNORED, never an error: the
     graph still opens on its default, which is what a reader following a stale
     link should get. */
  const wantFocus=qp.get("focus");
  if(wantFocus){
    const ns=S().nodes;
    let i=ns.findIndex(n=>n.label===wantFocus);
    if(i<0){const lc=wantFocus.toLowerCase();i=ns.findIndex(n=>String(n.label||"").toLowerCase()===lc);}
    if(i>=0)current=i;else linkNote+=(linkNote?" ":"")+`The link named a card "${wantFocus}", which this graph does not contain; showing its first card.`;
  }
  rebuildSelect();draw();
  /* 2026-09-14: a stale or mistyped link is still ignored, never an error, but the hint line now says so once, so a reader following it knows why the page is not where the link promised. */
  if(linkNote){LINK_NOTE=linkNote;setHint();}
}
(async()=>{const src=await loadRoot();await loadContents();const tag=document.getElementById("srcTag");if(tag){tag.textContent=src;tag.classList.toggle("live",src==="live");}await wireReceiver();})();
</script>
</body>
</html>

Budget Guard

A Python command-line tool in the tools folder of Tokens. It is built from the minutes step (`minutes`).

othertokens / tools/budget_guard.py · lines 1–49 of 49 · Entry point

What it does
Defines minutes, main. Uses libraries sys. Side effects: starts processes.
Why it exists in the grid workflow
Domain stage agent_infra (repository name word 'tokens'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: command-line arguments.
Downstream impact
It is itself an entry point (Python CLI); no other file was found loading it.
What it achieves
The antibody for CONTEXT BURN.
Why it matters
No other file in the estate was found to import it; it is an entry point.
Application
tokens · tools · Python CLI
Uses
sys
Used by
none found
Produces
minutes, main
Defines here
minutes, main
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
tokens@1abe639df81e7cadf0ab5e49fd16fa88cc3bd538 tools/budget_guard.py:1-49 · blob 8bfa70d58c426efd255d411466ab7ce7311e3315 · GitHub at these lines
State
achieves: comment · context: auto · stage: unknown · effects: process · domain stage: agent_infra · users: ai_agent · canonical: unknown
#!/usr/bin/env python3
"""budget_guard.py - the antibody for CONTEXT BURN. Fails closed.

    python tools/budget_guard.py --deadline 15:59 --reserve 1 14:27=36.69 14:46=16.79

Give it two or more balance readings as HH:MM=amount, the time the money must last until, and the
reserve that must be left. It works out the burn rate from the first and last reading, projects the
balance at the deadline, and EXITS 1 if the projection falls below the reserve. With fewer than two
readings, or readings it cannot parse, it exits 2: a guard that cannot measure refuses, it does not
wave you through.
"""
import sys


def minutes(hhmm):
    h, m = hhmm.split(':')
    return int(h) * 60 + int(m)


def main():
    a = sys.argv[1:]
    try:
        deadline = minutes(a[a.index('--deadline') + 1])
        reserve = float(a[a.index('--reserve') + 1])
        readings = sorted((minutes(x.split('=')[0]), float(x.split('=')[1])) for x in a if '=' in x)
    except Exception:
        print('REFUSED: could not read the arguments. See the top of this file.')
        return 2
    if len(readings) < 2 or readings[-1][0] == readings[0][0]:
        print('REFUSED: two readings at different times are needed to measure a rate.')
        return 2
    (t0, b0), (t1, b1) = readings[0], readings[-1]
    rate = (b0 - b1) / (t1 - t0)
    left = deadline - t1
    projected = b1 - rate * left
    print('burn rate        %.2f a minute, %.0f an hour' % (rate, rate * 60))
    print('minutes to go    %d' % left)
    if rate > 0:
        print('money lasts      %.0f minutes beyond the last reading' % ((b1 - reserve) / rate))
    print('projected        %.2f at the deadline, against a reserve of %.2f' % (projected, reserve))
    if projected < reserve:
        print('FAIL: stop every helper now, stop taking steps, write the handover.')
        return 1
    print('PASS')
    return 0


if __name__ == '__main__':
    sys.exit(main())