Feat/guard generic engine#146
Merged
Merged
Conversation
Full-string pins of the Claude/Codex deny-verdict bytes (CLI level) and the freshly installed hook-file contents (adapter level), captured against the current per-harness guard code. These are the compatibility lock for the upcoming generic-engine refactor (#137): armed hooks and their backups are an on-disk contract, so the refactor must reproduce these bytes exactly. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Collapse the per-harness write-guard modules (claude_code/guard.rs,
codex/guard.rs) into one engine (src/adapters/guard.rs) driven by the
descriptor's [guard] data block. The four per-harness axes — hooks_file,
matcher, hook_entry template, verdict_template — plus command_template move
into harnesses/{claude-code,codex}.toml; the GuardEngine capability enum is
gone. Templates are parsed to JSON and placeholder-substituted in string
values, so key order (and therefore verdict bytes and hook-file shape) is
authored data pinned by full-string tests. The teardown cleanup dir is now
derived from hooks_file's parent instead of being per-harness code.
Descriptor validation grows guard-template invariants (matcher⊆vocabulary now
reads guard.matcher; hook_entry/verdict_template must parse as JSON with
{command}/{matcher}/{reason} placeholders in string values; command_template
must carry {exe}/{marker}; hooks_file must stay relative). The guard↔banner
lockstep and guard-requires-skills_dir invariants carry over unchanged.
The hidden guard / guard-codex subcommands stay as frozen aliases over a new
generic run_guard_hook handler resolving the verdict through the adapter's
new guard_verdict method (default fails open). Verdict bytes verified
identical against a pre-change binary.
Part of #137.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Hidden `guard-hook --harness <name> <marker>` entry point resolving the verdict shape from the named harness's embedded descriptor; `guard` / `guard-codex` remain frozen aliases. The new subcommand joins the is_guard_hook gate so hook invocations stay off layered descriptor discovery, and it fails open on an unknown harness name. Part of #137. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
--guard with a harness defined by user-supplied descriptors alone now stops the run in preflight instead of downgrading to a warning: the write guard is restricted to embedded built-ins (fail-open safety), and a run the user asked to guard must not continue silently unguarded. The error names the detect-stray-writes fallback. Built-in guardless harnesses (opencode) keep the warn-and-continue downgrade. Registry entries now expose embedded-layer provenance via has_embedded_layer(). Part of #137. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
The user-layer restriction message and its doc comment drop the stale 'until the guard engine is opened up' framing — the engine is generic now; guard data stays embedded-only because the guard fails open. progressive-enhancements.md documents the six [guard] fields, the one engine at src/adapters/guard.rs, the frozen guard/guard-codex aliases, and the guard-hook entry point for future built-ins. byoh.md notes the hard --guard preflight rejection; the per-harness notes point at the shared engine; the --guard --help text names the user-descriptor rejection. Part of #137. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #137