Principle:20000419 Fauxnix Persistent Host Execution
| Knowledge Sources | |
|---|---|
| Domains | Execution, Process_Management, IPC |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
An execution strategy that keeps a long-lived host process resident and communicates over a framed protocol, eliminating per-command cold-boot cost and enabling session state persistence across invocations.
Description
Persistent Host Execution solves the latency problem of spawning a fresh shell process per command. A resident process (e.g. PowerShell) is booted once and kept alive; each command is sent as a framed request and the response is read back. This reduces per-command latency from cold-boot seconds to warm-call tens of milliseconds. The host communicates over a JSON-framed, base64-encoded stdio protocol so the host's native text encoding (e.g. UTF-16LE) cannot scramble command output. The host process is started lazily or prewarmed at server startup; an invokeLock serializes calls so teardown/reset cannot interleave with an in-flight invoke.
Usage
Use this principle when a translator or executor issues many commands to the same shell and the per-spawn cold-boot cost dominates. It is the right choice for MCP servers, interactive facades, and test runners that execute hundreds of commands in a loop.
Theoretical Basis
The protocol is request-response over stdin/stdout:
[boot] → host writes "ready" handshake
[per invoke]
client → host: {"script": "...", "env": {...}, "timeoutMs": N}
host → client: {"stdoutB64": "...", "stderrB64": "...", "exitCode": N}
Base64 encoding of stdout/stderr makes the payload binary-safe regardless of the host's console encoding. A timeout enforced client-side prevents a hung host from blocking the caller indefinitely.