Aramid is a git-hook-driven security and quality gate for a repo, backed by a persistent findings ledger. A deterministic gate runs at commit/push time (gitleaks, semgrep, ruff, tests, dependency audit, etc.), classifying each finding as a hard BLOCK or a soft WARN and enforcing a no-new-warnings ratchet so a repo can only get cleaner over time. On top of that, a Phase 2 "red-team drain" triages risky commits in the background and runs deeper, slower analysis against them on a schedule — an LLM code reviewer, mutation testing, fuzzing, and passive DAST — without ever slowing down a commit or push.
This guide walks the journey of adopting aramid on a repo you own: install, onboard, understand the gate, handle findings day to day, turn on the background drain, wire up its consumers, graduate out of bake periods, and integrate with CI.
Onboarding a Repo — aramid init
The Deterministic Gate on Commit/Push
Running Checks On Demand — aramid check
Understanding & Handling Findings
Diagnostics — aramid doctor and aramid update-rules
The Phase 2 Red-Team Drain
The Bake-Then-Arm Model
Compatibility Promise
Aramid ships a console script, aramid (from the package's [project.scripts] entry point), and an identical module form, python -m aramid , which behaves the same way — this is in fact what aramid's own installed git hooks call internally, not the console script.
Once the package is available on your interpreter, confirm it:
(the installed version; the latest release is on PyPI ).
The real prerequisite isn't the Python package so much as the external scanning toolchain aramid drives (gitleaks, semgrep, ruff, pip-audit). Check and provision that :
If gitleaks or semgrep (the two BLOCK-tier tools) are missing, doctor exits 2 . Let it fix what it can:
--fix runs pip install --upgrade for the tools aramid owns ( ruff , semgrep , pip-audit ) into the current interpreter, and, when gitleaks is missing, downloads a pinned gitleaks v8.30.1 release binary into ~/.aramid/tools/ (sha256-verified against a hardcoded checksum table before it's ever trusted/executed), then re-probes. It also replaces aramid's own copy there when that copy is at another version than the pin; a gitleaks on your PATH is yours, and is never replaced. See section 6 for the full doctor picture.
aramid init ( section) itself gates on doctor : if a BLOCK-tier tool is still missing, init refuses outright (exit 3 ) rather than arming hooks against a toolchain that can't actually run.
2. Onboarding a Repo — aramid init
From inside (or pointing at) the repo you want to protect:
or, targeting a path explicitly:
init resolves the given path to its git repo root and refuses (exit 3 ) if it isn't inside a git repo at all.
To onboard every nested repo under a directory in one pass:
--discover walks up to 3 levels deep looking for directories containing .git , skipping node_modules , _tools , .venv , .git , __pycache__ , .aramid , .cache , graph-out , and anything matching .graphite* , and runs the full single-repo flow on each one it finds, returning the worst exit code seen across all of them.
What a single-repo init does
Gates on aramid doctor — refuses (exit 3 , no partial state written) if gitleaks or semgrep is missing.
Writes aramid.toml only if it doesn't already exist — an existing config is never touched. The fresh stub sets semgrep_block_armed = false and bake_started = .
Always regenerates ARAMID.md .
Writes a marker-fenced, aramid-managed instruction block into CLAUDE.md and AGENTS.md (creating them when absent) so agent coders meet the gate before their first commit, not at their first blocked push. Content outside the / fence is never touched; a damaged fence (no closing marker) refuses the write with a notice. Both files are tracked, so teammates' agents inherit the block on pull.
Registers aramid's SessionStart and PreToolUse hooks in .claude/settings.json (merging, per event: entries belonging to other tools are preserved intact; aramid's own entries -- identified by aramid agent-hook in their command -- are rewritten to the current template; an unparseable file is reported and never written). Claude Code adds the SessionStart hook's stdout to each session's context, so agent sessions in the repo open with live gate posture: open findings, skip streaks, bake states, and the commands to use. PreToolUse screens every Bash/PowerShell tool call for a git hook-bypass invocation ( --no-verify / -n on commit, --no-verify on push, or a -c core.hooksPath=... wrapper) -- advisory while baking, rejected once aramid arm --agent runs (see section 9 ). Both hooks are fail-open everywhere -- outside an onboarded repo, or on any internal error, they print nothing and exit 0.
Appends any missing .gitignore entries: .aramid/ , graph-out/ , .graphite* , .cache/ .
Installs idempotent git hook shims for pre-commit , pre-push , and post-commit . If a foreign hook already exists at one of those paths, it's chained to .aramid-chained rather than clobbered. Another managing tool's hook (one carrying a # >>> managed >>> marker, such as graphite's) is never chained, because that would run both tools' gates twice. Its slot is left alone. If that hook names exactly one file beside it (graphite's post-commit names post-commit.local , and runs it), aramid installs its post-commit triage shim there, and aramid uninstall removes it again. aramid takes that name from the hook's text, from its lines that are not (a line is one whose first character other than a space or a tab is # ), and does not check that the hook runs it: a name in an echo , a trailing or a branch that never runs still counts. A pre-commit or pre-push gate is never placed in another tool's chain, because the tool may ignore that file's exit and the gate would then never block. If another tool put it there itself (its hook holds the slot and runs aramid's shim from beside it), init and doctor call the gate armed but its blocking unconfirmed, and name that hook to check: aramid does not read what it does with the gate's exit. That is a warning; no exit code changes. When a hook cannot be installed, init says so and exits 3 . aramid doctor names what does work: for post-commit , install aramid first (move the other tool's hook aside, run aramid init . , then re-run the other tool's installer).
Registers the repo in the machine-global registry (this is what makes it a candidate for aramid drain --all later).
Runs a one-time full-history gitleaks scan ( git log --all ), recording any hits as historical, non-blocking findings — a secret that's already in history doesn't suddenly block your commit, but it is now tracked until retired — ledger mark-rotated for a real leak, ledger mark-not-a-secret for a false positive (see section 5 ).
Writes the ratchet baseline once, guarded so a re-run of init never resets it.
Validates that the installed hook shim files exist and carry aramid's marker.
Prints a summary: repo root, scan scope, any nested-repo exclusions, detected stack, whether hooks are armed, baseline finding count, and historical secret count.
The hooks it installs
Two parts of those commands are load-bearing, and a shim missing either one is not the shim init wrote:
-P keeps the current directory off sys.path . Without it, python -m aramid imports from the repo root first, so an aramid.py (or an aramid/ package with an __init__.py ) committed there would run in place of the installed aramid — inside the very gate that is checking the repo.
ARAMID_HOOK= tells the gate that git is on the other end of stdin, so the pre-push gate may read git's ref lines (see "What the pre-push gate certifies" in section 3 ). Run by hand or in CI there is no such marker and the gate does not read stdin.
The pre-push shim also passes on the remote's name, which git hands the hook as $1 , as ARAMID_PUSH_REMOTE . The gate reads it only under the marker. It decides which remote's default branch a finding's content is judged against when the gate asks whether that content has left the repository. A shim without it still gates; the gate then guesses origin , or the only remote with a known default branch.
Shims written by an older aramid lack one or more of these; re-run aramid init after an upgrade to regenerate them (idempotent). Until you do, aramid doctor reports a pre-push shim that another tool's hook runs as stale.
These three are git hooks -- they run outside of, and are invisible to, an agent coding session. init separately registers a second, unrelated kind of hook: Claude Code SessionStart and PreToolUse hooks ( aramid agent-hook session-start / pre-tool-use ) in .claude/settings.json . SessionStart gives an agent opening a session in the repo live gate posture -- open findings, skip streaks, bake states -- in its own context, before it ever touches a commit; PreToolUse screens each Bash/PowerShell tool call for a git hook-bypass invocation. Both find the repo with git; when git cannot be started (it is not on the hook's PATH), they find it from the nearest .git that sits beside an aramid.toml , and SessionStart says so in one line. aramid doctor grades both entries ( ok / absent / stale / tampered / unparseable ) and aramid status reports them on an agent surfaces: line; see section 6 .
To reverse onboarding later, aramid uninstall [path] removes the installed hook shims, deletes ARAMID.md , removes the .gitignore entries init added, removes the managed agent blocks from CLAUDE.md / AGENTS.md (deleting a file that held nothing but the block), removes aramid's hook entries from .claude/settings.json (deleting the file if nothing else remains in it), and deregisters the repo — but deliberately keeps the ledger ( .aramid/ ) so security/audit history survives; delete that by hand if you genuinely don't want it.
Hooks for repos created later — aramid hooks
init writes its shims into one repo's .git/hooks , and git neither commits nor clones that directory. A fresh clone of an onboarded repo therefore arrives with the committed aramid.toml and no hooks, and nothing says so. aramid hooks closes that gap for repos created on this machine from now on, through git's template directory:
install writes two shims, pre-commit and pre-push , into ~/.aramid/git-template/hooks/ and sets git's global init.templateDir to ~/.aramid/git-template . git copies that directory's hooks into every repo a later git init or git clone creates. git takes only one template directory, so if init.templateDir already names another one, install refuses (exit 3 ) and changes nothing: copy the two shims into that directory yourself, or unset it first. Running install again rewrites the shims from the current aramid and interpreter.
remove unsets init.templateDir only when it names aramid's directory, and leaves anyone else's alone. The shim files stay on disk, unused.
status prints installed when init.templateDir names aramid's directory and both shims are there, and otherwise not installed with the reason. remove and status always exit 0 (unlike aramid schedule status ), so a script has to read the line, not the exit code.
A template shim does nothing in a repo without an aramid.toml . It asks git for the top-level directory of the working tree ( git rev-parse --show-toplevel ) and exits 0 at once, running nothing, if git cannot say or if no regular file named aramid.toml is there; an aramid.toml in a subdirectory does not count. So the shims land in every new repo on the machine but gate only the repos that have one, a file an onboarded repo commits; a clone of such a repo is gated from its first commit. There they run the same gate as the shims init writes: check --gate pre-commit or check --gate pre-push , with -P and ARAMID_HOOK , and the same exit-code mapping as the table above. The interpreter baked into them is the one that ran aramid hooks install , with the same py -3 fallback.
What the template does not do:
It reaches new repos only. git reads the template when it creates a repo, so repos already on disk never get these shims; run aramid init in them. A repo keeps the copy it was created with, so rewriting the template later does not change it.
It runs no triage, and ignores [hooks].pre_push_match_ci . There is no post-commit shim, and the pre-push shim always runs plain check --gate pre-push .
It does not onboard the repo. The registry entry that makes the repo a candidate for aramid drain --all , the one-time history scan and the agent hooks come only from aramid init .
When you run aramid init in a repo the template seeded, it recognises the template shims as its own (they carry aramid's # >>> aramid managed >>> marker) and rewrites them in place as the shims in the table above, adding post-commit ; it does not chain them as foreign hooks.
3. The Deterministic Gate on Commit/Push
Once hooks are installed, every commit and push runs a fixed set of runners per gate:
Each runner also has to be applicable to actually run: ruff only if the repo has a Python stack, eslint only if it has a JS stack, typecheck only if a tsconfig /mypy config is present (and mypy is handed only the in-range Python files inside the repo's own [tool.mypy] files / exclude , when set -- what the gate types is what the repo types), deps only if a package manager, a requirements*.txt , or a pyproject.toml with a [project] table exists (pip-audit audits the requirements files when there are any, else the pyproject's declared dependencies in project-path mode -- 40 s at pre-push; a pip-audit run that writes no report is run once more and then counts as crashed, with pip-audit's own error line as the reason, so it is never a clean audit and closes nothing, and the same holds for an npm, pnpm, yarn or cargo-audit run that exits 1 (their "vulnerabilities found") with nothing on stdout, or replies with an error object; a tool-only pyproject is not a dependency source, and doctor says so when a Python repo has nothing to audit), tests only if a test suite is detected (or [tests].command is set). gitleaks and semgrep are always applicable. A runner that isn't applicable is simply never selected — it never counts as "degraded."
aramid doctor tells you whether the repo's own tools are where the gate looks. It prints a row for eslint when the repo has a JS stack and at least one JS/TS file outside node_modules (a package.json kept only for tooling gets no row), and one for tsc or mypy, whichever the typecheck runner runs here: tsc when tsconfig.json is at the repo root, mypy only otherwise. eslint and tsc are looked for at /node_modules/.bin and nowhere else, mypy on PATH . OK with a path means the file is there; doctor does not start these tools, so it does not see a missing eslint config or a broken tsconfig.json . MISSING means the check is not being made: at pre-push the tool shows as degraded, and a --strict gate refuses the push. For tsc that is every push; eslint and mypy are handed files, so it is every push that holds a JS/TS file, or a Python file in mypy's scope, and the row says so. A repo with both a root tsconfig.json and a mypy config gets a WARN row for mypy, because it is configured and never runs. None of these rows changes doctor's exit code, and --fix does not install these tools.
Runners execute concurrently, budgeted by [timeouts] ( pre_commit = 10 seconds, pre_push = 300 seconds by default); a runner still running past its budget is abandoned and recorded as TIMEOUT rather than joined.
Pointing the test gate at a fast subset
tests is BLOCK-tier, so a suite that overruns the budget degrades the block tier and blocks the push . Most mature repos have a suite too slow for a push gate — aramid's own takes ~15 minutes. Point it at a fast subset rather than living on --no-verify , which disables every other check too:
A string ( command = "pytest -q tests/unit" ) works too and is split POSIX-style; prefer the argv form on Windows, where POSIX splitting eats backslashes. The command is never run through a shell, so a string holding a shell operator outside quotes ( pytest -q && npm test , | tee , > log ) is refused: the tests gate degrades and the push is refused until the command is a list or names a script, and aramid doctor names the key and the operator. (Before 0.20.20 such a string ran its first program only, with the rest as its arguments.) Setting one also makes the gate work in repos whose layout detect_tests doesn't recognize (a make test wrapper, a suite under a subpath).
A program of your own repo is named by its path: command = ["./run-tests", "-q"] or ["tools/run", "-q"] , read from the repo root. On Windows the extension may be left out ( tools/run finds tools/run.cmd ). A bare word ( pytest , python , npm ) is looked for on PATH , in pip's script directories and in ~/.aramid/tools , and never in the repository, even when a file of that name lies in its root. aramid doctor tells you when a bare word names such a file, and what to write instead.
timeout_s cannot exceed the gate's wall-clock budget — the gate abandons the runner at [timeouts].pre_push regardless — so raise both if you need a longer run. aramid warns when they're set incoherently.
enabled = false removes the gate entirely (it then never counts as degraded either). aramid prints a notice on every run where that suppresses a real suite: a silently disabled block-tier check is worse than no check at all. Note that subsetting the push gate narrows what it covers — keep the full suite running in CI.
When aramid doesn't recognize your suite
Detection is literal, not semantic: it looks for a real test_*.py , *_test.py , or conftest.py file; a scripts.test entry in a package.json at the repository root; a .rs file in a tests/ directory, when a Cargo.toml sits at the root; or a *_test.go file, when a go.mod sits at the root. Nothing more. A custom pytest python_files pattern, unittest-style testfoo.py naming, a doctest-only suite, or a Rust crate whose tests are all inline #[cfg(test)] modules ( section 12 ) are all invisible to it. If that's this repo's suite and nothing else tells the gate what to run, the tests runner is simply never selected — not degraded, not a visible failure, just absent — so the gate can exit clean at pre-push without ever having run your real tests. That is exactly the "reports nothing for a reason indistinguishable from clean" failure class this whole gate exists to prevent.
aramid does print a stderr notice for this: every gate that runs the tests and recognizes no suite says the test gate ran nothing, and says so specifically when a plausible tests/ , test/ , pytest.ini , tox.ini , or [tool.pytest.ini_options] setup was found but nothing recognized inside it. If you see it, set [tests].command to point aramid at your suite explicitly (same escape hatch as above); don't rely on renaming files to match the detector instead.
Dual-stack repos: pytest AND npm
If aramid detects both a real Python test file ( test_*.py , *_test.py , or conftest.py ) and a package.json scripts.test entry, it runs both suites at pre-push rather than picking one — a gate that silently ran only half a dual-stack repo's tests would be exactly the kind of gap this tool exists to close. The combined result blocks unless both suites pass; a failing suite reports the ordinary tests-failed finding either way, not some separate dual-stack-specific rule. The same holds for any two or more detected suites: pytest, npm, cargo and go run one after another, in that order, and the push blocks unless every one passes.
The npm side only joins the run when a JS package-manager lockfile is present ( package-lock.json , pnpm-lock.yaml , or yarn.lock ). A package.json with a scripts.test entry but nothing installed behind it is common — linters, formatters, and git hook managers (prettier, husky) often ship one as boilerplate — so promoting every such repo to a second BLOCK-tier suite would manufacture false blocks on repos that never meant to run JS tests at all. Without a lockfile, aramid runs pytest only and prints a notice explaining that npm was skipped rather than silently dropping it; npm install (or pnpm/yarn) is enough to have it join on the run. This requirement affects only the dual-stack promotion — a JS-only repo (no pytest detected) still runs npm test with no lockfile required at all.
If any suite's own tool binary can't be found (not installed, not on PATH) within a run of two or more suites , the push blocks with an explicit tests-tool-missing finding rather than an unexplained degraded exit — see below. A repo where only one suite runs, and whose one tool is missing, still degrades the BLOCK tier the same way it always has (see section 6 ). aramid doctor catches that case before a push does: it resolves the tool the gate would run — pytest, npm, cargo or go, or the binary a configured [tests].command names — and exits 2 when a detected suite's tool cannot be resolved.
Security blocks, quality warns — but not uniformly
The classifier ( policy.classify ) is the single source of truth, and the split isn't one rule per tool:
gitleaks → always BLOCK .
ruff → BLOCK only for the curated rule set S102, S105, S106, S107, S608, S301, S302 ; everything else is WARN .
semgrep → two independent gates: pack-compiled rules ( aramid-regression.block.* ) follow [pack].pack_block_armed (default true ). OWASP block-list matches ( owasp-top-ten.* , *sqli* , *deserialization* , *command-injection* ) follow the top-level semgrep_block_armed (default false , i.e. baking). Anything else from semgrep → WARN .
pack-compiled rules ( aramid-regression.block.* ) follow [pack].pack_block_armed (default true ).
OWASP block-list matches ( owasp-top-ten.* , *sqli* , *deserialization* , *command-injection* ) follow the top-level semgrep_block_armed (default false , i.e. baking).
Anything else from semgrep → WARN .
tests-failed → always BLOCK .
tests-tool-missing → always BLOCK . Fires only when two or more suites run (any of pytest, npm, cargo and go), when one suite's own tool binary can't be resolved at all. A repo where only one suite runs, and whose one tool is missing, does not get this finding — it still just degrades the BLOCK tier with no finding to explain it: exit 2 normally, or exit 1 at pre-push specifically via policy.escalate_degraded (a pure tool-state check — unrelated to the new-findings ratchet), the same unchanged behavior as before this rule existed.
dependency tools ( pip-audit , npm , pnpm , yarn ) → BLOCK only if severity is at or above [deps].block_severity (default "critical" ); otherwise WARN .
llm-review → the classifier itself always returns WARN structurally; a confirmed-critical LLM finding can only become BLOCK later, at the pre-push gate, once [llm].llm_block_armed is set (see section 9 ).
shadow , tdd , red-proof and mutation → WARN until the tool's own arming flag is set, then BLOCK ; mutation-score → BLOCK only for its transition rule, once armed. The first three are aramid's own checks, described below .
ruff-inline , gitleaks-inline and semgrep-inline (rule inline-suppressed-block ) → always WARN , whatever block_rules says. Each reports a BLOCK-tier hit that the repo's own marker ( # noqa , gitleaks:allow , # nosemgrep ) hid from its tool ( section 5 ).
Everything else → WARN .
So apart from aramid's own checks and the mutation gates, only the semgrep rules (the pack's and the OWASP block-list's) and LLM findings are gated by an arming flag — gitleaks, the curated ruff rules, failing tests, and ≥critical CVEs block unconditionally, bake state or not.
The pre-push no-new-warnings ratchet
At pre-push only, any WARN finding that is new (never seen before in the ledger) is escalated to BLOCK . Five kinds are exempt: the dependency audit's deps-audit-shape-unrecognized rule and cargo-audit-warnings findings, which the push's author cannot fix by changing the push; the tdd and red-proof findings, which block only once armed ( section 9 ); and inline-suppressed-block findings, which never block, and which a repo meets all at once on its first run after upgrading ( section 5 ). The LLM and mutation ledger gates' findings ( llm-review , mutation , mutation-score ) are added after the ratchet has run, so it never escalates them either. pre-commit has no ratchet at all.
A WARN the pre-commit gate already recorded is not new at the push. ruff runs at both gates, so a ruff WARN is escalated at the push only when the commit that introduced it skipped the pre-commit hook: the same finding committed through the hook stays a WARN .
On the very first pre-push run against a fresh ledger (no baseline yet), aramid writes a baseline from the current findings, and if the only reason the exit code came back 1 was the ratchet's own WARN→BLOCK escalation — no genuine BLOCK finding, no degraded BLOCK-tier tool — the exit code is downgraded to 0 (or 2 if something degraded). A real BLOCK is never downgraded.
In CI this happens on every run. .aramid/ is normally gitignored, so every CI checkout is a fresh ledger and every CI pre-push run is "the first" — the ratchet's new-warning escalation can never fail a CI step by exit code alone. The --json report says so: fresh_ledger_baseline is true and grandfathered lists the escalated ids the downgrade waved through (both keys are always present; false / [] on an ordinary run). A CI step that wants the ratchet to bite must read those keys — or persist .aramid/ between runs so the baseline survives. Intrinsic BLOCKs (secrets, semgrep BLOCK rules, a failed test suite) still exit 1 regardless.
aramid's own checks: shadow, TDD and red-first proof
Three checks are aramid's own rather than an external tool's. Each ships disarmed (WARN) and has one arming flag ( section 9 ); their config keys are in the knowledge base, section 2 .
shadow — a file that hijacks python -m aramid
What it checks. python -m puts the current directory first on sys.path , so a file at the repo root named for an installed tool is imported instead of that tool by every python -m aramid (or python -m graphite ) started there without -P : an old hook shim, a CI step, an editor task. It runs in place of the real package, and a hook that discards its output hides that it did. The shadow runner reports aramid.py , aramid/__init__.py , graphite.py and graphite/__init__.py at the repo root. A directory named aramid or graphite with no __init__.py is not reported: it cannot take the place of an installed package. The two names are fixed; no config key changes them.
When. At every gate (pre-commit, pre-push and --gate all ), in every repo, whatever the scan mode: it looks at the repo root, not at the changed files. It only checks whether those files exist, so it never times out or degrades.
Finding. Tool shadow , rule module-shadow , severity critical , line 1 of the file. The id depends on the path alone, so editing the file's content does not change it.
WARN or BLOCK. Disarmed, a finding is WARN. It is not exempt from the pre-push ratchet, so a pre-push gate that is the first recorded run to see it escalates it to BLOCK, like any new WARN (on a fresh ledger the fresh-ledger rule lets that push through). With [shadow].shadow_block_armed = true ( aramid arm --shadow ) it is BLOCK at every gate, pre-commit included. That key is the check's only setting ( knowledge base, [shadow] ).
Resolving it. Delete or rename the file, or move it out of the repo root; the gate run, at any gate, records the finding fixed because its file is gone. A repo that has to keep such a file can set the finding aside: aramid override while it is WARN, a .aramid-suppressions.toml entry once armed ( section 5 ).
tdd — code changed with no new test
What it checks. Whether a push that changes Python code also adds a test. If the push's commits add or change no line in any test file, it reports every production .py file they changed. A test file is a test_*.py or *_test.py file, or any file under a tests/ directory. One added or changed test line anywhere is enough to silence it for the whole push, whichever code that test exercises.
When. At pre-push only; pre-commit and --gate all never run it. On a push with no range to diff (no upstream and no remote-tracking ref, as on a new repo's first push), and under --gate pre-push --all , the whole tracked tree is the change, and it reports every tracked production .py file only when no tracked file is a test file.
Finding. Tool tdd , rule code-without-test , severity medium , line 0 : one per file.
WARN or BLOCK. WARN while baking, and exempt from the ratchet, so it cannot block a push until you arm it. With the top-level tdd_block_armed = true ( aramid arm --tdd ) it is BLOCK, and a git that does not answer while the check reads the push then counts as a degraded tool, which refuses the push unless accepted with --accept-degraded . [tdd].enabled = false turns the check off ( knowledge base, [tdd] ).
Resolving it. Write the test. A later pre-push resolves an open finding when it does not raise it again and either changes that file or changes a test file named for its module ( test_ , _test , test_ _ or test_ _ ); this needs an upstream to diff against, so a new repo's first push resolves nothing, while under --all the push's own changes are recomputed from the upstream. The finding on a file you deleted resolves at the pre-push.
red-proof — a test that was never red
What it checks. Whether a test the push changed could have failed before the push. For each changed test file in which at least one changed line is a test definition (a def test... or async def test... line, found by parsing the file), it writes the file's new version into a temporary worktree of the push's base commit and runs pytest -q there, with aramid's own interpreter. Exit 0 means every test in the file passes against the code as it was before the push: the tests were never red, so they prove nothing the change. Exit 1 or 2 (a collection error counts) proves the file red. Anything else proves nothing either way. A changed test file whose changed lines include no test definition, such as a fixture fix, a stronger assertion or a new parametrize case, is not checked.
When. At pre-push only, and only when the push has a range to diff: never on a new repo's first push, never under --all , never with --gate all . [red_proof].wall_budget_s (default 120 s) bounds the whole check and [red_proof].test_timeout_s (default 60 s) each file; a file the budget did not reach was not checked, which is not the same as clean.
Finding. Tool red-proof , rule test-not-red , severity medium , line 0 : one per test file. The verdict is for the whole file, so an older test in the same file that fails on the base hides a new test that never failed.
WARN or BLOCK. WARN while baking, and exempt from the ratchet. With [red_proof].red_proof_block_armed = true ( aramid arm --red-proof ) it is BLOCK, and a git that does not answer counts as a degraded tool, as for tdd . [red_proof].enabled = false turns the check off ( knowledge base, [red_proof] ).
Resolving it. Make the test fail without the change it tests. An open finding resolves when a later pre-push checks the file again (a push that changes one of its test definitions) and the base run proves it red. The finding on a file you deleted resolves at the pre-push. One trap: the base run uses the repo's own pytest configuration, and an addopts setting such as a coverage threshold or warnings as errors can make it exit non-zero whatever the tests do. That reads as red, so such a file is never reported, and an open finding on it resolves without any proof.
What the pre-push gate certifies -- and a branch that moves while it runs
git hands every pre-push hook one line per ref on stdin ( ). Over a native transport ( ssh:// , file:// , git:// ) it ships exactly those shas. Over smart HTTP it does not : the parent runs the hook first, then git-remote-http has send-pack resolve the refspec by name , at hook exit. So a commit made on the branch while a long gate runs ships, ungated, while git push prints the pre-hook range. (Measured on git 2.53; a consumer saw it in production with an 18-minute gate.)
The gate therefore pins what it certifies before anything runs -- the refs on the hook's stdin, plus HEAD -- and re-resolves them after the last runner returns. If any moved, the push fails with
and the run row records both sides: refs , head_at_start and hook on run_started , refs_moved and head_at_exit on run_finished ( aramid check --json carries refs_moved too). The fix is the message: re-run the push, so the gate certifies what actually ships. Do not commit on a branch while its push is inside the hook.
Two details of the mechanism:
The gate reads the hook's stdin only when the managed shim tells it git is on the other end ( ARAMID_HOOK=pre-push , exported by the shim aramid init writes). Run by hand, or in CI, there are no ref lines and the gate certifies HEAD at start against HEAD at exit, under the name HEAD . Re-run aramid init after upgrading to get the marker into an existing shim.
Under the marker, an empty ref list -- git's Everything up-to-date , or a push that only deletes a branch -- ships nothing, so the gate prints nothing to push and returns 0 without running the tools and without writing a run row (a row with no tools would read as a skip and start a skip streak for a push that shipped nothing).
The exit-code contract
A degraded tool is listed with its reason -- skipped (degraded tools): then - gitleaks (timeout after 120 s) , - semgrep (not found) , or - ruff (crashed (exit 2)) -- and the same {tool: reason} map is written to the run's run_finished row as degraded (empty when every selected tool ran) and to check --json as degraded_reasons . A tool that timed out also says so in its own log under .aramid/logs/ , which used to be empty for exactly that case. One entry there is not a tool. - non-utf8-names (1 file not handed to any tool: name not valid UTF-8: caf\xe9.py) means the run left that file out, because no tool can be handed a name that is not valid UTF-8 (Linux allows one). It degrades the run like a skipped tool, so --strict refuses it. Renaming the file ends it.
Layered on top of that base contract:
check --strict remaps 2 → 1 (CI mode — no soft states); 3 is already a hard failure and passes through unchanged.
The pre-commit hook shim remaps {2,3} → 0 (always fail-open).
The pre-push hook shim remaps 2 → 0 ; 1 and 3 pass through and block (fail-closed).
Any malformed CLI invocation ( aramid with no command, an unknown subcommand, a bad flag) is remapped to exit 3 at the top level, so a broken invocation reads the same as a genuinely crashed engine, never a bare argparse 2 .
4. Running Checks On Demand — aramid check
The installed hooks call check for you, but you can run it manually at any time:
From a subdirectory, check and every other repository command work on the repository root: its aramid.toml and its ledger. Each says so in one stderr line, naming any aramid.toml or .aramid/ the subdirectory has of its own, which is not used (a stray .aramid/ from an older version can be deleted). This holds below a top level that has an aramid.toml or an .aramid/ . Below one aramid never ran in, the current directory is still the repo. So JavaScript or Rust code in a subdirectory, with no package.json or Cargo.toml at the root, is not gated, and no run from inside it changes that.
--gate defaults to pre-commit . --gate all runs every runner either tier runs. The pre-push gate runs every pre-commit runner too, ruff included, so it also sees both halves of an edit that annotates a line for one tool and so re-keys the other tool's committed suppression id on that same line; the pre-commit gate never runs semgrep and cannot. --gate all defaults to scanning the whole tree, never ratchets, and no hook invokes it; exit codes are as for any gate.
These three are mutually exclusive. If none is given, the mode defaults per gate: staged for --gate pre-commit , range for --gate pre-push , all for --gate all . --all widens the FILE set to the whole tracked tree (and takes the pre-push time budget); it does not change which runners run -- that is --gate 's job, so --gate pre-commit --all is still a gitleaks+ruff scan. For both tiers at once, use --gate all . Under --all , gitleaks scans a temporary copy of exactly the tracked files rather than walking the checkout: gitleaks dir has no exclude option, and pointed at the repo root it walks every gitignored cache too -- on aramid's own checkout a 418 MB .cache/ cost 63 s of a 68 s scan against gitleaks' 120 s budget, and under load the tool timed out and --strict refused a push whose gate had nothing blocking. The 381 tracked files scan in 2 s.
Looking without recording
--no-record runs the gate against a snapshot of the ledger and writes nothing to .aramid/ledger.db (the runner logs under .aramid/logs/ are still written). The report is the real report -- the ratchet, new_ids and the fresh-ledger rule read the snapshot's history exactly as a recording run would -- so it is the way to take a whole-tree measurement without leaving it behind: one consumer's --all look wrote 683 rows into their ledger before this existed.
CI / automation flags
These are the two steps a CI job needs, one per tier; section 10 says why both steps are kept, and gives the one-step form for a fresh checkout. A bare aramid check --strict --json is no CI check: it scans the staged files, and a CI checkout has nothing staged.
--strict — remaps exit code 2 to 1 (treat degraded as failure; no soft-pass in CI). 3 (engine error) is already a failure and keeps its code.
--json — renders the machine-readable report instead of the console report. It leads with schema_version ; every key it carries, with its type and meaning, is in check --json keys below.
--accept-degraded --reason "why" — accept a degraded run instead of blocking on it: the gate exits 0 , writes an infrastructure_bypass ledger row carrying the reason, prints degraded, ACCEPTED: and carries accepted_reason in --json , so the pass is never mistaken for a clean one. --strict does not remap an accepted run, and the CI-parity shim needs no exit-code arm for it (until 0.12.0 the accepted run exited 2 , which --strict turned into 1 -- under [hooks].pre_push_match_ci the hatch refused the push with its acceptance on record). A genuine BLOCK finding still exits 1 ; --reason defaults to "no reason given" if --accept-degraded is passed without one. The same signal can be supplied via the ARAMID_ACCEPT_DEGRADED environment variable, which hooks inherit from the parent git process automatically.
Machine-readable output ( --json )
Six commands take --json . Each prints one JSON object that begins with schema_version , the version of that command's shape. The version changes only when a key is removed, renamed or retyped; a new key can appear in any release, so read the keys you need and ignore the rest. Each document is versioned on its own.
An empty result is an empty list inside the object, never prose. Before 0.19.0, ledger filter , ledger consumers and resolvers printed a bare list, and a ledger consumers row was the consumer's payload as written.
Every top-level key below is present in every report check --json prints, and every findings[] , refs_moved[] and stale_overrides[] key in every entry of that array; a null is a value the key carries, not a missing key. These are the keys section 13 declares. A unit test fails if a key is added to or removed from the report and not to this list, or the other way round; it checks the key names, not the types or meanings. Top level:
Keys of one entry in each array of objects:
5. Understanding & Handling Findings
A read-only report of this repo; the only thing it writes is a machine-level shown marker for any fleet notice it displays:
Reports: last run summary; open/historical/not-a-secret/overridden/unreachable/fixed/superseded/out-of-scope/pending-retest/rotated finding counts; count of findings new since the baseline; each open finding a drain recorded on a commit the remote default branch does not have yet, by id, file:line and the first line of its message, newest first (10 at most, then ... N more ; the session-start block names 3 by id, tool and file:line only, because a drain's message is model-written, possibly from code you do not trust, and that block goes to the agent as aramid's own words), so a branch's review findings are in front of you before it merges (the line is refs/remotes/ /HEAD , origin's or else the only remote that has one; a repo with no remote HEAD shows none); count of findings aging past 30 days open (a finding with an entry in .aramid-suppressions.toml is set aside and counted in a tail, N suppressed , rather than left aging forever); when a tool's own marker hides a BLOCK-tier hit, an inline markers: line counting those findings per label, and the ones accepted in .aramid-suppressions.toml apart ( below ); per-tool skip streaks; resolver defects (see aramid resolvers ); consumers stuck in degraded , as a streak of consecutive failed drain runs with the note explaining what broke — this matters because the drain re-queues an item while any consumer is degraded, so a stuck consumer means the same work is being retried every drain; unrotated historical secrets (with a hint naming both retirement exits: ledger mark-rotated for a real leak, ledger mark-not-a-secret for a false positive); unreachable candidates (open findings whose tool no longer runs in this repo, with the exact ledger mark-unreachable command to retire each); while semgrep_block_armed is still false , the bake day-count and per-rule semgrep hit counts (so you can spot noisy rules before arming); an LLM review status line (open/confirmed-critical counts, armed/baking state, OpenRouter monthly spend vs. cap, ladder tiers) plus an autolearn line; queue status (queued count/score/age, drained/expired counts); last drain timestamp (the newest of a consumer's run and the drain's own visit row, so an idle drain reads idle: nothing to drain and a line older than one interval means the scheduler did not run); whether the repo is registered; whether scheduled drain is installed; the fleet 1.0-readiness verdict and any fleet notice due in this repo (see Fleet health ).
ledger list — one line per finding: [status] id tool:rule file:line — message .
ledger show — full record ( tool, rule, file, line, severity, verdict, message, evidence, historical, status, reason ) plus every ledger event tied to that id. Exits 3 for an unknown id. reason is populated once a finding has been overridden or marked not-a-secret; a rotated finding's reason is recorded in the ledger event but not currently surfaced here.
ledger filter — all four filters are optional and AND-combined. --status and --severity take the spelling aramid status prints ( pending-retest and pending_retest are the same value; case is ignored), and a value outside the vocabulary exits 3 with the vocabulary listed instead of reporting an empty match.
ledger consumers — the drain's consumer runs ( regression_pack , llm-review , mutation , fuzz , js_mutation , dast ), newest first: [state] at consumer duration item — note . --consumer keeps one consumer, --last N the newest N, --json emits one fixed-shape row per run (see Machine-readable output in section 4). This is where a degraded consumer runs: line in aramid status has its history; ledger filter reads findings only and never shows these rows.
Versions on disk. .aramid/ledger.db and ~/.aramid/repos.toml record the version of their layout (0.19.0). Files written earlier have none and are read as they are. An aramid that meets a ledger written by a NEWER aramid refuses it rather than guess at its layout: check exits 3 with ... was written by a newer aramid ... -- upgrade aramid to use it , so the pre-commit hook lets the commit through and the pre-push hook blocks. A registry from a newer aramid is never rewritten by an older one, and neither is one that cannot be read at all: init reports the repo as not registered, uninstall exits 3 , and drain exits 3 , until the file is repaired or deleted. In short: upgrade freely, and do not downgrade below the aramid that last wrote these files.
If init 's one-time full-history secret scan found something, it has two possible exits: rotate the credential and mark it rotated, or confirm it was never a secret in the first place and mark it as such.
Rotate a real leak, then record it:
Some hits are not leaks at all. gitleaks' generic-api-key rule flags any sufficiently long, high-entropy string, so it routinely catches values that are secret- shaped but not secret — for example, a Shopify app's public client ID embedded in a wrangler.toml , already published in the storefront's HTML by design. Confirm that, then mark it not-a-secret instead of rotating it:
If the value is still in a tracked file, as that wrangler.toml client ID is, the mark is not enough on its own. A ledger mark never unblocks a gate, and the pre-push gate scans only what a push changes, so the value goes unnoticed until a whole-tree scan ( aramid check --all , or CI, which has no ledger) re-detects it and blocks, whatever it is marked (measured). Commit an entry for its id in .aramid-suppressions.toml with the same reason: that entry travels with the repo, and the whole-tree scan then passes, in CI too (measured). A rotated value left in a file blocks the same way; it is dead, so delete it.
--reason is required for both commands. mark-not-a-secret refuses (exit 3 ) for any status other than exactly historical , rather than silently no-op'ing — for a live open finding it points you at a committed .aramid-suppressions.toml entry for a BLOCK, or aramid override for a WARN, since those are that finding's real suppression paths; for a finding that's already rotated , already not_a_secret , or otherwise resolved (e.g. fixed ), it just refuses. That restriction matters because not_a_secret , like historical , is inert at gate time — a finding re-fires at its normal severity if it's ever re-detected in the working tree, regardless of ledger status. So loosening the guard would not open a gate bypass; it would open a reporting bypass — an uncommitted way to drop an open BLOCK finding out of status 's counts, sidestepping the committed, reviewable .aramid-suppressions.toml that BLOCK-tier suppression deliberately requires. mark-rotated , by contrast, accepts a historical finding OR one already marked not_a_secret : discovering that a supposed false positive is in fact a real credential, and rotating it, only adds caution, so that direction is never blocked. Neither mark can ever be undone — the ledger is append-only, and there is no path back from rotated to not_a_secret .
Retiring a finding whose tool no longer runs
A repo's stack can change: a test file gets removed, [tests].enabled gets set to false , a tsconfig.json disappears. When that happens, any OPEN finding that tool produced is stranded — no future run can ever resolve it the normal way, because resolution requires the tool to run, and it never will again. aramid status auto-detects these under an "unreachable candidates" section and names the exact command:
--reason is required. The command refuses (exit 3 ) for: an unknown id; a finding whose tool is a producer/consumer ( tdd , red-proof , mutation , mutation-score , llm-review , js-mutation , fuzz , dast ) — those resolve through their own producer's mechanism, not by this mark (an llm-review finding that a commit fixed has ledger resolve --fixed , see An LLM finding you fixed that stays open anyway ); a finding whose status isn't exactly open (a historical secret is redirected to mark-rotated / mark-not-a-secret instead); or a finding whose tool still runs here — that is a broken-toolchain problem ( aramid doctor ), not a ghost, and retiring it would hide a real gap rather than an obsolete one. Unlike mark-not-a-secret , this transition does resurrect: if the tool ever comes back and re-detects the same finding, it automatically re-opens — a repo that flips detection off and back on cannot permanently launder an open finding this way.
Findings on a path the runner no longer examines
The other stranded shape: the tool still runs here, so mark-unreachable refuses -- but its runner will never examine that path again, so no run can resolve the finding. It happened when the typecheck runner was scoped to .py / .pyi in 0.6.1: mypy:syntax rows recorded against ci.yml and README.md could neither re-report nor resolve. aramid status lists these under an "out-of-scope candidates" section and names the command:
Several ids per launch are accepted: every id is attempted, a refusal on one does not stop the rest, and the exit is the worst of them. It records finding_out_of_scope -- its own event kind, so the ledger can later tell "the tool left the repo" ( unreachable ) from "the path left the tool's scope" ( out_of_scope ) without reading payloads. The guard that keeps it from becoming a silencer: it refuses (exit 3 ) while the runner can still examine the path , decided by that runner's own file-suffix rule ( ruff / mypy : .py / .pyi ; eslint : JS/TS suffixes; clippy : .rs ) and, for mypy, by the repo's own [tool.mypy] files / exclude -- a .py that scope leaves untyped is one mypy will never examine here; it refuses outright for a tool with no suffix scope ( gitleaks , semgrep , tests , dependency audits -- "cannot say" is not "no"); and it redirects to mark-unreachable when the tool is not selected at all. Without --out-of-scope it refuses, unless --fixed is given (the other resolution, for an llm-review finding a commit fixed, described below): a finding that is simply gone resolves on the run that examines its file. Like fixed and unreachable , the row re-opens if a runner ever reports it...
The full story
This article is one source in a clustered incident — the cluster page carries the summary, timeline and every other outlet covering it.
