Principle:20000419 Fauxnix Harness Scaffolding Adaptation
| Knowledge Sources | |
|---|---|
| Domains | Adapter, Harness_Scaffolding, Agent_Integration |
| Last Updated | 2026-10-26 00:00 GMT |
Overview
An adaptation technique that detects a harness's private command-scaffolding (export prefix, shell options, eval 'PAYLOAD' < /dev/null, cwd marker) via captured regexes, applies the prefix and executes the payload itself, and falls through to plain translation when the pattern does not match.
Description
Harness Scaffolding Adaptation handles the private wrapper that Claude Code's Bash tool puts around every command: an export prefix (export TEMP=... TMP=...), shopt -u extglob, a shell-snapshot bootstrap, and eval 'PAYLOAD' < /dev/null && pwd -P >| marker. This scaffolding is harness plumbing, not user bash. The adapter detects it with two regexes (CC_SNAPSHOT_RE for the snapshot bootstrap, CC_COMMAND_RE for the export+eval+marker form), applies the export prefix, executes the payload via the facade session, and writes the cwd marker itself (only on success, matching bash's && chain). When neither pattern matches, it returns null so the facade falls through to plain one-shot translation. Pattern drift fails loud (visible in FAUXNIX_FACADE_TRACE), never silently wrong. The regexes were captured from a live session and dated; if the harness changes its scaffolding, the adapter must be updated.
Usage
Use this principle when a facade must interoperate with a harness that wraps commands in private scaffolding the facade cannot execute verbatim. The detect-and-adapt-with-fallthrough approach is the right choice when the scaffolding is stable enough to match but may change, requiring visible failure rather than silent misexecution.
Theoretical Basis
snap = CC_SNAPSHOT_RE.match(script)
if snap: write snapshot stub; return 0
cmd = CC_COMMAND_RE.match(script)
if not cmd: return null → fall through to plain translation
exportPart, payload, markerPosix = cmd.groups
run exportPart; if exit != 0: return exit # && chain stops
run payload; write stdout/stderr; if exit != 0: return exit
write marker (session.cwd as POSIX path); return 0