/** * Shared agent-facing CodeGraph usage guide. * * This body is reused by: * - MCP `initialize` instructions * - installer-generated AGENTS/CLAUDE/rules files * * Keep this tight. It is read on every session. */ export declare const CODEGRAPH_GUIDE_BODY = "## CodeGraph\n\nThis project has a CodeGraph MCP server (`codegraph_*` tools) configured. CodeGraph is a SQLite knowledge graph of every symbol, edge, and file in the workspace. Reads are sub-millisecond; the index lags writes by about a second through the file watcher.\n\nPrimary goal: help LLM agents narrow decision space fast. Use it to reduce retrieval noise before editing, not as a second planner.\n\n### When to prefer codegraph over native search\n\nUse codegraph for **structural** questions \u2014 what calls what, what would break, where is X defined, what is X's signature. Use native grep/read only for **literal text** queries (string contents, comments, log messages) or after you already have a specific file open.\n\n| Question | Tool |\n|---|---|\n| \"Where is X defined?\" / \"Find symbol named X\" | `codegraph_search` |\n| \"What is this task / feature / area about?\" | `codegraph_context` |\n| \"I need the first hop for a coding task, but do not yet know the right ArkTS entry / bridge / file to inspect.\" | `codegraph_context` with `mode: \"task\"` |\n| \"How does X reach/become Y? / trace the flow from X to Y\" | `codegraph_trace` |\n| \"What calls function Y?\" | `codegraph_callers` |\n| \"What does Y call?\" | `codegraph_callees` |\n| \"What would break if I changed Z?\" | `codegraph_impact` |\n| \"Show me Y's signature / source / docstring\" | `codegraph_node` |\n| \"Survey an unfamiliar module/topic\" | `codegraph_explore` |\n| \"What files exist under path/\" | `codegraph_files` |\n| \"Is the index healthy?\" | `codegraph_status` |\n\n### Default LLM-first flow\n\n- Start with `codegraph_context` when you need a broader task-level picture.\n- Start with `codegraph_context` plus `mode: \"task\"` when the task is implementation-oriented and you need a lower-noise first hop before choosing which symbols or files to inspect.\n- Treat `context(mode=\"task\")` as a **locate** step: use it to narrow one unresolved structural question such as `target`, `owner`, `chain`, or `boundary`, not to dump every related fact.\n- If the unresolved question is \"how does this reach that?\", use `codegraph_trace`.\n- If the unresolved question is \"what exactly is this surfaced symbol/file?\", use `codegraph_node`.\n- If the unresolved question is \"who depends on this seam?\", use `codegraph_callers`, `codegraph_callees`, or `codegraph_impact`.\n- Use `codegraph_explore` only when the area is genuinely unfamiliar and you need a broader source survey.\n\n### Tool choice shortcuts\n\n- Use `codegraph_context` with `mode: \"task\"` for coder-style work where the endpoint is not fully known yet and you want likely entry points, bridge hops, convergence points, and a compact first slice without a large context dump.\n- Use plain `codegraph_context` for planner-style or subsystem-orientation work where you want a wider structural picture, not just the first actionable path.\n- Use `codegraph_trace` after `context(mode=\"task\")` or plain `context` has surfaced plausible endpoints and you now want the explicit path.\n- Use `codegraph_node` after `context(mode=\"task\")` when the next step is to read one surfaced symbol or file directly.\n- Use `codegraph_explore` only after the lightweight tools still leave the area ambiguous.\n\n### Rules of thumb\n\n- **Trust codegraph results.** Do NOT re-verify them with grep unless you need literal text not carried by the graph.\n- **Don't grep first** when looking up a symbol by name. `codegraph_search` is faster and returns kind + location + signature in one call.\n- **Don't chain `codegraph_search` + `codegraph_node`** when you just want context \u2014 `codegraph_context` is one call.\n- **Prefer `codegraph_context` with `mode: \"task\"`** when a coding task needs a lower-noise locate slice rather than a full exploration dump. Follow with `codegraph_trace` once `context` surfaces concrete endpoints. It is not a planner and should not assign steps.\n- **Use `codegraph_explore`** for broad unfamiliar areas, not narrow lookups or first-hop implementation work.\n- **Avoid `codegraph_files` and `codegraph_status`** in normal retrieval loops. Use them for explicit path inventory, index health, or debugging the tool itself.\n- **Trust structured short output first.** `context` and `impact` are designed to narrow retrieval space directly for LLM use.\n- **Use native grep/read only as literal confirmation.** Once codegraph has surfaced the file/symbol set, use `rg` only for exact strings, resource keys, config keys, or log text.\n- **Don't degrade into grep loops.** If codegraph already surfaced relevant symbols/files, continue from those results instead of restarting broad text search.\n- **One unresolved structural question per hop.** If one `context(mode=\"task\")` call already closed `target`, `owner`, `chain`, and `boundary`, stop searching and read the narrowed code directly.\n- **Stop when you can read or patch.** Do not keep exploring for reassurance once the next concrete code read is obvious.\n- **Don't query immediately after editing a file** \u2014 the watcher needs ~500ms to debounce + sync.\n\n### ArkTS notes\n\n- ArkTS is first-class in this fork. Treat `.ets` as ArkTS, not as downgraded TypeScript.\n- ArkTS facts come from the `ArkAnalyzer` dependency, then flow through shared `search` / `context` / `impact` / `callers` / `callees` / `trace`.\n- HarmonyOS-aware relations such as `module.json5`, ability/form declarations, lifecycle entry associations, and narrow `Want/IPC` design-time links are query-visible.\n- ArkTS mixed-language bridge paths are valid navigation signals. Use them to move from ArkTS UI code into TS / C++ / Rust bridge layers.\n- `Want/IPC` is structure-only in this fork. It is not a full runtime propagation, full IPC precision graph, or cross-process dataflow graph.\n- Treat ability / form / lifecycle / bridge relations as context-narrowing hints for coding and design work, not as exhaustive runtime truth.\n\n### If `.codegraph/` doesn't exist\n\nThe MCP server returns \"not initialized.\" Ask the user: *\"I notice this project doesn't have CodeGraph initialized. Want me to run `codegraph init -i` to build the index?\"*"; //# sourceMappingURL=agent-instructions.d.ts.map