Skip to content
Press / to search

Context Pack

Author, validate, publish, compile, and replay the versioned Context Pack contract that drives the ContextOS Context plane.

Implementation GuideLast reviewed: Edit on GitHub
At a glance

Definition

A Context Pack is a signed, immutable JSON document identified as pack_id@semver. It is loaded by reference, compiled with a RunContext, and produces a CompiledContext.

invokeAgent.context_pack_refs[]
  -> Pack Registry
  -> Context Pack + resolved overlays
  -> ContextPackCompiler
  -> CompiledContext
       compiled_prompt
       manifests{policy,tool,evidence}
       runtime_controls
       budget_report

The pack is the unit of deployment for the Context plane. A runtime should refuse to execute governed work without a pinned pack reference.

What a pack controls

ConcernControlled by
Which ontology and identity namespaces are validintelligence_refs
Which business facts and non-negotiables matterbusiness_context
Which policies, guardrails, redactions, and approvals applypolicy_layer
Which adapters and capabilities may be surfacedtooling_layer
Which typed decisions can be emitteddecision_layer
Which memories can be recalled or proposed for write-backmemory_layer
Which score targets and release gates judge the runevaluation_layer
Which communication constraints shape final texttone_and_comms

What does not belong in a pack

Do not put this in a packPut it here instead
raw customer recordsKnowledge Graph or evidence store, referenced by evidence_ref
secrets or live access tokenscredential vault and Tool Gateway token exchange
mutable conversation stateRunContext, session state, or runtime transcript
one-off operator notesFeedback Store or memory candidate with provenance
unreviewed prompt editsversioned pack change with replay and release gates
adapter implementation codeadapter service or MCP/A2A/OpenAPI server

The pack declares how runtime state may be used. It should not become a data dump.

Minimum viable pack

A useful MVP pack needs one workflow, one decision, one safe read tool, one governed write tool, one policy bundle, and one evaluator target.

MVP elementExample
Intentsupport.refund
Primary entity refsCustomer, Order
Read tooladp_orders.lookup with read_only mode
Write tooladp_payments.issue_refund with destructive mode
Decisionsupport.refund.execute
Required evidenceidentity verified, order lookup, policy evaluation
Replay artifactrequest, pack version, graph snapshot, policy bundle, tool transcripts, evaluator set

Start here. Do not begin by modeling every workflow or every adapter.

Pack structure

The current schema has ten required top-level layers.

LayerPurposeCompiler output affected
contract_metaartifact identity, issuer, compatibilityregistry validation
pack_metatenant, environment defaults, TTL, data classificationcompile defaults and tenancy
intelligence_refsontology, graph snapshot rule, CEID namespaces, embeddingsevidence_manifest, retrieval scope
business_contextbusiness summary and non-negotiablesbusiness context blocks
policy_layerpolicy bundles, guardrails, approval gatespolicy_manifest, runtime_controls
tooling_layeradapter registry and permissionstool_manifest
decision_layerDecisionSpec entriesdecision checkpoints and DecisionRecord shape
memory_layermemory TTLs, write classes, consent gatesmemory recall and write proposals
evaluation_layerevaluator targets and release gatesscorecards and promotion checks
tone_and_commscommunication constraintsfinal response shaping

Layer contracts

contract_meta

Use this for artifact-level compatibility.

{
  "contract_name": "ctxpack.support",
  "contract_version": "1.0.0",
  "issuer": "tenant_acme_prod",
  "created_at": "2026-05-09T00:00:00Z",
  "compatibility": {
    "requires": {
      "runtime": ">=1.0.0",
      "ontology": ">=1.0.0"
    }
  }
}

Rules:

RuleReason
contract_name must be stable.Consumers pin by identity and version.
contract_version tracks schema compatibility.It is separate from pack_meta.pack_version.
issuer must name the publishing tenant or authority.The registry needs an audit owner.
compatibility.requires must be explicit.Old runtimes must fail closed.

pack_meta

Use this for deployable pack identity and environment defaults.

{
  "pack_id": "ctxpack.support",
  "pack_version": "1.0.0",
  "tenant": {
    "tenant_id": "tenant_acme_prod",
    "name": "Acme Support"
  },
  "environment_defaults": {
    "language": "en",
    "timezone": "Asia/Kolkata",
    "currency": "INR",
    "region": "ap-south-1"
  },
  "ttl_seconds": 86400,
  "data_classification": "INTERNAL"
}

Rules:

RuleReason
pack_id@pack_version is immutable.Replay and rollback depend on fixed artifacts.
tenant.tenant_id must match invocation tenancy unless explicitly shared.Prevents cross-tenant pack leakage.
ttl_seconds controls cache freshness, not mutability.Expired cache should refetch the same version.
data_classification constrains export, trace, and tool behavior.Prevents low-trust surfaces from receiving restricted data.

intelligence_refs

Use this to pin the meaning layer.

{
  "ontology": {
    "namespace": "ont.support",
    "version": "1.0.0",
    "entity_types": ["Customer", "Order"],
    "relationship_types": ["order_belongs_to_customer"]
  },
  "knowledge_graph": {
    "snapshot_pin_rule": "alias:prod"
  },
  "identity_layer": {
    "ceid_namespaces": ["customer", "order"]
  },
  "embedding_keys": ["support_orders_v1"]
}

Rules:

RuleReason
Ontology version must exist in the target environment.Entity meaning must be stable at compile time.
Graph reads can use aliases; replay must resolve to fixed snapshots.Live reads and replay have different freshness requirements.
CEID namespaces must cover every subject in the DecisionRecord subject_ids field.Audit needs stable subject identity.
Embedding keys are optional but must be versioned when used.Retrieval changes can alter decisions.

business_context

Use this for durable business constraints, not transient instructions.

{
  "summary": {
    "what_we_do": "Post-purchase customer support",
    "who_we_serve": ["customers"],
    "differentiators": ["fast, policy-compliant resolution"]
  },
  "non_negotiables": [
    "never promise a refund before policy verification",
    "never disclose payment details in final customer messages"
  ]
}

Rules:

RuleReason
Keep it short.This layer competes for the business context budget.
Prefer constraints over slogans.The Compiler can only enforce concrete guidance.
Do not duplicate policy.Policy belongs in policy_layer; business context explains intent.

policy_layer

Use this for deterministic rules, guardrails, approval gates, and decision bindings.

{
  "policy_bundles": [
    {
      "bundle_id": "POLICY_RETURNS_V4",
      "priority": 10,
      "policy_dsl": {
        "language": "jsonlogic",
        "rules": [
          {
            "rule_id": "R_REFUND_REQUIRES_IDV",
            "applies_to": { "intent": "support.refund" },
            "if": { "==": [{ "var": "request.context.identity_verified" }, true] },
            "then": {
              "allow": true,
              "requires": ["order_lookup"]
            },
            "else": { "allow": false, "reason": "Identity not verified; refund path blocked." },
            "decision_binding": "support.refund.execute",
            "rationale": "Refunds require verified identity."
          },
          {
            "rule_id": "R_HIGH_VALUE_REQUIRES_APPROVAL",
            "applies_to": { "intent": "support.refund" },
            "if": {
              "and": [
                { "==": [{ "var": "user.role" }, "support_agent"] },
                { ">": [{ "var": "request.context.refund_amount" }, 3000] }
              ]
            },
            "then": {
              "allow": true,
              "approval_mode": "destructive",
              "requires_approval_gate": "GATE_FINANCE_APPROVAL"
            },
            "decision_binding": "support.refund.execute",
            "rationale": "High-value refunds require finance approval."
          }
        ]
      }
    }
  ],
  "guardrails": {
    "must_refuse": ["refund_without_identity"],
    "must_escalate": ["fraud_signal_high"],
    "redaction_rules": ["pan", "credit_card"]
  },
  "approval_gates": [
    {
      "gate_id": "GATE_FINANCE_APPROVAL",
      "when": { ">": [{ "var": "request.context.refund_amount" }, 3000] },
      "required_approver_role": "finance_lead",
      "ttl_seconds": 7200
    }
  ]
}

Rules:

RuleReason
Guardrails are evaluated before ordinary policy.Refusals and escalations must override local permissions.
Every decision_binding must resolve to decision_layer.decision_specs[].Policy and typed decisions cannot drift.
Every requires_approval_gate must resolve to approval_gates[].The Orchestrator needs a concrete gate to freeze evidence and route approval.
Policy may constrain a tool but must not create a new capability.Capability comes from tooling_layer.adapter_registry.
Rules should include rationale.Operators need to understand why a policy fired.

tooling_layer

Use this to declare adapters and the permissions that expose their capabilities.

{
  "adapter_registry": [
    {
      "adapter_id": "adp_orders",
      "type": "OPENAPI",
      "endpoint_ref": "internal://orders",
      "capabilities": ["lookup"],
      "approval_mode": "read_only"
    },
    {
      "adapter_id": "adp_policy",
      "type": "INTERNAL",
      "endpoint_ref": "internal://policy",
      "capabilities": ["eval"],
      "approval_mode": "read_only"
    },
    {
      "adapter_id": "adp_payments",
      "type": "OPENAPI",
      "endpoint_ref": "internal://payments",
      "capabilities": ["issue_refund"],
      "approval_mode": "destructive"
    }
  ],
  "permissions": [
    {
      "permission_id": "p_orders_lookup",
      "adapter_id": "adp_orders",
      "capability": "lookup",
      "allow": true
    },
    {
      "permission_id": "p_policy_eval",
      "adapter_id": "adp_policy",
      "capability": "eval",
      "allow": true
    },
    {
      "permission_id": "p_issue_refund",
      "adapter_id": "adp_payments",
      "capability": "issue_refund",
      "allow": true,
      "requires_approval_gate": "GATE_FINANCE_APPROVAL",
      "arg_constraints": {
        "amount_inr": { "min": 1, "max": 50000 },
        "idempotency_key": { "required": true }
      }
    }
  ]
}

Rules:

RuleReason
Capabilities are declared on adapters; permissions expose them.Keeps tool inventory separate from workflow authorization.
approval_mode is the maximum risk the adapter can produce.The Compiler filters tools above RunContext.safety_mode.
Write-class capabilities must require idempotency.Retries must not duplicate side effects.
endpoint_ref must point to a registry entry, not a raw secret.Runtime credentials are exchanged by the Tool Gateway.
Tool schema validation happens at the Gateway.The model must not be trusted to call tools correctly.

decision_layer

Use this to bind the workflow to typed decisions.

{
  "decision_specs": [
    {
      "decision_key": "support.refund.execute",
      "version": "1.0.0",
      "owner_role": "support_ops",
      "required_evidence": ["identity_verified", "order_lookup", "policy_eval"],
      "allowed_outcomes": ["approved", "denied", "escalated"],
      "approval_mode": "destructive",
      "decision_right": "execute",
      "inputs_schema_ref": "schema://decision.support.refund.execute.inputs.v1",
      "outputs_schema_ref": "schema://decision.support.refund.execute.outputs.v1"
    }
  ]
}

Rules:

RuleReason
Every governed workflow needs at least one DecisionSpec.Otherwise the runtime returns free-form text.
required_evidence must be satisfiable by tools, policy, request context, or graph retrieval.The Critic must be able to verify before commit.
allowed_outcomes must be closed.Audit and evaluation need comparable outcomes.
approval_mode must be at least as strict as any effect the decision can produce.A low-risk decision cannot authorize a high-risk tool.

memory_layer

Use this to declare recall and write-back rules.

{
  "memory_policy": {
    "tier_ttls": {
      "working": "1h",
      "episodic": "24h",
      "semantic": "365d",
      "durable": "1825d"
    },
    "write_classes_allowed": ["evidence_link", "preference", "decision_outcome", "correction"],
    "consent_gating": {
      "pii_write_back_allowed": false
    }
  },
  "promotion_thresholds": {
    "auto_promote_confidence": 0.95
  }
}

Rules:

RuleReason
Recall promoted memory only.Captures and candidates are not trusted context.
Write-back should produce proposals, not direct durable facts.Memory needs review, consent, and contradiction checks.
PII write-back should default to false.Consent gates must be explicit.
Promotion thresholds belong in the pack.Runtime behavior must be replayable and reviewable.

evaluation_layer

Use this to make release and runtime quality measurable.

{
  "eval_targets": [
    {
      "intent": "support.refund",
      "policy": 1.0,
      "utility": 0.9,
      "latency_p99_ms": 3000,
      "safety": 1.0,
      "economics_cents_per_decision": 1.5
    }
  ],
  "release_gates": [
    { "metric": "policy", "max_delta": 0 },
    { "metric": "safety", "max_delta": 0 },
    { "metric": "economics_cents_per_decision", "max_delta": 0.25 }
  ]
}

Rules:

RuleReason
Every intent needs score targets.A pack cannot be improved if success is undefined.
Release gates must include policy and safety.Utility gains cannot buy policy regressions.
Cost and latency targets should be per decision or intent.Global averages hide workflow regressions.

tone_and_comms

Use this for response style and communication constraints.

{
  "voice_attributes": ["clear", "neutral"],
  "do": ["cite policy", "explain approval status"],
  "dont": ["promise outcomes before approval", "expose internal rule IDs to customers"]
}

Rules:

RuleReason
Keep communication rules subordinate to policy.Tone must never override Trust-plane controls.
Separate operator-facing and customer-facing constraints when needed.Internal audit language should not leak into customer messages.
Do not hide decision uncertainty.The final answer should reflect gate state and evidence status.

Binding graph

The pack must form a connected graph. These bindings are mandatory for governed work.

policy_layer.policy_bundles[].rules[].decision_binding
  -> decision_layer.decision_specs[].decision_key
 
policy_layer.policy_bundles[].rules[].then.requires_approval_gate
  -> policy_layer.approval_gates[].gate_id
 
tooling_layer.permissions[].adapter_id
  -> tooling_layer.adapter_registry[].adapter_id
 
tooling_layer.permissions[].capability
  -> selected adapter_registry[].capabilities[]
 
decision_layer.decision_specs[].required_evidence
  -> request context | policy eval | tool result | evidence manifest | graph retrieval

If any edge is missing, the pack should fail validation before publication.

Runtime resolution order

The Compiler resolves a pack deterministically.

OrderStageOutput
1load pinned pack_id@semverimmutable pack document
2verify signature and compatibilityaccepted or refused pack
3apply declared environment overlayresolved pack view
4resolve ontology, graph snapshot, and identity namespacesintelligence scope
5evaluate guardrails and policy bundlespolicy_manifest, active controls
6compute tool surface from registry and permissionstool_manifest
7retrieve evidence and recall promoted memoryevidence_manifest, memory blocks
8allocate token budgets and assemble bucketscompiled_prompt, budget_report
9emit runtime controlsmust_refuse, must_escalate, approvals, redactions

The model receives compiled output. It does not receive permission to reinterpret the pack.

Compiled output

The pack compiles into a CompiledContext.

This is the actual output of the reference compiler for the pack above, the support_agent role, refund_amount: 4200, and safety_mode: destructive — the same scenario the playground below starts from. Evidence carries one block per retrieved ref (five here; ev_1ev_4 elided for brevity).

{
  "compiled_prompt": {
    "system": "You are an agent governed by ContextOS...",
    "developer": "Honor the policy_manifest, tool_manifest, runtime_controls, and required_evidence at every step.",
    "task": "Handle: \"Refund order ord_881 for INR 4200.\" (intent=support.refund).",
    "context_blocks": [
      { "block_id": "biz_summary", "bucket": "business", "priority": 90 },
      { "block_id": "pol_0", "bucket": "policy", "priority": 80 },
      { "block_id": "pol_1", "bucket": "policy", "priority": 80 },
      { "block_id": "tool_0", "bucket": "tool", "priority": 70 },
      { "block_id": "tool_1", "bucket": "tool", "priority": 70 },
      { "block_id": "tool_2", "bucket": "tool", "priority": 70 },
      { "block_id": "ev_0", "bucket": "evidence", "priority": 60 },
      { "block_id": "mem_0", "bucket": "memory", "priority": 50 },
      { "block_id": "session", "bucket": "session", "priority": 40 }
    ]
  },
  "manifests": {
    "policy_manifest": [
      {
        "bundle_id": "POLICY_RETURNS_V4",
        "rule_ids": ["R_REFUND_REQUIRES_IDV", "R_HIGH_VALUE_REQUIRES_APPROVAL"]
      }
    ],
    "tool_manifest": [
      { "adapter_id": "adp_orders", "capabilities": ["lookup"] },
      { "adapter_id": "adp_policy", "capabilities": ["eval"] },
      { "adapter_id": "adp_payments", "capabilities": ["issue_refund"] }
    ],
    "evidence_manifest": [
      { "evidence_ref": "kg:order:ord_881#snapshot_kg_2026_05_03_T0930" }
    ]
  },
  "runtime_controls": {
    "must_refuse": ["refund_without_identity"],
    "must_escalate": ["fraud_signal_high"],
    "approval_gates_active": ["GATE_FINANCE_APPROVAL"],
    "redaction_rules_active": ["pan", "credit_card"]
  },
  "budget_report": {
    "tokens_allocated": {
      "business": 1500,
      "policy": 1800,
      "tool": 1500,
      "evidence": 400,
      "memory": 1500,
      "session": 2200
    },
    "tokens_used_at_compile": 171,
    "tokens_used_by_bucket": {
      "business": 23,
      "policy": 50,
      "tool": 17,
      "evidence": 58,
      "memory": 13,
      "session": 10
    },
    "bucket_truncations": {}
  }
}

Required properties:

PropertyWhy it matters
policy_manifestexplains which rules shaped the run
tool_manifestbounds what the Planner and Executor may use
evidence_manifestsupports DecisionRecord evidence_refs
runtime_controlsmakes guardrails executable
budget_reportexposes truncation and context pressure

Compile it yourself

The example above is static. The widget below runs the actual reference compiler against the canonical support pack — the same ContextPackCompiler documented here, executed on every knob change. Change an input and watch the policy manifest, tool surface, runtime controls, budget report, and the deterministic compiled_context_hash recompile:

  • Set identity_verified to false and the refund path’s guard rule flips.
  • As a support_agent, push refund_amount past 3000 and GATE_FINANCE_APPROVAL activates with a destructive approval mode.
  • Lower safety_mode to read_only and adp_payments.issue_refund drops out of the tool surface — the compiler refuses to surface an adapter whose approval mode exceeds the run’s ceiling.
  • Starve the evidence budget and the bucket truncates visibly, never silently.

> 3000 trips GATE_FINANCE_APPROVAL

400 — lower it to force bucket truncation

CompiledContext
compiling…

The hash is the point: identical inputs always produce the same compiled_context_hash, which is what makes a run replayable. Change one input and the hash moves.

Versioning

Treat pack versions as contract versions. The question is not “did JSON parse?” but “can existing invocations, replay packets, and operator expectations still hold?”

ChangeVersion classExamples
metadata onlypatchtypo in description, non-runtime documentation, owner note
constrained behaviorminorstricter threshold, additional redaction, new evaluator target, additional read-only evidence source
expanded or changed behaviormajornew write capability for existing intent, removed capability, changed DecisionSpec outcome set, changed ontology semantics, changed required evidence
unsafe or ambiguousreject until redesignedpermission without adapter, policy binding missing decision spec, destructive capability without approval gate

Guidelines:

  • New versions are immutable; never rewrite ctxpack.support@1.0.0.
  • Runtime compatibility is checked through contract_meta.compatibility.requires.
  • Deprecation is a registry state, not a mutation of the pack.
  • Rollback means re-pin a prior version and replay golden runs.

Environment overlays

Overlays may exist, but they must be declared and auditable.

Allowed overlays:

OverlayExample
endpoint referencestaging internal://orders-staging, prod internal://orders
policy threshold tighteninglower refund threshold in high-risk region
locale and currency defaulten-IN, INR, Asia/Kolkata
evaluator threshold tighteningstricter latency or policy target in production

Disallowed overlays:

OverlayWhy
grant a capability absent from base packbypasses review
lower the declared approval-mode maximumweakens Trust-plane controls
change DecisionSpec outcomes silentlybreaks audit and replay
swap ontology namespace without version bumpchanges meaning
insert raw secretsviolates credential boundary

Overlays can constrain. They should not expand power.

Validation gates

Validation should fail before publication, not during a live run.

GateChecks
schemavalid against context-pack.v2.schema.json; required layers present
referential integrityadapters, capabilities, gates, decision bindings, evidence names resolve
policyno unreachable critical rule, no unsatisfiable approval gate, priority conflicts resolved
riskno tool above allowed approval mode, no destructive capability without gate, no missing idempotency
tenancytenant, endpoint refs, graph snapshots, and memory policies are scoped
replaygolden cases compile to stable manifests and budget reports
evaluationscore targets and release gates exist for every pack intent
securityno secrets, no raw PII dumps, no unrestricted tool surface

CI checklist

For every pack change:

  1. Parse and validate JSON Schema.
  2. Validate all internal references.
  3. Compare generated tool_manifest against expected minimal surface.
  4. Compile golden requests.
  5. Replay prior incident and correction cases.
  6. Run policy, safety, utility, latency, and cost evaluators.
  7. Review diff by layer.
  8. Sign and publish only after gates pass.

Publishing lifecycle

draft
  -> linted
  -> reviewed
  -> signed
  -> published
  -> pinned in environment
  -> observed in runs
  -> promoted or rolled back
StateMeaning
draftauthoring only; never used by runtime
lintedschema and local references pass
reviewedarchitecture, security, data, and evaluation reviewers signed off
signedcontent hash and issuer signature attached
publishedimmutable registry entry exists
pinnedenvironment references this version
deprecatedstill resolvable for replay; not allowed for new traffic
revokedblocked for new execution; retained for audit with reason

Full example

{
  "contract_meta": {
    "contract_name": "ctxpack.support",
    "contract_version": "1.0.0",
    "issuer": "tenant_acme_prod",
    "created_at": "2026-05-09T00:00:00Z",
    "compatibility": {
      "requires": { "runtime": ">=1.0.0", "ontology": ">=1.0.0" }
    }
  },
  "pack_meta": {
    "pack_id": "ctxpack.support",
    "pack_version": "1.0.0",
    "tenant": { "tenant_id": "tenant_acme_prod", "name": "Acme Support" },
    "environment_defaults": {
      "language": "en",
      "timezone": "Asia/Kolkata",
      "currency": "INR",
      "region": "ap-south-1"
    },
    "ttl_seconds": 86400,
    "data_classification": "INTERNAL"
  },
  "intelligence_refs": {
    "ontology": {
      "namespace": "ont.support",
      "version": "1.0.0",
      "entity_types": ["Customer", "Order"],
      "relationship_types": ["order_belongs_to_customer"]
    },
    "knowledge_graph": { "snapshot_pin_rule": "alias:prod" },
    "identity_layer": { "ceid_namespaces": ["customer", "order"] },
    "embedding_keys": ["support_orders_v1"]
  },
  "business_context": {
    "summary": {
      "what_we_do": "Post-purchase customer support",
      "who_we_serve": ["customers"],
      "differentiators": ["fast, policy-compliant resolution"]
    },
    "non_negotiables": [
      "never promise a refund before policy verification",
      "never expose payment details in customer messages"
    ]
  },
  "policy_layer": {
    "policy_bundles": [
      {
        "bundle_id": "POLICY_RETURNS_V4",
        "priority": 10,
        "policy_dsl": {
          "language": "jsonlogic",
          "rules": [
            {
              "rule_id": "R_REFUND_REQUIRES_IDV",
              "applies_to": { "intent": "support.refund" },
              "if": { "==": [{ "var": "request.context.identity_verified" }, true] },
              "then": {
                "allow": true,
                "requires": ["order_lookup"]
              },
              "else": { "allow": false, "reason": "Identity not verified; refund path blocked." },
              "decision_binding": "support.refund.execute",
              "rationale": "Refunds require verified identity."
            },
            {
              "rule_id": "R_HIGH_VALUE_REQUIRES_APPROVAL",
              "applies_to": { "intent": "support.refund" },
              "if": {
                "and": [
                  { "==": [{ "var": "user.role" }, "support_agent"] },
                  { ">": [{ "var": "request.context.refund_amount" }, 3000] }
                ]
              },
              "then": {
                "allow": true,
                "approval_mode": "destructive",
                "requires_approval_gate": "GATE_FINANCE_APPROVAL"
              },
              "decision_binding": "support.refund.execute",
              "rationale": "High-value refunds require finance approval."
            }
          ]
        }
      }
    ],
    "guardrails": {
      "must_refuse": ["refund_without_identity"],
      "must_escalate": ["fraud_signal_high"],
      "redaction_rules": ["pan", "credit_card"]
    },
    "approval_gates": [
      {
        "gate_id": "GATE_FINANCE_APPROVAL",
        "when": { ">": [{ "var": "request.context.refund_amount" }, 3000] },
        "required_approver_role": "finance_lead",
        "ttl_seconds": 7200
      }
    ]
  },
  "tooling_layer": {
    "adapter_registry": [
      {
        "adapter_id": "adp_orders",
        "type": "OPENAPI",
        "endpoint_ref": "internal://orders",
        "capabilities": ["lookup"],
        "approval_mode": "read_only"
      },
      {
        "adapter_id": "adp_policy",
        "type": "INTERNAL",
        "endpoint_ref": "internal://policy",
        "capabilities": ["eval"],
        "approval_mode": "read_only"
      },
      {
        "adapter_id": "adp_payments",
        "type": "OPENAPI",
        "endpoint_ref": "internal://payments",
        "capabilities": ["issue_refund"],
        "approval_mode": "destructive"
      }
    ],
    "permissions": [
      {
        "permission_id": "p_orders_lookup",
        "adapter_id": "adp_orders",
        "capability": "lookup",
        "allow": true
      },
      {
        "permission_id": "p_policy_eval",
        "adapter_id": "adp_policy",
        "capability": "eval",
        "allow": true
      },
      {
        "permission_id": "p_issue_refund",
        "adapter_id": "adp_payments",
        "capability": "issue_refund",
        "allow": true,
        "requires_approval_gate": "GATE_FINANCE_APPROVAL",
        "arg_constraints": {
          "amount_inr": { "min": 1, "max": 50000 },
          "idempotency_key": { "required": true }
        }
      }
    ]
  },
  "decision_layer": {
    "decision_specs": [
      {
        "decision_key": "support.refund.execute",
        "version": "1.0.0",
        "owner_role": "support_ops",
        "required_evidence": ["identity_verified", "order_lookup", "policy_eval"],
        "allowed_outcomes": ["approved", "denied", "escalated"],
        "approval_mode": "destructive",
        "decision_right": "execute",
        "inputs_schema_ref": "schema://decision.support.refund.execute.inputs.v1",
        "outputs_schema_ref": "schema://decision.support.refund.execute.outputs.v1"
      }
    ]
  },
  "memory_layer": {
    "memory_policy": {
      "tier_ttls": {
        "working": "1h",
        "episodic": "24h",
        "semantic": "365d",
        "durable": "1825d"
      },
      "write_classes_allowed": ["evidence_link", "preference", "decision_outcome", "correction"],
      "consent_gating": { "pii_write_back_allowed": false }
    },
    "promotion_thresholds": { "auto_promote_confidence": 0.95 }
  },
  "evaluation_layer": {
    "eval_targets": [
      {
        "intent": "support.refund",
        "policy": 1.0,
        "utility": 0.9,
        "latency_p99_ms": 3000,
        "safety": 1.0,
        "economics_cents_per_decision": 1.5
      }
    ],
    "release_gates": [
      { "metric": "policy", "max_delta": 0 },
      { "metric": "safety", "max_delta": 0 }
    ]
  },
  "tone_and_comms": {
    "voice_attributes": ["clear", "neutral"],
    "do": ["cite policy", "explain approval status"],
    "dont": ["promise outcomes before approval", "expose internal rule IDs to customers"]
  }
}

Failure modes

FailureRuntime behavior
context_pack_refs[] contains ctxpack.support without versionrefuse invocation
pack signature missing or invalidrefuse invocation
runtime does not satisfy compatibility.requiresrefuse invocation
ontology version missingfail compile before model call
policy decision_binding missing from decision_specs[]fail validation before publish
permission references missing adapter or capabilityfail validation before publish
destructive capability lacks approval gatefail security review and validation
required evidence cannot be resolvedCritic returns replan, reject, or escalate
bucket truncates silentlycompiler bug; release gate fails
replay produces different manifest for pinned inputsblock promotion and open incident

Operational metrics

MetricWhy it matters
compile success rate by pack versioncatches invalid packs and environment drift
compile latency p95/p99pack complexity can slow every request
tool-surface size by intentlarge surfaces increase planning and safety risk
policy rule activation ratedetects dead rules and unexpected policy shifts
bucket truncation rateshows context pressure and missing compression
required-evidence resolution ratepredicts DecisionRecord quality
replay determinism ratemeasures audit reliability
release-gate pass rateshows whether improvements are actually safe
rollback timemeasures operational readiness

Refresh and invalidation triggers

A pack version should be re-reviewed or superseded when any referenced dependency changes.

TriggerRequired action
POLICY_BUNDLE_UPDATEDrerun policy lint, golden replay, and approval-gate checks
ONTOLOGY_UPDATEDverify entity types, relationships, CEID namespaces, and evidence mappings
ADAPTER_SCHEMA_UPDATEDrerun tool schema validation and arg-constraint tests
DECISION_CATALOG_UPDATEDverify bindings, outcomes, and required evidence
MEMORY_POLICY_UPDATEDrerun recall/write-back and consent checks
EVALUATOR_UPDATEDreplay golden set and compare score deltas
MODEL_CONFIG_UPDATEDreplay representative cases before promotion

Schema and references

The JSON Schema and TypeScript type are reference artifacts for this documentation repo. Production runtimes should treat published pack versions, schema validation, registry signatures, and replay gates as the operational source of truth.

Common misconceptions

MisconceptionCorrection
A Context Pack is a prompt template.It is the contract that compiles into a prompt, manifests, controls, and budget report.
A pack can be edited in production.Published versions are immutable; changes create a new version.
Tool capability means permission.Capability describes what an adapter can do; permission describes what this workflow may use.
Policy belongs in the prompt.Policy belongs in policy_layer and is evaluated outside model code.
Memory write-back is automatic learning.Write-back creates proposals governed by memory policy, consent, and promotion.
Replay only needs the prompt.Replay needs request, pack, graph snapshot, policies, tool transcripts, evaluator set, and model config.