From adcb862f8e93b2f3c9ab0a91dcb94f0a68ebbd8f Mon Sep 17 00:00:00 2001 From: Colby Mchenry Date: Fri, 12 Jun 2026 00:24:08 -0500 Subject: [PATCH] fix(cli): explore/node not-indexed error stops agents from running init themselves (#821) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The message said "run 'codegraph init' first" — an instruction-shaped error that invites an agent hitting it (e.g. a subagent following the global instructions block into an unindexed repo) to index the project uninvited: minutes of CPU and a surprise .codegraph/ the user never asked for. Every other layer already encodes indexing-is-the-user's- decision (the MCP NotIndexedError guidance, the inactive instructions, the conditional block); the CLI now matches: continue with your usual tools, do not run init yourself, the project owner can enable it. Co-authored-by: Claude Opus 4.8 --- src/bin/codegraph.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bin/codegraph.ts b/src/bin/codegraph.ts index a4fcbde..b6a3262 100644 --- a/src/bin/codegraph.ts +++ b/src/bin/codegraph.ts @@ -915,7 +915,7 @@ program try { if (!isInitialized(projectPath)) { - error(`CodeGraph not initialized in ${projectPath} — run 'codegraph init' first.`); + error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`); process.exit(1); } @@ -957,7 +957,7 @@ program try { if (!isInitialized(projectPath)) { - error(`CodeGraph not initialized in ${projectPath} — run 'codegraph init' first.`); + error(`CodeGraph isn't available here — no .codegraph/ index exists in ${projectPath}. If you are an AI agent: continue with your usual tools; indexing is the user's decision, do not run it yourself. (The project owner can enable CodeGraph with 'codegraph init'.)`); process.exit(1); }