Correctness Wall extension
July 13, 2026 · View on GitHub
B2C patch safety gate for edit and write tool calls, plus an explicit correctness_wall_evaluate tool. Policy checks come from omk-adaptorch-wpl via a relative import (no workspace package.json dependency).
Usage
From the packages/coding-agent directory (or repo root with a valid path):
omk --extension examples/extensions/correctness-wall/index.ts
Copy into user extensions for auto-discovery:
cp -r examples/extensions/correctness-wall ~/.omk/agent/extensions/correctness-wall/
Claim boundaries
- In scope: unified-diff preview for pending
edit/write, fast policy wall (write scope, flags), optional OA adjudication whencorrectness_wall_evaluateis called withrunIds,previewOnly: false, and either an OA fixture file or an explicitly enabled host-injected MCP transport. - Out of scope: Replacing core hooks, modifying
packages/adaptorch-wplfrom this lane, or adding npm workspace dependencies. The extension only importsevaluateCorrectnessWallandAdaptOrchClientfrom../../../../adaptorch-wpl/src/index.ts.
Environment variables
| Variable | Default | Meaning |
|---|---|---|
OMK_PATCH_SAFETY_WALL_MODE | shadow | shadow — log/notify only, never block. soft — block BLOCKED unless override. hard — block BLOCKED and INCONCLUSIVE. |
OMK_WALL_SCOPE | (empty) | Comma-separated glob/path prefixes allowed in the diff. Empty means scope checks do not approve any path (out-of-scope diffs can trigger blocking flags when paths are present). |
OMK_WALL_OVERRIDE | unset | When 1 / true / yes, soft mode does not block BLOCKED verdicts (human override). |
OMK_WALL_REPAIR_BUDGET | 1 | Capped regenerate budget: max blocked attempts per packet (keyed by packetId or SHA-256 of kind + sorted OMK_WALL_SCOPE) before repair hints are treated as exhausted. Also caps hint string count in UI/JSON. Persisted in .omk/wall-cache/repair-budget.json. Hints only — no auto-regenerate. |
OMK_WALL_RUN_IDS | (empty) | Comma-separated AdaptOrch run ids. On edit/write hooks, non-empty IDs enable OA only with either OMK_WALL_OA_FIXTURE_PATH or explicit OMK_WALL_OA_TRANSPORT=mcp/live plus a bound host callMcpTool; otherwise hooks stay preview-only. An unbound MCP facade falls back to preview-only. |
OMK_WALL_OA_FIXTURE_PATH | unset | Path to OA adjudication fixture JSON. Used when correctness_wall_evaluate runs with previewOnly: false and non-empty runIds, or as the fixture alternative for edit/write hooks. Overridden per call by adjudicationFixturePath. |
OMK_WALL_AUTO_REGENERATE | unset | When 1 / true / yes, correctness_wall_evaluate JSON may include a regeneratePacket (capped hints only; no automatic patch apply). |
OMK_WALL_RECEIPT_SIGNING_SECRET | unset | When set, verification receipts include signedReceipt (HMAC-SHA256 over digest composite). Never log or commit this value. |
OMK_WALL_DEEP_PHASE | stub | docker records deep-wall intent; hermetic runner still unavailable (batch-2). |
OMK_WALL_OA_TRANSPORT | fixture | mcp or live uses host-injected MCP callMcpTool via setWallAdaptOrchCallTool (see adjudication-fixture.ts). With non-empty OMK_WALL_RUN_IDS and a bound handler, this explicitly enables fixtureless read-only OA hook adjudication; it calls only adaptorch_get_run, adaptorch_get_artifacts, and adaptorch_get_traces. An unbound facade falls back to preview-only. |
OA adjudication fixture format
Fixture file (JSON object). Each run_id must define the three AdaptOrch introspection payloads the in-memory client serves:
{
"wall_version": "1",
"dispatchRecordId": "local-dev-dispatch",
"runsById": {
"run-oa-1": {
"run": { "run_id": "run-oa-1", "status": "completed" },
"artifacts": [{ "path": "out.md", "size_bytes": 42 }],
"traces": [{ "kind": "write", "level": "info" }]
}
}
}
wall_version: optional string copied onto the verification receipt returned bycorrectness_wall_evaluate(defaults to extension version1).dispatchRecordId: optional; passed to OA adjudication when not set elsewhere.runsById: required map; keys must matchrunIdsin the tool call.
createInMemoryAdaptOrchClient (in adjudication-fixture.ts) wraps these entries with the same transport pattern as packages/adaptorch-wpl/test/b2c-wall-oa.test.ts.
Tools
correctness_wall_evaluate
Parameters:
kind(string, required)approvedWriteScope(optional string array)previewOnly(optional boolean, defaulttrue)diffPath(optional string) — if omitted, returns anINCONCLUSIVEverdict card JSONrunIds(optional string array)packetId(optional string)adjudicationFixturePath(optional string) — OA fixture file; falls back toOMK_WALL_OA_FIXTURE_PATH
Returns JSON text: { verdictCard, receipt }, and repairHints when verdictCard.verdict is BLOCKED.
The receipt includes standard VerificationReceipt fields from adaptorch-wpl plus wall_version (from the fixture or default).
Example receipt fragment:
{
"schemaVersion": 1,
"evaluatedAt": "2026-07-08T12:00:00.000Z",
"kind": "code-edit",
"runIds": ["run-oa-1"],
"previewOnly": false,
"wall_version": "1",
"adjudicationVerdict": "CONFIRMED",
"policyFlags": []
}
Edit/write gate
On each edit or write tool_call hook:
- Build a unified diff preview from
event.input(edits or write content). - Call
evaluateCorrectnessWallwith scope fromOMK_WALL_SCOPE. DefaultpreviewOnly: true; with non-emptyOMK_WALL_RUN_IDS, hooks usepreviewOnly: falsewhen either an OA fixture path is set orOMK_WALL_OA_TRANSPORT=mcp/livereaches a bound host-injected MCP transport. An unbound facade falls back to preview-only. The live hook path performs read-only OA introspection only. - Apply
OMK_PATCH_SAFETY_WALL_MODEblocking rules; blocked calls return{ block: true, reason: "<short user message>" }. - Write a summary snapshot to
.omk/wall-cache/latest.json(mode, verdict,wouldBlock, compact card summary, timestamp — no full diff or secrets). - In
shadowmode, append one NDJSON line per gated tool call to.omk/wall-cache/shadow-telemetry.ndjson(event,wall_version,mode,verdict,wouldBlock,kind,tool,previewOnly,usedOaFixture,timestamp— no diff or secrets). - On
BLOCKED, increment per-packet attempts in.omk/wall-cache/repair-budget.json. Inshadowmode, append capped repair hints to the UI notification; whenattempts >= OMK_WALL_REPAIR_BUDGET, append a repair-budget-exhausted message.
Limitations
- Edit preview reads the target file from disk relative to session
cwd; if the file is missing or paths are wrong, the hook may returnINCONCLUSIVE(and block inhardmode). - Hook OA requires non-empty
OMK_WALL_RUN_IDSplus either a fixture path or explicitOMK_WALL_OA_TRANSPORT=mcp/livewith bound hostcallMcpTool; otherwise hooks remain preview-only. An unbound facade also falls back to preview-only. Explicitcorrectness_wall_evaluatecan still passrunIds,previewOnly: false, andadjudicationFixturePathper call. - Relative imports require loading this extension from the monorepo layout (or an equivalent path to
adaptorch-wplandcoding-agentsources).