Skip to content

Claude Code. Any Model. The most powerful AI coding agent now speaks every language.

add code search enigine

Jack Rudenkoe97180886f5e
diff --git a/.claude/profiles.json b/.claude/profiles.json
index 20529fe0..737d4997 100644
--- a/.claude/profiles.json
+++ b/.claude/profiles.json
@@ -69,7 +69,24 @@
},
"createdAt": "2026-09-28T04:06:00.113Z",
"settings": {
- "outputStyle": "composed"
+ "outputStyle": "composed",
+ "code-search": {
+ "engine": "codegraph",
+ "setup": "active",
+ "engines": {
+ "codegraph": {
+ "command": "codegraph",
+ "args": [
+ "serve",
+ "--mcp"
+ ],
+ "env": {
+ "CODEGRAPH_MCP_TOOLS": "explore,node,search,callers,callees,impact,files,status"
+ },
+ "callTimeoutMs": 30000
+ }
+ }
+ }
}
}
},
diff --git a/.gitignore b/.gitignore
index ed0d5430..64a3c82a 100644
--- a/.gitignore
+++ b/.gitignore
@@ -129,3 +129,4 @@ gtd/sessions/
# magus: generated profile config (source of truth: .claude/profiles.json)
.claude/.magus-backups/
+.codegraph/
diff --git a/CLAUDE.md b/CLAUDE.md
index b776aaa1..e1f5b7b0 100644
--- a/CLAUDE.md
+++ b/CLAUDE.md
@@ -255,3 +255,42 @@ for rationale. Three write-ups already died this way.
Set work aside with a temporary WIP commit, or copy the file out and back. To revert a
file for a mutation test, copy it — do not use git.
- Deep rationale goes in `ai-docs/architecture/`, not here. Add it there and name the trigger in the list above.
+
+## Code Search
+
+Added by the `code-search` plugin.
+
+### The tool surface
+
+| Tool | Present | Takes |
+|---|---|---|
+| `code_search` | always | `query` (free-form), `intent`, `scope` |
+| `find_dependencies`, `find_dependents`, `call_tree`, `find_implementations`, `impact` | only when the configured engine genuinely supports that operation | `symbol`, `depth` / `max_depth`, `scope` |
+| `Read`, `Grep`, `Glob` | always | — |
+
+**Read the tool list; never assume a structural tool exists.** Absence means the configured
+engine cannot answer that class of question at all — not that it would be slower or
+approximate. Say so in the report and answer with what is present.
+
+`code_search` infers intent from the query, so write the real question. Pass `intent` only to
+override an inference you have watched go wrong. Every response names the capability that
+served it — read that field.
+
+### Routing
+
+| The request is about | Route to |
+|---|---|
+| meaning, behaviour or a flow | `code_search` |
+| the shape of the system, or a **named** symbol and what touches it | `code_search`, then the structural tools |
+| an exact literal, an occurrence count, or a filename pattern | `Grep` / `Glob` |
+
+Text search is the correct tool for the third row — that is routing, not a fallback. The rule
+is to name the method behind each finding, never to avoid a tool.
+
+### Discipline
+
+- Search before reading. Three or more files in one investigation means one ranked query first.
+- Read only the line ranges returned, and re-resolve them before acting — edits move them.
+- Never rank-truncate a result set; narrow with `scope` instead.
+- An error and an empty result look alike and mean opposite things. Establish which you have.
+- Centrality is tiers, not a threshold. Absent centrality means unknown, not low.