User and operator guide · Architecture

TrustAI Architecture

Status: currentReviewed: 2026-08-06Audience: developers, deployment engineers, ML/runtime engineers, security reviewers, validation engineers
On this pageRoleRuntime TopologyComponent ResponsibilitiesScoring InputsEdge Scoring SequenceDDIL BehaviorSecurity ControlsEnforcement AssuranceRuntime trust anchors and scopeGateway/scorer verification boundaryEvaluated-candidate return custodyTraining Confidence ContractHybrid Training DataValidation PathChange Review ChecklistRelated Pages

Role

TrustAI supplies trust scoring and anomaly-aware context for continuous access evaluation. It does not replace authentication, authorization, incident response, or risk acceptance. Its output is an input to policy, session, workflow, and operator review paths.

The current repository contains two related TrustAI runtimes:

  • a service orchestration path that prepares trust-score requests, applies rules, caches results, and records metrics

  • a Python edge scoring service that can be reached over gRPC with TLS/mTLS configuration

Runtime Topology

Trustai Runtime Topology
Trustai Runtime TopologyArchitecture diagramOpen full size ↗

The trust WebSocket bridge subscribes to the Redis trust producers and pushes typed envelopes plus a live trust topology to /ws/trust-scores; GET /api/trustscores/graph serves the same topology snapshot on demand from identity and session state. Both remain internal gateway surfaces gated on api_gateway.websocket_enabled.

Component Responsibilities

Component Responsibility Security boundary

Service orchestration

Build trust score requests, extract features, call edge scorer where enabled, cache results, expose service behavior, record metrics.

Internal service only; gateway and service callers must authenticate/authorize before using results.

Feature extraction

Convert identity, session, event, graph, temporal, device, and access-pattern signals into score inputs.

Inputs must be bounded and query limits enforced to avoid data leakage or expensive graph queries.

Anomaly detection

Detect impossible travel, spoofing, lateral movement, privilege escalation, off-hours access, and device mismatch signals where configured.

Anomaly output is evidence context, not automatic proof of compromise.

Edge scoring service

Score connection batches, report health, load model bundle under admin authorization, expose model metadata.

gRPC TLS/mTLS and admin RPC authorization are required before deployment claims.

Model bundle

Rules, model metadata, and edge scoring inputs used by validation and local-live flows.

Bundle hash, version, provenance, and promotion decision must be recorded.

Cache

Store an encrypted, versioned current evidence envelope plus bounded append-only evidence history and coordination state.

Session/subject binding, producer policy, TTL, freshness, idempotency, and restart durability must be validated before use.

Graph

Provide relationship, topology, and knowledge graph context.

SPARQL complexity limits, result limits, and endpoint trust must be validated.

Scoring Inputs

Input family Examples Source Claim boundary

User identity

Role encoding, clearance level, MFA enrollment, CAC enrollment, account age, privilege level.

Identity service and directory attributes.

Attribute freshness depends on directory/cache evidence.

Device posture

Device type, trusted device flag, compliance state, device age.

Device/attestation sources where deployed.

Do not claim hardware-backed device trust without attestation evidence.

Temporal behavior

Time of day, day of week, last access, access frequency.

Authentication/session/audit events.

Requires accurate clocks and event timestamps.

Access pattern

Resource diversity, failed attempts, unique locations, anomalous counts.

Gateway, audit, session, and graph-derived events.

Low confidence must be visible when history is sparse.

Relationship context

Graph distance, common connections, trust delegation, organizational proximity.

Oxigraph/SPARQL graph and knowledge graph data.

Graph data provenance and query limits must be documented.

DDIL context

Cache age, offline mode, local model checksum, queue state, reachback status.

DDIL runtime and deployment evidence.

Stale or local-only state cannot prove enterprise synchronization.

Edge Scoring Sequence

Trustai Edge Sequence
Trustai Edge SequenceArchitecture diagramOpen full size ↗

DDIL Behavior

TrustAI is central to DDIL posture because disconnected nodes may need local model and cache behavior when enterprise reachback is absent.

DDIL condition Expected TrustAI behavior Evidence required

Connected

Use current event, graph, cache, and edge scoring inputs according to policy.

Gateway status, edge scorer health, graph/cache evidence.

Automatic DDIL

Use local cache, local model, bounded stale-state policy, and local queue/event evidence.

DDIL status, cache age, model checksum, queue state, local audit.

Forced DDIL

Operator explicitly selects local posture; mutable actions must be audited.

Operator identity, approval/authority, action audit, mode history.

Reachback restored

Replay queued events, deduplicate, reconcile, and record whether enterprise receipt succeeded.

Sync history, replay result, reconciliation evidence.

Model unavailable

Mark score unavailable, use policy fallback if approved, or fail closed for affected paths.

Failure log, policy decision, incident or POA&M if needed.

Security Controls

Control area Implementation expectation Validation

Transport

Use TLS/mTLS for edge scoring where configured; avoid unauthenticated inference endpoints.

TrustAI edge validation and deployment TLS evidence.

Admin RPCs

Model load or administrative scoring operations must require metadata-based authorization.

src/trustai_scoring/service.py tests and validation artifacts.

Model provenance

Record model version, rule-set version, bundle path, and checksum.

models/trustai/edge-default, validator output, artifact manifest.

Cache safety

Record TTL, stale age, score source, and DDIL state.

Atlas Cache evidence and DDIL validation.

Graph safety

Limit query complexity and result size.

SPARQL config and security tests.

Decision boundary

TrustAI informs policy; it does not bypass auth, operator approval, or audit.

Gateway route tests and audit evidence.

Enforcement Assurance

The numeric score is advisory unless every enforcement condition passes at the point of use. Enabling an environment flag or configuring a threshold is not sufficient. An enforcement-capable bundle must be immutable, signed with ECDSA P-384/SHA-384, explicitly marked enforcement_ready, emit the probability_of_correctness_v2 contract, and carry a current atlas.trustai.validation-receipt/v2 over independently labeled operational data.

The v2 evaluation path separates model ownership from validation authority:

  1. The model owner produces an explicitly unsigned atlas.trustai.validation-evaluation/v2 artifact. It is pending and cannot make itself enforcement-eligible.

  2. Calibration and final-validation ledgers must be disjoint by declared subject pseudonym, row ID, and review ID. Each declared pseudonym contributes one outcome row per split so the same identifier cannot create repeated Bernoulli trials. This uniqueness check does not prove that different pseudonyms represent distinct people or independently sampled outcomes. Both splits are after the training cutoff and configured gap, and final validation is strictly later than every calibration row. Future-dated reviews are rejected. Evaluation generated_at cannot be earlier than any review or later than receipt valid_from, and receipt valid_from cannot be more than 24 hours after generated_at. The report is exact to the candidate model-artifact digest and declared site/population identifiers; identifier equality does not establish sampling provenance, population membership, representativeness, or transfer applicability.

  3. Calibration parameters are fitted only on the calibration split. Calibration and operating-point metrics are calculated only on the final-validation split. Outcome probability and threshold-decision correctness remain separate semantics.

  4. Promotion recomputes two-sided Wilson bounds from signed numerators and nonzero denominators. It evaluates conservative lower bounds for precision and recall and upper bounds for overall and high-value false-positive rates. Each split must satisfy minimum sample, subject, class, and high-value-negative support.

  5. A separate validator signs exact artifact, data, code, outcome, and deployment scope binding groups. The current code group binds the declared evaluation schema and calibration record; it does not bind an evaluator binary, container image, source revision, or dependency lock. The bundle-signing key and validator key must be distinct P-384 keys.

  6. A third, distinct P-384 status-authority key signs replaceable validator status. The scorer checks its freshness, sequence, validator state, and validation-ID revocation at load, health, and enforcement scoring boundaries. Missing, stale, replayed, suspended, or revoked status fails closed.

  7. The enforcement feature contract must contain exactly 87 unique canonical names and rules that generate the same schema. The ONNX artifact must accept one float32 batch-by-feature input and load and execute with exactly two named, ordered outputs: score and confidence.

  8. The signed operating point must declare decision_rule=score_lte_threshold_is_malicious and a positive Platt weight. Promotion probes the ONNX contract, and every enforcement score rejects a confidence output that differs by more than 1e-5 from the fixed-threshold decision-correctness probability recomputed from the signed weight, bias, score, and threshold. Scorer health exposes both validated_score_threshold and validated_decision_rule; the gateway requires the rule and its inclusive threshold to equal the behavioral enforcement boundary exactly.

Legacy v1 independent-evaluation reports and self-authored approval metadata may remain in a bundle for advisory consumers, but they cannot satisfy enforcement promotion. Only validation receipt v2 is recognized as enforcement validation.

Validation receipt v2 is still a pre-deployment source contract. Development v2 evaluations or receipts created before the current required fields and checks must be regenerated, independently reviewed, and re-signed. The repository verifies an already produced enforcement ONNX artifact; it does not currently provide an exporter that creates this exact 87-feature, two-output enforcement contract.

Each actionable score must then carry exact model, rule, feature-schema, feature-digest, session, subject, producer, policy, freshness, coverage, and enforcement-trace bindings. Runtime revocation additionally requires a critical high-confidence anomaly, multiple recent authoritative events from independent origins, repeated low-score evaluations, and the configured recovery hysteresis. Fallback, stale, partial, legacy, unsigned, uncalibrated, synthetic-only, or malformed results remain visible but cannot revoke.

Automatic revocation has both process-local and shared Atlas Cache sliding-window budgets. Service, break-glass, and continuity-marked sessions are retained for manual incident response. Cache or coordination failure leaves the result in alert-only mode. These controls limit the damage from poisoned telemetry, a bad model rollout, correlated false positives, and attempts to make privileged users appear untrustworthy.

Important

These are source-code capabilities, not a claim about the shipped deployment. The bundled models/trustai/edge-default model and the current AIO package remain advisory_only; the AIO package defaults also keep edge scoring and TrustAI enforcement disabled. No included model has independent validation receipt v2, deployment-specific approval, accreditation, ATO, or automatic-denial authority. A running AIO must be rebuilt and explicitly configured before newly implemented source behavior can be exercised.

Runtime trust anchors and scope

An enforcement scorer requires the following exact environment tuple. Path and inline-PEM alternatives are mutually exclusive; use one from each pair.

Purpose Runtime environment

Bundle signer trust anchor

TRUSTAI_BUNDLE_PUBLIC_KEY_PATH or TRUSTAI_BUNDLE_PUBLIC_KEY. Set TRUSTAI_REQUIRE_SIGNED_BUNDLES=true for a general signed-bundle policy; enforcement requires the P-384 signature regardless.

Independent validator trust anchor

TRUSTAI_VALIDATOR_PUBLIC_KEY_PATH or TRUSTAI_VALIDATOR_PUBLIC_KEY.

Evaluation-plan authority trust anchor

TRUSTAI_EVALUATION_PLAN_AUTHORITY_PUBLIC_KEY_PATH or TRUSTAI_EVALUATION_PLAN_AUTHORITY_PUBLIC_KEY. The consumed plan fixes the exact artifact, split ledgers, scope, training cutoff, out-of-time gap, threshold, confidence level, and decision rule before evaluation starts.

Validator-status authority trust anchor

TRUSTAI_VALIDATOR_STATUS_AUTHORITY_PUBLIC_KEY_PATH or TRUSTAI_VALIDATOR_STATUS_AUTHORITY_PUBLIC_KEY.

Exact deployment scope

TRUSTAI_VALIDATION_AUTHORITY_ID, TRUSTAI_VALIDATION_SITE_ID, TRUSTAI_VALIDATION_POPULATION_ID, and TRUSTAI_VALIDATION_CONTEXT. The runtime fixes deployment_mode to enforcement.

Current external status and anti-replay state

TRUSTAI_VALIDATOR_STATUS_PATH and a different TRUSTAI_VALIDATOR_STATUS_HEAD_PATH.

Bounded freshness

Positive integer seconds in TRUSTAI_VALIDATOR_STATUS_MAX_AGE_SECONDS and TRUSTAI_VALIDATION_MAX_AGE_SECONDS. Validation max age is enforced against both receipt valid_from and evaluation generated_at at load, health, and enforcement-score boundaries.

The bundle signer, evaluation-plan authority, validator, and validator-status authority must use four distinct pinned keys. The plan must be signed as consumed before evaluation_started_at; retrospective planning fails closed. Distinct fingerprints enforce cryptographic role separation, not organizational or personnel independence: deployments must separately prove maker/checker identity, key custody, assessor independence, and approval authority. Private plan, validator, and status-authority keys do not belong in the scoring or release runtime.

Gateway/scorer verification boundary

The Python scorer verifies the bundle signature, the separately pinned consumed evaluation plan, validation-receipt bytes (including the complete plan binding), exact scope, validity window, current signed validator status, and live confidence-to-signed-calibration equality. The Go gateway does not independently parse or cryptographically verify those receipt bytes. For enforcement, its trust boundary is the version-pinned scorer over mandatory mTLS: after LoadModel, it calls scorer health, accepts only the exact v2 assurance metadata, plan chronology and authority separation, signed decision rule, and validated behavior threshold, persists that observed assurance into evidence, and rejects or rolls back a candidate that is not currently enforcement-ready. It refreshes scorer health before enforcement scoring so expiry, status failure, or threshold drift removes authority.

The gateway holds a model-generation read lease across scoring, immutable assurance attribution, durable evidence persistence, and the associated policy action; model loads and activation-mode changes wait for that lease. Activating any bundle for advisory use atomically clears enforcement authorization. Gateway startup also begins deauthorized, so an operator must explicitly re-promote the verified bundle after every gateway restart before enforcement can resume.

Evaluated-candidate return custody

An immutable evaluation handoff is not itself a return channel. The external evaluator must attach evaluation_handoff_binding (atlas.trustai.evaluation-handoff-binding/v1) to the evaluated manifest before the P-384 bundle signer signs it. That sidecar names the exact Atlas candidate ID and version, handoff SHA-256, model-artifact digest, deployment scope, fixed cutoff/gap/threshold/confidence/decision policy, the no-activation effect, and raw_evaluation_rows_included=false.

The AIO operator stages the complete returned bundle below the root-owned mode-0700 ATLAS_TRUSTAI_EVALUATED_PACKAGE_ROOT and supplies a separately communicated canonical full-tree SHA-256 to POST /api/v1/trust/models/{modelId}/evaluated-package-admission. The gateway accepts no browser upload or arbitrary path. It derives the source from a bounded package ID, rejects symlinks, non-regular files, loose ownership/permissions, undeclared files, changed model artifacts, mismatched handoff/scope/policy/timeline, and claimed reuse of bundle/plan/validator fingerprints. It copies the bytes to a digest-addressed immutable path below ATLAS_TRUSTAI_MODEL_IMPORT_ROOT and records ADMITTED_STRUCTURAL_UNVERIFIED without calling the scorer, activating the model, or affecting authorization.

Structural admission does not establish a signature, key custody, evaluator independence, receipt freshness, or current validator status. A different human from the candidate maker, handoff preparer, and package admitter must use fresh phishing-resistant AAL3 for promotion. Promotion re-hashes the immutable package and handoff/admission records, then the scorer re-verifies all four separately pinned P-384 roles and live status before a runtime load can become enforcement-authorized. A handed-off edge-training candidate cannot skip return admission even for advisory activation.

Training Confidence Contract

TrustAI training records two different quality measures and they must not be conflated:

  • The continuous trust-score head records temporal-split MAE/RMSE and a held-out split-conformal residual interval. The interval is a score-uncertainty diagnostic, not a probability of correctness.

  • The multi-label anomaly head records threshold precision, recall, and F1, including per-scenario results. F1 is a global operating-point measure and is never presented as the confidence of an individual session.

Each newly exported bundle includes a checksummed confidence_contract.json with both measurements. Synthetic bundles label that artifact synthetic_validation_only and retain confidence_semantics=unavailable_uncalibrated; only an operationally calibrated and independently approved artifact may expose a probability-of-correctness contract to policy.

src.trustai_scoring.operational_calibration prepares the unsigned v2 evaluation from two pseudonymous, reviewed, scope-matched ledgers. Every row is bound to the exact model version and artifact-set digest, carries unique row and review IDs, a review time, a declared confirmed-malicious outcome, and high-value status. Each split requires at least 1,000 rows from 1,000 unique declared subject pseudonyms, 100 outcomes of each class, and 100 high-value negatives. The split-disjoint rule therefore requires at least 2,000 declared pseudonyms for one evaluation bearing exact declared site/population identifiers. The tool emits pending evidence only; promotion later verifies signed commitments and declarations rather than reopening the raw rows. Neither step can prove label truth, distinct human identity, sampling provenance or representativeness, training-membership exclusion, one-time holdout use, evaluator implementation identity, organizational independence, approval authority, or accreditation.

That 2,000-pseudonym minimum may be infeasible for a small or newly deployed edge site. Such a site must remain advisory unless it can complete the same scope-bound validation process. The current repository does not implement privacy-preserving pooled or federated validation. It also does not bind a pseudonym-issuing authority or alias-resolution policy into the receipt, so deployment governance must prevent one person from appearing under multiple pseudonyms and must document how identities are reconciled across sites without exposing raw identifiers.

Hybrid Training Data

The training command accepts an optional --operational-dataset JSONL file alongside ontology-backed synthetic scenarios. Operational records must contain a pseudonymous score request, a bounded trust-score label, a known scenario family, an analyst disposition, a confirmed downstream outcome, and an event-time anchor. Raw telemetry without reviewed labels is rejected.

Training reports retain separate synthetic and external sample counts plus the SHA-256 of each input dataset. This makes the data mix and label authority reviewable without copying raw operational records into the model bundle.

The public-data adapter supports the LANL Comprehensive Multi-Source Cyber-Security Events corpus. The archive is acquired directly from LANL’s access-controlled download form and kept under ignored artifacts/ storage; it is neither added to Git nor embedded in a container. It emits only pseudonymous score requests. LANL red-team events are marked public_labeled; all other telemetry is marked public_unlabeled (a weak normality proxy). Neither category can satisfy operational evaluation, calibration, or enforcement-promotion requirements.

For a no-account, local-only network-risk corpus, the supported CSE-CIC-IDS2018 selection is the three fixed February CSVs totaling approximately 1.07 GB. The converter uses deterministic, per-day/per-label hash sampling and retains the three capture days as temporal partitions. CSE attack labels are public network labels, not identity or analyst truth.

# Acquire auth.txt.gz and redteam.txt.gz through LANL's dataset form first.
python -m src.trustai_scoring.training.public_datasets prepare-lanl-cyber1 \
  --auth artifacts/trustai-datasets/lanl-cyber1/auth.txt.gz \
  --redteam artifacts/trustai-datasets/lanl-cyber1/redteam.txt.gz \
  --output artifacts/trustai-datasets/lanl-cyber1/training.jsonl \
  --max-auth-records 1000000 --max-examples 20000

python -m src.trustai_scoring.training.train_edge_model \
  --operational-dataset artifacts/trustai-datasets/lanl-cyber1/training.jsonl \
  --min-operational-examples 1000
# Downloads remain in ignored artifacts/ and are never included in an image.
mkdir -p artifacts/trustai-datasets/cse-cic-ids2018
aws s3 cp --no-sign-request --region ca-central-1 \
  's3://cse-cic-ids2018/Processed Traffic Data for ML Algorithms/' \
  artifacts/trustai-datasets/cse-cic-ids2018/ --exclude '*' \
  --include 'Friday-02-03-2018_TrafficForML_CICFlowMeter.csv' \
  --include 'Friday-16-02-2018_TrafficForML_CICFlowMeter.csv' \
  --include 'Friday-23-02-2018_TrafficForML_CICFlowMeter.csv'

python -m src.trustai_scoring.training.public_datasets prepare-cse-cic-ids2018 \
  --dataset-dir artifacts/trustai-datasets/cse-cic-ids2018 \
  --output artifacts/trustai-datasets/cse-cic-ids2018/training.jsonl
python -m src.trustai_scoring.training.train_edge_model \
  --operational-dataset approved-operational-labels.jsonl \
  --min-operational-examples 1000

Validation Path

The current validation path starts or targets the edge scoring service with models/trustai/edge-default and runs:

./scripts/validate-trustai-edge-scoring.sh

For deployment claims, pair that with local-live or environment validation:

./scripts/run-local-live-validation.sh
./scripts/run-security-validation.sh --live
make control-validation

Passing a local validator proves the repository-supported runtime path for that run. It does not prove production model reliability. That claim requires the independently labeled operational evaluation, calibration, slice-level false-positive evidence, signed promotion, and post-deployment shadow/drift evidence described above.

Change Review Checklist

Change Required review

Scoring rule or model bundle

Update bundle metadata, hash, rule-set version, validation artifacts, and guide source references.

Feature extraction

Check data minimization, graph query limits, missing-data confidence, and tests for sparse histories.

Edge scorer API

Check TLS/mTLS, admin authorization, timeout behavior, and backward compatibility with Go client.

DDIL scoring behavior

Check cache age, stale-state policy, local model checksum, queue behavior, and replay evidence.

Gateway behavior observation route

Check operator/AAL/fresh-auth gates and audit visibility.

Control validation status

Regenerate artifact-gated control results; do not manually mark controls validated.