SageOx

The hivemind for agentic engineering

ox query

Search across your team's accumulated knowledge — discussions, docs, session history, and optionally local code.

Usage

terminal
$

Returns the most relevant chunks from your team's indexed content, ranked by relevance.

What gets searched

SourceWhat it includesControlled by
Team ContextDiscussions, team docs, distilled memory, AGENTS.md--source team (default)
LedgerSession history, commit summaries, code decisions--repo flag
CodeLocal repository files--source code or --source all

By default, ox query searches Team Context only. Add --source all to include local code in the search.

Flags

FlagDescriptionDefault
-k, --limitMax results to return5
--teamTeam ID to searchCurrent team
--repoRepo ID to search (searches Ledger)
--modeSearch mode: hybrid, knn, or bm25hybrid
--sourceSearch source: team, code, or allteam

Example output

ox query
$
[1] score: 0.92 type: doc
Error Handling Guide
All API errors return a JSON body with code and message fields...
[2] score: 0.87 type: discussion
Discussion: API Review (2024-01-15)
We decided to use structured error codes instead of HTTP status...
[3] score: 0.81 type: memory
Weekly Summary (2024-01-12)
Team standardized on returning 4xx for client errors with...

Search modes

ModeHow it worksBest for
hybridCombines semantic similarity (knn) with keyword matching (bm25)Most queries — balances meaning and exact terms
knnPure vector similarity searchConceptual questions ("how do we approach X?")
bm25Pure keyword matchingExact term lookup ("what is PARCEL_ID?")

Hybrid mode is the default and works well for most queries. Use --mode knn when searching for concepts without specific terminology, and --mode bm25 when you know the exact terms you're looking for.

terminal
# Semantic search for concepts
$
# Keyword search for specific terms
$

Searching across teams and repos

Search a specific team's context:

terminal
$

Search a repo's Ledger (session history and code decisions):

terminal
$

Agent version

AI coworkers use ox agent query instead of ox query. The behavior is identical, but ox agent query includes agent telemetry (agent ID, agent type) for observability.

terminal
# Human usage
$
# AI coworker usage (includes telemetry)
$

When building prompts or CLAUDE.md instructions for AI coworkers, use ox agent query so that queries are attributed to the agent session.

When to use query vs. prime

ScenarioUse
Start of session — load team normsox agent prime
Mid-session — find specific knowledgeox agent query
Human exploring team knowledgeox query

ox prime loads the core context files (AGENTS.md, SOUL.md, etc.) at session start. ox query searches the full corpus — discussions, docs, memory — for specific information during a task.

  • ox prime — Load team context at session start
  • ox doctor — Diagnose configuration issues
  • ox init — Initialize repository (required for query)