Skip to content

fix: replace tilde paths with $HOME in v3.0 markdown instructions#717

Open
m4nt0de4 wants to merge 1 commit intodanielmiessler:mainfrom
m4nt0de4:fix/tilde-path-markdown-instructions
Open

fix: replace tilde paths with $HOME in v3.0 markdown instructions#717
m4nt0de4 wants to merge 1 commit intodanielmiessler:mainfrom
m4nt0de4:fix/tilde-path-markdown-instructions

Conversation

@m4nt0de4
Copy link
Contributor

Summary

Claude Code's Write/Edit tools use fs.writeFile() internally — they do not shell-expand ~. When the AI follows markdown instructions containing ~/.claude/... paths and passes them to Write/Edit tools, 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:

  • TypeScript tools (paths.ts, hooks) — use homedir() + join()correct, unaffected
  • Markdown instructions — use ~/.claude/ shorthand that the AI passes verbatim to Write/Editbroken on all platforms

This is platform-agnostic — affects Linux, macOS, and WSL equally since Write/Edit are API-level file operations, not shell commands.

Files Changed (11 files, 20 insertions, 18 deletions)

File Lines Change
PAI/Components/Algorithm/v1.6.0.md 287, 664 PRD creation path + PATH RULE warning
PAI/SKILL.md 326, 703 Same (built version of Algorithm)
WorldThreatModelHarness/Workflows/UpdateModels.md 82, 86 Save/write model paths
WorldThreatModelHarness/SKILL.md 42 Model storage reference
Evals/Workflows/CreateUseCase.md 42, 100, 124, 176 4× Create file instructions
Evals/Workflows/CreateJudge.md 36 Create judge config
Evals/Workflows/CompareModels.md 49 Create comparison config
Evals/Workflows/ComparePrompts.md 79 Create comparison config
Research/Workflows/ExtractAlpha.md 382, 385 Scratch workspace + history paths
Agents/AgentProfileSystem.md 184 Agent profile creation
PAI/THEHOOKSYSTEM.md 163 Ratings write path

What Was NOT Changed

  • Shell commands (mkdir -p ~/.claude/... in bash blocks) — shell correctly expands ~
  • Read-only references (Read ~/.claude/...) — Read tool handles ~ correctly
  • TypeScript code — already uses homedir() + join() via paths.ts
  • User-facing documentation~ is fine in human-readable contexts

Testing

# Verify no Write-facing tilde paths remain in v3.0 skills:
cd Releases/v3.0/.claude/skills
grep -rn '~/.claude/' --include='*.md' | grep -iE '(create|write|save|work in)' | grep -v '```bash' | grep -v 'mkdir'
# Should return 0 results

Related

🤖 Generated with Claude Code

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>
nsalvacao added a commit to nsalvacao/Personal_AI_Infrastructure that referenced this pull request Feb 17, 2026
nsalvacao added a commit to nsalvacao/Personal_AI_Infrastructure that referenced this pull request Feb 17, 2026
intake(lote-A): import upstream PR danielmiessler#717 (tilde path markdown fix)
nsalvacao added a commit to nsalvacao/Personal_AI_Infrastructure that referenced this pull request Feb 17, 2026
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