TOPAK is a safe-by-design architecture pattern for agentic AI collaboration. It treats every agent as Byzantine, keeps models out of the trusted computing base, and states every guarantee against what an agent's action alphabet allows. The letters name roles, not products:
| Role | Instrument at the reference | |
|---|---|---|
| T | Formal specification and model checking | TLA+ / TLC |
| O | Policy as code: a verified floor and a per-request bundle | Cedar (floor), OPA/Rego (bundle) |
| P | Consensus over the control plane | Multi-Paxos |
| A | Agents, the principals doing the work | MCP-connected agents |
| K | Event transport | Kafka |
Status: a design corpus in its genesis phase, with a reference implementation of the admit path. It is not a deployable system.
- How it fits together: Theory of Operation (revision 16, tag
ToO-rev16) - State of record (what is ratified, owed and open): Genesis Checkpoint G12. Where it and the narrative disagree, the checkpoint wins; where a frozen checkpoint is known to be wrong,
checkpoints/README.mdsays so. - Vocabulary: Glossary
- Reviews: Reviewer's Guide: guidance for potential reviewers.
- Building on the pattern: Adopter's Guide (draft): the deployment declaration, with the reference worked as the example, and the conformance checklist
| Path | Contents |
|---|---|
decisions/ |
Architecture decision records, ADR-0001 onward (index) |
checkpoints/ |
Genesis checkpoints, the state of record; the layout map from the 2026.09.30 cut (README) |
narrative/ |
The living layer: the Theory of Operation and the glossary, cut with each checkpoint, and the closed archive of earlier revisions (README) |
spec/ |
TLA+ modules, run scripts, generators, and dated TLC results (README) |
floor/ |
Draft genesis policy floor in Cedar, with tests and gates (README) |
policies/ |
Rego bundle-tier policies and tests |
mechanism/ |
Rust reference implementation of the admit path (README, gaps) |
slm/ |
Small-model pre-training and the ADR-0035 lineage rehearsal (README) |
derived/ |
Dated, frozen analyses, reviews and assessments (index) |
manifests/ |
Digest manifests for checkpoint, reference and rehearsal cuts, with an index of what each measures (README) |
process/ |
The genesis cleanup's process logs (README) |
tools/ |
The TLC jar and wrappers, the TLAPS wrapper and pin, the Lean pin, report and sync, the installers, and the manifest and reference checkers |
diagrams/ |
Diagrams and their generators |
skills/ |
Agent skills drafted from the corpus's methods, each packaged as a plugin for use outside this repository: writing-tla-specs-and-proofs, the spec, model-checking and proof method as a reusable skill (README); writing-lean-encodings-and-proofs, its companion for the Lean 4 second derivations and the premise each one adds (README); generating-corpus-diagrams, the diagram family's method, its rationale and its scripts (README); auditing-claims-against-evidence, the reading of a document claim by claim against the evidence it rests on (README) |
.claude/skills/ |
Project skills for this corpus's own procedures, which a Claude Code session opened in this repository loads from that path: drafting-records, how a record in decisions/ is drafted, revised and amended before it is settled; ratifying-records, the numbered Batch under ADR-0029 §2; cutting-manifests, the reference and checkpoint manifests and their index rows; use-case-simulator, a stated use case configured and played out as an illustrative deployment. They are here and not in skills/ because they are about this repository's records and tools, and are not packaged for use elsewhere |
tools/tlc and tools/tlc-workers wrap TLC over the tracked tools/tla2tools.jar; each module has a *-run.sh in
spec/ (README).
Run TLC on Coupling under a config you write, here Coupling.cfg with
SPECIFICATION Spec, INVARIANT Safe and CONSTANTS Mut = "none" K = 1 R = 3 MaxRound = 2 (from spec/):
../tools/tlc -config Coupling.cfg -deadlock Coupling.tlaRun the same check with a worker per CPU core (from spec/):
../tools/tlc-workers -config Coupling.cfg -deadlock Coupling.tlaRun a module's checks through its run script, which writes the config itself: here Coupling's Safe invariant
with no mutation, under a run named c-none-safe (from spec/; each script's header gives its arguments):
./coupling-run.sh c-none-safe none Safetools/tlapm wraps the TLA+ Proof System. The build pinned has two known unsound cases, recorded against its
trusted-base row in Batch 37 (ADR-0046 A2): write proofs by spec/proof-certification.md §10, and run
spec/proof-scan.sh on every new proof module.
Install the pinned prover beside the wrapper (1.9 GB, not tracked):
tools/install-tlaps.shCheck a proof module, here Coupling_proof, and write its results file (from spec/):
./proof-results.sh Coupling_proof > Coupling-proof-results-2026.10.13.txtScan a proof module, here Coupling_proof, for the known unsound cases (from spec/; with no module named it scans
every *_proof.tla, about 16 minutes):
./proof-scan.sh Coupling_proof > proof-scan-results-2026.10.13.txtCheck every proof results file against the tree and the pin:
spec/proof-sync.shThree packages prove in Lean what the TLAPS proofs and the gates claim, by a second route (ADR-0053, ratified in
Batch 36). spec/lean/ re-encodes sixteen modules, and checks the Seats, FloorComposition and Emergency
encodings against TLC's state graphs. mechanism/lean/ transcribes admit.rs, clock.rs and the floor wrapper and
proves the admit decision a step of FloorComposition. It also models State::apply's seat and lease arms and proves
that model refines Seats. It proves Coupling's properties of a second model built on the first, and replays the
reference's recorded traces through both. floor/lean/ states the floor in Cedar's verified model.
Install the toolchain tools/LEAN-PIN names, through elan (not tracked):
tools/install-lean.shBuild and check the specification package (from spec/lean/):
./results.sh > TopakSpec-results-2026.10.13.txtBuild and check the mechanism package (from mechanism/lean/):
./results.sh > Admit-results-2026.10.13.txtBuild and check the floor package (from floor/lean/; needs cedar on PATH):
./results.sh > TopakFloor-results-2026.10.13.txtCheck every Lean results file against the tree and the pin:
tools/lean-sync.shCheck every manifest at the commit it measured:
tools/verify-manifest.sh --allCheck every path a document cites:
tools/check-refs.pySee the README in each directory.
Code, specifications, policies and tooling are Apache-2.0 (LICENSE); documentation is CC BY 4.0 (LICENSE-DOCS). See NOTICE for how the split applies.