Skip to content

You are currently viewing documentation for0.1.0-alpha.1

Audit artifact schema

Versioned evidence record

The complete JSON Schema below defines the audit response returned by the execution and MCP evidence APIs. Required nullable drift and patch fields distinguish absent evidence from a missing field. proof.write_integrity is an evidence claim, not a consequence of HTTP success; false means write integrity has not been established. Credential values do not belong in metadata.

Full operation schema
json
{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "title": "AuditArtifact",
  "description": "The immutable record of one tool call: what was sent, what drifted, what changed, and the proof the write was correct. Matches agindow-runtime-contract.md §3.3. No internal envelope — this shape is public and read by customers and agents.",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "ts",
    "tool",
    "operation",
    "mode",
    "drift",
    "decision",
    "patch",
    "proof"
  ],
  "properties": {
    "id": {
      "type": "string",
      "minLength": 1
    },
    "ts": {
      "type": "string",
      "format": "date-time"
    },
    "tool": {
      "type": "string",
      "minLength": 1
    },
    "operation": {
      "enum": [
        "read",
        "write",
        "unknown"
      ]
    },
    "mode": {
      "enum": [
        "observe",
        "repair",
        "strict"
      ]
    },
    "drift": {
      "anyOf": [
        {
          "$ref": "#/$defs/drift"
        },
        {
          "type": "null"
        }
      ],
      "description": "Required, possibly null: a clean call states so explicitly."
    },
    "decision": {
      "enum": [
        "ok",
        "repaired",
        "degraded",
        "bypassed",
        "blocked"
      ]
    },
    "patch": {
      "anyOf": [
        {
          "$ref": "#/$defs/patch"
        },
        {
          "type": "null"
        }
      ],
      "description": "Required, possibly null. Null means nothing was changed — including the semantic-drift case that must fail closed."
    },
    "proof": {
      "$ref": "#/$defs/proof"
    },
    "confidence": {
      "type": "number",
      "minimum": 0,
      "maximum": 1
    },
    "hypothesis": {
      "type": "string",
      "minLength": 1,
      "description": "Engine's semantic reading before investigation (agindow-runtime-contract.md §4a)."
    },
    "detail": {
      "type": "string",
      "minLength": 1
    },
    "note": {
      "type": "string",
      "minLength": 1
    },
    "metadata": {
      "type": "object",
      "additionalProperties": true,
      "description": "Free-form context (workflow, tenant, request id). Never credentials."
    }
  },
  "$defs": {
    "change": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "path",
        "kind"
      ],
      "properties": {
        "path": {
          "type": "string",
          "minLength": 1
        },
        "kind": {
          "type": "string",
          "minLength": 1,
          "description": "Change taxonomy (field_renamed, type_changed, unit_changed, ...). Deliberately open: the vocabulary grows with the detectors."
        },
        "from": {
          "type": "string"
        },
        "to": {
          "type": "string"
        }
      }
    },
    "drift": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "class",
        "side"
      ],
      "properties": {
        "class": {
          "enum": [
            "shape",
            "semantic",
            "unknown"
          ]
        },
        "side": {
          "enum": [
            "request",
            "response",
            "both"
          ]
        },
        "vendor": {
          "type": "string",
          "minLength": 1
        },
        "changes": {
          "type": "array",
          "minItems": 1,
          "items": {
            "$ref": "#/$defs/change"
          }
        },
        "first_seen": {
          "type": "string",
          "format": "date-time"
        },
        "occurrences": {
          "type": "integer",
          "minimum": 1
        }
      }
    },
    "patch": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "applied",
        "byte_identical"
      ],
      "properties": {
        "applied": {
          "type": "boolean"
        },
        "byte_identical": {
          "type": "boolean",
          "description": "True only when the outgoing payload is the caller's bytes; false when repair built a new object (agindow-runtime-contract.md §3.1)."
        },
        "fields_changed": {
          "type": "array",
          "items": {
            "type": "string",
            "minLength": 1
          }
        },
        "selective": {
          "type": "boolean"
        },
        "reasoning": {
          "type": "string",
          "minLength": 1
        }
      }
    },
    "proof": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "contract_version",
        "verified_against",
        "write_integrity"
      ],
      "properties": {
        "contract_version": {
          "type": "string",
          "minLength": 1
        },
        "verified_against": {
          "enum": [
            "registry",
            "pin",
            "cache"
          ]
        },
        "write_integrity": {
          "type": "boolean"
        },
        "idempotency_key": {
          "type": "string",
          "minLength": 1
        }
      }
    }
  }
}

Read a record

id and ts identify the call; operation and mode identify its frozen policy; drift describes classification, side and optional changes; decision names the call outcome. patch is null when nothing changed, otherwise applied and byte_identical describe the patch. proof records contract_version, verified_against and write_integrity, plus an optional idempotency_key. confidence, hypothesis, detail, note and metadata are optional. Missing retained evidence is unavailable, not proof of a clean call.