A small, runnable reference implementation of the three-layer control architecture for autonomous systems: discovery proposes, reasoning proposes, and an isolated control core decides what is allowed to reach execution.
What this is. An educational reference implementation of the architecture described in A Three-Layer Reference Architecture for Deterministic Control in Agentic Trading Systems (SSRN 7488978). It exists so the architecture can be read, run and tested without exposing any production system.
What this is not. It is not ZVAKTHOR, it contains no proprietary logic, it connects to no broker, it places no orders, and it makes no performance claim. It is a control-flow reference, not a trading system.
The component that can influence a decision is not the component that authorises it.
Four claims follow from that split, and each one is enforced by tests rather than by convention:
| Claim | Where it is enforced | Test |
|---|---|---|
| Nothing executes without a live authorisation from the control core | ControlCore.execute() |
test_unknown_decision_cannot_execute, test_rejected_proposal_cannot_execute |
| Authority is revocable, and revocation is checked at the execution boundary | ControlCore.engage_kill_switch() |
test_kill_switch_revokes_a_prior_authorisation |
| Revocation does not rewrite history | committed state is never modified | test_kill_switch_does_not_undo_committed_state |
| A decision is reproducible from its recorded context | DecisionJournal + ControlCore.replay() |
test_replay_reproduces_the_recorded_outcomes |
No dependencies — standard library only.
python3 run_demo.py # walks one candidate through all three layers
python3 -m pytest tests/ -vThe demo prints each stage: candidates, proposals, the rejection with its reasons, the autorised execution, an operator halt that revokes a live authorisation, the journal, and a replay that reproduces every outcome.
control_reference/
types.py immutable, serialisable domain types (Candidate, Proposal, Context, Decision)
layers.py discovery + reasoning — may propose, cannot authorise
control.py ControlCore — the only component that may authorise execution
journal.py append-only decision journal (accepted and rejected)
run_demo.py end-to-end scenario
tests/ 42 tests: the control boundary, the journal, replay, the layer separation,
and a run of deliberately malformed proposals from an untrusted proposer
- ARCHITECTURE.md — component and sequence views, decision rules, failure model, trade-offs and security posture.
- CASE-STUDY.md — problem, constraints, requirements, and what the result does and does not establish.
- EVIDENCE.md — claim-by-claim evidence index with explicit non-claims.
- docs/adr/ — the decisions behind the design.
- docs/adr/ — the decisions behind the design.
Proprietary — all rights reserved. See LICENSE. Published for review and demonstration; no reuse licence is granted.