fix(context-guard): default-disable the zone-crossing injection on both wirings - #2049
fix(context-guard): default-disable the zone-crossing injection on both wirings#2049kyle-sexton wants to merge 1 commit into
Conversation
…th wirings Add a zone_crossing_inject_enabled userConfig boolean (declared default false, in-script default false per the hook-config-delivery convention's fact 3 — the declared default is never delivered to hook processes) that gates zone-crossing-inject.sh after the existing context_guard_hooks_enabled master switch. One in-script gate covers both wirings (PostToolBatch + UserPromptSubmit). The script and its wiring stay shipped; operators opt back in via /plugin. Rationale: #2021 classified this injection as the only always-on model-facing behavioral hook in a default install, and #2009 (check I23) flagged its four-option exit menu as manufacturing stop-initiative current models already carry. Config-off-first per the plugin philosophy's instruction-economy evidence gate. zone-gate.sh and post-compact-mark.sh keep their prior defaults. Tests: opt existing scenarios in explicitly; add default-off (unset and explicit false) coverage and master-switch-outranks-opt-in coverage. Version 0.4.9 -> 0.5.0; CHANGELOG entry; README, setup SKILL.md, and the generated catalog updated to match. Closes #2009 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
Claude finished @kyle-sexton's task in 1m 8s —— View job Security review complete
No security issues found. Scope reviewed (7 files, per Notes from the review (no findings, just what was checked):
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b61d46c500
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| # Opt-in gate — default false (hook::check_enabled cannot express a | ||
| # default-off switch: it allows on unset). Covers both wirings | ||
| # (PostToolBatch + UserPromptSubmit); silent-skip-ok by design. | ||
| [[ "${CLAUDE_PLUGIN_OPTION_ZONE_CROSSING_INJECT_ENABLED:-false}" == "true" ]] || exit 0 |
There was a problem hiding this comment.
Reset prior zone state before the first opted-in check
When an existing 0.4.9 session already has dumb in its persistent ${CLAUDE_PLUGIN_DATA}/state/<session>.zone, upgrading to 0.5.0 and later opting in while that session remains dumb produces no guidance: this early exit preserves the old state, so the first enabled invocation compares dumb to dumb and stays silent. That conflicts with the new test's stated intent that the disabled posture remain stateless so a later opt-in sees its first transition, and the user will receive nothing until the session recovers and worsens again. Clear or version the injection state while disabled, or explicitly detect the first enabled invocation.
Useful? React with 👍 / 👎.
|
Claude finished @kyle-sexton's task in 3m 39s —— View job Review completeSummary: This is a clean, well-scoped default-flip. The gating change in Test coverage: Two stale-doc findings (not on changed lines, so noted here rather than inline):
Neither of these blocks the PR (they're pre-existing files this change didn't touch, and the shipped behavior itself is correct), but both are genuine truthfulness gaps the "opt-in" change created in adjacent unchanged docs, worth a fast follow-up commit. No other correctness, architecture, or error-handling issues found in the changed files. The kill-switch/opt-in layering, the version bump (0.4.9 → 0.5.0, correctly minor for a default-behavior change with no contract removal), and the docs updates that were in scope for this PR are all consistent and accurate. |
|
Claude has reviewed this PR 1 time. The lane skips further automatic reviews after 5; deleting this comment resets the count. |
|
Superseded by #2031 (created by a concurrent session before this PR's spec was written, discovered after both were up). #2031 answers the same #2009 finding by splitting the injection by audience — the four-option menu moves to systemMessage (human channel) and additionalContext carries only the zone measurement plus a counter-steer — with the same context-guard 0.4.9→0.5.0 slot and the same files, so the two PRs conflict directly. Under the classification rubric this work-stream just codified (PR #2033), the reworked hook is a measurement relay with a non-derivable oracle — a keep, not the behavioral ablation candidate the original #2021 line-i classification described, because that classification was of the old payload. The open codex thread here (stale persisted zone state on the upgrade path) does not apply to #2031's shape, which keeps the hook always-on. #2021's line-i disposition for the context-guard leg is therefore #2031, recorded on the issue; the two guardrails injector legs still land via #2058. |
Closes #2009
Summary
Flips the default for
zone-crossing-inject.sh— the ~1KB continuation-guidance lecture with a four-option exit menu, wired twice (PostToolBatch + UserPromptSubmit) — from always-on to opt-in, via a new per-hookzone_crossing_inject_enableduserConfig boolean defaulting false. The script and both wirings stay shipped; consumers opt back in by configuring the optiontruevia/plugin.zone-gate.shandpost-compact-mark.shkeep their prior defaults. context-guard 0.4.9 → 0.5.0.Fix
context_guard_hooks_enabled) is plugin-wide and would have silenced the gate and the PostCompact marker too, so a per-hookzone_crossing_inject_enableduserConfig boolean was added (declareddefault: false). Perdocs/conventions/hook-config-deliveryfact 3, the declareddefaultfield is never delivered to hook processes, so the shipped behavior lives in an in-script default:zone-crossing-inject.shnow exits silently unlessCLAUDE_PLUGIN_OPTION_ZONE_CROSSING_INJECT_ENABLEDis configuredtrue(channel B, decision rule 4 — non-safety advisory surface, same channel the master switch already uses). One in-script gate placed after the master switch covers both wirings; the master switch still outranks the opt-in.description, README (component bullet + Configuration), setup skill's hook-activation reporting step (new "Injection opt-in" fact; "injection hook still runs" corrected), CHANGELOG[0.5.0]entry, regenerateddocs/CATALOG.md(cheatsheet generator ran clean with no diff).Fresh-docs verification (fetched this session, 2026-08-08):
type: boolean,default"Value used when the user provides nothing",title/descriptionrequired) and theCLAUDE_PLUGIN_OPTION_<KEY>(key uppercased) env export to hook processes.PostToolBatchandUserPromptSubmitevent validity, hook-entry fields (type,timeoutin seconds,statusMessage), andadditionalContextsemantics for both events.hooks/hooks.jsonitself is unchanged.Verification
plugins/context-guard/hooks/zone-crossing-inject.test.sh— PASS 20 / FAIL 0, including new coverage: default (opt-in unset) is silent and stateless; explicitfalsesilent; master kill switch outranks atrueopt-in; all pre-existing scenarios opt in explicitly and still pass.plugins/context-guard/hooks/zone-gate.test.sh— PASS 24 / FAIL 0 (unchanged file, run to confirm no collateral).plugins/context-guard/hooks/post-compact-mark.test.sh— PASS 16 / FAIL 0 (unchanged file).check-silent-skips.shclean,check-hook-userconfig-argv.shclean,check-changelog-parity.sh --checkand--check-bump origin/mainclean,markdownlint-cli2clean on the three edited markdown files,jqvalidatesplugin.json,bash -n+ shellcheck clean on both edited scripts.node scripts/generate-catalog.mjs(diff committed) andnode scripts/generate-cheatsheet.mjs(no diff).Related
🤖 Generated with Claude Code