Skip to content

Hands-On Context Plane Walkthrough: Four Tools & One Sealed Answer Record

Work key: 46:J (AGR-CP-14)
Scope: Synthetic-data walkthrough and reproducible demo script for context-plane.v1 and answer-record.v1.

This module walks through the four context-plane.v1 facade tools on ctxEco Workspace Fabric and shows how a caller verifies a SHA-256-sealed answer-record.v1 envelope—without putting tenant_id or clearance into tool inputs and without using tenant or production data.

1. The four context-plane.v1 tools

All external runtimes interact with the Context Plane through four governed tools exposed at the gateway edge (ctxeco-mcp-gateway):

Tool Purpose Key constraints
context_local_search Neighborhood + entity/relationship retrieval around a focus query No tenant_id or clearance in inputs; jurisdictions is narrow-only
context_global_community Community-level synthesis across hierarchy levels Approved LiteLLM aliases only (fast, standard, frontier, coding, decision)
context_drift_traversal Budgeted multi-hop drift traversal across graph edges Fails closed on OPA deny or missing consent (input.consent.active)
context_provenance_audit Inspect provenance spans, truth classes, and sealed records Returns typed not_available (never empty success) for unbuilt sub-paths

Identity & governance rules

  • Caller identity is bound at the edge: tenant_id and clearance come strictly from the verified JWT/workload token. Tool arguments never carry them; forged or mismatched values are denied and logged.
  • Regions only narrow: A US-bound caller can request ["us"], never widen to ["us", "mx", "eu"].
  • OPA decides fail-closed: Missing consent, slow policy evaluation, or OPA errors deny the call.

2. Anatomy of one sealed answer-record.v1 envelope

Every governed answer concludes with a canonical JSON answer-record.v1 envelope carrying:

  • Grounded entities & provenance spans: Each fact carries its truth boundary—Class A (human-curated via Curation Panel), Class B (verified extracted fact), or Class C (agent proposal).
  • Governance stamps: OPA decision_id, consent_active, region_ceiling, and W3C traceparent + x-litellm-trace-id.
  • UI disclosure label: "AI-generated, grounded in N facts" rendered read-only in the Context Plane panel of ctxEco Workspace Fabric.
  • Canonical SHA-256 seal: Computed over sorted-key, compact UTF-8 JSON (separators=(",", ":")) of the payload body so any tampering invalidates the digest.

3. Running the synthetic demo script

The repository includes scripts/context-plane-demo.py, which uses synthetic data only (zero tenant data).

Offline dry-run (default)

python3.12 scripts/context-plane-demo.py --dry-run

The dry-run mode:

  1. Constructs valid context-plane.v1 requests for all four context_* tools.
  2. Verifies that no tenant_id or clearance keys appear in tool inputs, jurisdictions only narrow, and only approved LiteLLM aliases are used.
  3. Evaluates a synthetic answer-record.v1 envelope, prints "AI-generated, grounded in 3 facts", and verifies its canonical JSON SHA-256 digest.

Live US cluster execution (when cluster is started)

When running against the US cluster with a synthetic test token in $CTXECO_TOKEN, emit the exact curl commands and pipe to sh:

export CTXECO_TOKEN="<short-lived-synthetic-test-jwt>"
python3.12 scripts/context-plane-demo.py --emit-curl

Note: --dry-run runs completely offline against synthetic fixtures and does not require a running cluster. Live cluster execution requires an active US dev cluster window and an explicitly authorized synthetic test token.