# x-3306/project-onyx architecture

> Architecture diagram of the GitHub repository x-3306/project-onyx, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-30). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/x-3306/project-onyx
- Repository: https://github.com/x-3306/project-onyx

## Overview

Project Onyx is a Windows proof-of-concept pipeline that combines hardware-derived keying, ONNX inference and key recovery, in-memory WASM execution, and a narrowly scoped model-update control channel. The main runtime entry is the C++ host; build.py generates and verifies assets but is excluded as build tooling. The README documents the end-to-end stages, while the source excerpts show selected host and Wasm3 internals; connections inside unsampled interpreter code are omitted or marked unverified.

Main entry points: [`DiagnosticsTool.cpp`](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp) (Windows Host), [`wasm3/source/wasm3.h`](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/wasm3.h) (Wasm3 Public API), [`wasm3/source/m3_parse.c`](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_parse.c) (WASM Parser), [`wasm3/source/m3_compile.c`](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_compile.c) (WASM Compiler)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host["Host Runtime"]
  node_host_app["Windows Host"]
  node_fingerprint["Machine Fingerprint"]
  node_wasm_cipher["Encrypted WASM"]
  node_status["Heartbeat Status"]
end

subgraph group_onnx["ONNX Pipeline"]
  node_onnx_model["Embedded ONNX Model"]
  node_weight_vault["Weight Vault"]
  node_metadata_vault["Metadata Fallback"]
  node_inference["Inference Workload"]
end

subgraph group_wasm["WASM Runtime"]
  node_wasm_api["Wasm3 Public API<br/>[wasm3.h]"]
  node_wasm_parser["WASM Parser<br/>[m3_parse.c]"]
  node_wasm_compiler["WASM Compiler<br/>[m3_compile.c]"]
  node_wasm_executor["WASM Executor<br/>[m3_exec.h]"]
  node_wasm_code["Code Pages<br/>[m3_code.c]"]
  node_wasm_heartbeat["Heartbeat Module<br/>[lib.rs]"]
end

subgraph group_downlink["Downlink Channel"]
  node_downlink_model["Updated ONNX Model"]
  node_delta_directive["Directive Reader"]
end

node_user(("Operator"))

node_host_app -->|"derives key"| node_fingerprint
node_host_app -->|"loads resource"| node_onnx_model
node_host_app -->|"extracts key"| node_weight_vault
node_host_app -->|"checks fallback"| node_metadata_vault
node_host_app -->|"runs inference"| node_inference
node_host_app -->|"decrypts payload"| node_wasm_cipher
node_host_app -->|"calls API"| node_wasm_api
node_wasm_api -.->|"parses module"| node_wasm_parser
node_wasm_parser -.->|"compiles module"| node_wasm_compiler
node_wasm_compiler -.->|"emits code"| node_wasm_code
node_wasm_executor -.->|"executes code"| node_wasm_code
node_host_app -->|"runs in memory"| node_wasm_heartbeat
node_user -->|"supplies update"| node_downlink_model
node_host_app -->|"reads update"| node_downlink_model
node_host_app -->|"validates directives"| node_delta_directive
node_delta_directive -->|"sets status"| node_status
node_wasm_heartbeat -.->|"signals heartbeat"| node_status

click node_host_app "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_fingerprint "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_onnx_model "https://github.com/x-3306/project-onyx/blob/main/assets/base/squeezenet1.0-12.onnx"
click node_weight_vault "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_metadata_vault "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_inference "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_wasm_cipher "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_wasm_api "https://github.com/x-3306/project-onyx/blob/main/wasm3/source/wasm3.h"
click node_wasm_parser "https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_parse.c"
click node_wasm_compiler "https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_compile.c"
click node_wasm_executor "https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_exec.h"
click node_wasm_code "https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_code.c"
click node_wasm_heartbeat "https://github.com/x-3306/project-onyx/blob/main/wasm_license_module/src/lib.rs"
click node_downlink_model "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_delta_directive "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"
click node_status "https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_host_app,node_fingerprint,node_wasm_cipher,node_status toneBlue
class node_onnx_model,node_weight_vault,node_metadata_vault,node_inference toneAmber
class node_wasm_api,node_wasm_parser,node_wasm_compiler,node_wasm_executor,node_wasm_code,node_wasm_heartbeat toneMint
class node_downlink_model,node_delta_directive toneRose
class node_user toneIndigo
```

## Components

### Host Runtime

- [Windows Host](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Machine Fingerprint](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Encrypted WASM](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Heartbeat Status](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`

### ONNX Pipeline

- [Embedded ONNX Model](https://github.com/x-3306/project-onyx/blob/main/assets/base/squeezenet1.0-12.onnx): `assets/base/squeezenet1.0-12.onnx`
- [Weight Vault](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Metadata Fallback](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Inference Workload](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`

### WASM Runtime

- [Wasm3 Public API](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/wasm3.h): `wasm3/source/wasm3.h`
- [WASM Parser](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_parse.c): `wasm3/source/m3_parse.c`
- [WASM Compiler](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_compile.c): `wasm3/source/m3_compile.c`
- [WASM Executor](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_exec.h): `wasm3/source/m3_exec.h`
- [Code Pages](https://github.com/x-3306/project-onyx/blob/main/wasm3/source/m3_code.c): `wasm3/source/m3_code.c`
- [Heartbeat Module](https://github.com/x-3306/project-onyx/blob/main/wasm_license_module/src/lib.rs): `wasm_license_module/src/lib.rs`

### Downlink Channel

- [Updated ONNX Model](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`
- [Directive Reader](https://github.com/x-3306/project-onyx/blob/main/DiagnosticsTool.cpp): `DiagnosticsTool.cpp`

### Other components

- **Operator**

## Connections

- Windows Host → Machine Fingerprint: derives key (evidence: `README.md`)
- Windows Host → Embedded ONNX Model: loads resource (evidence: `DiagnosticsTool.cpp`)
- Windows Host → Weight Vault: extracts key (evidence: `README.md`)
- Windows Host → Metadata Fallback: checks fallback (evidence: `README.md`)
- Windows Host → Inference Workload: runs inference (evidence: `README.md`)
- Windows Host → Encrypted WASM: decrypts payload (evidence: `README.md`)
- Windows Host → Wasm3 Public API: calls API (evidence: `DiagnosticsTool.cpp`)
- Wasm3 Public API → WASM Parser: parses module
- WASM Parser → WASM Compiler: compiles module
- WASM Compiler → Code Pages: emits code
- WASM Executor → Code Pages: executes code
- Windows Host → Heartbeat Module: runs in memory (evidence: `README.md`)
- Operator → Updated ONNX Model: supplies update (evidence: `README.md`)
- Windows Host → Updated ONNX Model: reads update (evidence: `README.md`)
- Windows Host → Directive Reader: validates directives (evidence: `README.md`)
- Directive Reader → Heartbeat Status: sets status (evidence: `README.md`)
- Heartbeat Module → Heartbeat Status: signals heartbeat
