sx search
Run focused searches with sx and return actionable results.
workflow
- •Always check index coverage first:
sx status. - •If status is not indexed, do not run search yet. Tell the user to index first with:
- •
sx index . - •Then re-run:
sx status
- •
- •Form a concise query from the user request. Use
|for alternation (e.g."ACLLoad|ACLSetUser|load"). - •Run
sx "<query>"first. Add a path after the query to scope results:sx "query" src/acl.c. - •If results are noisy, narrow with
--path,--ext,--k. - •Use
--snippetwhen context is needed. - •Use
--jsonwhen output needs to be parsed or reused by tools. - •Return top matches with path, line number, and short context.
command patterns
bash
sx status sx index . sx "replication backlog" sx "ACLLoad|ACLSetUser|ACLParse|load" # alternation sx "ACLLoad|ACLSetUser" src/acl.c # alternation + path scope sx --path src/ "timeout logic" sx --ext .py,.md "config parser" sx --snippet "aof fsync" sx --k 20 "cluster state" sx --json "slot migration"
response format
- •Show best hits first.
- •Include file path and line when available.
- •Keep snippets short and relevant.
- •If nothing is found, suggest one tighter and one broader query.
guardrails
- •Prefer precise terms from the user’s domain.
- •Add path/extension filters before increasing
--ktoo much. - •Avoid speculative conclusions; report what the matches actually show.