fix: replace tilde paths with $HOME in v3.0 markdown instructions#717
fix: replace tilde paths with $HOME in v3.0 markdown instructions#717m4nt0de4 wants to merge 1 commit intodanielmiessler:mainfrom
Conversation
Claude Code's Write/Edit tools use fs.writeFile() internally and do NOT shell-expand `~`. When AI follows markdown instructions containing `~/.claude/...` paths and passes them to Write/Edit tools, literal `~` directories are created in the working directory instead of writing to the home directory. This affects 11 skill/workflow files across v3.0 where Write-facing instructions used `~/.claude/` shorthand. Changed to `$HOME/.claude/` with resolution notes where appropriate. TypeScript tools (paths.ts, hooks) already use homedir() + join() and are unaffected. Relates to danielmiessler#699 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
intake(lote-A): import upstream PR danielmiessler#717 (tilde path markdown fix)
|
Ran the test on WSL2 (Ubuntu). Checked all 11 changed files against the grep criteria from the PR description — all pass, no Write-facing tilde paths remaining in the changed files. The broader Looks good to me. |
|
Thanks for this contribution! PAI v4.0 significantly restructured the architecture — new directory layout, Algorithm v3.6.0 (up from v1.x), hooks/lib/paths.ts for path resolution, and many of the underlying systems this PR targets have been rewritten. This PR targets the v3.0 architecture and can't be cleanly applied to v4.0.x. Closing as superseded. The latest release is v4.0.2. We're actively working on platform compatibility and other bigger items. If there's still a gap not covered by the new releases, we'd welcome a fresh PR against the current codebase. Thanks again! |
Summary
Claude Code's
Write/Edittools usefs.writeFile()internally — they do not shell-expand~. When the AI follows markdown instructions containing~/.claude/...paths and passes them toWrite/Edittools, a literal directory named~is created in the current working directory instead of writing to the user's home directory.This PR fixes 11 files across v3.0 where Write-facing markdown instructions used
~/.claude/shorthand, replacing them with$HOME/.claude/(with resolution notes where appropriate).Root cause: The PAI system has two path systems:
paths.ts, hooks) — usehomedir()+join()→ correct, unaffected~/.claude/shorthand that the AI passes verbatim toWrite/Edit→ broken on all platformsThis is platform-agnostic — affects Linux, macOS, and WSL equally since
Write/Editare API-level file operations, not shell commands.Files Changed (11 files, 20 insertions, 18 deletions)
PAI/Components/Algorithm/v1.6.0.mdPAI/SKILL.mdWorldThreatModelHarness/Workflows/UpdateModels.mdWorldThreatModelHarness/SKILL.mdEvals/Workflows/CreateUseCase.mdEvals/Workflows/CreateJudge.mdEvals/Workflows/CompareModels.mdEvals/Workflows/ComparePrompts.mdResearch/Workflows/ExtractAlpha.mdAgents/AgentProfileSystem.mdPAI/THEHOOKSYSTEM.mdWhat Was NOT Changed
mkdir -p ~/.claude/...in bash blocks) — shell correctly expands~Read ~/.claude/...) — Read tool handles~correctlyhomedir()+join()viapaths.ts~is fine in human-readable contextsTesting
Related
plansDirectorysetting)🤖 Generated with Claude Code