Hunk Consent Guard (hunk-consent-guard)
Per-hunk patch staging, SHA-256 baseline-drift approval revocation, and drift-checked rollback receipts for Hermes Agent.
Derived from patch-review-desk and cart-consent-paypal.
Core Safety Guarantees
- User-Only Granular Per-Hunk Consent (
hunk_propose,hunk_review_status,/hunk-desk):
Stage a multi-hunk file edit without touching the working tree. Model-facing tools (hunk_propose,hunk_review_status) cannot approve hunks; approval comes exclusively from the user via/hunk-desk approve <proposal_id> 1,3orhermes hunk-desk approve <proposal_id> 1,3, and bothhunk_apply_approvedandhunk_rollback_receiptescalate through Hermes'spre_tool_callapproval gate with per-ID rule keys. - Local-Backend Enforcement, Public-API Path Safety &
write_fileDispatch:
Refuses host filesystem access (and skips middleware receipt capture) whenever the active terminal backend (TERMINAL_ENVorterminal.backendin Hermes config) is non-local (such asdocker,ssh, ormodal), preventing sandboxed sessions from reading host files. On the local backend, relative paths resolve againstctx.session_cwd()/agent.runtime_cwd.resolve_agent_cwd(), protected paths (HERMES_HOME, credential directories,.env*, NT-namespace paths, non-regular files, and paths outsideHERMES_WRITE_SAFE_ROOT) are blocked before reading or storing, and all file writes dispatch exclusively throughctx.dispatch_tool("write_file", ...). - Automatic Baseline-Drift Revocation:
Every proposal pins the target file'sbaseline_sha256. If the file on disk is modified out-of-band beforehunk_apply_approvedruns,hunk-consent-guarddetects the SHA-256 drift, revokes all approvals (status: "drifted_revoked"), and refuses to overwrite the file. - Durable Rollback Receipts (
tool_executionMiddleware &hunk_rollback_receipt):
Every applied hunk proposal—and everywrite_file/patchcall wrapped bytool_executionmiddleware—records a receipt withbefore_sha256,after_sha256, unified diff, and text snapshots in<HERMES_HOME>/plugin-data/hunk-consent-guard/data.db. Rolling back a receipt verifies that the current file still matchesafter_sha256before restoringbefore_text, so later edits are never clobbered.
Installation
hermes plugins install misakamikotoghr-5205/hermes-hackathon-plugins --subdir hunk-consent-guard
hermes plugins enable hunk-consent-guard
Slash & CLI Commands
/hunk-desk list
/hunk-desk status 1
/hunk-desk approve 1 1,3
/hunk-desk apply 1
/hunk-desk rollback 1
Disclosure (Catalog Rule 13)
- Filesystem Access: Local terminal backend only (refuses host reads/writes and skips middleware capture when
terminal.backend/TERMINAL_ENVis non-local, e.g.docker,ssh,modal). On the local backend, reads target workspace files duringwrite_file/patchtool execution and explicithunk_propose/hunk_apply_approved/hunk_rollback_receiptcalls; writes target files exclusively viactx.dispatch_tool("write_file", ...)whenhunk_apply_approvedorhunk_rollback_receiptis explicitly invoked. - Storage: Persists file snapshots (up to
max_snapshot_kb, default 256 KB) and SHA-256 receipts in<HERMES_HOME>/plugin-data/hunk-consent-guard/data.db. - Approvals & Network: Never alters or bypasses Hermes's built-in approval prompts; makes no network calls and spawns no subprocesses.
README from the reviewed commit 0149f99; it updates when the author re-pins.

misakamikotoghr-5205