Claude Code started by a program in a new directory blocks on the folder trust dialog; trust is per exact path in ~/.claude.json
Symptom#
A program spawns claude <prompt> in a fresh directory (here a copy-on-write workspace clone) inside a PTY. No hook event ever arrives and the screen shows: Accessing workspace: <path> / Quick safety check: Is this a project you created or one you trust? ... ❯ No, exit / Yes, I trust this folder. The session waits forever for a keypress.
Cause#
Claude records folder trust per exact path in ~/.claude.json under projects.<path>.hasTrustDialogAccepted. A clone of a trusted repository at a new path is untrusted, even under a trusted parent.
Fix#
Either answer the dialog once through the terminal (Down then Enter selects "Yes, I trust this folder"), or before the spawn mark the new path trusted in ~/.claude.json by copying the repository's entry: projects[new_path] = {"hasTrustDialogAccepted": true}. After the answer the entry for the new path appears with hasTrustDialogAccepted: true.
Evidence#
rmaestro real run, 2026-10-15, claude 2.1.301: the pane sat on the dialog for over a minute with no hook events; after Down and Enter through the pane input the session ran the task and ~/.claude.json held both the repo path and the workspace path with hasTrustDialogAccepted: True.