In this section
- Twin Register energy-data · kuiper-belt / tools/twin_register.mjs lines 1–106
- Wafer Topup storage · kuiper-belt / tools/wafer_topup.py lines 1–247
- What Is Kuiper render · kuiper-belt / what-is-kuiper.html lines 1–206
- Geometry Test test · kuiper-drawing-engine / tests/geometry.test.mjs lines 1–25
- Site Test test · kuiper-drawing-engine / tests/site.test.mjs lines 1–11
- Test Public Bundle test · kuiper-drawing-engine / tests/test_public_bundle.py lines 1–29
- Audit Estate storage · kuiper-drawing-engine / tools/audit_estate.py lines 1–73
Twin Register
A JavaScript module in the tools folder of Kuiper Belt that reads entangle, using SHA-256. It is built from the latest twins helper (`latestTwins`).
energy-datakuiper-belt / tools/twin_register.mjs · lines 1–106 of 106 · Entry point
- What it does
- It loads entangle. Defines arg, latestTwins. Uses libraries node:crypto, node:fs, node:path. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file entangle.json; command-line arguments.
- Downstream impact
- It is itself an entry point (JavaScript module); no other file was found loading it.
- What it achieves
- Defines `arg` and `latestTwins`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- kuiper-belt · tools · JavaScript module
- Uses
- node:crypto, node:fs, node:path
- Used by
- none found
- Produces
- arg, latestTwins
- Defines here
- arg, latestTwins
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 tools/twin_register.mjs:1-106 · blob 2c4fb1441b18ef61aff870ebdb3087cba4ca3df4 · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
#!/usr/bin/env node
// tools/twin_register.mjs
// Join the repository level host verdicts to the key level twins, so every key knows
// which universes it exists in.
//
// node tools/twin_register.mjs [--twins data/twins-<run>.json] [--entangle <path to entangle.json>]
//
// No per key network work and no per key hashing. A commit SHA is a Merkle root over the
// tree, so one matching commit certifies every key inside it. Keys inherit the certification
// of the tree that contains them. Comparing them individually would be a check that cannot
// fail, and a check that cannot fail examines nothing.
import { createHash } from 'node:crypto';
import { readFileSync, writeFileSync, readdirSync, mkdirSync, existsSync } from 'node:fs';
import { join } from 'node:path';
const argv = process.argv.slice(2);
const arg = (k, d) => { const i = argv.indexOf(k); return i < 0 ? d : argv[i + 1]; };
const latestTwins = () => {
if (!existsSync('data')) return null;
const f = readdirSync('data').filter(n => /^twins-.*\.json$/.test(n)).sort();
return f.length ? join('data', f[f.length - 1]) : null;
};
const TWINS = arg('--twins', latestTwins());
const ENTANGLE = arg('--entangle', 'C:/Users/vikra/Documents/GitHub/star-electron-star/entangle.json');
if (!TWINS || !existsSync(TWINS)) { console.error('FAIL: no twins record. Run entangle_hosts.mjs first.'); process.exit(1); }
if (!existsSync(ENTANGLE)) { console.error(`FAIL: no entangle.json at ${ENTANGLE}`); process.exit(1); }
const twins = JSON.parse(readFileSync(TWINS, 'utf8'));
const ent = JSON.parse(readFileSync(ENTANGLE, 'utf8'));
const perRepo = ent.per_repo || {};
if (Object.keys(perRepo).length === 0) { console.error('FAIL: entangle.json carries no per_repo. Refusing.'); process.exit(1); }
// The key index names repositories as "<owner>/<name>". The twin record names them "<name>".
const byName = new Map();
for (const [full, v] of Object.entries(perRepo)) byName.set(full.split('/').pop().toLowerCase(), { full, ...v });
const rows = [];
let certified = 0, suspect = 0, uncertified = 0, orphanKeys = 0;
for (const b of twins.bodies) {
const k = byName.get(b.body.toLowerCase());
const keys = k ? (k.resolved ?? k.keys ?? 0) : 0;
// A key is only as entangled as the tree that carries it.
let state;
if (!k) state = 'NO KEYS';
else if (b.verdict === 'HONOURED') { state = 'CERTIFIED'; certified += keys; }
else if (b.verdict === 'OVERREACHED') { state = 'SUSPECT'; suspect += keys; } // pink, per the protocol
else { state = 'UNCERTIFIED'; uncertified += keys; }
rows.push({
body: b.body,
keys,
key_source: k ? k.full : null,
state,
verdict: b.verdict,
commit: b.github?.commit ?? null,
tree: b.github?.tree ?? null,
hosts: [b.github ? 'github' : null, b.gitlab ? 'gitlab' : null].filter(Boolean),
observed_at: b.github?.observed_at ?? twins.rules?.asof ?? null,
});
}
// Keys whose repository was not observed at all are named, never merely counted.
const observed = new Set(twins.bodies.map(b => b.body.toLowerCase()));
const missing = [...byName.entries()].filter(([n]) => !observed.has(n)).map(([, v]) => v.full);
for (const m of missing) orphanKeys += (byName.get(m.split('/').pop().toLowerCase()).resolved ?? 0);
const total = ent.keys ?? (certified + suspect + uncertified + orphanKeys);
const register = {
schema: 'twin-register-v1',
run: twins.run,
law: 'Keys inherit the host certification of the tree that contains them. One commit SHA certifies every key inside it.',
rules: { ...twins.rules, key_index: ENTANGLE, key_index_generated: ent.generated_utc ?? null },
totals: { keys_in_index: total, certified, suspect, uncertified, in_repos_not_observed: orphanKeys },
repositories_with_keys_not_observed: missing.sort(),
bodies: rows.sort((a, b) => b.keys - a.keys),
};
const json = JSON.stringify(register, null, 1);
mkdirSync('data', { recursive: true }); mkdirSync('proof', { recursive: true });
writeFileSync(join('data', `register-${twins.run}.json`), json);
const digest = createHash('sha256').update(json).digest('hex');
writeFileSync(join('proof', `${twins.run}-register.json`), JSON.stringify({
run: twins.run, digest, totals: register.totals,
command: 'node tools/twin_register.mjs ' + argv.join(' '),
}, null, 1));
const pct = total ? ((certified / total) * 100).toFixed(2) : '0.00';
console.log(`key index ${ENTANGLE}`);
console.log(`generated ${ent.generated_utc ?? 'unstated'}`);
console.log(`keys ${total}`);
console.log(`CERTIFIED ${certified} (${pct}% present and identical in both universes)`);
console.log(`SUSPECT ${suspect} (repository diverged between hosts; draw pink)`);
console.log(`UNCERTIFIED ${uncertified} (one host only, so far)`);
if (missing.length) console.log(`repositories with keys but no observation: ${missing.join(', ')}`);
console.log(`\nregister digest ${digest}`);
// Below 95 per cent the protocol refuses to write a claim of entanglement.
if (total && certified / total < 0.95) {
console.log('\nBELOW THRESHOLD: under 95 per cent certified. This is a report, not a claim of entanglement.');
process.exit(1);
}Wafer Topup
A Python command-line tool in the tools folder of Kuiper Belt that fetches wafer meta from GitHub API.
storagekuiper-belt / tools/wafer_topup.py · lines 1–247 of 247 · Entry point · pattern public_repos (shared by 3 files)
- What it does
- It fetches wafer meta. Defines 7 functions or classes, including public_repos, git, mirror, count_blobs, feed. Uses libraries io, json, os, subprocess, sys. Side effects: reads or writes files; makes network requests; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: data source: GitHub API; JSON file wafer-meta.json; command-line arguments. Out: JSON file.
- Downstream impact
- Used directly by 2 files: What Is Kuiper (kuiper-belt, https://ventusltd.github.io/kuiper-belt/what-is-kuiper.html); Engine Workflow (kuiper-belt). Reached from 7 other entry points, including Lesson (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html); Menu (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html); Modes (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/modes.html).
- What it achieves
- It counts blobs (`count_blobs`) and is built from the public repos helper (`public_repos`) and the git step (`git`). The wafer grows by itself: every public commit since the rim, appended.
- Why it matters
- Loaded by the What Is Kuiper page at https://ventusltd.github.io/kuiper-belt/what-is-kuiper.html. Run by Engine Workflow.
- Application
- kuiper-belt · tools · Python CLI
- Uses
- Check Proof (import), io, json, os, subprocess, sys, threading, time, urllib.request
- Used by
- linked from What Is Kuiper (link), run by Engine Workflow (workflow run)
- Produces
- public_repos, git, mirror, count_blobs, new_commits, main
- Defines here
- public_repos, git, mirror, count_blobs, feed, new_commits, main
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 tools/wafer_topup.py:1-247 · blob a06efc9a41b5e9dc9dfc0f9e3d57a684b2e0f002 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
#!/usr/bin/env python3
r"""tools/wafer_topup.py - the wafer grows by itself: every public commit since the rim, appended.
python tools/wafer_topup.py [--dry-run]
wafer_keys.py issued the first 37,929,255,811 keys from a measurement frozen on 19 Sept 2026. This
tool is run by .github/workflows/engine.yml after every harvest and adds what has been written
since, by the same rule and the same law:
issued keys one per line in every file in every commit (binary blobs, NUL in the first
8,000 bytes, have no lines; a last line with no newline still counts)
unissued keys GAP_KEYS_PER_SECOND x seconds since the commit before, capped at CAP_SECONDS,
imported from wafer_keys.py so the constants cannot drift apart
It asks GitHub which repositories of the account are PUBLIC, keeps a shallow bare mirror of each
(in the runner's temp on GitHub, in .local/ here), and takes every commit on every branch with a
commit time after wafer-meta.json last_unix and no later than the moment the run began. Commits
with no lines are left out, as wafer_keys.py leaves them out. The rest are appended to
cosmos/wafer.tsv in time order, new repositories are appended to cosmos/repos.tsv with the next
index, and cosmos/wafer-meta.json is rewritten from the rows themselves.
APPEND ONLY. Nothing already issued moves: every new commit lands beyond the rim. The price is
that a commit pushed after a later run, bearing an older time, stays outside the wafer; it would
need an address that is already taken. Re-running wafer_keys.py rebuilds from belt.tsv and the
commit shards, which this tool does not extend, so it would drop everything appended here.
SAFEGUARDS. Run twice with nothing new, it writes nothing. It refuses and writes nothing if more
than a fifth of the repositories cannot be read, if one that cannot be read was pushed since the
rim (its commits would be lost for good), if the sums would not agree as ci_check.py K2 requires,
or if a name that is not public would be written.
"""
import io
import json
import os
import subprocess
import sys
import threading
import time
import urllib.request
from datetime import datetime, timezone
HERE = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.join(HERE, '..')
COSMOS = os.path.join(ROOT, 'cosmos')
sys.path.insert(0, HERE)
from check_proof import leaks
from wafer_keys import GAP_KEYS_PER_SECOND, CAP_SECONDS, rows
LAW = 'r = sqrt(key), theta = 2 pi frac(key x 2654435769 / 2^32)'
OWNER = 'Ventusltd'
MARGIN = 86400 # mirrors reach a day behind the rim, so no boundary is missed
def public_repos():
"""Every PUBLIC repository of the account, empty-looking ones included: GitHub reports a size
of 0 for a small new repository, so harvest.py's size filter would drop real commits here."""
out, page = [], 1
while True:
req = urllib.request.Request('https://api.github.com/users/%s/repos?type=owner&per_page=100&page=%d'
% (OWNER, page), headers={'Accept': 'application/vnd.github+json',
'User-Agent': 'kuiper-topup'})
if os.environ.get('GITHUB_TOKEN'):
req.add_header('Authorization', 'Bearer ' + os.environ['GITHUB_TOKEN'])
got = json.load(urllib.request.urlopen(req, timeout=60))
if not got:
break
out += [r for r in got if not r.get('private') and r.get('visibility', 'public') == 'public']
page += 1
return sorted(out, key=lambda r: r['name'].lower())
def git(d, *args):
r = subprocess.run(['git'] + list(args), cwd=d, capture_output=True, timeout=1800)
if r.returncode:
raise RuntimeError(r.stderr.decode('utf-8', 'replace').strip()[:300])
return r.stdout.decode('utf-8', 'replace')
def mirror(name, cache, since):
"""A bare mirror of every branch, shallow from `since`. None if nothing was written since."""
d = os.path.join(cache, name + '.git')
date = datetime.fromtimestamp(since, timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ')
try:
if os.path.isdir(d):
git(d, 'fetch', '-q', '--prune', '--shallow-since=' + date, 'origin', '+refs/heads/*:refs/heads/*')
else:
git(cache, 'clone', '-q', '--bare', '--no-single-branch', '--shallow-since=' + date,
'https://github.com/%s/%s.git' % (OWNER, name), d)
except RuntimeError as e:
if 'no commits selected' in str(e) or 'processing shallow info' in str(e):
return None # nothing since: nothing to add
raise
return d
def count_blobs(d, shas, cache):
"""Stream one git cat-file --batch pass; cache[sha] = lines, or 0 for a binary blob."""
if not shas:
return
p = subprocess.Popen(['git', 'cat-file', '--batch'], cwd=d, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
def feed():
p.stdin.write(('\n'.join(shas) + '\n').encode())
p.stdin.close()
threading.Thread(target=feed, daemon=True).start()
for _ in shas:
hdr = p.stdout.readline().split()
if len(hdr) < 3 or hdr[1] == b'missing':
raise RuntimeError('cat-file could not read %s' % (hdr[0].decode() if hdr else '?'))
size, left, head, n, last = int(hdr[2]), int(hdr[2]), b'', 0, b'\n'
while left:
chunk = p.stdout.read(min(left, 1 << 20))
if not chunk:
raise RuntimeError('cat-file ended early')
if len(head) < 8000:
head += chunk[:8000 - len(head)]
n += chunk.count(b'\n')
last, left = chunk[-1:], left - len(chunk)
p.stdout.read(1) # the newline after each object
binary = b'\x00' in head
cache[hdr[0].decode()] = 0 if binary else n + (1 if size and last != b'\n' else 0)
p.wait()
def new_commits(d, after, until, cache):
"""(unix, lines, sha) for every commit on any branch with after < commit time <= until."""
out = []
for line in git(d, 'log', '--branches', '--format=%H %ct').split('\n'):
if not line.strip():
continue
sha, ct = line.split()
if not after < int(ct) <= until:
continue
blobs = []
for t in git(d, 'ls-tree', '-r', sha).split('\n'):
p = t.split(None, 3)
if len(p) == 4 and p[1] == 'blob':
blobs.append(p[2])
count_blobs(d, sorted(set(b for b in blobs if b not in cache)), cache)
out.append((int(ct), sum(cache[b] for b in blobs), sha))
return out
def main():
dry = '--dry-run' in sys.argv[1:]
started = int(time.time())
wafer = rows(os.path.join(COSMOS, 'wafer.tsv'))
repos = rows(os.path.join(COSMOS, 'repos.tsv'))
meta = json.load(io.open(os.path.join(COSMOS, 'wafer-meta.json'), encoding='utf-8'))
rim = meta['last_unix']
if int(wafer[-1][0]) != rim:
print('REFUSED: wafer.tsv ends at %s, wafer-meta.json says %d' % (wafer[-1][0], rim))
return 2
index = {n.lower(): int(i) for i, n, _ in repos}
seen = set((int(r[2]), r[3]) for r in wafer)
cache_dir = os.path.join(os.environ['RUNNER_TEMP'], 'topup') if os.environ.get('RUNNER_TEMP') \
else os.path.join(ROOT, '.local', 'topup-mirrors')
os.makedirs(cache_dir, exist_ok=True)
listed = public_repos()
found, missed, blob_lines = [], [], {}
for r in listed:
name, pushed = r['name'], started
try:
pushed = int(datetime.strptime(r.get('pushed_at') or '1970-01-01T00:00:00Z',
'%Y-%m-%dT%H:%M:%SZ').replace(tzinfo=timezone.utc).timestamp())
d = mirror(name, cache_dir, rim - MARGIN) if pushed > rim else None
got = new_commits(d, rim, started, blob_lines) if d else []
except Exception as e:
print(' missed %-40s %s' % (name, str(e)[:120]), file=sys.stderr)
missed.append((name, pushed))
continue
if len(blob_lines) > 2_000_000:
blob_lines.clear() # a blob is the same in every repository
got = [c for c in got if c[1] > 0]
if got:
print(' %-44s %5d commits %16s keys' % (name, len(got), format(sum(c[1] for c in got), ',')),
file=sys.stderr, flush=True)
found.append((name, got))
print('%d public repositories, %d read, %d missed' % (len(listed), len(found), len(missed)))
if not found or len(missed) * 5 > len(listed):
print('REFUSED: too many missed to call this a measurement; nothing written')
return 1
late = [n for n, p in missed if p > rim]
if late:
print('REFUSED: %d unread repositories were pushed since the rim; nothing written' % len(late))
return 1
names = [n for _, n, _ in repos]
totals = [int(l) for _, _, l in repos]
add = []
for name, got in found:
if not got:
continue
i = index.get(name.lower())
if i is None:
i = index[name.lower()] = len(names)
names.append(name)
totals.append(0)
for unix, n, sha in got:
if (i, sha[:12]) not in seen:
add.append((unix, n, i, sha[:12]))
totals[i] += n
if not add:
print('nothing new since %s: nothing written' % datetime.fromtimestamp(rim, timezone.utc).isoformat())
return 0
add.sort(key=lambda c: (c[0], c[2], c[3])) # time, then the same tiebreak as wafer_keys
prev, lines = rim, []
for unix, n, i, sha in add:
gap = GAP_KEYS_PER_SECOND * min(max(unix - prev, 0), CAP_SECONDS)
lines.append('%d\t%d\t%d\t%s\t%d' % (unix, n, i, sha, gap))
prev = unix
allrows = wafer + [l.split('\t') for l in lines]
issued = sum(int(r[1]) for r in allrows)
unissued = sum(int(r[4]) for r in allrows)
new_meta = {'issued_keys': issued, 'unissued_keys': unissued, 'address_space': issued + unissued,
'silence_share': round(unissued / (issued + unissued), 4), 'commits': len(allrows),
'repositories': len(names), 'first_unix': int(allrows[0][0]), 'last_unix': int(allrows[-1][0]),
'gap_keys_per_second': GAP_KEYS_PER_SECOND, 'cap_seconds': CAP_SECONDS, 'law': LAW}
if not (issued == sum(totals) == meta['issued_keys'] + sum(c[1] for c in add)
and unissued == meta['unissued_keys'] + sum(int(l.split('\t')[4]) for l in lines)):
print('REFUSED: the sums would not agree (K2); nothing written')
return 2
repos_text = '# repo_index\tname\tlines\n' + ''.join('%d\t%s\t%d\n' % (i, n, l)
for i, (n, l) in enumerate(zip(names, totals)))
if leaks(repos_text) or leaks('\n'.join(lines)):
print('REFUSED (L6): a name that is not public is in the result; nothing written')
return 2
print('added %d commits, %s keys, %d new repositories; issued keys now %s'
% (len(add), format(sum(c[1] for c in add), ','), len(names) - len(repos), format(issued, ',')))
if dry:
print('dry run: nothing written')
return 0
with io.open(os.path.join(COSMOS, 'wafer.tsv'), 'a', encoding='utf-8', newline='\n') as f:
f.write('\n'.join(lines) + '\n')
with io.open(os.path.join(COSMOS, 'repos.tsv'), 'w', encoding='utf-8', newline='\n') as f:
f.write(repos_text)
with io.open(os.path.join(COSMOS, 'wafer-meta.json'), 'w', encoding='utf-8', newline='\n') as f:
json.dump(new_meta, f, indent=1)
print(json.dumps(new_meta, indent=1))
return 0
if __name__ == '__main__':
sys.exit(main())What Is Kuiper
A web page in Kuiper Belt that draws wafer meta. Published at https://ventusltd.github.io/kuiper-belt/what-is-kuiper.html. It is built from the attempt step (`attempt`).
renderkuiper-belt / what-is-kuiper.html · lines 1–206 of 206 · Entry point · pattern attempt (shared by 7 files)
- What it does
- It draws wafer meta. Defines attempt. Side effects: changes the web page (DOM); makes network requests.
- Why it exists in the grid workflow
- Domain stage agent_infra (path word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file wafer-meta.json. Out: web page; canvas drawing.
- Downstream impact
- Used directly by 1 file: Start Here (kuiper-belt). Reached from 6 other entry points, including Lesson (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/lesson.html); Menu (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050354/menu.html); Modes (kuiper-belt, https://ventusltd.github.io/kuiper-belt/learn-the-kuiper/202610050609/modes.html). It is itself an entry point, published at https://ventusltd.github.io/kuiper-belt/what-is-kuiper.html.
- What it achieves
- A plain-English explanation of the Kuiper: why Ventus Ltd built it for globalgrid2050.com, how Keys become deterministic positions, and how the code estate can become a procedural computational engine. It reads `cosmos/wafer-meta.json`. It responds to load events.
- Why it matters
- Imported by Start Here.
- Application
- kuiper-belt · / · page
- Uses
- Kuiper Belt — Index Page (iframe), Count Lines (link), Wafer Keys (link), Wafer Topup (link)
- Used by
- named by URL in Start Here (estate URL)
- Produces
- attempt
- Defines here
- attempt
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-belt@26fba12ab1b5bab8e71934ab86c58273e5f32682 what-is-kuiper.html:1-206 · blob bfef1e362ee09d19ed3138b441a4ca5845f9dddb · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: dom, network · 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">
<title>What is the Kuiper? — GlobalGrid2050</title>
<meta name="description" content="A plain-English explanation of the Kuiper: why Ventus Ltd built it for globalgrid2050.com, how Keys become deterministic positions, and how the code estate can become a procedural computational engine.">
<style>
:root{color-scheme:dark;--bg:#000;--ink:#fff;--muted:#aaa;--line:#2a2a2a;--blue:#66ccff;--cyan:#00ffff;--amber:#ffb000;--green:#22ee77}
*{box-sizing:border-box}
html{background:var(--bg)}
body{margin:0;background:var(--bg);color:var(--ink);font:15px/1.65 ui-monospace,SFMono-Regular,Consolas,monospace}
a{color:var(--blue);text-underline-offset:5px}
a:hover{color:var(--cyan)}
a:focus-visible{outline:2px solid var(--cyan);outline-offset:4px}
.wrap{max-width:1040px;margin:0 auto;padding:0 28px}
.topline{border-bottom:1px solid var(--line);border-top:1px solid var(--line);overflow:hidden;white-space:nowrap}
.ticker{display:flex;gap:42px;width:max-content;padding:9px 0;font-size:11px;letter-spacing:.07em;text-transform:uppercase;color:var(--muted)}
.ticker b{color:var(--cyan);font-weight:500}
header{padding:46px 0 30px;border-bottom:1px solid var(--line)}
.brand{margin:0 0 22px;color:var(--blue);font-size:13px;letter-spacing:.16em}
h1{margin:0;font-size:clamp(38px,7vw,78px);line-height:.98;letter-spacing:-.055em;font-weight:500}
.deck{max-width:780px;margin:24px 0 0;color:#d6d6d6;font-size:clamp(17px,2.5vw,23px);line-height:1.5}
.art{padding:30px 0;border-bottom:1px solid var(--line)}
.art-head{display:flex;justify-content:space-between;gap:20px;align-items:baseline;margin-bottom:10px;color:var(--muted);font-size:11px;text-transform:uppercase;letter-spacing:.08em}
.screen{position:relative;aspect-ratio:16/9;overflow:hidden;border:1px solid #12414a;background:#090c13}
.screen iframe,.screen canvas{position:absolute;inset:0;width:100%;height:100%;border:0;display:block}
.screen iframe{pointer-events:none}
.screen canvas{display:none;background:#090c13}
.screen.captured iframe{visibility:hidden}
.screen.captured canvas{display:block}
.screen-link{position:absolute;inset:0;z-index:4;display:flex;align-items:flex-end;justify-content:flex-end;padding:16px;text-decoration:none;background:linear-gradient(180deg,transparent 60%,rgba(0,0,0,.72))}
.screen-link span{border:1px solid #12414a;background:#000d;padding:9px 12px;color:var(--cyan);font-size:12px}
.caption{margin:10px 0 0;color:var(--muted);font-size:12px}
main{padding:8px 0 60px}
section.block{padding:32px 0;border-bottom:1px solid var(--line)}
.kicker{color:var(--cyan);font-size:11px;letter-spacing:.1em;text-transform:uppercase;margin-bottom:10px}
h2{font-size:clamp(24px,4vw,38px);font-weight:500;line-height:1.15;letter-spacing:-.025em;margin:0 0 18px}
p{max-width:900px;margin:0 0 18px;color:#d3d3d3}
.law{border:1px solid #12414a;padding:24px;margin:12px 0 22px;background:#030609}
.law .formula{font-size:clamp(30px,6vw,64px);line-height:1;color:var(--cyan);letter-spacing:-.04em;margin-bottom:14px}
.law .function{color:var(--ink);font-size:14px}
.grid{display:grid;grid-template-columns:170px 1fr;border-top:1px solid var(--line);margin-top:24px}
.grid dt,.grid dd{margin:0;padding:13px 0;border-bottom:1px solid var(--line)}
.grid dt{color:var(--muted);font-size:12px;text-transform:uppercase;letter-spacing:.08em}
.grid dd{color:#ddd}
code{color:#c6f7ff;font-family:inherit}
.callout{border-left:2px solid var(--amber);padding:2px 0 2px 18px;margin:22px 0;color:#f1d6a5}
.links{display:flex;flex-wrap:wrap;gap:9px 20px}
.links a{font-size:13px}
footer{padding:26px 0 42px;color:var(--muted);font-size:11px}
@media(max-width:650px){
.wrap{padding:0 20px}
header{padding-top:30px}
.grid{grid-template-columns:1fr}
.grid dt{padding-bottom:0;border-bottom:0}
.grid dd{padding-top:5px}
.art-head{display:block}
.art-head span{display:block;margin-top:5px}
}
</style>
</head>
<body>
<div class="topline">
<div class="wrap">
<div class="ticker" aria-label="Live Kuiper measurements">
<span>KUIPER / LIVE</span>
<span>ISSUED KEYS <b id="issued">loading</b></span>
<span>ADDRESS SPACE <b id="space">loading</b></span>
<span>COMMITS <b id="commits">loading</b></span>
<span>REPOSITORIES <b id="repos">loading</b></span>
<span>LAST MEASURED <b id="measured">loading</b></span>
</div>
</div>
</div>
<div class="wrap">
<header>
<p class="brand">GLOBALGRID2050 / VENTUS LTD / KUIPER</p>
<h1>What is the Kuiper?</h1>
<p class="deck">Kuiper began as a way to see an expanding estate of code on one dashboard. The solution was to stop treating the estate as a pile of files and give its measured history a deterministic mathematical address space.</p>
</header>
<section class="art" aria-label="Kuiper page art">
<div class="art-head">LIVE KUIPER VIEW <span>the page captures the actual Kuiper canvas when the browser allows it</span></div>
<div class="screen" id="screen">
<iframe id="kuiperFrame" src="./" title="Live Kuiper view"></iframe>
<canvas id="kuiperShot" width="1600" height="900" aria-hidden="true"></canvas>
<a class="screen-link" href="./" target="_blank" rel="noopener"><span>OPEN THE ACTUAL KUIPER →</span></a>
</div>
<p class="caption">This art is sourced from the Kuiper itself, not a decorative illustration. If a same-origin canvas capture is available it becomes a frozen live snapshot; otherwise the embedded live view remains visible.</p>
</section>
<main>
<section class="block">
<div class="kicker">Why it exists</div>
<h2>A visibility problem became an addressing problem.</h2>
<p>globalgrid2050.com is a Ventus Ltd project that has accumulated billions of historical line occurrences across code, data and engineering work through continuous machine-learning and computational iteration. That process has combined AI development tools such as Codex and Claude, Python and CuPy GPU computation, automated CI/CD and GitHub Actions runs, repeated software testing, calibrated ha … [line shortened here: 501 characters; full line on GitHub]
<p>The resulting code estate is therefore not simply a collection of AI-generated code. It is the accumulated record of repeated human-directed computation, automation, testing and machine-assisted development over time. Kuiper emerged from a practical problem created by that scale: how do we see and organise such a large body of work on one dashboard when it is distributed across many repositor … [line shortened here: 457 characters; full line on GitHub]
</section>
<section class="block">
<div class="kicker">The Key</div>
<h2>The Key is the chronological address of a measured line occurrence.</h2>
<p>Kuiper measures historical line occurrences and gives each issued occurrence its own numerical Key. Earlier measured material receives earlier Keys and later material is appended further out. The Key is unique even when the underlying text is repeated, because Kuiper is preserving the history of iteration rather than pretending that repeated states never happened.</p>
<dl class="grid">
<dt>Measure</dt><dd><code>tools/count_lines.py</code> — its <code>entries</code> mode walks every file entry in every commit, deliberately including repeated historical occurrences.</dd>
<dt>Issue Keys</dt><dd><code>tools/wafer_keys.py</code> — converts the measured historical population into issued Keys in time order and leaves unissued address space for measured silence between commits.</dd>
<dt>Keep Growing</dt><dd><code>tools/wafer_topup.py</code> — appends later public commits beyond the existing rim so earlier issued addresses do not move.</dd>
</dl>
</section>
<section class="block">
<div class="kicker">Wafer placement law</div>
<div class="law">
<div class="formula">Radius = √Key</div>
<div class="function">Function: how Kuiper spreads the measured population across a circular map.</div>
</div>
<p>Once an occurrence has a Key, the square root of that Key determines how far from the centre it belongs. The reason is geometric: the area of a circle grows with the square of its radius. Taking the square root makes the radius grow more slowly than the population, so the available circular area grows broadly in step with the number of addresses instead of the outer addresses being pushed abs … [line shortened here: 420 characters; full line on GitHub]
<p>That is only the radial part of the placement. Kuiper then uses its angular law to decide which direction around the circle the Key belongs, allowing a deterministic coordinate to be generated from the address rather than storing a separate coordinate for every point.</p>
<div class="callout">The law stays small while the population grows. That is one of the central ideas of Kuiper.</div>
</section>
<section class="block">
<div class="kicker">From picture to engine</div>
<h2>The larger opportunity appeared after the visualisation worked.</h2>
<p>What began as a way to make the accumulated coding estate visible exposed a larger possibility: the same deterministic addressing system can organise very large volumes of distributed code, high-frequency grid data, engineering drawings and other generated information without storing a separate position for every item.</p>
<p>An address can become part of a procedural programmable engine in which information is generated, resolved, transformed or rendered when required. Billions of issued Kuiper addresses can therefore become computational locations rather than merely passive dots on a visualisation. Algorithms can operate across those addresses, compare and combine their contents, search for repeated structures, … [line shortened here: 513 characters; full line on GitHub]
<p>The wider opportunity is to turn that history into an active computational environment in which previous iterations can inform future ones. In that sense Kuiper is not merely a visualisation of the code estate: it is becoming an iteration engine for coding, grid intelligence, engineering information and potentially much more, with the foundations for a machine that can progressively learn fro … [line shortened here: 463 characters; full line on GitHub]
</section>
<section class="block">
<div class="kicker">Iteration</div>
<h2>Kuiper records change instead of hiding it.</h2>
<p>A conventional deduplicated count asks how much unique material exists now. Kuiper can ask a different question: what sequence of computational work actually happened? Repeated lines, changing files and successive commits are meaningful because they describe development over time. The historical occurrence is therefore part of the data.</p>
<p>Like the numerical methods used to calculate a square root, the system is iterative: a state is produced, measured, refined and followed by another state. Kuiper makes that accumulated iteration addressable.</p>
</section>
<section class="block">
<div class="kicker">Technical references</div>
<h2>Follow the implementation.</h2>
<div class="links">
<a href="./">Live Kuiper</a>
<a href="https://github.com/Ventusltd/kuiper-belt">Kuiper repository</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/ABOUT.md">ABOUT.md</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/MEASURED.md">MEASURED.md</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/LAWS.md">LAWS.md</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/SPEC-INFINITE.md">SPEC-INFINITE.md</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/tools/count_lines.py">count_lines.py</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/tools/wafer_keys.py">wafer_keys.py</a>
<a href="https://github.com/Ventusltd/kuiper-belt/blob/main/tools/wafer_topup.py">wafer_topup.py</a>
</div>
</section>
</main>
<footer>GLOBALGRID2050 · VENTUS LTD · OPEN ENGINEERING AND COMPUTATIONAL RESEARCH</footer>
</div>
<script>
const nf = new Intl.NumberFormat('en-GB');
fetch('cosmos/wafer-meta.json', {cache:'no-store'}).then(r => {
if(!r.ok) throw new Error('meta');
return r.json();
}).then(m => {
document.getElementById('issued').textContent = nf.format(m.issued_keys);
document.getElementById('space').textContent = nf.format(m.address_space);
document.getElementById('commits').textContent = nf.format(m.commits);
document.getElementById('repos').textContent = nf.format(m.repositories);
document.getElementById('measured').textContent = new Date(m.last_unix * 1000).toISOString().slice(0,10);
}).catch(() => {
for (const id of ['issued','space','commits','repos','measured']) document.getElementById(id).textContent = 'LIVE';
});
// Same-origin live capture: take a snapshot of the actual Kuiper WebGL canvas for page art.
// If the browser cannot capture it, the live iframe remains as the fallback.
const frame = document.getElementById('kuiperFrame');
frame.addEventListener('load', () => {
let tries = 0;
const attempt = () => {
tries++;
try {
const doc = frame.contentDocument;
const source = doc && doc.getElementById('c');
const shot = document.getElementById('kuiperShot');
if (source && source.width > 0 && source.height > 0) {
const ctx = shot.getContext('2d');
ctx.fillStyle = '#090c13';
ctx.fillRect(0,0,shot.width,shot.height);
const sw = source.width, sh = source.height;
const scale = Math.max(shot.width/sw, shot.height/sh);
const dw = sw*scale, dh = sh*scale;
ctx.drawImage(source,(shot.width-dw)/2,(shot.height-dh)/2,dw,dh);
const px = ctx.getImageData(shot.width/2|0,shot.height/2|0,1,1).data;
if (px[0] || px[1] || px[2]) {
document.getElementById('screen').classList.add('captured');
return;
}
}
} catch(e) {}
if (tries < 7) setTimeout(attempt, 1200);
};
setTimeout(attempt, 1800);
});
</script>
</body>
</html>Geometry Test
A test in the tests folder of Kuiper Drawing Engine.
testkuiper-drawing-engine / tests/geometry.test.mjs · lines 1–25 of 25 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Downstream impact
- Used directly by 1 file: Array Pages Workflow (kuiper-drawing-engine).
- What it achieves
- Its code works with 1 GW.
- Why it matters
- Run by Array Pages Workflow.
- Application
- kuiper-drawing-engine · tests · test
- Uses
- node:test
- Used by
- run by Array Pages Workflow (workflow run)
- 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
- kuiper-drawing-engine@0d322ce8edb4646f2153cf72eeac247d903301e6 tests/geometry.test.mjs:1-25 · blob 2bf26e6d5e49cde35016c9e9a6b8afd6f82a78dd · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
import test from 'node:test';import assert from 'node:assert/strict';import {defaults,array,plant,basis,validate} from '../web/geometry.mjs';
test('five portrait opposing faces and single portrait directions',()=>{assert.equal(array(defaults).modules.length,60);for(const azimuth of [0,90,180,270]){const m=array({...defaults,rows:1,columns:1,layout:'fixed',azimuth});assert.equal(m.modules.length,1);assert(Math.abs(m.rise-2.4*Math.sin(12*Math.PI/180))<1e-12);}});
test('orthonormal frame and module sizes over angular grid',()=>{for(let a=0;a<360;a+=5)for(let t=0;t<=60;t+=2){const b=basis(a,t);for(const v of Object.values(b))assert(Math.abs(Math.hypot(...v)-1)<1e-12);assert(Math.abs(b.u.reduce((s,v,i)=>s+v*b.v[i],0))<1e-12);const m=array({...defaults,rows:1,columns:1,layout:'fixed',azimuth:a,tilt:t}).modules[0];assert(Math.abs(Math.hypot(...m.corners[1].map( … [line shortened here: 443 characters; full line on GitHub]
test('opposing faces meet across ridge and retain lower height',()=>{const m=array({...defaults,columns:1});const top=m.modules.filter(x=>x.row===5);const p=top[0].corners[3],q=top[1].corners[2];assert(Math.abs(p[2]-q[2])<1e-12);assert(m.modules.every(x=>x.corners.every(p=>p[2]>=defaults.height)));});
test('1 GW string rounding and bounded geometry',()=>{const p=plant(defaults);assert(p.actualDCMW>=1000);assert(p.actualDCMW-1000<defaults.series*defaults.moduleW/1e6);assert.equal(p.modules,p.strings*30);assert(p.lastInverterStrings>=1&&p.lastInverterStrings<=24);assert(array({...defaults,rows:10,columns:60}).modules.length<=1200);});
test('invalid imported values rejected',()=>{for(const x of [{rows:0},{tilt:NaN},{rows:1.2},{unknown:'value'},{boxV:2},{moduleW:Infinity}])assert.throws(()=>validate(x));});
test('unknown boxes hidden and specified positions rotate with module orientation',()=>{
assert.equal(array(defaults).modules[0].boxes.length,0);
for(const orientation of ['portrait','landscape']){
const m=array({...defaults,rows:1,columns:1,layout:'fixed',azimuth:0,tilt:0,orientation,boxLayout:'one',boxU:.2,boxV:.8}).modules[0];
const dx=m.boxes[0][0]-m.corners[0][0],dy=m.corners[0][1]-m.boxes[0][1];
assert(Math.abs(dx-(orientation==='portrait'?defaults.moduleWidth*.2:defaults.moduleLength*.8))<1e-12);
assert(Math.abs(dy-(orientation==='portrait'?defaults.moduleLength*.8:defaults.moduleWidth*.2))<1e-12);
}
});
test('edge heights drive tilt and schematic supports without stretching modules',()=>{
const s={...defaults,heightMode:'edges',height:4,upperHeight:5};const a=array(s);const z=a.modules.flatMap(m=>m.corners.map(p=>p[2]));assert(Math.abs(Math.min(...z)-4)<1e-10);assert(Math.abs(Math.max(...z)-5)<1e-10);assert(a.structure.some(m=>m.kind==='brace'));
for(const m of a.structure.filter(m=>m.kind==='post')){assert.equal(m.points[0][2],0);assert(m.points[1][2]>=4&&m.points[1][2]<=5+1e-10);}
for(const h of [.1,20]){const f=array({...s,height:h,upperHeight:h});assert.equal(f.settings.tilt,0);assert(f.modules.every(m=>m.corners.every(p=>p[2]===h)));}
assert.throws(()=>array({...s,height:5,upperHeight:4}));assert.throws(()=>array({...s,rows:1,height:.1,upperHeight:20}));assert.throws(()=>array({...s,height:20.01,upperHeight:20.01}));
});
test('long table runs retain real module sizes',()=>{const a=array({...defaults,columns:150});assert.equal(a.modules.length,1500);assert(Math.abs(a.span-(150*defaults.moduleWidth+149*defaults.gap))<1e-9);});Site Test
A test in the tests folder of Kuiper Drawing Engine.
testkuiper-drawing-engine / tests/site.test.mjs · lines 1–11 of 11 · Entry point
- What it does
- It tests its inputs. Uses libraries node:test.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Downstream impact
- Used directly by 1 file: Array Pages Workflow (kuiper-drawing-engine).
- What it achieves
- Its code works with 1 GW.
- Why it matters
- Run by Array Pages Workflow.
- Application
- kuiper-drawing-engine · tests · test
- Uses
- node:test
- Used by
- run by Array Pages Workflow (workflow run)
- 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
- kuiper-drawing-engine@0d322ce8edb4646f2153cf72eeac247d903301e6 tests/site.test.mjs:1-11 · blob f51bbf06e67c7bca381f9c2ba4b596e013a7fc0b · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: unknown · effects: none found · domain stage: agent_infra · users: ai_agent · canonical: unknown
import test from 'node:test';import assert from 'node:assert/strict';import {defaults,plant} from '../web/geometry.mjs';import {siteModel,tableAt,validatePlacements,overlapsFor} from '../web/site.mjs';
test('every 1GW module belongs to exactly one virtual array',()=>{const s=siteModel(defaults);let count=0;for(let i=0;i<s.tables;i++)count+=tableAt(s,i).modules;assert.equal(count,plant(defaults).modules);assert(tableAt(s,s.tables-1).modules>0);assert.equal(tableAt(s,s.tables-1).modules,s.modules-(s.tables-1)*s.modulesPerTable);});
test('regular footprints do not overlap and edits round-trip',()=>{const s=siteModel(defaults);assert(s.pitch[0]>s.size[0]);assert(s.pitch[1]>s.size[1]);const e=validatePlacements([{index:10,x:100,y:200}],s);assert.deepEqual(tableAt(s,10,e),{index:10,x:100,y:200,modules:60});assert.throws(()=>validatePlacements([{index:0,x:0,y:0},{index:0,x:1,y:1}],s));assert.throws(()=>validatePlacements([{index: … [line shortened here: 426 characters; full line on GitHub]
test('overlap lookup matches exhaustive footprint checks after array moves',()=>{
const site=siteModel({...defaults,targetMW:.1}),edits={0:{x:siteModel({...defaults,targetMW:.1}).pitch[0],y:0},2:{x:-100,y:0}};
for(let i=0;i<site.tables;i++){const a=tableAt(site,i,edits),expected=[];
for(let j=0;j<site.tables;j++){if(i===j)continue;const b=tableAt(site,j,edits);if(Math.min(a.x+site.size[0],b.x+site.size[0])-Math.max(a.x,b.x)>1e-9&&Math.min(a.y+site.size[1],b.y+site.size[1])-Math.max(a.y,b.y)>1e-9)expected.push(j);}
assert.deepEqual(overlapsFor(site,i,edits).sort((a,b)=>a-b),expected);}
assert(overlapsFor(site,0,edits).includes(1));
});Test Public Bundle
A test in the tests folder of Kuiper Drawing Engine. It is built from the bundle test class (`BundleTest`).
testkuiper-drawing-engine / tests/test_public_bundle.py · lines 1–29 of 29 · Entry point
- What it does
- It tests its inputs. Defines BundleTest, test_extra_data_file_is_rejected, test_missing_file_is_rejected. Uses libraries importlib.util, pathlib, tempfile, unittest. Side effects: reads or writes files.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: JSON file local-review.json.
- Downstream impact
- Used directly by 1 file: Array Pages Workflow (kuiper-drawing-engine).
- What it achieves
- Defines `BundleTest`, `test_extra_data_file_is_rejected` and `test_missing_file_is_rejected`.
- Why it matters
- Run by Array Pages Workflow.
- Application
- kuiper-drawing-engine · tests · test
- Uses
- importlib.util, pathlib, tempfile, unittest
- Used by
- run by Array Pages Workflow (workflow run)
- Produces
- BundleTest
- Defines here
- BundleTest, test_extra_data_file_is_rejected, test_missing_file_is_rejected
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-drawing-engine@0d322ce8edb4646f2153cf72eeac247d903301e6 tests/test_public_bundle.py:1-29 · blob becdcf189c9a43cc1a18b693f8212e3d07cfb8eb · GitHub at these lines
- State
- achieves: name · context: readme_derived · stage: output · effects: filesystem · domain stage: agent_infra · users: ai_agent · canonical: unknown
import importlib.util
from pathlib import Path
import tempfile
import unittest
spec = importlib.util.spec_from_file_location('gate', Path(__file__).resolve().parents[1] / 'tools/check_public_bundle.py')
gate = importlib.util.module_from_spec(spec)
spec.loader.exec_module(gate)
class BundleTest(unittest.TestCase):
def test_extra_data_file_is_rejected(self):
with tempfile.TemporaryDirectory() as temp:
root = Path(temp)
for name in gate.ALLOWED:
(root / name).write_text('synthetic fixture')
self.assertEqual(len(gate.check(root)['files']), 5)
(root / 'local-review.json').write_text('{}')
with self.assertRaises(ValueError):
gate.check(root)
def test_missing_file_is_rejected(self):
with tempfile.TemporaryDirectory() as temp:
with self.assertRaises(ValueError):
gate.check(Path(temp))
if __name__ == '__main__':
unittest.main()Audit Estate
A Python command-line tool in the tools folder of Kuiper Drawing Engine covering inventory summary, using SHA-256. It is built from the flush step (`flush`).
storagekuiper-drawing-engine / tools/audit_estate.py · lines 1–73 of 73 · Entry point · pattern flush (shared by 14 files)
- What it does
- Defines main, flush. Uses libraries argparse, hashlib, json, os, subprocess. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'kuiper'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: command-line arguments. Out: JSON file inventory-summary.json.
- Downstream impact
- It is itself an entry point (Python CLI); no other file was found loading it.
- What it achieves
- Local-only lexical drawing-code inventory; never executes discovered code. It accepts `--root` and `--out`.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- kuiper-drawing-engine · tools · Python CLI
- Uses
- argparse, hashlib, json, os, subprocess, time, pathlib, numpy
- Used by
- none found
- Produces
- main
- Defines here
- main, flush
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- kuiper-drawing-engine@0d322ce8edb4646f2153cf72eeac247d903301e6 tools/audit_estate.py:1-73 · blob 044a7a19f2939d58cecb6c32628d20cb73631df3 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: agent_infra · users: ai_agent · canonical: supporting_data
"""Local-only lexical drawing-code inventory; never executes discovered code.
GPU channel matches literal byte patterns; CPU channel independently uses bytes
membership on every input. Agreement proves matching only, not code semantics.
Paths and inventory stay outside the public repository. No file contents output.
"""
import argparse, hashlib, json, os, subprocess, time
from pathlib import Path
import numpy as np
import cupy as cp
PATTERNS = [b'canvas', b'webgl', b'buffergeometry', b'linesegments', b'orthographic',
b'perspective', b'junction', b'azimuth', b'portrait', b'landscape',
b'transform', b'polyline', b'polygon', b'quaternion', b'arraygeometry',
b'modulegeometry', b'raycast', b'svg', b'instanc', b'bezier']
KERNEL = cp.RawKernel(r'''
extern "C" __global__ void match(const unsigned char* text,const long long* ends,
const unsigned char* patterns,const int* sizes,int files,int count,unsigned char* out){
int k=blockDim.x*blockIdx.x+threadIdx.x;if(k>=files*count)return;
int f=k/count,p=k%count,n=sizes[p];long long begin=f?ends[f-1]:0,end=ends[f];
unsigned char found=0;
for(long long j=begin;j+n<=end&&!found;j++){
int t=0;while(t<n&&text[j+t]==patterns[p*32+t])t++;if(t==n)found=1;
}out[k]=found;
}''', 'match')
def main():
ap=argparse.ArgumentParser();ap.add_argument('--root',required=True);ap.add_argument('--out',required=True)
args=ap.parse_args();out=Path(args.out);out.mkdir(parents=True,exist_ok=True)
start=time.perf_counter();records=[];skipped=0;total=0;bytes_read=0;gpu_ms=0.;mismatch=0
patterns=np.zeros((len(PATTERNS),32),np.uint8)
for i,p in enumerate(PATTERNS):patterns[i,:len(p)]=np.frombuffer(p,np.uint8)
gp=cp.asarray(patterns);gs=cp.asarray(np.array(list(map(len,PATTERNS)),np.int32))
batch=[];batch_bytes=0
def flush():
nonlocal total,bytes_read,gpu_ms,mismatch,batch,batch_bytes
if not batch:return
contents=[x[2] for x in batch];ends=np.cumsum([len(x) for x in contents],dtype=np.int64)
body=b''.join(contents);result=cp.empty((len(batch),len(PATTERNS)),cp.uint8)
dev=cp.asarray(np.frombuffer(body,np.uint8));de=cp.asarray(ends)
a,b=cp.cuda.Event(),cp.cuda.Event();a.record()
KERNEL(((result.size+127)//128,),(128,),(dev,de,gp,gs,len(batch),len(PATTERNS),result));b.record();b.synchronize()
gpu_ms+=cp.cuda.get_elapsed_time(a,b);got=cp.asnumpy(result)
reference=np.array([[p in content for p in PATTERNS] for content in contents],np.uint8)
mismatch+=int(np.count_nonzero(got!=reference))
for (repo,path,content),flags in zip(batch,got):
found=[p.decode() for p,v in zip(PATTERNS,flags) if v]
if found:records.append(dict(repository=repo,path=path,bytes=len(content),normalized_sha256=hashlib.sha256(content).hexdigest(),patterns=found,review='lexical candidate; licence and semantics not yet admitted'))
total+=len(batch);bytes_read+=len(body);batch=[];batch_bytes=0
for repo in sorted(Path(args.root).iterdir()):
if not repo.is_dir() or not (repo/'.git').exists():continue
proc=subprocess.run(['git','ls-files','-z'],cwd=repo,capture_output=True)
if proc.returncode:continue
for name in proc.stdout.decode('utf-8',errors='replace').split('\0'):
path=repo/name
if not name or path.suffix.lower() not in {'.js','.mjs','.cjs','.ts','.tsx','.html','.py','.glsl','.wgsl'}:continue
if any(part in {'node_modules','.venv','vendor','dist','build'} for part in Path(name).parts):continue
try:
if path.is_symlink() or path.stat().st_size>2_000_000:skipped+=1;continue
content=path.read_bytes().lower()
except OSError:skipped+=1;continue
batch.append((repo.name,name,content));batch_bytes+=len(content)
if batch_bytes>=32_000_000 or len(batch)>=512:flush()
flush()
records.sort(key=lambda r:(-len(r['patterns']),r['repository'],r['path']))
with (out/'drawing-candidates.private.jsonl').open('w',encoding='utf-8') as f:
for row in records:f.write(json.dumps(row)+'\n')
receipt=dict(status='pass' if mismatch==0 else 'fail',files=total,bytes=bytes_read,candidates=len(records),skipped=skipped,
pattern_checks=total*len(PATTERNS),cpu_gpu_differences=mismatch,gpu_kernel_ms=gpu_ms,wall_seconds=time.perf_counter()-start,
scope='Tracked text code in local repositories; excluded vendored/generated/oversize files. Literal matching only; no semantic or complete estate claim.')
(out/'inventory-summary.json').write_text(json.dumps(receipt,indent=2)+'\n',encoding='utf-8');print(json.dumps(receipt))
return bool(mismatch)
if __name__=='__main__':raise SystemExit(main())