A three-part manuscript series establishing the theoretical foundations, computational validation, and unified practical/applications guidance for cognitive security in multiagent AI systems. Parts 3 and 4 were merged into a single comprehensive paper.
Program documentation · Local trust verification
To check the trust calculus with a small numerical fixture, start with the local trust verification guide. It records the computed weighted score, fixed-path delegation scores, and invalid-input checks. The assurance note describes what those observations support.
Each paper is a self-contained Python project with its own lockfile and requires Python 3.11 or later. From any paper's directory:
uv sync --locked # install the pinned environment
uv run pytest tests/ -q # the paper's own test suite
uv run python scripts/generate_all_figures.py # regenerate every figure
uv run python scripts/verify_manuscript.py # the manuscript gateFrom the repository root, scripts/check_series_integrity.py — run through Part
2's environment, as the example below does — runs the six program-level checks
that compare the three papers to each other. Registered measurements are derived
from artifacts under <paper>/output/data/; unregistered prose numbers are
outside that guarantee.
| Reader | Start here |
|---|---|
| Formal definitions, proofs, adversary taxonomy | Part 1 (Second Edition): Formal Foundations |
| Empirical results, adversarial training, reproducibility | Part 2 (First Publication): Computational Validation — evidence spine: claims traceability, framework validation |
| Deployment, checklists, operator guidance, cross-domain applications (minimal math) | Part 3+4: Practical Guide + Applications |
| Part | Title | Status | DOI |
|---|---|---|---|
| 1 | Formal Foundations (Second Edition) | v2.0 (Second Edition) | 10.5281/zenodo.22134544 |
| 2 | Computational Validation (First Publication) | v2.0 (first publication) | 10.5281/zenodo.22134546 |
| 3+4 merged | Practical Applications and Deployment Guide (Parts 3+4 Unified) | v2.0 (first publication) | 10.5281/zenodo.22134548 |
All three papers are released together as v2.0, dated 2026-08-26. They share one measurement layer --- Part 2 produces the artifacts and Parts 1 and 3 cite them --- so a version applying to one paper alone would be a version of nothing. Part 1 is a second edition of an existing Zenodo record; Parts 2 and 3 are first publications. See CHANGELOG.md.
- Start with Part 1 if you want definitions, theorems, and the formal trust / defense / adversary apparatus.
- Start with Part 2 if you want empirical evidence — the 1,475-item attack corpus, ablation studies, Bayesian uncertainty, parametric ceilings (exact architecture set and ceiling definition are in Part 2 methodology).
- Start with Part 3+4 (merged) if you are deploying CIF and need engineering guidance without formal prerequisites or are evaluating CIF for a specific operational sector (infrastructure, supply chain, cyber, biowarfare, information ecosystems, etc.).
Part 2 distinguishes the default integrated corpus (1,475 samples, five primary
families, fifteen subcategories) from the legacy extended=False corpus (950
samples, four families, twelve subcategories). The retained parametric
architecture artifact uses 950 × 4 = 3,800 simulated instances; integrated
pipeline studies use either all 1,475 attacks or their stated stratified
subsample. None of those denominators establishes field performance.
Each paper stands alone but explicitly points readers to the most relevant sections of its siblings.
Daniel Ari Friedman
Active Inference Institute
- Trust Calculus with bounded delegation and δ^d decay (Part 1)
- Defense Composition Algebra for layered security reasoning (Part 1)
- Computational validation over a 1,475-item attack corpus and a 120-item benign corpus (Part 2; architecture set and parametric ceiling definitions are in that manuscript's methodology)
- Operator-facing synthesis with checklists, risk framing, and deployment guidance (Part 3)
- CIF-AD-OODA integration and ten-domain applied analysis of goal hijacking (Part 3+4)
- Three universal attack patterns — FR Polarity Inversion, Constraint Relaxation, Context Boundary Violation (Part 3+4)
- Four defense extensions in the cross-domain study — verification channel separation, active perturbation probing, physics-informed invariants, semiotic decoupling
Technical documentation for the CIF implementation lives in cogsec_multiagent_2_computational/docs/:
- Claims Traceability — Manuscript-to-code mapping
- Usage Guides — Per-component guides (Firewall, Sandbox, Trust, Consensus, Tripwires, Drift Detection, Provenance, Invariants, Red-Team Evaluation)
- Framework Validation — Experiment reproduction guide
- Program Documentation Index — Program-wide documentation map
For manuscripts: use explicit figure captions in markdown; where markdown allows alt text for images, set meaningful alt text so HTML builds remain readable without the image. Spot-check combined HTML under each part's output/web/ after changing figures.
Part 1 (example; see Zenodo for each part's record):
@article{friedman2026cogsec1,
author = {Friedman, Daniel Ari},
title = {Cognitive Integrity Framework: Formal Foundations},
year = {2026},
doi = {10.5281/zenodo.22134544},
publisher = {Zenodo},
note = {Part 1 of three: Cognitive Security for Multiagent Operators}
}- GitHub: docxology/cognitive_integrity
- Template: docxology/template
If this checkout is nested inside docxology/template (i.e. this directory lives at projects/cognitive_integrity/ under that repo's root), build from the template repository root (with uv sync already run there):
# Render any paper as PDF (qualified names required for the nested layout)
./run.sh --render-pdf --project cognitive_integrity/cogsec_multiagent_1_theory
./run.sh --render-pdf --project cognitive_integrity/cogsec_multiagent_2_computational
./run.sh --render-pdf --project cognitive_integrity/cogsec_multiagent_3_practical
# Or directly:
uv run python scripts/pipeline/stage_03_render.py --project cognitive_integrity/cogsec_multiagent_1_theory
# Run tests (examples; run from repo root)
uv run pytest projects/cognitive_integrity/cogsec_multiagent_1_theory/tests/ -v
uv run pytest projects/cognitive_integrity/cogsec_multiagent_2_computational/tests/ -q
uv run pytest projects/cognitive_integrity/cogsec_multiagent_3_practical/tests/ -vPart 2's tests import scipy (declared in that part's pyproject.toml). If collection fails with ModuleNotFoundError: scipy, run uv sync from cogsec_multiagent_2_computational/ so its dependencies are installed, then re-run pytest from the repo root as above.
In a standalone checkout, build each paper from its own directory. The root scripts/ contains series-level checks and uses the environment documented below.
(cd cogsec_multiagent_1_theory && uv sync --frozen && uv run --frozen pytest tests/ -q && uv run --frozen ruff check .)
(cd cogsec_multiagent_2_computational && uv sync --frozen && uv run --frozen pytest tests/ -q && uv run --frozen ruff check . && make all) # tracked data + figures + tables + verify
(cd cogsec_multiagent_3_practical && uv sync --frozen && uv run --frozen pytest tests/ -q && uv run --frozen ruff check .)Manuscript integrity checks (Parts 1 and 3) and figure regeneration are documented in each part's own README.md § Usage and scripts/README.md.
Every other check in this repository is scoped to one part: each part runs its own
pytest and its own verify_manuscript.py, and Part 2 runs its claim registry over its own
manuscript. Nothing compared the three papers to each other, which is how a shared quantity
came to be published as two different numbers in two papers that cite each other.
# The gating set defined in the CI workflow must exit 0. Run it in Part 2's
# environment: `shared-quantities` derives its Bayesian interval by loading Part
# 2's src/statistics/bayesian.py, so NumPy and SciPy must be importable.
uv run --project cogsec_multiagent_2_computational --frozen \
python scripts/check_series_integrity.py \
--only shared-quantities --only bibliography --only truncation \
--only math-hygiene --only artifact-provenance
uv run --project cogsec_multiagent_2_computational --frozen \
python scripts/check_series_integrity.py # adds the advisory pointer lint,
# so a bare run exits 1 by design
uv run --project cogsec_multiagent_2_computational --frozen \
python scripts/check_series_integrity.py --json # machine-readableNo build step, and stdlib-only apart from the ledger's Bayesian derivers, which load Part 2's source and therefore need Part 2's environment (NumPy and SciPy). Six checks:
| Check | What it refuses to let through |
|---|---|
shared-quantities |
A registered shared quantity disagreeing across papers, or with the Part 2 artifact it is derived from |
bibliography |
The same work entered twice under two bibkeys, or the same work disagreeing about its own metadata across the three bibliographies |
truncation |
A manuscript file ending mid-sentence, or a heading whose section body never arrives |
math-hygiene |
LaTeX that builds but renders wrong: a doubled backslash before a command name, or a * where a subscript _ was meant. Parts 1 and 3 each check this in their own verifier; Part 2 had no such gate |
artifact-provenance |
A manuscript citing a data artifact that does not positively declare where it came from. src/data/generate.py forbids its placeholders from backing manuscript tables; the rule was unenforced until a scaling table was found built on one |
cross-paper-pointers |
Hardcoded Part 1, Theorem 3.2a-style pointers, which the renderer numbers per part and which therefore cannot be verified from a sibling paper (advisory) |
scripts/series_ledger.py is the source of truth for the registered quantities
shared across papers. Each variable binds a name to a deriver that recomputes
the value from a shipped artifact under Part 2's output/data/; quantities not
registered in the ledger are outside this mechanism.
python3 scripts/series_ledger.py # every derived value
python3 scripts/series_ledger.py --coverage # how much of the prose is managedPart 2 runs derive-then-verify on its registered manuscript measurements
(injector.py writes measured values in, claim_registry.py reads them back and
re-derives). The series ledger extends that governance to registered shared
quantities: shared-quantities checks every ledger variable across all three
manuscripts, and a governed value that disagrees with its artifact fails the build.
The series test count is derived too. scripts/collect_test_inventory.py records collected
counts into test_inventory.json;
--check recollects and fails if the recorded numbers have moved. Run that check after adding
tests. The CI definition provisions all three part environments for this collection check.
The inventory counts collected tests rather than passes, because collection
is deterministic and side-effect free while a pass count depends on the environment a given run
happened to have.
The matching write path is scripts/inject_series_values.py: it rewrites any governed site
whose number has drifted from its artifact, reusing the ledger's own patterns so the two
mechanisms cannot disagree about where a number lives. Reporting is the default; --write
applies. It refuses to run at all if any variable fails to derive, because injecting a subset
would leave some numbers sourced from the artifacts and some not.
python3 scripts/inject_series_values.py # report drift, change nothing
python3 scripts/inject_series_values.py --write # rewrite from the artifactsTwo variables are derived structurally rather than from an artifact: the applied-domain count
is obtained by counting Part 3's 09c..09l section files, and the ablation denominator is
recovered from the measurement resolution (with an n-sample corpus every delta is a multiple
of 1/n, so the smallest non-zero delta is 1/n). Neither is typed anywhere.
Every check fails on an empty input set: a pattern that matches nothing is a broken guard,
not a clean run. tests/test_series_integrity.py drives each check against a planted defect
and requires it to be caught.
This work is licensed under CC BY 4.0.
