--- name: nopray description: >- NOPRAY (Native Opcode Protocol: Reach the Almighty Yourself — "Talk Direct to God Without Praying") implements the DMCS-1.0 standard for synthesizing complete, standalone native applications directly in raw machine code (hexadecimal opcodes + executable headers) from natural language specifications, with zero programming languages, compilers, assemblers, linkers, or external libraries. Use when asked to create native binaries, GUI/TUI/CLI apps, network daemons, audio tools, or system utilities strictly in machine code, or when auditing and verifying raw machine-code executables on any discovered host. icon: ./assets/icon.svg --- # NOPRAY — Direct Machine Code Synthesis (`NOPRAY-1.0` / `DMCS-1.0`) > **N**ative **O**pcode **P**rotocol: **R**each the **A**lmighty **Y**ourself > *"Talk Direct to God Without Praying" — Zero Compilers, Zero Assemblers, Zero Libraries.* Synthesize complete, production-verifiable native software directly from natural language into **raw machine code bytes**, bypassing programming languages, compilers, assemblers, linkers, and runtime libraries. This skill defines an interoperable standard for frontier AI agents and human auditors. It turns raw binary synthesis from an error-prone trick into a deterministic, auditable engineering discipline powered by `0x90` (`NOP`)-aligned **Fixed-Slot Virtual Addressing**. --- ## Purity Tiers (Declare Before Building) Always declare and honor the strictest purity tier compatible with the request: | Tier | Name | Allowed Build Path | Prohibited | | :--- | :--- | :--- | :--- | | **`DMCS-L0`** | **Pure Raw Hex (Strict)** | Hand-encoded hexadecimal machine code (`.hex`) materialized solely via raw byte converter (`xxd -r -p`, `printf`, or direct binary write). Static disassembler (`objdump`/`readelf`) allowed **only** for read-only audit. | Any programming language (C, Rust, Python, Go, JS, shell logic), any assembler (`as`, `nasm`, `fasm`), any linker (`ld`), any script generating code or patching offsets. | | **`DMCS-L1`** | **Audited Raw Hex** | Same as `L0`, plus declarative human-readable annotated map (`.disasm.txt` / `.map.md`) and deterministic SHA-256 manifest. | Same as `L0`. | | **`DMCS-L2`** | **W^X Hardened Raw Hex** | Same as `L1`, using dual `PT_LOAD` segments (`PF_R\|PF_X` code page + `PF_R\|PF_W` data/BSS page) so no memory page is simultaneously writable and executable. | Same as `L0`. | | **`DMCS-L3`** | **Bootstrapped / Multi-Page** | `L0–L2` raw machine-code core paired with declarative binary asset blobs (bitmaps, audio tables, shaders, lookup tables) concatenated directly into segments. | Still zero compilers, assemblers, or dynamic libraries. | > **Rule of Honesty:** Never secretly compile C/Assembly and dump its bytes while claiming `DMCS-L0`–`L3`. Every instruction byte must be authored directly in machine code and audited via disassembly. --- ## 6-Phase Execution Protocol Follow these six phases in strict order for **any** application class (GUI, CLI, TUI, network server, DSP/audio, system daemon, game, embedded): ### Phase 0 — Target Environment Fingerprinting Never assume ISA, OS, display server, auth model, or keymap. Probe the exact execution host first. - Read [references/ENV-DISCOVERY.md](./references/ENV-DISCOVERY.md) for the exact discovery commands. - Capture: 1. **CPU & Endianness** (`x86_64`, `aarch64`, `riscv64`, little/big endian, available extensions). 2. **OS & Binary Format** (Linux ELF64, BSD ELF64, Windows PE32+, macOS Mach-O). 3. **I/O Substrate** (X11/Xwayland socket & auth state, Wayland `wl_shm`/`xdg_shell`, `/dev/fb0`, TTY, raw TCP/UDP/Unix sockets, ALSA/PipeWire). 4. **Window Manager & Input Quirks** (e.g., Hyprland/Sway auto-tiling requiring `WM_NORMAL_HINTS`, locale keyboard layout such as `es`/`us`/`de`). 5. **Audit & Materialization Tools** (`xxd`, `readelf`, `objdump`, `strace`, `grim`/`scrot`, `xdotool`). ### Phase 1 — Fixed-Slot Virtual Address Architecture Before emitting a single opcode, lock a **Fixed-Slot Virtual Address Map** so editing one function never shifts any other function or data address. - Read [references/FIXED-SLOT-ABI.md](./references/FIXED-SLOT-ABI.md). - Partition the binary into aligned slots (e.g., `0x400000` base, header `0x000..0x07F`, syscall helpers `0x080`, `_start` `0x100`, event/main loop, logic modules, renderer, read-only tables `0xC00+`, zero-initialized `.bss` `0x402000+`). - Dedicate one callee-saved register (e.g., `r15` on `x86_64`, `x28` on `aarch64`) as the permanent `.bss` state pointer so every global field is a short `[base + disp8]` access. - Define exact register-clobber contracts for every internal routine before encoding. ### Phase 2 — Byte-Exact Machine Code Emission Encode each slot directly into a plain hexadecimal file (`.hex`), padding unused tail bytes of each code slot with `90` (`NOP` on `x86_64`) or `1f2003d5` (`NOP` on `aarch64`), and data slots with `00`. - Consult [references/ELF64-X86_64-SPEC.md](./references/ELF64-X86_64-SPEC.md) for ELF headers, syscall numbers, opcodes, and encoding pitfalls. - Consult [references/GRAPHICS-SUBSTRATES.md](./references/GRAPHICS-SUBSTRATES.md) for direct X11, Wayland, framebuffer, TTY, and socket wire protocols. - Always compute exact branch displacements (`rel = target - next_ip`) and verify zero integer/division traps (`#DE` guards before `idiv`, bounds checks before buffer writes). ### Phase 3 — Zero-Language Materialization Convert `.hex` directly into the executable binary: ```bash rm -f ./app xxd -r -p app.hex app chmod +x app ``` - **Always `rm -f` (or write to a temp file and `mv`) before replacing a running binary** to avoid Linux `ETXTBSY`. - Verify exact byte length matches `p_filesz` (`wc -c app`). ### Phase 4 — Static Disassembly & Zero-Trust Audit Before running the binary, inspect **every single instruction and header**: ```bash file app ldd app # Must confirm: not a dynamic executable readelf -h -l app # Verify entry point, p_filesz, p_memsz, flags objdump -D -b binary -m i386:x86-64 -M intel \ --adjust-vma=0x400000 --start-address=0x400080 --stop-address=0x400c00 app | grep -v 'nop$' ``` - Verify **zero** `(bad)` decodings, **zero** unintended jump targets, **exact** `call` destinations, and **exact** `.rodata` addresses (`xxd -s app`). - Fix all encoding defects in `.hex` and re-audit until 100% clean. ### Phase 5 — Live End-to-End Verification & Evidence A binary that merely starts is not verified. Prove real behavior on the live target: - For **GUI apps**: launch on the real display, verify window geometry/state (e.g., `hyprctl clients` / `xwininfo`), drive real pointer + keyboard interactions (`xdotool` / `ydotool`), capture live screenshots (`grim` / `scrot`), and visually inspect every state (normal, edge cases, error handling, clean exit). - For **CLI/Network/System apps**: test live syscalls (`strace`), protocol exchanges (`curl`/`nc`), error paths, EOF handling, and clean exit codes. - Record SHA-256 checksums, exact file size, RSS footprint, and reproducible audit commands per [references/HUMAN-AUDIT-PROTOCOL.md](./references/HUMAN-AUDIT-PROTOCOL.md). --- ## Reference Library (Load On Demand) | Document | Purpose | | :--- | :--- | | [references/MANUAL.md](./references/MANUAL.md) | Master architectural manual (human + AI): paradigm, possibilities beyond calculators, scaling patterns, limits, and standard compliance. | | [references/ENV-DISCOVERY.md](./references/ENV-DISCOVERY.md) | Target host fingerprinting matrix (ISA, OS, X11/Wayland/FB/TTY/Audio/Net, WM quirks, keymaps). | | [references/FIXED-SLOT-ABI.md](./references/FIXED-SLOT-ABI.md) | Fixed-Slot Virtual Address Architecture specification (`L0`–`L2`, `W^X` layout, register ABI, cross-ISA portability). | | [references/ELF64-X86_64-SPEC.md](./references/ELF64-X86_64-SPEC.md) | Byte-exact ELF64 headers (`RWX` & `W^X`), Linux syscall numbers, x86-64 opcode reference, and real-world encoding traps. | | [references/GRAPHICS-SUBSTRATES.md](./references/GRAPHICS-SUBSTRATES.md) | Direct binary wire protocols: X11/Xwayland (`PutImage`), Wayland (`wl_shm` + `xdg_shell`), `/dev/fb0`, ANSI TTY, TCP/HTTP. | | [references/HUMAN-AUDIT-PROTOCOL.md](./references/HUMAN-AUDIT-PROTOCOL.md) | Independent human & automated verification checklist to prove purity, safety, and reproducibility. | ## Reference Implementations - [examples/nopray3d-x86_64-cachyos/README.md](./examples/nopray3d-x86_64-cachyos/README.md) — **Reference #002 (`DMCS-L2` W^X Hardened):** Real-time 60 FPS `640×360` 3D first-person raycasting engine (`SSE2` + `x87 fsincos`, 5 procedural textured/animated materials, distance fog, live 2D color minimap, WASD + autopilot tour) in **8,192 bytes** with dual `R-X`/`RW-` segments and zero libraries. - [examples/calc-x86_64-cachyos/README.md](./examples/calc-x86_64-cachyos/README.md) — **Reference #001 (`DMCS-L1` Single-Page):** Complete, live-verified **4,096-byte (1-page) graphical desktop calculator** running natively on CachyOS + Hyprland/Xwayland, with verbatim `.hex`, full disassembly, and 7 visual verification captures.