diff --git a/.changeset/strange-zebras-tan.md b/.changeset/strange-zebras-tan.md new file mode 100644 index 00000000..d5c3c980 --- /dev/null +++ b/.changeset/strange-zebras-tan.md @@ -0,0 +1,5 @@ +--- +"claude-dev": patch +--- + +Adding safety guard for workspace root diff --git a/src/core/mentions/index.ts b/src/core/mentions/index.ts index 0cbe6c85..075f7f5a 100644 --- a/src/core/mentions/index.ts +++ b/src/core/mentions/index.ts @@ -89,6 +89,14 @@ export async function parseMentions( const uniqueMentions = Array.from(new Set(mentions)) for (const mention of uniqueMentions) { + // Safety guard: skip a bare "/" mention. This can surface from parsed strings or tool output and would resolve to the + // workspace root. Expanding it would scan the entire project, inflate context, and can trigger recursive loops. + // If root-level expansion is ever desired, gate it behind an explicit syntax (e.g. "@root" or "@folder:/") + // and enforce strict size/.clineignore limits instead. + if (mention === "/") { + continue + } + if (mention.startsWith("http")) { let result: string if (launchBrowserError) {