# ox doctor (https://test.sageox.ai/docs/cli/doctor)

# ox doctor

Run diagnostics on your SageOx setup to identify configuration issues, verify authentication, and check repository health.

## Usage

<Terminal>
  <TerminalCommand>ox doctor [--verbose]</TerminalCommand>
</Terminal>

## What It Checks

### Authentication
- Valid session token
- Token expiration
- Correct permissions

### Repository Registration
- Repository is registered with SageOx
- Local configuration matches server
- Repository exists on platform

### Context Injection
- Context injection is configured
- CLAUDE.md and context files are set up
- Context can be retrieved from server

### Session Uploads
- Coding sessions cached locally have reached the Ledger
- Pending uploads left behind by an earlier failure are retried

This check repairs itself: when `ox doctor` finds sessions that never finished
uploading, it retries them for you rather than only reporting the backlog. If
SageOx has told you that your coding sessions stopped arriving, this is the
check that clears it.

## Output

| Symbol | Meaning |
|--------|---------|
| `[OK]` | Check passed |
| `[WARN]` | Non-critical issue |
| `[FAIL]` | Critical issue |

<Terminal title="ox doctor">
  <TerminalOutput>SageOx Doctor</TerminalOutput>
  <TerminalOutput>=============</TerminalOutput>
  <TerminalOutput> </TerminalOutput>
  <TerminalOutput>Authentication</TerminalOutput>
  <TerminalOutput>  [OK] Logged in as user@example.com</TerminalOutput>
  <TerminalOutput> </TerminalOutput>
  <TerminalOutput>Repository</TerminalOutput>
  <TerminalOutput>  [OK] Repo registered: my-project</TerminalOutput>
  <TerminalOutput> </TerminalOutput>
  <TerminalOutput>Context Injection</TerminalOutput>
  <TerminalOutput>  [OK] Context injection enabled</TerminalOutput>
  <TerminalOutput> </TerminalOutput>
  <TerminalOutput>All checks passed.</TerminalOutput>
</Terminal>

## Verbose Mode

<Terminal>
  <TerminalCommand>ox doctor --verbose</TerminalCommand>
</Terminal>

Shows config paths, API endpoints, and full server responses.

## Exit Codes

| Code | Meaning |
|------|---------|
| 0 | All checks passed |
| 1 | One or more checks failed |

## Common Issues

**Not Authenticated** - Run `ox login`

**Repository Not Registered** - Run `ox init`

**Expired Token** - Run `ox login`

**Sessions Not Arriving** - Run `ox doctor --fix` in the affected repository to retry pending uploads and repair what it can. If sessions still don't arrive, share the output of `ox doctor --json` with SageOx support.

## Related Commands

- [ox login](/docs/cli/auth) - Authenticate with SageOx
- [ox init](/docs/cli/init) - Initialize repository
- [ox prime](/docs/cli/prime) - Context injection for agents
