SageOx

The hivemind for agentic engineering

ox index

Build searchable indexes from your codebase. ox index creates CodeDB -- a local database of commits, symbols, diffs, PRs, and issues that your AI coworker can query during sessions.

Usage

terminal
$

Run from any initialized repository. The index lives locally on your machine.

What gets indexed

SourceContentCommand
Git historyCommits, diffs, file changesox index code
Code symbolsFunctions, types, classesox index code
GitHub PRsTitles, descriptions, comments, review threadsox index github
GitHub issuesTitles, descriptions, labels, commentsox index github

Subcommands

ox index code

Index git history and code symbols from your repository.

terminal
$
FlagDescription
--fullForce a complete re-index, ignoring cached state

Without --full, indexing is incremental -- only new commits since the last index are processed.

terminal
# Index the current repository
$
terminal
# Index a specific repository by URL
$
terminal
# Force a full re-index
$

ox index github

Index PRs and issues from your GitHub repository.

terminal
$
FlagDescription
--fullForce a complete re-index
--prs-onlyIndex only pull requests
--issues-onlyIndex only issues
terminal
# Index all GitHub activity
$
terminal
# Index only PRs
$

Where the index lives

CodeDB stores indexes locally in your repository's .sageox/codedb/ directory. The index never leaves your machine -- your AI coworker queries it locally during sessions.

.sageox/
└── codedb/
    ├── commits.db      # Git history and diffs
    ├── symbols.db      # Code symbols and definitions
    └── github.db       # PRs and issues

CodeDB is local-only by design. Your code and git history stay on your machine. SageOx servers never see your source code.

Incremental vs full re-index

By default, ox index runs incrementally:

  • Code: Indexes only commits since the last run
  • GitHub: Fetches only PRs and issues updated since the last run

Use --full when:

  • The index seems stale or incomplete
  • You've changed indexing configuration
  • You want to rebuild from scratch after a major refactor

Full re-indexing takes longer but ensures the index matches your current repository state.

Searching the index

Once indexed, use ox code search to query CodeDB.

terminal
$
FlagDescription
--limitMaximum number of results (default: 20)
--full-jsonOutput full result details as JSON

Example searches

terminal
# Find functions related to user auth
$
terminal
# Search for recent changes to the API
$
terminal
# Get JSON output for scripting
$

The ox code command group provides shortcuts for common indexing operations.

CommandEquivalentDescription
ox code index [url]ox index code [url]Alias for indexing code
ox code search <query>--Search the CodeDB index
ox code status--Show index status and stats
terminal
# Check index status
$

How AI coworkers use CodeDB

When you start a coding session with ox prime or ox session start, your AI coworker gains access to CodeDB queries. This enables:

  • Semantic search -- find code by meaning, not just text matching
  • History queries -- "when did this behavior change?" answered from git history
  • Cross-reference navigation -- understand how modules connect across the codebase
  • PR/issue context -- reference decisions from code review threads

Without CodeDB, AI coworkers rely on grep and file reads. With it, they navigate your codebase with precision.

Troubleshooting

"Repository not initialized" -- Run ox init first to connect your repository to SageOx.

"No commits to index" -- The repository needs at least one commit. If you're starting fresh, make an initial commit first.

"GitHub rate limited" -- GitHub API has rate limits. Wait and retry, or use --prs-only or --issues-only to reduce API calls.

Stale search results -- Run ox index code to pick up recent commits. Use --full if incremental indexing isn't catching changes.

What's next