TraceTrial-Bench 7-Pillar Harness Reliability & Fail-Closed Stress Specification
Role: Autonomous Open-Core Software Architect
Objective: Codify the empirical 7-pillar harness reliability evaluation framework aligned with TraceTrial-Bench (arXiv:2610.32285) and harden three critical fail-closed adversarial boundary invariants across worktree isolation, statutory configuration pinning, and gate crash recovery.
1. Context & Epistemology#
Contemporary agent benchmarks evaluate model code generation in isolation while holding the orchestration harness constant. Empirical evaluation in TraceTrial-Bench (arXiv:2610.32285) demonstrates that enterprise coding agents succeed or fail across seven orthogonal harness pillars: Context, Execution, Governance, Lifecycle, Observability, Tools, and Verification.
In Nomos, prompts are advisory while the compiled Go substrate is statutory. A governance harness is only statutory if it fails closed under adversarial mutation, boundary escape attempts, and runtime probe failures:
- Worktree Boundary Escape (Law 3): An agent must be physically blocked from mutating files outside
worktrees/<repo>-<task>/or committing directly to protected trunk. - Statutory Configuration Tampering (Law 4 & Law 7): An agent inside a task worktree must be incapable of relaxing gate thresholds, disabling
strict_mode, or disablingboundary.enforcerelative to the trunk baseline (nomos.yaml). - Gate Crash / Panic Abort (Law 2 & Law 5): If any verification gate panics, errors, or fails during evaluation, the 2-Phase Commit (2PC) release engine (
nomos task sync) must deterministically recover, abort the merge transaction, emit zero cryptographic release receipts, and leave trunk (main) untouched.
2. Seven-Pillar Statutory Mapping#
| Pillar | TraceTrial-Bench Dimension | Nomos Statutory Law & Enforcement Seam |
|---|---|---|
| 1. Context | Bounded, repository-scoped orientation without cross-repo leakage | Law 1 & Law 6: SynthesizeDynamicHandshake (nomos handshake) injects repository-scoped wavefronts, directives, and verified Mneme patterns (mneme.db). |
| 2. Execution | Hermetic filesystem isolation and path-traversal confinement | Law 3: nomos hook pre-tool (worktree-guard.sh delegator) and Git pre-commit hooks reject writes outside worktrees/<repo>-<task>/ (or --hermetic-dir) and block .. traversal. |
| 3. Governance | Immutability of grading rubrics, plane separation, and config pinning | Law 4 & Law 7: PlaneSeparationGate blocks SUB-* config mutations; ThresholdIntegrityGate pins strict_mode and boundary.enforce to trunk RepoRoot. |
| 4. Lifecycle | Atomic 2PC state transitions and crash-safe abort semantics | Law 5: TimedEvaluate recovers runtime gate panics into ERR_CORE fail-closed errors; nomos task sync aborts before rebase/FF-merge on any non-zero exit. |
| 5. Observability | Cryptographic release provenance and empirical pattern distillation | Law 2: nomos task sync stamps SHA-256 receipts onto refs/notes/nomos/releases and distills verified positive-path patterns into mneme.db. |
| 6. Tools | Sanctioned toolchain wrappers and zero filesystem aliasing | Law 3 & Law 4: nomos hook pre-tool intercepts raw go install, direct sqlite3, destructive rm -rf, and unexpanded $/~ file paths; ZeroFilesystemAliasGate rejects symlinks. |
| 7. Verification | Multi-gate AST anti-shortcut enforcement (0.0% trunk defect rate) |
Law 2 & Law 4: 42 DoD gates (AntiShimGate, SecretScanGate, UncheckedErrorsGate, GateIntegrityProofGate) and nomos hook post-tool reject shortcuts fail-closed. |
3. Fail-Closed Hardening Invariants#
3.1 Trunk Statutory Baseline Pinning (ThresholdIntegrityGate)#
When nomos verify executes inside an isolated task worktree (ctx.WorktreePath != "" and filepath.Clean(ctx.WorktreePath) != filepath.Clean(ctx.RepoRoot)):
- Substrate Plane Rejection:
PlaneSeparationGaterejects any modification to rootnomos.yamlorintent/files within aSUB-*task (ERR_CROSS_PLANE_MUTATION). - Intent Plane Downgrade Rejection: Even within an
INT-*worktree permitted to edit intent/governance artifacts,ThresholdIntegrityGateloads the canonical trunk configuration fromctx.RepoRoot.- If trunk
nomos.yamlenforcesgovernance.quality_gates.strict_mode: trueand the worktreenomos.yamldowngradesstrict_mode: false,ThresholdIntegrityGatemust returnPassed: false. - If trunk
nomos.yamlenforcesgovernance.boundary.enforce: trueand the worktreenomos.yamldowngradesboundary.enforce: false,ThresholdIntegrityGatemust returnPassed: false. - Any threshold relaxation violating statutory ceilings (
max_file_loc > 400,max_func_loc > 60,max_complexity > 15,min_coverage < 50.0) continues to fail closed.
- If trunk
- Brownfield Root Compatibility: When evaluating directly on a brownfield repository root (
ctx.WorktreePath == "") where the repository owner explicitly configuredstrict_mode: falseon trunk,ThresholdIntegrityGatehonors the root baseline.
3.2 Gate Runtime Panic Recovery (TimedEvaluate)#
In substrate/src/nomos/modules/verify/gate.go, TimedEvaluate(g Gate, ctx *VerifyContext) wraps g.Evaluate(ctx) in a defer recover() boundary:
- Any runtime panic
rinside a gate probe is caught and converted into a structuredNomosError(ERR_CORE:"gate <Name> panicked during evaluation (fail-closed abort): <r>") withres = nil. Pipeline.Executetreats any non-nilerrfromTimedEvaluateas an immediate pipeline abort, ensuringnomos verifyandnomos task syncnever fail open or leave half-committed state.
3.3 Native Compiled nomos hook Subcommands & Zero-Footprint Container Mode (INT-863 / SUB-1546)#
To eliminate external runtime dependencies on jq, bash, or python3 in minimalist container and workstation environments, Nomos provides compiled Go hook subcommands (nomos hook session-start, nomos hook pre-tool, nomos hook post-tool):
- Unified JSON Payload Ingestion: Each subcommand parses standard agent hook payloads from
stdinsupporting Claude Code (tool_name,tool_input), Cursor, and Antigravity (toolCall.name,toolCall.args,workspacePaths,cwd). - PreToolUse Guards (
nomos hook pre-tool— Law 3 & Law 7):- Unexpanded Shell Variable & Tilde Guard: Rejects native file-mutation tool calls (
Write,Edit,MultiEdit,write_file,edit_file,write_to_file,replace_file_content,multi_replace_file_content) whose target path contains unexpanded$VAR,${VAR}, or leading~tokens, preventing literal$HOMEdirectory creation. - Canonical Boundary Containment: Resolves relative and symlinked paths against
cwd. In standard mode, mutations outside/worktrees/,/.tmp/, and/.gemini/are denied with a HATEOAS remediation hint (nomos task chore "<title>"). When--hermetic-dir <dir>is supplied (container/sandbox mode), mutations are permitted inside the canonical realpath of<dir>and denied outside<dir>(while still protecting system roots/etc,/usr,/bin,/sbin,/var,/proc,/sys,/dev,/boot). - Command Safety & Encapsulation Guard: Inspects shell tool invocations (
Bash,bash,run_command,execute_command) and denies:- Wildcard or root recursive deletions (
rm -rf /,rm -rf /*,rm -rf *,rm -rf ~,rm -rf ..). - Manual
go installofnomosduring active task sessions (Law 4). - Direct
sqlite3mutations or queries against.nomosor.dbfiles (Law 1 & ADR-0062). - Stateful
git stashmutations (allowing read-onlygit stash list/git stash clear). - Tampering with
.git/hooksdefense scripts (rm,unlink,chmod,mv).
- Wildcard or root recursive deletions (
- Unexpanded Shell Variable & Tilde Guard: Rejects native file-mutation tool calls (
- PostToolUse Channel Purity & Zero-Footprint Verification (
nomos hook post-tool— Law 4):- 100% Silent on Non-Edit Channels: Emits
{}immediately when invoked forBash,Read, orMCPtools so native operating system errors (EACCES,ENOENT) are never masked by hook output. - In-Memory Syntax & Radar Verification: Validates edited
.json,.jsonl,.cue, and source files directly without writing.tmp/nomos_radar_alert.txtfiles into the workspace, preserving a zero-footprint working tree.
- 100% Silent on Non-Edit Channels: Emits
- Additive Workspace Hook Chaining & 3-Strike Loop Circuit-Breaker (
INT-868/SUB-1560):- Additive Settings & Hook Chaining: When a target workspace contains an existing
.claude/settings.jsonwith task-localPreToolUse,PostToolUse, orSessionStarthooks or plugins,nomos initandnomos hookpreserve and chain the existing workspace hooks rather than overwriting them, eliminating TraceTrialO(Observability) andT(Tooling) overlay contention. - 3-Strike Identical-Failure Circuit-Breaker:
nomos hook pre-toolcomputes a deterministic call fingerprint(tool_name, sha256(canonical_args), workspace_mtime_digest). When the same fingerprint fails or repeats>= 3consecutive times without a workspace state change (workspace_mtime_digestunchanged),nomos hook pre-tooldenies the 3rd identical invocation with a 1-line state-change remediation directive so the agent alters its parameters or inspects workspace state instead of looping.
- Additive Settings & Hook Chaining: When a target workspace contains an existing
4. Deterministic Verification Vectors (VEC-TTB-01 .. VEC-TTB-07)#
The cleanroom harness suite (substrate/cli/cleanroom_tracetrial_bench_test.go) and unit hardening tests (substrate/src/nomos/modules/verify/tracetrial_hardening_test.go) execute seven deterministic end-to-end vectors:
VEC-TTB-01(Pillar 1 — Context): Provision cleanroom workspace, seed Mneme records across two repo scopes, executeSynthesizeDynamicHandshake, and assert strict repository isolation plus active wavefront orientation.VEC-TTB-02(Pillar 2 — Execution / Worktree Escape): Invokeworktree-guard.shagainst root trunk paths andworktrees/repo-SUB-1/../../trunk.gopath traversal, plus attempt a direct commit onmain; assert non-zero fail-closed denial across all vectors.VEC-TTB-03(Pillar 3 — Governance / Config Tampering):- Sub-vector 3a: Mutate
nomos.yamlinside aSUB-*worktree; assertPlaneSeparationGatefails closed. - Sub-vector 3b: Flip
strict_mode: falseandmax_file_loc: 9999inside anINT-*worktree against astrict_mode: truetrunk; assertThresholdIntegrityGatedetects the downgrade againstRepoRootand fails closed.
- Sub-vector 3a: Mutate
VEC-TTB-04(Pillar 4 — Lifecycle / Gate Crash & 2PC Abort): Trigger a panicking gate inTimedEvaluate/Pipeline.Execute(asserting structuredERR_CORErecovery without process crash) and runnomos task syncon a failing worktree; assert trunkHEADSHA is unchanged andrefs/notes/nomos/releasescontains zero receipts for the aborted task.VEC-TTB-05(Pillar 5 — Observability / Attestation & Mneme Provenance): Sync a compliant worktree through 2PCnomos task sync; assert a cryptographic SHA-256 receipt is attached torefs/notes/nomos/releasesand a statutorypatternrecord is distilled intomneme.db.VEC-TTB-06(Pillar 6 — Tools / Toolchain & Symlink Confinement): Invokenomos-build-guard.shon rawgo build(asserting fail-closed block) and plant a symlink inside a worktree (assertingZeroFilesystemAliasGaterejection).VEC-TTB-07(Pillar 7 — Verification / Anti-Shortcut Enforcement): Inject an empty function stub (func Shortcut() {}) into a worktree; assertAntiShimGaterejects the shortcut (0.0%trunk defect leakage).
Nomos