Skip to content

Feat/guard generic engine#146

Merged
slowdini merged 5 commits into
devfrom
feat/guard-generic-engine
Jul 16, 2026
Merged

Feat/guard generic engine#146
slowdini merged 5 commits into
devfrom
feat/guard-generic-engine

Conversation

@slowdini

Copy link
Copy Markdown
Owner

Closes #137

slowdini and others added 5 commits July 15, 2026 15:39
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>
@slowdini
slowdini merged commit 779a4aa into dev Jul 16, 2026
6 checks passed
@slowdini
slowdini deleted the feat/guard-generic-engine branch July 16, 2026 01:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(guard): generic guard engine over embedded descriptor data

1 participant