Home / Spec / Execution chain

Execution-chain spec

Stable Contract version 1.0. Changes are versioned with migration notes.

Every action executed under AmetiOS passes through the same six-stage chain. The chain is the platform differentiator: models propose actions; the platform authorizes them. Proposal, authorization decision, controlled execution, and verification are separate steps — models are kept out of the authorization path by construction.

Chain overview

  1. 1 Contracts

    Machine-readable interface definitions bound what a module may propose.

    Execution Chain, Stage 1 — Contracts Stable

  2. 2 Tenant boundary

    Organization → workspace → environment scoping, enforced at the storage layer.

    Execution Chain, Stage 2 — Tenant boundary Stable

  3. 3 Verified identity

    Every action is bound to a known actor: human, service, or agent.

    Execution Chain, Stage 3 — Verified identity Stable

  4. 4 Deterministic policy

    Pure, ordered rule evaluation produces allow / deny / require-approval.

    Execution Chain, Stage 4 — Deterministic policy Stable · Deep-dive: Policy Model Stable

  5. 5 Governed action

    Controlled execution inside a transaction — only what policy allowed.

    Execution Chain, Stage 5 — Governed action Stable

  6. 6 Evidence

    A verifiable, hash-chained receipt is recorded for every action.

    Execution Chain, Stage 6 — Evidence Stable · Deep-dive: Evidence Model Stable

Specification Layer

Implementation & Runtime Layer

1. Contracts Stable

Purpose

Constrain the action space before anything runs. Contracts are machine-readable interface definitions — action schemas and capability manifests — that describe exactly what a module may propose. If it is not in a registered contract, it cannot be proposed, let alone executed.

Inputs

  • Module manifest: declares the module's actions, required capabilities, and policy bundle reference.
  • Action schema registry: versioned JSON schemas for every action type.

Outputs

  • A validated action proposal, or
  • a typed rejection naming the schema violation.

Invariants

  • No action executes without a registered schema.
  • Proposals that fail schema validation are rejected with a typed error; they never reach the policy stage.
  • Schema versions are immutable; a module pins the schema versions it was built against.

2. Tenant boundary Stable

Purpose

Isolate tenants at three levels — organization, workspace, environment — so that one tenant's actions, data, and evidence can never leak into another's.

Inputs

  • The verified actor's identity and granted scopes.
  • The requested tenant scope (organization, workspace, environment).

Outputs

  • A resolved tenant context attached to the proposal, or
  • a denial when the actor holds no grant for the requested scope.

Invariants

  • Tenant isolation is enforced by the storage layer (forced row-level security on every table), not merely by application convention.
  • Every query and every evidence record carries the tenant context; records cannot be written or read outside it.
  • Scope is resolved once per action and is immutable for that action's lifetime.

3. Verified identity Stable

Purpose

Bind every action to a known actor — a human, a service, or an agent — with attestable capabilities.

Inputs

  • Credentials or attestation material (API key, signed token, workload attestation).

Outputs

  • A verified actor record: stable actor id, actor class (human / service / agent), and granted capabilities.

Invariants

  • No anonymous execution: an action without a verified actor is rejected.
  • Actor capabilities are bound to the identity at verification time and cannot be widened mid-action.
  • Human actors acting through agents remain the recorded actor of record; delegation is explicit and evidenced.

4. Deterministic policy Stable

Purpose

Decide, repeatably, whether a proposed action may proceed: allow, deny, or require-approval. See the policy model for the full expression, evaluation, and versioning rules.

Inputs

  • The validated action proposal.
  • Tenant context and verified actor.
  • The effective policy bundle (versioned, immutable).

Outputs

  • A decision (allow / deny / require-approval) plus the evaluation trace: which rules matched, in which order, under which bundle version.

Invariants

  • Same inputs produce the same decision. Evaluation is a pure function: no network calls, no clock reads except an explicit effective-date input.
  • Deny by default: anything not explicitly allowed is denied.
  • The evaluation trace is recorded as evidence with the action.

5. Governed action Stable

Purpose

Execute exactly what policy allowed — and nothing else — inside a controlled transaction.

Inputs

  • An authorized proposal (decision allow, or require-approval with a recorded human approval).

Outputs

  • The action result and an execution record: what ran, for how long, what it cost, what it changed.

Invariants

  • Execution occurs inside a governed transaction: authorized mutations commit; unauthorized mutations are impossible, not merely forbidden.
  • Long-running work is orchestrated as durable workflows with deterministic replay; a crashed action resumes from its last checkpoint, never from scratch.
  • Expected value, cost, and risk (declared in the proposal) are compared against actuals and recorded in evidence.

6. Evidence Stable

Purpose

Leave a verifiable record of everything that happened, so any action can be audited, replayed, or disputed after the fact. See the evidence model for the receipt format and verification rules.

Inputs

  • The execution record and the policy evaluation trace.

Outputs

  • A signed, hash-chained evidence receipt, stored append-only within the tenant boundary.

Invariants

  • Receipts are append-only and hash-chained: tampering with any receipt invalidates every receipt after it.
  • Every receipt records the policy bundle version and decision, so past actions remain interpretable under the rules that governed them.
  • Evidence is queryable per tenant for audit, the evidence timeline, and ROI comparison.

Action proposal envelope

Illustrative referenceJSON shape of an action proposal entering the chain. Field names follow this spec; the transport binding is Draft.
{
  "action_id": "act_01J9ZQK7M3T2R8W4N6P0",
  "schema": "billing.invoice.issue",
  "schema_version": "1.2.0",
  "tenant": {
    "organization": "org_9f2",
    "workspace": "ws_billing",
    "environment": "production"
  },
  "actor": {
    "actor_id": "svc_invoicer",
    "actor_class": "service"
  },
  "inputs": {
    "customer_id": "cus_88412",
    "amount_cents": 290000,
    "currency": "USD"
  },
  "expectations": {
    "expected_value_cents": 290000,
    "expected_cost_cents": 12,
    "risk_tier": "low"
  }
}

Related: policy model (how stage 4 decides), evidence model (how stage 6 records), governed-webhook reference (the chain in code).