Skip to content

Commit 5a7c6cb

Browse files
committed
docs: document routing hint behavior
1 parent 3e1cc68 commit 5a7c6cb

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

README.md

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,12 +132,13 @@ src/api/checkout.ts:89 (Route handler for /pay)
132132
| Don't know the function name | `codebase_search` | Semantic search finds by meaning |
133133
| Exploring unfamiliar codebase | `codebase_search` | Discovers related code across files |
134134
| Just need to find locations | `codebase_peek` | Returns metadata only, saves ~90% tokens |
135+
| Need the authoritative definition site | `implementation_lookup` | Prioritizes real implementation definitions over docs/tests |
135136
| Understand code flow | `call_graph` | Find callers/callees of any function |
136137
| Know exact identifier | `grep` | Faster, finds all occurrences |
137138
| Need ALL matches | `grep` | Semantic returns top N only |
138139
| Mixed discovery + precision | `/find` (hybrid) | Best of both worlds |
139140

140-
**Rule of thumb**: `codebase_peek` to find locations → `Read` to examine → `grep` for precision.
141+
**Rule of thumb**: `codebase_peek` to find locations → `Read` to examine → `grep` for precision. For symbol-definition questions, use `implementation_lookup` first.
141142

142143
## 📊 Token Usage
143144

@@ -296,6 +297,12 @@ The plugin exposes these tools to the OpenCode agent:
296297
```
297298
- **Workflow**: `codebase_peek` → find locations → `Read` specific files
298299

300+
### `implementation_lookup`
301+
**Definition-first lookup.** Jumps to the authoritative definition site for a symbol or natural-language definition query.
302+
- **Use for**: "Where is X defined?", symbol-definition requests, and cases where you want the implementation site rather than all usages.
303+
- **Behavior**: Prefers real implementation files over tests, docs, examples, and fixtures.
304+
- **Fallback**: If nothing authoritative is found, use `codebase_search` for broader discovery.
305+
299306
### `find_similar`
300307
Find code similar to a provided snippet.
301308
- **Use for**: Duplicate detection, refactor prep, pattern mining.
@@ -530,7 +537,8 @@ Zero-config by default (uses `auto` mode). Customize in `.opencode/codebase-inde
530537
"fusionStrategy": "rrf", // rrf | weighted
531538
"rrfK": 60, // RRF smoothing constant
532539
"rerankTopN": 20, // Deterministic rerank depth
533-
"contextLines": 0 // Extra lines before/after match
540+
"contextLines": 0, // Extra lines before/after match
541+
"routingHints": true // Runtime nudges for local discovery/definition queries
534542
},
535543
"reranker": {
536544
"enabled": false,
@@ -600,6 +608,7 @@ String values in `codebase-index.json` can reference environment variables with
600608
| `rrfK` | `60` | RRF smoothing constant. Higher values flatten rank impact, lower values prioritize top-ranked candidates more strongly |
601609
| `rerankTopN` | `20` | Deterministic rerank depth cap. Applies lightweight name/path/chunk-type rerank to top-N only |
602610
| `contextLines` | `0` | Extra lines to include before/after each match |
611+
| `routingHints` | `true` | Inject lightweight runtime hints for local conceptual discovery and definition lookups. Set to `false` to disable plugin-side routing nudges. |
603612
| **reranker** | | Optional second-stage model reranker for the top candidate pool |
604613
| `enabled` | `false` | Turn external reranking on/off |
605614
| `provider` | `"custom"` | Hosted shortcuts: `cohere`, `jina`, or `custom` |
@@ -621,6 +630,7 @@ String values in `codebase-index.json` can reference environment variables with
621630
### Retrieval ranking behavior
622631

623632
- `codebase_search` and `codebase_peek` use the hybrid path: semantic + keyword retrieval → fusion (`fusionStrategy`) → deterministic rerank (`rerankTopN`) → optional external reranker (`reranker`) → filtering.
633+
- When `search.routingHints` is enabled (default), the plugin adds tiny per-turn runtime hints for local conceptual discovery and definition queries. Conceptual discovery is nudged toward `codebase_peek` / `codebase_search`, while definition questions are nudged toward `implementation_lookup`. Exact identifier and unrelated operational tasks are left alone.
624634
- `find_similar` stays semantic-only: semantic retrieval + deterministic rerank only (no keyword retrieval, no RRF).
625635
- For compatibility rollbacks, set `search.fusionStrategy` to `"weighted"` to use the legacy weighted fusion path.
626636
- When enabled, the external reranker sees path metadata plus a bounded on-disk code snippet for each candidate so it can distinguish real implementations from docs/tests more reliably.

0 commit comments

Comments
 (0)