---
name: headless-spawn-external-imports-gate
description: "External CLAUDE.md imports dialog is a SECOND headless-spawn gate (stacks with trust dialog) — approve hasClaudeMdExternalIncludesApproved per project key, or spawn from an import-free cwd"
metadata: 
  node_type: memory
  type: project
  originSessionId: ecd15339-2c75-4e4c-ba1a-2c25bd437233
---

2026-07-10 scratch-c bringup stall RCA. An spt-hosted spawn (`spt endpoint run` → `claude-spt launch` → `claude --remote-control … --dangerously-skip-permissions` in broker PTY) hangs UNBOUND forever when CC shows ANY startup dialog: no hooks, no transcript, no session-env, ~1s CPU, blank PTY on late attach (no scrollback replay). TWO stacked gates hit in sequence:

1. **Folder trust** (`hasTrustDialogAccepted` — known F-026/F-027).
2. **External CLAUDE.md imports** — cwd `tools/claude-spt` loads a CLAUDE.md chain importing `spt-claude-code\AGENTS.md` (outside cwd) → "Allow external CLAUDE.md file imports?" interactive confirm. Keys: `hasClaudeMdExternalIncludesApproved` + `hasClaudeMdExternalIncludesWarningShown` on the PROJECT entry in the resolved config root's `.claude.json`.

**Why:** fixing trust alone leaves the spawn stuck on gate 2; both must be pre-seeded for any cwd whose CLAUDE.md imports outside itself (any subdir of a repo using `@AGENTS.md` at root!).

**How to apply:** before spt-hosted spawns, pre-seed BOTH flags + trust on the spawn cwd's project key (AND the repo-root key — CC keys some state to the enclosing root) in the resolved config root (bare `ccs` → `~/.ccs/instances/bigscreen`), atomic tmp+`os.replace` per [[claudejson-write-hazard]]. Alternative: spawn from an import-free cwd (scratchpad dirs — the proven wakep/rc44 pattern). Diagnosis trick: reproduce the spawn in a REAL window (`Start-Process claude …` with `CLAUDE_CONFIG_DIR` set) + screenshot — PTY attach shows nothing (no backlog), a window shows the actual dialog. Related: [[f027-trust-seam-groundtruth]].
