Skip to content

disk-hygiene: give the session belt an escape hatch and re-scope its deny-by-default to its actual threat model #3856

Closed as not planned

Description

@kyle-sexton

This was generated by AI during triage.

Parent

Refs #3347, findings F9.3 and F9.4. Blocked by the proportionality decision carrier; a component that gains a proportionality notion may want the belt scoped differently.

What this is

Two related problems with the session-scoped safety belt:

No escape hatch. Once engaged, the belt has no lever. An operator who knows the belt is wrong about a specific command has no supported way to proceed, so the only paths are to abandon the work or to defeat the belt by means it does not sanction. A safety mechanism with no sanctioned override trains people to route around it, which costs more safety than it buys.

This is not theoretical. The parent records that a triage session which had never invoked the skill was nonetheless denied a read-only inspection command in the belt's wording. A belt that blocks read-only inspection in sessions unrelated to the skill is over-scoped by any reading.

The deny-by-default exceeds its threat model. The belt denies broadly on the Bash lane. The parent records an inversion worth stating plainly: on Windows, the lane that is hard-denied cannot perform the deletion the belt exists to prevent, while the lane that can is treated differently. Re-verified on 2026-09-06: the two lanes are still registered asymmetrically, one carrying a narrowing predicate that the other does not. So the denial's breadth is not tracking where the danger actually is.

Constraint that must be carried forward

The parent records a withdrawn claim whose correction matters: the belt does not reach subagents, and that non-inheritance is undocumented and build-specific.

This cuts both ways and any redesign must account for it. It bounds the belt's real coverage, so a belt that appears to protect a session may not protect work the session delegates; and because the behavior is build-specific and undocumented, it cannot be relied upon in either direction. Whoever takes this must establish the current behavior empirically rather than reasoning from the belt's intent, and document what they find.

Why human-gated

Changing what a safety mechanism denies is a threat-model decision. The questions have no default:

  1. What is the belt actually protecting against, stated concretely enough to test a denial against it?
  2. Which lane presents that risk on which platform? The recorded inversion suggests the current answer is wrong.
  3. What form does the escape hatch take, and what stops it becoming the default path? An override everyone uses is not an override.
  4. What is the intended subagent behavior, now that non-inheritance is known?

An agent answering these would be setting security policy.

Acceptance criteria

  • The belt's threat model is stated explicitly, concretely enough that a given denial can be judged correct or incorrect against it.
  • Denials are scoped to that model. A read-only inspection command in a session that never invoked the skill is not denied.
  • A sanctioned override exists, with its boundaries stated and its use visible rather than silent.
  • Subagent behavior is established empirically, documented, and made deliberate rather than incidental.
  • The platform inversion is resolved: the lane that can perform the dangerous operation is the lane that is governed.
  • Regression coverage for the recorded false positive, so it cannot silently return.

Out of scope

  • The proportionality question, which is the carrier.
  • The residual fail-open when no interpreter resolves, which is its own child.
  • Broadening the belt to cover new operations.

Blocked by

Activity

  1. added
    needs-human
    on Sep 6, 2026
  2. added theissue type on Sep 6, 2026
  3. kyle-sexton commented on Sep 19, 2026

    @kyle-sexton
    MemberAuthor

    Another occurrence on v0.23.12 (Windows): after /disk-hygiene:clean loaded, the belt denied every non-engine Bash command for the rest of the session, including unrelated gh calls for filing issues. The only recovery offered was "start a new session". The work had to move to the PowerShell lane.

  4. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    This was generated by AI during triage.

    Health check: the body says "Blocked by #3855"; #3855 is closed. Re-check whether its outcome changes this issue's scope before acting.

  5. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Another occurrence, this time with the cost stated. One operator session ran /disk-hygiene:clean on C:\, $HOME and D:\, and /repo-hygiene:clean across all repos, orchestrated together. After /disk-hygiene:clean loaded, the session belt denied git, gh and /repo-hygiene:clean's scripts on the Bash lane for the rest of the session. The denial text says the belt "persists until the session ends" and names recovery as a new session (skills/clean/scripts/destructive_guard.py:1847). Running both concurrently under one orchestrator could not be done, so cleanup was split into separate sessions with disk-hygiene last.

    The belt also blocks the discovery plugin's dispatch gate (discovery/0.24.0/scripts/check-dispatch-artifact.sh). /discovery:explore and /discovery:research could not run their default route in the session and ran inline through subagents. Because the Bash belt stayed on for the whole session, execution had to route through PowerShell and subagents.

    The operator's requirement is that the whole workflow runs in ONE orchestrated session: disk-hygiene across C:, $HOME and D:; repo-hygiene across all repos; the discovery skills; and git/gh cleanup. Splitting across sessions is not acceptable.

    Requirement to add to the acceptance criteria: the plugins must work both in a dedicated session and together in one session. Concretely:

    • Loading /disk-hygiene:clean must not deny commands that belong to another skill's documented workflow (git, gh, repo-hygiene scripts, discovery's dispatch gate). The deny list should be the deletion shapes the belt exists for, not everything not on the engine allowlist.
    • The belt should be releasable inside the session (the escape hatch in this issue), or scoped to the skill's own turns.
    • skills/clean/SKILL.md:6-24 registers the belt as a skill-frontmatter hook with matcher: "Bash|PowerShell" and no if filter, so the scope is the whole session by construction. Moving deletion enforcement to the always-on plugin-level gate (already present, and already fires without the skill being invoked) would remove the need for a session-lifetime belt.

    Related: #2618 (closed, documented the lifetime), #4228 item 3 (subagent reach), #5214 (orchestrated whole-machine audit), #3347.

    🤖 Generated with Claude Code

    https://claude.ai/code/session_01K3VkbjLqtYZ6JtsQaDKP4v

  6. kyle-sexton commented on Sep 29, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-09-29): Decide with evidence. The owner accepted the recommendation: an agent gathers the evidence, then the choice among A (narrow the belt to deletion shapes with an if filter plus a visible release lever), B (drop the session-lifetime belt and enforce deletion shapes in the always-on plugin gate), C (keep the belt, add only a documented release lever) and D (close as won't do) is made from it. Leading candidate is A.

    Next: an agent posts on this issue (1) whether the skill hook outlives the skill turn on the current Claude Code build, (2) whether the belt reaches subagents (CHANGELOG:47 and README:106-107 conflict), and (3) a matrix of the deletion shapes the belt blocks today versus what the plugin gate covers. This is a security choice, so the agent stops after posting the evidence and the issue keeps needs-human for the final call.

  7. kyle-sexton commented on Sep 30, 2026

    @kyle-sexton
    MemberAuthor

    Resolution (2026-09-29, owner-approved consensus)

    Three independent read-only researchers voted do-here (3/3, confidence 0.8). The problem is live: repeat occurrences are recorded on v0.23.12 and 0.24.0. The belt is a skill-frontmatter PreToolUse hook in plugins/disk-hygiene/skills/clean/SKILL.md (matcher Bash|PowerShell, no if), so it denies git, gh, repo-hygiene scripts and discovery's dispatch gate for the whole session. Its only stated recovery is a new session (#4935, docs only). No evidence comment has been posted yet.

    Goal

    Post one evidence comment that lets the owner choose among A (narrow the belt with an if filter plus a visible release lever), B (drop the session-lifetime belt, enforce deletion shapes in the always-on plugin gate), C (keep the belt, add a documented release lever) and D (won't do). Make no code change until the owner picks. This is a security choice, so the agent stops after the post.

    Steps

    1. Matrix, from code. Read plugins/disk-hygiene/skills/clean/scripts/destructive_guard.py and the plugin-level hooks/hooks.json gate. Tabulate each deletion shape the belt denies against what the always-on gate already denies, on both the Bash and PowerShell lanes. Include the lane asymmetry and the read-only false positive recorded in this issue.
    2. Reconcile plugins/disk-hygiene/CHANGELOG.md (line ~136, "belt does not reach subagents") with README lines 106-107, which conflict on subagent reach.
    3. Probes, one local non-destructive claude session, no fleet host needed. (a) After the skill's turn ends, is the frontmatter hook still armed on the current Claude Code build? (b) Does a subagent spawned in that session hit the belt? Cross-check against the hooks doc's current text on skill-scoped hooks and subagent inheritance.
    4. Post one evidence comment covering (a), (b) and the matrix, and recommend A, B or C with a Basis: line.

    Acceptance criteria

    • One comment on this issue contains the deny-shape matrix (belt vs always-on gate, Bash and PowerShell), the probe (a) and (b) results with the Claude Code version, and the CHANGELOG/README reconciliation.
    • The comment recommends A, B or C with a Basis: line citing file:line, probe output or a fetched doc URL.
    • No code change is made before the owner's A/B/C/D choice.
    • After the owner picks, implementation is do-here work with regression tests for the recorded read-only false positive.

    Labels: needs-human removed and agent-ready added per the owner's "approve all". The owner's final A/B/C/D choice stays gated.

  8. removed
    needs-human
    on Sep 30, 2026
  9. 6 remaining items

  10. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Cross-reference: #5226 part (b), pwsh launched from Bash getting through, is the same belt-does-not-reach-subagents gap tracked here. #5226 is closed by owner decision; part (a) was fixed by #5546.

  11. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-01): approved the recommendation ("go with recommended", the owner's reply to the batch decision page that listed this question and its recommendation).

    Question: for the /disk-hygiene:clean session belt, which option: A, B, C or D?

    Chosen: A. Add an if filter so the skill-frontmatter belt checks only deletion shapes, and add a visible, logged release lever. git, gh, the repo-hygiene scripts and discovery's dispatch gate stop being denied; ad hoc rm, find -delete and Remove-Item stay governed. Accepted cost: the Bash lane becomes a deny-list that a wrapped deletion can bypass. Subagent reach is unchanged; widening the plugin gate is a separate decision.

    Next: an agent edits plugins/disk-hygiene/skills/clean/SKILL.md (if filters) and destructive_guard.py (logged release lever), adds regression tests for the read-only false positive, updates README and CHANGELOG, and opens a draft PR that Closes #3856. The change touches a security guard, so it needs the security review before ready.

  12. removed
    needs-human
    on Oct 1, 2026
  13. kyle-sexton commented on Oct 1, 2026

    @kyle-sexton
    MemberAuthor

    Owner decision (2026-10-01): accepted the recommendation ("accept all recommendations" and "I want you to do all of this for me", the owner's reply to the list that named this item).

    Close #5698 and keep the session belt on main unchanged. Four fresh-verify rounds on #5698 each found a new way for a delivered deletion to pass the belt (exec-wrapper heads, ${x:-/bin/rm } operator defaults, abbreviated git exec options such as git rebase --exe), so option A does not ship. While the belt is armed, git and gh stay denied as before.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    agent-ready

    Type

    Fields

    No fields configured for Task.

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions