Documentation
CLICommands

ox query

Search across your team's accumulated knowledge: discussions, docs, session history, and optionally local code or the locally-cached Ledger.

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 code index--source code or --source all
Local LedgerLocally-cached Ledger only, with zero network (fast hook path)--local or --source local

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 searchProject config, else the credential's team
--repoRepo ID to search (searches Ledger)From project config
--modeSearch mode: hybrid, knn, or bm25hybrid
--sourceSearch source: team, code, local, or allteam
--localSearch the locally-cached Ledger only (zero network)—
--jsonEmit machine-readable JSONOn in agent context

Examples

terminal
# Return up to 10 results
$
# Search the local code index only
$
# Search the locally-cached Ledger, with no network call
$
# Same, as JSON
$

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 <agent_id> query instead of ox query. The behavior is identical, but the agent form 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 <agent_id> 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 <agent_id> query
Human exploring team knowledgeox query

ox agent 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.

What's next

  • ox agent prime: Load team context at session start
  • ox doctor: Diagnose configuration issues
  • ox init: Initialize a repository (needed to search local code: --source code or --source all)