DevQL Explore First
Do not use sed, rg, grep, find, wc, directory crawling, or broad
source-file reads to discover task-relevant code while DevQL can answer the
lookup. Use traditional tools only to:
- read bounded ranges returned by DevQL
- inspect files you are editing after DevQL selected them
- run tests or git/status commands
- fall back when DevQL fails, is empty, or contradicts the task
Do not run bitloops devql --help or bitloops devql query --help.
Choose the most specific selector:
- known
symbolFqn: use symbolFqn
- known file or file range: use
path, optionally with lines
- single concrete identifier, method name, literal, error code, path-like
string, or copied snippet: use
searchMode: LEXICAL
- architecture role terms such as API endpoint, command handler, repository,
adapter, or boundary: use
searchMode: ARCHITECTURE
- multiple related terms, behavior, concept, or task keywords without one exact
anchor: omit
searchMode and use default AUTO
Fuzzy symbol-name lookup is included in the lexical lane; do not use a separate
fuzzy selector.
Use compact exploration queries. If the prompt has no concrete anchor, start
with the default AUTO query:
bitloops devql query '{ selectArtefacts(by: { search: "<short behavior phrase or task keywords>" }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'
bitloops devql query '{ selectArtefacts(by: { search: "<single identifier, literal, path fragment, or short snippet>", searchMode: LEXICAL }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'
bitloops devql query '{ selectArtefacts(by: { symbolFqn: "<symbol-fqn>" }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'
bitloops devql query '{ selectArtefacts(by: { path: "<repo-relative-path>", lines: { start: <start>, end: <end> } }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'
For architecture role context on a known file, use the minimal GraphQL shape and
request role fields only unless target or rule metadata is needed:
bitloops devql query '{ selectArtefacts(by: { path: "<repo-relative-path>" }) { architectureRoles(first: 10) { items(first: 10) { role { canonicalKey displayName family description } target { symbolFqn canonicalKind } } } } }'
bitloops devql query '{ selectArtefacts(by: { symbolFqn: "<symbol-fqn>" }) { architectureRoles(first: 10) { items(first: 10) { role { canonicalKey displayName family description } target { symbolFqn canonicalKind } } } } }'
If DevQL returns relevant paths and line ranges:
- read only about 50 lines before and after those ranges
- do not duplicate the same search with
rg, grep, glob, or find
- for each new exploration question, query DevQL again instead of switching to
grep/glob/find
- fall back to normal search only if DevQL fails, is empty, or contradicts the task
- use at most 3 DevQL calls before each bounded source-read phase
1---2name: devql-explore-first3description: Use always before codebase exploration, bug fixing, SWE-bench tasks, locating symbols, files, or tests, or before using rg, grep, sed, find, or source-file reads in a repository.4---56# DevQL Explore First78<VERY_IMPORTANT>9For code understanding and exploration, DevQL is the primary discovery tool, not10a one-time preflight. Use `bitloops devql query ...` whenever locating symbols,11files, tests, implementations, callers/usages, or the next source region to12inspect.13</VERY_IMPORTANT>1415Do not use `sed`, `rg`, `grep`, `find`, `wc`, directory crawling, or broad16source-file reads to discover task-relevant code while DevQL can answer the17lookup. Use traditional tools only to:1819- read bounded ranges returned by DevQL20- inspect files you are editing after DevQL selected them21- run tests or git/status commands22- fall back when DevQL fails, is empty, or contradicts the task2324Do not run `bitloops devql --help` or `bitloops devql query --help`.2526Choose the most specific selector:2728- known `symbolFqn`: use `symbolFqn`29- known file or file range: use `path`, optionally with `lines`30- single concrete identifier, method name, literal, error code, path-like31 string, or copied snippet: use `searchMode: LEXICAL`32- architecture role terms such as API endpoint, command handler, repository,33 adapter, or boundary: use `searchMode: ARCHITECTURE`34- multiple related terms, behavior, concept, or task keywords without one exact35 anchor: omit `searchMode` and use default `AUTO`3637Fuzzy symbol-name lookup is included in the lexical lane; do not use a separate38fuzzy selector.3940Use compact exploration queries. If the prompt has no concrete anchor, start41with the default `AUTO` query:4243```bash44bitloops devql query '{ selectArtefacts(by: { search: "<short behavior phrase or task keywords>" }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'45bitloops devql query '{ selectArtefacts(by: { search: "<single identifier, literal, path fragment, or short snippet>", searchMode: LEXICAL }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'46bitloops devql query '{ selectArtefacts(by: { symbolFqn: "<symbol-fqn>" }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'47bitloops devql query '{ selectArtefacts(by: { path: "<repo-relative-path>", lines: { start: <start>, end: <end> } }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score } } }'48```4950For architecture role context on a known file, use the minimal GraphQL shape and51request role fields only unless target or rule metadata is needed:5253```bash54bitloops devql query '{ selectArtefacts(by: { path: "<repo-relative-path>" }) { architectureRoles(first: 10) { items(first: 10) { role { canonicalKey displayName family description } target { symbolFqn canonicalKind } } } } }'55bitloops devql query '{ selectArtefacts(by: { symbolFqn: "<symbol-fqn>" }) { architectureRoles(first: 10) { items(first: 10) { role { canonicalKey displayName family description } target { symbolFqn canonicalKind } } } } }'56```5758If DevQL returns relevant paths and line ranges:5960- read only about 50 lines before and after those ranges61- do not duplicate the same search with `rg`, `grep`, `glob`, or `find`62- for each new exploration question, query DevQL again instead of switching to63 grep/glob/find64- fall back to normal search only if DevQL fails, is empty, or contradicts the task65- use at most 3 DevQL calls before each bounded source-read phase