GLOBALGRID2050 / EXPLORE CODE

Part of: Explore Code / Kuiper, cosmos and drawing engines / star-maker / machinery/bench

Wanderer and 8 more files

A JavaScript module in the bench folder of Star Maker that reads summary from the ventus-grid-engine repository.

632 lines of JavaScript and PowerShell from star-maker, stars, in 9 files. Topic: Kuiper, cosmos and drawing engines. Section 1561 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. VEDIC storage · star-maker / machinery/bench/vedic.mjs lines 1–61
  2. Ventus automation · star-maker / machinery/bench/ventus.ps1 lines 1–23
  3. Wanderer render · star-maker / machinery/bench/wanderer.mjs lines 1–170
  4. Eyes render · star-maker / machinery/eyes/eyes.mjs lines 1–100
  5. Chemistry storage · stars / builders/chemistry.mjs lines 1–114
  6. Links and Evidence Test test · stars / builders/links-and-evidence.test.mjs lines 1–53
  7. Node Links transform · stars / builders/node-links.mjs lines 1–20
  8. Random storage · stars / builders/random.mjs lines 1–34
  9. VEDIC storage · stars / builders/vedic.mjs lines 1–57

VEDIC

A JavaScript module in the bench folder of Star Maker that reads table, summary and bhuta, using haversine. It is built from the bhuta of helper (`bhutaOf`).

storagestar-maker / machinery/bench/vedic.mjs · lines 1–61 of 61 · Not reached from any entry point (candidate for review)

What it does
It loads table, summary and bhuta. Defines bhutaOf. Uses libraries node:fs/promises, node:path, node:fs. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'vedic'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: JSON file table.json; JSON file atoms.json; JSON file summary.json; DuckDB queries. Out: JSON file bhuta.json; JSON file graph.json.
What it achieves
THE VEDIC STAR — guided by the Upanishads.
Why it matters
No other file in the estate was found to import it.
Application
star-maker · machinery/bench · JavaScript module
Uses
node:fs/promises, node:path, node:fs
Used by
none found
Produces
bhutaOf
Defines here
bhutaOf
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-maker@2c477b0cc673304c5b288cee9d0e0ae42d273b2e machinery/bench/vedic.mjs:1-61 · blob e3efe14bbaa643b6fa210d6d09ec86efa31f7a05 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// THE VEDIC STAR — guided by the Upanishads. Brahman: the one behind all forms; Atman: the self
// that is that one (tat tvam asi — every incarnation IS its soul); the five elements, pancha
// bhuta, in which every form exists; neti neti — "not this, not this" — the way to what is real
// by removing what is not; rita — the order that holds the cosmos together.
// Applied, plainly: (1) sort every element and soul into the five bhutas — prithvi/earth = data
// that sits (layers, files), apas/water = data that flows (streams, parquet, fetch), agni/fire =
// transformation (engines, calculations), vayu/air = movement between (deep links, events,
// messages), akasha/ether = the space that holds all (shells, manifests, contracts, registries);
// (2) neti neti — what is not stated, not called, not tested, not composed: the list a mind may
// release (moksha) without loss; (3) rita — the declared order of the composition and whether
// every star kept it (the loader honours cartridge_order; stars prove the order held). No model.
//
//   node vedic.mjs  → star-maker/vedic/{bhuta.json, graph.json}, VEDIC.md
import { readFile, writeFile, mkdir } from 'node:fs/promises';
import path from 'node:path';
const SKY = process.env.SKY_DIR || 'C:/Users/vikra/Documents/GitHub/star-maker';
const OUT = path.join(SKY, 'vedic'); await mkdir(OUT, { recursive: true });
const table = JSON.parse(await readFile(path.join(SKY, 'elements', 'table.json'), 'utf8')).elements;
const atoms = JSON.parse(await readFile(path.join(SKY, 'electron', 'atoms.json'), 'utf8'));
const soulSummary = JSON.parse(await readFile(path.join(SKY, 'soul', 'summary.json'), 'utf8'));
const BHUTA = [
  ['akasha (ether)', /shell|manifest|contract|registry|schema|composition|current|loader|kernel/i],
  ['vayu (air)',     /deeplink|deep-link|link|event|dispatch|message|emit|route|flyto|arrival|search|gazetteer/i],
  ['agni (fire)',    /engine|calc|compute|distance|fault|rating|power|flow|topology|estimate|demand|capacity|economics|drop|factor|envelope|geodesy|haversine|area|shape/i],
  ['apas (water)',   /stream|parquet|bridge|fetch|duckdb|feed|pipeline|flow|sync|crawl|survey/i],
  ['prithvi (earth)',/layer|geojson|data|substation|grid_|railway|airport|datacentre|plant|offtaker|csv|json|file|store/i],
];
const bhutaOf = s => (BHUTA.find(([, rx]) => rx.test(s)) || ['prithvi (earth)'])[0];
const forms = [...table.map(e => ({ kind: 'element', name: e.symbol + ' ' + e.name, bhuta: bhutaOf(e.name + ' ' + e.family), state: e.state })),
               ...atoms.top.map(a => ({ kind: 'soul', name: `#${a.number} ${a.name}`, bhuta: bhutaOf(a.name), class: a.class, spin: a.spin }))];
const counts = Object.fromEntries(BHUTA.map(([b]) => [b, forms.filter(f => f.bhuta === b).length]));
// neti neti: not stated, not called, not tested — from the soul summary and the electron atoms
const neti = atoms.top.filter(a => a.class === 'inert-unused' || (a.spin === 'unpaired' && a.valence === 0 && !a.purpose)).slice(0, 60);
// rita: did every star keep the declared order? (loaded order must be a subsequence of the live order)
let kept = 0, broke = 0; const live = ['streaming-parquet-bridge', 'uk-gazetteer-flyto', 'substation-intelligence', 'sld-sandbox'];
try { const { readdirSync } = await import('node:fs'); for (const f of readdirSync(path.join(SKY, 'stars')).slice(0, 4000)) { const s = JSON.parse(await readFile(path.join(SKY, 'stars', f), 'utf8')); const idx = (s.loaded || []).map(id => live.indexOf(id)); (idx.every((v, i) => i === 0 || v > idx[i - 1]) ? kept++ : broke++); } } catch {}
await writeFile(path.join(OUT, 'bhuta.json'), JSON.stringify({ generated_utc: new Date().toISOString(), counts, forms: forms.slice(0, 800), neti_neti: neti, rita: { kept, broke } }, null, 2));
const nodes = BHUTA.map(([b]) => ({ label: b, type: 'bhuta', rag: 'green', reason: `${counts[b]} forms` }));
const edges = [];
for (const f of forms.slice(0, 300)) { nodes.push({ label: f.name, type: f.kind, rag: f.state === 'UNSETTLED' || f.class === 'inert-unused' ? 'amber' : 'green', reason: `${f.kind} · ${f.bhuta}` }); edges.push({ from: f.bhuta, to: f.name, kind: 'IS_MADE_OF' }); }
await writeFile(path.join(OUT, 'graph.json'), JSON.stringify({ schema: 'vedic-graph.v1', label: 'The Vedic star', generated_utc: new Date().toISOString(), note: 'The five bhutas and the forms that exist in each; neti neti in the report.', focus_default: 'agni (fire)', nodes, edges }, null, 2));
const md = `# The Vedic star

*Tat tvam asi* — every incarnation is its soul: ${soulSummary.souls.toLocaleString()} souls behind ${soulSummary.incarnations.toLocaleString()} forms. Below, the forms sorted into the five bhutas, what neti neti would release, and whether rita — the declared order — held. Updated ${new Date().toISOString()}. No model.

## Pancha bhuta — in which element does each form exist?
| bhuta | meaning here | forms |
|---|---|---|
${BHUTA.map(([b]) => `| **${b}** | ${{ 'akasha (ether)': 'the space that holds all: shells, manifests, contracts, registries', 'vayu (air)': 'movement between: deep links, events, routes, arrivals', 'agni (fire)': 'transformation: engines, calculations, the maths', 'apas (water)': 'data that flows: streams, parquet, feeds, crawls', 'prithvi (earth)': 'data that sits: layers, files, substations, ci  … [line shortened here: 444 characters; full line on GitHub]

## Neti neti — not stated, not called, not tested: what may be released without loss
${neti.slice(0, 40).map(a => `- **#${a.number} ${a.name}** · ${a.lines} lines · home ${a.homes.join('/')} · ${a.class}`).join('\n') || '- nothing: everything is held by something'}

## Rita — did the declared order hold?
Of ${kept + broke} stars read, **${kept}** loaded their cartridges in the declared order and **${broke}** did not.${broke ? ' A star that broke the order is a finding.' : ' The loader keeps rita; the cracks are in the parts, not the order.'}

## For the Spider
\`vedic/graph.json\` — ${nodes.length} nodes, ${edges.length} IS_MADE_OF edges: fly from a bhuta into its forms.
`;
await writeFile(path.join(SKY, 'VEDIC.md'), md);
console.log(`vedic: ${Object.entries(counts).map(([b, n]) => `${b.split(' ')[0]} ${n}`).join(' · ')} · neti ${neti.length} · rita ${kept}/${kept + broke}`);

Ventus

A PowerShell script in the bench folder of Star Maker.

automationstar-maker / machinery/bench/ventus.ps1 · lines 1–23 of 23 · Not reached from any entry point (candidate for review)

What it does
Side effects: starts processes.
What it achieves
The terminal surface of the Spider.
Why it matters
No other file in the estate was found to import it.
Application
star-maker · machinery/bench · PowerShell script
Uses
none found
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-maker@2c477b0cc673304c5b288cee9d0e0ae42d273b2e machinery/bench/ventus.ps1:1-23 · blob a48b19718dc6193ebc431b45637b86430b57d3dc · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: unknown · users: none · canonical: unreached_review
# ventus.ps1 — the terminal surface of the Spider. Same elements, same stars, same Bench;
# written on a keyboard instead of touched on the web. Usage:
#   ventus element <symbol|name>        show one element from the periodic table
#   ventus elements [family]            list the table (physics, vocabulary, engine, cartridge, data-layer, contract)
#   ventus stars [RED|AMBER|GREEN] [n]  newest stars, optionally by verdict
#   ventus star <id>                    one star in full
#   ventus drive '<json choice>' [query] drive a composition on the Bench now, e.g. ventus drive '{"enabled":{"sld-sandbox":false}}'
#   ventus map <repd_ref> <technology>  fire the MAP button for a project and report the arrival
#   ventus tick                         the 10-minute watch, once
param([Parameter(Position=0)][string]$cmd = 'help', [Parameter(Position=1)][string]$a, [Parameter(Position=2)][string]$b2, [Parameter(Position=3)][string]$c)
$sky = if ($env:SKY_DIR) { $env:SKY_DIR } else { 'C:\Users\vikra\Documents\GitHub\star-maker' }
$bench = 'http://127.0.0.1:8790'
function T { (Get-Content "$sky\elements\table.json" -Raw | ConvertFrom-Json).elements }
switch ($cmd) {
  'element'  { T | ? { $_.symbol -eq $a -or $_.name -like "*$a*" -or $_.key -like "*$a*" } | % { $_ | ConvertTo-Json -Depth 5 } }
  'elements' { T | ? { -not $a -or $_.family -eq $a } | Select-Object number, symbol, family, name, state | Format-Table -AutoSize }
  'stars'    { $n = if ($b2) { [int]$b2 } else { 20 }; Get-ChildItem "$sky\stars" -Filter *.json | Sort-Object LastWriteTime -Descending | % { Get-Content $_.FullName -Raw | ConvertFrom-Json } | ? { -not $a -or $_.verdict -eq $a } | Select-Object -First $n | % { "{0} {1,-5} {2}" -f $_.id, $_.verdict, $_.seed.label } }
  'star'     { Get-Content "$sky\stars\$a.json" -Raw }
  'drive'    { $choice = $a | ConvertFrom-Json; $body = @{ choice = @{ enabled = if ($choice.enabled) { $choice.enabled } else { @{} }; selected = if ($choice.selected) { $choice.selected } else { @{} } }; query = $b2 } | ConvertTo-Json -Depth 5; $r = Invoke-RestMethod -Method Post -Uri "$bench/api/testdrive" -ContentType application/json -Body $body -TimeoutSec 240; "$($r.verdict) · universe $($r  … [line shortened here: 536 characters; full line on GitHub]
  'map'      { $body = @{ choice = @{ enabled = @{}; selected = @{} }; query = "repd_ref=$a&technology=$b2&zoom=12"; expect = if ($c) { $c } else { $null } } | ConvertTo-Json -Depth 5; $r = Invoke-RestMethod -Method Post -Uri "$bench/api/testdrive" -ContentType application/json -Body $body -TimeoutSec 240; "$($r.verdict) · arrived=$($r.arrival.arrived) · km: $($r.arrival.km -join ', ') · $($r.arri  … [line shortened here: 426 characters; full line on GitHub]
  'tick'     { & "$PSScriptRoot\tick.ps1" }
  default    { Get-Content $PSCommandPath | Select-Object -First 10 | % { $_.TrimStart('# ') } }
}

Wanderer

A JavaScript module in the bench folder of Star Maker that reads summary from the ventus-grid-engine repository.

renderstar-maker / machinery/bench/wanderer.mjs · lines 1–170 of 170 · Not reached from any entry point (candidate for review) · pattern lineage (shared by 2 files)

What it does
It loads summary. Defines 10 functions or classes, including MINIFIED, sha, lineage, normBody, walk. Uses libraries node:fs/promises, node:crypto, node:path. Side effects: changes the web page (DOM); reads or writes files.
Inputs & outputs
In: data source: ventus-grid-engine data; command-line arguments. Out: JSON file graph.json; JSON file summary.json.
What it achieves
It is built from the sha step (`sha`), the lineage step (`lineage`) and the norm body helper (`normBody`). THE WANDERER — one star that never stops moving.
Why it matters
No other file in the estate was found to import it.
Application
star-maker · machinery/bench · JavaScript module
Uses
node:fs/promises, node:crypto, node:path
Used by
none found
Produces
MINIFIED, sha, lineage, normBody, walk, bodyFrom, purposeBefore, pass, score, label
Defines here
MINIFIED, sha, lineage, normBody, walk, bodyFrom, purposeBefore, pass, score, label
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-maker@2c477b0cc673304c5b288cee9d0e0ae42d273b2e machinery/bench/wanderer.mjs:1-170 · blob 737039df94a08c3925df5601fb0e38a039a43e6f · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
// THE WANDERER — one star that never stops moving. It reads every line of code ever written in
// the estate, numbers every unit (function, method, class, def) once and forever, and asks of
// each: WHY is this here? WHAT does it serve? IS IT A DUPLICATE? No model — our own reading.
// Its answers are evidence: the comment that states a purpose, the callers that prove a use,
// the identical body found elsewhere, the twin with the same name and a different body, the
// rare name two repos both call — an entanglement. It writes a graph the Spider can load, so a
// reader can get lost in the code and the entanglements can reveal themselves.
//
//   node wanderer.mjs            one pass → star-maker/wanderer/{units.jsonl, graph.json}, WANDERER.md
//   node wanderer.mjs --loop     a pass every hour, forever (the speed of light, for a CPU)
import { readFile, readdir, writeFile, mkdir, stat } from 'node:fs/promises';
import { createHash } from 'node:crypto';
import path from 'node:path';

const ROOT = process.env.ESTATE_DIR || 'C:/Users/vikra/Documents/GitHub';
const SKY = process.env.SKY_DIR || 'C:/Users/vikra/Documents/GitHub/star-maker';
const OUT = path.join(SKY, 'soul');                                      // published: graph, summary
const DEEP = path.join(path.dirname(new URL(import.meta.url).pathname.replace(/^\/([A-Za-z]:)/, '$1')), 'state', 'soul');   // sandbox: the full table (large)
const SKIP = /[\\/](\.git|node_modules|dist|build|vendor|\.venv|homepage_versions|restore_points|site_versions|_codemap|star-maker[\\/]stars)[\\/]/;
const EXT = new Set(['.js', '.mjs', '.cjs', '.py']);
const MINIFIED = t => t.length > 20000 && t.split('\n').some(l => l.length > 3000);
const sha = s => createHash('sha1').update(s).digest('hex').slice(0, 12);
const lineage = p => p.replace(/\d{12}[-_]?/g, '').replace(/\\/g, '/');
const normBody = b => b.replace(/\/\/[^\n]*|\/\*[\s\S]*?\*\/|#[^\n]*/g, '').replace(/\s+/g, ' ').trim();

async function* walk(dir) {
  for (const e of await readdir(dir, { withFileTypes: true }).catch(() => [])) {
    const p = path.join(dir, e.name);
    if (SKIP.test(p + (e.isDirectory() ? '/' : ''))) continue;
    if (e.isDirectory()) yield* walk(p); else if (EXT.has(path.extname(e.name)) && (await stat(p)).size < 2_500_000) yield p;
  }
}
// unit finders: [regex, kind]. name in group 1.
const FINDERS = [
  [/(?:^|\n)[ \t]*(?:export\s+)?(?:async\s+)?function\s*\*?\s*([A-Za-z_$][\w$]*)\s*\(/g, 'function'],
  [/(?:^|\n)[ \t]*(?:export\s+)?(?:const|let|var)\s+([A-Za-z_$][\w$]*)\s*=\s*(?:async\s*)?(?:\([^)]*\)|[A-Za-z_$][\w$]*)\s*=>/g, 'arrow'],
  [/(?:^|\n)[ \t]*(?:export\s+)?class\s+([A-Za-z_$][\w$]*)/g, 'class'],
  [/(?:^|\n)[ \t]+(?:async\s+)?(?!if|for|while|switch|catch|function|return)([A-Za-z_$][\w$]*)\s*\([^)]*\)\s*\{/g, 'method'],
  [/(?:^|\n)[ \t]*(?:async\s+)?def\s+([A-Za-z_]\w*)\s*\(/g, 'def'],
];
function bodyFrom(text, start, py) {
  if (py) { const lines = text.slice(start).split('\n'); const ind = (lines[0].match(/^[ \t]*/) || [''])[0].length; let i = 1; for (; i < lines.length && i < 400; i++) { const l = lines[i]; if (l.trim() && (l.match(/^[ \t]*/) || [''])[0].length <= ind) break; } return lines.slice(0, i).join('\n'); }
  const open = text.indexOf('{', start); if (open < 0) return text.slice(start, start + 200);
  let depth = 0; for (let i = open; i < text.length && i < open + 40000; i++) { const c = text[i]; if (c === '{') depth++; else if (c === '}' && --depth === 0) return text.slice(start, i + 1); }
  return text.slice(start, open + 2000);
}
function purposeBefore(text, start) {
  const before = text.slice(Math.max(0, start - 1200), start);
  const m = before.match(/(\/\*\*?[\s\S]*?\*\/|(?:[ \t]*\/\/[^\n]*\n)+|(?:[ \t]*#[^\n]*\n)+)\s*$/);
  if (!m) return null;
  const s = m[1].replace(/^\s*(\/\*\*?|\*\/|\*|\/\/|#)\s?/gm, '').replace(/\s+/g, ' ').trim();
  return s.length > 8 ? s.slice(0, 220) : null;
}

async function pass() {
  const t0 = Date.now();
  await mkdir(OUT, { recursive: true }); await mkdir(DEEP, { recursive: true });
  // THE SOUL: the key of a unit is its normalized body, hashed — formless (no file, no name, no
  // position in it), eternal (the same code anywhere, any time, has the same soul), and prior to
  // any universe it appears in. Numbers are assigned once per soul and never reused.
  const prev = new Map();
  try { for (const l of (await readFile(path.join(DEEP, 'souls.jsonl'), 'utf8')).split('\n')) if (l) { const u = JSON.parse(l); prev.set(u.soul, u.number); } } catch {}
  let nextNumber = prev.size ? Math.max(...prev.values()) + 1 : 1;

  const units = []; const callsByFile = new Map(); const files = []; let totalLines = 0; const uniqueLines = new Set();
  for await (const f of walk(ROOT)) {
    const text = await readFile(f, 'utf8').catch(() => '');
    if (!text || MINIFIED(text)) continue;
    const rel = path.relative(ROOT, f).replace(/\\/g, '/'); const repo = rel.split('/')[0]; const lin = lineage(rel);
    files.push(rel); totalLines += text.split('\n').length;
    for (const l of text.split('\n')) { const n = l.trim(); if (n.length > 3) uniqueLines.add(sha(n)); }
    callsByFile.set(rel, new Set(text.match(/(?<![.\w$])[A-Za-z_$][\w$]*(?=\s*\()/g) || []));   // bare calls only: obj.slice( is not a call of our slice
    const py = f.endsWith('.py'); const seen = new Set();
    for (const [rx, kind] of FINDERS) {
      if (py !== (kind === 'def')) continue;
      for (const m of text.matchAll(rx)) {
        const name = m[1]; const start = m.index + (m[0].startsWith('\n') ? 1 : 0);
        if (seen.has(start)) continue; seen.add(start);
        const body = bodyFrom(text, start, py); const lines = body.split('\n').length;
        if (lines < 2 && kind !== 'arrow') continue;
        const soul = sha(normBody(body));
        const number = prev.get(soul) || (prev.set(soul, nextNumber), nextNumber++);
        units.push({ soul, number, key: `${lin}#${kind}:${name}`, name, kind, repo, file: rel, lineage: lin, line: text.slice(0, start).split('\n').length, lines,
          body_hash: soul, purpose: purposeBefore(text, start) });
      }
    }
  }
  // WHY / WHAT / DUPLICATE — answered from evidence
  const byHash = new Map(), byName = new Map(), defFiles = new Map();
  for (const u of units) {
    (byHash.get(u.body_hash) || byHash.set(u.body_hash, []).get(u.body_hash)).push(u);
    (byName.get(u.name) || byName.set(u.name, []).get(u.name)).push(u);
    (defFiles.get(u.name) || defFiles.set(u.name, new Set()).get(u.name)).add(u.file);
  }
  for (const u of units) {
    const callers = []; for (const [f, calls] of callsByFile) if (f !== u.file && calls.has(u.name)) callers.push(f);
    u.callers = callers.length; u.caller_repos = [...new Set(callers.map(f => f.split('/')[0]))]; u.caller_files = callers.slice(0, 60);
    const dups = byHash.get(u.body_hash).filter(o => o !== u && o.lineage !== u.lineage);
    u.duplicates = dups.slice(0, 12).map(o => o.number); u.duplicate_repos = [...new Set(dups.map(o => o.repo))];
    const twins = (byName.get(u.name) || []).filter(o => o !== u && o.repo !== u.repo && o.body_hash !== u.body_hash);
    u.twins = twins.slice(0, 12).map(o => o.number);
    u.why = u.purpose ? 'stated' : callers.length ? 'used' : 'unstated-and-uncalled';
  }
  // entanglements: a name called from ≥2 repos but defined in exactly one file — a hidden dependency by name
  const BUILTIN = new Set(['slice','Number','String','Boolean','Array','Object','round','floor','ceil','abs','min','max','open','has','get','set','add','delete','entries','keys','values','next','range','len','print','int','str','float','list','dict','sorted','function','require','fetch','setTimeout','setInterval','clearTimeout','querySelector','querySelectorAll','createElement','getAttribute','set  … [line shortened here: 1,014 characters; full line on GitHub]
  const entangled = units.filter(u => u.kind !== 'method' && u.name.length >= 4 && !BUILTIN.has(u.name) && !/^[a-z]$/.test(u.name) && defFiles.get(u.name).size === 1 && u.caller_repos.filter(r => r !== u.repo).length >= 1);

  units.sort((a, b) => a.number - b.number || a.file.localeCompare(b.file));
  await writeFile(path.join(DEEP, 'souls.jsonl'), units.map(u => JSON.stringify(u)).join('\n') + '\n');   // deep: every incarnation of every soul (sandbox only)
  const soulsDistinct = new Set(units.map(u => u.soul)).size;

  // a graph the Spider can load (receiver idiom: nodes {label,type,rag,reason,gh}, edges {from,to,kind})
  const score = u => u.duplicates.length * 3 + u.twins.length * 2 + (entangled.includes(u) ? 5 : 0) + (u.why === 'unstated-and-uncalled' ? 1 : 0);
  const top = units.filter(u => score(u) > 0).sort((a, b) => score(b) - score(a)).slice(0, 400);
  const inTop = new Set(top.map(u => u.number)); const byNum = new Map(units.map(u => [u.number, u]));
  const label = u => `#${u.number} ${u.repo}/${u.name}`;
  const nodes = top.map(u => ({ label: label(u), type: u.why === 'unstated-and-uncalled' ? 'orphan' : entangled.includes(u) ? 'entangled' : u.duplicates.length ? 'duplicate' : 'twin',
    rag: u.why === 'unstated-and-uncalled' ? 'red' : u.duplicates.length ? 'amber' : 'green',
    reason: `${u.kind} · ${u.lines} lines · ${u.file}:${u.line} · ${u.purpose ? 'says: ' + u.purpose.slice(0, 120) : 'no stated purpose'} · ${u.callers} callers`,
    gh: `https://github.com/Ventusltd/${u.repo}/blob/main/${u.file.slice(u.repo.length + 1)}#L${u.line}` }));
  const edges = [];
  for (const u of top) {
    for (const n of u.duplicates) if (inTop.has(n)) edges.push({ from: label(u), to: label(byNum.get(n)), kind: 'DUPLICATES' });
    for (const n of u.twins) if (inTop.has(n)) edges.push({ from: label(u), to: label(byNum.get(n)), kind: 'TWIN_OF' });
  }
  for (const u of entangled) if (inTop.has(u.number)) for (const r of u.caller_repos) if (r !== u.repo) edges.push({ from: `repo ${r}`, to: label(u), kind: 'ENTANGLED_WITH' });
  const repoNodes = [...new Set(edges.filter(e => e.from.startsWith('repo ')).map(e => e.from))].map(l => ({ label: l, type: 'repo', rag: 'green', reason: 'calls a unit defined in another repo by name alone', gh: `https://github.com/Ventusltd/${l.slice(5)}` }));
  await writeFile(path.join(OUT, 'graph.json'), JSON.stringify({ schema: 'soul-graph.v1', label: 'Soul stars', generated_utc: new Date().toISOString(),
    note: 'Every unit of code keyed by its soul (normalized body hash) and numbered once, forever; edges are evidence: identical souls in several places, same-name twins across repos, names called across repos but defined once.',
    focus_default: nodes[0]?.label, nodes: [...nodes, ...repoNodes], edges }, null, 2));
  await writeFile(path.join(OUT, 'summary.json'), JSON.stringify({ generated_utc: new Date().toISOString(), files: files.length, lines_read: totalLines, unique_lines: uniqueLines.size,
    incarnations: units.length, souls: soulsDistinct, stated: units.filter(u => u.purpose).length, uncalled_unstated: units.filter(u => u.why === 'unstated-and-uncalled').length,
    cross_repo_duplicates: units.filter(u => u.duplicate_repos.length).length, entanglements: entangled.length }, null, 2));

  const orphans = units.filter(u => u.why === 'unstated-and-uncalled'), dups = units.filter(u => u.duplicate_repos.length), stated = units.filter(u => u.purpose);
  const md = `# Soul stars — ${soulsDistinct.toLocaleString()} souls in ${units.length.toLocaleString()} incarnations

Pass at ${new Date().toISOString()} · ${files.length} files · ${totalLines.toLocaleString()} lines read · **${uniqueLines.size.toLocaleString()} unique lines** ever written · ${Math.round((Date.now() - t0) / 1000)} s. No model; our own reading.

A **soul** is the key of a unit of code: its body, normalized and hashed. It has no file, no name and no position in it — the same code anywhere, any time, has the same soul, and the soul exists before any universe it is composed into. A soul's number (\`#n\`) is given once and never reused. A soul can have many **incarnations** (the places it lives); copper is deep, but on the periodic table it i  … [line shortened here: 556 characters; full line on GitHub]

Levels at which new code falls into place: **line** (unique-line hash) → **soul** (unit body hash) → **element** (a soul that is a named primitive on the periodic table) → **compound** (a composition of elements, judged by the Chemistry star).

| question | answer |
|---|---|
| WHY is it here? — states its purpose in a comment | ${stated.length} (${Math.round(100 * stated.length / units.length)} %) |
| WHAT does it serve? — called from another file | ${units.filter(u => u.callers).length} |
| Unstated **and** uncalled (the wanderer's worry) | **${orphans.length}** |
| IS IT A DUPLICATE? — identical body in another repo | **${dups.length}** |
| Twins — same name, another repo, different body | ${units.filter(u => u.twins.length).length} |
| **Entanglements** — called across repos, defined once | **${entangled.length}** |

## Entanglements (quantum: two repos, one definition, no declared wire)
${entangled.sort((a, b) => b.caller_repos.length - a.caller_repos.length).slice(0, 40).map(u => `- **#${u.number} ${u.name}** defined in \`${u.file}\`, called from ${u.caller_repos.filter(r => r !== u.repo).join(', ')}`).join('\n') || '- none'}

## Duplicates across repos (the same body, copied)
${dups.sort((a, b) => b.duplicate_repos.length - a.duplicate_repos.length).slice(0, 40).map(u => `- **#${u.number} ${u.name}** (${u.lines} lines) in ${u.repo} = also in ${u.duplicate_repos.join(', ')}`).join('\n') || '- none'}

## Unstated and uncalled — why are these here?
${orphans.filter(u => u.lines >= 8).sort((a, b) => b.lines - a.lines).slice(0, 40).map(u => `- **#${u.number} ${u.name}** · ${u.lines} lines · \`${u.file}:${u.line}\``).join('\n') || '- none'}

## For the Spider
\`soul/graph.json\` — ${nodes.length + repoNodes.length} nodes, ${edges.length} edges, in the receiver's own idiom. To let a reader get lost in it on https://ventusltd.github.io/ventus-grid-engine/, add a graph entry to \`spider/manifest.json\` pointing at this file's published URL (publishing is the architect's).
`;
  await writeFile(path.join(SKY, 'SOUL.md'), md);
  console.log(`soul stars: ${soulsDistinct} souls / ${units.length} incarnations, ${uniqueLines.size} unique lines, ${orphans.length} orphans, ${dups.length} cross-repo duplicates, ${entangled.length} entanglements, ${Math.round((Date.now() - t0) / 1000)} s`);
}

if (process.argv.includes('--loop')) { for (;;) { try { await pass(); } catch (e) { console.error('wanderer error', e.message); } await new Promise(r => setTimeout(r, 60 * 60 * 1000)); } }
else await pass();

Eyes

A JavaScript module in the machinery folder of Star Maker that draws targets. It is built from the flag step (`flag`) and the inspect step (`inspect`).

renderstar-maker / machinery/eyes/eyes.mjs · lines 1–100 of 100 · Not reached from any entry point (candidate for review) · pattern inspect (shared by 40 files)

What it does
It draws targets. Defines flag, inspect. Uses libraries puppeteer-core, node:fs/promises, node:os, node:path. Side effects: changes the web page (DOM); reads or writes files.
Inputs & outputs
In: JSON file targets.json; JSON file report.json; command-line arguments. Out: JSON file report.json; WebGL/WebGPU drawing.
What it achieves
Load pages in real Chrome on the GPU, in parallel, wait for them to settle, capture console errors / failed requests / screenshot.
Why it matters
No other file in the estate was found to import it.
Application
star-maker · machinery/eyes · JavaScript module
Uses
puppeteer-core, node:fs/promises, node:os, node:path
Used by
none found
Produces
flag, inspect
Defines here
flag, inspect
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
star-maker@2c477b0cc673304c5b288cee9d0e0ae42d273b2e machinery/eyes/eyes.mjs:1-100 · blob ea432ff43534b2ca36c349f5ecbadbc73882cdf1 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: dom, filesystem · domain stage: unknown · users: none · canonical: unreached_review
// EYES: load pages in real Chrome on the GPU, in parallel, wait for them to settle,
// capture console errors / failed requests / screenshot. Screenshots stay in RAM and
// are only written as small JPEGs (or only for failing pages with --failures-only).
//
// node eyes.mjs targets.json [--concurrency 8] [--failures-only] [--headed]
import puppeteer from 'puppeteer-core';
import { readFile, writeFile, mkdir } from 'node:fs/promises';
import { tmpdir } from 'node:os';
import path from 'node:path';

const args = process.argv.slice(2);
const flag = (name, dflt) => { const i = args.indexOf(name); return i < 0 ? dflt : (args[i + 1] ?? true); };
const targetsFile = args.find(a => a.endsWith('.json')) ?? 'targets.json';
const concurrency = Number(flag('--concurrency', 8));
const failuresOnly = args.includes('--failures-only');
const headed = args.includes('--headed');

const targets = JSON.parse((await readFile(targetsFile, 'utf8')).replace(/^/, ''));
const stamp = new Date().toISOString().replace(/[-:]/g, '').slice(0, 13);
const runDir = path.join('runs', stamp);
await mkdir(runDir, { recursive: true });

const browser = await puppeteer.launch({
  executablePath: 'C:/Program Files/Google/Chrome/Application/chrome.exe',
  headless: !headed,
  userDataDir: path.join(tmpdir(), 'eyes-chrome-profile'),
  defaultViewport: { width: 1600, height: 1000 },
  args: ['--use-angle=d3d11', '--enable-gpu', '--ignore-gpu-blocklist', '--enable-gpu-rasterization',
         '--disable-background-timer-throttling', '--disable-renderer-backgrounding'],
});

const gpu = await (async () => {
  const p = await browser.newPage();
  const info = await p.evaluate(() => {
    const gl = document.createElement('canvas').getContext('webgl2');
    const ext = gl && gl.getExtension('WEBGL_debug_renderer_info');
    return gl ? gl.getParameter(ext ? ext.UNMASKED_RENDERER_WEBGL : gl.RENDERER) : 'NO WEBGL';
  });
  await p.close();
  return info;
})();
console.log(`GPU: ${gpu}\nTargets: ${targets.length}  concurrency: ${concurrency}\n`);

async function inspect(t) {
  const page = await browser.newPage();
  const consoleErrors = [], pageErrors = [], failed = [];
  page.on('console', m => { if (['error', 'warn'].includes(m.type())) consoleErrors.push(`[${m.type()}] ${m.text()}`.slice(0, 400)); });
  page.on('pageerror', e => pageErrors.push(String(e.message).slice(0, 400)));
  page.on('requestfailed', r => failed.push(`${r.failure()?.errorText} ${r.url()}`.slice(0, 300)));
  page.on('response', r => { if (r.status() >= 400) failed.push(`HTTP ${r.status()} ${r.url()}`.slice(0, 300)); });

  const t0 = Date.now();
  let status = null, navError = null;
  try {
    const resp = await page.goto(t.url, { waitUntil: 'networkidle2', timeout: (t.timeoutSec ?? 60) * 1000 });
    status = resp?.status() ?? null;
  } catch (e) { navError = e.message.slice(0, 200); }
  await new Promise(r => setTimeout(r, (t.settleSec ?? 4) * 1000));
  for (const text of t.clickText ?? []) {
    const clicked = await page.evaluate(txt => {
      const el = [...document.querySelectorAll('button, a, [role=button], label, li, div, span')]
        .find(e => e.offsetParent && e.textContent.trim() === txt);
      if (el) el.click();
      return !!el;
    }, text);
    if (!clicked) consoleErrors.push(`[eyes] could not find clickable "${text}"`);
    await new Promise(r => setTimeout(r, 2500));
  }
  const loadMs = Date.now() - t0;

  const probe = await page.evaluate(() => ({
    title: document.title,
    textChars: document.body?.innerText.length ?? 0,
    canvases: [...document.querySelectorAll('canvas')].map(c => `${c.width}x${c.height}`),
    visibleErrorBanners: [...document.querySelectorAll('body *')]
      .filter(el => el.children.length === 0 && /error|failed|not installed|mismatch|nothing to/i.test(el.textContent) && el.offsetParent)
      .slice(0, 5).map(el => el.textContent.trim().slice(0, 200)),
  })).catch(e => ({ probeError: e.message }));

  const shot = await page.screenshot({ type: 'jpeg', quality: 70, fullPage: !!t.fullPage });
  const problems = pageErrors.length + consoleErrors.filter(e => e.startsWith('[error]')).length
                 + (navError ? 1 : 0) + (status && status >= 400 ? 1 : 0) + (probe.visibleErrorBanners?.length ?? 0);
  const verdict = problems ? 'RED' : 'GREEN';
  if (!failuresOnly || verdict === 'RED') await writeFile(path.join(runDir, `${t.id}.jpg`), shot);
  await page.close();

  const r = { id: t.id, url: t.url, verdict, status, loadMs, navError, ...probe, pageErrors, consoleErrors: consoleErrors.slice(0, 15), failedRequests: failed.slice(0, 15) };
  console.log(`${verdict === 'RED' ? '🔴' : '🟢'} ${t.id.padEnd(24)} ${String(status).padEnd(4)} ${String(loadMs).padStart(6)} ms  errors:${pageErrors.length}/${consoleErrors.length}  failedReq:${failed.length}`);
  return r;
}

const queue = [...targets], results = [];
await Promise.all(Array.from({ length: Math.min(concurrency, queue.length) }, async () => {
  while (queue.length) results.push(await inspect(queue.shift()));
}));
await browser.close();

results.sort((a, b) => a.id.localeCompare(b.id));
await writeFile(path.join(runDir, 'report.json'), JSON.stringify({ gpu, stamp, results }, null, 2));
console.log(`\nReport: ${path.resolve(runDir, 'report.json')}`);

Chemistry

A JavaScript module in the builders folder of Stars that reads table and compounds.

storagestars / builders/chemistry.mjs · lines 1–114 of 114 · Not reached from any entry point (candidate for review) · pattern formulaOf (shared by 2 files)

What it does
It loads table and compounds. Defines 7 functions or classes, including term, formulaOf, decayOf, node, wire. Uses libraries node:fs/promises, node:path. Side effects: reads or writes files.
Inputs & outputs
In: JSON file table.json. Out: JSON file compounds.json; JSON file graph.json.
Downstream impact
Used directly by 1 file: Links and Evidence Test (stars).
What it achieves
It is built from the term step (`term`), the formula of helper (`formulaOf`) and the decay of helper (`decayOf`). THE CHEMISTRY STAR — computes compounds from the elements.
Why it matters
Checked by Links and Evidence Test.
Application
stars · builders · JavaScript module
Uses
Node Links (import), node:fs/promises, node:path
Used by
run by Links and Evidence Test (script call)
Produces
term, formulaOf, decayOf, node, wire, termUnstable, pairUnstable
Defines here
term, formulaOf, decayOf, node, wire, termUnstable, pairUnstable
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc builders/chemistry.mjs:1-114 · blob b59a75af45c8909b58fba751d31f9edb65357aee · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: unreached_review
// THE CHEMISTRY STAR — computes compounds from the elements. Every star in the sky is a
// molecule: the elements (cartridge versions, the deep-link contract, the shell) it was composed
// from. Its verdict is the compound's stability. Across thousands of stars the reactions emerge:
// which element pairs are stable, which decay, and what the decay product is (the exception).
// All of it is written as a graph the Spider can load. No model — arithmetic over the sky.
//
//   node chemistry.mjs   → star-maker/chemistry/{compounds.json, graph.json}, CHEMISTRY.md
import { readFile, readdir, writeFile, mkdir } from 'node:fs/promises';
import path from 'node:path';
import { nodeLinks } from './node-links.mjs';

const SKY = process.env.SKY_DIR || 'C:/Users/vikra/Documents/GitHub/star-maker';
const OUT = path.join(SKY, 'chemistry');
await mkdir(OUT, { recursive: true });
const table = JSON.parse(await readFile(path.join(SKY, 'elements', 'table.json'), 'utf8')).elements;
const symbolOf = new Map(table.filter(e => e.family === 'cartridge').map(e => [e.name, e.symbol]));
const contractSym = table.find(e => e.key === 'contract:deeplink')?.symbol || 'Dl';

const files = (await readdir(path.join(SKY, 'stars'))).filter(f => f.endsWith('.json'));
const stars = [];
const exampleFile = new Map();
for (const f of files) { const star = JSON.parse(await readFile(path.join(SKY, 'stars', f), 'utf8')); stars.push(star); exampleFile.set(star.id, f); }
if (!stars.length) throw new Error('No composition tests found');

// formula: one term per element present. A cartridge term is Symbol(version stamp); absence = shell original in that slot.
const term = (id, sel) => `${symbolOf.get(id) || id}${sel ? '(' + String(sel).slice(0, 12) + ')' : ''}`;
const formulaOf = s => {
  const on = (s.loaded || []).map(id => term(id, s.seed.choice.selected?.[id]));
  if (s.seed.kind === 'deeplink') on.push(contractSym);
  return on.sort().join('·') || 'Shell';
};
const decayOf = s => (s.findings || []).filter(f => f.level === 'exception' || f.level === 'arrival').map(f => `${f.part}: ${f.text}`.slice(0, 120));

const compounds = new Map();
for (const s of stars) {
  const formula = formulaOf(s);
  const c = compounds.get(formula) || compounds.set(formula, { formula, kind: s.seed.kind, stars: 0, green: 0, amber: 0, red: 0, decays: new Map(), ids: [] }).get(formula);
  c.stars++; c[s.verdict.toLowerCase()] = (c[s.verdict.toLowerCase()] || 0) + 1; if (c.ids.length < 5) c.ids.push(s.id);
  for (const d of decayOf(s)) c.decays.set(d, (c.decays.get(d) || 0) + 1);
}
const list = [...compounds.values()].map(c => ({ ...c, stability: c.stars ? c.green / c.stars : 0, decays: [...c.decays].sort((a, b) => b[1] - a[1]).slice(0, 3).map(([text, n]) => ({ text, n })) }))
  .sort((a, b) => a.stability - b.stability || b.stars - a.stars);

// reactions between element versions: for constellation stars, which pair decays and why
const pairs = new Map();
for (const s of stars.filter(s => s.seed.kind === 'constellation' || s.seed.kind === 'unplug')) {
  const key = s.seed.kind === 'unplug' ? `without ${Object.keys(s.seed.choice.enabled).map(id => symbolOf.get(id) || id).sort().join('+')}` : formulaOf(s);
  const p = pairs.get(key) || pairs.set(key, { key, kind: s.seed.kind, stars: 0, red: 0, decays: new Map() }).get(key);
  p.stars++; if (s.verdict === 'RED') p.red++;
  for (const d of decayOf(s)) p.decays.set(d, (p.decays.get(d) || 0) + 1);
}
// element-level rules: for each cartridge version (element term), how often does it appear in a RED compound?
const termStats = new Map();
for (const s of stars) for (const t of formulaOf(s).split('·')) { const x = termStats.get(t) || termStats.set(t, { term: t, stars: 0, red: 0, decays: new Map() }).get(t); x.stars++; if (s.verdict === 'RED') { x.red++; for (const d of decayOf(s)) x.decays.set(d, (x.decays.get(d) || 0) + 1); } }
const unstableTerms = [...termStats.values()].filter(x => x.stars >= 3 && x.red / x.stars >= 0.9).sort((a, b) => b.stars - a.stars);
const nobleTerms = [...termStats.values()].filter(x => x.stars >= 3 && x.red === 0).sort((a, b) => b.stars - a.stars);

// graph for the Spider: element-version nodes; UNSTABLE_WITH edges between terms that co-occur in red compounds; DECAYS_TO edges to the exception text
const nodes = [], edges = [], seen = new Set(), wired = new Set();
const symbols = new Set(table.map(e => e.symbol));
const decayExamples = new Map();
for (const star of stars) for (const decay of decayOf(star)) if (!decayExamples.has(decay)) decayExamples.set(decay, 'https://github.com/Ventusltd/star-maker/blob/main/stars/' + encodeURIComponent(exampleFile.get(star.id)));
const node = (label, type, rag, reason) => { if (!seen.has(label)) { seen.add(label); const n = { label, type, rag, reason }; nodes.push({ ...n, ...nodeLinks(n, { report: 'CHEMISTRY', symbols, example: decayExamples.get(label) }) }); } };
// one wire per relationship: a pair seen in many compounds is still one relationship
const wire = (from, to, kind) => { const k = kind === 'DECAYS_TO' ? `${from}\u0000${to}\u0000${kind}` : `${[from, to].sort().join('\u0000')}\u0000${kind}`; if (!wired.has(k)) { wired.add(k); edges.push({ from, to, kind }); } };
// pair evidence across ALL stars, red and green: a pair is unstable only when the stars that contain it are mostly red,
// by the same thresholds the element rules use (at least 3 stars, at least 90% red). Co-occurring in a red star is not enough:
// an element present in every star co-occurs with every failure.
const pairStats = new Map();
for (const s of stars) {
  const t = [...new Set(formulaOf(s).split('·'))].sort();
  for (let i = 0; i < t.length; i++) for (let j = i + 1; j < t.length; j++) {
    const k = `${t[i]}\u0000${t[j]}`; const p = pairStats.get(k) || pairStats.set(k, { stars: 0, red: 0 }).get(k);
    p.stars++; if (s.verdict === 'RED') p.red++;
  }
}
const termUnstable = t => { const x = termStats.get(t); return !!x && x.stars >= 3 && x.red / x.stars >= 0.9; };
// A pair wire adds no distinct evidence when either element already meets the rule alone.
// Such an element keeps its red node and decay links; suppressing this wire does not clear its fault.
const pairUnstable = (a, b) => { const p = pairStats.get([a, b].sort().join('\u0000')); return !!p && p.stars >= 3 && p.red / p.stars >= 0.9 && !termUnstable(a) && !termUnstable(b); };
for (const x of [...unstableTerms.slice(0, 80), ...nobleTerms.slice(0, 40)]) node(x.term, 'element', x.red / x.stars >= 0.9 ? 'red' : 'green', `${x.stars} compounds · ${x.red} red`);
for (const c of list.filter(c => c.red && c.formula.includes('·')).slice(0, 300)) {
  const terms = c.formula.split('·'); const bad = terms.filter(t => termStats.get(t) && termStats.get(t).red / termStats.get(t).stars < 0.9);
  for (const t of terms) node(t, 'element', termStats.get(t).red / termStats.get(t).stars >= 0.9 ? 'red' : 'amber', `${termStats.get(t).stars} compounds · ${termStats.get(t).red} red`);
  for (let i = 0; i < terms.length; i++) for (let j = i + 1; j < terms.length; j++) if (pairUnstable(terms[i], terms[j])) wire(terms[i], terms[j], 'UNSTABLE_WITH');
  for (const d of c.decays.slice(0, 1)) { node(d.text, 'decay', 'red', `${d.n} stars`); for (const t of terms) wire(t, d.text, 'DECAYS_TO'); }
}
await writeFile(path.join(OUT, 'compounds.json'), JSON.stringify({ generated_utc: new Date().toISOString(), stars: stars.length, compounds: list }, null, 2));
await writeFile(path.join(OUT, 'graph.json'), JSON.stringify({ schema: 'chemistry-graph.v1', label: 'The Chemistry star', generated_utc: new Date().toISOString(),
  note: 'Elements (cartridge versions, the contract) as nodes; UNSTABLE_WITH when at least three recorded tests contain the pair and at least 90% are red; co-occurrence does not establish cause; DECAYS_TO the exception a compound produces.', focus_default: nodes[0]?.label, nodes, edges }, null, 2));

const md = `# The Chemistry star — ${list.length} compounds from ${stars.length} stars

A compound is a composition of elements (cartridge versions by symbol and stamp; **${contractSym}** = the deep-link contract; **Shell** = nothing bolted on). Stability = share of its stars that were GREEN. Decay = the exception the compound produces. Updated ${new Date().toISOString()}. No model — arithmetic over the sky.

Symbols: ${[...symbolOf].map(([n, s]) => `**${s}** ${n}`).join(' · ')}

## Noble elements (never in a red compound, ≥ 3 compounds)
${nobleTerms.slice(0, 15).map(x => `- **${x.term}** — ${x.stars} compounds, all stable`).join('\n') || '- none yet'}

## Radioactive elements (red in ≥ 90 % of their compounds)
${unstableTerms.slice(0, 25).map(x => `- **${x.term}** — ${x.red}/${x.stars} red · decays to: ${[...x.decays].sort((a, b) => b[1] - a[1]).slice(0, 2).map(([t]) => `\`${t.slice(0, 80)}\``).join(' / ')}`).join('\n') || '- none'}

## Reactions that decay (unplug one element, another dies)
${[...pairs.values()].filter(p => p.kind === 'unplug' && p.red).map(p => `- **${p.key}** → ${p.red}/${p.stars} red · ${[...p.decays].sort((a, b) => b[1] - a[1]).slice(0, 2).map(([t, n]) => `\`${t.slice(0, 90)}\` ×${n}`).join(' · ')}`).join('\n') || '- none'}

## Least stable compounds
${list.filter(c => c.stars >= 1 && c.red).slice(0, 30).map(c => `- \`${c.formula}\` — ${Math.round(100 * c.stability)} % stable (${c.red} red / ${c.stars}) · ${c.decays[0] ? '`' + c.decays[0].text.slice(0, 90) + '`' : ''}`).join('\n') || '- none'}

## For the Spider
\`chemistry/graph.json\` — ${nodes.length} nodes, ${edges.length} edges, receiver idiom.
`;
await writeFile(path.join(SKY, 'CHEMISTRY.md'), md);
console.log(`chemistry: ${stars.length} stars → ${list.length} compounds · ${nobleTerms.length} noble · ${unstableTerms.length} radioactive · graph ${nodes.length}/${edges.length}`);

Links and Evidence Test

A test in the builders folder of Stars that checks Node Links and Pair Verdict.

teststars / builders/links-and-evidence.test.mjs · lines 1–53 of 53 · Not reached from any entry point (candidate for review)

What it does
It tests its inputs. Uses libraries node:test, node:assert/strict, node:fs, node:os, node:path. Side effects: reads or writes files; starts processes.
Inputs & outputs
In: JSON file example.json; JSON file graph.json. Out: JSON file table.json.
What it achieves
No statement of purpose was found in the file, a README line naming it, or its name.
Why it matters
Guards the behaviour of Node Links, Pair Verdict and Chemistry.
Application
stars · builders · test
Uses
Node Links (script call), Pair Verdict (script call), Chemistry (script call), node:test, node:assert/strict, node:fs, node:os, node:path, node:child_process, node:url
Used by
none found
Produces
none declared
Defines here
none
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc builders/links-and-evidence.test.mjs:1-53 · blob f8775f5de6c378e42d5b35abdb8cf51347a75fe6 · GitHub at these lines
State
achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: unknown · users: none · canonical: unreached_review
import test from 'node:test';
import assert from 'node:assert/strict';
import { nodeLinks } from './node-links.mjs';
import { pairVerdict } from '../modular-star/pair-verdict.mjs';
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join, resolve, sep } from 'node:path';
import { spawnSync } from 'node:child_process';
import { fileURLToPath } from 'node:url';
test('legacy electron numbers never masquerade as permanent family keys', () => {
  const legacy = nodeLinks({ label: '#511 distanceKm', type: 'function' });
  assert.match(legacy.ext, /CLASSIFICATION\.md$/);
  assert.match(nodeLinks({ id: 'family:511', label: 'distanceKm', type: 'function' }).ext, /family=511$/);
});
test('element, repository and evidence links resolve by identity', () => {
  assert.match(nodeLinks({ label: 'Si(202609051525)', type: 'element' }, { symbols: new Set(['Si']) }).ext, /block=Si$/);
  assert.equal(nodeLinks({ label: 'gridatlas', type: 'repo' }).gh, 'https://github.com/Ventusltd/gridatlas');
  assert.equal(nodeLinks({ type: 'decay' }, { example: 'https://github.com/Ventusltd/star-maker/blob/main/stars/example.json' }).ext, 'https://github.com/Ventusltd/star-maker/blob/main/stars/example.json');
});
test('77 percent green is mixed evidence, not unstable', () => {
  assert.equal(pairVerdict({ green: 3261, red: 955, total: 4216 }), 'mixed evidence');
});
test('unstable needs three observations and at least ninety percent actually red', () => {
  assert.equal(pairVerdict({ green: 0, red: 2, total: 2 }), 'mixed evidence');
  assert.equal(pairVerdict({ green: 1, red: 9, total: 10 }), 'unstable');
  assert.equal(pairVerdict({ green: 1, red: 8, total: 10 }), 'mixed evidence');
  assert.equal(pairVerdict({ green: 0, red: 0, total: 10 }), 'mixed evidence');
  assert.equal(pairVerdict({ green: 3, red: 0, total: 3 }), 'proven');
  assert.throws(() => pairVerdict({ green: 4, red: 0, total: 3 }), /Invalid/);
});
test('chemistry suppresses pairs explained by an independently unstable element', () => {
  const root = mkdtempSync(join(tmpdir(), 'stars-pairs-'));
  try {
    mkdirSync(join(root, 'elements')); mkdirSync(join(root, 'stars'));
    writeFileSync(join(root, 'elements/table.json'), JSON.stringify({ elements: [{ family: 'cartridge', name: 'a', symbol: 'Aa' }, { family: 'cartridge', name: 'b', symbol: 'Bb' }] }));
    for (let i = 0; i < 3; i++) writeFileSync(join(root, `stars/${i}.json`), JSON.stringify({ id: i, seed: { kind: 'constellation', choice: { selected: {} } }, loaded: ['a', 'b'], verdict: 'RED', findings: [] }));
    const run = spawnSync(process.execPath, [fileURLToPath(new URL('./chemistry.mjs', import.meta.url))], { env: { ...process.env, SKY_DIR: root }, encoding: 'utf8' });
    assert.equal(run.status, 0, run.stderr);
    const graph = JSON.parse(readFileSync(join(root, 'chemistry/graph.json'), 'utf8'));
    assert.equal(graph.edges.filter(e => e.kind === 'UNSTABLE_WITH').length, 0);
    assert.ok(graph.nodes.every(n => n.gh && n.ext));
    assert.ok(graph.nodes.every(n => n.rag === 'red'));
    // Add green observations separately: now the pair carries additional evidence.
    for (let i = 3; i < 9; i++) writeFileSync(join(root, `stars/${i}.json`), JSON.stringify({ id: i, seed: { kind: 'constellation', choice: { selected: {} } }, loaded: [i < 6 ? 'a' : 'b'], verdict: 'GREEN', findings: [] }));
    const rerun = spawnSync(process.execPath, [fileURLToPath(new URL('./chemistry.mjs', import.meta.url))], { env: { ...process.env, SKY_DIR: root }, encoding: 'utf8' });
    assert.equal(rerun.status, 0, rerun.stderr);
    const updated = JSON.parse(readFileSync(join(root, 'chemistry/graph.json'), 'utf8'));
    assert.equal(updated.edges.filter(e => e.kind === 'UNSTABLE_WITH').length, 1);
  } finally {
    assert.ok(resolve(root).startsWith(resolve(tmpdir()) + sep));
    rmSync(root, { recursive: true, force: true });
  }
});

Node Links

A JavaScript module in the builders folder of Stars. It is built from the node links helper (`nodeLinks`).

transformstars / builders/node-links.mjs · lines 1–20 of 20 · Not reached from any entry point (candidate for review)

What it does
It calculates its inputs. Defines nodeLinks.
Downstream impact
Used directly by 4 files: Chemistry (stars); Links and Evidence Test (stars); Random (stars); VEDIC (stars).
What it achieves
Numbers in the historical electron/soul graphs are not modular-star family keys.
Why it matters
Imported by Chemistry, Random and VEDIC. Checked by Links and Evidence Test.
Application
stars · builders · JavaScript module
Uses
Stars — Index Page (estate URL)
Used by
imported by Chemistry (import), run by Links and Evidence Test (script call), imported by Random (import), imported by VEDIC (import)
Produces
nodeLinks
Defines here
nodeLinks
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc builders/node-links.mjs:1-20 · blob 9dcbd1b7230065579bec028064d2bba00f0b0d67 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: transform · effects: none found · domain stage: unknown · users: none · canonical: unreached_review
// Numbers in the historical electron/soul graphs are not modular-star family keys.
// Only an explicit family key may open code.html?family=N.
const SITE = 'https://ventusltd.github.io/stars/';
const GH = 'https://github.com/Ventusltd/stars/blob/main/';
export function nodeLinks(node, { report = 'CLASSIFICATION', symbols = new Set(), example = null } = {}) {
  const fallback = `${GH}reports/${report}.md`;
  let gh = node.gh || fallback, ext = node.ext || fallback;
  const family = /^family:(\d+)$/.exec(node.id || '');
  if (family) ext = `${SITE}code.html?family=${family[1]}`;
  const symbol = node.symbol || String(node.label || '').split(/[ (]/)[0];
  if ((node.type === 'element' || node.type === 'constant' || node.type === 'block') && symbols.has(symbol)) {
    ext = `${SITE}table.html?block=${encodeURIComponent(symbol)}`;
  }
  if (node.type === 'repo' || node.type === 'repository') {
    const repo = node.repo || node.label;
    if (/^(?:Ventusltd\/)?[A-Za-z0-9_.-]+$/.test(repo || '')) gh = ext = `https://github.com/${repo.startsWith('Ventusltd/') ? repo : 'Ventusltd/' + repo}`;
  }
  if (node.type === 'decay' && example) gh = ext = example;
  return { gh, ext };
}

Random

A JavaScript module in the builders folder of Stars. It is built from the rnd step (`rnd`).

storagestars / builders/random.mjs · lines 1–34 of 34 · Not reached from any entry point (candidate for review)

What it does
It loads data. Defines rnd. Uses libraries node:fs/promises, node:path. Side effects: reads or writes files.
Inputs & outputs
In: JSON file graph.json; command-line arguments. Out: JSON file graph.json.
What it achieves
THE RANDOM STAR — picks links on probability alone, no defined logic.
Why it matters
No other file in the estate was found to import it.
Application
stars · builders · JavaScript module
Uses
Node Links (import), node:fs/promises, node:path
Used by
none found
Produces
rnd
Defines here
rnd
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc builders/random.mjs:1-34 · blob 853ea451814f8c0329c0ab6a281fecfcac672946 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem · domain stage: unknown · users: none · canonical: unreached_review
// THE RANDOM STAR — picks links on probability alone, no defined logic. It takes every node the
// other stars have drawn and joins pairs at random, with a random kind. Nothing here is a
// finding; it is serendipity, offered to Claude + VIK-AI in case an accident is an insight.
// Seeded by the date, so today's randomness can be reproduced tomorrow (a star with a seed).
//
//   node random.mjs [n]  → star-maker/random/graph.json, RANDOM.md
import { readFile, writeFile, mkdir } from 'node:fs/promises';
import path from 'node:path';
import { nodeLinks } from './node-links.mjs';
const SKY = process.env.SKY_DIR || 'C:/Users/vikra/Documents/GitHub/star-maker';
const OUT = path.join(SKY, 'random'); await mkdir(OUT, { recursive: true });
const N = Number(process.argv[2] || 150);
const seedStr = new Date().toISOString().slice(0, 10);
let s = [...seedStr].reduce((h, c) => (h * 31 + c.charCodeAt(0)) >>> 0, 7) || 1;
const rnd = () => { s ^= s << 13; s >>>= 0; s ^= s >> 17; s ^= s << 5; s >>>= 0; return s / 4294967296; };   // xorshift32
const pool = [];
for (const g of ['soul', 'electron', 'chemistry', 'vedic', 'magnetar']) { try { for (const n of JSON.parse(await readFile(path.join(SKY, g, 'graph.json'), 'utf8')).nodes) pool.push({ ...n, star: g }); } catch {} }
const KINDS = ['MIGHT_TOUCH', 'RHYMES_WITH', 'COULD_REPLACE', 'REMINDS_OF', 'WHAT_IF', 'ENTANGLED_MAYBE'];
const edges = [], used = new Map();
for (let i = 0; i < N && pool.length > 1; i++) { const a = pool[Math.floor(rnd() * pool.length)], b = pool[Math.floor(rnd() * pool.length)]; if (a === b) continue; edges.push({ from: a.label, to: b.label, kind: KINDS[Math.floor(rnd() * KINDS.length)], p: Math.round(rnd() * 1000) / 1000 }); used.set(a.label, a); used.set(b.label, b); }
const nodes = [...used.values()].map(n => ({ label: n.label, type: n.star, rag: 'green', reason: `from the ${n.star} star · ${(n.reason || '').slice(0, 80)}` }));
for (const n of nodes) Object.assign(n, nodeLinks(used.get(n.label), { report: 'RANDOM' }));
await writeFile(path.join(OUT, 'graph.json'), JSON.stringify({ schema: 'random-graph.v1', label: 'The Random star', seed: seedStr, generated_utc: new Date().toISOString(), note: 'Links chosen by probability alone. Not findings. Serendipity for Claude + VIK-AI.', focus_default: nodes[0]?.label, nodes, edges }, null, 2));
const md = `# The Random star — ${edges.length} links by chance, seed \`${seedStr}\`

No logic. Pairs drawn at random from every node the other stars drew (${pool.length} in the pool), joined with a random kind and a random weight. None of it is a finding. It exists because a mind that only follows evidence never trips over anything, and sometimes tripping is how a wire is found. Regenerated with the same seed, it gives the same links; a new day, new chance.

${edges.slice(0, 40).map(e => `- ${e.from} —${e.kind} (${e.p})→ ${e.to}`).join('\n')}

## For the Spider
\`random/graph.json\` — ${nodes.length} nodes, ${edges.length} edges. Fly it when you want to get lost on purpose.
`;
await writeFile(path.join(SKY, 'RANDOM.md'), md);
console.log(`random: ${edges.length} links from ${pool.length} nodes, seed ${seedStr}`);

VEDIC

A JavaScript module in the builders folder of Stars that reads table, summary and classes, using haversine. It is built from the class of helper (`classOf`).

storagestars / builders/vedic.mjs · lines 1–57 of 57 · Not reached from any entry point (candidate for review) · pattern classOf (shared by 12 files)

What it does
It loads table, summary and classes. Defines classOf. Uses libraries node:fs/promises, node:path, node:fs. Side effects: reads or writes files; uses storage (browser storage, DuckDB or Parquet).
Why it exists in the grid workflow
Domain stage agent_infra (path word 'vedic'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
Inputs & outputs
In: JSON file table.json; JSON file atoms.json; JSON file summary.json; DuckDB queries. Out: JSON file classes.json; JSON file graph.json.
What it achieves
THE CLASSIFICATION STAR. Every element and every function family is sorted into one of five classes by what it does: Structure (shells, manifests, contracts, registries), Movement (links, events, routes), Computation (engines, calculations), Flow (streams, feeds, fetches) and Data (layers.
Why it matters
No other file in the estate was found to import it.
Application
stars · builders · JavaScript module
Uses
Node Links (import), node:fs/promises, node:path, node:fs
Used by
none found
Produces
classOf
Defines here
classOf
Cannot conclude
Whether this code runs, is used by a live app today, or is correct. This is a static reading.
Evidence
stars@030ebc202d35959fecd162327892f671d1d9a0cc builders/vedic.mjs:1-57 · blob 2b7b54eccf47b595fa046bcfaca4ce267aca4fa3 · GitHub at these lines
State
achieves: comment · context: readme_derived · stage: output · effects: filesystem, storage · domain stage: agent_infra · users: ai_agent · canonical: unreached_review
// THE CLASSIFICATION STAR. Every element and every function family is sorted into one of five classes by
// what it does: Structure (shells, manifests, contracts, registries), Movement (links, events, routes),
// Computation (engines, calculations), Flow (streams, feeds, fetches) and Data (layers, files, records).
// Then two checks: what is never used and could be removed without loss; and whether every recorded test
// loaded the map's parts in the declared order. No model.
//
//   node vedic.mjs  → <sky>/vedic/{classes.json, graph.json}, CLASSIFICATION.md   (folder name kept for continuity)
import { readFile, writeFile, mkdir } from 'node:fs/promises';
import path from 'node:path';
import { nodeLinks } from './node-links.mjs';
const SKY = process.env.SKY_DIR || 'C:/Users/vikra/Documents/GitHub/star-maker';
const OUT = path.join(SKY, 'vedic'); await mkdir(OUT, { recursive: true });
const table = JSON.parse(await readFile(path.join(SKY, 'elements', 'table.json'), 'utf8')).elements;
const atoms = JSON.parse(await readFile(path.join(SKY, 'electron', 'atoms.json'), 'utf8'));
const summary = JSON.parse(await readFile(path.join(SKY, 'soul', 'summary.json'), 'utf8'));
const CLASSES = [
  ['Structure',   /shell|manifest|contract|registry|schema|composition|current|loader|kernel/i, 'what holds everything in place: shells, manifests, contracts, registries'],
  ['Movement',    /deeplink|deep-link|link|event|dispatch|message|emit|route|flyto|arrival|search|gazetteer/i, 'what moves between parts: links, events, routes, arrivals'],
  ['Computation', /engine|calc|compute|distance|fault|rating|power|flow|topology|estimate|demand|capacity|economics|drop|factor|envelope|geodesy|haversine|area|shape/i, 'what transforms: engines, calculations, the maths'],
  ['Flow',        /stream|parquet|bridge|fetch|duckdb|feed|pipeline|flow|sync|crawl|survey/i, 'data on the move: streams, feeds, fetches, crawls'],
  ['Data',        /layer|geojson|data|substation|grid_|railway|airport|datacentre|plant|offtaker|csv|json|file|store/i, 'data at rest: layers, files, substations, circuits'],
];
const classOf = s => (CLASSES.find(([, rx]) => rx.test(s)) || ['Data'])[0];
const forms = [...table.map(e => ({ kind: 'element', name: e.symbol + ' ' + e.name, cls: classOf(e.name + ' ' + e.family), state: e.state })),
               ...atoms.top.map(a => ({ kind: 'function', name: `#${a.number} ${a.name}`, cls: classOf(a.name), class: a.class, spin: a.spin }))];
const counts = Object.fromEntries(CLASSES.map(([c]) => [c, forms.filter(f => f.cls === c).length]));
// Never used: not stated, not called, not tested.
const unused = atoms.top.filter(a => a.class === 'inert-unused' || (a.spin === 'unpaired' && a.valence === 0 && !a.purpose)).slice(0, 60);
// Declared order: the loaded order must follow the live order.
let kept = 0, broke = 0; const live = ['streaming-parquet-bridge', 'uk-gazetteer-flyto', 'substation-intelligence', 'sld-sandbox'];
try { const { readdirSync } = await import('node:fs'); for (const f of readdirSync(path.join(SKY, 'stars')).slice(0, 4000)) { const s = JSON.parse(await readFile(path.join(SKY, 'stars', f), 'utf8')); const idx = (s.loaded || []).map(id => live.indexOf(id)); (idx.every((v, i) => i === 0 || v > idx[i - 1]) ? kept++ : broke++); } } catch {}
await writeFile(path.join(OUT, 'classes.json'), JSON.stringify({ generated_utc: new Date().toISOString(), counts, forms: forms.slice(0, 800), unused, declared_order: { kept, broke } }, null, 2));
const nodes = CLASSES.map(([c, , meaning]) => ({ label: c, type: 'class', rag: 'green', reason: `${meaning} · ${counts[c]} forms` }));
const edges = [];
for (const f of forms.slice(0, 300)) { nodes.push({ label: f.name, type: f.kind, rag: f.state === 'UNSETTLED' || f.class === 'inert-unused' ? 'amber' : 'green', reason: `${f.kind} · ${f.cls}` }); edges.push({ from: f.cls, to: f.name, kind: 'IS_MADE_OF' }); }
for (const n of nodes) Object.assign(n, nodeLinks(n, { report: 'CLASSIFICATION', symbols: new Set(table.map(e => e.symbol)) }));
await writeFile(path.join(OUT, 'graph.json'), JSON.stringify({ schema: 'classification-graph.v1', label: 'The Classification star', generated_utc: new Date().toISOString(), note: 'Five classes and the forms in each; unused forms and the declared-order check are in the report.', focus_default: 'Computation', nodes, edges }, null, 2));
const md = `# The Classification star

Every version belongs to its family: ${summary.souls.toLocaleString()} function families behind ${summary.incarnations.toLocaleString()} versions. Below, the forms sorted into five classes, what is never used, and whether the declared order held. Updated ${new Date().toISOString()}. No model.

## Five classes: what does each form do?
| class | meaning here | forms |
|---|---|---|
${CLASSES.map(([c, , meaning]) => `| **${c}** | ${meaning} | ${counts[c]} |`).join('\n')}

## Never used: not stated, not called, not tested; could be removed without loss
${unused.slice(0, 40).map(a => `- **#${a.number} ${a.name}** · ${a.lines} lines · home ${a.homes.join('/')} · ${a.class}`).join('\n') || '- nothing: everything is held by something'}

## Declared order: did it hold?
Of ${kept + broke} tests read, **${kept}** loaded the map's parts in the declared order and **${broke}** did not.${broke ? ' A test that broke the order is a finding.' : ' The loader keeps the order; the faults are in the parts, not the order.'}

## For the Spider
\`vedic/graph.json\` — ${nodes.length} nodes, ${edges.length} IS_MADE_OF edges: open a class to see the forms in it.
`;
await writeFile(path.join(SKY, 'CLASSIFICATION.md'), md);
console.log(`classification: ${Object.entries(counts).map(([c, n]) => `${c} ${n}`).join(' · ')} · unused ${unused.length} · order ${kept}/${kept + broke}`);