Using DevQL
Overview
DevQL is Bitloops's typed repo-intelligence surface. In repos where this guidance is enabled, use DevQL first for repo-understanding questions when it is available in the current session. If DevQL returns nothing useful or is not available, fall back to targeted repo search or file reads.
When to Use
- understanding what a file, function, module, class, or symbol does
- resolving the concrete artefacts matched by a path or line range
- looking up an exact symbol with
symbolFqn - looking up identifiers, literals, paths, or snippets with
searchplussearchMode: LEXICAL - looking up an approximate name or conceptual behavior with
searchin the defaultAUTOmode - answering architecture questions after selecting a concrete area
Choosing The by Selector
path: use this when the starting point is one file; Bitloops selects artefacts from that file.path + lines: use this when the starting point is a specific region inside a file; Bitloops limits the seed artefacts to that line range.symbolFqn: use this when the starting point is one exact artefact or symbol.search: use this when you do not yet have an exact seed. UsesearchMode: LEXICALfor identifiers, literals, file-ish strings, and snippets. Keep the defaultAUTOmode for approximate or conceptual search. UseIDENTITY,ARCHITECTURE,CODE, orSUMMARYonly when you need advanced narrowing.
Process
- Choose the most specific selector available:
path,path + lines, orsymbolFqnwhen the request is exact;searchwhen you need lookup rather than direct addressing. - If the request is an identifier, literal, path-like string, or snippet,
distill it and run
searchwithsearchMode: LEXICAL. - If the request is approximate or conceptual, distill it to a short phrase
and run
searchin the defaultAUTOmode first. Inspectartefacts(first: 10)and, when useful,searchBreakdown(first: 3)to see which retrieval mode is carrying the result. - Reserve
searchMode: IDENTITY,ARCHITECTURE,CODE, orSUMMARYfor advanced narrowing whenAUTOis broad but you already know which representation is likely to matter. - Once you have a concrete file or artefact, run
overview. - If the response includes
expandHint,schema, or another typed follow-up hint, read that hint before composing the next query. - Expand only one relevant stage or
artefacts(first: ...)if the overview shows that more detail is needed. - When DevQL returns
path,startLine, andendLine, use a bounded read around that range first: start about 20 lines beforestartLineand stop about 40 lines afterendLine. Escalate to a full-file read only when the bounded context is insufficient. - If DevQL returns nothing useful, fall back to targeted repo search or file reads.
Query Templates
# Use AUTO search first when the request is approximate or conceptual
bitloops devql query '{ selectArtefacts(by: { search: "<distilled conceptual phrase>" }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score summary } searchBreakdown(first: 3) { lexical { path symbolFqn score summary } identity { path symbolFqn score summary } code { path symbolFqn score summary } summary { path symbolFqn score summary } } } }'
# Use LEXICAL search for identifiers, literals, paths, or snippets
bitloops devql query '{ selectArtefacts(by: { search: "<identifier or snippet>", searchMode: LEXICAL }) { count artefacts(first: 10) { path symbolFqn canonicalKind startLine endLine score summary } } }'
# Ask for overview once the selection is concrete
bitloops devql query '{ selectArtefacts(by: { symbolFqn: "<symbol-fqn>" }) { overview } }'
# Same overview shape for file or file+line selectors
bitloops devql query '{ selectArtefacts(by: { path: "<repo-relative-path>", lines: { start: <start>, end: <end> } }) { overview } }'
Reading Response Hints
- Treat
overviewas the compact first pass. - Treat
searchBreakdownas anAUTO-only widening tool when the unified top hits are relevant but you want to see which lexical or semantic mode is also surfacing candidates. - When DevQL returns
expandHint,schema, or another typed follow-up hint, read it before composing the next query. - Prefer the hint's suggested parameters and drill-down shape over guessing the next stage call.
Sandbox Execution
- In sandboxed agent environments, run
bitloops devql ...outside the sandbox by default. - These commands rely on Bitloops-managed daemon and runtime state under platform app directories, so they can fail inside a workspace-only sandbox even when DevQL is healthy.
- If your platform requires approval or escalation for out-of-sandbox commands, request it immediately before running
bitloops devql ....
Common Mistakes
- Do not reintroduce obsolete selector names from older DevQL guidance.
- Do not dump the full conversational prompt into
search; distill it. - Do not use conceptual
AUTOsearch for obvious identifiers or snippets whensearchMode: LEXICALis the right tool. - Do not force
IDENTITY,CODE, orSUMMARYunless you are intentionally narrowing an already-understood search problem. - Do not ignore
expandHintor other response hints when DevQL already tells you how to drill down. - Do not read an entire file first when DevQL already returned
path,startLine, andendLine; start with a bounded read around the range, roughly 20 lines beforestartLinethrough 40 lines afterendLine. - Do not start with stage-specific detail queries before selecting a concrete artefact.
- Do not use DevQL for edits, builds, tests, formatting, or git operations.
Integration
- If
overviewshows something relevant, expand only the one stage needed for the current question. - If DevQL is unavailable or empty, switch to targeted
rgor file reads.