> SYSTEM_DOCS_PORTAL v4.2.1-BETA

CLI Engine Architecture Specifications

Deploy local compiled Web3 binaries, parse real-time voice transcripts with ONNX models, configure Cosine Sentiment triggers, and establish high-speed JSON pipelines.

rocket_launch 01// Getting Started

setup_guide.md

The PolyEye CLI is a specialized daemon binary that implements real-time tokenized prediction contract speculation. The system bypasses web app latency by processing audio streams, executing local sentiment calculations using compiled tensor parameters, and dispatching trades through direct Polygon mainnet RPC node connections.

>_ DSP AUDIO STREAM DECODER PROTOCOL

VAD ENGINE: Silero VAD (Voice Activity Detection) ONNX Classifier

SAMPLING PRESET: Single-channel (Mono) Float32 linear PCM at 16,000Hz

VAD WINDOW SIZE: 30ms (480 samples per frame evaluation block)

TRIGGER LOGIC: Starts speech buffering when voice probability Pr(Speech) ≥ 0.82. Speech block halts when voice probability dips Pr(Speech) < 0.35 for 15 consecutive frames.

When the speech chunk ends, the system processes text tokens via a local BERT-based WordPiece tokenizer (vocabulary array of 30,522 keys) and converts transcripts into 1536-dimensional dense embedding vectors inside a local ONNX runtime thread.

System Prerequisites

  • Node.js Environment: Active Node runtime (version v18.16.0 or higher LTS recommended).
  • ONNX Support: Local execution of ONNX Runtime models requires WebAssembly dependencies (`onnxruntime-web`).
  • Web3 Connection: Access credentials to a Polygon Mainnet RPC URL (e.g. Alchemy, Infura, or a self-hosted geth node).
  • Collateral Wallet: Private keys with active USDC balances on Polygon for option execution, and native POL tokens for transaction gas limits.

1. Global Binary Installation

Install the package globally. This compiles the web3 client libraries and locks local binary execution path variables:

npm install -g @polyeye/cli-binary

2. Node Credentials Initialization

Execute the `init` command to generate your local wallet key repository and point your clients onto a mainnet RPC node:

polyeye init --rpc https://polygon-mainnet.g.alchemy.com/v2/demo-key --wallet 0x93b7df82e666a4f216e2578...
"Security warning on private credentials": Private key keys are encrypted locally using AES-256-GCM. The key is decoded in memory during order dispatch checks and is never shared outside your sandboxed CLI system.
03// PIPELINE_EXECUTION_FLOW_CHART
Voice Input WebSocket DSP VAD Audio segments NLP Model Vector distance Risk Gate Gas & Slippage Polygon Router Mainnet contracts
PIPELINE_SCHEMATICS_V4.2

settings_suggest 02// Configuration Details

config.json

The `config.json` configuration file is maintained locally in the daemon directory. This configuration dictates Cosine Vector similarity calculations, watchlist variables, safety gates, and dynamic gas estimation.

>_ COSINE SENTIMENT MATCHING MATHEMATICAL PROTOCOL

The system tokenizes decoded transcripts into vector arrays. Cosine Similarity between transcript embedding $T$ and watchlisted outcome semantic vector $C$ is computed as:

$\text{Cosine Similarity} = \frac{T \cdot C}{\|T\| \|C\|} = \frac{\sum_{i=1}^{n} T_i C_i}{\sqrt{\sum_{i=1}^{n} T_i^2} \sqrt{\sum_{i=1}^{n} C_i^2}}$

TRIGGER CRITERIA: Executes automatic purchase signals if the similarity score satisfies Score ≥ 0.94 and the Sentiment Polarity index registers positive outcomes above the risk gate limits.

{
  "rpc_node": "https://polygon-mainnet.g.alchemy.com/v2/demo-key",
  "backup_rpc_nodes": [
    "https://polygon-rpc.com",
    "https://rpc-mainnet.maticvigil.com"
  ],
  "websocket_feed": "wss://speech-api.polyeye.io/stream",
  "trading_limit_usdc": 1000.0,
  "slippage_threshold": 0.02,
  "max_slippage_model": "dynamic",
  "contracts_watchlist": [
    "US_PRES_ELECTION_2026",
    "FED_RATE_CUT_2026",
    "SOL_ETF_APPROVAL_2026"
  ],
  "gas_premium_gwei": 5.0,
  "gas_premium_limit": 50.0,
  "enable_hedging": true,
  "log_level": "info"
}
Property Type Default Description
rpc_node string null Primary Polygon node provider RPC URL.
backup_rpc_nodes array [] Fallback RPC nodes checked if the primary RPC encounters latency spikes.
websocket_feed string "wss://speech-api.polyeye.io/stream" WS address used for streaming real-time speech broadcasts.
trading_limit_usdc float 100.0 Budget ceiling allocation per trigger signal order.
slippage_threshold float 0.02 Maximum allowed slippage (2%) before order abort.
max_slippage_model string "static" Calculation preset ('static' limits, or 'dynamic' matching book thickness).
contracts_watchlist array [] Short identifiers representing target outcome token ABIs.
gas_premium_gwei float 5.0 Gas surcharge added to base gas limits for fast execution blocks.
gas_premium_limit float 50.0 Maximum gas price ceiling in Gwei to prevent congestion trade errors.
enable_hedging boolean false Triggers hedge counters if vector outputs invert.
log_level string "info" Level of system outputs ("debug" | "info" | "warn" | "error").
03// DATAFLOW_MAPPING_BLUEPRINT
config.json rpc_node websocket_feed watchlist POLYEYE_CORE
SCHEMATIC_V4.2

menu_book 03// CLI Command Reference

commands_manual
polyeye init

Establishes secure transaction configurations. This commands takes your hex private key and encrypts it locally using AES-256-GCM. Derives authentication passcodes via PBKDF2 (100,000 iterations, 256-bit salt).

FlagTypeRequirementDesc
--rpcstringRequiredPolygon RPC provider node endpoint url.
--walletstringRequiredHex address string representing wallet private key.
polyeye init --rpc https://polygon-mainnet.g.alchemy.com/v2/demo --wallet 0xABCD...
polyeye run

Launches the speech-to-trade algorithmic engine daemons. Connects WebSocket speech feeds and runs concurrent thread pools mapping incoming streams.

FlagTypeDefaultDesc
--topicstring"politics"Feed channel ('politics' | 'finance' | 'custom').
--stakenumber100.0USDC stake amount allocated per contract trade trigger.
--max-slippagefloat0.02Max slippage bounds (percentage).
--vad-thresholdfloat0.82Speech activity threshold value (0.0 to 1.0).
--cosine-sim-limitfloat0.94Cosine similarity gate limits.
--hedge-ratiofloat0.50Hedge allocation ratio used during trade reversals.
--max-pending-txsinteger3Maximum parallel trade transactions allowed before lock.
--sim-audio-filestringnullRuns local audio files path for diagnostic simulations.
polyeye run --topic politics --stake 500 --max-slippage 0.015 --vad-threshold 0.85 --max-pending-txs 5
polyeye status

Outputs live indicators, connection health status, RPC block height latency stats, pending nonces, and current wallet USDC balances.

polyeye status --watch --verbose

>> [STATUS] POLYEYE ENGINE RUNNING - V4.2.1-BETA

> UPTIME: 34h 40m | THREADS: 5 ACTIVE | CPU: 4.8%

> PORTFOLIO VALUE: 244,092.12 USDC | ACCURACY: 89.4%

> ACTIVE RPC ENDPOINT: https://polygon-mainnet.g.alchemy.com (Latency: 12ms)

> LAST SIMILARITY MATCH: Cos(T, C) = 0.962 (Outcome: FED_RATE_CUT_2026 YES)

> PENDING TRANSACTION NONCES: 0 (Synced)

polyeye config

Dynamically get, set, or validate properties in `config.json` without opening text editors. Path validators verify syntax schema and RPC connection speeds before saving.

# Set budget limits
polyeye config set trading_limit_usdc 1500.0

# Set nested RPC endpoints
polyeye config set backup_rpc_nodes.0 https://polygon-rpc.com

# Query current watch list
polyeye config get contracts_watchlist

# Validate configuration structures
polyeye config validate
polyeye watchlist

Manage the prediction event contracts watchlist. Fetch outcome token details directly from Polymarket smart contract ABI routers on-chain.

# Add a contract identifier to scan
polyeye watchlist add BTC_OVER_100K

# Remove a contract key
polyeye watchlist remove US_PRES_ELECTION_2026

# List all active contracts watchlists and their on-chain mappings
polyeye watchlist list
polyeye logs

Query logs from local Sqlite `run.db` storage. Supports level queries, transaction hashes lookups, and regex searches.

# Show error logs only
polyeye logs --level error --lines 50

# Grep for specific block transaction hashes
polyeye logs --find "0x7e88"
polyeye version

Returns client compilation build targets, dependencies versions, and performs network speed handshakes.

polyeye version

lan 04// API Telemetry Reference

http://localhost:8080

The PolyEye client spawns a local HTTP telemetry server on `localhost:8080` to export runtime data and allow trigger injections for diagnostic automation workflows.

1. GET /pnl - Returns execution balance metrics
curl http://localhost:8080/pnl
{
  "status": "NOMINAL",
  "net_balance_usdc": 244092.12,
  "active_positions_count": 12,
  "gas_saved_usdc": 428.12,
  "last_trade_latency_ms": 12,
  "uptime_seconds": 124800
}
2. GET /metrics - Exposes Prometheus instrumentation statistics
curl http://localhost:8080/metrics
# HELP polyeye_balance_usdc Current USDC balance in execution wallet
# TYPE polyeye_balance_usdc gauge
polyeye_balance_usdc 244092.12
# HELP polyeye_trade_latency_ms Cosine matching and Polygon dispatch delay
# TYPE polyeye_trade_latency_ms summary
polyeye_trade_latency_ms{quantile="0.5"} 12.0
polyeye_trade_latency_ms{quantile="0.9"} 14.5
polyeye_trade_latency_ms_sum 3624.0
polyeye_trade_latency_ms_count 302
# HELP polyeye_accuracy_ratio Accuracy of resolved Yes/No options
# TYPE polyeye_accuracy_ratio gauge
polyeye_accuracy_ratio 0.894
3. POST /trigger - Manual override input inject (debugging only)

Post raw speech transcripts directly to the sentiment tokenizers. This override diagnostic bypasses audio inputs and triggers automated buy actions directly if score parameters match.

curl -X POST -H "Content-Type: application/json" -d '{"transcript":"inflation is falling down target rate", "bypass_risk": false}' http://localhost:8080/trigger
{
  "success": true,
  "cosine_similarity": 0.958,
  "sentiment_polarity": 0.981,
  "trade_triggered": true,
  "transaction_hash": "0x7e88a032d9198abf210..."
}

build 05// Troubleshooting Guide

exit_codes

Summary descriptions of exit codes and common resolution procedures.

Error: RPC_RATE_LIMIT (Exit Code: 102)

Cause: The volume of balance queries or gas estimators checks exceeded limits of your Polygon node.

Resolution: Set up fallback RPC urls in your `backup_rpc_nodes` list or increase the watch query delay limits inside settings.

Error: SLIPPAGE_EXCEEDED (Exit Code: 105)

Cause: The probability rate shifted between token embeddings checks and transaction inclusion blocks.

Resolution: Switch your `max_slippage_model` to `"dynamic"` or scale the bounds flag `--max-slippage` to `0.03`.

Error: NONCE_TOO_LOW (Exit Code: 112)

Cause: Concurrent threads dispatched trade orders simultaneously, resulting in out-of-order execution slots.

Resolution: Lower execution pools limits using `--max-pending-txs 2` or check that client nonce synchronizers are enabled.

Error: ONNX_RUNTIME_INIT_FAILED (Exit Code: 180)

Cause: Node cannot allocate webassembly buffers or C++ runtime modules are missing from the OS.

Resolution: Upgrade your system to Node 18+ or install VC++ Redistributable packages (on Windows) or `libgomp` (on Linux).

Error: WEBSOCKET_TIMEOUT (Exit Code: 201)

Cause: Audio stream socket lost network connection for over 30 seconds.

Resolution: The daemon auto-reconnects, but check internet connections and ensure firewall ports are open for outgoing websockets.