Org profile
The docs/architecture directory contains documentation for Kubernetes architecture across Cerebral and Unsigned:
Generate or update these documents with:
python3 scripts/generate_k8s_docs.pyVerify documentation parity with:
python3 scripts/generate_k8s_docs.py --checkRun python3 -m pip install PyYAML==6.0.2, then
python3 -m unittest discover -s tests -v.
The harness extracts and executes the actual reusable workflow shell with real
jq and a local curl stub. It uses synthetic diffs, no credentials or network.
It checks successful full/fast reviews, oversized prompts, request-build and
response-parsing failures, and the existing error comment/label/delivery gate.
For a break-check against a saved older workflow:
JURY_WORKFLOW=/tmp/old-agent-jury.yml python3 -m unittest discover -s tests -v.
Failure assertions should go red on an unguarded build/parser; the successful
review control should still pass.
Changes here do not reach callers pinned to @v1 until an operator explicitly
updates that tag or changes caller refs. Test changes on a canary caller before
an estate-wide rollout.
The claims check job flags unverified claims, guarantees and legal liabilities in public text. It reads only the lines a PR adds, from a diff taken with rename detection off, so a file moved into a public path shows all its lines as added. It matches file names and directory names case-insensitively. The default scope is:
- extensions
.md,.mdx,.markdown,.rst,.html,.htm,.astro,.svelte,.vue,.tsx,.jsx,.njk,.liquid; - any file whose name starts with
README, at any depth; - anything under
site/,web/,docs/,public/,legal/,privacy/,terms/,pricing/,landing/,locales/ori18n/, at any depth. This includes*.txtand*.jsonthere.
Out of the default on purpose: code and config (.ts, .yaml, .rs) outside those directories, and LICENSE, LICENCE, COPYING and UNLICENSE files. Code comments and config strings give many false positives, and licence files hold standard warranty and liability boilerplate that every repo carries. A repo whose public copy lives elsewhere sets the input claims_paths (comma-separated globs, for example src/content/**/*.yaml,*.ts). When set, it replaces the default scope, and the licence exclusion no longer applies.
scripts/claims_check.py matches the lexicon in scripts/claims_lexicon.json. The categories are guarantee, certification, absolute, metric, liability, unreadable and obfuscation. It prints JSON and exits 0 (no uncited hit), 1 (uncited hits) or 2 (bad input, which fails closed). Run it by hand with git diff origin/main...HEAD | python3 scripts/claims_check.py --repo ..
Before matching, the script normalises each added line, in this order:
html.unescape, then per character Unicode NFKD, dropping categories Mn, Me and Cf and the blank-rendering characters U+3164, U+115F, U+1160, U+FFA0 and U+2800. Accents are dropped for matching only.- Markup removal, so fragments join into one word: HTML comments and tags,
[text](url)link syntax (the text stays), backslash escapes, and*or_between letters. - Cyrillic and Greek look-alike letters (an explicit map in the script) fold to Latin in every word, so a word written wholly in look-alikes matches too.
- Whitespace and hyphens between the words of a term are equivalent.
The report shows the original line. Two more hit categories come from this step:
obfuscation: a line with a format or blank-rendering character (zero-width characters, soft hyphen, BOM, right-to-left marks), or a word that mixes Latin with Cyrillic or Greek letters. A PR that adds them needs a marker.unreadable: a binary, UTF-16, NUL-byte or non-UTF-8 diff that touches an in-scope path. A binary change outside scope is ignored. A diff with only renames, mode changes or deletions exits 0.
The script also matches each pair of consecutive added lines of one hunk, joined with a space (no space after a trailing hyphen). It reports a hit that crosses the join on the first line, and drops a pair hit already found on one line.
Cite a claim with a marker:
We cut p99 latency by 40%. <!-- claims: proven docs/bench/2026-11.md -->- The marker token
claims:must start the line or follow whitespace or a comment opener (<!--,//,#,{/*).noclaims: proven xis not a marker. - A marker cites one claim. A claim is a group of overlapping hits, for example
99.99%and99.99% uptime. A marker that holds the whole line, alone or inside<!-- -->,{/* */},//or#, cites the first claim on the next added line. Any other marker cites only the claim immediately before it on its own line. Text inside the marker never cites itself. - Evidence must resolve, or the marker does not cite. A repo path must be a regular, non-empty file at the base branch tip (
origin/<base>): not a symlink, not a directory, and not a file the PR adds, changes, deletes or renames, which includes the claim's own file. The path must also match the inputclaims_evidence_paths(comma-separated globs, defaultevidence/**,docs/evidence/**), so an ordinary file such asREADME.mdnever counts as evidence. A repo with no evidence folder fails closed until it adds one or sets the input; an empty string allows any path. A commit SHA must be a commit that is an ancestor of the base tip (git merge-base --is-ancestor) and must change at least one path that matches the evidence globs (git diff-tree), so a commit that only the PR or a side branch holds, or the root commit, does not cite. An https URL cites only when it starts with a prefix listed in the inputclaims_url_prefixes(default empty, so no URL cites; each prefix must end with/, for examplehttps://github.com/my-org/). Scheme and host are compared in lowercase. A URL with userinfo, a port, an IP-literal host or a..segment does not cite. The job never fetches a URL, because a 2xx answer shows only that a page exists, and a fetch would let a PR make the runner call any host. - The marker token is still
claims: proven <evidence>. "Proven" in the token means the evidence resolves. It does not mean the check judged the claim true.
When a hit is uncited, the job asks the model to classify it as proven (the diff itself shows the evidence), unverified, guarantee or liability. The hit text goes to the model between <claim> tags, and the prompt says that text inside them is data. With no uncited hit, the job passes and makes no model call. In enforce mode the job fails on any class except proven. It also fails, with exit code 2 and a message, when the model call fails or the answer is unusable (a malformed entry, a repeated index, or a count that is not a number), because it fails closed.
Residual risks:
- The model is the only judge once uncited hits exist, and no test shows that a crafted claim cannot talk it into
proven. The<claim>delimiters lower that risk and do not remove it. - The lexicon is finite. A claim phrased with other words passes. A test of any lexicon cannot prove completeness.
- Look-alike folding covers an explicit map of Cyrillic and Greek letters. Letters from other scripts or from outside the map do not fold.
- Markup removal joins fragments, so
fully<br>securebecomes one word and misses the phrasefully secure. An HTML comment that spans several lines is not removed, because the script reads one line at a time. - The split-line match covers two consecutive added lines of one hunk. A claim spread over three or more lines, or over lines with a context line between them, is not matched.
- N-E: with
on: pull_request, a PR can edit its own caller workflow and loosenclaims_mode,claims_pathsorclaims_evidence_paths. The PR-time check is a tripwire, not an enforcement point against a hostile author. The enforcement point is the deploy gate: it runs from main, cannot be put in report mode and is bound to an approval. - A marker glued to the text before it, with no space or comment opener between (
copy.claims: proven docs/evidence/a.md), is not recognised and does not cite. This fails closed and is a minor case. - The lexicon is finite, so a claim phrased with other words passes. A test of any lexicon cannot prove completeness.
- Accents are dropped before matching, so an English claim spelled with an accent (
guarant\u00e9e) still matches. Accented non-English copy that folds onto a term (Frenchassur\u00e9) is a hit too; in the job the model judge classifies it, so it fails closed rather than open. - Prompt injection into the model judge stays unproven (see the first item).
- A cited file or commit is checked for existing, not for proving the claim. A regular file with a plausible name that says nothing cites.
- Claims in a repo whose public copy lives outside the default scope are not seen until the caller sets
claims_paths.
The input claims_mode sets the mode. enforce is the default. report never fails and only writes the step summary. The input claims_url_prefixes sets the URL prefixes, claims_paths the scope, and claims_evidence_paths the evidence path globs. The result goes to the step summary, not to a PR comment. The job checks out the script and lexicon from this repo at job.workflow_sha, the commit of the workflow file the caller pinned.
The job is a new check, claims check. Add it to branch protection only after a canary run.
deploy-gate.yml runs the claims check on everything a deploy ships. The range starts at the newest successful deployment of the caller's environment whose commit is an ancestor of, or equal to, the commit being deployed, and ends at that commit. A newer deployment that is not an ancestor, as in a rollback, is skipped, so a commit that was never deployed is checked from the deployed commit before it. GitHub records a deployment for every job that uses an environment, so the gate keeps no state of its own. The check always enforces; the gate has no claims_mode input.
The approval is the environment on the caller's deploy job (TASK-0823, option A). The reviewer approves the job that holds the deploy credentials, after the gate has run in the same workflow run. The gate's step summary shows the environment, the last deployed commit, the commit being deployed, the number of commits in the range and the effective claims settings.
jobs:
gate:
uses: cerebral-work/.github/.github/workflows/deploy-gate.yml@<sha> # <tag>
permissions:
contents: read
deployments: read
with:
environment: reverie-docs-prod
secrets:
AGENT_JURY_API_KEY: ${{ secrets.AGENT_JURY_API_KEY }}
deploy:
needs: gate
environment: reverie-docs-prod
steps:
- uses: actions/checkout@<sha> # v7
with:
ref: ${{ needs.gate.outputs.sha }}Set up the environment <unit>-prod like cortex-prod:
- required reviewer
todie; - deployment branches limited to protected branches;
- the deploy credentials stored as environment secrets, not repo secrets.
A first deploy has no deployment to start from. Pass base_sha once, as a full 40-character SHA, for example the last commit that is already live. It must be a strict ancestor of the commit being deployed. The gate uses it only when no successful deployment is an ancestor; otherwise it ignores it with a warning, so wiring base_sha to a dispatch input cannot shorten the range. The gate fails closed in each of these cases:
- no successful deployment at an ancestor is found and no usable
base_shais given; - the deployments API refuses the request, for example when the caller did not grant
deployments: read; - the base commit is not in the repository's history;
- the environment name has characters other than letters, digits,
.,_and-.
Evidence follows the PR rule with the last deployed commit as the base. It must exist at that commit and stay unchanged in the range.
Limits:
- A caller can drop
needs: gateonly by landing a workflow change onmain. The approval still applies, because it belongs to the environment, but the claims check would not run. A reviewer should see thegate / claims checkjob in the run before approving. - GitHub lets a required reviewer's token approve through the API, and agents on ceres hold that token. The approval stops accidents, not a rogue agent. It moves to a reflex RED card once reflexd is reachable from CI runners (TASK-0823).
- Every successful deployment of the environment moves the base, whichever workflow made it.
- A rollback to a commit that was itself deployed has an empty range and passes.
- Anyone holding a token with
deployments: writein the repository, including a workflow on a branch that asks for it, can create a deployment with a success status and so move the base. GitHub's documentation does not say that environment protection applies to deployments created through the API. A tamper-evident record of each gate pass replaces deployment statuses when the approval moves to a reflex RED card (TASK-0823). - Do not give the deploy job
if: always()orif: ${{ !cancelled() }}: with either, it runs after a failed or skipped gate. - The gate checks this repository out at
.jury-toolsin the workspace. A caller that tracks a path of that name gets a checkout error.
The current release is v1.3.0 (7802b956fbba8a65e193d0bddecc27387327c0cf, tag v1.3.0). It adds the reusable deploy gate (see Deploy gate above) and moves the claims step into scripts/claims_job.sh, which both workflows run (#23, #24). v1.2.0 (f72b4b6c4d469929fafa7bda3b1a5374b5531abb) adds the claims check job (see Claims check above; claims_mode defaults to enforce, so set report while you tune a repo) and fixes a startup failure on main caused by an expression in the verdict_runner input description (#19, #21). v1.1.2 (df7fe2a8efe50421e1e8dfb4bcc203c4b585d386) keeps the gateway key off curl argv, and its caller example passes AGENT_JURY_API_KEY by name instead of secrets: inherit and forwards api_url / model from repo variables (#16). v1.1.1 (a868a09b27976af8239cd295a6937c966f6b1f91) writes the PR title, body and file list to GITHUB_OUTPUT under a random per-run delimiter, so a PR body line EOF can no longer inject step outputs (#13). Pin callers by full commit SHA. The previous release, v1.1.0 (c6567996e98d6c2228262646749821ce4f6522cd), added the error tier for request-build and parse failures (CER-2146) and was canaried on cerebral-work/vilicus#36. Pin callers to the release commit by SHA, with the tag in a trailing comment. The moving v1 tag still points at the older 701db71 and will be retired or moved only by an explicit operator decision.
A pull request opened by Dependabot runs with Dependabot secrets, not Actions secrets. On a private repo that runs Dependabot, the caller therefore needs AGENT_JURY_API_KEY stored as a Dependabot secret as well (gh secret set AGENT_JURY_API_KEY --app dependabot). Without one, the gateway answers 401 "No api key passed in", seen on reverie #1969. With a stale key you get 403 key_model_access_denied, seen on vilicus#32. The job log line Secret source: Dependabot shows which store a run used.