In this section
- Claude CI History Mine Workflow automation · claude / .github/workflows/202609032345-ci-history-mine.yml lines 1–114
- Claude Clean Clone Byte Survey Workflow automation · claude / .github/workflows/202609032350-clean-clone-byte-survey.yml lines 1–131
- Claude Llama Cpu Benchmark Workflow automation · claude / .github/workflows/202609032355-llama-cpu-benchmark.yml lines 1–215
- Generate Workflow automation · code-generator / .github/workflows/generate.yml lines 1–84
- Check Assembly ingest · code-generator / tools/check-assembly.mjs lines 1–57
- Raise Work Orders storage · code-generator / tools/raise-work-orders.mjs lines 1–47
Claude CI History Mine Workflow
A GitHub Actions workflow. Runs on push, on a schedule and by hand.
automationclaude / .github/workflows/202609032345-ci-history-mine.yml · lines 1–114 of 114 · version 2026-09-03 23:45 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'claude'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- The whole CI history of every repository, not just its last run.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- claude · .github/workflows · workflow
- Uses
- Claude CI History Mine (workflow run)
- Used by
- none found
- Produces
- none declared
- Defines here
- 202609032345 CI history across the estate
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- claude@df9da02425fdf0c65d11a84f32cd9b3ef927b309 .github/workflows/202609032345-ci-history-mine.yml:1-114 · blob 9e2f5460474ec8fc32a7b32994c0edaf85f67b4b · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: agent_infra · users: ai_agent · canonical: unknown
# The whole CI history of every repository, not just its last run.
#
# =============================================================================
# THIS JOB IS INFORMATIONAL. IT EXITS 0 ON EVERY FINDING, ALWAYS.
#
# It surveys 260 workflows across 35 repositories and it will always find reds - that is
# the point of it. A survey that exits non-zero when it finds what it went looking for is
# misrepresenting its own role, and in GitHub Actions it also mails the actor every night
# until the mail is filtered and the report stops being read.
#
# The findings are in the artifact and in docs/boards/ci-history.md. If you are about to
# "fix" this into a gate: don't. The gates already exist in the repositories that own the
# work, and they already fail loudly when they should.
# =============================================================================
#
# WHY IT EXISTS ALONGSIDE audit_estate.py
#
# That script answers "what is red right now?" from the LATEST run per workflow. It cannot
# tell a regression from a workflow that has never worked in its life, because both present
# as a failing last run. The difference decides whether you are fixing something or
# finishing it, and on the first cloud run it separated 45 never-green workflows from the
# reds that actually regressed.
#
# It also measures that reader's own blind spot. audit_estate.py files `success` as green,
# `failure`/`timed_out`/`startup_failure` as red, and everything else as neither - so
# `cancelled` runs are reported as nothing at all. The first run counted 300 of them.
#
# WHY THE CLOUD
#
# Roughly 400 API calls against 35 repositories, entirely deterministic, no local state.
# It costs this laptop two minutes of wall clock and a chunk of its hourly API budget every
# time someone wants the answer. On a public repository it costs the cloud nothing.
#
# ON THE TOKEN. GITHUB_TOKEN is scoped to this repository. Cross-repo reads of PUBLIC
# Actions history normally succeed with it; if any repository comes back 403 or 404 the
# script records it under `unreadable` and carries on, so a permission limit is reported as
# a fact about the token rather than as a defect of the repository. If that list is ever
# non-empty, the fix is a read-only PAT in a secret named GH_READ_TOKEN - not a change here.
name: 202609032345 CI history across the estate
on:
workflow_dispatch:
# ONE nightly informational run, staggered off the crawl so the two do not contend.
schedule:
- cron: '11 3 * * *'
push:
branches: [main]
paths:
- 'scripts/ci_history_mine.py'
- '.github/workflows/202609032345-ci-history-mine.yml'
permissions:
contents: write
actions: read
concurrency:
group: ci-history-mine
cancel-in-progress: true
jobs:
mine:
runs-on: ubuntu-24.04
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.12'
- name: Mine every workflow's whole history
env:
# A read-only PAT if one has been provided; otherwise the job's own token.
GH_TOKEN: ${{ secrets.GH_READ_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -uo pipefail
python scripts/ci_history_mine.py \
--owner Ventusltd \
--max-runs 200 \
--out ci-history.json \
--board docs/boards/ci-history.md
echo "miner exit: $?"
- name: Upload the survey
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ci-history
path: ci-history.json
if-no-files-found: warn
retention-days: 90
# Staged BY EXPLICIT PATH. Other lanes write to this repository and `git add -A` in a
# job would sweep up their work in progress.
- name: Commit the board if it changed
run: |
set -uo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/boards/ci-history.md
if git diff --cached --quiet; then
echo "the board is unchanged; nothing to commit"
exit 0
fi
{
printf '%s\n\n' 'docs/boards/ci-history.md: every workflow that has never been green'
printf '%s\n' 'Written by 202609032345-ci-history-mine.yml. Informational: the survey exits 0'
printf '%s\n' 'on every finding, so a red is recorded here rather than mailed to anyone.'
} > /tmp/commit-msg.txt
git commit -F /tmp/commit-msg.txt
git pull --rebase --quiet || true
git push || echo "push declined; the findings are in the artifact"Claude Clean Clone Byte Survey Workflow
A GitHub Actions workflow. Runs on push, on a schedule and by hand.
automationclaude / .github/workflows/202609032350-clean-clone-byte-survey.yml · lines 1–131 of 131 · version 2026-09-03 23:50 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: starts processes.
- Why it exists in the grid workflow
- Domain stage agent_infra (repository name word 'claude'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- Out: commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- The byte questions, asked where the bytes are true.
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- claude · .github/workflows · workflow
- Uses
- Claude Clean Clone Byte Survey (workflow run)
- Used by
- none found
- Produces
- none declared
- Defines here
- 202609032350 Clean-clone byte survey
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- claude@df9da02425fdf0c65d11a84f32cd9b3ef927b309 .github/workflows/202609032350-clean-clone-byte-survey.yml:1-131 · blob b31f6e4c09a9466224d3f24f79a89c8e932ede2e · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: unknown · effects: process · domain stage: agent_infra · users: ai_agent · canonical: unknown
# The byte questions, asked where the bytes are true.
#
# =============================================================================
# THIS JOB IS INFORMATIONAL. IT EXITS 0 ON EVERY FINDING, ALWAYS.
#
# The gate that must block already exists: gridatlas's 202608312212-cartridge-proof.yml
# fails loudly on CRLF, on a bad composition and on a cartridge over its ceiling, and
# nothing here touches it. This job measures the same surface across the whole estate and
# writes the numbers down. A survey that exits non-zero would both mail the actor nightly
# and claim an authority it does not have over repositories it does not own.
#
# Findings are in the artifact and in docs/boards/clean-clone-bytes.md. If you are about to
# "fix" this into a gate: don't - the gate is elsewhere and it is already red when it needs
# to be.
# =============================================================================
#
# WHY THIS CANNOT BE ANSWERED ON THE LAPTOP
#
# `git status` compares THROUGH .gitattributes normalisation. It reports a tree clean while
# the disk holds CRLF and the blob holds LF, and fifteen of eighteen repositories in this
# estate are in exactly that state. So every measurement that depends on file bytes - a
# digest, a checksum manifest, a character ceiling - reads a different number on a Windows
# working tree than it reads anywhere the artefact is served. That is not a rounding error;
# it is a different file.
#
# A runner checks out from the blob. It is the cheapest clean clone available, and it can
# hold several repositories side by side. Hence: the cloud.
#
# WHAT IT SETTLES
#
# Three different ceilings are enforced in this estate and they are three different numbers:
#
# 368640 characters asserted by the cartridge proof (0.9 x 409600)
# 400000 bytes gated by tools/scope/loop.mjs lint
# 409600 bytes the composer boundary, reported but not enforced
#
# and characters are not bytes - the proof measures UTF-16 code units, the lint measures
# statSync().size, and cartridges contain non-ASCII. The survey reports a cartridge on all
# three gauges with the divergence named, so nobody has to remember which one they were
# reading. A prior version of that check asserted against one number and REPORTED against
# another, and printed 40,995 characters of headroom when the true figure was 35.
name: 202609032350 Clean-clone byte survey
on:
workflow_dispatch:
push:
branches: [main]
paths:
- 'scripts/clean_clone_byte_survey.py'
- '.github/workflows/202609032350-clean-clone-byte-survey.yml'
# ONE nightly informational run, staggered clear of the other two.
schedule:
- cron: '29 4 * * *'
permissions:
contents: write
concurrency:
group: clean-clone-byte-survey
cancel-in-progress: true
jobs:
survey:
runs-on: ubuntu-24.04
timeout-minutes: 25
steps:
- name: Checkout this repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Python
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5
with:
python-version: '3.12'
# Fresh clones, one per repository, into a directory this repository does not track.
# Shallow, because line endings and file bytes are properties of the checked-out tree
# and need no history. gridatlas is cloned to full depth of one but with its blobs,
# because the cartridge measurement reads the files themselves.
- name: Clone the estate clean
env:
GH_TOKEN: ${{ secrets.GH_READ_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -uo pipefail
mkdir -p /tmp/clones
for r in gridatlas globalgrid2050 pipelinenews cvaa spiders companies \
data-gridatlas data-grid-gb data-centres-gb data-interconnectors \
data-gb-electricity gb-electricity-ui grid-distance-maths \
chatgpt-audits codex-chatgpt gemini claude \
data-federation-map-for-globalgrid2050-all-repos; do
git clone --quiet --depth 1 "https://github.com/Ventusltd/$r.git" "/tmp/clones/$r" \
&& echo "cloned $r" \
|| echo "could not clone $r; it will be reported as absent rather than skipped"
done
ls /tmp/clones
- name: Measure
run: |
set -uo pipefail
python scripts/clean_clone_byte_survey.py \
--root /tmp/clones \
--out clean-clone-bytes.json \
--board docs/boards/clean-clone-bytes.md
echo "survey exit: $?"
- name: Upload the survey
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: clean-clone-bytes
path: clean-clone-bytes.json
if-no-files-found: warn
retention-days: 90
- name: Commit the board if it changed
run: |
set -uo pipefail
git config user.name 'github-actions[bot]'
git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add docs/boards/clean-clone-bytes.md
if git diff --cached --quiet; then
echo "the board is unchanged; nothing to commit"
exit 0
fi
{
printf '%s\n\n' 'docs/boards/clean-clone-bytes.md: line endings and cartridge ceilings on a clean clone'
printf '%s\n' 'Written by 202609032350-clean-clone-byte-survey.yml. Informational: exits 0 on'
printf '%s\n' 'every finding. The gate that blocks is gridatlas 202608312212-cartridge-proof.yml.'
} > /tmp/commit-msg.txt
git commit -F /tmp/commit-msg.txt
git pull --rebase --quiet || true
git push || echo "push declined; the findings are in the artifact"Claude Llama Cpu Benchmark Workflow
A GitHub Actions workflow. Runs by hand and on release.
automationclaude / .github/workflows/202609032355-llama-cpu-benchmark.yml · lines 1–215 of 215 · version 2026-09-03 23:55 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. 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 'claude'): AI-agent memory, coordination and code audit (the multi-agent journey named in Ventus Ltd's brief).
- Inputs & outputs
- In: JSON file bench.json.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Can a GitHub runner run a model?
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- claude · .github/workflows · workflow
- Uses
- none found
- Used by
- none found
- Produces
- none declared
- Defines here
- 202609032355 Llama on a CPU runner, measured
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- claude@df9da02425fdf0c65d11a84f32cd9b3ef927b309 .github/workflows/202609032355-llama-cpu-benchmark.yml:1-215 · blob ec4d5a3ca741763c453d7206954e43503fd01742 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, network, process · domain stage: agent_infra · users: ai_agent · canonical: unknown
# Can a GitHub runner run a model? Measure it, then answer.
#
# =============================================================================
# THIS JOB IS INFORMATIONAL. IT EXITS 0 ON EVERY RESULT, INCLUDING A BAD ONE.
#
# It is a measurement, not a threshold. There is no tokens/sec below which something is
# broken - a slow number is the answer, not a failure. And a benchmark that goes red would
# mail the actor for reporting exactly what it was asked to report.
#
# It is also workflow_dispatch ONLY: no schedule at all. Hardware does not change nightly,
# so a nightly run would burn minutes to reprint the same table.
# =============================================================================
#
# THE QUESTION
#
# "Run a sandbox in GitHub so we can use the compute available there too" is two proposals
# wearing one sentence. One of them is obviously right - crawls and surveys are parallel and
# deterministic and belong on free runners. The other is inference, and the honest way to
# settle it is to measure rather than to assert.
#
# WHAT IS KNOWN BEFORE MEASURING, and why it still needs measuring
#
# Standard GitHub-hosted runners have NO GPU. ubuntu-24.04 is 4 vCPU / 16 GB. So a model
# runs on CPU or not at all. That much is documentation. What documentation does not give
# you is the shape of the cost: how many seconds of every run are spent acquiring the model
# before a single token is produced, and how far tokens/sec falls as the model grows. Those
# two numbers decide whether the idea survives, and they are what this job produces.
#
# HOW IT MEASURES
#
# 1. The runner's actual specification, read off the machine, not off a docs page.
# 2. COLD START: the seconds to fetch llama.cpp and the seconds to fetch the model. This
# is paid on every run unless the model is cached, and it is the cost that decides the
# question for short jobs.
# 3. WARM START: the same job with the model restored from the Actions cache, so the
# difference between the two is a measurement rather than an estimate.
# 4. THROUGHPUT: llama-bench, which reports prompt-eval (pp512) and generation (tg128)
# tokens/sec separately, averaged over repeats. Those are different numbers and quoting
# one for the other overstates a CPU by roughly an order of magnitude.
#
# Two model sizes, so the result is a curve and not a point.
#
# The llama.cpp build is PINNED to b10793. `latest` is a moving target; a benchmark whose
# binary changes between runs is not comparable with its own history.
name: 202609032355 Llama on a CPU runner, measured
on:
workflow_dispatch:
inputs:
llama_build:
description: 'llama.cpp release tag to pin'
default: 'b10793'
required: false
permissions:
contents: read
concurrency:
group: llama-cpu-benchmark
cancel-in-progress: true
jobs:
bench:
runs-on: ubuntu-24.04
timeout-minutes: 45
strategy:
fail-fast: false
matrix:
include:
- label: qwen2.5-0.5b-q4_k_m
repo: Qwen/Qwen2.5-0.5B-Instruct-GGUF
file: qwen2.5-0.5b-instruct-q4_k_m.gguf
- label: qwen2.5-3b-q4_k_m
repo: Qwen/Qwen2.5-3B-Instruct-GGUF
file: qwen2.5-3b-instruct-q4_k_m.gguf
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
# Read the machine. A benchmark without its runner's specification is an anecdote.
- name: What this runner actually is
run: |
set -uo pipefail
{
echo "### Runner"
echo '```'
echo "vCPU: $(nproc)"
echo "model: $(grep -m1 'model name' /proc/cpuinfo | cut -d: -f2- | sed 's/^ //')"
echo "MHz: $(grep -m1 'cpu MHz' /proc/cpuinfo | cut -d: -f2- | sed 's/^ //')"
echo "MemTotal: $(grep MemTotal /proc/meminfo | awk '{print $2/1024/1024 " GiB"}')"
echo "disk free: $(df -BG --output=avail / | tail -1 | tr -d ' ')"
echo "AVX2: $(grep -qm1 avx2 /proc/cpuinfo && echo yes || echo no)"
echo "AVX512F: $(grep -qm1 avx512f /proc/cpuinfo && echo yes || echo no)"
echo "AMX: $(grep -qm1 amx_tile /proc/cpuinfo && echo yes || echo no)"
echo "GPU: $(lspci 2>/dev/null | grep -ci 'vga\|3d\|display' || echo 0) display devices"
echo "nvidia: $(command -v nvidia-smi >/dev/null && nvidia-smi -L || echo 'no nvidia-smi, no CUDA device')"
echo '```'
} | tee -a "$GITHUB_STEP_SUMMARY"
# COLD START, part one: the runtime. 16.7 MB, so this is the cheap half.
- name: Fetch llama.cpp (timed)
env:
BUILD: ${{ inputs.llama_build || 'b10793' }}
run: |
set -uo pipefail
url="https://github.com/ggml-org/llama.cpp/releases/download/${BUILD}/llama-${BUILD}-bin-ubuntu-x64.tar.gz"
t0=$(date +%s.%N)
curl -sSL --retry 3 -o /tmp/llama.tar.gz "$url"
rc=$?
t1=$(date +%s.%N)
echo "curl rc: $rc"
if [ "$rc" -ne 0 ]; then
echo "could not fetch $url - reporting that, not pretending it succeeded"
echo "LLAMA_OK=0" >> "$GITHUB_ENV"
exit 0
fi
mkdir -p /tmp/llama && tar -xzf /tmp/llama.tar.gz -C /tmp/llama
bin=$(find /tmp/llama -name 'llama-bench' -type f | head -1)
echo "LLAMA_BENCH=$bin" >> "$GITHUB_ENV"
echo "LLAMA_OK=1" >> "$GITHUB_ENV"
echo "RUNTIME_FETCH_S=$(echo "$t1 - $t0" | bc)" >> "$GITHUB_ENV"
echo "runtime fetched in $(echo "$t1 - $t0" | bc)s, $(du -m /tmp/llama.tar.gz | cut -f1) MB"
# WARM START: if the model is already in the Actions cache it is restored here and the
# download below is skipped. `cache-hit` is what makes cold and warm a measurement
# rather than a guess.
- name: Restore the model from the Actions cache
id: modelcache
uses: actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
with:
path: /tmp/models/${{ matrix.file }}
key: gguf-${{ matrix.label }}-v1
# COLD START, part two: the model. This is the number that decides the question.
- name: Fetch the model if the cache missed (timed)
run: |
set -uo pipefail
mkdir -p /tmp/models
if [ -f "/tmp/models/${{ matrix.file }}" ]; then
echo "cache HIT; no download"
echo "MODEL_FETCH_S=0" >> "$GITHUB_ENV"
echo "CACHE=hit" >> "$GITHUB_ENV"
else
url="https://huggingface.co/${{ matrix.repo }}/resolve/main/${{ matrix.file }}"
t0=$(date +%s.%N)
curl -sSL --retry 3 -o "/tmp/models/${{ matrix.file }}" "$url"
rc=$?
t1=$(date +%s.%N)
echo "curl rc: $rc"
if [ "$rc" -ne 0 ]; then
echo "MODEL_OK=0" >> "$GITHUB_ENV"
exit 0
fi
echo "MODEL_FETCH_S=$(echo "$t1 - $t0" | bc)" >> "$GITHUB_ENV"
echo "CACHE=miss" >> "$GITHUB_ENV"
fi
echo "MODEL_MB=$(du -m "/tmp/models/${{ matrix.file }}" | cut -f1)" >> "$GITHUB_ENV"
ls -la /tmp/models
# llama-bench reports prompt-eval and generation SEPARATELY. They differ by roughly an
# order of magnitude on a CPU, and quoting the first as if it were the second is the
# standard way this measurement gets overstated.
- name: Throughput
run: |
set -uo pipefail
if [ "${LLAMA_OK:-0}" != "1" ] || [ ! -f "/tmp/models/${{ matrix.file }}" ]; then
echo "no runtime or no model; nothing was measured, and that is what is reported"
exit 0
fi
t0=$(date +%s.%N)
"$LLAMA_BENCH" -m "/tmp/models/${{ matrix.file }}" \
-p 512 -n 128 -r 3 -t "$(nproc)" -o json > /tmp/bench.json 2>/tmp/bench.err
rc=$?
t1=$(date +%s.%N)
echo "llama-bench rc: $rc, wall $(echo "$t1 - $t0" | bc)s"
tail -20 /tmp/bench.err || true
python3 - <<'PY' | tee -a "$GITHUB_STEP_SUMMARY"
import json, os
label = os.environ.get('MATRIX_LABEL', '?')
try:
rows = json.load(open('/tmp/bench.json'))
except Exception as e:
print('### %s\n\nllama-bench produced no parseable JSON: %s\n' % (label, e))
raise SystemExit(0)
print('### %s' % label)
print('')
print('| test | tokens/sec | stddev |')
print('|---|---:|---:|')
for r in rows:
n = r.get('n_prompt') or 0
g = r.get('n_gen') or 0
name = ('prompt eval (pp%d)' % n) if n else ('generation (tg%d)' % g)
print('| %s | %.2f | %.2f |' % (name, r.get('avg_ts', 0), r.get('stddev_ts', 0)))
print('')
print('runner: %s vCPU · model %s MB · runtime fetch %ss · model fetch %ss (cache %s)'
% (os.environ.get('NPROC', '?'), os.environ.get('MODEL_MB', '?'),
os.environ.get('RUNTIME_FETCH_S', '?'), os.environ.get('MODEL_FETCH_S', '?'),
os.environ.get('CACHE', '?')))
PY
env:
MATRIX_LABEL: ${{ matrix.label }}
NPROC: 4
- name: Upload the raw measurements
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: llama-bench-${{ matrix.label }}
path: |
/tmp/bench.json
/tmp/bench.err
if-no-files-found: warn
retention-days: 90Generate Workflow
A GitHub Actions workflow in Code Generator using data from the stars repository. Runs by hand.
automationcode-generator / .github/workflows/generate.yml · lines 1–84 of 84 · Entry point
- What it does
- It runs automated jobs on GitHub Actions. Side effects: reads or writes files; starts processes.
- Inputs & outputs
- In: data source: stars data. Out: commits pushed to the repository.
- Downstream impact
- It is itself an entry point (workflow); no other file was found loading it.
- What it achieves
- Runs Generate (`generate.mjs`), Check Assembly (`tools/check-assembly.mjs`) and Raise Work Orders (`tools/raise-work-orders.mjs`).
- Why it matters
- No other file in the estate was found to import it; it is an entry point.
- Application
- code-generator · .github/workflows · workflow
- Uses
- Generate (workflow run), Check Assembly (workflow run), Raise Work Orders (workflow run), Code (estate URL)
- Used by
- none found
- Produces
- none declared
- Defines here
- Generate app
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- code-generator@3897d83efcd0259d21dce87704b0c33118fe2c2e .github/workflows/generate.yml:1-84 · blob 3ea994d21b7f755cd187491dfec5ecaf1e1e19ab · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: unknown · users: none · canonical: unknown
name: Generate app
# Assemble a new app from blocks of the periodic table (or numbered families), prove the assembly page is sound,
# raise a work order for everything that is missing, and commit it all with its report and recipe.
# Run from the Actions tab (or: gh workflow run generate.yml -f name=substation-finder -f blocks=Si,Vn,Ug,Ps,Dt).
on:
workflow_dispatch:
inputs:
name:
description: App name (lowercase letters, digits, hyphens)
required: true
blocks:
description: Block symbols from the periodic table, comma-separated (e.g. Si,Vn,Ug)
required: false
families:
description: Family numbers, comma-separated (from https://ventusltd.github.io/stars/code.html)
required: false
title:
description: Title for the report (optional)
required: false
permissions:
contents: write
issues: write
concurrency:
group: generate
cancel-in-progress: false
jobs:
generate:
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 24
- name: Generate
run: node generate.mjs --name "${{ inputs.name }}" --blocks "${{ inputs.blocks }}" --families "${{ inputs.families }}" --title "${{ inputs.title || inputs.name }}"
- name: Prove the module parses and imports
run: |
set -e
find apps/${{ inputs.name }} -name '*.mjs' -o -name '*.js' | while read f; do node --check "$f" || echo "parse problem: $f"; done
if [ -f "apps/${{ inputs.name }}/${{ inputs.name }}.mjs" ]; then
node -e "import('./apps/${{ inputs.name }}/${{ inputs.name }}.mjs').then(m => console.log(Object.keys(m).length + ' export(s) load'))"
fi
if [ -f "apps/${{ inputs.name }}/${{ inputs.name }}.py" ]; then python3 -c "import ast,sys; ast.parse(open('apps/${{ inputs.name }}/${{ inputs.name }}.py').read()); print('Python parses')"; fi
# The assembly page must exist, its plan and inline script must parse, every planned file must be on disk,
# and every name still needed must have a labelled input. A missing input fails the run; it is never skipped.
- name: Check the assembly page
run: node tools/check-assembly.mjs "apps/${{ inputs.name }}"
# One GitHub issue per new work order, labelled work-order. A request that already records an issue, or whose
# id is already in an issue title, is not raised again.
- name: Raise work orders as issues
if: always()
env:
GH_TOKEN: ${{ github.token }}
GH_REPO: ${{ github.repository }}
run: |
ls requests/${{ inputs.name }}-*.json >/dev/null 2>&1 || { echo "No work orders for ${{ inputs.name }}."; exit 0; }
node tools/raise-work-orders.mjs requests/${{ inputs.name }}-*.json
node generate.mjs --name "${{ inputs.name }}" --blocks "${{ inputs.blocks }}" --families "${{ inputs.families }}" --title "${{ inputs.title || inputs.name }}" >/dev/null
- name: Commit
if: always()
run: |
git add apps spider requests
if git diff --cached --quiet; then echo "No change."; exit 0; fi
git config user.name "github-actions[bot]"
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
git commit -qm "Generate ${{ inputs.name }} from ${{ inputs.blocks || inputs.families }}"
for i in 1 2 3; do git pull --rebase -q -X theirs && git push -q && exit 0; git rebase --abort 2>/dev/null || true; sleep 7; done
exit 1
- name: Summary
if: always()
run: |
[ -f "apps/${{ inputs.name }}/REPORT.md" ] && cat "apps/${{ inputs.name }}/REPORT.md" >> "$GITHUB_STEP_SUMMARY" || echo "No report produced." >> "$GITHUB_STEP_SUMMARY"
[ -f "apps/${{ inputs.name }}/WORK-ORDERS.md" ] && cat "apps/${{ inputs.name }}/WORK-ORDERS.md" >> "$GITHUB_STEP_SUMMARY" || trueCheck Assembly
A JavaScript module in the tools folder of Code Generator that reads parts.
ingestcode-generator / tools/check-assembly.mjs · lines 1–57 of 57 · Entry point
- What it does
- It loads parts. Uses libraries node:fs, node:child_process, node:path, node:vm. Side effects: reads or writes files; starts processes.
- Why it exists in the grid workflow
- README: "`tools/check-assembly.mjs` is the workflow's check of the assembly page: its plan and script must parse, every planned file must exist, and every name still needed must have a labelled input, or the run fails."
- Inputs & outputs
- In: JSON file parts.json; form fields (user input); command-line arguments.
- Downstream impact
- Used directly by 1 file: Generate Workflow (code-generator).
- What it achieves
- Check an assembled app without a browser.
- Why it matters
- Run by Generate Workflow.
- Application
- code-generator · tools · JavaScript module
- Uses
- node:fs, node:child_process, node:path, node:vm
- Used by
- run by Generate 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
- code-generator@3897d83efcd0259d21dce87704b0c33118fe2c2e tools/check-assembly.mjs:1-57 · blob ea0fe5255abe5f7cc751c794eeba87929bdb1a97 · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: ingest · effects: filesystem, process · domain stage: unknown · users: none · canonical: unknown
// Check an assembled app without a browser: node tools/check-assembly.mjs apps/<name>
// Fails (exit 1) when the assembly page is missing, its inline script does not compile, a file it plans to load is
// not on disk, or a name the recipe says is still needed has no input on the page. A missing input is a failure,
// never a skip: the page must ask for every value it cannot supply. Parse problems in the copied files are reported
// but do not fail, because those files are copied unchanged and the page's job is to show what they do.
import { readFileSync, existsSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
import path from 'node:path';
import vm from 'node:vm';
const dir = process.argv[2];
if (!dir || !existsSync(dir)) { console.error('usage: node tools/check-assembly.mjs apps/<name>'); process.exit(2); }
const fail = [], warn = [], ok = [];
const pagePath = path.join(dir, 'index.html');
if (!existsSync(pagePath)) { console.error(`FAIL no assembly page at ${pagePath}`); process.exit(1); }
const html = readFileSync(pagePath, 'utf8');
const recipe = JSON.parse(readFileSync(path.join(dir, 'parts.json'), 'utf8'));
// 1. the plan the page carries must parse and agree with the recipe
const planMatch = html.match(/<script type="application\/json" id="plan">([\s\S]*?)<\/script>/);
let plan = null;
if (!planMatch) fail.push('the page carries no plan (<script type="application/json" id="plan">)');
else { try { plan = JSON.parse(planMatch[1]); ok.push(`plan parses: ${plan.plan.length} file(s), ${plan.inputs.length} input(s)`); } catch (e) { fail.push('the plan is not valid JSON: ' + e.message); } }
if (plan && recipe.load_order && recipe.load_order.join('\n') !== plan.plan.map(f => f.saved).join('\n')) fail.push('the load order on the page differs from parts.json');
// 2. every inline script must compile
for (const m of html.matchAll(/<script(?![^>]*type="application\/json")[^>]*>([\s\S]*?)<\/script>/g)) {
try { new vm.Script(m[1], { filename: pagePath }); ok.push('inline script compiles'); } catch (e) { fail.push('inline script does not compile: ' + e.message); }
}
// 3. every file the page plans to load must exist on disk, and every referenced link must be relative
if (plan) for (const f of plan.plan) {
if (!existsSync(path.join(dir, f.saved))) fail.push(`planned file missing on disk: ${f.saved}`);
if (/^(\/|https?:)/.test(f.saved)) fail.push(`planned file is not a relative path: ${f.saved}`);
}
// 4. every name still needed must have a labelled input on the page
const inputs = new Set([...html.matchAll(/<input[^>]*data-need="([^"]+)"/g)].map(m => m[1]));
const labels = new Set([...html.matchAll(/<label for="need-([^"]+)"/g)].map(m => m[1]));
for (const n of recipe.inputs || []) {
if (!inputs.has(n)) fail.push(`no input on the page for the needed name ${n}`);
else if (!labels.has(n)) fail.push(`input for ${n} has no label`);
else ok.push(`input declared: ${n}`);
}
for (const n of inputs) if (!(recipe.inputs || []).includes(n)) warn.push(`input ${n} on the page is not in the recipe`);
// 5. copied JavaScript files: report parse problems, do not fail
if (plan) for (const f of plan.plan.filter(f => f.load)) {
try { execFileSync(process.execPath, ['--check', path.join(dir, f.saved)], { stdio: 'pipe' }); }
catch (e) { warn.push(`${f.saved} does not parse as ${f.kind === 'module' ? 'a module' : 'a script'} under Node: ${String(e.stderr || e.message).split('\n').find(l => /Error/.test(l)) || 'parse error'}`); }
}
for (const l of ok) console.log('ok ' + l);
for (const l of warn) console.log('note ' + l);
for (const l of fail) console.log('FAIL ' + l);
console.log(`${fail.length ? 'FAILED' : 'PASSED'}: ${ok.length} check(s) passed, ${warn.length} note(s), ${fail.length} failure(s)`);
process.exit(fail.length ? 1 : 0);Raise Work Orders
A JavaScript module in the tools folder of Code Generator.
storagecode-generator / tools/raise-work-orders.mjs · lines 1–47 of 47 · Entry point
- What it does
- It loads data. Defines gh. Uses libraries node:fs, node:child_process, node:path. Side effects: reads or writes files; starts processes.
- Inputs & outputs
- In: command-line arguments.
- Downstream impact
- Used directly by 1 file: Generate Workflow (code-generator).
- What it achieves
- Raise one GitHub issue per new work order.json ...] A request that already records an issue is left alone.
- Why it matters
- Run by Generate Workflow.
- Application
- code-generator · tools · JavaScript module
- Uses
- node:fs, node:child_process, node:path
- Used by
- run by Generate Workflow (workflow run)
- Produces
- gh
- Defines here
- gh
- Cannot conclude
- Whether this code runs, is used by a live app today, or is correct. This is a static reading.
- Evidence
- code-generator@3897d83efcd0259d21dce87704b0c33118fe2c2e tools/raise-work-orders.mjs:1-47 · blob b1a714378d743e282bfff83657416fe034bd606d · GitHub at these lines
- State
- achieves: comment · context: readme_derived · stage: output · effects: filesystem, process · domain stage: unknown · users: none · canonical: supporting_data
// Raise one GitHub issue per new work order: node tools/raise-work-orders.mjs [requests/<name>-*.json ...]
// A request that already records an issue is left alone. Before creating, the open and closed issues are searched
// for the request id in the title, so a re-run after a lost commit does not open a second issue. The issue number
// and URL are written back into the request file, which the workflow then commits. Needs gh with GH_TOKEN.
import { readFileSync, writeFileSync, readdirSync } from 'node:fs';
import { execFileSync } from 'node:child_process';
import path from 'node:path';
const REPO = process.env.GH_REPO || 'Ventusltd/code-generator';
const gh = (args, input) => execFileSync('gh', [...args, '-R', REPO], { encoding: 'utf8', input, stdio: ['pipe', 'pipe', 'pipe'] }).trim();
const files = process.argv.slice(2).length ? process.argv.slice(2) : readdirSync('requests').filter(f => f.endsWith('.json')).map(f => path.join('requests', f));
const template = readFileSync('.github/ISSUE_TEMPLATE/work-order.md', 'utf8').replace(/^---[\s\S]*?---\s*/, '');
try { gh(['label', 'create', 'work-order', '--color', 'FFD54A', '--description', 'A package for an agent to write: what is missing, where it is used, how it is checked', '--force']); } catch (e) { console.log('label: ' + String(e.stderr || e.message).trim().split('\n')[0]); }
let raised = 0, kept = 0, found = 0;
for (const file of files) {
const o = JSON.parse(readFileSync(file, 'utf8'));
if (o.issue && o.issue.number) { kept++; continue; }
const title = `Work order ${o.id}: ${o.title}`;
let issue = null;
try {
const hits = JSON.parse(gh(['issue', 'list', '--state', 'all', '--label', 'work-order', '--search', `"Work order ${o.id}:" in:title`, '--json', 'number,title,url', '--limit', '20']));
const hit = hits.find(h => h.title.startsWith(`Work order ${o.id}:`));
if (hit) { issue = { number: hit.number, url: hit.url }; found++; }
} catch (e) { console.log(`search failed for ${o.id}: ${String(e.stderr || e.message).trim().split('\n')[0]}`); }
if (!issue) {
const body = template
.replace('{{missing}}', `\`${o.missing.name}\` — ${o.missing.type}. ${o.missing.meaning}`)
.replace('{{used_in}}', [o.used_in.blocks.map(b => `- ${b.symbol} · #${b.number} · ${b.title}`).join('\n'), o.used_in.families.map(f => `- family #${f}`).join('\n'), o.used_in.files.slice(0, 10).map(f => `- [${f.path}${f.line ? ':' + f.line : ''}](${f.link}) at ${f.commit.slice(0, 7)}`).join('\n')].filter(Boolean).join('\n') || '- (not recorded)')
.replace('{{must_provide}}', o.must_provide.map(m => `- \`${m.name}\` — ${m.type}`).join('\n'))
.replace('{{acceptance}}', o.acceptance)
.replace('{{decisions}}', o.decisions.length ? o.decisions.map(u => `- ${u}`).join('\n') : '- none recorded; if a value has to be chosen, raise a decision record in Ventusltd/stars first')
.replace('{{brief}}', o.brief)
.replace('{{request}}', `https://github.com/${REPO}/blob/main/requests/${o.id}.json`)
.replace('{{app}}', `https://ventusltd.github.io/code-generator/apps/${o.app}/index.html`);
try {
const url = gh(['issue', 'create', '--title', title, '--label', 'work-order', '--body-file', '-'], body);
const number = Number(url.split('/').pop());
issue = { number, url }; raised++;
console.log(`raised #${number} ${title}`);
} catch (e) { console.log(`could not raise ${o.id}: ${String(e.stderr || e.message).trim().split('\n').slice(-1)[0]}`); continue; }
} else console.log(`found #${issue.number} ${title}`);
o.issue = issue; o.updated_utc = new Date().toISOString();
writeFileSync(file, JSON.stringify(o, null, 2) + '\n');
}
console.log(`${raised} issue(s) raised, ${found} found by title, ${kept} already recorded, ${files.length} request(s) in all.`);