px0 brain searchreturns passages. Use it when you want to find the source.px0 brain askreturns an answer built from those passages. Use it when you want the point.
Search for passages
path#anchor and a relevance score, followed by a snippet. The anchor is a heading slug, so the reference points at a section rather than a whole file - which is what makes citations useful and what lets provenance track a specific claim.
Words are OR-matched, so any one of them can hit, and punctuation is safe - it can never be read as query syntax. Non-ASCII works too: Devanagari, CJK, and accented Latin all match, and accents fold both ways, so cafe finds café and the reverse.
--k sets how many passages come back, defaulting to retrieval.k_default (5).
Narrow by kind
Every file px0 wrote records what it is in its frontmatter -blog, paper, doc, video, or stub. Filter to one:
--kind never matches them - in a vault that is most of your notes. When a --kind search finds nothing, the output says so explicitly rather than looking like an empty brain.
Ask a question
ask retrieves the relevant passages and generates an answer from them. Add --sources to print the path#anchor list alongside the answer, which is how you check that the answer came from where you expected:
ask is deliberately narrow. It touches no connectors and no guidelines - it is retrieval plus generation over your brain and nothing else. If you want a question answered and posted somewhere, that is a workflow.
Asks are recorded like runs
Everyask produces a run record, exactly like a workflow run - with an ask_-prefixed id. It appears in px0 runs list, and px0 runs why <run-id> can explain precisely which passages fed the answer:
Retrieval inside a workflow
A workflow can pull from the brain the same way, with aretrieve: input:
path#anchor so the model can cite them. See Workflow files.
When results are not what you expected
Nothing comes back at all. The index may be empty or stale.px0 doctor reports this directly, and px0 brain reindex fixes it. ask refuses with an actionable message rather than guessing when the index is empty or nothing matched the question.
The right document exists but does not match. The default backend is keyword-based, so a search for “connection pooling” will not surface a passage that says “reusing database connections” - same idea, no shared words. That gap is exactly what the semantic backend is for. See Retrieval backends.
A file you know you saved never appears. Check whether it is under the private folder (brain/work/ by default), which is excluded from every retrieval px0 performs by design.
