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
Run from any initialized repository. The index lives locally on your machine.
What gets indexed
| Source | Content | Command |
|---|---|---|
| Git history | Commits, diffs, file changes | ox index code |
| Code symbols | Functions, types, classes | ox index code |
| GitHub PRs | Titles, descriptions, comments, review threads | ox index github |
| GitHub issues | Titles, descriptions, labels, comments | ox index github |
Subcommands
ox index code
Index git history and code symbols from your repository.
| Flag | Description |
|---|---|
--full | Force a complete re-index, ignoring cached state |
Without --full, indexing is incremental -- only new commits since the last index are processed.
ox index github
Index PRs and issues from your GitHub repository.
| Flag | Description |
|---|---|
--full | Force a complete re-index |
--prs-only | Index only pull requests |
--issues-only | Index only issues |
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 issuesCodeDB 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.
| Flag | Description |
|---|---|
--limit | Maximum number of results (default: 20) |
--full-json | Output full result details as JSON |
Example searches
Related ox code commands
The ox code command group provides shortcuts for common indexing operations.
| Command | Equivalent | Description |
|---|---|---|
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 |
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
- ox prime -- Activate context injection for AI coworkers
- ox distill -- Process GitHub activity into Team Context
- Claude Code integration -- How CodeDB enhances AI coding sessions

