Skip to content

docs(rules): avoid if/Test-Path file checks that prompt#755

Merged
kcenon merged 1 commit into
developfrom
docs/issue-754-resume-read-tool
Jun 15, 2026
Merged

docs(rules): avoid if/Test-Path file checks that prompt#755
kcenon merged 1 commit into
developfrom
docs/issue-754-resume-read-tool

Conversation

@kcenon

@kcenon kcenon commented Jun 15, 2026

Copy link
Copy Markdown
Owner

What

Steers session-resume.md and the environment.md cheatsheet away from
if/Test-Path compound file-existence checks toward the Read tool.

Why

Closes #754.

Follow-up to #752. The #752 cheatsheet is prevention; it cannot stop prompts when
a rule itself induces a compound command. session-resume.md phrased the resume
check as "if resume.md exists", so the agent built an
if (Test-Path) { Get-Content } else command whose if first token erodes the
matchable prefix and triggers a permission prompt. This is the structure /
prefix-erosion axis, independent of the #750 length axis.

How

  • session-resume.md "How to Resume": use the Read tool on .claude/resume.md;
    a not-found error means no resume file; do not wrap the check in if/Test-Path.
  • environment.md cheatsheet: add a row mapping
    if (Test-Path X) { Get-Content X } else {...} -> Read tool on X
    (or Get-Content X -ErrorAction SilentlyContinue).

Where

  • project/.claude/rules/workflow/session-resume.md
  • project/.claude/rules/core/environment.md
  • +9 / -2 lines, docs only.

Test

Verified prompt-free: the Read tool and Get-Content X -ErrorAction SilentlyContinue
both run without a permission prompt (the original if/else form prompted). No
settings.json / settings.windows.json permissions entries touched, so
tests/scripts/test-windows-powershell-permissions.sh and the narrow Windows
PowerShell allow policy are unaffected.

Closes #754

session-resume.md phrased the resume check as "if resume.md
exists", which leads to an if (Test-Path) { Get-Content } else
compound command whose if first token erodes the matchable
prefix and triggers a permission prompt. Steer the rule to the
Read tool and add a cheatsheet row mapping the conditional
file-existence pattern to the Read tool (or Get-Content with
-ErrorAction SilentlyContinue).

Closes #754
@kcenon kcenon merged commit ce59e7e into develop Jun 15, 2026
1 check passed
@kcenon kcenon deleted the docs/issue-754-resume-read-tool branch June 15, 2026 07:13
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.

1 participant