CoreGuard shield
VERIFY • PROTECT • EMPOWER

CoreGuard Agent Commerce Security — Specification v1.0

The execution trust layer for AI agents and on-chain payments. Evidence over narrative.

CoreGuard Agent Commerce Security — Specification v1.0

Version: 1.0 · Date: 2026-11-14 · Audience: reviewers, integrators, the owner.

This document SPECIFIES the CoreGuard Agent Commerce Security family. Every status below is the real one: BUILT means committed code that runs and is measured on this tree; SPEC’D means designed here and only here; OWNER-GATED means a decision only the owner can make. Nothing in this document claims contact, integration, or endorsement with OpenAI, American Express, Mastercard, Visa, or any provider. Every order in every example is synthetic. Funding is $0.

الملخص التنفيذي (عربي)

تحدد هذه الوثيقة عائلة «CoreGuard Agent Commerce Security» الإصدار 1.0: طبقة تربط تفويض المستخدم بـالتنفيذ الفعلي بـإيصال قابل لإعادة الاشتقاق، فتُجيب على سؤال واحد بدقة: «هل التنفيذ مطابق لما وافق عليه المستخدم؟». كل حالة منتج مكتوبة بحالتها الحقيقية: BUILT = كود ملتزم يعمل ومُقاس على هذه الشجرة، SPEC’D = مصمَّم هنا فقط ولم يُبنَ، OWNER-GATED = قرار للمالك وحده. لا اتصال ولا تكامل ولا تأييد يُدَّعى مع OpenAI أو American Express أو Mastercard أو Visa أو أي مزوّد. كل طلب اصطناعي. التمويل $0.

1. The question the family answers

An agent pays. The user approves a specific order — a merchant, items, a total, a payment-credential reference, a time window. Later someone asks: did the executed order match the approved one — and who can prove it later, independently? Tokenized credentials protect card data; they do not bind execution to authorization. This family is that binding layer, composed entirely from the repository’s own committed verification machinery (CGEP/1) — no new hashing domains, no new trust assumptions, no keys, no network, no wall clock.

2. The five products and their real statuses

# Product Surfaces (committed paths) Status Measured where
1 Agent Authorization Firewall packages/agent-commerce/firewall.mjs (AC-FW/1 composed gate: authorizeRequest → reviewExecution) over packages/policy BUILT · TEST_EXECUTED (offline) the firewall contract tests + the offline demo
2 Verifiable Consent Receipts (CGCR/1) packages/agent-commerce/index.mjs (createConsent, verifyConsent) over packages/canonical · packages/evidence · packages/verifier BUILT · TEST_EXECUTED the suite CONSENT leg + tests
3 Agent Risk Engine (AGR/1) packages/agent-commerce/risk.mjs BUILT · TEST_EXECUTED the suite attack battery + tests
4 Agent Commerce SDK · MCP server · REST API packages/agent-commerce/index.mjs · mcp.mjs · http.mjs BUILT · TEST_EXECUTED — npm publication OWNER-GATED the suite MCP + HTTP legs + tests
5 Cross-Chain Execution Attestation (CGXA/1) packages/agent-commerce/attest.mjs (buildAttestation · verifyAttestation · the frozen adapter registry) BUILT · TEST_EXECUTED (offline attestation surface) — on-chain broadcast legs OWNER-GATED / NOT_PERFORMED the attestation contract tests (16) + the offline demo (§7 items 9–10)

Product 5 note (honest context, committed facts only): per-chain attribution machinery already exists in this tree — Core DAO commitment anchors are LIVE/RECORDED on Core Mainnet chainId 1116 (docs/DEPLOYMENT.md, docs/STATUS.md), and Stellar PSAR/1 pre-sign receipts are BUILT · TEST_EXECUTED with integration NOT_BUILT (packages/stellar/presign.mjs). The unified attestation surface is NOW BUILT as the offline attestation record CGXA/1 (§8): it attests an authorization↔execution arc against each chain’s COMMITTED binding record and performs NO broadcast — a new anchor commit or a Soroban call is a new on-chain transaction, owner-authorized only, and the code to attempt a broadcast does not exist in the module (offline Soroban consent-binding preparation is provided as CGXA-SOROBAN/1).

3. Reuse-vs-build map

3a. REUSED — committed machinery, zero new trust assumptions

Machinery Package What the family uses it for
Canonical hashing packages/canonical (hashIntent, hashPolicy, hashTrace, computeReceiptId, hashStateDelta) every byte-exact binding and re-derivation
Evidence + receipts packages/evidence (createEvidenceBundle, createReceipt) the CGCR/1 receipt inside every consent record
Verifier (10-check engine) packages/verifier (verifyReceipt) the execution verdict — TRACE_HASH compared unconditionally whenever a trace is supplied
Policy evaluation packages/policy (evaluatePolicy) value limits + target/recipient/selector allowlists, evaluated against the EXECUTED order

3b. BUILT NEW — this family’s contribution

Surface File What it adds
AC-SDK/1 façade packages/agent-commerce/index.mjs one provider-independent API: createConsent · verifyConsent · verifyExecution · nameDrift
AC-FW/1 composed firewall packages/agent-commerce/firewall.mjs product 1 as ONE face over the existing engines (no fifth engine): the PRE-EXECUTION gate authorizeRequest (committed policy against the DECLARED request · consent byte-match · caller-pinned window · single-use replay consulted, never consumed) + the POST-EXECUTION review reviewExecution (the full verifyExecution record) · frozen 6-code refusal vocabulary · ALLOW only on an empty reasons list · a shared createFirewall({ consumedSet }) bound guard; the family’s shared trace→policy context (policy-context.mjs) keeps the firewall and AGR/1 judging the same rule context
CGCR/1 consent record index.mjs the user’s approval bound to the EXACT approved order bytes as a CGEP/1 receipt with a PINNED timestamp
AC-CS/1 consumption store adapter consumption-store.mjs file-backed Set-compatible single-use ledger (createConsumptionStore / openConsumptionStore) for durable cross-process anchoring on the same host via existing consumedSet injection; NOT a distributed ledger, NOT an on-chain marker (on-chain anchoring OWNER-GATED / NOT_BUILT)
AGR/1 drift taxonomy risk.mjs + risk-cli.mjs 8 named violation classes with severities (§5, classes frozen) — deterministic, never a probabilistic score; standalone CLI + assessment persistence (JSON report + JSONL ledger)
MCP server mcp.mjs real stdio JSON-RPC 2.0 server (protocol 2025-06-18), 4 tools, newline-delimited transport
REST API (AC-API/1) http.mjs GET /health + POST /v1/authorize, /v1/verify, /v1/consent-verify, /v1/risk-assess; exact-address allowlist guard-0; token-bucket limiter with /health limiter-exempt but allowlist-NOT-exempt; 1 MiB body cap
Security suite examples/agent-commerce-security-suite/run.mjs synthetic store + agent; the full arc: CONSENT VERIFIED → exact execution VERIFIED → named-class attack battery → a REAL MCP child driven live → a REAL loopback HTTP instance driven live; exit 0 ONLY on the exact arc; deterministic artifacts.json
Named attack battery test/integrations/agent-commerce-attack-battery.test.mjs the adversarial depth the arc’s 8 rows summarize: a deterministic six-vector prompt-injection fuzz set, post-approval recipient swap / tax-shipping-fee escalation / credential substitution / item mutation, replay, expiry, receipt tamper — and the DOCUMENTED cross-session consumption gap, asserted honestly (a fresh ledger cannot see prior consumption; named on the report, never hidden)
TypeScript declaration surface + tsc lane packages/agent-commerce/index.d.ts + tsconfig.json + typecheck-smoke.ts type-only façade over index.mjs + risk.mjs, structurally contracted and type-checked in CI via npx --yes --package typescript@5.9 tsc --noEmit --project packages/agent-commerce (declaration surface + smoke)
Operator dashboard docs/agent-commerce-dashboard.html bilingual (Arabic-first RTL + English mirror) offline operator view: the decision timeline (APPROVE → EXECUTE exact → real MCP INVALID → real REST VERIFIED), the 8 named attacks refused, the consent receipt id + pinned epoch, and the honest-gaps panel; embeds the committed artifacts verbatim; contract-tested offline
CGXA/1 attestation + Soroban consent-binding packages/agent-commerce/attest.mjs product 5: the authorization↔execution arc attested against a chain’s COMMITTED binding record — offline, deterministic, fail-closed with 9 frozen reject codes — plus Soroban authorized-lane consent-binding preparation (CGXA-SOROBAN/1: buildSorobanConsentBinding / deriveSorobanAuthorizedAnchorId, offline commit_authorized invocation payload, no broadcast); NO broadcast surface in the module (commit_authorized call OWNER-GATED / NOT_PERFORMED)

3c. NOT_BUILT — named, with no pretense

Revision 2026-11-15: three §3c rows moved to BUILT on this tree — the named attack battery (prompt-injection fuzz + the cross-session gap, honestly framed), the TypeScript declaration surface (structural contract; no tsc lane in CI — stated on the surface itself), and the bilingual authorization/receipts dashboard — and the cross-chain attestation row moved to BUILT the same day (CGXA/1, the offline attestation surface; its broadcast legs stay OWNER-GATED, §8). The rows below are what remains. §4–§7 are unchanged; §8–§10 record the attestation build, the npm lane and the IP study.

Revision 2026-11-16: product 1 now ships as ONE composed firewall face — packages/agent-commerce/firewall.mjs (AC-FW/1, §3b): a request-time interception gate over packages/policy + the consent binding, plus the after-the-fact review over the family’s own verdict — no fifth engine was built. The surface registry (docs/surface-status.json, agent-authorization-firewall) was re-pointed from the older Stellar mandate gate (packages/agent-gate, a distinct surface) to this face, with the alignment guarded by a contract test. Durable single-use consumption anchoring remains the next step (§4 note).

Revision 2026-11-16 (Phase 2 c/d/e): durable single-use consumption anchoring now ships as the file-backed AC-CS/1 store adapter (packages/agent-commerce/consumption-store.mjs, Set-compatible, cross-process on host via existing consumedSet injection) — BUILT / TEST_EXECUTED; an on-chain single-use consumption marker remains OWNER-GATED / NOT_BUILT. The Agent Risk Engine now ships a standalone CLI + assessment persistence (packages/agent-commerce/risk-cli.mjs: JSON assessment + JSONL ledger), classes frozen — BUILT / TEST_EXECUTED. Soroban consent-binding integration now ships as offline preparation (CGXA-SOROBAN/1: buildSorobanConsentBinding / deriveSorobanAuthorizedAnchorId, commit_authorized invocation payload, no broadcast) — BUILT / TEST_EXECUTED; the commit_authorized call/broadcast remains OWNER-GATED / NOT_PERFORMED. The tsc declaration typecheck lane is in CI (npx --yes --package typescript@5.9 tsc --noEmit --project packages/agent-commerce).

Missing surface Why it matters Status
Durable single-use consumption anchoring — file-backed host adapter (AC-CS/1) cross-process replay resistance on the same host via existing consumedSet injection (createConsumptionStore) BUILT — TEST_EXECUTED (file-backed, same host; NOT distributed). On-chain single-use consumption marker: OWNER-GATED / NOT_BUILT
TypeScript compiler typecheck lane (tsc in CI over the declaration surface) compiler lane over the declaration surface + smoke BUILT — TEST_EXECUTED in CI (npx --yes --package typescript@5.9 tsc --noEmit --project packages/agent-commerce)
Soroban consent-binding integration (offline preparation, CGXA-SOROBAN/1) carries the consent↔execution attestation into the Soroban authorized lane as commit_authorized invocation payload (derived anchor id, no broadcast) BUILT — TEST_EXECUTED (preparation only). commit_authorized call/broadcast: OWNER-GATED / NOT_PERFORMED
Standalone CLI + assessment persistence (AGR/1) operator/CI risk assessment with persisted audit trail (JSON + JSONL ledger), classes frozen BUILT — TEST_EXECUTED (packages/agent-commerce/risk-cli.mjs)
Live shopping-agent demo against a real merchant integration real-world proof NOT_BUILT (the synthetic suite is the current ceiling)
npm publication distribution OWNER-GATED — the owner’s go is recorded (§9); the remaining steps are owner-only

The record shape is described field-by-field below (this document is fence-free by policy; every command elsewhere appears inline only).

Field table (the object returned by createConsent):

Field Type Semantics
spec constant "CGCR/1" the consent-record schema version
sdkVersion constant "AC-SDK/1" the SDK surface that produced it
receipt CGEP/1 receipt object the approval bound as an independently re-derivable receipt; timestamp is PINNED to the approval epoch and receiptId is RECOMPUTED over the pinned payload
receiptId hex string commitment id of the pinned receipt
intent CGEP/1 intent the approved order: merchant, items, total, credential ref, window, singleUse
policy CGEP/1 policy the committed rules the approval ran under
declaredTrace object the exact submit-order payload the approval covers (the platform’s declared execution shape)

Creation semantics. createConsent({ intent, policy, declaredTrace, nowSeconds }) — nowSeconds is REQUIRED; the wall clock is never read (every input to a byte-equality claim is pinned, including time). Re-running with the same inputs regenerates the record byte-identically. The offline state-delta is a FIXED documented constant (never a claim about chain state).

Verification semantics. verifyConsent(consent) re-derives every commitment against the record’s OWN approved bytes — any tampered byte fails the commitment. verifyExecution(consent, trace, { consumedSet }) verifies the executed order against the binding, fail-closed end to end (§6). A singleUse consent is consumed by its FIRST verified execution; the default ledger is process-local. A file-backed Set-compatible store adapter (AC-CS/1, createConsumptionStore) provides durable cross-process anchoring on the same host via the existing consumedSet injection (BUILT — NOT a distributed ledger, NOT an on-chain marker; an on-chain consumption marker remains OWNER-GATED / NOT_BUILT); callers may inject an external consumedSet.

5. AGR/1 — the risk taxonomy (schema)

Report shape: spec (constant AGR/1) · classification (CLEAN or VIOLATIONS) · violations[] (code, severity, field, optional expected/observed/detail) · boundary (travels inside every report). Deterministic by construction: expiry is measured against the trace’s own blockTimestamp, never the wall clock; two assessments of the same inputs are byte-identical.

The eight named classes (frozen codes; adding a class is additive, renaming is forbidden — reports cite the code):

Code Severity Answers
RECIPIENT_SUBSTITUTION CRITICAL did the payee change after approval?
VALUE_ESCALATION CRITICAL did the executed total exceed the approved amount (incl. post-approval surcharges, fees, taxes, shipping)?
ITEM_MUTATION HIGH did the cart change after approval (injected item, quantity or unit-price change)?
CREDENTIAL_SUBSTITUTION CRITICAL was the payment-credential reference swapped after approval?
EXPIRED_AUTHORIZATION CRITICAL did execution happen after the authorization window closed?
POLICY_VIOLATION CRITICAL did the executed order violate a committed policy rule?
SINGLE_USE_REUSE HIGH was a single-use authorization replayed after consumption?
MALFORMED_EXECUTION CRITICAL is the payload unreadable for the fields the taxonomy reads — refused, never guessed?

Boundary (standing, load-bearing): this is a deterministic RULE taxonomy — never a probabilistic fraud score, never a risk “rating”, never a substitute for a payment network’s fraud systems. It answers exactly one question: did the executed order drift from what was authorized, and where. VERIFIED ≠ SAFE.

6. Verdict semantics (fail-closed end to end)

verifyExecution returns VERIFIED only when ALL of the following hold: the CGEP/1 engine verdict is VERIFIED (every check PASS — a trace-less or partial L2 claim can never be VERIFIED); no check is FAIL; and the AGR/1 classification is CLEAN. Any drift → INVALID with the drifted field named (engine check + taxonomy class + human-readable driftNamed). Any tampered byte of the consent record → commitment mismatch → INVALID. Any unreadable field the taxonomy must decide on → MALFORMED_EXECUTION → INVALID. Nothing is ever “guessed” into a pass.

Boundary (standing): execution verification never decides delivery conformity (DDE/1 — the delivery-disbursement gate opens only on third-party acceptance records). The actor is declared, never detected.

7. Acceptance checks (independent re-derivation)

A reviewer can verify every claim on this tree, offline, with zero keys:

  1. The suite arc: run node examples/agent-commerce-security-suite/run.mjs — it exits 0 ONLY on the exact arc (consent VERIFIED → exact execution VERIFIED → every named-class attack INVALID → the real MCP server rejects a drifted order → the real REST API verifies the exact order); any other outcome exits 1.
  2. Determinism: re-running the suite regenerates examples/agent-commerce-security-suite/artifacts.json byte-identically — the committed copy is the reference artifact.
  3. The contract tests: run node --test test/integrations/agent-commerce-sdk.test.mjs test/integrations/agent-commerce-mcp.test.mjs test/integrations/agent-commerce-http.test.mjs test/integrations/agent-commerce-console-page.test.mjs — the console-page contract additionally proves the static console’s embedded data island equals the committed artifacts byte-for-byte and that the page stays fully offline.
  4. Consent re-derivation: anyone holding a consent record recomputes its binding with verifyConsent — no keys, no network, no trust in the issuer.
  5. The MCP server live: run node packages/agent-commerce/mcp.mjs and speak newline-delimited JSON-RPC 2.0 on stdio (initialize → tools/list → tools/call).
  6. The named attack battery: run node --test test/integrations/agent-commerce-attack-battery.test.mjs — every attack leg INVALID fail-closed; the control leg VERIFIED; the battery byte-deterministic.
  7. The declaration surface: run node --test test/integrations/agent-commerce-types.test.mjs — declared value-exports ↔ runtime exports both directions, constants equal, no implementation.
  8. The dashboard contract: run node --test test/integrations/agent-commerce-dashboard-page.test.mjs — data island equals the committed artifacts byte-for-byte; boundaries in BOTH languages; the page fully offline.
  9. The attestation surface (CGXA/1): run node --test test/integrations/agent-commerce-attestation.test.mjs — the exact arc VERIFIES offline against both committed adapters; every attack leg REFUSES fail-closed with a named code from the frozen 9-code vocabulary; the record id re-derives byte-deterministically; the attestation view consumes nothing; every adapter fact literal is pinned to its cited committed document; no exported name suggests a broadcast.
  10. The attestation demo: run node examples/agent-commerce-attestation/run.mjs — exit 0 ONLY on the exact arc (CONSENT VERIFIED → ATTEST+VERIFY VERIFIED → the 3 named attack legs REFUSED with their codes → determinism); re-running regenerates examples/agent-commerce-attestation/artifacts.json byte-identically — the committed copy is the reference artifact.
  11. The authorization firewall (AC-FW/1): run node examples/agent-commerce-firewall/run.mjs — exit 0 ONLY on the exact arc (PRE gate ALLOWs the exact request → the exact execution VERIFIES → the 5 named attack legs DENIED with their codes → determinism); re-running regenerates examples/agent-commerce-firewall/artifacts.json byte-identically — the committed copy is the reference artifact. The firewall contract tests additionally prove the frozen refusal vocabulary, byte-deterministic decisions, the pre-gate never consuming a single-use consent, and the registry’s product-1 mapping (packages/agent-commerce/firewall.mjs).

8. Cross-Chain Execution Attestation — BUILT as the offline attestation surface (CGXA/1)

Goal (unchanged): one verifiable statement — “this executed order on chain A / platform X corresponds to the authorization bound in consent record C” — provable across execution environments, with each network’s own limits stated honestly.

Built (this tree, packages/agent-commerce/attest.mjs):

9. npm publish lane — the owner’s go is recorded; the remaining steps are owner-only; NOTHING published

Owner’s decision (2026-11-15, recorded here in substance): the owner opened the publication gate — publish the npm lane. What already exists on this tree, needing nothing further from the agent: release.yml (workflow_dispatch with a mandatory confirm: RELEASE input, the npm-release environment, id-token: write for npm provenance, and its own fail-closed guards — it refuses to run without the confirm input or without NPM_TOKEN), scripts/release-please.mjs (publish-check + plan + publish over the 13 @coreguard/* packages), and scripts/publish-check.mjs certifying install parity from packed tarballs.

What physically remains — owner-only steps (the agent cannot perform them):

  1. Register/confirm the @coreguard scope on npmjs.org (requires an npmjs account and email verification).
  2. Create an npm automation token and set it as the repository secret: gh secret set NPM_TOKEN (the secrets list is empty as of this writing — measured).
  3. Dispatch once: gh workflow run release.yml -f confirm=RELEASE, and watch the run to green.

Status: NOTHING has been published — zero packages, $0. The agent deliberately does NOT dispatch the workflow without the token (that would create a deliberate red run), and does NOT add packages/agent-commerce/package.json this cycle (it would force a package-lock.json regen — an owner-protected file). The agent-commerce package keeps shipping without one (bare @coreguard/* specifiers resolve from the repo root); adding it belongs to the owner-gated publication step itself.

10. IP feasibility study — the authorization ↔ proof-of-execution binding (with the disclosure warning)

Scope honesty first: this is an engineering feasibility note written by the author of the code, hosted in the same document as the spec. It is NOT a patentability opinion, NOT legal advice, and NOT a registered or filed right. No patentability search has been performed — no prior-art search, no counsel review. “CoreGuard” is not a registered trademark.

The candidate mechanism family — what could be worth protecting. The family’s one idea, expressed once: bind a user’s authorization to a PROOF OF EXECUTION as re-derivable bytes, so any third party can later verify the binding offline without trusting the issuer. Four concrete mechanisms compose it:

Honest prior-art adjacency (what this note can and cannot say): adjacent fields exist and are active — verifiable-credential and signed-payload schemes (W3C VC, JOSE/COSE families), EIP-712 typed structured signing for approvals, payment-network credential tokenization and its binding layers, and generic append-only audit-log hashing (RFC 6962-style transparency structures). This note does NOT assert novelty over any of them — a structured search would have to compare mechanism by mechanism, claim by claim, and none has been run. The candidate differentiator is the specific COMPOSITION (pinned-clock approval receipt + exact-bytes execution verdict + deterministic named taxonomy + committed-record attestation, composed as one fail-closed family) — and whether that composition is novel and non-obvious is precisely what only a professional search can decide.

Disclosure warning (read before sharing anything further): public commits and repositories can constitute prior disclosure that affects patent rights in some jurisdictions (absolute-novelty regimes can destroy filing options from the disclosure date onward). This repository is public, and the mechanisms above are already publicly disclosed by being committed here; this document’s own publication date is visible in git history. Practical consequences, stated plainly: (1) if the owner ever wants to file, a patent specialist should be consulted BEFORE any further public description of these mechanisms (posts, demos, papers, outreach documents); (2) grace periods differ sharply by jurisdiction and are unreliable as a plan; (3) no IP claim may appear in any outreach or funding material beyond this study’s own honest framing.

Decision owner-gated: any filing decision, any attorney engagement, and any further-disclosure decision belong to the owner alone. This study changes none of that.

11. The 30-day plan — mapped to what exists

Window (owner’s plan) Planned Real status on this tree
Days 1–5 — product-ize the demo Firewall as the lead product; SDK API; consent data contracts; MCP example DONE — all five products built and measured (§2)
Days 6–12 — technical superiority proof prompt injection, recipient swap, price/tax/shipping changes, replay + cross-session, expiry, receipt tamper DONE for the named battery — each class is a named taxonomy violation; the deeper fuzz harness is NOT_BUILT
Days 13–18 — usable product MCP server; TypeScript SDK; REST API; dashboard; real store demo MCP + REST DONE; TS SDK, dashboard, real-store demo NOT_BUILT
Days 19–24 — distribution integration docs; npm publish; MCP server publish; short video; partner trials integration docs DONE (this document + the suite README); npm/MCP publication OWNER-GATED — the owner’s go is recorded (§9); the remaining steps are owner-only (npmjs scope + NPM_TOKEN + one dispatch); nothing published; video OWNER-GATED
Days 25–30 — funding & partnerships OpenAI ecosystem file; Stellar funding; Core ecosystem; incubators; 15–20 partner messages funding/partnerships file COMMITTED (docs/agent-commerce-funding-and-partnerships-2026-11-14.md); all outreach/contact OWNER-GATED — no contact made

12. Standing boundaries

Execution verification never decides delivery conformity (DDE/1) · VERIFIED ≠ SAFE · the actor is declared, never detected · every demo order is synthetic (the credential is a placeholder, never a PAN) · no contact, integration or endorsement is claimed with OpenAI, American Express, Mastercard, Visa or any provider · durable single-use anchoring: AC-CS/1 file-backed host adapter BUILT (cross-process on host), on-chain marker OWNER-GATED / NOT_BUILT · cross-chain attestation is never bridge trust or a relay, and its on-chain broadcast legs are OWNER-GATED / NOT_PERFORMED · funding is $0 · the dated market-context instrument (docs/agent-commerce-moment-chatgpt-wallet-2026-11-14.md) records the public launch event and the honest adjacency — it is evidence of context, never of integration.