The contract
- Search before you SELECT. Start with
duckbrain search "<terms>" [facets]— never guess schemas or scan tables first. - Filter first, rank second. Use the four facets (
--source,--in,--since/--until,--person) to shrink the pool before relevance does the rest. - Budget your context. Use
duckbrain context "<query>" --budget <chars>for prompt-ready blocks instead of raw row dumps. - Hydrate last. Snippets are ~400 chars; drill into full records only for the hits that matter.
- Read-only by default. Direct SQL access:
duckdb -init ~/.duckbrain/default/state.sqlattaches the lake read-only and definesbrain_search(query).
Anti-patterns
SELECT * FROM raw_records— floods context; always search first.- Re-ranking by re-querying with tiny variations — adjust facets instead.
- Parsing user questions into flags with a model — compose flags directly from intent.