Adopting ANTfrastructure in a New Project#
The checklist for wiring a new project to the hub’s tooling, which consumers import instead of copying: Windows container builds (Stevedore), Linux container builds (Rancher Desktop / CI), the planner–executor agentic loop, reusable PowerShell modules and bash libraries, and CI composite actions. BeschleunigerBallett is the reference consumer: when a detail here is ambiguous, read how that repo does it.
Reuse before adding functionality#
Before adding a helper, script, library, workflow or tool in any owned repository, search that
repository and its submodules for an implementation to reuse. Extend the canonical shared
implementation and consume it through the repo or submodule when one exists. If it does not, add
the functionality once to the shared repo and wire consumers to it with project-specific values
passed as parameters. When a technical boundary makes reuse impossible, record the reason and keep
the duplicate connected to its canonical source.
The AGENTS.md template puts this search rule in new
consumer repositories; the shared quality report lists Bash and PowerShell overlap candidates.
0. Add the submodule#
git submodule add https://github.com/Kataglyphis/ANTfrastructure.git third_party/ANTfrastructure
git submodule update --init --recursive
Everything below assumes that path. Consumers pin a commit like any other submodule; bump the pin
and the consuming change in the same commit. Push ANTfrastructure develop before the
consumer and wait until its CI is green, because CI resolves composite actions at @develop
(§ 6 says why not @main).
Submodule URLs are https, never git@#
Every .gitmodules url in the family is https://github.com/Kataglyphis/<repo>.git. An ssh url
needs a key, and nothing that resolves these has one: a hosted runner, the :latest container the
Renovate runner starts, an anonymous clone, and a recursive checkout from a superproject, which
inherits the submodule’s .gitmodules. actions/checkout installs a url.<https>.insteadOf
rewrite that hides an ssh url; a bare git submodule update gets no such rewrite and dies with
Permission denied (publickey) on a public repository. To change one:
git config -f .gitmodules submodule.<path>.url https://github.com/Kataglyphis/<repo>.git
git submodule sync # moves the existing checkout's remote too
Submodule maintenance#
Bumping the pin#
The family moves gitlinks with Renovate as a local CLI
(dependency-updates.md): renovate-local.sh, called through the
wrapper template in shared/linux/templates/, reports what is behind; --apply moves the gitlink.
It checks every direct submodule against its remote default branch, even when
.gitmodules names another branch or the checkout has not been initialized.
To stage one explicit, already published commit across consumers, run the hub checkout’s
reusable pin helper once per initialized direct submodule:
python3 linux/scripts/pin-antfrastructure-submodule.py \
--repo /path/to/consumer --branch develop --sha <full-40-character-hub-sha>
# For another direct submodule, choose its declared path and published default-branch tip:
python3 linux/scripts/pin-antfrastructure-submodule.py \
--repo /path/to/consumer --branch develop \
--path third_party/Other --sha <full-40-character-other-sha>
Pass the consumer’s checked-out branch (develop, main or master). The helper verifies
that checkout matches its remote branch, requires a tracked direct .gitmodules gitlink,
fetches the selected submodule’s remote default-branch tip and requires the exact SHA,
refuses a dirty or uninitialized child, then stages only the selected gitlink. --path
defaults to third_party/ANTfrastructure, so existing hub pin calls still work. The
.gitmodules branch setting does not select the target. The helper never commits or pushes.
Repositories without the hub gitlink, such as DocumANTation, use the reusable workflow’s
separate hub-checkout instead.
By hand, name the path and leave --recursive out:
git submodule update --remote --merge third_party/ANTfrastructure
A bare git submodule update --remote is forbidden in this family (AGENTS.md
§ Dependency Updates). --remote follows the branch = that .gitmodules declares for the
submodule. Commit the pointer with the consuming change and push the hub’s develop first (§ 0).
Putting every checkout on its branch#
git submodule update leaves each submodule on a detached HEAD at its recorded commit. To work on
the latest tip of every repo instead, run from the superproject:
bash third_party/ANTfrastructure/linux/scripts/git-sync-branches.sh --dry-run # the plan
bash third_party/ANTfrastructure/linux/scripts/git-sync-branches.sh # do it
It checks out the superproject’s default branch, then walks every submodule, parents before
children, onto the branch = that .gitmodules declares for it, else the remote’s default
branch. It only fast-forwards: a submodule with uncommitted changes is skipped (SKIP); a local
branch diverged from its remote fails the run (FAIL) while the rest still syncs.
Every submodule moves, third-party ones included (owner decision 2026-10-07). To hold a third-party library at a release, declare that release branch as its
branch =.--owned-onlyleaves every submodule hosted under another owner than the superproject’s (github.com/nlohmannvsgithub.com/Kataglyphis) at its recorded commit (PIN).A submodule inside a third-party submodule cannot be recorded by any repo you own, so after a run it stays listed as moved until that upstream bumps it.
It moves working trees, never gitlinks. It ends by listing every submodule no longer at its recorded commit. The next
git submodule update, or a git GUI that runs one, puts them back. To keep them, commit the gitlinks in each parent, innermost repo first, through the pin bump above.A submodule that a newer parent commit adds is not initialised; run
git submodule update --init <path>for it.
After a history rewrite#
When a repository’s history is rewritten on GitHub (big blobs purged, every commit id new), an
existing checkout still holds the old commits and their blobs, and a plain git pull merges the
two histories. Instead, run this once per checkout, from the superproject, on every machine
(Windows: Git Bash):
bash third_party/ANTfrastructure/linux/scripts/git-adopt-rewritten-history.sh --dry-run # the plan
bash third_party/ANTfrastructure/linux/scripts/git-adopt-rewritten-history.sh # do it
Nothing local is lost. Before anything moves, uncommitted changes, stashes, commits that never reached origin and local-only tags go to
~/git-rewrite-backup/<timestamp>/(--backup DIR) as patches and lists; the uncommitted changes are re-applied (staged) afterwards.A rewritten commit is told from unpushed work by its twin: origin has a commit with the same author, author date and subject. So an IDE’s background fetch before the run does not hide the rewrite.
The old blobs leave the disk: in each rewritten repository the reflogs are expired and
gc --prune=nowruns. A repository whose remote was not rewritten is only fast-forwarded and keeps its reflog.A detached submodule moves to the superproject’s new gitlink; one on a branch, as
git-sync-branches.shleaves it, moves with that branch.It names what it cannot clean: another remote (a fork), a linked worktree, a local branch without an upstream that origin lacks commits of, and
refs/original/(a localfilter-branch) may still hold the old history, and their objects stay until they are removed. Bundle such a branch (git bundle create) before deleting it.
Resolving a submodule conflict on merge#
A merge that touches the pin from both sides leaves third_party/ paths unmerged, and
git checkout --theirs alone does not resolve them: the conflict is over which commit the
superproject records, not over file contents. It arises when two branches diverged far enough that
you want one side wholesale. Set the merge up so it stages nothing automatically, then resolve:
git fetch origin
git checkout main
git reset --hard origin/main
# take develop's content, but stop before committing
git merge --allow-unrelated-histories --no-commit -X theirs develop
# what is actually unmerged
git diff --name-only --diff-filter=U
# take the incoming side's commit for every conflicted submodule
for p in $(git diff --name-only --diff-filter=U | grep '^third_party/' || true); do
echo "Resolving submodule conflict: $p"
git submodule update --init --recursive "$p" || true
git checkout --theirs -- "$p"
git add "$p"
done
# then the ordinary file conflicts
git checkout --theirs -- .
git add -A
git commit
# and materialize the commits that were just recorded
git submodule update --init --recursive
Run git submodule update --init --recursive after committing as well as before: staging the
pointer does not check the submodule out at that commit, so skipping it leaves a working tree that
does not match what you just recorded.
-X theirs on the merge resolves file contents but leaves submodule pointers conflicted. The loop
above is the part that is easy to forget, and without it the “resolved” merge silently pins the
wrong commit.
Recovering a broken submodule checkout#
When a clone left submodules half-initialised (wrong commit, empty directory, a .git file
pointing nowhere), reset them instead of deleting the tree:
git submodule deinit -f --all
git submodule update --init --recursive
deinit -f discards local submodule working trees: commit or stash anything inside them first.
Long paths (Windows consumers)#
The hub’s nesting plus a deep build directory exceeds MAX_PATH quickly. Besides the host-level
LongPathsEnabled setting in windows-host-setup.md, git needs its own:
git config --global core.longpaths true
Without it, clone or checkout fails with Filename too long on files the filesystem accepts.
Resetting to a clean tree#
git clean -fdx
git reset --hard
-x also removes ignored files (build outputs, .venv, cached toolchains): usually the point, but
the next build starts cold.
git pull hanging in PowerShell#
An SSH remote needs the agent running as a Windows service; without it the client waits on a passphrase prompt nothing displays:
Start-Service ssh-agent
ssh-add "$env:USERPROFILE\.ssh\id_ed25519"
Set-Service -Name ssh-agent -StartupType Automatic makes it stick.
Shallow fetches#
A build agent rarely needs every submodule’s full history:
git fetch --depth=1 origin <branch>
git reset --hard FETCH_HEAD
1. The one file that cannot live here#
Each consumer needs a small bootstrap that finds this submodule, since it runs before anything
upstream is importable. Copy
shared/windows/templates/Resolve-BuildModule.ps1
to scripts/windows/Resolve-BuildModule.ps1 and adjust $script:RepoRootRelativeToHere if the
script does not sit exactly two directories below the repo root. It resolves a module name to
third_party/ANTfrastructure/windows/scripts/modules/<Name>.psm1
first, then a local modules/ fallback beside itself, and throws with both paths if neither
exists.
Copy the template, do not re-author it. All four consumers had written this file
independently and drifted: different search orders, different error text, one missing -Global
on the import.
The search order is the whole contract: put reusable modules upstream and they win
automatically; the local fallback holds only project-specific modules. A module a second
consumer needs belongs here; that test moved WindowsTesting.Common and WindowsClang.Common
upstream on 2026-08-11.
Bash consumers: copy
shared/linux/templates/antfrastructure.sh
to scripts/linux/lib/antfrastructure.sh (or scripts/lib/ in a flat Flutter repo), adjust
KATAGLYPHIS_REPO_ROOT_RELATIVE, and declare it as antfrastructure-sh in
.antfrastructure-shared.manifest so the drift gate watches it. Copy
shared/linux/templates/renovate-git-mode.sh beside it and declare that file as
renovate-git-mode-sh; the bootstrap requires this shared Git selector. It resolves paths from
${BASH_SOURCE[0]}, never from the caller’s working directory, and its failure message names the
fix.
A consumer with no submodule is supported. The bootstrap takes $ANTFRASTRUCTURE_DIR first (a
container mounts the workspace elsewhere than the host, so an explicit answer always wins), then
third_party/ANTfrastructure, then a sibling clone at <repo>/antfrastructure-tools. Its error
offers git submodule update only when .gitmodules names that path, and otherwise tells you to
clone or to export ANTFRASTRUCTURE_DIR.
2. Windows container builds (Stevedore)#
Image: ghcr.io/kataglyphis/kataglyphis_beschleuniger:winamd64 (clang-cl, CMake, Ninja, Vulkan
SDK, Rust, sccache preinstalled). Import WindowsContainerBuild.Reuse through the resolver and
build on its functions instead of re-implementing the pattern:
Function |
Purpose |
|---|---|
|
Find Stevedore’s |
|
Process vs Hyper-V isolation, CPU/memory args |
|
Reuse/start/recreate one long-lived build container; recreates on image change |
|
tar-pipe transfers with mandatory exclusion support |
|
Ensure PowerShell 7 exists inside the container |
|
Prune deleted sources on reuse (tar never deletes) |
|
Fail when a “green” build produced or delivered nothing |
|
Bind-mount probe; wcifs-tolerant removal |
|
Trust the container’s state, not the docker client’s exit code, when the CLI drops its pipe mid-run (needs a named run, never |
Read windows-container-build-performance.md before
designing your flow: both transports and their setup, why the build tree must not live on a named
volume, the Windows path limit that silently truncates tar transfers, and the container-reuse
measurements.
Three rules, each learned by debugging:
Mount/stream to the same in-container path under every transport. CMake bakes absolute paths into
CMakeCache.txtand rejects a cache generated elsewhere.A green build is not proof of delivery. Always end with
Test-BuildArtifactsDelivered; both “built nothing” and “delivered nothing” have happened silently.A red docker client is not proof of failure. The CLI drops its pipe mid-run on this host while the container keeps building. Name the run, leave
--rmoff, and take the verdict fromWait-ContainerExit.
3. Linux container builds (Rancher Desktop / CI)#
Image: ghcr.io/kataglyphis/kataglyphis_beschleuniger:latest.
Local runs go through one driver, which answers the image tag, the mount layout, the git
safe.directory, the engine and the Git Bash path-mangling escape in one place instead of per repo
(shared-script-libraries.md § run-in-ci-image.sh
owns the explanation):
bash third_party/ANTfrastructure/linux/scripts/run-in-ci-image.sh . -- \
bash scripts/linux/cmake-configure-build.sh --preset <preset> \
--build-dir /tmp/build
A cache that outlives the run goes on a named volume, with the variable that points the tool at it:
bash third_party/ANTfrastructure/linux/scripts/run-in-ci-image.sh . \
--volume myrepo-cargo:/var/cache/cargo -- \
bash scripts/linux/cmake-configure-build.sh --preset <preset> \
--build-dir /tmp/build --cargo-cache-dir /var/cache/cargo
--env NAME=VALUE and --privileged are passed on the same way, and under a rootless engine on
Linux the helper runs as root by itself.
Three constraints:
The CMake build directory must be container-native (
/tmp/...), not on the bind-mounted host tree: FetchContent’s rename and cargo’s temp-file cleanup both fail on that filesystem.Persist cargo via a named volume (
--cargo-cache-dir, whichlib/cmake-build.shturns intoCARGO_HOMEandCARGO_TARGET_DIR). The image’s ownCARGO_HOMEis writable (consumer-image-contract.md, promise 2), but it lives in the container and dies with it.Never assume a tool is present because it is on your dev box. Check
consumer-image-contract.mdfirst.jqandpython3are in the current Linux image, but older images lackedjq: a hardjqdependency once broke shader precompilation there and left CI with no artifacts.
Prefer linux/scripts/01-core/ helpers (logging, retry, downloads with SHA verification,
uv/python env, parallelism) over new implementations.
4. The agentic loop#
Reusable core:
PowerShell:
windows/scripts/modules/WindowsAgenticLoop.Common.psm1Bash:
linux/scripts/lib/agentic-loop.shDefault task prompts:
shared/agentic-loop/prompts/{planner,refactor-planner,executor}.md, the single source both platforms read. Never hard-code prompt text in a consumer wrapper; that is how the two platforms drifted apart.
Start from the copy-and-edit templates in
shared/agentic-loop/templates/
(config with every project-specific field marked TODO, plus both runner wrappers, which
.antfrastructure-shared.manifest declares as agentic-loop-sh and agentic-loop-ps1 so the
shared-config gate watches them). A consumer supplies four things:
BACKLOG.mdwith the checkbox protocol:- [ ]actionable,- [b]blocked (skipped, and excluded from the pending count so a blocked-only backlog lets the planner run again),- [x]completed (pruned; history lives in git).A config JSON. Shape (see the reference consumer’s
scripts/agentic-loop/AgenticLoop.config.json):engine, per-engine model and prompt settings underengines.*, cadences and timeouts underintervals.*, per-platformbuildMatrix.{windows,linux}entries (name/sanitizer/buildDir/buildType/testCommand),build.*commands,git.*auto-commit settings,backlog.*policy,logging.logDir.Thin runner wrappers:
Invoke-AgenticLoop.ps1/.sh. They load the config, resolve the module/library, and callInvoke-AgenticLoop/run_agentic_loop. Build configs and prompts both default from the config and the shared prompt files, so the wrappers stay tiny.Project role-prompt overlays:
scripts/agentic-loop/prompts/planner-overlay.mdandexecutor-overlay.md, wired via the config’s top-levelpromptOverlaysblock. Write only your project’s delta. The loop composesshared/agentic-loop/system-prompts/<role>.md+ your overlay once and delivers that one text to both engines (the opencode engine needs opencode v2, install): toclaudevia--append-system-prompt-file, and toopencodeby GENERATING.opencode/agents/<role>.md, its only role-prompt channel. Add.opencode/agents/to.gitignore; the loop warns if you have not. A tracked, hand-edited copy of that file left one consumer with two full copies of the role prompt 271 lines apart, the stale one missing the executor’s incident narrative, itstimeout: 600000guidance and the- [b]commit step.
API reference: windows-agentic-loop.md.
Build-matrix semantics and sanitizer env handling:
agentic-loop-build-matrix.md.
The loop does not watch CI, and it auto-commits with git add -A. Expect it to keep committing
over a red pipeline, and check whether it is live before running interactive work in the same tree.
5. Application launchers#
linux/scripts/lib/app-runner.sh provides argument parsing
(--exe-name/--build-dir/--build-type), executable discovery with a bounded
fallback search, LD_LIBRARY_PATH export, and hooks
(app_runner_post_vulkan_hook, app_runner_env_hook,
APP_RUNNER_ENABLE_SHADER_CLEAN). Consumers keep only per-profile wrappers
holding defaults and hooks.
6. CI#
Composite actions live in .github/actions/ and are referenced
from a consumer workflow as Kataglyphis/ANTfrastructure/.github/actions/<name>@develop.
@develop, not @main (owner directive 2026-09-25). Work lands on develop; main is a
release branch that lags it, and its versions.env still names the retired :latest-cross, whose
tags were deleted on 2026-09-29, so an action at @main fails at docker pull. The same ref
applies to the reusable workflows below, and a consumer workflow change that depends on a hub
change needs the hub push first (§ 0).
Each action’s action.yml declares its inputs and outputs, and
.github/actions/README.md describes most of them; this page keeps
no second copy. They replace hand-rolled docker run blocks (twenty-plus copies across two
workflows in the reference consumer) and include deploy-over-ftp, the family’s one FTP publish policy
(ftp-deploys.md).
One ordering rule is about your workflow, not an action, so it lives here: on a Windows runner,
set-docker-data-root runs FIRST (prepare-windows-container-host runs it before its own
pull). It moves docker’s data root to the big D: drive: the ~54 GB image does not fit on a stock
windows-2025 runner’s C:, and a pull without the move dies late with
hcsshim::ImportLayer 0x70 (measured; see
windows-build-resources.md).
The lanes below are reusable workflows, each called with
uses: Kataglyphis/ANTfrastructure/.github/workflows/<name>.yml@develop. There are more:
grep -l workflow_call .github/workflows/*.yml lists every one, and § 9 names the gate lanes.
lint-gates.yml: the consumer lint gates (§ 9).submodule-pins.yml: the pin suite (§ 9).python-ci-linux.yml/python-ci-windows.yml: the Python pair (§ 9).build-docs.yml: builds, checks and publishes a docs site from the repository’s owndocs.yml(inputs, secrets and each repository’s move:docs-sites.md).container-ci-windows.yml: the Windows container lane. Its caller names a build script, the script’s arguments and the directory the product lands in (dist/windows-x64ordist/windows-arm64in every caller, with the DLL closure the product needs);target-arch: arm64adds the arch gate and a run onwindows-11-arm(windows-cross-builds.md§ Consumer cross lanes). Itssubmodulesinput defaults torecursivefor existing callers; set it to'true'when direct dependencies suffice, so a nested documentation cycle cannot block the Windows build before its script starts. Since 2026-09-26 thewindows-x64.ymlandwindows-arm64-cross.ymlof OxidANT, AccelerANTgine and BeschleunigerBallett call it. A caller hands its own secrets to the container through theCONTAINER_SECRET_ENVsecret, oneKEY=valueper line, which reaches docker as an--env-file.
Workflow file names and display names#
Owner decision 2026-09-24, for every repository in the family, this one included.
Files are kebab-case, and a build gets one file per platform and arch:
linux-x64.yml,linux-arm64.yml,windows-x64.yml,windows-arm64-cross.yml,android.yml,web.yml. A lane every repo has carries the same file name everywhere:lint-gates.yml,submodule-pins.yml,codeql.yml,docs.yml. A reusable workflow that lives in a consumer isreusable-<platform>.yml.Display names read
<Platform> <Arch> · <what>for a build (Linux x64 · preflight + mutation gate) and<Area> · <what>for anything else (Docs · stale check,GHCR · cleanup). The separator is U+00B7, the middle dot. The shared lanes areLint gates,Submodule pins,CodeQLandDocs · …; a consumer’s reusable workflow is<Platform> · reusable build.This hub’s reusable workflows keep their file names. Every consumer calls them as
Kataglyphis/ANTfrastructure/.github/workflows/<file>@develop, so a rename breaks the fleet at once. Only their display names changed, and they end in(reusable):Docs · build + publish (reusable),Lint gates (reusable),Python CI · Linux (reusable),Python CI · Windows (reusable),Submodule pins (reusable), andContainer CI · Windows (reusable), new on 2026-09-25.Splitting a Python lane per arch needs no copied job:
python-ci-linux.yml’sarchesinput picks the rows (python-ci.md).
The rename across the fleet, old name to new:
Repository |
Before |
After |
|---|---|---|
ANTfrastructure |
|
|
ANTfrastructure |
|
|
OxidANT |
|
|
OxidANT |
|
|
AccelerANTgine |
|
|
AccelerANTgine |
|
|
AccelerANTgine |
|
|
AccelerANTgine |
|
|
OmniAccelerANT |
|
|
OmniAccelerANT |
|
|
OmniAccelerANT |
|
|
OmniAccelerANT |
|
|
BeschleunigerBallett |
|
|
BeschleunigerBallett |
|
|
BeschleunigerBallett |
|
|
BeschleunigerBallett |
|
|
OrchestrANT, WebDavClient |
|
|
WebDavClient |
|
|
OrchestrANT |
|
kept for now; the same split is open to it ( |
jotrockenmitlocken |
|
|
ANThology |
|
|
DocumANTation |
|
|
A hub page that cites a consumer workflow with a LINE number from before the rename (the table in
ftp-deploys.md) is a dated record and keeps the old name; this table
translates it.
7. Certificates / packaging (Windows)#
windows/scripts/certificates/ holds MSIX certificate generation and import (README.md there),
driven by the WindowsMsix.Common, WindowsMsix.Signing and WindowsWebDav.Common modules.
Signing:
Invoke-MsixPackage -Sign -SigningRoot <repo root>signs with the*.pfxit finds in that directory (not recursively; the family keeps it there, gitignored) andMSIX_PFX_PASSWORD. Since 2026-09-25-Signwithout-SigningRootthrows before anything is staged.A failed signing only warns, so a package that must install passes
-RequireSignature(with-SignerSubjectfor the manifest’s publisher): it throws when the MSIX comes out unsigned, or signed by another subject.A throwaway certificate for a test signature comes from
New-TestSigningCertificate(WindowsMsix.Signing): made in memory, no certificate store touched, the.pfxoptionally protected with-Password.certificates/GenerateCertificateMSIX.ps1stays the manual tool for a long-lived, AES-protected developer certificate.An MSI built from the project’s own
.wxsgoes throughInvoke-MsiPackage(WindowsMsix.Common, since 2026-10-05). It runswix buildwithVersion,ExeSource,LicenseRtf,ProductNameandManufactureras preprocessor variables. With-PayloadFilesit also writes a fragment for<ComponentGroupRef Id='PayloadFiles'/>, one component per file. OxidANT is the first caller; a CMake repo builds its MSI through CPack’s WiX generator instead.An NSIS setup goes through
Invoke-NsisPackage(WindowsNsis.Common), see NSIS setups. A CMake repo stays on CPack’s NSIS generator.
NSIS setups#
Invoke-NsisPackage builds <stem>-setup.exe from the hub’s windows/scripts/nsis/setup.nsi
and kataglyphis-common.nsh. The consumer passes one -Setup table: ProductName,
Publisher, Version, Arch (x64 or arm64), PayloadDir, MainExe, LicenseFile, a
stable UninstallKey, OtherArchSetup, OutFile and WorkDir. MsiUpgradeCode, IconFile
and ShortcutArguments are optional. A missing, malformed or unknown key fails before makensis
runs, so a misspelt optional key cannot drop the MSI guard.
Only the pinned makensis.
Resolve-MakensisExetakes-MakensisPath, thenNSISDIR, thenPATH, and fails unlessmakensis /VERSIONequalsv$NSIS_VERSION. GitHub runners carry their own NSIS, so a host build installs the pin withInstall-Nsis.ps1first.A short build root. makensis 3.13 is not long-path aware.
Assert-NsisPayloadPathfails when a payload path reaches 260 characters and names it.Per machine, zlib. The setup asks for admin, installs under
$PROGRAMFILES64and puts the shortcut in the all-users Start menu (SetShellVarContext allin both init functions). The LZMA stub carries CPL-1.0 code, so the template compresses with zlib.One uninstall key, no version. An upgrade finds the old install under the key, runs its uninstaller in place and installs into the same folder.
Refusals exit 2. The x64 setup stops on ARM64 and names the arm64 setup; the arm64 one stops off ARM64. With
MsiUpgradeCode, a present MSI of the same product stops it too. A silent run shows no dialog and exits 2.The uninstaller removes only what it installed.
New-NsisFileListwrites oneDeleteper payload file and oneRMDirper folder, deepest first; nothing deletes recursively.ShortcutArgumentsstarts the main exe with arguments (OxidANT’sgui).SignPfxsigns the setup and its uninstaller. makensis runsInvoke-NsisSign.ps1through!finalizeand!uninstfinalize, and a nonzero exit stops the build. The password comes fromMSIX_PFX_PASSWORDorMSIX_CERT_PASSWORDin the environment, never from the command line, and the build log shows it as<redacted>. After the build,Assert-AuthenticodeSignerchecks that the written setup carries the certificate’s signature; a test certificate’s untrusted root passes, a foreign signer or a broken hash does not.
Invoke-AuthenticodeSign (WindowsMsix.Signing) is the signtool step for any format. Without
-Require, a missing signtool or .pfx warns and skips; with it, both stop the build.
-Verify Trusted runs signtool verify /pa, which needs a trusted root; -Verify Signer
compares the signer’s thumbprint, for test certificates.
The package gates read a finished setup like any other format. Pass the .exe and paths
relative to $INSTDIR (bin/app.exe). 7-Zip must be on PATH. This covers the licence,
binary, MSVC notice and ORT gates:
third-party-licenses.md § Checking delivered package licences.
Nsis.Common.Tests.ps1 checks argv, the file list, the signer check and the template’s source
with fakes. Nsis.PackageGates.Tests.ps1 checks the gates over a fake 7-Zip listing. Neither
runs makensis, signtool or a setup.
The consumer stages what a package carries, with two hub helpers. A product’s DLL closure comes
from Copy-PeImportClosure (WindowsCrossBundle.Common,
windows-cross-builds.md). ONNX Runtime comes from
WindowsOrtPayload.Common: stage the chain copy with Copy-ChainOrtBeside, then prove the payload
with New-OrtProvenPayload or Assert-ChainOrtTree
(onnxruntime-single-source.md § The shared Windows glue).
The WebDAV downloader that fetches those signing certificates in CI (instead of committing them) is
not Windows-specific and no longer lives there: it is
linux/scripts/01-core/download-webdav-files.py, with a shim at the old
windows/scripts/certificates/download_webdav_files.py path because the PowerShell module
resolves it relative to itself. A Linux lane calls it through webdav_download_tree
(shared-script-libraries.md). Both halves
install the client at WEBDAVCLIENT_REF from versions.env.
8. Calling conventions (what every consumer looks like)#
.github/consumers.json lists every repo that consumes this one. The shapes below are what the
first seven consumers converged on, so a new consumer that follows them reads like every other.
Until they were measured, the convention was folklore and had drifted.
Windows entry point: <scripts>/windows/Build-Windows.ps1, PascalCase Verb-Noun like every
other PowerShell file. It must:
#requires -Version 7.0 # every module here declares it; pwsh, never powershell
. (Join-Path $PSScriptRoot 'Resolve-BuildModule.ps1')
Import-BuildModule @('WindowsScripts.Shared', 'WindowsBuild.Common', ...)
Run the app with a sibling Start-Windows.ps1. Project-specific modules go in
<scripts>/windows/modules/, which the resolver checks after this repo.
The verb carries the meaning. The family uses three of PowerShell’s approved verbs in narrower
senses than the approved-verb list gives them: Start- launches the built application, Invoke-
runs a build step or a tool, Build- produces artifacts. Build-Windows.ps1 builds,
Start-Windows.ps1 runs, Invoke-Lint.ps1 lints. PowerShell lives under scripts/windows/
whatever lane it drives: a .ps1 that starts a Linux container is still PowerShell and belongs
there, because a reader asks “which shell do I need”, not “which OS does it target”.
Bash entry points: set -euo pipefail, resolve the script’s own directory, then source a
per-repo bridge that pulls in the bootstrap of § 1, and reach a hub file through it, never through
a ../../third_party/... literal:
set -euo pipefail
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
source "${SCRIPT_DIR}/lib/common.sh" # sources lib/antfrastructure.sh
antfrastructure_source linux/scripts/lib/<lib>.sh
Long flags are --kebab-case value. A wrapper around one of the lib/*.sh drivers should be ~30
lines: source the library, set the project’s defaults, call its *_main.
BeschleunigerBallett/scripts/linux/run-ctest.sh is the canonical example.
Shell safety: the five bug classes in shared-script-libraries.md § Shell safety conventions
apply to consumer scripts too. Each one falsified or killed a real build here; they are not style
preferences.
Directory layout is uniform across the six consumers that have a Windows lane
(BeschleunigerBallett, OmniAccelerANT, OrchestrANT, AccelerANTgine, OxidANT, WebDavClient;
normalised 2026-08-11, WebDavClient checked 2026-09-25): lowercase scripts/, with
scripts/windows/, scripts/linux/ and, where the agentic loop is wired up,
scripts/agentic-loop/, plus scripts/windows/modules/ for a repo with project-specific modules
and scripts/windows/container/ for scripts that run inside the Windows image, not on the host
(OxidANT’s Invoke-StevedoreBuild callees). Two repos used Scripts/ + Scripts/Windows/ until
that sweep; use lowercase in a new consumer, there is no per-repo casing rule to look up. Two
exceptions: jotrockenmitlocken, a Linux-only Flutter repo, keeps a flat scripts/, with the
bootstrap and Git mode companion at scripts/lib/, with both paths declared in
.antfrastructure-shared.manifest. ANThology keeps its find-hub.sh candidate priority and uses
the copied bootstrap for a missing hub on a real Renovate apply.
Bash filenames are kebab-case everywhere except OrchestrANT (measured 2026-09-14). There the
four ci_*.sh wrappers mirror the hub’s own snake_case drivers under
linux/scripts/02-toolchain/python/ by name, and benchmarks/run_benchmarks.sh kept its name
from the hub’s llm-stack; its other scripts are kebab. An older wording said “snake_case in the
rest” and was wrong about OxidANT and AccelerANTgine, both kebab. That exception stays: unlike a
directory rename it buys no structural consistency, and renaming every script would churn history
for a purely lexical preference. Match the repo you are in.
set -euo pipefail applies to entry points, not to sourced libraries: a file-scope set -e
in a library leaks into whoever sources it. The hub’s own libraries follow the same rule
(AGENTS.md § Development Rules).
Reach for these before writing a helper#
Every row was first written locally in a consumer and later found here, usually in a better form
and twice with a bug the local copy did not have. The list moved here from OxidANT’s AGENTS.md
on 2026-10-05 (CON55), so each consumer links one list instead of keeping its own.
Need |
Use |
Defined in |
Not |
|---|---|---|---|
|
|
a hand-rolled candidate list |
|
|
|
same file |
|
A bash command in a Linux container from Windows: named volumes chowned by the run’s image, |
|
|
a hand-built |
|
|
same file |
inline flags |
Container teardown |
|
same file |
|
Bind-mount probe, artifact delivery |
|
same file |
assuming a green build delivered something |
Stage, manifest, pack and sign one MSIX; |
|
a local makeappx/assets/tokens/pack sequence, or a |
|
A throwaway code-signing certificate, no store touched |
|
|
|
The |
|
a |
|
A CMake product’s |
|
an install, |
|
The version to stamp a package with: |
|
same file |
reading a version file inline, with a different fallback per step |
SDK tools (makeappx, signtool) |
|
same file |
|
Manifest tokens, XML escaping, placeholder PNGs |
|
same file |
|
A clang-format of the pinned LLVM, or a refusal |
|
a |
|
Config access |
|
copies |
|
A PE file’s machine and the target’s expected machine |
|
reading |
|
Installer and runtime smoke checks with counted failures |
|
a local |
|
One |
|
same file |
a |
Build logging and steps |
|
ad-hoc |
|
|
|
another local package-build argument array |
|
What NSIS or WiX said when a |
|
same file |
a package step that ends at CPack’s “Problem running NSIS command” |
|
|
same file, |
a robocopy |
A Python repo’s Windows CI build: pytest legs, gating static analysis, packaging |
|
a |
|
Tool guards, workspace paths, a hub pin from |
|
a second implementation, or a |
|
Logging inside a container |
|
a |
|
CI version stamping (bash) |
|
re-reading |
|
In-container cargo steps |
|
inline cargo invocations |
|
Publishing a GitHub release: |
|
a per-repo release script |
|
A |
|
copying another repo’s two jobs |
|
The lanes’ uploads as one flat directory of release files |
|
a per-repo |
|
Every library a bundle’s ELFs need, copied into it (Linux) |
|
a per-repo |
|
Models and scenes a lock pins: cache, hash checks, atomic writes, the scene stamp |
|
a per-repo fetcher in bash, PowerShell, Python or CMake |
|
A bash suite’s asserts and its exit code |
|
an |
|
Parseable ELF64 and gst-inspect test inputs |
|
a second ELF byte writer or gst-inspect heredoc |
|
The family image’s pinned Python in a consumer check |
|
a local |
|
Linux packaging (tar, deb, AppImage, Flatpak) |
|
bespoke packaging |
|
CI job plumbing |
|
hand-written |
|
Linting workflows locally |
|
bootstrapping your own |
|
The agentic loop |
config and runner templates |
writing one from scratch |
|
Bash helpers: logging, retry, SHA-checked downloads, parallelism |
|
new implementations |
Two caveats:
A module’s own imports are private to it.
WindowsBuild.CommonimportingWindowsScripts.Shareddoes not re-export it to you. Import each module you call into directly, or the first run of that code path stops with “command not found”.Change the hub, not a local copy. The same owner may edit this repo, but every consumer reads it: change it here, push, then move the consumer’s pin.
The rest of the naming rules, in one place#
Small decisions that were folklore until 2026-09-15, one line each.
Version file. Where a repo has one, it is
VERSION.txtat the repo root, the default every entry point of02-toolchain/rust/version_util.shfalls back to. A repo whose ecosystem already carries the version (apyproject.toml, apubspec.yaml, a workspaceCargo.toml) does not add a second one.CHANGELOG (owner, 2026-10-20). A repo with a release keeps
CHANGELOG.md, becauserelease-publish.ymltakes each release’s notes from its## <version>or## [<version>]section; one without a release (jotrockenmitlocken) needs none. A package published to a registry (PyPI, pub.dev, crates.io) keeps it at the package root, which the registry renders. ModelANT and AssetANT release per asset, with notes from itsmodel.jsonorasset.json, and keep none.Instruction file.
AGENTS.mdis the only instruction file. Anything an agent-specific tool wants at its own path (.github/copilot-instructions.md,CLAUDE.md, a.cursorrules) is a two-line pointer toAGENTS.md, never a second copy: the copies drift, and the one nobody re-reads wins.Sphinx layout. Consumers keep their Sphinx sources under
docs/source/, which isdocs-build.sh’s default. This hub and DocumANTation are the exception: they keepdocs/conf.pybeside the pages.Package names. A package name is unique within its registry. Reusing one across registries is allowed only when the two artifacts are the same capability in two languages, and the reuse is recorded here. There is exactly one:
kataglyphis_inferenceis OxidANT’scrates/inference(an ONNX Runtime Rust crate) and AccelerANTgine’s staged Python binding around the same C++ inference path. Neither is published, the registries are disjoint, and they are two faces of one capability, so both keep the name. A third use, or a publish, reopens this.Environment-variable prefixes.
KATAGLYPHIS_*for build/tree knobs shared by every family repo,ANTFRASTRUCTURE_*for knobs that configure this hub’s own machinery (the pin suite, the shared-config sync),AGENTIC_*for the agentic loop, and the repo’s own name for consumer-private knobs (ORCHESTRANT_*). The hub’s registry gate (code-quality-tooling.md§env-knobs) grades the hub’s own knobs against that vocabulary.Workflow files. Kebab-case, one per platform and arch, display names
<Platform> <Arch> · <what>: § 6, Workflow file names and display names.
The git hooks, by reference#
One config line per clone, run from its top level, and no copied file:
git config core.hooksPath "$PWD/third_party/ANTfrastructure/shared/linux/templates/git-hooks"
The path is absolute (owner decision 2026-11-19, CON269): a relative one resolves inside each
working tree, so a linked worktree whose hub submodule is not checked out finds no hooks
directory, and git commits without a word. With the absolute path the main clone’s hooks run
there too, and the repo’s bootstrap checks out the submodule or stops with its
git submodule update hint. A clone that moves sets the line again.
That directory holds a pre-commit and a pre-push. Each calls the repo’s own
scripts/linux/run-lint-gates.sh when the repo has one, so the flags that wrapper passes
(--ratchets, --agents-drift, --exclude) apply, and the bare
run-lint-gates.sh <root> only when it has none. The wrapper must pass its arguments on ("$@").
Hook |
Runs |
Measured 2026-11-12 and 2026-11-13 on a Raspberry Pi 5 |
|---|---|---|
|
|
2.4 to 3.0 s, one staged file in a clone of OxidANT; 5 to 16 s in a clone of OrchestrANT with all four cores busy |
|
|
127 to 188 s in the clone of OxidANT and 47 to 84 s in the one of OrchestrANT, beside other builds |
The commit hook leaves every whole-tree gate to the push, mutation staleness included. Both check
shell line endings: the commit hook the staged bytes, the push hook the working tree.
The push hook reads the working tree, not the pushed commits, and prints how many paths are
uncommitted. It checks nothing when the push updates no ref or only deletes refs. A run by hand
without a terminal (git hook run pre-push) hands it no ref either: run the wrapper to check by hand.
The extension point. scripts/linux/pre-push-checks.sh is the one place for what a repo
checks before a push beyond lint, for example the script suites its CI lint lane runs. The contract:
The hook runs
bash scripts/linux/pre-push-checks.sh, without arguments, from the top level of the repository, after the lint gates passed. Failed gates stop the push before it runs.Exit code 0 lets the push continue. Any other exit code stops the push, and the hook prints it.
Standard input is
/dev/null.GIT_DIR,GIT_WORK_TREE,GIT_INDEX_FILEandGIT_PREFIXare unset, so agitcall in a test fixture acts on the fixture and not on the repository.It reads the working tree, as the gates do. The hook sets no time limit.
The file needs no executable bit. CI does not call it: let the CI step it mirrors call the same file.
A host without a tool the image has (CON277): when the run fails and its output says
prerequisite missing:(the harness’st_skip_unlesson Linux), and the clone setsgit config kataglyphis.imageRunner "<command> --", the hook runsbash scripts/linux/pre-push-checks.shonce more through that command, and that run decides. A real failure, or a clone without the setting, stops the push as before. On a Raspberry Pi dev host with no node, the runner is its CI-image wrapper, for examplepi-ci --(notpi-heavy, whose lock the push already holds).
Bypass. git commit --no-verify and git push --no-verify skip the hook. Run
scripts/linux/run-lint-gates.sh by hand before the push then.
A clone without the config line gets one line from every local run of the gates:
run-lint-gates.sh: WARNING: core.hooksPath is unset in <root>, …, and a clone that still has the
relative line gets … core.hooksPath is relative in <root> … with the absolute line to set. CI
(CI set) gets none, and neither does a clone whose core.hooksPath names any other directory.
A repo that keeps its own hooks directory calls these from its own hooks, a pre-commit before
it unsets GIT_INDEX_FILE:
exec bash third_party/ANTfrastructure/shared/linux/templates/git-hooks/pre-push "$@".
pre-commit install (the pre-commit framework) refuses to run while core.hooksPath is set, so a
clone has that framework’s hooks or these, not both.
Both files are tracked executable. Git skips a hook that is not, and says only
hint: The '…/pre-commit' hook was ignored because it's not set as executable.
The hooks are not a shared-assets.manifest row: a copied hook is a fork nobody re-syncs, and
a stale hook is invisible because it keeps passing. The hub’s own versioned hooks under
linux/host-config/git-hooks/ are a different pair: they cd into the hub layout, gate this
repository’s internals, and stay hub-only.
9. Quality gates#
Every gate the hub runs over itself has a consumer-facing half; a consumer wires the items below and gets all of it. The lanes below are required. The consumer lanes gate fails a repository that does not call one its tree needs:
The shared-asset manifest.
.antfrastructure-shared.manifestat the consumer root declares which hub-owned files the repo holds a copy of (configs, the two bootstrap templates);bash third_party/ANTfrastructure/shared/config/sync-shared-config.sh --repo-root . --checkis the drift gate,--writerefreshes. The registry of asset ids and the rules are in../shared/config/README.md.The lint aggregator.
bash third_party/ANTfrastructure/linux/scripts/run-lint-gates.sh .runs shellcheck, actionlint + CI image refs, gitleaks (with a self-test), ruff, the manifest drift check, the consumer pin-forwarding check, the README length and badges, and the stale-recipe check of item 7, the linters from pinned and SHA-verified binaries:shared-script-libraries.md§ run-lint-gates.sh. Keep a ~5-linescripts/linux/run-lint-gates.shwrapper so the dev-box command and the CI step are the same string, and call the reusable lane from CI:jobs: lint: uses: Kataglyphis/ANTfrastructure/.github/workflows/lint-gates.yml@develop(inputs:exclude,submodules,hub-checkoutfor a consumer without a submodule,allow-empty-shellfor a repo with no tracked shell). Add--ratchets(the lane’sratchets: true) once the eight<gate>.allowfreeze files are seeded and committed; that switches on the measurement gates (code size, complexity, dead functions, comment size, stdout returns, masked declarations, trailing conditionals, shellcheck warnings) over the consumer’s own shell. The same step grades the consumer’s pages against the hub’s (doc-dupes --against-hub), off untildoc-dupes-hub.allowis committed. The lane uploads a duplication report from ignoredlogs/code-quality/by default;code-dupes: truemakes the same scanner fatal once findings are removed.The pin suite.
Submodule.Pins.Tests.ps1asserts every submodule sits at its recorded, remotely reachable commit; consumers calluses: Kataglyphis/ANTfrastructure/.github/workflows/submodule-pins.yml@develop(the AGENTS.md template’s § 3 names the suite) instead of copying the job.hub-checkout: trueobtains the suite separately when the consumer has no hub gitlink and still checks the consumer’s own submodules. Use that path when this hub already vendors the consumer; mutual submodule links create a recursive cycle. The generated-artifacts suite,shared/windows/tests/Repo.GeneratedArtifacts.Tests.ps1, fails on a tracked file that.gitignorealso excludes, and on one under the repo’s generated-output pathspecs inscripts/windows/generated-artifacts.txt(one per line,#starts a comment). Run it withrun-pester-suite,path:set to that suite underthird_party/ANTfrastructure/, on a Windows runner checked out withsubmodules: true. A wildcard pathspec ending in/(**/__pycache__/,build*/) matches no file in git, so the suite refuses it: write**/__pycache__/*. A pathspec git rejects, such as../build/, fails the suite too, since it would make git check none of the others. The action also runs consumer Pester suites and fails if none of their tests pass, including when every test is skipped. The separate PowerShell quality workflow does not run them.Python repos get the whole CI surface from the reusable
python-ci-linux.yml/python-ci-windows.ymlworkflows:python-ci.md.The docs gates take
--roottoo (2026-09-15).doc-linksruns in the--ratchetsstep (it has no freeze file, so it is safe the first time) and grades every tracked Markdown page, which puts a consumer’s ownREADME.mdinto the cross-reference graph.doc-dupesandcode-dupestake--rootas well, with budgets at<root>/doc-dupes.allowand<root>/code-dupes.allow. Existing duplication is reported without a budget; remove it before enabling the strict gate. Do not add new freeze rows for adoption.Every consumer can measure code quality automatically by calling
code-quality-report.yml@develop. Its size, complexity and duplication reports are artifacts under ignoredlogs/code-quality/measurements/; broken scans fail. Python files can get a reviewable safe Ruff patch throughpython-refactor.yml@developwith a trackedpathinput. No workflow commits the patch. Callpython-static.yml@developon push and pull request for uv-locked Ruff and ty reports over tracked Python; expose itsstrictinput for a manual fatal run.Mutation recipes stay in the consumer, but
mutation-gates.yml@developruns them with a trackedmanifestand optional trackedsetup-script. Missing recipes and empty shards fail rather than passing without a test. Recipe targets must be normalized relative paths within the caller root. Setup runs once in each disposable test copy, so a script such asuv synccan create that copy’s.venv.in-image: trueruns the recipes inside the family CI image instead of on the bare runner, with the pinned Python and the chain-built wheels a recipe on that Python needs. The lint aggregator fails on a stale recipe in every trackedscripts/linux/tests/*mutations*.json; a manifest kept elsewhere is checked by its mutation lane only.PowerShell-only consumers call
powershell-quality.yml@develop; it runs PSScriptAnalyzer and complexity overlint-pathrooted at the caller and uploads JSON.strict: truemakes complexity findings fatal when the consumer has removed its debt.
Still hub-only: the hub’s own git hooks; consumers get the pair of § 8 (The git hooks, by reference).
Checklist#
[ ] Submodule added;
Resolve-BuildModule.ps1copied[ ] The repo listed in the hub’s
.github/consumers.json(a hub commit), so the consumer inventory sees what it uses[ ] Entry points named and shaped as in § 8
[ ] Windows build script built on
WindowsContainerBuild.Reuse, ending in a delivery check (where the consumer has a Windows lane)[ ] Linux build uses a container-native build dir and a cargo cache volume
[ ] No consumer copy of anything that exists upstream (check before writing) — the manifest drift gate and the lint aggregator of § 9 are the mechanism
[ ]
.antfrastructure-shared.manifestdeclared;sync-shared-config.sh --checkgreen[ ]
run-lint-gates.shwired as a wrapper and as the reusablelint-gates.ymllane; ratchets on with freeze files committed[ ]
code-quality-report.ymlwired;/logs/ignored;python-static.ymlandpython-refactor.ymlwired when Python is tracked[ ] PowerShell quality and mutation workflows wired when those languages and recipes are present
[ ]
submodule-pins.ymllane called (any repo with a submodule;hub-checkout: trueif the hub is separate)[ ]
core.hooksPathpointed at the absolute path ofthird_party/ANTfrastructure/shared/linux/templates/git-hooks(§ 8)[ ]
BACKLOG.md+ loop config + thin runners in place, prompts left upstream[ ] Role prompts are overlays only;
.opencode/agents/gitignored, never hand-edited[ ] Workflows call the composite actions, FTP publishes through
deploy-over-ftp[ ] A Windows lane whose logic lives in one build script is a thin caller of
container-ci-windows.yml(§ 6)[ ] Workflow files and display names follow § 6 (
linux-x64.yml,Linux x64 · …)[ ] Consumer AGENTS.md links to these docs instead of restating them
When the push is refused#
main is usually protected, so the merge of
Resolving a submodule conflict on merge cannot be
pushed directly. Do not force it; put the result on a branch and open a PR:
git push origin main || {
git branch overwrite-main-from-develop
git push origin overwrite-main-from-develop
}
Repointing a remote#
After a rename, a transfer, or moving from HTTPS to SSH:
git remote set-url origin git@github.com:<org>/<repo>.git
git remote -v