244f70aae5
Follow-up on the salvaged #64611 commit: the original guard blocked the install tree unconditionally, which would have broken the legitimate 'developing Hermes from a source clone' CLI flow (launching hermes inside the repo and getting its AGENTS.md as project context). Refined policy: - resolve_context_cwd(): validates configured paths (missing dir -> None + warning) but honors an EXPLICIT install-tree cwd verbatim — deliberate user choice. - build_context_files_prompt(): blocks only the cwd=None -> os.getcwd() FALLBACK into the install tree, with a new allow_install_tree_fallback param. system_prompt.py passes it for platform cli/tui (launch dir is the user's real shell cwd there); desktop/gateway surfaces keep the guard (their fallback dir is self-spawned, never user-picked). - Warning log names the resolved dir and the terminal.cwd remedy. E2E-verified all five scenarios: desktop fallback blocked, in-tree CLI dev keeps AGENTS.md, explicit install-tree cwd honored, invalid TERMINAL_CWD falls to None then blocked, normal workspace loads.