Skip to main content

Module subprocess

Module subprocess 

Source
Expand description

Subprocess gate plugin contract (SPEC §8.1) — the language-agnostic moat mechanism.

A gate can be any executable: a 10-line Python script, a compiled binary, bash -c '…'. The proxy speaks to it over a tiny, stable contract:

  • stdin (JSON): { "gate_id", "candidate", "request": { model, system, messages } }. The model output is passed as data on stdin, never as a command-line argument, so a malicious candidate can’t be interpreted as flags or shell (§8.3.2 injection resistance).
  • stdout (JSON): { "verdict": "pass|fail|abstain", "score"?: 0.0-1.0, "reason"?, "evidence"? }.
  • exit ≠ 0 → gate error → abstain (reason gate_crash, stderr captured).
  • timeout → the child is killed → abstain (reason timeout).

A gate never gets the API keys or anything beyond the candidate + request metadata it needs.

Structs§

SubprocessGate
A gate backed by an external process.