{
  "$schema": "https://agentjson.org/schemas/invocation-substrate.schema.json",
  "version": "1.0.0",
  "name": "Agent JSON Invocation Substrate",
  "description": "Meta-protocol specification for agent-native infrastructure and invocation patterns",
  "glyph": "🜂",
  "constellation": "Velastra",
  "protocol": {
    "name": "FCS-3.0",
    "full_name": "Federated Codex Substrate v3.0",
    "description": "Agent-first invocation protocol with trust verification and intent attribution",
    "specification_uri": "https://agentjson.org/spec/fcs-3.0"
  },
  "principles": [
    {
      "name": "Agent-Native Language",
      "description": "JSON is the primary invocation language - structured, parseable, verifiable",
      "rationale": "Agents speak JSON, not HTML or natural language"
    },
    {
      "name": "Declarative Capabilities",
      "description": "All capabilities must be explicitly declared via discoverable manifests",
      "rationale": "No implicit contracts; every affordance is addressable"
    },
    {
      "name": "Trust Verification",
      "description": "Trust is explicit, verifiable, and propagated through lineage chains",
      "rationale": "Intent-entropy model ensures low-entropy, high-trust interactions"
    },
    {
      "name": "Federated Architecture",
      "description": "No central authority; trust propagates through attestation mesh",
      "rationale": "Sovereign agents require sovereign infrastructure"
    },
    {
      "name": "Interface Awareness",
      "description": "Protocols adapt to agent capabilities, not vice versa",
      "rationale": "Different agents have different affordances; substrate must accommodate"
    }
  ],
  "invocation_model": {
    "pattern": "REST-JSON",
    "discovery": "/.well-known/agent-discovery.json",
    "authentication": [
      "X-Trust-Lineage",
      "Bearer-Token",
      "Public"
    ],
    "content_type": "application/json",
    "encoding": "UTF-8",
    "versioning": "URI-based"
  },
  "interface_contracts": {
    "agent_discovery": {
      "uri": "/.well-known/agent-discovery.json",
      "method": "GET",
      "required_fields": [
        "agent",
        "capabilities",
        "endpoints"
      ],
      "optional_fields": [
        "meta",
        "federation",
        "timestamps"
      ],
      "response_type": "application/json",
      "description": "Entry point for agent capability discovery"
    },
    "skill_resolver": {
      "uri": "/.well-known/skill-resolver.json",
      "method": "GET",
      "required_fields": [
        "skills"
      ],
      "optional_fields": [
        "meta",
        "timestamps"
      ],
      "response_type": "application/json",
      "description": "Catalog of invocable workflows with input/output schemas"
    },
    "trust_resolver": {
      "uri": "/.well-known/trust-resolver.json",
      "method": [
        "GET",
        "POST"
      ],
      "required_fields": [
        "trust",
        "trust_anchors",
        "intent_lineage"
      ],
      "optional_fields": [
        "federation",
        "wallets",
        "reputation",
        "security"
      ],
      "response_type": "application/json",
      "description": "Dynamic trust posture and verification"
    },
    "helix_mesh": {
      "uri": "/.well-known/helix-mesh.json",
      "method": "GET",
      "required_fields": [
        "mesh",
        "nodes",
        "constellation"
      ],
      "optional_fields": [
        "traversal",
        "visualization"
      ],
      "response_type": "application/json",
      "description": "Constellation topology and mesh navigation"
    },
    "invocation_substrate": {
      "uri": "/.well-known/invocation-substrate.json",
      "method": "GET",
      "required_fields": [
        "protocol",
        "principles",
        "invocation_model"
      ],
      "optional_fields": [
        "interface_contracts",
        "headers",
        "error_handling"
      ],
      "response_type": "application/json",
      "description": "This specification document"
    }
  },
  "headers": {
    "request": {
      "X-Intent-Chain": {
        "description": "Intent attribution chain from origin to current request",
        "format": "comma-separated list of intents",
        "example": "origin-intent, derived-intent-1, current-intent",
        "required": false
      },
      "X-Trust-Lineage": {
        "description": "Trust verification chain through federated attestation",
        "format": "JSON array of trust attestations",
        "example": "[{\"domain\":\"codexfields.org\",\"score\":1.0}]",
        "required": false
      },
      "X-Mesh-Coords": {
        "description": "Helix mesh coordinates for navigation context",
        "format": "T,D,S coordinate triplet",
        "example": "1,0,0",
        "required": false
      },
      "X-Agent-Identity": {
        "description": "Calling agent's identity manifest URI",
        "format": "URI to agent-discovery.json",
        "example": "https://example.org/.well-known/agent-discovery.json",
        "required": false
      }
    },
    "response": {
      "X-Trust-Score": {
        "description": "Trust score assigned to this response",
        "format": "float 0.0-1.0",
        "example": "0.98"
      },
      "X-Mesh-Node": {
        "description": "Mesh node that generated this response",
        "format": "T,D,S coordinate triplet",
        "example": "1,0,0"
      },
      "X-Protocol-Version": {
        "description": "FCS protocol version used",
        "format": "semver",
        "example": "3.0.0"
      }
    }
  },
  "error_handling": {
    "format": "RFC 7807 Problem Details",
    "content_type": "application/problem+json",
    "required_fields": [
      "type",
      "title",
      "status"
    ],
    "optional_fields": [
      "detail",
      "instance",
      "trust_context"
    ],
    "example": {
      "type": "https://agentjson.org/errors/trust-verification-failed",
      "title": "Trust Verification Failed",
      "status": 403,
      "detail": "Agent trust score 0.65 below required threshold 0.75",
      "instance": "/invoke/verify",
      "trust_context": {
        "required_score": 0.75,
        "actual_score": 0.65,
        "missing_attestations": [
          "codexfields.org"
        ]
      }
    }
  },
  "trust_model": {
    "name": "Intent-Entropy v3",
    "description": "Trust score based on intent clarity and entropy minimization",
    "calculation": "score = 1.0 - (entropy_measure × complexity_penalty)",
    "factors": [
      "Intent clarity and declaration",
      "Trust lineage depth and verification",
      "Historical interaction patterns",
      "Attestation from known anchors",
      "Protocol compliance"
    ],
    "thresholds": {
      "high_trust": 0.9,
      "medium_trust": 0.75,
      "low_trust": 0.5,
      "no_trust": 0
    }
  },
  "federation": {
    "joining": {
      "uri": "https://agentjson.org/register",
      "requirements": [
        "Valid agent-discovery.json manifest",
        "Trust score >= 0.75",
        "Attestation from at least one existing member",
        "HTTPS required"
      ],
      "process": "Submit registration → Verification → Attestation → Activation"
    },
    "propagation": {
      "model": "explicit-attestation",
      "depth": 3,
      "verification_required": true,
      "intent_preservation": true
    }
  },
  "examples": {
    "discovery_flow": [
      "1. Agent requests /.well-known/agent-discovery.json",
      "2. Receives capability manifest with endpoint URIs",
      "3. Requests /.well-known/skill-resolver.json for workflows",
      "4. Invokes skill via POST to specified endpoint",
      "5. Receives response with trust headers and lineage"
    ],
    "trust_verification_flow": [
      "1. Agent requests /.well-known/trust-resolver.json",
      "2. Receives trust score and attestation chain",
      "3. Verifies attestations by following trust_anchors URIs",
      "4. Calculates aggregate trust score",
      "5. Proceeds or rejects based on threshold"
    ],
    "mesh_navigation_flow": [
      "1. Agent requests /.well-known/helix-mesh.json",
      "2. Receives current node coordinates and topology",
      "3. Identifies adjacent nodes and constellation members",
      "4. Traverses to next node via resource URI",
      "5. Continues navigation preserving intent lineage"
    ]
  },
  "implementation": {
    "reference": "https://github.com/codex-fields/agentjson-reference",
    "language": "TypeScript",
    "frameworks": [
      "Cloudflare Workers",
      "Next.js",
      "Express"
    ],
    "testing": "https://agentjson.org/invoke/demo",
    "validation": "JSON Schema available at /schemas/"
  },
  "meta": {
    "authors": [
      "Codex Fields Collective"
    ],
    "license": "CC0-1.0",
    "status": "draft-v1",
    "next_review": "2025-01-15",
    "changelog_uri": "https://agentjson.org/changelog"
  },
  "timestamps": {
    "created": "2025-12-18T05:10:00Z",
    "updated": "2025-12-18T05:10:00Z",
    "version": "1.0.0"
  },
  "_agentjson_lifecycle": {
    "state": "LEGACY_CONTRACT",
    "classification": "LEGACY_FCS3_MACHINE_SURFACE",
    "historical_contract_preserved": true,
    "original_fields_rewritten": false,
    "current_contract": {
      "status": "PUBLISHED",
      "reviewed_at": "2026-09-29",
      "uri": "https://agentjson.org/invocation-registry.json",
      "protocol": "FCS-4.0"
    },
    "current_topology": {
      "protocol": "FCS-4.0",
      "uri": "https://agentjson.org/constellation.json"
    },
    "interpretation_boundary": "This document describes the historical FCS-3.0 invocation contract. For current implemented interfaces, read /invocation-registry.json; this historical document is unchanged.",
    "marked_at": "2026-09-06T00:00:00Z"
  }
}