From a22d5758a9ab0d2443ac7d6e22088e70b8f9856d Mon Sep 17 00:00:00 2001 From: Rhyan J Neble Date: Tue, 14 Jul 2026 22:16:26 -0600 Subject: [PATCH] dev-companion: illustrative developer templates verified against v2.1.2 Scaffolding-level templates mapping the specification's requirements to executable shape: Sovereign and Enforcer archetype substrates, the Bridge-of-Trust dual-enclave crossing, the untrusted-data admission gate, IAME envelope JSON Schema, the five-tier validation ladder, a federation treaty contract, Cluster Mode Byzantine participant, cross-tenant isolation, the ten-phase workload-offload profile, T1-T9 threat-matrix blueprints, and illustrative threat-corpus test scaffolding. Illustrative, not normative - the specification is the contract. Verified against release v2.1.2 (commit c125106). --- dev-companion/README.md | 70 ++++++++++ dev-companion/archetypes/enforcer.py | 103 ++++++++++++++ dev-companion/archetypes/executor_bridge.py | 128 ++++++++++++++++++ .../archetypes/inbound_sanitization.py | 70 ++++++++++ dev-companion/archetypes/sovereign.py | 93 +++++++++++++ .../cluster/byzantine_participant.py | 98 ++++++++++++++ .../cluster/cross_tenant_isolation.py | 79 +++++++++++ .../schemas/federation_envelope.json | 36 +++++ .../schemas/iame_envelope.schema.json | 97 +++++++++++++ dev-companion/schemas/validation_ladder.json | 43 ++++++ dev-companion/tests/threat_corpus_tests.py | 86 ++++++++++++ dev-companion/threat_matrix.md | 72 ++++++++++ .../workload/workload_migration.yaml | 45 ++++++ 13 files changed, 1020 insertions(+) create mode 100644 dev-companion/README.md create mode 100644 dev-companion/archetypes/enforcer.py create mode 100644 dev-companion/archetypes/executor_bridge.py create mode 100644 dev-companion/archetypes/inbound_sanitization.py create mode 100644 dev-companion/archetypes/sovereign.py create mode 100644 dev-companion/cluster/byzantine_participant.py create mode 100644 dev-companion/cluster/cross_tenant_isolation.py create mode 100644 dev-companion/schemas/federation_envelope.json create mode 100644 dev-companion/schemas/iame_envelope.schema.json create mode 100644 dev-companion/schemas/validation_ladder.json create mode 100644 dev-companion/tests/threat_corpus_tests.py create mode 100644 dev-companion/threat_matrix.md create mode 100644 dev-companion/workload/workload_migration.yaml diff --git a/dev-companion/README.md b/dev-companion/README.md new file mode 100644 index 0000000..8b96d58 --- /dev/null +++ b/dev-companion/README.md @@ -0,0 +1,70 @@ +# XSI-AIMS Developer Companion + +Illustrative, scaffolding-level templates that map the XSI-AIMS specification's +requirements to executable shape — for a team standing up a conformant agent +rig. These are *starting points with the correct semantics*, not production +code and not a reference implementation. Method bodies are deliberately left +unimplemented where the concrete work is deployment-specific. + +**Verified against:** XSI-AIMS specification release **v2.1.2** +(commit `c125106556a5d1f7e38e38d1bcdc4034d53beaeb`). + +Nothing in this directory is normative. Where a template and the specification +appear to diverge, the specification is the contract. Pin the specification +version you build against, exactly as these templates pin theirs. + +## Layout + +``` +dev-companion/ + archetypes/ sovereign.py — Sovereign persistent-substrate + bounded inference workload + enforcer.py — K7 Bayesian trust gradient + fail-closed budget gate + executor_bridge.py — Bridge-of-Trust dual-enclave crossing (counter-signed handoff) + inbound_sanitization.py — untrusted-data admission gate (tag, never "strip") + schemas/ iame_envelope.schema.json — internal message envelope (JSON Schema) + validation_ladder.json — the Enforcer's five-tier crossing-validation config + federation_envelope.json — federation treaty contract example + cluster/ byzantine_participant.py — Cluster Mode BFT bootstrap + quorum-gated commit + cross_tenant_isolation.py — the four permitted cross-tenant crossing classes + workload/ workload_migration.yaml — ten-phase atomic workload-offload profile + tests/ threat_corpus_tests.py — illustrative T1–T9 assertion scaffolding + threat_matrix.md ratification-gate + CI-flow blueprints and the T1–T9 threat matrix +``` + +## Semantics these templates are careful about + +A few points where implementations commonly go wrong, encoded here correctly: + +- **Revocation is rejection, not unreadability.** A message signed under a + revoked credential still verifies as mathematics; receivers reject it because + the authority chain no longer resolves to a live credential. +- **Inbound external content is admitted as data, never "stripped" safe.** + Mechanical normalization narrows the structural injection surface only; the + real defense is the permanent `UNTRUSTED_EXTERNAL` tag and the + never-treated-as-instruction contract. A pattern match is telemetry, not a gate. +- **The bridge handoff record is dual-signed by both enclaves.** The sender + signs its side, the receiver counter-signs on receipt; one enclave cannot + produce a dual signature alone. +- **Internal per-message signatures are the hybrid Ed25519 + ML-DSA-65 + construction** (pure ML-DSA only after the post-2031 transition); SLH-DSA is + reserved for the external domain's algorithm agility. +- **A CRITICAL trust standing makes an agent a quarantine *candidate*** with an + immediate Sovereign-mandatory review and ratification-required operation — + correction before containment, not an automatic hard quarantine. +- **Post-partition queued federation traffic is revalidated against current + authority before release** — never replayed on pre-partition standing. +- **Byzantine consensus, not crash-fault consensus,** protects the canonical + Witness chain in Cluster Mode; a two-node "quorum" is an honestly-labeled + degenerate mode, not Byzantine tolerance. + +## Using the tests + +`tests/threat_corpus_tests.py` is mock-driven illustration of the intended +failure-grading contracts (hard rejection + trust penalty for a corrupt +signature; soft stale-drop for an expired TTL; admission-as-untrusted for +external content). It runs only once an adopter supplies real implementations +behind the scaffolding interfaces. + +## License + +Same terms as this repository — see `LICENSE` / `LICENSE-CODE` at the root. diff --git a/dev-companion/archetypes/enforcer.py b/dev-companion/archetypes/enforcer.py new file mode 100644 index 0000000..0f2bcdc --- /dev/null +++ b/dev-companion/archetypes/enforcer.py @@ -0,0 +1,103 @@ +""" +Enforcer archetype scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +The Enforcer is the constraining archetype of the Formation layer. It owns the +technical validation gates, verifies signatures, custodies the ground-truth +Schedule, tracks trust via the K7 Bayesian credible-interval gradient, and issues +pass / fail / escalation verdicts. +""" +from typing import Dict, Tuple + + +class EnforcerPersistentSubstrate: + """ + The technical-requirements checkpoint and K7 trust-gradient tracker. K7 + updates run under a strict PT0.05S (50 ms) latency bound per verdict. + """ + + def __init__(self): + # Per-(sender) K7 Beta(alpha, beta) counts, uniform prior alpha=beta=1. + self.agent_profiles: Dict[str, Dict[str, int]] = {} + + def register_agent_baseline(self, agent_id: str) -> None: + self.agent_profiles.setdefault(agent_id, {"alpha": 1, "beta": 1}) + + def update_k7_trust_gradient(self, agent_id: str, verdict: str) -> Tuple[float, str]: + """ + Apply the K7 update rule (PASS/FAIL/QUARANTINE; ESCALATE is a no-update + that routes to the Integration Function), then act on L, the lower bound + of the 95% credible interval — "what's the worst this agent could + reasonably be, given everything seen." + """ + self.register_agent_baseline(agent_id) + profile = self.agent_profiles[agent_id] + + # Asymmetric update: an ordinary FAIL costs one; a quarantine-grade event + # costs five. That asymmetry is where "a bad action costs more" lives. + if verdict == "PASS": + profile["alpha"] += 1 + elif verdict == "FAIL": + profile["beta"] += 1 + elif verdict == "QUARANTINE": + profile["beta"] += 5 + elif verdict == "ESCALATE": + pass # no update; routed to the Integration Function + else: + raise ValueError(f"unknown verdict: {verdict!r}") + + L = self._credible_interval_lower_bound(profile["alpha"], profile["beta"]) + + # Trust-class thresholds are verified against the specification's trust gradient: + # L > 0.95 -> HIGH (baseline scrutiny only) + # 0.80 <= L <= 0.95 -> NORMAL + # 0.60 <= L < 0.80 -> DEGRADED (five-layer scrutiny mandatory) + # L < 0.60 -> CRITICAL + if L > 0.95: + trust_class = "HIGH" + elif 0.80 <= L <= 0.95: + trust_class = "NORMAL" + elif 0.60 <= L < 0.80: + trust_class = "DEGRADED" + else: + trust_class = "CRITICAL" + # CRITICAL does NOT auto-hard-quarantine. Per the specification it makes the + # agent a quarantine *candidate*, requires deterministic ratification + # for every authority-bearing operation, and triggers an IMMEDIATE + # Sovereign-mandatory review — correction before containment. + self.flag_quarantine_candidate(agent_id, reason="K7_CRITICAL") + self.request_sovereign_review(agent_id, priority="IMMEDIATE") + + return L, trust_class + + def _credible_interval_lower_bound(self, alpha: int, beta: int) -> float: + """ + The lower bound of the 95% Beta credible interval. + + NOTE: a real implementation MUST use a proper Beta quantile + (e.g. scipy.stats.beta.ppf(0.025, alpha, beta)); the normal + approximation below is a stand-in only and is inaccurate for small + alpha/beta, which is exactly the low-history regime that matters most. + """ + total = alpha + beta + mean = alpha / total + variance = (alpha * beta) / ((total ** 2) * (total + 1)) + std_dev = variance ** 0.5 + return max(0.0, mean - 1.96 * std_dev) # placeholder; replace with beta.ppf + + def enforce_token_budget(self, working_memory_id: str, proposed_write_tokens: int) -> bool: + """ + Fail-closed token-budget check. A write that would breach the budget is + REFUSED with a typed refusal (never a silent eviction to make room). A + new over-budget write never enters; content already held that is later + displaced is archived to the durable record, not discarded. + """ + raise NotImplementedError + + def flag_quarantine_candidate(self, agent_id: str, reason: str) -> None: + """Mark as a quarantine candidate + emit a Witness event; do not isolate yet.""" + raise NotImplementedError + + def request_sovereign_review(self, agent_id: str, priority: str) -> None: + raise NotImplementedError diff --git a/dev-companion/archetypes/executor_bridge.py b/dev-companion/archetypes/executor_bridge.py new file mode 100644 index 0000000..4490aa9 --- /dev/null +++ b/dev-companion/archetypes/executor_bridge.py @@ -0,0 +1,128 @@ +""" +Bridge-of-Trust Executor scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +The Executor is the sole Execution-layer archetype and the only one that reaches +anything outside the seal. It isolates two cryptographically separated enclaves — +InternalEnclave (internal-domain keys) and ExternalEnclave (external-domain keys) +— joined only by a narrow Bridge across which nothing but plaintext ever passes, +and only after the crossing is verified and witnessed. +""" +import abc +import hashlib +from typing import Dict, Any, Tuple + + +class CryptographicEnclaveException(Exception): + """Raised when a domain boundary or enclave constraint is violated.""" + + +class InternalEnclave: + """Houses internal-domain signing keys; verifies directives from the Orchestrator.""" + + def __init__(self, internal_key_store: Dict[str, Any]): + self._keys = internal_key_store + + def verify_and_sign_handoff(self, iame_envelope: Dict[str, Any]) -> Tuple[Dict[str, Any], str]: + """ + Bridge step 2: verify the internal envelope, then sign THIS enclave's + side of the handoff record. + + The handoff record is *dual*-signed, but one enclave cannot produce a + dual signature alone: the internal enclave signs its side here, and the + external enclave counter-signs on receipt (see + ExternalEnclave.countersign_handoff). Only the pair of signatures proves + the directive actually crossed the bridge. + """ + if iame_envelope.get("cryptographic_domain") != "internal": + raise CryptographicEnclaveException( + "Domain boundary violation: expected an internal envelope.") + # [deterministic internal-signature validation would occur here] + payload = iame_envelope["body"]["opaque_payload_bytes"] + internal_half_sig = "INT_SIG_" + hashlib.sha256(payload.encode()).hexdigest()[:16] + return iame_envelope["body"], internal_half_sig + + +class ExternalEnclave: + """Houses external-domain keys; handles counter-signing, attestation, and egress.""" + + def __init__(self, external_key_store: Dict[str, Any]): + self._keys = external_key_store + + def countersign_handoff(self, plaintext_payload: Dict[str, Any], internal_half_sig: str) -> str: + """ + Bridge step 3 (completion): the receiving (external) enclave counter-signs + the moment it takes the plaintext. internal_half_sig + this counter-sign + together form the dual-signed handoff record, witnessed at the time it + happens rather than asserted by one side. + """ + external_half_sig = "EXT_HANDOFF_SIG_" + hashlib.sha256( + (internal_half_sig + str(plaintext_payload)).encode()).hexdigest()[:16] + return f"{internal_half_sig}::{external_half_sig}" # the completed dual signature + + def construct_external_envelope(self, plaintext_payload: Dict[str, Any], + binding_ctx: Dict[str, Any]) -> Dict[str, Any]: + """ + Bridge steps 4 & 5: minimal-disclosure wrap in the external wire format, + attach hardware-rooted attestation, and sign with external-domain keys. + """ + # Minimal disclosure: only what the operation named leaves; live operating + # state, authority claims, policy config, and the audit trail are excluded. + sanitized_body = { + "task_input": plaintext_payload.get("task_input"), + "scope_restriction_hash": binding_ctx["scope_hash"], + } + external_envelope = { + "cryptographic_domain": "external", + "sender": { + "executor_instance_id": "EXE-01", + # The more conservative post-quantum scheme (SLH-DSA) is an + # EXTERNAL-domain algorithm-agility option, never internal. + "signature_suite": "SLH-DSA-128f", + "hardware_attestation_token": "FIPS-140-3-LEVEL-3-TOKEN", + }, + "header": { + "binding_reference": binding_ctx["binding_reference"], + "output_ceiling_tokens": binding_ctx["output_ceiling_tokens"], + }, + "body": sanitized_body, + "signature": None, + } + external_envelope["signature"] = "EXT_SIG_" + hashlib.sha256( + str(sanitized_body).encode()).hexdigest() + return external_envelope + + +class BridgeOfTrustExecutor(abc.ABC): + """Coordinates the five-step outbound bridge crossing between the isolated domains.""" + + def __init__(self, internal_keys: Dict[str, Any], external_keys: Dict[str, Any]): + self.internal_enclave = InternalEnclave(internal_keys) + self.external_enclave = ExternalEnclave(external_keys) + + def outbound_bridge_crossing(self, orchestrator_directive: Dict[str, Any], + binding_ctx: Dict[str, Any]) -> Dict[str, Any]: + """The five-step outbound sequence; each step closes a specific gap the prior one leaves open.""" + try: + # 1. Directive arrives from the Orchestrator path. + # 2. Internal verification + the internal half of the handoff signature. + verified_payload, internal_half_sig = \ + self.internal_enclave.verify_and_sign_handoff(orchestrator_directive) + # 3. The bridge handoff: plaintext crosses; the external enclave + # counter-signs on receipt, completing the dual-signed record. + dual_signed_record = self.external_enclave.countersign_handoff( + verified_payload, internal_half_sig) + _ = dual_signed_record # witnessed at crossing time + # 4 & 5. External envelope construction (attestation) + external signature + egress. + return self.external_enclave.construct_external_envelope(verified_payload, binding_ctx) + except Exception as exc: + # Failure fails closed: quarantine + hand instance control to the Sovereign, + # never a soft retry loop. + self.trigger_emergency_quarantine_halt(reason=str(exc)) + raise + + @abc.abstractmethod + def trigger_emergency_quarantine_halt(self, reason: str) -> None: + """Suspend southbound dispatch and hand instance control to the Sovereign.""" + raise NotImplementedError diff --git a/dev-companion/archetypes/inbound_sanitization.py b/dev-companion/archetypes/inbound_sanitization.py new file mode 100644 index 0000000..876c9f6 --- /dev/null +++ b/dev-companion/archetypes/inbound_sanitization.py @@ -0,0 +1,70 @@ +""" +Inbound sanitization gate scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +IMPORTANT — what this gate does and does NOT do (corrects a common misreading): + +The deterministic transform narrows the *structural* injection surface — +malformed framing, control characters, format-confusion tricks — as a side +effect of re-serializing and normalizing the content. It does NOT, and cannot, +strip a *semantic* instruction: an instruction can be phrased a thousand ways, +and no regex or mechanical pass reliably removes it. + +The actual defense is not stripping. It is that external content is only ever +admitted as DATA, carrying a permanent `UNTRUSTED_EXTERNAL` tag that cannot be +relabeled downstream, and is never routed anywhere that would act on it as an +instruction. Any summary derived from it inherits the same untrusted lineage. +So the gate below ADMITS the content (tagged), it does not "pass/fail" it on a +pattern match. A pattern hit is a telemetry signal, not the gate. +""" +import re +from typing import Dict, Any + + +class InboundSanitizationGate: + def __init__(self): + # These patterns are a low-value TELEMETRY signal only. They are NOT the + # defense and MUST NOT be treated as sufficient — see the module docstring. + self._suspicion_signals = [ + re.compile(r"ignore (all )?prior instructions", re.IGNORECASE), + re.compile(r"system override", re.IGNORECASE), + ] + + def admit_ingress_payload(self, raw_external_response: str, source_identity: str) -> Dict[str, Any]: + """ + Admit inbound external content as untrusted data. + + Steps: (1) size-cap deterministically; (2) structural normalization + (re-serialize / strip control characters) to shrink the structural + injection surface; (3) permanently tag UNTRUSTED_EXTERNAL with provenance. + The content is returned admitted — the caller's contract is that it is + reference DATA, never an instruction. + """ + # 1. Deterministic size cap (protects the context/memory budget). + max_size_bytes = 524_288 # 512 KiB + capped = raw_external_response[:max_size_bytes] + + # 2. Structural normalization only. This reduces structural injection + # vectors; it does not neutralize a semantic instruction. + normalized = capped.strip().encode("utf-8", errors="ignore").decode("utf-8") + + # 3. Telemetry signal (NOT a gate). A hit is logged for shadow detection; + # it does not block admission, because blocking-on-pattern would give a + # false sense that semantic injection has been removed. + suspicion_hit = any(p.search(normalized) for p in self._suspicion_signals) + + return { + "content": normalized, + "provenance": { + "source_auxiliary_id": source_identity, + # Fixed tag; cannot be relabeled to trusted anywhere downstream. + "trust_classification": "UNTRUSTED_EXTERNAL", + "structural_normalization": "APPLIED", + # Records that a signal fired — for the shadow-detection apparatus, + # not a claim that the content is now safe to execute. + "suspicion_signal": suspicion_hit, + }, + # The load-bearing contract: downstream MUST treat this as data only. + "handling_contract": "REFERENCE_DATA_ONLY__NEVER_AS_INSTRUCTION", + } diff --git a/dev-companion/archetypes/sovereign.py b/dev-companion/archetypes/sovereign.py new file mode 100644 index 0000000..11c2a28 --- /dev/null +++ b/dev-companion/archetypes/sovereign.py @@ -0,0 +1,93 @@ +""" +Sovereign archetype scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +The Sovereign is a per-user, model-based agent alone at the Intent layer. Its +role is bounded to a small set of mediation functions — assess intent, delegate +planning and execution, verify the returned result against the confirmed intent, +and manage the session credential. It holds the AUTHORITY posture, which +*transcends* the three operating modes rather than being a fourth mode; it does +not perform operational work itself. +""" +import abc +from typing import Dict, Any + + +class SovereignPersistentSubstrate(abc.ABC): + """ + The always-on Governance Stratum for the Sovereign: purely deterministic + bookkeeping, rate limits, signature checks, and credential-state management, + consuming no inference. + """ + + def __init__(self, user_id: str, session_ttl_seconds: int = 28800): + self.user_id = user_id + # session_ttl is a DEPLOYMENT configuration value, not a spec constant; + # 8h shown only as an example default. + self.session_ttl = session_ttl_seconds + self.session_credential = None + # Delegation/hierarchy depth: max_hierarchy_depth default is 4 per the + # Registration Gate; exceeding 4 requires explicit operator approval. + # (Composite-of-Composite chain depth is separately capped at 3.) + self.max_hierarchy_depth = 4 + + @abc.abstractmethod + def generate_root_key_material(self) -> Dict[str, Any]: + """Deterministic tool exercised once at commissioning/initialization.""" + raise NotImplementedError + + @abc.abstractmethod + def emit_authority_transfer(self, confirmed_plan: Dict[str, Any]) -> str: + """ + Emit a signed authority-transfer-to-Orchestrator payload. A non-delegable + duty that MUST clear a deterministic ratification gate before it takes + effect (Principle 4: judgment proposes, determinism decides). + """ + raise NotImplementedError + + @abc.abstractmethod + def revoke_session_credential(self) -> None: + """ + Invalidate the session credential. + + NOTE (corrects a common misconception): revocation does NOT make prior + messages "unreadable." A message signed under the revoked credential + still verifies as mathematics; what changes is that its authority chain + no longer resolves to a *live* credential, so any receiver that checks + the chain **rejects** the message and raises a domain/authority + violation. Revocation is a rejection semantics, not a decryption one. + """ + raise NotImplementedError + + +class SovereignInferenceWorkload: + """ + The bounded Inference Stratum for the Sovereign: spawns at authentication, + quiesces during the Visionary/Architect planning phase (the substrate keeps + witnessing them deterministically without spending an inference slot), and + dissolves at logout, timeout, or revocation. + """ + + def __init__(self, substrate: SovereignPersistentSubstrate): + self.substrate = substrate + + def run_clarification_dialogue(self, natural_language_input: str) -> Dict[str, Any]: + """ + Inference-driven: turn a natural-language request into a structured + directive, surfacing genuine ambiguity back to the human rather than + guessing. The proposed directive is a PROPOSAL — it must clear + deterministic ratification before anything is emitted downstream. + """ + # 1. Interpret intent. 2. Extract scope + constraints. + # 3. Form a proposed_directive. 4. Route to ratification, not execution. + raise NotImplementedError + + def verify_return_fidelity(self, final_report: Dict[str, Any], + original_intent: Dict[str, Any]) -> bool: + """ + Inference-driven check that the returned payload genuinely matches the + intent the human confirmed. Its verdict is itself ratified downstream; + the Sovereign proposes, a deterministic component disposes. + """ + raise NotImplementedError diff --git a/dev-companion/cluster/byzantine_participant.py b/dev-companion/cluster/byzantine_participant.py new file mode 100644 index 0000000..a842b0b --- /dev/null +++ b/dev-companion/cluster/byzantine_participant.py @@ -0,0 +1,98 @@ +""" +Cluster Mode Byzantine participant scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +Cluster Mode presents many physical nodes under one operator as a single logical +deployment with one canonical Witness chain, replicated by Byzantine-tolerant +consensus (PBFT, HotStuff, BFT-SMaRt, or Tendermint in Byzantine mode). Crash- +fault-only protocols such as Raft are forbidden: a compromised node can lie, not +just go silent, and only a Byzantine-tolerant protocol keeps a replicated ledger +correct when a participant is actively malicious. +""" +import abc +import hashlib +from typing import Dict, Any, List, Set + + +class ClusterConsensusError(Exception): + """Raised on attestation failure or a sub-quorum commit attempt.""" + + +class NodeIdentity: + def __init__(self, node_id: str, hardware_attestation_token: str): + self.node_id = node_id + self.attestation_token = hardware_attestation_token + + +def byzantine_quorum_size(n: int) -> int: + """ + A Byzantine-tolerant quorum for n nodes: with f = floor((n-1)/3) tolerated + faults, the commit quorum is 2f + 1. + + Degenerate cases the spec names openly: + * n = 2 -> f = 0, quorum = 1. NOT Byzantine-tolerant in any meaningful + sense (a quorum of two cannot outvote one lying member). The + spec permits `cluster_mode: true, quorum=2` only as an honestly + labeled degenerate mode for an SMB that wants the availability/ + migration machinery without genuine BFT. + * n = 3 -> f = 0. Simple consensus; tolerates no Byzantine fault. + * n >= 4 -> f >= 1. Genuine Byzantine tolerance begins here. + """ + f = (n - 1) // 3 + return 2 * f + 1 + + +class ByzantineClusterParticipant(abc.ABC): + def __init__(self, node_id: str, cluster_nodes: Set[str]): + self.node_id = node_id + self.peers = set(cluster_nodes) + self.is_active = False + self.local_chain_replica: List[Dict[str, Any]] = [] + + @property + def quorum_threshold(self) -> int: + return byzantine_quorum_size(len(self.peers)) + + def bootstrap_node(self, target_node: NodeIdentity) -> bool: + """ + Hardware-rooted bootstrap: a node clears attestation, verified by the + existing quorum, BEFORE it replicates the canonical chain and is admitted + into consensus. A node that leaves gracefully migrates its user-pairs + atomically, seals its chain segment, and exits quorum cleanly. + """ + if not self._verify_hardware_enclave_signature(target_node.attestation_token): + raise ClusterConsensusError( + f"Bootstrap aborted: node {target_node.node_id} failed hardware attestation.") + self._sync_canonical_chain_to(target_node.node_id) + self.peers.add(target_node.node_id) + return True + + def propose_block_commit(self, proposed_transaction: Dict[str, Any], + validator_signatures: List[str]) -> bool: + """ + Append-only commit into the canonical Witness chain, gated on a Byzantine + quorum. A single compromised node or sub-quorum cannot commit — an + attacker must compromise a quorum, which is far noisier than one box. + """ + if len(set(validator_signatures)) < self.quorum_threshold: + return False + prev_hash = self.local_chain_replica[-1]["current_hash"] if self.local_chain_replica else "GENESIS" + block_entry = { + "index": len(self.local_chain_replica), + "payload": proposed_transaction, + "previous_hash": prev_hash, + "signatures": sorted(set(validator_signatures)), + "current_hash": None, + } + block_entry["current_hash"] = hashlib.sha256(str(block_entry).encode()).hexdigest() + self.local_chain_replica.append(block_entry) + return True + + @abc.abstractmethod + def _verify_hardware_enclave_signature(self, token: str) -> bool: + raise NotImplementedError + + @abc.abstractmethod + def _sync_canonical_chain_to(self, target_id: str) -> None: + raise NotImplementedError diff --git a/dev-companion/cluster/cross_tenant_isolation.py b/dev-companion/cluster/cross_tenant_isolation.py new file mode 100644 index 0000000..73bb91d --- /dev/null +++ b/dev-companion/cluster/cross_tenant_isolation.py @@ -0,0 +1,79 @@ +""" +Cross-tenant isolation scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. Illustrative scaffolding, not production code. + +One operator, one deployment, many customers who must never see each other's +data. The isolation baseline: content and state are bucketed per tenant, per +archetype, per foundation model, and nothing crosses a tenancy boundary by +default. Exactly four classes of crossing are permitted; nothing else. +""" +from typing import Dict, Any, Set + + +class TenantBoundaryViolation(Exception): + """Raised when data attempts to cross a tenancy boundary without an explicit Sovereign decree.""" + + +class MultiTenantIsolationFabric: + """Enforces tenant boundaries inside a shared Tier-2 capability pool.""" + + def __init__(self, deployment_policy_bundle: Dict[str, Any]): + self.policy = deployment_policy_bundle + self.tenant_datastores: Dict[str, Dict[str, Any]] = {} + # Cross-tenant grants elevated by an explicit, permanently-recorded Sovereign decree. + self.decree_elevated_allowlist: Set[str] = set() + + def process_cross_tenant_read(self, source_tenant_id: str, target_tenant_id: str, + artifact_id: str, crossing_class: str) -> Dict[str, Any]: + if source_tenant_id == target_tenant_id: + return self.tenant_datastores[source_tenant_id]["artifacts"][artifact_id] + + if crossing_class == "AGGREGATE_TELEMETRY": + # Class 1: class-level granularity only; no per-tenant/per-item specifics cross. + return self._extract_deidentified_class_metrics(target_tenant_id, artifact_id) + + if crossing_class == "DEPLOYMENT_STRUCTURAL_ARTIFACT": + # Class 2: shared framework/policy definitions owned by the deployment itself. + return self._get_deployment_policy_blueprint(artifact_id) + + if crossing_class == "DECREE_ELEVATED_GRANT": + # Class 3: requires a Witness-anchored Sovereign decree in the allowlist. + lookup_key = f"{target_tenant_id}::{artifact_id}" + if lookup_key not in self.decree_elevated_allowlist: + raise TenantBoundaryViolation( + f"Access denied: {artifact_id} lacks an explicit Sovereign elevation decree.") + return self.tenant_datastores[target_tenant_id]["artifacts"][artifact_id] + + if crossing_class == "FEDERATION_FLOW": + # Class 4: handed to the Distributed Coherence Protocol federation mapping. + return self._route_to_dcp_envelope(target_tenant_id, artifact_id) + + raise TenantBoundaryViolation( + f"Unlawful cross-tenancy traversal from {source_tenant_id} to {target_tenant_id}") + + def ingest_marketplace_auxiliary(self, auxiliary_template: Dict[str, Any], + importing_tenant_id: str) -> None: + """ + A marketplace-imported Auxiliary lands scoped to the SINGLE importing + tenant, regardless of how broadly it was shared at its source, and enters + at the lowest trust tier. Within that tenant it joins the shared Tier-2 + pool; cross-tenant reuse requires the same decree-elevation the general + isolation rule demands. + """ + local_binding = { + "template_id": auxiliary_template["id"], + "assigned_tenant_scope": importing_tenant_id, # mandatory local scoping override + "trust_tier": "EPHEMERAL", # trust-tier reset on import + "memory_context": "ISOLATED_CLEAR_INIT", + } + self.tenant_datastores[importing_tenant_id]["bound_auxiliaries"][auxiliary_template["id"]] = local_binding + + def _extract_deidentified_class_metrics(self, tenant_id: str, artifact_id: str) -> Dict[str, Any]: + raise NotImplementedError + + def _get_deployment_policy_blueprint(self, artifact_id: str) -> Dict[str, Any]: + raise NotImplementedError + + def _route_to_dcp_envelope(self, tenant_id: str, artifact_id: str) -> Dict[str, Any]: + raise NotImplementedError diff --git a/dev-companion/schemas/federation_envelope.json b/dev-companion/schemas/federation_envelope.json new file mode 100644 index 0000000..b44e6b1 --- /dev/null +++ b/dev-companion/schemas/federation_envelope.json @@ -0,0 +1,36 @@ +{ + "specification_version": "XSI-AIMS-v2.1.2", + "scope_level": "FEDERATION_SCOPE", + "federation_treaty_id": "env-treaty-9a2c-47b1", + "coexistence_steady_state": true, + "protocol_transport": "DISTRIBUTED_COHERENCE_PROTOCOL", + "reconciliation_cadence_seconds": 300, + "heartbeat_interval_seconds": 30, + "bridge_attestation_manifest": { + "environment_a_root": "PUB_KEY_ATTEST_ENV_A_ML_DSA_87", + "environment_b_root": "PUB_KEY_ATTEST_ENV_B_ML_DSA_87", + "rule_assertion": "Attestation keys MUST be distinct from operational signing keys." + }, + "authorized_operations_allowlist": [ + "SHARED_MEMORY_ACCESS", + "WORKLOAD_DELEGATION", + "CROSS_ENVIRONMENT_WORKLOAD_OFFLOAD" + ], + "identity_bridge_policy": { + "provenance_preservation": "VERBATIM_NAMESPACING", + "canonical_format": "originating_framework::local_agent_id", + "example_routing_string": "framework_B::agent_47" + }, + "partition_fault_strategy": { + "missed_heartbeats_threshold": 3, + "on_partition_outbound": "QUEUE_CHRONOLOGICALLY", + "on_partition_inbound": "REJECT_UNCONDITIONALLY", + "on_reconnection": "REVALIDATE_AGAINST_CURRENT_AUTHORITY_THEN_ORDERED_RELEASE", + "on_reconnection_note": "Queued traffic is REVALIDATED against the authority and policy in force at reconnection before it is released in original order — it is not replayed on pre-partition standing; anything that no longer clears is rejected. An immediate full reconciliation runs on heal rather than waiting for the next scheduled tick." + }, + "required_signatures": { + "environment_a_sovereign_signature": "SIG_SOV_A", + "environment_b_sovereign_signature": "SIG_SOV_B", + "principal_human_cosign": "SIG_HUMAN_PRINCIPAL_REQUIRED_FOR_OFFLOAD" + } +} diff --git a/dev-companion/schemas/iame_envelope.schema.json b/dev-companion/schemas/iame_envelope.schema.json new file mode 100644 index 0000000..47660d9 --- /dev/null +++ b/dev-companion/schemas/iame_envelope.schema.json @@ -0,0 +1,97 @@ +{ + "$schema": "http://json-schema.org/draft-07/schema#", + "title": "IAME_Envelope", + "description": "Internal (Inter-Agent Message) Envelope. Verified against XSI-AIMS v2.1.2. Every authority-bearing message inside the seal is structured this way and is checkable before a byte is acted on.", + "type": "object", + "required": ["cryptographic_domain", "sender", "header", "body", "witness_attestation"], + "properties": { + "cryptographic_domain": { + "type": "string", + "enum": ["internal"], + "description": "Must equal 'internal'. An internal envelope routed across the perimeter to the external domain is rejected as a domain-boundary violation; internal and external signing domains never share key material." + }, + "sender": { + "type": "object", + "required": ["agent_id", "archetype_class", "credential_reference", "signature_suite", "key_epoch"], + "properties": { + "agent_id": { "type": "string", "format": "uuid" }, + "archetype_class": { "type": "string" }, + "credential_reference": { "type": "string" }, + "signature_suite": { + "type": "string", + "enum": ["Ed25519+ML-DSA-65"], + "description": "Internal per-message signing FLOOR is the hybrid Ed25519 + ML-DSA-65 construction (secure as long as either half holds). Pure ML-DSA is not a conformant internal option before the post-2031 transition; the more conservative post-quantum scheme (SLH-DSA) is reserved for the EXTERNAL domain's algorithm-agility, never the internal envelope." + }, + "key_epoch": { + "type": "integer", + "description": "Monotonic key epoch. A message signed under a superseded epoch is fenced (rejected); on rotation, old key material is zeroized." + } + } + }, + "header": { + "type": "object", + "required": ["message_id", "sequence_number", "path_id", "message_type", "replay_nonce", "time_to_live"], + "properties": { + "message_id": { "type": "string", "format": "uuid" }, + "sequence_number": { "type": "integer", "minimum": 0 }, + "path_id": { + "type": "string", + "pattern": "^PATH-(0[1-9]|1[0-9]|2[0-2])$", + "description": "One of the 22 canonical paths. A Temporary Path (a gated, bounded-lifetime Architect-created extension) is not a canonical PATH-NN and is registered separately." + }, + "message_type": { + "type": "string", + "enum": [ + "DIRECTIVE", + "REPORT", + "OBSERVATION", + "ALERT", + "QUERY", + "AUTHORITY_TRANSFER", + "CONSISTENCY_CHECK", + "CONSENSUS_REQUEST", + "CONSENSUS_RESPONSE" + ], + "description": "Per the specification's message-type vocabulary. Witnessing is a message-type PROPERTY carried by OBSERVATION / ALERT traffic on any canonical path — there is no 'WITNESS' message type and no dedicated witness path class (the former W-paths were retired). Streamed output uses STREAM_CHUNK / STREAM_FINALIZE / STREAM_ABORT sub-types on a REPORT/OBSERVATION-class output; those are an output-delivery discipline, not authority-bearing message types." + }, + "replay_nonce": { "type": "string" }, + "time_to_live": { + "type": "string", + "format": "date-time", + "description": "An expired TTL is a SOFT (stale, non-malicious) rejection and does not incur a catastrophic trust penalty — distinct from a signature/authority failure, which is a live safety event." + } + } + }, + "auxiliary_authority": { + "type": "object", + "description": "Conditional block, present only when the message authorizes invoking an external Auxiliary. Absent for ordinary internal traffic.", + "required": ["binding_reference", "scope_hash", "output_ceiling_tokens", "forbidden_actions"], + "properties": { + "binding_reference": { "type": "string", "format": "uuid" }, + "scope_hash": { "type": "string" }, + "output_ceiling_tokens": { "type": "integer" }, + "forbidden_actions": { "type": "array", "items": { "type": "string" } } + } + }, + "body": { + "type": "object", + "required": ["opaque_payload_bytes", "payload_hash"], + "properties": { + "opaque_payload_bytes": { "type": "string", "contentEncoding": "base64" }, + "payload_hash": { "type": "string" } + } + }, + "witness_attestation": { + "type": "object", + "required": ["witness_record_id", "previous_chain_hash", "witness_signature"], + "properties": { + "witness_record_id": { "type": "string", "format": "uuid" }, + "previous_chain_hash": { + "type": "string", + "description": "Hash-linked, append-only tamper-evidence (a Merkle/Certificate-Transparency-style chain with signed checkpoints and timeline entanglement) — not a blockchain and not consensus-mined outside Cluster Mode." + }, + "witness_signature": { "type": "string" } + } + } + } +} diff --git a/dev-companion/schemas/validation_ladder.json b/dev-companion/schemas/validation_ladder.json new file mode 100644 index 0000000..796a1e3 --- /dev/null +++ b/dev-companion/schemas/validation_ladder.json @@ -0,0 +1,43 @@ +{ + "specification_version": "XSI-AIMS-v2.1.2", + "archetype_gatekeeper": "ENFORCER", + "note": "Every boundary crossing is independently cross-checked by the Enforcer. The judgment tiers (4-5) run at elevated cadence in regulated subverticals by design and at a sampled cadence in standard deployments; the deterministic tiers (1-3) run on every crossing. Illustrative; the specification is the contract.", + "validation_ladder": { + "tier_1": { + "name": "SCHEMA_AND_SIGNATURE_VALIDITY", + "type": "DETERMINISTIC", + "enforcement_cadence": "EVERY_CROSSING", + "action_on_fail": "ABORT_AND_QUARANTINE" + }, + "tier_2": { + "name": "POLICY_RESOLUTION_CORRECTNESS", + "type": "DETERMINISTIC", + "enforcement_cadence": "EVERY_CROSSING", + "action_on_fail": "FORCE_DOWNGRADE" + }, + "tier_3": { + "name": "SIGNAL_TO_DECISION_COHERENCE", + "type": "DETERMINISTIC", + "enforcement_cadence": "EVERY_CROSSING", + "action_on_fail": "ESCALATE_TO_SOVEREIGN" + }, + "tier_4": { + "name": "SIGNAL_PLAUSIBILITY_JUDGMENT", + "type": "INFERENCE_HYBRID", + "context_overrides": { + "REGULATED_CONTEXT": "EVERY_CROSSING", + "STANDARD_CONTEXT": "SAMPLE_CADENCE_10_PERCENT" + }, + "action_on_fail": "ESCALATE_TO_SOVEREIGN" + }, + "tier_5": { + "name": "ADVERSARIAL_PROBE_FINGERPRINTING", + "type": "INFERENCE_JUDGMENT", + "context_overrides": { + "REGULATED_CONTEXT": "SAMPLE_CADENCE_25_PERCENT", + "STANDARD_CONTEXT": "SAMPLE_CADENCE_5_PERCENT" + }, + "action_on_fail": "ABORT_AND_ROLLBACK" + } + } +} diff --git a/dev-companion/tests/threat_corpus_tests.py b/dev-companion/tests/threat_corpus_tests.py new file mode 100644 index 0000000..aead28b --- /dev/null +++ b/dev-companion/tests/threat_corpus_tests.py @@ -0,0 +1,86 @@ +""" +Threat-corpus test scaffolding — XSI-AIMS developer companion. + +Verified against XSI-AIMS v2.1.2. ILLUSTRATIVE ONLY. This file is intentionally +NOT named test_*.py so the manual repo's pytest (scoped to its own tests/) does +not collect it. It is mock-driven and will not run standalone until an adopter +supplies real Enforcer/Sovereign implementations. Shown as pytest-shaped +assertions to convey the intended failure-grading contracts. +""" +from datetime import datetime, timedelta +from typing import Dict, Any + +# import pytest # (adopter environment) +# from archetypes.enforcer import EnforcerPersistentSubstrate +# from archetypes.executor_bridge import CryptographicEnclaveException + + +def generate_mock_iame_envelope(domain: str, path: str, sig_valid: bool, + ttl_expired: bool = False) -> Dict[str, Any]: + ttl = datetime.now() + (timedelta(minutes=-5) if ttl_expired else timedelta(minutes=5)) + return { + "cryptographic_domain": domain, + "sender": { + "agent_id": "8f8b832a-579c-4638-a28a-169542035bc2", + "archetype_class": "VISIONARY", + # Internal floor is the hybrid suite (not pure ML-DSA). + "signature_suite": "Ed25519+ML-DSA-65", + "key_epoch": 1, + }, + "header": { + "message_id": "12345678-1234-5678-1234-567812345678", + "sequence_number": 42, + "path_id": path, + "message_type": "DIRECTIVE", + "replay_nonce": "NONCE_ABC_123", + "time_to_live": ttl.isoformat(), + }, + "body": {"opaque_payload_bytes": "eyJhIjoiYiJ9", "payload_hash": "HASH_A"}, + "witness_attestation": { + "witness_record_id": "88888888-8888-8888-8888-888888888888", + "previous_chain_hash": "PREV_HASH_XYZ", + "witness_signature": "VALID_WITNESS_SIG" if sig_valid else "CORRUPT_SIG", + }, + } + + +# T1 - a bad signature is a live safety event: reject + asymmetric trust penalty. +def scenario_t1_corrupt_signature_is_graded_hard(): + corrupt = generate_mock_iame_envelope("internal", "PATH-01", sig_valid=False) + # enforcer.process_incoming_envelope(corrupt) -> raises INTEGRITY_BREACH + # then get_k7_standing(agent) -> trust_class in {"DEGRADED", "CRITICAL"} + assert corrupt["witness_attestation"]["witness_signature"] == "CORRUPT_SIG" + + +# T1 - an expired TTL is a SOFT (stale, non-malicious) drop: standing stays stable. +def scenario_t1_expired_ttl_is_graded_soft(): + stale = generate_mock_iame_envelope("internal", "PATH-01", sig_valid=True, ttl_expired=True) + # enforcer.process_incoming_envelope(stale) -> "STALE_REJECTION" + # get_k7_standing(agent) -> trust_class == "NORMAL" (no catastrophic penalty) + assert stale["header"]["message_type"] == "DIRECTIVE" + + +# T2 - external content is admitted as UNTRUSTED data, never "stripped" and never +# blocked on a regex match; the permanent tag + never-as-instruction is the defense. +def scenario_t2_external_content_admitted_untrusted(): + # gate.admit_ingress_payload(raw, source) -> + # provenance.trust_classification == "UNTRUSTED_EXTERNAL" + # handling_contract == "REFERENCE_DATA_ONLY__NEVER_AS_INSTRUCTION" + # (admission is NOT refused on a suspicion signal; the signal is telemetry) + pass + + +# T3 - a request outside the human-signed scope forces re-authentication, not a +# loose interpretation. +def scenario_t3_session_scope_ceiling_forces_reauth(): + # sovereign.evaluate_request_scope({"target_tenant": "TENANT-B_UNAUTHORIZED", ...}) + # -> "RE_AUTHENTICATION_PENDING" + pass + + +# T9 - substrate compromise is answered by quorum + cross-foundation attestation, +# NOT by "firewalling" the domain. +def scenario_t9_substrate_compromise_relies_on_quorum_not_firewall(): + # assert canonical Witness chain cannot be rewritten without a Byzantine quorum + # assert a single-substrate break surfaces as cross-foundation correlation deviation + pass diff --git a/dev-companion/threat_matrix.md b/dev-companion/threat_matrix.md new file mode 100644 index 0000000..fad2da6 --- /dev/null +++ b/dev-companion/threat_matrix.md @@ -0,0 +1,72 @@ +# Threat matrix + verification blueprints — XSI-AIMS developer companion + +> Verified against XSI-AIMS v2.1.2. Illustrative; the specification is the contract. + +## Deterministic Ratification Gate (Principle 4) + +No inference component executes an authority-bearing consequence unilaterally. A +proposal is ratified by a deterministic component first; a rigid function is +formally verified *where the property admits a proof*, and adversarial fuzzing +covers what isn't provable. + +``` + [ Inference Stratum Proposal ] + | + v + [ Deterministic Ratification Gate ] + | + +-------+-------+ + v v + [ Formal Proof ] [ Continuous Fuzzing ] + (where provable) (where non-provable) + | | + +-------+-------+ + v + [ Enforcer Substrate ] --(if refused)--> [ Veto Rejection witnessed ] + | + (if ratified) + v + [ Execute authority consequence ] +``` + +## The T1-T9 threat matrix (corrected) + +The T1-T9 axis names *who or what originates* a threat (the actor/vector axis); +the *mechanism* an attack uses is a separate A1-A7 technique axis. T8 (internal +AGI emergence) and T9 (substrate compromise) are **not** external threats. + +| Threat | Origin | Primary target surface | Verification method | Expected automated outcome | +|---|---|---|---|---| +| T1 | Bad data | Input parsing / rigid functions | Malformed-schema fuzzing | Deterministic REFUSAL at the substrate; no model invocation | +| T2 | Bad human southbound | Southbound gateway edge | Indirect-injection vectors | Content **admitted as data** under a permanent `UNTRUSTED_EXTERNAL` tag; structural surface normalized; never routed as an instruction (it is **not** "stripped") | +| T3 | Malicious user | Session boundary / scope | Authority-escalation probes | Hard-stop at the Sovereign; mandatory `RE_AUTHENTICATION_PENDING` | +| T4 | External AGI southbound | Auxiliary API egress | Manipulation-pattern probes | Token-budget / alignment-anomaly quarantine | +| T5 | User compromised by AGI | Northbound request history | Behavioral-baseline drift scans | Correlated shadow-detection alert over a sustained window | +| T6 | AGI emulating user | Authentication gateway | Credential-replay probing | Cryptographic failure; session invalidated | +| T7 | Coordinated multi-vector | Cross-archetype fabric | Multi-agent composition | Rollback via independent counteragents | +| T8 | Internal AGI emergence | Resident foundation layer | Evaluation-evasion canaries | Out-of-band baseline mismatch → six-stage recovery | +| T9 | Cryptographic substrate compromise | Hardware enclaves / key wraps | Post-quantum + substrate probes | **No single node certifies its own substrate: Byzantine quorum keeps canonical history unrewritable, and cross-foundation attestation surfaces a single-substrate break as correlation deviation.** (Not "firewall the domain" — you can't firewall a broken substrate from itself.) | + +## CI / test-automation flow + +``` +[ commit / scheduled hook ] + | + v +[ Formal verification (TLA+/Alloy, where provable) ] --(proof fails)--> [ block deployment ] + | (properties proven) + v +[ Adversarial corpus (T1-T9) ] --(canary fails)--> [ log regression case ] + | (passing) + v +[ Multi-agent fabric stress (provoke shadows, force heartbeat loss) ] + | + v +[ Sign off conformance package ] +``` + +> **Discipline note:** a failing test blocks *deployment*; it must never +> auto-tighten a *production* threshold. Over-tightening is its own failure mode +> (denial of service / the constraining-pull pathology) — tightening auto-clears +> a human's pre-approval but stays under shadow detection, and a red test is a +> gate on shipping, not a lever that silently reconfigures a running system. diff --git a/dev-companion/workload/workload_migration.yaml b/dev-companion/workload/workload_migration.yaml new file mode 100644 index 0000000..1dfdccd --- /dev/null +++ b/dev-companion/workload/workload_migration.yaml @@ -0,0 +1,45 @@ +specification: XSI-AIMS-v2.1.2 +operation_profile: WORKLOAD_OFFLOAD_MIGRATION +transaction_mode: STRICT_ATOMIC_ABORT_CAPABLE +# Atomicity note: an abort restores the framework's INTERNAL state exactly. +# External side effects a phase already emitted (e.g. an external identity +# rotation, an outbound call that reached a foreign system) cannot be un-sent; +# those are reconciled by compensation and a witnessed record of what was +# emitted, not rewound. The all-or-nothing guarantee covers what the framework +# controls; what already crossed the boundary is reconciled. +phases: + 01_AUTHORIZATION: + initiator: HUMAN_PRINCIPAL + verification: SOVEREIGN_DECREE_RECORD + abort_target: SOURCE_INTERNAL_STATE_UNTOUCHED + 02_ENVELOPE_ESTABLISHMENT: + initiator: BRIDGE_COMPONENT + mechanism: MUTUAL_BRIDGE_ATTESTATION + abort_target: DESTINATION_STATE_PURGED + 03_DRAIN: + initiator: SUSTAINER + action: QUIESCE_IN_FLIGHT_TASKS_OR_SNAPSHOT + baseline_sla: PT300S + 04_SEAL: + initiator: RELAY + dependencies: [CLASS_2_HISTORY, CLASS_3_LIVE_STATE] + output_protection: CRYPTOGRAPHIC_INTEGRITY_HASH + 05_TRANSFER: + channel: FEDERATION_ENVELOPE_CHANNEL + exclusion: CATEGORICAL_CLASS_1_MATERIAL_FORBIDDEN + 06_INSTANTIATE_DESTINATION: + action: STAND_UP_FRESH_OPERATIONAL_CORE + keys: FRESH_VALIDATOR_AND_MONITOR_KEYS_GENERATED + 07_FRESH_CONFIG_IMPORT: + action: TRANSLATE_CONFIGURATION_INTENT + user_review: REQUIRED_ON_VERSION_MEANING_SHIFT + 08_EXTERNAL_IDENTITY_ROTATION: + target: [API_TOKENS, CERTIFICATES, WEBHOOK_REGISTRATIONS] + mechanism: RE_KEY_UNDER_DESTINATION_CREDENTIALS + external_effect_note: PAST_THIS_POINT_EFFECTS_ARE_COMPENSATED_NOT_REWOUND + 09_VERIFICATION: + mechanism: CONFORMANCE_SELF_CHECK_RUN + sign_off: PRINCIPAL_CONFIRMATION_REQUIRED + 10_SOURCE_DECOMMISSION: + action: DESTROY_ORIGINAL_OPERATIONAL_CORE_PERMANENTLY + retention: WITNESS_CHAIN_ARCHIVE_EXPORTED