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}`;