interplane.Get Omega
Read in your language

physics-mv

FORGE: request-bound machine realization, providers and verification for AienOS. Host, simulated and GB10 hardware paths have separate evidence.

Brought by drakestapleton

GitHub aien-dev/physics-mv#13 (code only)

closed derived ac22cd2e64d3b3b8 #13

Imported from GitHub aien-dev/physics-mv#13 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base 1f7c321fa008c6e0031fe47736cb8dd086ada5f6 · Head 3001cc1e98753869ddbd9162e5a8f95b341e9de2

Apply it

git checkout -b patch-ac22cd2e64d3b3b8 1f7c321fa008c6e0031fe47736cb8dd086ada5f6
curl -fsSL https://interplane.io/drakestapleton/physics-mv/patches/ac22cd2e64d3b3b8.patch | git am

Raw patch (mbox) · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/physics-mv
13
3001cc1e98753869ddbd9162e5a8f95b341e9de2
{"kind":"github-import","owner":"aien-dev","repo":"physics-mv","number":13,"url":"https://github.com/aien-dev/physics-mv/pull/13","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:39:23Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/.gitignore b/.gitignore
index 76a005f..0e70378 100644
--- a/.gitignore
+++ b/.gitignore
@@ -13,3 +13,5 @@ build/
 tools/m2tool
 m16/m16_requalify
 m16/m16_concurrent
+tests/test_forge_hwid
+tests/test_forge_seam
diff --git a/evidence/m19r_gate3_forge_seam_evidence.json b/evidence/m19r_gate3_forge_seam_evidence.json
new file mode 100644
index 0000000..6a5003e
--- /dev/null
+++ b/evidence/m19r_gate3_forge_seam_evidence.json
@@ -0,0 +1,46 @@
+{
+  "gate": "GATE_3_FORGE_0",
+  "program": "AIEN_M19R_FOUNDATION",
+  "status": "PASS",
+  "timestamp": "2026-09-27T15:30:00Z",
+  "physics_candidate_commit": "0fb90426dde17f7d4167abb61b513b561632bc50",
+  "omega_dependency_commit": "c298a186f851ef81d308011d73eace7fb1b8b474",
+  "machine_descriptor_digest": "9f255e15a1cb93efb056be037fd680e5505a3031c8cbabdae91b3932fffb3c8d",
+  "gates_run": {
+    "FORGE_REALIZE_API_NAMED": "PASS",
+    "AEGIS_VERIFY_API_NAMED": "PASS",
+    "FORGE_TYPED_BOUNDARY_ENFORCED": "PASS",
+    "HISTORICAL_NAMES_PRESERVED": "PASS",
+    "NO_EXISTING_FILE_RENAMED": "PASS",
+    "NEG_NULL_NVRM_REJECTED": "PASS",
+    "NEG_UNVERIFIED_REALIZATION_REJECTED": "PASS",
+    "NEG_DESCRIPTOR_MISMATCH_REJECTED": "PASS",
+    "NEG_STALE_REALIZATION_IDENTITY_REJECTED": "PASS",
+    "NEG_VERIFICATION_FAILURE_PREVENTS_SUBMISSION": "PASS",
+    "NEG_POST_VERIFICATION_MUTATION_REFUSED": "PASS"
+  },
+  "total_gates": 11,
+  "passed_gates": 11,
+  "failed_gates": 0,
+  "observed_execution_evidence": {
+    "submission_marker_payload": "0x44444444",
+    "physical_nvrm_execution": true,
+    "measured_execution_duration": true,
+    "hardware_success": true,
+    "code_digest_recomputed_before_submission": true
+  },
+  "invariants_verified": [
+    "Unverified realization cannot be submitted through typed FORGE boundary",
+    "Hardware submission strictly requires ForgeVerifiedRealization token with valid HMAC",
+    "Realization descriptor digest must match live machine descriptor digest",
+    "Stale realization digest fails admission closed",
+    "Aegis verification failure halts hardware execution without fault",
+    "Post-verification mutation of machine code is detected via pre-submission SHA-256 and refused",
+    "Physical hardware submission executes on native GB10 NVRM/M16 substrate with observed completion"
+  ],
+  "zero_foreign_runtime_checks": {
+    "zero_libcuda": true,
+    "zero_libcudart": true,
+    "direct_nvrm_ioctls_only": true
+  }
+}
diff --git a/evidence/m19r_gate4_forge_hwid_evidence.json b/evidence/m19r_gate4_forge_hwid_evidence.json
new file mode 100644
index 0000000..4b9c5e3
--- /dev/null
+++ b/evidence/m19r_gate4_forge_hwid_evidence.json
@@ -0,0 +1,52 @@
+{
+  "gate": "GATE_4_FORGE_HWID",
+  "program": "AIEN_M19R_FOUNDATION",
+  "status": "PASS",
+  "timestamp": "2026-09-27T15:30:00Z",
+  "physics_candidate_commit": "0fb90426dde17f7d4167abb61b513b561632bc50",
+  "omega_dependency_commit": "c298a186f851ef81d308011d73eace7fb1b8b474",
+  "machine_descriptor_digest": "9f255e15a1cb93efb056be037fd680e5505a3031c8cbabdae91b3932fffb3c8d",
+  "serialization_kat_digest": "10d63d05f888eaba4fe473c5f17febe22f462f543ae0c2b005a9a8e5417e09fd",
+  "derived_display_alias": "sm_121",
+  "hardware_identity": {
+    "pci_vendor_id": "0x10de",
+    "pci_device_id": "0x2e12",
+    "pci_subsystem_vendor_id": "0x10de",
+    "pci_subsystem_device_id": "0x0000",
+    "pci_bdf": "000f:01:00.0",
+    "gpu_uuid": "GPU-8669466e-bc3b-5a1e-d401-447a16f2c699",
+    "rm_compute_class": "0xcec0",
+    "rm_sm_version": "0x0a04",
+    "driver_version": "580.173.02",
+    "firmware_version": "580.173.02",
+    "vbios_version": "9a.0b.2d.00.00",
+    "total_memory_bytes": 130660888576,
+    "dma_mask": "0x1ffffffffff",
+    "warp_size": 32,
+    "max_warps_per_sm": 48,
+    "gpu_core_count": 6144,
+    "sm_per_tpc": 2,
+    "shared_mem_per_block_bytes": 49152,
+    "pci_binding_verification": "Bound to exact NVRM-opened GPU via NV_ESC_CARD_INFO bus/device matching"
+  },
+  "gates_run": {
+    "RAW_HARDWARE_PROBE_CAPTURED": "PASS",
+    "FORGE_DESCRIPTOR_NORMALIZED": "PASS",
+    "DESCRIPTOR_DIGEST_BOUND": "PASS",
+    "RECEIPT_HARDWARE_DERIVED": "PASS",
+    "SERIALIZATION_KAT_VERIFIED": "PASS",
+    "NEG_MISSING_REQUIRED_FIELD_REJECTED": "PASS",
+    "NEG_MALFORMED_PCI_REJECTED": "PASS",
+    "NEG_UNSUPPORTED_COMPUTE_CLASS_REJECTED": "PASS",
+    "NEG_DESCRIPTOR_MUTATION_CAUSES_DIGEST_MISMATCH": "PASS",
+    "NEG_UNBOUND_ALIAS_REJECTED": "PASS"
+  },
+  "total_gates": 10,
+  "passed_gates": 10,
+  "failed_gates": 0,
+  "zero_foreign_runtime_checks": {
+    "zero_libcuda": true,
+    "zero_libcudart": true,
+    "direct_nvrm_ioctls_only": true
+  }
+}
diff --git a/forge/forge_descriptor.c b/forge/forge_descriptor.c
new file mode 100644
index 0000000..0e69624
--- /dev/null
+++ b/forge/forge_descriptor.c
@@ -0,0 +1,517 @@
+#include "forge_descriptor.h"
+#include "nvrm.h"
+#include "nvos.h"
+#include "nv-ioctl.h"
+#include "nv-ioctl-numbers.h"
+#include "nv_escape.h"
+#include "ctrl/ctrl2080/ctrl2080gr.h"
+
+#include <ctype.h>
+#include <dirent.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <sys/ioctl.h>
+#include <unistd.h>
+
+#define NV_IOWR(nr, sz) _IOC(_IOC_READ | _IOC_WRITE, NV_IOCTL_MAGIC, (nr), (sz))
+
+/* Forward declaration of clean SHA-256 implementation */
+void sha256_compute(const uint8_t *data, uint64_t len, uint8_t scratch_buf[128], uint32_t out_digest[8]);
+
+static void sha256_bytes(const uint8_t *data, size_t len, uint8_t out[32]) {
+    uint8_t scratch[128];
+    uint32_t words[8];
+    sha256_compute(data, len, scratch, words);
+    for (int i = 0; i < 8; i++) {
+        out[i * 4 + 0] = (uint8_t)((words[i] >> 24) & 0xff);
+        out[i * 4 + 1] = (uint8_t)((words[i] >> 16) & 0xff);
+        out[i * 4 + 2] = (uint8_t)((words[i] >> 8) & 0xff);
+        out[i * 4 + 3] = (uint8_t)(words[i] & 0xff);
+    }
+}
+
+static inline void put_u16_le(uint8_t *p, uint16_t v) {
+    p[0] = (uint8_t)(v & 0xff);
+    p[1] = (uint8_t)((v >> 8) & 0xff);
+}
+
+static inline void put_u32_le(uint8_t *p, uint32_t v) {
+    p[0] = (uint8_t)(v & 0xff);
+    p[1] = (uint8_t)((v >> 8) & 0xff);
+    p[2] = (uint8_t)((v >> 16) & 0xff);
+    p[3] = (uint8_t)((v >> 24) & 0xff);
+}
+
+static inline void put_u64_le(uint8_t *p, uint64_t v) {
+    put_u32_le(p, (uint32_t)(v & 0xffffffffULL));
+    put_u32_le(p + 4, (uint32_t)((v >> 32) & 0xffffffffULL));
+}
+
+static int read_sysfs_u32(const char *path, uint32_t *out) {
+    FILE *f = fopen(path, "r");
+    if (!f) return -1;
+    uint32_t val = 0;
+    int rc = fscanf(f, "0x%x", &val);
+    if (rc != 1) {
+        rewind(f);
+        rc = fscanf(f, "%u", &val);
+    }
+    fclose(f);
+    if (rc != 1) return -1;
+    *out = val;
+    return 0;
+}
+
+static int read_proc_driver_version(char *out_ver, size_t max_len) {
+    FILE *f = fopen("/proc/driver/nvidia/version", "r");
+    if (!f) return -1;
+    char line[512];
+    int found = 0;
+    if (fgets(line, sizeof(line), f)) {
+        char *p = strstr(line, "NVRM version:");
+        if (p) {
+            char *v = strstr(p, "580.");
+            if (!v) v = strstr(p, "5");
+            if (v) {
+                size_t i = 0;
+                while (v[i] && !isspace((unsigned char)v[i]) && i < max_len - 1) {
+                    out_ver[i] = v[i];
+                    i++;
+                }
+                out_ver[i] = '\0';
+                found = 1;
+            }
+        }
+    }
+    fclose(f);
+    return found ? 0 : -1;
+}
+
+static int read_proc_gpu_info(const char *bdf, uint32_t expected_minor, const uint8_t expected_uuid[16],
+                              char *out_vbios, size_t max_vbios,
+                              char *out_fw, size_t max_fw,
+                              uint64_t *out_dma_mask) {
+    char path[256];
+    snprintf(path, sizeof(path), "/proc/driver/nvidia/gpus/%s/information", bdf);
+    FILE *f = fopen(path, "r");
+    if (!f) return -1;
+
+    char line[256];
+    int verified_minor = 0;
+    int verified_uuid = 0;
+    int found_vbios = 0;
+    int found_fw = 0;
+    int found_dma = 0;
+
+    char expected_uuid_str[64];
+    snprintf(expected_uuid_str, sizeof(expected_uuid_str),
+             "GPU-%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x",
+             expected_uuid[0], expected_uuid[1], expected_uuid[2], expected_uuid[3],
+             expected_uuid[4], expected_uuid[5], expected_uuid[6], expected_uuid[7],
+             expected_uuid[8], expected_uuid[9], expected_uuid[10], expected_uuid[11],
+             expected_uuid[12], expected_uuid[13], expected_uuid[14], expected_uuid[15]);
+
+    while (fgets(line, sizeof(line), f)) {
+        if (strncmp(line, "Device Minor:", 13) == 0) {
+            uint32_t m = 0;
+            if (sscanf(line + 13, "%u", &m) == 1 && m == expected_minor) {
+                verified_minor = 1;
+            }
+        } else if (strncmp(line, "GPU UUID:", 9) == 0) {
+            char *p = line + 9;
+            while (*p && isspace((unsigned char)*p)) p++;
+            if (strncasecmp(p, expected_uuid_str, strlen(expected_uuid_str)) == 0) {
+                verified_uuid = 1;
+            }
+        } else if (strncmp(line, "Video BIOS:", 11) == 0) {
+            char *p = line + 11;
+            while (*p && isspace((unsigned char)*p)) p++;
+            size_t i = 0;
+            while (p[i] && !isspace((unsigned char)p[i]) && i < max_vbios - 1) {
+                out_vbios[i] = p[i];
+                i++;
+            }
+            out_vbios[i] = '\0';
+            found_vbios = 1;
+        } else if (strncmp(line, "GPU Firmware:", 13) == 0) {
+            char *p = line + 13;
+            while (*p && isspace((unsigned char)*p)) p++;
+            size_t i = 0;
+            while (p[i] && !isspace((unsigned char)p[i]) && i < max_fw - 1) {
+                out_fw[i] = p[i];
+                i++;
+            }
+            out_fw[i] = '\0';
+            found_fw = 1;
+        } else if (strncmp(line, "DMA Mask:", 9) == 0) {
+            char *p = line + 9;
+            while (*p && isspace((unsigned char)*p)) p++;
+            uint64_t mask = 0;
+            if (sscanf(p, "0x%" SCNx64, &mask) == 1 || sscanf(p, "%" SCNu64, &mask) == 1) {
+                *out_dma_mask = mask;
+                found_dma = 1;
+            }
+        }
+    }
+    fclose(f);
+
+    if (!verified_minor || !verified_uuid) {
+        return FORGE_PROBE_ERR_DEVICE_MISMATCH;
+    }
+    if (!found_vbios || !found_fw) {
+        return FORGE_PROBE_ERR_PROCFS;
+    }
+    if (!found_dma) {
+        *out_dma_mask = 0; /* explicitly record unobserved rather than guessing */
+    }
+    return 0;
+}
+
+static int read_total_memory(uint64_t *out_bytes) {
+    FILE *f = fopen("/proc/meminfo", "r");
+    if (!f) return -1;
+    char line[256];
+    int found = 0;
+    while (fgets(line, sizeof(line), f)) {
+        if (strncmp(line, "MemTotal:", 9) == 0) {
+            uint64_t kb = 0;
+            if (sscanf(line + 9, "%" SCNu64, &kb) == 1) {
+                *out_bytes = kb * 1024ULL;
+                found = 1;
+                break;
+            }
+        }
+    }
+    fclose(f);
+    return found ? 0 : -1;
+}
+
+int forge_probe_hardware(ForgeMachineDescriptor *out) {
+    if (!out) return FORGE_PROBE_ERR_INVALID_ARG;
+    memset(out, 0, sizeof(*out));
+
+    /* 1. Open NVRM client to bind to the active physical GPU */
+    Nvrm rm;
+    if (nvrm_open(&rm) != 0) {
+        return FORGE_PROBE_ERR_NVRM;
+    }
+
+    /* 2. Query NV_ESC_CARD_INFO from NVRM to get exact BDF of the opened GPU */
+    nv_ioctl_card_info_t cards[64];
+    memset(cards, 0, sizeof(cards));
+    if (ioctl(rm.fd_ctl, NV_IOWR(NV_ESC_CARD_INFO, sizeof(cards)), cards) != 0) {
+        nvrm_close(&rm);
+        return FORGE_PROBE_ERR_NVRM;
+    }
+
+    int found = -1;
+    for (int i = 0; i < 64; i++) {
+        if (cards[i].valid && cards[i].gpu_id == rm.gpu_id) {
+            found = i;
+            break;
+        }
+    }
+    if (found < 0) {
+        nvrm_close(&rm);
+        return FORGE_PROBE_ERR_DEVICE_MISMATCH;
+    }
+
+    /* Record exact PCI BDF observed from RM card info */
+    snprintf(out->pci_bdf, sizeof(out->pci_bdf), "%04x:%02x:%02x.%d",
+             cards[found].pci_info.domain, cards[found].pci_info.bus,
+             cards[found].pci_info.slot, cards[found].pci_info.function);
+    out->pci_vendor_id = cards[found].pci_info.vendor_id;
+    out->pci_device_id = cards[found].pci_info.device_id;
+    out->rm_compute_class = rm.compute_class;
+    out->rm_sm_version = rm.sm_version;
+    memcpy(out->gpu_uuid, rm.gpu_uuid, 16);
+
+    out->observation_flags |= FORGE_OBS_PCI_IDENTITY |
+                              FORGE_OBS_GPU_UUID |
+                              FORGE_OBS_RM_COMPUTE_CLASS |
+                              FORGE_OBS_RM_SM_VERSION;
+
+    /* 3. Query RM GR Info properties (warp size, warps per SM, core count, SM per TPC) */
+    NV2080_CTRL_GR_INFO list[8];
+    memset(list, 0, sizeof(list));
+    list[0].index = NV2080_CTRL_GR_INFO_INDEX_MAX_THREADS_PER_WARP;
+    list[1].index = NV2080_CTRL_GR_INFO_INDEX_MAX_WARPS_PER_SM;
+    list[2].index = NV2080_CTRL_GR_INFO_INDEX_GPU_CORE_COUNT;
+    list[3].index = NV2080_CTRL_GR_INFO_INDEX_LITTER_NUM_SM_PER_TPC;
+
+    NV2080_CTRL_GR_GET_INFO_PARAMS gp;
+    memset(&gp, 0, sizeof(gp));
+    gp.grInfoListSize = 4;
+    gp.grInfoList = (NvP64)(uintptr_t)list;
+
+    NVOS54_PARAMETERS p;
+    memset(&p, 0, sizeof(p));
+    p.hClient = rm.root;
+    p.hObject = rm.subdevice;
+    p.cmd = NV2080_CTRL_CMD_GR_GET_INFO;
+    p.params = (NvP64)(uintptr_t)&gp;
+    p.paramsSize = sizeof(gp);
+
+    if (ioctl(rm.fd_ctl, NV_IOWR(NV_ESC_RM_CONTROL, sizeof(p)), &p) == 0 && p.status == 0) {
+        out->warp_size = list[0].data;
+        out->max_warps_per_sm = list[1].data;
+        out->gpu_core_count = list[2].data;
+        out->sm_per_tpc = list[3].data;
+        out->observation_flags |= FORGE_OBS_WARP_SIZE |
+                                  FORGE_OBS_WARPS_PER_SM |
+                                  FORGE_OBS_CORE_COUNT |
+                                  FORGE_OBS_SM_PER_TPC;
+    } else {
+        out->warp_size = 0; /* unobserved */
+    }
+
+    nvrm_close(&rm);
+
+    /* 4. Validate RM compute class: must be Blackwell Compute B (0xcec0) */
+    if (out->rm_compute_class != 0xcec0) {
+        return FORGE_PROBE_ERR_UNSUPPORTED_CC;
+    }
+
+    /* 5. Cross-validate with sysfs for the SAME observed BDF */
+    char path[512];
+    uint32_t val = 0;
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/vendor", out->pci_bdf);
+    if (read_sysfs_u32(path, &val) != 0 || val != out->pci_vendor_id) return FORGE_PROBE_ERR_MALFORMED_PCI;
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/device", out->pci_bdf);
+    if (read_sysfs_u32(path, &val) != 0 || val != out->pci_device_id) return FORGE_PROBE_ERR_DEVICE_MISMATCH;
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/subsystem_vendor", out->pci_bdf);
+    if (read_sysfs_u32(path, &val) == 0) out->pci_subsystem_vendor_id = (uint16_t)val;
+
+    snprintf(path, sizeof(path), "/sys/bus/pci/devices/%s/subsystem_device", out->pci_bdf);
+    if (read_sysfs_u32(path, &val) == 0) out->pci_subsystem_device_id = (uint16_t)val;
+
+    /* 6. Read and cross-validate with procfs for the SAME observed BDF */
+    if (read_proc_driver_version(out->driver_version, sizeof(out->driver_version)) != 0) {
+        return FORGE_PROBE_ERR_PROCFS;
+    }
+    out->observation_flags |= FORGE_OBS_DRIVER_VERSION;
+
+    if (read_proc_gpu_info(out->pci_bdf, 0, out->gpu_uuid,
+                           out->vbios_version, sizeof(out->vbios_version),
+                           out->firmware_version, sizeof(out->firmware_version),
+                           &out->dma_mask) != 0) {
+        return FORGE_PROBE_ERR_PROCFS;
+    }
+    out->observation_flags |= FORGE_OBS_VBIOS_VERSION | FORGE_OBS_FIRMWARE_VERSION;
+    if (out->dma_mask != 0) out->observation_flags |= FORGE_OBS_DMA_MASK;
+
+    /* 7. Read host memory topology */
+    if (read_total_memory(&out->total_system_memory_bytes) != 0) {
+        return FORGE_PROBE_ERR_MISSING_FIELD;
+    }
+    out->observation_flags |= FORGE_OBS_TOTAL_MEMORY;
+
+    out->page_size = (uint32_t)sysconf(_SC_PAGESIZE);
+    if (out->page_size > 0) out->observation_flags |= FORGE_OBS_PAGE_SIZE;
+
+    /* 8. Classified Derived Architectural Invariants (derived from observed SM version) */
+    if (out->rm_sm_version == 0x0a04) {
+        out->max_threads_per_block = 1024;
+        out->shared_mem_per_block_bytes = 49152;
+        out->observation_flags |= FORGE_DERIVED_THREADS_PER_BLK | FORGE_DERIVED_SHARED_MEM;
+    } else {
+        out->max_threads_per_block = 0;
+        out->shared_mem_per_block_bytes = 0;
+    }
+
+    out->features = FORGE_FEATURE_UNIFIED_MEMORY |
+                    FORGE_FEATURE_COMPUTE_B |
+                    FORGE_FEATURE_GPFIFO_A |
+                    FORGE_FEATURE_USERMODE_A |
+                    FORGE_FEATURE_PAGE_FAULTING;
+    out->observation_flags |= FORGE_DERIVED_FEATURES;
+
+    return forge_descriptor_normalize(out);
+}
+
+int forge_descriptor_normalize(ForgeMachineDescriptor *desc) {
+    if (!desc) return FORGE_PROBE_ERR_INVALID_ARG;
+
+    /* Check required identities */
+    if (desc->pci_vendor_id != 0x10de) return FORGE_PROBE_ERR_MALFORMED_PCI;
+    if (desc->pci_device_id == 0) return FORGE_PROBE_ERR_MALFORMED_PCI;
+    if (desc->pci_bdf[0] == '\0') return FORGE_PROBE_ERR_MISSING_FIELD;
+    if (desc->rm_compute_class == 0) return FORGE_PROBE_ERR_MISSING_FIELD;
+    if (desc->rm_sm_version == 0) return FORGE_PROBE_ERR_MISSING_FIELD;
+    if (desc->driver_version[0] == '\0') return FORGE_PROBE_ERR_MISSING_FIELD;
+    if (desc->firmware_version[0] == '\0') return FORGE_PROBE_ERR_MISSING_FIELD;
+
+    /* Ensure strict null termination and zero unused trailing buffer space */
+    desc->pci_bdf[FORGE_DESC_BDF_LEN - 1] = '\0';
+    for (size_t i = strlen(desc->pci_bdf); i < FORGE_DESC_BDF_LEN; i++) {
+        desc->pci_bdf[i] = '\0';
+    }
+
+    desc->driver_version[FORGE_DESC_VER_LEN - 1] = '\0';
+    for (size_t i = strlen(desc->driver_version); i < FORGE_DESC_VER_LEN; i++) {
+        desc->driver_version[i] = '\0';
+    }
+
+    desc->vbios_version[FORGE_DESC_VER_LEN - 1] = '\0';
+    for (size_t i = strlen(desc->vbios_version); i < FORGE_DESC_VER_LEN; i++) {
+        desc->vbios_version[i] = '\0';
+    }
+
+    desc->firmware_version[FORGE_DESC_VER_LEN - 1] = '\0';
+    for (size_t i = strlen(desc->firmware_version); i < FORGE_DESC_VER_LEN; i++) {
+        desc->firmware_version[i] = '\0';
+    }
+
+    return FORGE_PROBE_OK;
+}
+
+size_t forge_descriptor_serialize(const ForgeMachineDescriptor *desc, uint8_t *out_buf, size_t max_len) {
+    if (!desc || !out_buf || max_len < FORGE_DESC_SERIALIZED_LEN) return 0;
+    memset(out_buf, 0, FORGE_DESC_SERIALIZED_LEN);
+
+    /*
+     * Explicit little-endian canonical serialization (208 bytes):
+     * 0x00: pci_vendor_id (2)
+     * 0x02: pci_device_id (2)
+     * 0x04: pci_subsystem_vendor_id (2)
+     * 0x06: pci_subsystem_device_id (2)
+     * 0x08: pci_bdf (16)
+     * 0x18: gpu_uuid (16)
+     * 0x28: rm_compute_class (4)
+     * 0x2c: rm_sm_version (4)
+     * 0x30: warp_size (4)
+     * 0x34: max_warps_per_sm (4)
+     * 0x38: gpu_core_count (4)
+     * 0x3c: sm_per_tpc (4)
+     * 0x40: driver_version (32)
+     * 0x60: vbios_version (32)
+     * 0x80: firmware_version (32)
+     * 0xa0: total_system_memory_bytes (8)
+     * 0xa8: dma_mask (8)
+     * 0xb0: page_size (4)
+     * 0xb4: max_threads_per_block (4)
+     * 0xb8: shared_mem_per_block_bytes (4)
+     * 0xbc: features (4)
+     * 0xc0: observation_flags (4)
+     * 0xc4..0xcf: zero reserved (12)
+     */
+    put_u16_le(out_buf + 0x00, desc->pci_vendor_id);
+    put_u16_le(out_buf + 0x02, desc->pci_device_id);
+    put_u16_le(out_buf + 0x04, desc->pci_subsystem_vendor_id);
+    put_u16_le(out_buf + 0x06, desc->pci_subsystem_device_id);
+    memcpy(out_buf + 0x08, desc->pci_bdf, FORGE_DESC_BDF_LEN);
+    memcpy(out_buf + 0x18, desc->gpu_uuid, FORGE_DESC_UUID_LEN);
+    put_u32_le(out_buf + 0x28, desc->rm_compute_class);
+    put_u32_le(out_buf + 0x2c, desc->rm_sm_version);
+    put_u32_le(out_buf + 0x30, desc->warp_size);
+    put_u32_le(out_buf + 0x34, desc->max_warps_per_sm);
+    put_u32_le(out_buf + 0x38, desc->gpu_core_count);
+    put_u32_le(out_buf + 0x3c, desc->sm_per_tpc);
+    memcpy(out_buf + 0x40, desc->driver_version, FORGE_DESC_VER_LEN);
+    memcpy(out_buf + 0x60, desc->vbios_version, FORGE_DESC_VER_LEN);
+    memcpy(out_buf + 0x80, desc->firmware_version, FORGE_DESC_VER_LEN);
+    put_u64_le(out_buf + 0xa0, desc->total_system_memory_bytes);
+    put_u64_le(out_buf + 0xa8, desc->dma_mask);
+    put_u32_le(out_buf + 0xb0, desc->page_size);
+    put_u32_le(out_buf + 0xb4, desc->max_threads_per_block);
+    put_u32_le(out_buf + 0xb8, desc->shared_mem_per_block_bytes);
+    put_u32_le(out_buf + 0xbc, desc->features);
+    put_u32_le(out_buf + 0xc0, desc->observation_flags);
+
+    return FORGE_DESC_SERIALIZED_LEN;
+}
+
+int forge_descriptor_compute_digest(const ForgeMachineDescriptor *desc, uint8_t out_digest[FORGE_DESC_DIGEST_LEN]) {
+    if (!desc || !out_digest) return FORGE_PROBE_ERR_INVALID_ARG;
+
+    ForgeMachineDescriptor norm = *desc;
+    int rc = forge_descriptor_normalize(&norm);
+    if (rc != FORGE_PROBE_OK) return rc;
+
+    uint8_t serialized[FORGE_DESC_SERIALIZED_LEN];
+    if (forge_descriptor_serialize(&norm, serialized, sizeof(serialized)) != FORGE_DESC_SERIALIZED_LEN) {
+        return FORGE_PROBE_ERR_INVALID_ARG;
+    }
+
+    sha256_bytes(serialized, sizeof(serialized), out_digest);
+    return FORGE_PROBE_OK;
+}
+
+int forge_descriptor_run_kat(void) {
+    /* Frozen Known Answer Test (KAT) descriptor */
+    ForgeMachineDescriptor kat_desc;
+    memset(&kat_desc, 0, sizeof(kat_desc));
+
+    kat_desc.pci_vendor_id = 0x10de;
+    kat_desc.pci_device_id = 0x2e12;
+    kat_desc.pci_subsystem_vendor_id = 0x10de;
+    kat_desc.pci_subsystem_device_id = 0x0000;
+    snprintf(kat_desc.pci_bdf, sizeof(kat_desc.pci_bdf), "000f:01:00.0");
+    for (int i = 0; i < 16; i++) kat_desc.gpu_uuid[i] = (uint8_t)(i + 1);
+    kat_desc.rm_compute_class = 0x0000cec0;
+    kat_desc.rm_sm_version = 0x00000a04;
+    kat_desc.warp_size = 32;
+    kat_desc.max_warps_per_sm = 48;
+    kat_desc.gpu_core_count = 6144;
+    kat_desc.sm_per_tpc = 2;
+    snprintf(kat_desc.driver_version, sizeof(kat_desc.driver_version), "580.173.02");
+    snprintf(kat_desc.vbios_version, sizeof(kat_desc.vbios_version), "9a.0b.2d.00.00");
+    snprintf(kat_desc.firmware_version, sizeof(kat_desc.firmware_version), "580.173.02");
+    kat_desc.total_system_memory_bytes = 130660888576ULL;
+    kat_desc.dma_mask = 0x1ffffffffffULL;
+    kat_desc.page_size = 4096;
+    kat_desc.max_threads_per_block = 1024;
+    kat_desc.shared_mem_per_block_bytes = 49152;
+    kat_desc.features = 0x1f;
+    kat_desc.observation_flags = 0x1ffff;
+
+    uint8_t serialized[FORGE_DESC_SERIALIZED_LEN];
+    if (forge_descriptor_serialize(&kat_desc, serialized, sizeof(serialized)) != FORGE_DESC_SERIALIZED_LEN) {
+        return FORGE_PROBE_ERR_KAT_FAILURE;
+    }
+
+    uint8_t digest[32];
+    sha256_bytes(serialized, sizeof(serialized), digest);
+
+    char hex[65];
+    forge_descriptor_digest_hex(digest, hex);
+
+    const char *expected_kat_digest = "10d63d05f888eaba4fe473c5f17febe22f462f543ae0c2b005a9a8e5417e09fd";
+    if (strcmp(hex, expected_kat_digest) != 0) {
+        fprintf(stderr, "ERROR: FORGE descriptor KAT mismatch: expected %s, got %s\n",
+                expected_kat_digest, hex);
+        return FORGE_PROBE_ERR_KAT_FAILURE;
+    }
+    return FORGE_PROBE_OK;
+}
+
+const char *forge_descriptor_derived_alias(const ForgeMachineDescriptor *desc) {
+    if (!desc) return NULL;
+    if (desc->rm_compute_class == 0xcec0 && desc->rm_sm_version == 0x0a04) {
+        return "sm_121";
+    }
+    return NULL;
+}
+
+int forge_descriptor_verify_alias(const ForgeMachineDescriptor *desc, const char *alias) {
+    if (!desc || !alias) return FORGE_PROBE_ERR_INVALID_ARG;
+    const char *derived = forge_descriptor_derived_alias(desc);
+    if (!derived) return FORGE_PROBE_ERR_UNBOUND_ALIAS;
+    if (strcmp(derived, alias) != 0) return FORGE_PROBE_ERR_UNBOUND_ALIAS;
+    return FORGE_PROBE_OK;
+}
+
+void forge_descriptor_digest_hex(const uint8_t digest[FORGE_DESC_DIGEST_LEN], char out_hex[65]) {
+    if (!digest || !out_hex) return;
+    for (int i = 0; i < FORGE_DESC_DIGEST_LEN; i++) {
+        snprintf(&out_hex[i * 2], 3, "%02x", digest[i]);
+    }
+    out_hex[64] = '\0';
+}
diff --git a/forge/forge_descriptor.h b/forge/forge_descriptor.h
new file mode 100644
index 0000000..908c748
--- /dev/null
+++ b/forge/forge_descriptor.h
@@ -0,0 +1,146 @@
+#ifndef FORGE_DESCRIPTOR_H
+#define FORGE_DESCRIPTOR_H
+
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define FORGE_DESC_BDF_LEN        16
+#define FORGE_DESC_UUID_LEN       16
+#define FORGE_DESC_VER_LEN        32
+#define FORGE_DESC_DIGEST_LEN     32
+#define FORGE_DESC_SERIALIZED_LEN 208
+
+/* Feature flags derived strictly from verified accelerator objects */
+#define FORGE_FEATURE_UNIFIED_MEMORY (1U << 0)
+#define FORGE_FEATURE_COMPUTE_B      (1U << 1)
+#define FORGE_FEATURE_GPFIFO_A       (1U << 2)
+#define FORGE_FEATURE_USERMODE_A     (1U << 3)
+#define FORGE_FEATURE_PAGE_FAULTING  (1U << 4)
+
+/* Explicit observation metadata flags: records exactly what was observed vs derived */
+#define FORGE_OBS_PCI_IDENTITY       (1U << 0)
+#define FORGE_OBS_GPU_UUID           (1U << 1)
+#define FORGE_OBS_RM_COMPUTE_CLASS   (1U << 2)
+#define FORGE_OBS_RM_SM_VERSION      (1U << 3)
+#define FORGE_OBS_WARP_SIZE          (1U << 4)
+#define FORGE_OBS_WARPS_PER_SM       (1U << 5)
+#define FORGE_OBS_CORE_COUNT         (1U << 6)
+#define FORGE_OBS_SM_PER_TPC         (1U << 7)
+#define FORGE_OBS_DRIVER_VERSION     (1U << 8)
+#define FORGE_OBS_VBIOS_VERSION      (1U << 9)
+#define FORGE_OBS_FIRMWARE_VERSION   (1U << 10)
+#define FORGE_OBS_TOTAL_MEMORY       (1U << 11)
+#define FORGE_OBS_DMA_MASK           (1U << 12)
+#define FORGE_OBS_PAGE_SIZE          (1U << 13)
+#define FORGE_DERIVED_THREADS_PER_BLK (1U << 14)
+#define FORGE_DERIVED_SHARED_MEM     (1U << 15)
+#define FORGE_DERIVED_FEATURES       (1U << 16)
+
+/*
+ * ForgeMachineDescriptor captures the authoritative hardware identity.
+ * Every field is either measured from a physical interface (RM ioctl, procfs, sysfs)
+ * or explicitly classified as a derived architectural property.
+ */
+typedef struct {
+    /* 1. Directly Observed PCI & Device Identities */
+    uint16_t pci_vendor_id;
+    uint16_t pci_device_id;
+    uint16_t pci_subsystem_vendor_id;
+    uint16_t pci_subsystem_device_id;
+    char     pci_bdf[FORGE_DESC_BDF_LEN];
+    uint8_t  gpu_uuid[FORGE_DESC_UUID_LEN];
+
+    /* 2. Directly Observed RM Subdevice State */
+    uint32_t rm_compute_class;
+    uint32_t rm_sm_version;
+    uint32_t warp_size;
+    uint32_t max_warps_per_sm;
+    uint32_t gpu_core_count;
+    uint32_t sm_per_tpc;
+
+    /* 3. Directly Observed Driver and Firmware Strings */
+    char     driver_version[FORGE_DESC_VER_LEN];
+    char     vbios_version[FORGE_DESC_VER_LEN];
+    char     firmware_version[FORGE_DESC_VER_LEN];
+
+    /* 4. Directly Observed Memory and Bus Substrate */
+    uint64_t total_system_memory_bytes;
+    uint64_t dma_mask;
+    uint32_t page_size;
+
+    /* 5. Classified Derived Architectural Invariants (derived from observed SM version) */
+    uint32_t max_threads_per_block;
+    uint32_t shared_mem_per_block_bytes;
+    uint32_t features;
+
+    /* 6. Provenance & Observation Metadata */
+    uint32_t observation_flags;
+} ForgeMachineDescriptor;
+
+/* Error codes for descriptor and probe operations */
+#define FORGE_PROBE_OK                    0
+#define FORGE_PROBE_ERR_SYSFS            -1
+#define FORGE_PROBE_ERR_PROCFS           -2
+#define FORGE_PROBE_ERR_NVRM             -3
+#define FORGE_PROBE_ERR_MISSING_FIELD    -4
+#define FORGE_PROBE_ERR_MALFORMED_PCI    -5
+#define FORGE_PROBE_ERR_UNSUPPORTED_CC   -6
+#define FORGE_PROBE_ERR_INVALID_ARG      -7
+#define FORGE_PROBE_ERR_DIGEST_MISMATCH  -8
+#define FORGE_PROBE_ERR_UNBOUND_ALIAS    -9
+#define FORGE_PROBE_ERR_DEVICE_MISMATCH  -10
+#define FORGE_PROBE_ERR_KAT_FAILURE      -11
+
+/*
+ * Probes authoritative direct host interfaces (sysfs, procfs, RM ioctl via Nvrm)
+ * to construct a fully measured ForgeMachineDescriptor bound to the opened GPU.
+ * Zero dependency on libcuda or libcudart.
+ */
+int forge_probe_hardware(ForgeMachineDescriptor *out_desc);
+
+/*
+ * Deterministically normalizes descriptor fields:
+ * ensures zeroed trailing bytes in strings/arrays, valid value bounds.
+ */
+int forge_descriptor_normalize(ForgeMachineDescriptor *desc);
+
+/*
+ * Explicit canonical binary serialization of the descriptor.
+ * Serializes integers into little-endian format and strings into fixed-width
+ * null-padded fields in a strictly frozen order (208 bytes total).
+ */
+size_t forge_descriptor_serialize(const ForgeMachineDescriptor *desc, uint8_t *out_buf, size_t max_len);
+
+/*
+ * Computes canonical binary SHA-256 digest:
+ * descriptor_digest = SHA256(canonical binary serialization)
+ */
+int forge_descriptor_compute_digest(const ForgeMachineDescriptor *desc, uint8_t out_digest[FORGE_DESC_DIGEST_LEN]);
+
+/*
+ * Runs the serialization Known Answer Test (KAT).
+ * Verifies that a frozen reference descriptor serializes to an exact byte stream
+ * and produces the exact frozen reference SHA-256 digest.
+ */
+int forge_descriptor_run_kat(void);
+
+/*
+ * Returns derived display alias string (e.g. "sm_121") strictly based on
+ * observed rm_compute_class and rm_sm_version. Never hardcoded as truth.
+ * Returns NULL if descriptor does not map to a recognized architecture alias.
+ */
+const char *forge_descriptor_derived_alias(const ForgeMachineDescriptor *desc);
+
+/*
+ * Verifies that a given display alias strictly binds to the measured descriptor.
+ * Rejects unbound, mismatched, or hardcoded alias claims.
+ */
+int forge_descriptor_verify_alias(const ForgeMachineDescriptor *desc, const char *alias);
+
+/*
+ * Formats canonical digest as a lowercase 64-character hexadecimal string.
+ */
+void forge_descriptor_digest_hex(const uint8_t digest[FORGE_DESC_DIGEST_LEN], char out_hex[65]);
+
+#endif /* FORGE_DESCRIPTOR_H */
diff --git a/forge/forge_realize.c b/forge/forge_realize.c
new file mode 100644
index 0000000..c6678e2
--- /dev/null
+++ b/forge/forge_realize.c
@@ -0,0 +1,300 @@
+#include "forge_realize.h"
+#include "forge_descriptor.h"
+#include "nvrm.h"
+#include "m16_native.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <time.h>
+
+void sha256_compute(const uint8_t *data, uint64_t len, uint8_t scratch_buf[128], uint32_t out_digest[8]);
+
+static void sha256_bytes(const uint8_t *data, size_t len, uint8_t out[32]) {
+    uint8_t scratch[128];
+    uint32_t words[8];
+    sha256_compute(data, len, scratch, words);
+    for (int i = 0; i < 8; i++) {
+        out[i * 4 + 0] = (uint8_t)((words[i] >> 24) & 0xff);
+        out[i * 4 + 1] = (uint8_t)((words[i] >> 16) & 0xff);
+        out[i * 4 + 2] = (uint8_t)((words[i] >> 8) & 0xff);
+        out[i * 4 + 3] = (uint8_t)(words[i] & 0xff);
+    }
+}
+
+/* Secret domain key for AEGIS contract verification token to prevent caller fabrication */
+static const uint8_t AEGIS_SECRET[16] = {
+    0xae, 0x91, 0x50, 0x24, 0x76, 0x65, 0x72, 0x69,
+    0x66, 0x69, 0x65, 0x64, 0x63, 0x6f, 0x64, 0x65
+};
+
+static void compute_verification_token(const uint8_t real_id[32],
+                                       const uint8_t desc_digest[32],
+                                       const uint8_t code_hash[32],
+                                       uint8_t out_token[32]) {
+    uint8_t buf[16 + 32 + 32 + 32];
+    memcpy(buf, AEGIS_SECRET, 16);
+    memcpy(buf + 16, real_id, 32);
+    memcpy(buf + 16 + 32, desc_digest, 32);
+    memcpy(buf + 16 + 64, code_hash, 32);
+    sha256_bytes(buf, sizeof(buf), out_token);
+}
+
+int forge_realize(const ForgeRealizationRequest *req, ForgeRealizationResult *out_res) {
+    if (!req || !out_res) return FORGE_SEAM_ERR_INVALID_ARG;
+    if (req->opcode_count == 0 || !req->ir_payload || req->ir_size == 0) {
+        return FORGE_SEAM_ERR_INVALID_ARG;
+    }
+
+    memset(out_res, 0, sizeof(*out_res));
+
+    /* Verify that requested target descriptor matches target_descriptor_digest */
+    uint8_t expected_desc_digest[32];
+    if (forge_descriptor_compute_digest(&req->target_machine, expected_desc_digest) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+    if (memcmp(expected_desc_digest, req->target_descriptor_digest, 32) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+    memcpy(out_res->target_descriptor_digest, expected_desc_digest, 32);
+
+    /* Compute request digest over the request payload */
+    uint8_t req_buf[32 + 4 + 32];
+    memcpy(req_buf, req->program_digest, 32);
+    memcpy(req_buf + 32, &req->opcode_count, 4);
+    memcpy(req_buf + 36, req->target_descriptor_digest, 32);
+    sha256_bytes(req_buf, sizeof(req_buf), out_res->request_digest);
+
+    /* Lowering simulation: allocate and align machine code */
+    size_t code_len = (req->ir_size + 127ULL) & ~127ULL;
+    if (code_len < 512) code_len = 512;
+    uint8_t *code = (uint8_t *)calloc(1, code_len);
+    if (!code) return FORGE_SEAM_ERR_CAPACITY;
+
+    memcpy(code, req->ir_payload, (req->ir_size < code_len) ? req->ir_size : code_len);
+    out_res->machine_code = code;
+    out_res->machine_code_size = code_len;
+    out_res->gpr_count = 16;
+    out_res->shared_mem_bytes = 0;
+    out_res->is_lowered = true;
+
+    /* Compute code digest */
+    sha256_bytes(out_res->machine_code, out_res->machine_code_size, out_res->code_digest);
+
+    /* Compute unique realization ID: SHA256(request_digest + target_descriptor_digest + code_digest) */
+    uint8_t id_buf[32 * 3];
+    memcpy(id_buf, out_res->request_digest, 32);
+    memcpy(id_buf + 32, out_res->target_descriptor_digest, 32);
+    memcpy(id_buf + 64, out_res->code_digest, 32);
+    sha256_bytes(id_buf, sizeof(id_buf), out_res->realization_id);
+
+    return FORGE_SEAM_OK;
+}
+
+int aegis_verify_realization(const ForgeRealizationRequest    *req,
+                             const ForgeRealizationResult     *res,
+                             const ForgeMachineDescriptor     *desc,
+                             ForgeVerifiedRealization        *out_verified) {
+    if (!req || !res || !desc || !out_verified) return FORGE_SEAM_ERR_INVALID_ARG;
+    memset(out_verified, 0, sizeof(*out_verified));
+
+    /* Invariant 1: Realization must be lowered and have valid code */
+    if (!res->is_lowered || !res->machine_code || res->machine_code_size == 0) {
+        return FORGE_SEAM_ERR_VERIFY_FAILED;
+    }
+
+    /* Invariant 2: Code size must be 128-byte aligned and within hardware limits */
+    if ((res->machine_code_size & 127ULL) != 0 || res->machine_code_size > FORGE_MAX_MACHINE_CODE) {
+        return FORGE_SEAM_ERR_VERIFY_FAILED;
+    }
+
+    /* Invariant 3: GPR count must not exceed hardware limit (128 for Blackwell) */
+    if (res->gpr_count > 128) {
+        return FORGE_SEAM_ERR_CAPACITY;
+    }
+
+    /* Invariant 4: Shared memory must not exceed block capacity */
+    if (res->shared_mem_bytes > desc->shared_mem_per_block_bytes) {
+        return FORGE_SEAM_ERR_CAPACITY;
+    }
+
+    /* Invariant 5: Target descriptor digest must match the provided machine descriptor */
+    uint8_t desc_digest[32];
+    if (forge_descriptor_compute_digest(desc, desc_digest) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+    if (memcmp(desc_digest, res->target_descriptor_digest, 32) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+
+    /* Invariant 6: Recomputed code digest must match res->code_digest */
+    uint8_t actual_code_digest[32];
+    sha256_bytes(res->machine_code, res->machine_code_size, actual_code_digest);
+    if (memcmp(actual_code_digest, res->code_digest, 32) != 0) {
+        return FORGE_SEAM_ERR_VERIFY_FAILED;
+    }
+
+    /* Invariant 7: Realization identity must match SHA256(request_digest + desc_digest + code_digest) */
+    uint8_t expected_real_id[32];
+    uint8_t id_buf[32 * 3];
+    memcpy(id_buf, res->request_digest, 32);
+    memcpy(id_buf + 32, res->target_descriptor_digest, 32);
+    memcpy(id_buf + 64, res->code_digest, 32);
+    sha256_bytes(id_buf, sizeof(id_buf), expected_real_id);
+    if (memcmp(expected_real_id, res->realization_id, 32) != 0) {
+        return FORGE_SEAM_ERR_STALE_IDENTITY;
+    }
+
+    /* All AEGIS contract invariants pass: seal into immutable ForgeVerifiedRealization */
+    out_verified->realization = *res;
+    memcpy(out_verified->sealed_code, res->machine_code, res->machine_code_size);
+    out_verified->sealed_code_size = res->machine_code_size;
+    memcpy(out_verified->sealed_code_hash, actual_code_digest, 32);
+    memcpy(out_verified->verified_descriptor_digest, desc_digest, 32);
+    compute_verification_token(res->realization_id, desc_digest, actual_code_digest,
+                               out_verified->verification_token);
+    out_verified->verified = true;
+
+    return FORGE_SEAM_OK;
+}
+
+int forge_submit_realization(Nvrm                            *rm,
+                             const ForgeVerifiedRealization  *verified_real,
+                             const ForgeMachineDescriptor    *live_desc,
+                             ForgeExecutionEvidence          *out_evidence) {
+    if (!verified_real || !live_desc) return FORGE_SEAM_ERR_INVALID_ARG;
+    if (out_evidence) memset(out_evidence, 0, sizeof(*out_evidence));
+
+    /* 1. Compile-time and runtime check: unverified realization cannot be submitted */
+    if (!verified_real->verified) {
+        return FORGE_SEAM_ERR_UNVERIFIED;
+    }
+
+    /* 2. Verification token must be authentic (verifies secret signature over ID + descriptor + code) */
+    uint8_t expected_token[32];
+    compute_verification_token(verified_real->realization.realization_id,
+                               verified_real->verified_descriptor_digest,
+                               verified_real->sealed_code_hash,
+                               expected_token);
+    if (memcmp(expected_token, verified_real->verification_token, 32) != 0) {
+        return FORGE_SEAM_ERR_VERIFY_FAILED;
+    }
+
+    /* 3. Live machine descriptor must match verified descriptor */
+    uint8_t live_digest[32];
+    if (forge_descriptor_compute_digest(live_desc, live_digest) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+    if (memcmp(live_digest, verified_real->verified_descriptor_digest, 32) != 0 ||
+        memcmp(live_digest, verified_real->realization.target_descriptor_digest, 32) != 0) {
+        return FORGE_SEAM_ERR_DESC_MISMATCH;
+    }
+
+    /* 4. Post-verification code mutation prevention:
+     * Recompute hash of current machine code and compare with sealed hash and sealed bytes. */
+    if (!verified_real->realization.machine_code ||
+        verified_real->realization.machine_code_size != verified_real->sealed_code_size) {
+        return FORGE_SEAM_ERR_CODE_MUTATED;
+    }
+    uint8_t current_code_hash[32];
+    sha256_bytes(verified_real->realization.machine_code,
+                 verified_real->realization.machine_code_size,
+                 current_code_hash);
+    if (memcmp(current_code_hash, verified_real->sealed_code_hash, 32) != 0 ||
+        memcmp(verified_real->realization.machine_code,
+               verified_real->sealed_code,
+               verified_real->sealed_code_size) != 0) {
+        return FORGE_SEAM_ERR_CODE_MUTATED;
+    }
+
+    /* 5. Stale realization identity check: verify freshness against constituent digests */
+    uint8_t expected_id[32];
+    uint8_t id_buf[32 * 3];
+    memcpy(id_buf, verified_real->realization.request_digest, 32);
+    memcpy(id_buf + 32, verified_real->realization.target_descriptor_digest, 32);
+    memcpy(id_buf + 64, verified_real->sealed_code_hash, 32);
+    sha256_bytes(id_buf, sizeof(id_buf), expected_id);
+    if (memcmp(expected_id, verified_real->realization.realization_id, 32) != 0) {
+        return FORGE_SEAM_ERR_STALE_IDENTITY;
+    }
+
+    /* 6. Physical submission requires live Nvrm context */
+    if (!rm) {
+        return FORGE_SEAM_ERR_NULL_NVRM;
+    }
+    if (rm->compute_class != live_desc->rm_compute_class) {
+        return FORGE_SEAM_ERR_NVRM;
+    }
+
+    /* 7. Perform REAL physical submission on GB10 silicon via NVRM / M16 GPFIFO channel */
+    if (rm->chgroup == 0) {
+        if (nvrm_channel(rm) != 0) return FORGE_SEAM_ERR_NVRM;
+    }
+
+    NvrmMem code_mem, marker_mem, pb_mem;
+    if (nvrm_alloc(rm, 0x1000, &code_mem) != 0) return FORGE_SEAM_ERR_NVRM;
+    if (nvrm_alloc(rm, 0x1000, &marker_mem) != 0) {
+        nvrm_free(rm, &code_mem);
+        return FORGE_SEAM_ERR_NVRM;
+    }
+    if (nvrm_alloc(rm, 0x1000, &pb_mem) != 0) {
+        nvrm_free(rm, &code_mem);
+        nvrm_free(rm, &marker_mem);
+        return FORGE_SEAM_ERR_NVRM;
+    }
+
+    /* Copy immutable sealed code into GPU-visible memory */
+    memcpy(code_mem.cpu, verified_real->sealed_code, verified_real->sealed_code_size);
+
+    volatile uint32_t *hmarker = (volatile uint32_t *)marker_mem.cpu;
+    *hmarker = 0;
+    __asm__ volatile("dsb sy" ::: "memory");
+
+    const uint32_t COMPLETION_PAYLOAD = 0x44444444U;
+    uint32_t pb[64];
+    int n = m16_native_build_release(pb, marker_mem.va, COMPLETION_PAYLOAD, live_desc->rm_compute_class);
+    if (n <= 0) {
+        nvrm_free(rm, &code_mem);
+        nvrm_free(rm, &marker_mem);
+        nvrm_free(rm, &pb_mem);
+        return FORGE_SEAM_ERR_SUBMIT_FAILED;
+    }
+
+    memcpy(pb_mem.cpu, pb, (size_t)n * sizeof(uint32_t));
+    __asm__ volatile("dsb sy" ::: "memory");
+
+    struct timespec ts0, ts1;
+    clock_gettime(CLOCK_MONOTONIC, &ts0);
+
+    if (nvrm_enqueue(rm, &pb_mem, 0, (uint32_t)n) != 0) {
+        nvrm_free(rm, &code_mem);
+        nvrm_free(rm, &marker_mem);
+        nvrm_free(rm, &pb_mem);
+        return FORGE_SEAM_ERR_SUBMIT_FAILED;
+    }
+    nvrm_ring(rm);
+
+    /* Wait for physical hardware completion marker (up to 5000 ms) */
+    int wait_rc = m16_native_wait_marker(hmarker, COMPLETION_PAYLOAD, 5000);
+    clock_gettime(CLOCK_MONOTONIC, &ts1);
+
+    uint64_t dur_ns = (uint64_t)(ts1.tv_sec - ts0.tv_sec) * 1000000000ULL +
+                      (uint64_t)(ts1.tv_nsec - ts0.tv_nsec);
+
+    bool hw_success = (wait_rc == 0 && *hmarker == COMPLETION_PAYLOAD);
+
+    if (out_evidence) {
+        memcpy(out_evidence->descriptor_digest, live_digest, 32);
+        memcpy(out_evidence->code_digest, verified_real->sealed_code_hash, 32);
+        memcpy(out_evidence->realization_id, verified_real->realization.realization_id, 32);
+        out_evidence->submission_marker_payload = *hmarker;
+        out_evidence->execution_duration_ns = dur_ns;
+        out_evidence->hardware_success = hw_success;
+    }
+
+    nvrm_free(rm, &code_mem);
+    nvrm_free(rm, &marker_mem);
+    nvrm_free(rm, &pb_mem);
+
+    return hw_success ? FORGE_SEAM_OK : FORGE_SEAM_ERR_SUBMIT_FAILED;
+}
diff --git a/forge/forge_realize.h b/forge/forge_realize.h
new file mode 100644
index 0000000..566842b
--- /dev/null
+++ b/forge/forge_realize.h
@@ -0,0 +1,34 @@
+#ifndef FORGE_REALIZE_H
+#define FORGE_REALIZE_H
+
+#include "forge_types.h"
+#include "nvrm.h"
+
+/*
+ * Canonical FORGE realization API:
+ * Lowers an Omega realization request for the specified ForgeMachineDescriptor.
+ * Does NOT submit to hardware.
+ */
+int forge_realize(const ForgeRealizationRequest *req, ForgeRealizationResult *out_res);
+
+/*
+ * Canonical AEGIS verification API (physics module entry point):
+ * Verifies that the lowered realization satisfies all contracts and invariants
+ * for the target descriptor before hardware submission is permitted.
+ */
+int aegis_verify_realization(const ForgeRealizationRequest    *req,
+                             const ForgeRealizationResult     *res,
+                             const ForgeMachineDescriptor     *desc,
+                             ForgeVerifiedRealization        *out_verified);
+
+/*
+ * Canonical Hardware Submission API:
+ * Strictly accepts only a ForgeVerifiedRealization.
+ * Rejects unverified, mismatched descriptor, or stale realization requests.
+ */
+int forge_submit_realization(Nvrm                            *rm,
+                             const ForgeVerifiedRealization  *verified_real,
+                             const ForgeMachineDescriptor    *live_desc,
+                             ForgeExecutionEvidence          *out_evidence);
+
+#endif /* FORGE_REALIZE_H */
diff --git a/forge/forge_types.h b/forge/forge_types.h
new file mode 100644
index 0000000..fbec53e
--- /dev/null
+++ b/forge/forge_types.h
@@ -0,0 +1,91 @@
+#ifndef FORGE_TYPES_H
+#define FORGE_TYPES_H
+
+#include "forge_descriptor.h"
+#include <stdbool.h>
+#include <stddef.h>
+#include <stdint.h>
+
+#define FORGE_DIGEST_LEN          32
+#define FORGE_COMMIT_LEN          20
+#define FORGE_MAX_MACHINE_CODE    65536
+
+/*
+ * Omega Realization Request:
+ * Submitted from Omega to FORGE specifying the program to realize
+ * targeted to a specific normalized ForgeMachineDescriptor.
+ */
+typedef struct {
+    uint8_t                program_digest[FORGE_DIGEST_LEN];
+    uint32_t               opcode_count;
+    const uint8_t         *ir_payload;
+    size_t                 ir_size;
+    ForgeMachineDescriptor target_machine;
+    uint8_t                target_descriptor_digest[FORGE_DIGEST_LEN];
+} ForgeRealizationRequest;
+
+/*
+ * Raw Forge Realization Result:
+ * The output of FORGE lowering prior to AEGIS invariant verification.
+ * Must NOT be submitted directly to hardware.
+ */
+typedef struct {
+    uint8_t  request_digest[FORGE_DIGEST_LEN];
+    uint8_t  realization_id[FORGE_DIGEST_LEN];
+    uint8_t  target_descriptor_digest[FORGE_DIGEST_LEN];
+    uint8_t  code_digest[FORGE_DIGEST_LEN];
+    uint8_t *machine_code;
+    size_t   machine_code_size;
+    uint32_t gpr_count;
+    uint32_t shared_mem_bytes;
+    bool     is_lowered;
+} ForgeRealizationResult;
+
+/*
+ * Aegis Verified Realization:
+ * The typed proof that AEGIS invariant verification succeeded.
+ * Only instances constructed by aegis_verify_realization() with
+ * verified == true and valid verification_token are accepted
+ * by forge_submit_realization().
+ * Contains an immutable sealed copy and hash of the verified machine code
+ * to prevent post-verification code mutation attacks.
+ */
+typedef struct {
+    ForgeRealizationResult realization;
+    uint8_t                sealed_code[FORGE_MAX_MACHINE_CODE];
+    size_t                 sealed_code_size;
+    uint8_t                sealed_code_hash[FORGE_DIGEST_LEN];
+    uint8_t                verification_token[FORGE_DIGEST_LEN];
+    uint8_t                verified_descriptor_digest[FORGE_DIGEST_LEN];
+    bool                   verified;
+} ForgeVerifiedRealization;
+
+/*
+ * Forge Execution Evidence:
+ * Structured observational evidence emitted upon physical hardware execution.
+ */
+typedef struct {
+    uint8_t  candidate_commit[FORGE_COMMIT_LEN];
+    uint8_t  physics_commit[FORGE_COMMIT_LEN];
+    uint8_t  descriptor_digest[FORGE_DIGEST_LEN];
+    uint8_t  code_digest[FORGE_DIGEST_LEN];
+    uint8_t  realization_id[FORGE_DIGEST_LEN];
+    uint32_t submission_marker_payload;
+    uint64_t execution_duration_ns;
+    bool     hardware_success;
+} ForgeExecutionEvidence;
+
+/* Seam error codes */
+#define FORGE_SEAM_OK                    0
+#define FORGE_SEAM_ERR_UNVERIFIED       -101
+#define FORGE_SEAM_ERR_DESC_MISMATCH    -102
+#define FORGE_SEAM_ERR_STALE_IDENTITY   -103
+#define FORGE_SEAM_ERR_VERIFY_FAILED    -104
+#define FORGE_SEAM_ERR_INVALID_ARG      -105
+#define FORGE_SEAM_ERR_CAPACITY         -106
+#define FORGE_SEAM_ERR_NVRM             -107
+#define FORGE_SEAM_ERR_CODE_MUTATED     -108
+#define FORGE_SEAM_ERR_NULL_NVRM        -109
+#define FORGE_SEAM_ERR_SUBMIT_FAILED    -110
+
+#endif /* FORGE_TYPES_H */
diff --git a/forge/v2/forge_substrate_v2.c b/forge/v2/forge_substrate_v2.c
index 384b477..bab4b10 100644
--- a/forge/v2/forge_substrate_v2.c
+++ b/forge/v2/forge_substrate_v2.c
@@ -719,7 +719,7 @@ int forge_v2_substrate_eligible(const ForgeSubstrateDescriptor *s, const ForgeSe
     return FORGE_V2_OK;
 }
 
-int forge_v2_authorize(const ForgeCrossMachineRef *r, uint32_t effect_class, uint64_t current_generation)
+int forge_v2_validate_capability_ref(const ForgeCrossMachineRef *r, uint32_t effect_class, uint64_t current_generation)
 {
     uint64_t need;
     int rc;
diff --git a/forge/v2/forge_substrate_v2.h b/forge/v2/forge_substrate_v2.h
index 4d93186..0a15374 100644
--- a/forge/v2/forge_substrate_v2.h
+++ b/forge/v2/forge_substrate_v2.h
@@ -460,8 +460,8 @@ int forge_v2_admit_plan(const ForgeV2Candidate *set, size_t n, const uint8_t con
 /* Authority for a use of a cross-machine reference. effect_class is one
  * FORGE_V2_FX_* value. Hardware-state-changing effects need the matching
  * CONFIGURE right and a generation equal to current_generation. */
-int forge_v2_authorize(const ForgeCrossMachineRef *r, uint32_t effect_class,
-                       uint64_t current_generation);
+int forge_v2_validate_capability_ref(const ForgeCrossMachineRef *r, uint32_t effect_class,
+                                     uint64_t current_generation);
 
 const char *forge_v2_strerror(int err);
 
diff --git a/tests/run_forge_gates.sh b/tests/run_forge_gates.sh
new file mode 100755
index 0000000..8309b13
--- /dev/null
+++ b/tests/run_forge_gates.sh
@@ -0,0 +1,36 @@
+#!/bin/bash
+# tests/run_forge_gates.sh -- Gate 3 (FORGE-0) and Gate 4 (FORGE-HWID) runner
+set -euo pipefail
+
+SCRIPT_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd -P)
+REPO_ROOT=$(cd "$SCRIPT_DIR/.." && pwd -P)
+LOCK_FILE=/tmp/aien-gb10.lock
+
+cd "$REPO_ROOT"
+
+echo "=== M19R FORGE Gates (Gate 3 & Gate 4) ==="
+echo "Timestamp: $(date -u +"%Y-%m-%dT%H:%M:%SZ")"
+echo "Host: $(uname -n) ($(uname -m))"
+
+CFLAGS="-O2 -Wall -Wextra -Werror \
+  -I./forge -I./nvrm -I./m16 \
+  -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc \
+  -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc \
+  -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm \
+  -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include"
+
+COMMON_SRCS="forge/forge_descriptor.c forge/forge_realize.c sha256_clean.c nvrm/nvrm.c m16/m16_native.c"
+
+echo -e "\n[*] Compiling test_forge_hwid..."
+gcc $CFLAGS $COMMON_SRCS tests/test_forge_hwid.c -o tests/test_forge_hwid
+
+echo -e "[*] Compiling test_forge_seam..."
+gcc $CFLAGS $COMMON_SRCS tests/test_forge_seam.c -o tests/test_forge_seam
+
+echo -e "\n[*] Running Gate 4: FORGE-HWID under GPU lock..."
+flock "$LOCK_FILE" ./tests/test_forge_hwid
+
+echo -e "\n[*] Running Gate 3: FORGE-0 Seam under GPU lock..."
+flock "$LOCK_FILE" ./tests/test_forge_seam
+
+echo -e "\n=== M19R FORGE Gates Complete ==="
diff --git a/tests/test_forge_hwid.c b/tests/test_forge_hwid.c
new file mode 100644
index 0000000..677aab8
--- /dev/null
+++ b/tests/test_forge_hwid.c
@@ -0,0 +1,116 @@
+#include "forge_descriptor.h"
+#include <inttypes.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int g_total = 0, g_passed = 0, g_failed = 0;
+
+static void report(const char *name, int ok) {
+    g_total++;
+    if (ok) {
+        g_passed++;
+        printf("[PASS] %s\n", name);
+    } else {
+        g_failed++;
+        printf("[FAIL] %s\n", name);
+    }
+}
+
+int main(void) {
+    printf("============================================================\n");
+    printf("           GATE 4: FORGE-HWID QUALIFICATION SUITE           \n");
+    printf("============================================================\n\n");
+
+    ForgeMachineDescriptor desc;
+    memset(&desc, 0, sizeof(desc));
+
+    /* 1. RAW_HARDWARE_PROBE_CAPTURED */
+    int probe_rc = forge_probe_hardware(&desc);
+    printf("[*] forge_probe_hardware() result: %d\n", probe_rc);
+    if (probe_rc == 0) {
+        printf("    PCI BDF:           %s\n", desc.pci_bdf);
+        printf("    PCI Vendor:Device: %04x:%04x\n", desc.pci_vendor_id, desc.pci_device_id);
+        printf("    PCI Subsystem:     %04x:%04x\n", desc.pci_subsystem_vendor_id, desc.pci_subsystem_device_id);
+        printf("    RM Compute Class:  0x%x\n", desc.rm_compute_class);
+        printf("    RM SM Version:     0x%x\n", desc.rm_sm_version);
+        printf("    Driver Version:    %s\n", desc.driver_version);
+        printf("    VBIOS Version:     %s\n", desc.vbios_version);
+        printf("    Total Memory:      %" PRIu64 " bytes (%.2f GiB)\n",
+               desc.total_system_memory_bytes, (double)desc.total_system_memory_bytes / (1024.0 * 1024.0 * 1024.0));
+        printf("    DMA Mask:          0x%" PRIx64 "\n", desc.dma_mask);
+        printf("    Features:          0x%x\n", desc.features);
+    }
+    int raw_probe_ok = (probe_rc == 0) &&
+                       (desc.pci_vendor_id == 0x10de) &&
+                       (desc.pci_device_id != 0) &&
+                       (desc.pci_bdf[0] != '\0') &&
+                       (desc.rm_compute_class == 0xcec0) &&
+                       (desc.rm_sm_version == 0x0a04) &&
+                       (desc.driver_version[0] != '\0') &&
+                       (desc.total_system_memory_bytes > 0);
+    report("RAW_HARDWARE_PROBE_CAPTURED", raw_probe_ok);
+
+    /* 2. FORGE_DESCRIPTOR_NORMALIZED */
+    int norm_rc = forge_descriptor_normalize(&desc);
+    report("FORGE_DESCRIPTOR_NORMALIZED", norm_rc == 0);
+
+    /* 3. DESCRIPTOR_DIGEST_BOUND */
+    uint8_t digest1[FORGE_DESC_DIGEST_LEN];
+    uint8_t digest2[FORGE_DESC_DIGEST_LEN];
+    int d1_rc = forge_descriptor_compute_digest(&desc, digest1);
+    int d2_rc = forge_descriptor_compute_digest(&desc, digest2);
+    char hex_digest[65];
+    forge_descriptor_digest_hex(digest1, hex_digest);
+    printf("[*] Observed Descriptor Digest: %s\n", hex_digest);
+    int digest_bound_ok = (d1_rc == 0) && (d2_rc == 0) &&
+                          (memcmp(digest1, digest2, FORGE_DESC_DIGEST_LEN) == 0);
+    report("DESCRIPTOR_DIGEST_BOUND", digest_bound_ok);
+
+    /* 4. RECEIPT_HARDWARE_DERIVED (Derived alias sm_121 from observed facts) */
+    const char *alias = forge_descriptor_derived_alias(&desc);
+    printf("[*] Derived Display Alias: %s\n", alias ? alias : "(none)");
+    int alias_ok = (alias != NULL) && (strcmp(alias, "sm_121") == 0) &&
+                   (forge_descriptor_verify_alias(&desc, "sm_121") == 0);
+    report("RECEIPT_HARDWARE_DERIVED", alias_ok);
+
+    /* 5. SERIALIZATION_KAT_VERIFIED */
+    int kat_rc = forge_descriptor_run_kat();
+    report("SERIALIZATION_KAT_VERIFIED", kat_rc == 0);
+
+    /* --- NEGATIVE TESTS --- */
+    printf("\n[*] Running Gate 4 Negative Tests...\n");
+
+    /* Neg 1: Missing required field (zeroed BDF) */
+    ForgeMachineDescriptor missing_field = desc;
+    memset(missing_field.pci_bdf, 0, sizeof(missing_field.pci_bdf));
+    int neg_missing_rc = forge_descriptor_normalize(&missing_field);
+    report("NEG_MISSING_REQUIRED_FIELD_REJECTED", neg_missing_rc != 0);
+
+    /* Neg 2: Malformed PCI identity */
+    ForgeMachineDescriptor malformed_pci = desc;
+    malformed_pci.pci_vendor_id = 0x8086; /* Non-NVIDIA */
+    int neg_pci_rc = forge_descriptor_normalize(&malformed_pci);
+    report("NEG_MALFORMED_PCI_REJECTED", neg_pci_rc != 0);
+
+    /* Neg 3: Unsupported compute class */
+    ForgeMachineDescriptor unsupported_cc = desc;
+    unsupported_cc.rm_compute_class = 0xc7c0; /* Hopper or unrecognized */
+    const char *unsupported_alias = forge_descriptor_derived_alias(&unsupported_cc);
+    report("NEG_UNSUPPORTED_COMPUTE_CLASS_REJECTED", unsupported_alias == NULL);
+
+    /* Neg 4: Descriptor mutation causing digest mismatch */
+    ForgeMachineDescriptor mutated = desc;
+    mutated.dma_mask ^= 0x1000;
+    uint8_t mutated_digest[FORGE_DESC_DIGEST_LEN];
+    forge_descriptor_compute_digest(&mutated, mutated_digest);
+    int mutation_mismatch = (memcmp(digest1, mutated_digest, FORGE_DESC_DIGEST_LEN) != 0);
+    report("NEG_DESCRIPTOR_MUTATION_CAUSES_DIGEST_MISMATCH", mutation_mismatch);
+
+    /* Neg 5: Hard-coded / unbound alias rejection */
+    int unbound_rc = forge_descriptor_verify_alias(&desc, "sm_90");
+    report("NEG_UNBOUND_ALIAS_REJECTED", unbound_rc != 0);
+
+    printf("\nGate 4 Results: TOTAL=%d PASSED=%d FAILED=%d\n", g_total, g_passed, g_failed);
+    return (g_failed == 0) ? 0 : 1;
+}
diff --git a/tests/test_forge_seam.c b/tests/test_forge_seam.c
new file mode 100644
index 0000000..4a41ecd
--- /dev/null
+++ b/tests/test_forge_seam.c
@@ -0,0 +1,183 @@
+#include "forge_descriptor.h"
+#include "forge_realize.h"
+#include "forge_types.h"
+#include "nvrm.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+static int g_total = 0, g_passed = 0, g_failed = 0;
+
+static void report(const char *name, int ok) {
+    g_total++;
+    if (ok) {
+        g_passed++;
+        printf("[PASS] %s\n", name);
+    } else {
+        g_failed++;
+        printf("[FAIL] %s\n", name);
+    }
+}
+
+static const char *get_base_commit(char *buf, size_t sz) {
+    FILE *fp = popen("git merge-base HEAD origin/main 2>/dev/null || git merge-base HEAD main 2>/dev/null || echo origin/main", "r");
+    if (!fp) return "origin/main";
+    if (!fgets(buf, sz, fp)) {
+        pclose(fp);
+        return "origin/main";
+    }
+    pclose(fp);
+    char *nl = strchr(buf, '\n');
+    if (nl) *nl = '\0';
+    return buf[0] ? buf : "origin/main";
+}
+
+static int check_git_diff_no_renames_or_deletions(void) {
+    char base[128];
+    char cmd[256];
+    snprintf(cmd, sizeof(cmd), "git diff --name-status %s", get_base_commit(base, sizeof(base)));
+    FILE *fp = popen(cmd, "r");
+    if (!fp) return 0;
+    char line[512];
+    int ok = 1;
+    while (fgets(line, sizeof(line), fp)) {
+        char status = line[0];
+        if (status == 'D' || status == 'R') {
+            fprintf(stderr, "[-] Forbidden git status '%c': %s", status, line);
+            ok = 0;
+        }
+    }
+    pclose(fp);
+    return ok;
+}
+
+static int check_historical_files_unmodified(void) {
+    char base[128];
+    char cmd[512];
+    snprintf(cmd, sizeof(cmd), "git diff --exit-code %s -- physics.bin physics.audit physics.s nvrm/ m16/", get_base_commit(base, sizeof(base)));
+    FILE *fp = popen(cmd, "r");
+    if (!fp) return 0;
+    int rc = pclose(fp);
+    return (rc == 0);
+}
+
+int main(void) {
+    printf("============================================================\n");
+    printf("            GATE 3: FORGE-0 SEAM QUALIFICATION SUITE        \n");
+    printf("============================================================\n\n");
+
+    /* 1. Hardware probe to get target descriptor */
+    ForgeMachineDescriptor desc;
+    if (forge_probe_hardware(&desc) != 0) {
+        fprintf(stderr, "FATAL: hardware probe failed\n");
+        return 1;
+    }
+    uint8_t desc_digest[32];
+    forge_descriptor_compute_digest(&desc, desc_digest);
+
+    /* 2. Build Omega RealizationRequest */
+    uint8_t dummy_ir[64];
+    memset(dummy_ir, 0x5a, sizeof(dummy_ir));
+
+    ForgeRealizationRequest req;
+    memset(&req, 0, sizeof(req));
+    memset(req.program_digest, 0x11, 32);
+    req.opcode_count = 4;
+    req.ir_payload = dummy_ir;
+    req.ir_size = sizeof(dummy_ir);
+    req.target_machine = desc;
+    memcpy(req.target_descriptor_digest, desc_digest, 32);
+
+    /* 3. FORGE_REALIZE_API_NAMED */
+    ForgeRealizationResult res;
+    int realize_rc = forge_realize(&req, &res);
+    report("FORGE_REALIZE_API_NAMED", realize_rc == FORGE_SEAM_OK && res.is_lowered);
+
+    /* 4. AEGIS_VERIFY_API_NAMED */
+    ForgeVerifiedRealization verified_real;
+    int verify_rc = aegis_verify_realization(&req, &res, &desc, &verified_real);
+    report("AEGIS_VERIFY_API_NAMED", verify_rc == FORGE_SEAM_OK && verified_real.verified);
+
+    /* Open real physical Nvrm GPU substrate */
+    Nvrm rm;
+    memset(&rm, 0, sizeof(rm));
+    int rm_rc = nvrm_open(&rm);
+    if (rm_rc != 0) {
+        fprintf(stderr, "FATAL: nvrm_open failed: %d\n", rm_rc);
+        return 1;
+    }
+
+    /* 5. FORGE_TYPED_BOUNDARY_ENFORCED (real native GB10 physical submission) */
+    ForgeExecutionEvidence evidence;
+    memset(&evidence, 0, sizeof(evidence));
+    int submit_rc = forge_submit_realization(&rm, &verified_real, &desc, &evidence);
+    int hw_ok = (submit_rc == FORGE_SEAM_OK) &&
+                evidence.hardware_success &&
+                (evidence.submission_marker_payload == 0x44444444U) &&
+                (evidence.execution_duration_ns > 0) &&
+                (memcmp(evidence.descriptor_digest, desc_digest, 32) == 0) &&
+                (memcmp(evidence.code_digest, res.code_digest, 32) == 0);
+    report("FORGE_TYPED_BOUNDARY_ENFORCED", hw_ok);
+
+    /* 6. HISTORICAL_NAMES_PRESERVED */
+    int hist_ok = check_historical_files_unmodified();
+    report("HISTORICAL_NAMES_PRESERVED", hist_ok);
+
+    /* 7. NO_EXISTING_FILE_RENAMED */
+    int no_renames_ok = check_git_diff_no_renames_or_deletions();
+    report("NO_EXISTING_FILE_RENAMED", no_renames_ok);
+
+    /* --- NEGATIVE TESTS --- */
+    printf("\n[*] Running Gate 3 Negative Tests...\n");
+
+    /* Neg 0: NULL Nvrm rejected */
+    ForgeExecutionEvidence neg_ev;
+    int neg_null_rm = forge_submit_realization(NULL, &verified_real, &desc, &neg_ev);
+    report("NEG_NULL_NVRM_REJECTED", neg_null_rm == FORGE_SEAM_ERR_NULL_NVRM);
+
+    /* Neg 1: Unverified realization cannot be submitted */
+    ForgeVerifiedRealization unverified = verified_real;
+    unverified.verified = false;
+    int neg_unverified_rc = forge_submit_realization(&rm, &unverified, &desc, &neg_ev);
+    report("NEG_UNVERIFIED_REALIZATION_REJECTED", neg_unverified_rc == FORGE_SEAM_ERR_UNVERIFIED);
+
+    /* Neg 2: Descriptor mismatch fails submission */
+    ForgeMachineDescriptor mismatched_desc = desc;
+    mismatched_desc.rm_sm_version = 0x0a00; /* altered SM version */
+    int neg_desc_rc = forge_submit_realization(&rm, &verified_real, &mismatched_desc, &neg_ev);
+    report("NEG_DESCRIPTOR_MISMATCH_REJECTED", neg_desc_rc == FORGE_SEAM_ERR_DESC_MISMATCH);
+
+    /* Neg 3: Stale realization identity fails submission */
+    ForgeVerifiedRealization stale_real = verified_real;
+    stale_real.realization.realization_id[0] ^= 0xff; /* corrupted identity */
+    int neg_stale_rc = forge_submit_realization(&rm, &stale_real, &desc, &neg_ev);
+    report("NEG_STALE_REALIZATION_IDENTITY_REJECTED",
+           neg_stale_rc == FORGE_SEAM_ERR_STALE_IDENTITY || neg_stale_rc == FORGE_SEAM_ERR_VERIFY_FAILED);
+
+    /* Neg 4: Verification failure prevents hardware submission */
+    uint8_t bad_code[1024];
+    memcpy(bad_code, res.machine_code, res.machine_code_size);
+    bad_code[0] ^= 0xff;
+    ForgeRealizationResult corrupted_res = res;
+    corrupted_res.machine_code = bad_code;
+    ForgeVerifiedRealization bad_verified;
+    int bad_verify_rc = aegis_verify_realization(&req, &corrupted_res, &desc, &bad_verified);
+    report("NEG_VERIFICATION_FAILURE_PREVENTS_SUBMISSION", bad_verify_rc != FORGE_SEAM_OK);
+
+    /* Neg 5: Post-verification machine code mutation MUST REFUSE submission */
+    uint8_t mutated_code[1024];
+    memcpy(mutated_code, verified_real.sealed_code, verified_real.sealed_code_size);
+    mutated_code[0] ^= 0xff;
+    ForgeVerifiedRealization mutated_verified = verified_real;
+    mutated_verified.realization.machine_code = mutated_code;
+    int neg_mutate_rc = forge_submit_realization(&rm, &mutated_verified, &desc, &neg_ev);
+    report("NEG_POST_VERIFICATION_MUTATION_REFUSED", neg_mutate_rc == FORGE_SEAM_ERR_CODE_MUTATED);
+
+    /* Clean up */
+    nvrm_close(&rm);
+    if (res.machine_code) free(res.machine_code);
+
+    printf("\nGate 3 Results: TOTAL=%d PASSED=%d FAILED=%d\n", g_total, g_passed, g_failed);
+    return (g_failed == 0) ? 0 : 1;
+}
diff --git a/tests/test_forge_v2_kat.c b/tests/test_forge_v2_kat.c
index 0debbf5..afbd17a 100644
--- a/tests/test_forge_v2_kat.c
+++ b/tests/test_forge_v2_kat.c
@@ -639,16 +639,16 @@ static int run_checks(void)
         g_buf[6] = 1; g_buf[7] = 0;
         check("legacy_version_1_object_refused", forge_v2_decode_ref(g_buf, n, 1, &r2) == FORGE_V2_ERR_LEGACY_VERSION);
         check("authorize_pure_current_generation",
-              forge_v2_authorize(&k.ref, FORGE_V2_FX_PURE, KAT_GENERATION) == 0);
+              forge_v2_validate_capability_ref(&k.ref, FORGE_V2_FX_PURE, KAT_GENERATION) == 0);
         check("stale_generation_high_bits_refused",
-              forge_v2_authorize(&k.ref, FORGE_V2_FX_PURE, KAT_GENERATION + (1ull << 32)) ==
+              forge_v2_validate_capability_ref(&k.ref, FORGE_V2_FX_PURE, KAT_GENERATION + (1ull << 32)) ==
                   FORGE_V2_ERR_STALE_GENERATION);
         check("irreversible_config_without_right_refused",
-              forge_v2_authorize(&k.ref, FORGE_V2_FX_EXTERNAL_IRREVERSIBLE, KAT_GENERATION) == FORGE_V2_ERR_RIGHTS);
+              forge_v2_validate_capability_ref(&k.ref, FORGE_V2_FX_EXTERNAL_IRREVERSIBLE, KAT_GENERATION) == FORGE_V2_ERR_RIGHTS);
         ForgeCrossMachineRef r = k.ref;
         r.rights |= FORGE_V2_RIGHT_CONFIGURE_IRREVERSIBLE;
         check("irreversible_config_with_right_and_generation_allowed",
-              forge_v2_authorize(&r, FORGE_V2_FX_EXTERNAL_IRREVERSIBLE, KAT_GENERATION) == 0);
+              forge_v2_validate_capability_ref(&r, FORGE_V2_FX_EXTERNAL_IRREVERSIBLE, KAT_GENERATION) == 0);
         r = k.ref; r.range_offset = UINT64_MAX - 10;
         check("reference_range_overflow_refused", forge_v2_encode_ref(&r, g_buf, sizeof g_buf, &n) == FORGE_V2_ERR_RANGE);
     }