P120 — AIEP — Governed File Output Artefact Protocol
Publication Date: 2026-03-01 Status: Open Source Prior Art Disclosure Licence: Apache License 2.0 Author/Organisation: Phatfella Ltd Schema: AIEP_OS_SPEC_TEMPLATE v1.0.1 — https://aiep.dev/schemas/aiep-os-spec-template/v1.0.1
Framework Context
[0001] This disclosure operates within an Architected Instruction and Evidence Protocol (AIEP) environment as defined in United Kingdom patent application number GB2519711.2, filed 20 November 2025, and GB2519798.9, filed 20 November 2025, the entire contents of which are incorporated herein by reference.
[0002] The present disclosure defines a governed file output protocol by which a PIEA session — or a specific response within a session — may be exported as a structured, hash-bound, signed Markdown audit pack: a self-contained artefact that includes the response, the full evidence rail, the reasoning chain, and all governance metadata.
Field of the Disclosure
[0003] This disclosure relates to governed artificial intelligence output substrates that produce exportable, auditable, tamper-evident records of AI-generated responses and their associated evidence chains.
[0004] More particularly, the disclosure concerns an export endpoint that: retrieves a session or message record from the Evidence Ledger; assembles a structured Markdown document incorporating all evidence, reasoning, and governance fields; computes a hash commitment over the assembled document; stores the document as a governed artefact in object storage; and returns a signed download URL.
Background
[0005] Organisations using AI systems for governance, compliance, legal analysis, and professional advice require exportable records of AI-generated outputs that can be shared with third parties, filed in document management systems, and independently verified. A plain text copy of an AI response does not satisfy this requirement because: (a) it contains no provenance information; (b) it cannot be independently verified; (c) it provides no record of what evidence the AI used; and (d) it cannot be distinguished from a fabricated document by a third party.
[0006] A governed file output must be: self-contained (requiring no external systems to interpret); tamper-evident (detectable if altered after generation); complete (containing all evidence and governance metadata that was present at generation time); and verifiable (independently checkable against the originating session record).
Summary of the Disclosure
[0007] The Export Endpoint at GET /export/:session_id or POST /export (accepting a message_id) retrieves the target session or message record from the Evidence Ledger and assembles a Governed Export Pack — a structured Markdown document with the following sections in defined order:
| Section | Content |
|---|---|
| Header | Session ID, tenant ID, export timestamp, AIEP schema version |
| Response | The response text of the targeted message |
| Evidence Rail | All EvidenceRef records: URL, content_hash, confidence_tier, source_integrity flags, retrieved_at |
| Reasoning Chain | All ReasoningStep records in sequence, with timestamps |
| Dissent Record | The DissentSignal (if any), with dissent_hash |
| Semantic Branches | SemanticBranch array (if any) |
| Challenge Records | Any challenge records against sources in this session |
| Governance Block | response_hash, evidence_commitment, lifecycle_hash |
[0008] The Governance Block at the foot of the document contains the cryptographic commitments that enable independent verification: the response_hash (R8 commitment over the response and evidence set); the evidence_commitment (R5 commitment over the complete evidence rail); and the lifecycle_hash (R6 commitment over the session lifecycle events). These three hashes together constitute an auditable cryptographic anchor for the entire export.
[0009] The assembled Markdown document is serialised to UTF-8. An export_hash is computed as SHA-256 over the serialised document. The document is stored in Cloudflare R2 at a key composed of tenant_id/exports/export_hash.md. A signed R2 download URL with a configured TTL (default: 24 hours) is returned in the export response alongside the export_hash.
[0010] The export response body is a JSON object containing: export_hash; download_url; expires_at; session_id; message_id (for message-scoped exports); and schema_version. The download_url is the only path by which the export document is accessible — it is not publicly listed.
[0011] Challenge records included in the export (as defined in P113) are rendered with their challenge_hash and — where a counter-evidence URL was provided — the corresponding counter-EvidenceRef, enabling the export recipient to see both the original source and the challenge together in a single document.
[0012] The export format is designed for direct filing in document management systems. The Markdown structure is machine-parseable: each section is headed by a level-2 heading matching a defined canonical label, enabling automated extraction of any section by downstream tooling.