From e2f1fe4b2a549118ccc79af63545d60670f85f5e Mon Sep 17 00:00:00 2001 From: Colby Mchenry Date: Fri, 12 Jun 2026 00:20:29 -0500 Subject: [PATCH] =?UTF-8?q?fix(installer):=20instructions=20block=20is=20s?= =?UTF-8?q?cope-neutral=20=E2=80=94=20conditional=20on=20.codegraph/=20exi?= =?UTF-8?q?sting=20(#820)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit A global install writes the block into user-scope files (~/.claude/CLAUDE.md, ~/.codex/AGENTS.md) that apply to EVERY repo the user opens — the unconditional "This repository is indexed" claim was false in unindexed ones and would send subagents into failing codegraph calls, the exact noise the unindexed-session policy (#817) eliminates. Now: "In repositories indexed by CodeGraph (a .codegraph/ directory exists) …" plus an explicit skip-entirely line for the no-index case. Residual: the delegation A/B validated the assertive project-scoped wording; the conditional form keeps the same active ingredients (the codegraph name + both command surfaces in the relay-able slot) — fold a re-check into the next delegation A/B run. Co-authored-by: Claude Opus 4.8 --- src/installer/instructions-template.ts | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/installer/instructions-template.ts b/src/installer/instructions-template.ts index 74fa7ae..54f066e 100644 --- a/src/installer/instructions-template.ts +++ b/src/installer/instructions-template.ts @@ -29,12 +29,23 @@ export const CODEGRAPH_SECTION_START = ''; export const CODEGRAPH_SECTION_END = ''; -/** The full block, markers included, exactly as written to disk. */ +/** + * The full block, markers included, exactly as written to disk. + * + * The wording is deliberately CONDITIONAL ("in repositories indexed by…"): + * a global install writes this into a user-scope file (~/.claude/CLAUDE.md, + * ~/.codex/AGENTS.md) that applies to every project the user opens — + * including unindexed ones, where an unconditional "this repository is + * indexed" claim would send subagents into failing codegraph calls (the + * noise the unindexed-session policy exists to prevent). + */ export const CODEGRAPH_INSTRUCTIONS_BLOCK = `${CODEGRAPH_SECTION_START} ## CodeGraph -This repository is indexed by CodeGraph — a pre-built code knowledge graph. Reach for it BEFORE grep/find or reading files when you need to understand or locate code: +In repositories indexed by CodeGraph (a \`.codegraph/\` directory exists at the repo root), reach for it BEFORE grep/find or reading files when you need to understand or locate code: - **MCP tools** (when available): \`codegraph_explore\` answers most code questions in one call — the relevant symbols' verbatim source plus the call paths between them. \`codegraph_node\` returns one symbol's source + callers, or reads a whole file with line numbers. If the tools are listed but deferred, load them by name via tool search. - **Shell** (always works): \`codegraph explore ""\` and \`codegraph node \` print the same output. + +If there is no \`.codegraph/\` directory, skip CodeGraph entirely — indexing is the user's decision. ${CODEGRAPH_SECTION_END}`;