Skip to content

quantum-encoding/quantum-zig-forge

Repository files navigation

Quantum Zig Forge

A monorepo of production-grade Zig programs and libraries developed by QUANTUM ENCODING LTD.

Structure

quantum-zig-forge/
├── programs/             # Standalone programs
│   ├── zig_ai/           # Universal AI CLI (Claude, DeepSeek, Gemini, Grok, Vertex)
│   ├── http_sentinel/    # Production HTTP client library with AI providers
│   ├── quantum_curl/     # High-velocity HTTP router [PREMIER]
│   ├── guardian_shield/  # Multi-layered Linux security framework
│   ├── chronos_engine/   # Sovereign Clock temporal tracking system
│   ├── zig_jail/         # Kernel-enforced syscall sandbox
│   ├── zig_port_scanner/ # High-performance TCP port scanner
│   ├── duck_agent_scribe/ # Eternal accountability logging for AI agents
│   ├── duck_cache_scribe/ # Automated git commit/push daemon
│   ├── cognitive_telemetry_kit/ # AI cognitive state monitoring toolkit
│   ├── stratum_engine_claude/ # High-frequency Stratum mining engine (Claude)
│   ├── stratum_engine_grok/ # io_uring Stratum mining engine (Grok)
│   ├── timeseries_db/       # High-performance columnar time series database
│   ├── market_data_parser/  # Zero-copy exchange market data parser
│   ├── financial_engine/    # HFT trading system with Alpaca integration
│   ├── async_scheduler/     # Work-stealing async task scheduler
│   ├── zero_copy_net/       # io_uring zero-copy network stack
│   ├── simd_crypto/         # SIMD-accelerated cryptographic primitives [STUBBED]
│   ├── memory_pool/         # Fixed-size memory pool allocator [WIP]
│   ├── lockfree_queue/      # Lock-free SPSC/MPMC queues [WIP]
│   ├── distributed_kv/      # Raft-based distributed key-value store
│   ├── zig_pdf_engine/      # PDF generation and parsing library
│   ├── zig_pdf_generator/   # Cross-platform PDF library with C FFI
│   ├── zig_charts/          # SVG charting library (candlestick, line, bar, sparkline)
│   ├── wasm_runtime/        # WebAssembly interpreter/runtime
│   ├── zig_dns_server/      # Authoritative DNS server
│   ├── zig_reverse_proxy/   # HTTP reverse proxy with load balancing
│   ├── warp_gate/           # P2P file transfer (NAT traversal, encrypted)
│   ├── terminal_mux/        # Terminal multiplexer (tmux alternative)
│   └── zig_core_utils/      # High-performance GNU coreutils replacements
├── libs/                 # Shared libraries
├── docs/                 # Monorepo-wide documentation
├── tests/                # Integration tests
├── scripts/              # Build and utility scripts
├── zig-out/              # Centralized build output
│   ├── bin/              # All program binaries
│   └── lib/              # Shared libraries
└── build.zig             # Root build orchestrator

Building

Build Everything

zig build

All binaries will be placed in zig-out/bin/ at the repository root.

Build Specific Programs

zig build zig_ai
zig build http_sentinel
zig build quantum_curl
zig build guardian_shield
zig build chronos_engine
zig build zig_jail
zig build zig_port_scanner
zig build duck_agent_scribe
zig build duck_cache_scribe
zig build cognitive_telemetry_kit
zig build stratum_engine_claude
zig build stratum_engine_grok
zig build timeseries_db
zig build market_data_parser
zig build financial_engine
zig build async_scheduler
zig build zero_copy_net
zig build simd_crypto
zig build memory_pool
zig build lockfree_queue
zig build distributed_kv
zig build zig_pdf_engine
zig build zig_pdf_generator
zig build zig_pdf_generator_wasm  # WebAssembly module for edge deployment
zig build zig_charts
zig build wasm_runtime
zig build zig_dns_server
zig build zig_reverse_proxy
zig build warp_gate
zig build terminal_mux

# Build individual zig_core_utils utilities
cd programs/zig_core_utils/zfind && zig build -Doptimize=ReleaseFast
cd programs/zig_core_utils/zgrep && zig build -Doptimize=ReleaseFast
# ... etc for each utility

Build All Programs

zig build all

Testing

Run all tests across the monorepo:

zig build test

Cleaning

Remove all build artifacts:

zig build clean

Programs

zig_ai

Universal AI Providers CLI Tool

Command-line interface for interacting with multiple AI providers: Claude, DeepSeek, Gemini, Grok, and Vertex AI.

Features:

  • One-shot queries and interactive mode
  • Batch processing with CSV input/output
  • Cost estimation based on actual model pricing
  • Conversation context tracking
  • Configurable temperature and max tokens

Quick Start:

# One-shot query
zig-ai deepseek "What is Zig?"
zig-ai claude --temperature 0.5 "Explain async"

# Interactive mode
zig-ai --interactive gemini

# Batch processing
zig-ai --batch prompts.csv --output results.csv --concurrency 50

# List providers
zig-ai --list

Environment Variables:

  • ANTHROPIC_API_KEY - Claude
  • DEEPSEEK_API_KEY - DeepSeek
  • GOOGLE_GENAI_API_KEY - Gemini
  • XAI_API_KEY - Grok
  • VERTEX_PROJECT_ID - Vertex AI

Documentation: programs/zig_ai/README.md

Binary: zig-ai


http_sentinel

A production-grade HTTP client library for Zig 0.16.0+, built on std.Io.Threaded architecture. Provides AI provider clients and the core HTTP infrastructure.

Features:

  • Thread-safe concurrent HTTP operations
  • Client-per-worker pattern for zero contention
  • Automatic GZIP decompression
  • Full HTTP method support (GET, POST, PUT, PATCH, DELETE, HEAD)
  • AI provider clients (Claude, DeepSeek, Gemini, Grok, Vertex)
  • Production-tested in high-frequency trading systems

Documentation: programs/http_sentinel/README.md

Binaries:

  • Multiple examples and demos

quantum_curl (Premier Strategic Asset)

High-Velocity Command-Driven Router for Microservice Orchestration

Quantum Curl is not a curl clone. It is a strategic weapon designed for the orchestration and stress-testing of complex microservice architectures. The core innovation: decoupling the Battle Plan (JSONL manifest) from the Execution Engine (high-concurrency Zig runtime).

Performance:

Metric Value Comparison
Routing Latency ~2ms p99 5-7x lower than nginx
Concurrency Thread-per-request Zero contention
Memory Client-per-worker No shared state

Strategic Applications:

  • Service Mesh Router: Decentralized, high-velocity inter-service communication
  • Resilience Testing: Native retry/backoff imposes discipline on flaky services
  • Stress Testing: Find breaking points under realistic concurrent load
  • API Test Suites: Batch execution with full telemetry

Quick Start:

# Process from stdin
echo '{"id":"1","method":"GET","url":"https://httpbin.org/get"}' | quantum-curl

# Process from file with high concurrency
quantum-curl --file battle-plan.jsonl --concurrency 100

Documentation: programs/quantum_curl/README.md

Binary: quantum-curl


guardian_shield

Multi-layered Linux security framework implementing the "Chimera Protocol" with defense-in-depth strategy.

Features:

  • User-space protection via LD_PRELOAD syscall interception (libwarden.so)
  • Kernel-space execution control via LSM BPF (zig-sentinel)
  • Fork bomb prevention (libwarden-fork.so)
  • eBPF-based system monitoring and anomaly detection
  • Multi-dimensional threat detection (crypto mining, gaming cheats, etc.)
  • Cognitive state tracking via Chronos Engine
  • Production-tested Linux security

Documentation: programs/guardian_shield/README.md

Binaries:

  • zig-sentinel - eBPF system monitor
  • conductor-daemon - Strategic command daemon
  • chronos-stamp-cognitive-direct - Cognitive state tracker
  • hardware-detector - System capability detection
  • adaptive-pattern-loader - Adaptive threat pattern loading
  • Test harnesses: test-inquisitor, test-oracle-advanced, test-conductor-daemon

Libraries:

  • libwarden.so - Filesystem protection library
  • libwarden-fork.so - Fork bomb protection library

chronos_engine

Sovereign Clock temporal tracking system with Phi-synchronized timestamps and cognitive state monitoring.

Features:

  • Monotonic tick counter independent of wall clock
  • PHI-synchronized timestamp generation for distributed systems
  • D-Bus interface for system-wide time coordination
  • Cognitive state tracking for AI agent monitoring
  • Real-time metrics aggregation with rolling time windows
  • SVG visualization of cognitive state timelines
  • Integration with Claude Code for development workflow tracking

Documentation: programs/chronos_engine/README.md

Binaries:

  • chronosd - Chronos daemon with D-Bus service
  • chronos-stamp - CLI timestamp generation tool
  • chronos-stamp-cognitive - Cognitive-aware timestamp tool
  • chronos-stamp-cognitive-direct - Direct cognitive state integration
  • cognitive-watcher - Real-time AI process monitoring
  • chronos-logger-simple - Simplified logging interface
  • test-phi-timestamp - PHI timestamp validation
  • test-cognitive-states - Cognitive state machine tests
  • test-cognitive-metrics - Metrics system validation
  • Multiple example tools and visualizers

zig_jail

Kernel-enforced syscall sandbox using seccomp-BPF, Linux namespaces, and capabilities for secure process isolation.

Features:

  • Seccomp-BPF filtering with kernel-enforced syscall whitelist/blacklist
  • Linux namespace isolation (PID, mount, network, IPC)
  • Capability dropping for privilege restriction
  • Profile-based security configurations (minimal, python-safe, node-safe, shell-readonly)
  • Bind mount support with read-only options
  • Defense-in-depth security architecture

Documentation: programs/zig_jail/README.md

Binaries:

  • zig-jail - Syscall sandbox CLI

zig_port_scanner

High-performance, multi-threaded TCP port scanner for network security monitoring and AI agent activity detection.

Features:

  • Multi-threaded concurrent scanning (up to 100 threads)
  • Order-independent argument parsing
  • Non-blocking I/O with poll() for efficient connection testing
  • Service detection for common protocols
  • Flexible port ranges (single, ranges, comma-separated lists)
  • Configurable connection timeout
  • Real-time verbose mode and closed port reporting
  • Comprehensive error handling and input validation

Documentation: programs/zig_port_scanner/README.md

Binaries:

  • zig-port-scanner - TCP port scanner CLI

Use Cases:

  • Baseline network activity monitoring
  • Detection of unauthorized network connections from AI agents
  • Identification of reverse shells and data exfiltration attempts
  • Security auditing and vulnerability assessment

duck_agent_scribe

Eternal accountability logging system for spawned AI agents with full lifecycle tracking.

Features:

  • Agent initialization with chronos tick timestamps
  • Turn-by-turn logging with 4th-dimensional timestamps
  • Completion tracking with status, turns taken, and tokens used
  • Batch manifest management for multi-agent orchestration
  • Retry lineage tracking for failed agent attempts
  • JSON-based manifest storage for each agent run

Documentation: programs/duck_agent_scribe/README.md

Binaries:

  • duckagent-scribe - Agent accountability CLI

Commands:

  • init - Initialize eternal log for new agent
  • log - Log agent turn/action
  • complete - Mark agent completion
  • batch-complete - Finalize batch manifest
  • query - Query agent logs
  • lineage - Show retry lineage

duck_cache_scribe

Automated git commit/push daemon for continuous repository synchronization with chronos timestamps.

Features:

  • inotify-based file change detection
  • Debounced commits to prevent commit storms
  • Chronos-stamp integration for 4th-dimensional commit messages
  • Automatic push after configurable commit threshold
  • Exponential backoff retry for network failures
  • JSON configuration for repository settings
  • Systemd service integration

Documentation: programs/duck_cache_scribe/README.md

Binaries:

  • duckcache-scribe - Git sync daemon

Configuration:

  • repo_path - Target repository path
  • remote_name - Git remote name
  • branch_name - Branch to push
  • chronos_stamp_path - Path to chronos-stamp binary
  • agent_id - Agent identifier for commits
  • debounce_ms - Debounce interval in milliseconds

cognitive_telemetry_kit

Comprehensive toolkit for monitoring AI agent cognitive states with real-time telemetry and analytics.

Components:

  • chronos-hook - Claude Code hook for automatic chronos timestamps on tool completions
  • cognitive-state-server - D-Bus server with SQLite-backed cognitive state cache
  • cognitive-tools - Analytics and export utilities for cognitive telemetry data

Features:

  • Real-time cognitive state tracking via inotify file watching
  • D-Bus interface for system-wide state queries
  • SQLite persistence with in-memory caching
  • CSV export for external analysis
  • Confidence scoring and pattern detection
  • Claude Code integration via hooks

Documentation: programs/cognitive_telemetry_kit/README.md

Binaries:

  • chronos-hook - Git commit hook with cognitive state injection
  • cognitive-state-server - In-memory state oracle daemon
  • cognitive-export - CSV export tool
  • cognitive-stats - Analytics and statistics
  • cognitive-query - Advanced state search
  • cognitive-confidence - Code quality confidence analyzer

Dependencies:

  • SQLite3
  • D-Bus
  • libbpf (for eBPF components)

stratum_engine_claude

High-frequency Stratum mining engine with SIMD-optimized SHA256, mempool monitoring, and exchange execution.

Features:

  • SIMD-optimized SHA256d hashing (AVX2/AVX-512 support)
  • Stratum V1 protocol implementation for mining pools
  • Real-time Bitcoin P2P mempool monitoring
  • mbedTLS-based secure exchange connections
  • WebSocket-over-TLS for live market data
  • High-frequency execution engine for trading
  • Real-time mining and mempool dashboard

Documentation: programs/stratum_engine_claude/README.md

Binaries:

  • stratum-engine - Main mining engine
  • stratum-engine-dashboard - Real-time mining + mempool dashboard
  • bench-sha256 - SHA256 performance benchmarks
  • test-mempool - Bitcoin P2P mempool connection test
  • test-execution-engine - High-frequency execution test
  • test-tls - TLS/exchange connection test
  • test-exchange-client - WebSocket exchange client test

Dependencies:

  • mbedTLS (TLS support for exchange connections)

stratum_engine_grok

Alternative Stratum mining engine using Linux io_uring for high-performance async I/O.

Features:

  • Linux io_uring for zero-copy async networking
  • Native SHA256d hashing implementation
  • Stratum V1 protocol client
  • JSON-RPC message parsing
  • Efficient buffer management with ring buffers

Documentation: programs/stratum_engine_grok/README.md

Binaries:

  • stratum-engine-grok - io_uring-based Stratum mining client

Requirements:

  • Linux kernel 5.1+ (io_uring support)

timeseries_db

High-performance columnar time series database optimized for OHLCV (candlestick) market data.

Features:

  • mmap-based zero-copy reads for 10M+ reads/second
  • Columnar storage format for efficient compression
  • SIMD-accelerated delta encoding (AVX2/AVX-512)
  • B-tree indexing for O(log N) time-range queries
  • Delta + bit-packing compression (87.5%+ reduction)
  • Lock-free concurrent reads

Documentation: programs/timeseries_db/README.md

Binaries:

  • tsdb - Time series database CLI

Commands:

  • write <symbol> <csv_file> - Import candles from CSV
  • query <symbol> <start> <end> - Query time range
  • info <symbol> - Show database info
  • benchmark - Run performance benchmarks

market_data_parser

Zero-copy parsing of exchange market data feeds at wire speed.

Features:

  • SIMD-accelerated JSON parsing (AVX2/AVX-512)
  • Zero-copy field extraction for sub-microsecond latency
  • Cache-line aligned lock-free order book
  • 2M+ messages/second throughput
  • Support for Binance, Coinbase WebSocket protocols

Documentation: programs/market_data_parser/README.md

Binaries:

  • bench-parser - Parser performance benchmarks
  • example-binance - Binance protocol example

Performance:

  • Simple message: ~96ns/msg (10.4M msg/sec)
  • Binance depth: ~189ns/msg (5.3M msg/sec)
  • ~50x faster than Python (ujson)
  • ~3x faster than C++ (RapidJSON)

financial_engine

High-frequency trading system ("The Great Synapse") combining Zig's ultra-low latency processing with Go's networking capabilities for Alpaca API integration.

Features:

  • Sub-microsecond latency HFT engine
  • Lock-free order book implementation
  • Custom zero-GC memory pools
  • Fixed-point decimal arithmetic
  • Alpaca paper/live trading integration
  • Go bridge for network layer (CGO)
  • Real-time market data processing

Documentation: programs/financial_engine/README.md

Zig Binaries:

  • zig-financial-engine - Main trading engine
  • hft-system - HFT system with strategy engine
  • live-trading - Live trading system
  • real-hft-system - Real HFT with Alpaca WebSocket
  • trading-api-test - Alpaca trading API test

Note: Go components require separate build with CGO_ENABLED=1 go build in the go-bridge/ directory.

Dependencies:

  • libzmq (ZeroMQ for IPC)
  • libwebsockets (for real-hft-system)

async_scheduler

Work-stealing async task scheduler for concurrent Zig applications.

Features:

  • Chase-Lev work-stealing deque (lock-free)
  • Thread pool management
  • Task priorities and handles
  • Async/await-style task completion
  • Zero-allocation fast path (target)

Documentation: programs/async_scheduler/README.md

Binaries:

  • bench-scheduler - Scheduler performance benchmarks

Status: Work in progress - core components implemented, performance optimization needed.

zero_copy_net

io_uring-based zero-copy network stack for ultra-low latency networking.

Features:

  • io_uring integration via std.os.linux.IoUring
  • Lock-free buffer pool with page-aligned buffers
  • TCP server with callback-based API
  • Connection tracking with HashMap
  • Zero-copy data path design

Documentation: programs/zero_copy_net/README.md

Binaries:

  • tcp-echo - TCP echo server example

Status: TCP server compiles and ready for testing. UDP socket needs rewrite.

Requirements:

  • Linux kernel 5.1+ (io_uring support)

simd_crypto

SIMD-accelerated cryptographic primitives for high-performance applications.

Features:

  • SHA256 with AVX2/AVX-512 acceleration (planned)
  • AES-NI support (planned)
  • ChaCha20 SIMD implementation (planned)

Documentation: programs/simd_crypto/README.md

Status: STUBBED - Function signatures defined, implementations return placeholder values. Ready for implementation.

memory_pool

Fixed-size memory pool allocator for predictable, ultra-low latency allocations.

Features:

  • O(1) allocation/deallocation via free-list
  • <10ns allocation, <5ns deallocation (target)
  • Fixed object sizes for cache-friendly access
  • Zero fragmentation

Documentation: programs/memory_pool/README.md

Status: Work in progress - Core pool implementation complete, needs benchmarks and additional pool types.

lockfree_queue

Lock-free SPSC (Single Producer Single Consumer) and MPMC (Multi Producer Multi Consumer) queues.

Features:

  • SPSC queue with cache-line padding
  • MPMC queue with atomic operations
  • Wait-free fast path for producers
  • Bounded capacity for predictable memory usage

Documentation: programs/lockfree_queue/README.md

Status: Work in progress - SPSC queue complete, MPMC queue implemented.

distributed_kv

Raft-based distributed key-value store with strong consistency guarantees.

Features:

  • Raft consensus algorithm for leader election and log replication
  • Persistent Write-Ahead Log (WAL) with CRC32 checksums and crash recovery
  • TTL support for key expiration
  • Compare-and-swap (CAS) atomic operations
  • Watch/subscribe for key change notifications
  • TCP-based RPC for cluster communication
  • Client library with automatic failover

Documentation: programs/distributed_kv/README.md

Binaries:

  • kv-server - Distributed KV node server
  • kv-client - Command-line client tool

Usage:

# Start a 3-node cluster
kv-server --id 1 --port 8000 --peer 2=127.0.0.1:8001 --peer 3=127.0.0.1:8002
kv-server --id 2 --port 8001 --peer 1=127.0.0.1:8000 --peer 3=127.0.0.1:8002
kv-server --id 3 --port 8002 --peer 1=127.0.0.1:8000 --peer 2=127.0.0.1:8001

# Client operations
kv-client --server 127.0.0.1:8000 set mykey "myvalue"
kv-client --server 127.0.0.1:8000 get mykey

zig_pdf_engine

PDF generation and parsing library with zero external dependencies.

Features:

  • PDF 1.7 specification compliant generation
  • Text rendering with built-in fonts (Helvetica, Times, Courier)
  • Vector graphics (lines, rectangles, circles, Bézier curves)
  • Color support (RGB, CMYK, grayscale)
  • Image embedding (JPEG, PNG with zlib compression)
  • PDF parsing and text extraction
  • Multi-page document support
  • Page templates and reusable content

Documentation: programs/zig_pdf_engine/README.md

Binaries:

  • pdf-gen - PDF generation CLI
  • pdf-info - PDF metadata extraction
  • pdf-text - PDF text extraction

zig_pdf_generator

Cross-platform PDF generation library with C FFI and WebAssembly support for mobile, embedded, and edge deployment.

Features:

  • High-performance PDF generation library
  • WebAssembly (WASM) build for edge deployment (Cloudflare Workers, Deno, Node.js)
  • C FFI exports for JNI/FFI integration
  • Static and shared library builds
  • Cross-compilation support (Android ARM64/ARMv7, iOS ARM64, macOS, Windows, WASM)
  • Zero external dependencies in core

Document Types:

  • Invoices - Business invoices with line items, tax calculations
  • Dividend Vouchers - UK and Irish with DWT (25% withholding tax) support
  • Share Certificates - Company share certificates
  • Contracts - Legal contracts with parties, sections, signatures
  • Board Resolutions - Corporate board resolutions
  • Stock Transfer Forms - Share transfer documentation
  • Director Documents - Consent, appointment, resignation letters
  • Written Resolutions - Shareholder written resolutions

Edge Deployment Examples:

Platform Example Features
Cloudflare Workers examples/cloudflare-worker.js Stripe webhook, minimal WASI
Firebase Functions examples/firebase-function.js Firestore triggers, Cloud Storage
Google Cloud Functions examples/gcloud-function.js Pub/Sub, Storage triggers
Deno Deploy examples/deno-deploy.ts TypeScript, zero cold-start
AWS Lambda examples/aws-lambda.js SQS, S3, EventBridge triggers
Node.js examples/node-test.mjs Local testing with native WASI

Documentation: programs/zig_pdf_generator/README.md

Binaries:

  • pdf-gen - PDF generation CLI
  • libzigpdf.a - Static library
  • libzigpdf.so - Shared library for FFI
  • zigpdf.wasm - WebAssembly module (362KB)

Build Targets:

# Native build
zig build

# WebAssembly for edge deployment
zig build wasm
# Output: zig-out/lib/zigpdf.wasm

# Android ARM64 cross-compile
zig build android

# Shared library for JNI
zig build shared

WASM Usage (JavaScript):

const pdfBytes = generatePdf(exports, 'zigpdf_generate_invoice', {
  invoice_number: "INV-001",
  company_name: "Acme Corp",
  items: [{ description: "Service", quantity: 1, unit_price: 100, total: 100 }],
  total: 100
});

zig_charts

High-performance SVG charting library for financial and general data visualization.

Features:

  • SVG Output - Text-based, easy to test, diff, and embed in HTML/PDF
  • Financial Charts - OHLCV candlestick charts with volume bars
  • Line Charts - Multi-series with legend, area fills, dashed lines
  • Bar Charts - Grouped/stacked with value labels
  • Sparklines - Compact inline charts (line, bar, win/loss)
  • Scales - Linear, logarithmic, time, and band scales
  • Axis Generation - Nice tick values with automatic formatting

Chart Types:

Type Description Features
Candlestick OHLCV financial charts Volume bars, bull/bear coloring
Line Multi-series line charts Legend, area fills, markers
Bar Grouped bar charts Value labels, custom colors
Sparkline Compact inline charts Line, bar, win/loss variants

Documentation: programs/zig_charts/README.md

Binaries:

  • chart-demo - Demo CLI generating sample charts

Usage:

# Generate all demo charts to /tmp/
chart-demo

# Generate specific chart type
chart-demo candlestick
chart-demo line
chart-demo bar
chart-demo sparkline

# Output to custom directory
chart-demo --output ./my-charts

Library Usage (Zig):

const charts = @import("zigcharts");

// Create candlestick chart
var svg = charts.SvgCanvas.init(allocator, 800, 400);
defer svg.deinit();

const layout = charts.Layout{ .width = 800, .height = 400 };
var chart = charts.CandlestickChart.init(allocator, candles, layout, .{
    .show_volume = true,
});
try chart.render(svg.canvas());

const output = try svg.canvas().finish();
// output is valid SVG string

Generated Output:

  • /tmp/chart-candlestick.svg - 30-day OHLCV with volume
  • /tmp/chart-line.svg - Revenue vs Expenses (12 months)
  • /tmp/chart-bar.svg - Quarterly comparison
  • /tmp/chart-sparklines.svg - Line, bar, win/loss sparklines

wasm_runtime

WebAssembly interpreter/runtime with full WASI support.

Features:

  • WebAssembly MVP specification compliant
  • WASI preview1 system interface
  • Stack-based virtual machine
  • Memory management with bounds checking
  • Import/export resolution
  • Multi-module linking
  • Trap handling and debugging support

Documentation: programs/wasm_runtime/README.md

Binaries:

  • wasm - WebAssembly runtime CLI (wasm run, wasm info, wasm validate)

zig_dns_server

Authoritative DNS server with zone file support.

Features:

  • RFC 1035 compliant DNS protocol
  • Zone file parsing (BIND format)
  • Support for A, AAAA, CNAME, MX, NS, TXT, SOA records
  • UDP and TCP transport
  • Query logging and statistics
  • Configurable TTL and caching

Documentation: programs/zig_dns_server/README.md

Binaries:

  • dns-server - Authoritative DNS server

Usage:

dns-server -z zones/example.com.zone -p 5353
dig @127.0.0.1 -p 5353 example.com A

zig_reverse_proxy

HTTP reverse proxy with load balancing and health checking.

Features:

  • Round-robin and least-connections load balancing
  • Active health checking with configurable intervals
  • Connection pooling to backends
  • Request/response header manipulation
  • Access logging with timing metrics
  • Graceful shutdown and hot reload
  • WebSocket proxying support

Documentation: programs/zig_reverse_proxy/README.md

Binaries:

  • reverse-proxy - HTTP reverse proxy server

warp_gate

Peer-to-peer file transfer without cloud intermediaries.

Features:

  • No cloud servers - Direct device-to-device transfer
  • NAT traversal via STUN/UDP hole punching
  • Local discovery via mDNS (instant on same LAN)
  • ChaCha20-Poly1305 AEAD encryption
  • Human-readable transfer codes (e.g., warp-729-alpha)
  • BLAKE3 integrity checksums
  • Cross-platform (Linux, macOS, Windows)

Documentation: programs/warp_gate/README.md

Binaries:

  • warp - P2P file transfer CLI

Usage:

# Send files
warp send ./my-project
# Shows: Transfer code: warp-729-alpha

# Receive files
warp recv warp-729-alpha

# Check network status
warp status

Performance:

Operation Throughput
Code generation 5.2M ops/sec
Code parsing 8.1M ops/sec
Encryption (64KB) 1500 MB/s

terminal_mux

Terminal multiplexer (tmux alternative) with native Zig configuration.

Features:

  • PTY management for shell processes
  • Session/window/pane hierarchy
  • Full VT100/ANSI terminal emulation
  • Zig-native configuration (no config file parsing)
  • Unix socket IPC for attach/detach
  • Pane splitting (horizontal/vertical)
  • 10,000 line scrollback buffer
  • UTF-8 support

Documentation: programs/terminal_mux/ARCHITECTURE.md

Binaries:

  • tmux - Terminal multiplexer

Key Bindings (Ctrl-b prefix):

  • d - Detach from session
  • c - Create new window
  • n/p - Next/previous window
  • % - Split pane horizontally
  • " - Split pane vertically
  • o - Switch to next pane

Usage:

tmux                    # Start new session or attach
tmux new -s dev         # Create named session
tmux attach -t dev      # Attach to existing session

zig_core_utils

High-performance Zig implementations of GNU coreutils (131 utilities), optimized for modern hardware with parallel processing, SIMD acceleration, and zero-copy I/O.

Feature Parity Summary:

Status Count Description
Full 72 (56%) All or nearly all GNU options implemented
Partial 47 (36%) Core functionality complete, some options missing
Basic 10 (8%) Minimal implementation

Suite of 131 Utilities by Category:

Category Count Utilities
File Operations 16 zcat, zcp, zdd, zln, zlink, zls, zmv, zrm, zrmdir, zmkdir, zmkfifo, zmknod, ztouch, ztruncate, zshred, zinstall
Text Processing 19 zawk, zcut, zfmt, zfold, zgrep, zhead, zjoin, znl, zpaste, zsed, zsort, zsplit, ztac, ztail, ztr, zuniq, zwc, zxargs
System Info/User 22 zarch, zdate, zdf, zdu, zenv, zfree, zgroups, zhostid, zhostname, zid, zlogname, znproc, zprintenv, zps, zpwd, zsys, ztty, zuname, zuptime, zusers, zwho, zwhoami
Encoding/Hashing 11 zbase32, zbase64, zbasenc, zb2sum, zcksum, zhashsum, zmd5sum, zsha1sum, zsha256sum, zsha512sum, zsum
Path/Name Utils 8 zbasename, zdirname, zpathchk, zreadlink, zrealpath, zstat, ztest, zexpr
Process/Permission 13 zchgrp, zchmod, zchown, zchroot, zkill, znice, znohup, zpgrep, zpkill, zruncon, zstdbuf, zsudo, ztimeout
Misc Utilities 22 zcomm, zcsplit, zecho, zexpand, zunexpand, zfactor, zfalse, ztrue, zmktemp, znumfmt, zod, zpr, zprintf, zptx, zseq, zshuf, zsleep, zsync, ztee, ztsort, zunlink, zyes
Extended/Custom 18 zbackup, zbench, zcurl, zfind, zgzip, zjq, zmore, zping, zregex, zstty, ztar, ztime, ztree, zuptime, zvdir, zxz, zzstd

Performance Benchmarks:

Tested on Samsung 990 EVO Pro NVMe (7400 MB/s) with 17,854 files:

Tool GNU Time Zig Time Speedup Optimization
find 21.1s 2.1s 10.2x MPMC queue + getdents64
sha256sum 0.388s 0.111s 3.5x SIMD acceleration
du ~3s ~1s ~3x Parallel traversal
tree 14ms 9ms 1.5x Buffered I/O
jq 61ms 31ms 2x Buffered I/O

SIMD-Accelerated Utilities:

  • zgrep - SIMD pattern matching
  • zwc - SIMD line/word counting
  • zregex - Thompson NFA with SIMD (ReDoS-immune)
  • zsha256sum - SIMD message schedule expansion

Parallel Execution Support:

  • zdu - --threads=N for parallel directory scanning
  • zfind - Lock-free MPMC queue for parallel traversal
  • zxargs - -P/--max-procs for parallel command execution

Extended Beyond GNU:

  • zsort - Added -R (random) and -V (version sort)
  • zrealpath - Added --relative-to and --relative-base
  • zbench - Full hyperfine-like benchmarking utility

Building:

cd programs/zig_core_utils/zfind
zig build -Doptimize=ReleaseFast

# Or build individual utilities
cd programs/zig_core_utils/zcat && zig build -Doptimize=ReleaseFast

Usage:

# Find all .zig files (10.2x faster)
zfind /path -name "*.zig"

# Random sort lines
zsort -R file.txt

# Version sort (1.2 < 1.10)
zsort -V versions.txt

# Relative path resolution
zrealpath --relative-to=/home /home/user/docs

# Fast SHA256 checksums (3.5x faster)
zsha256sum *.bin

# Parallel disk usage
zdu --threads=8 /home

Documentation: programs/zig_core_utils/README.md Feature Parity: programs/zig_core_utils/FEATURE_PARITY.md

Requirements

  • Zig Version: 0.16.0-dev.1303+ (minimum)
  • OS: Linux (required for guardian_shield, chronos_engine, zig_jail), macOS/Windows (http_sentinel)
  • Dependencies:
    • libbpf (for guardian_shield eBPF components)
    • libdbus-1 (for guardian_shield and chronos_engine D-Bus integration)
    • TLS support (for http_sentinel HTTPS)
    • Linux kernel 3.17+ with seccomp support (for zig_jail)

License

MIT License - See individual program LICENSE files for details.

Copyright 2025 QUANTUM ENCODING LTD
Website: https://quantumencoding.io
Contact: [email protected]

Adding New Programs

  1. Create program directory: programs/your-program/
  2. Add build.zig and source code
  3. Update root build.zig to include your program
  4. Update this README

Development

Each program maintains its own:

  • Source code (src/)
  • Build configuration (build.zig)
  • Documentation (README.md)
  • Examples (examples/)
  • Tests (tests/)

The root build system orchestrates building all programs and collects binaries into a single zig-out/ directory for convenience.

About

A monorepo of production-grade Zig programs and libraries developed by QUANTUM ENCODING LTD

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •