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

# ox prime

`ox prime` (or `ox agent prime`) injects Team Context into AI coding agents, providing them with domain-specific guidance, architectural decisions, and coding conventions.

## How It Works

When an agent runs `ox prime`:

1. **Fetches Team Context** - Retrieves your team's shared knowledge base from SageOx
2. **Injects Context** - Provides it to the agent in a format it can use
3. **Confirms with Agent ID** - Returns a unique identifier confirming context is active

The agent then has access to:
- Team norms and conventions
- Architectural decisions
- Distilled learnings from past work
- Domain-specific guidance

## Setup

Context injection is automatically configured when you run `ox init` in a repository. The agent needs:

1. Repository initialized with SageOx (`ox init`)
2. Valid authentication (`ox login`)
3. Shell access to run the command

Agents like Claude Code can be configured to run `ox prime` automatically via CLAUDE.md instructions.

## Supported agents

| Agent | Status | How it receives SageOx context |
|-------|--------|-------------------------------|
| **Claude Code** | Supported | `ox agent prime` via CLAUDE.md hook |
| **Conductor** | Supported | `ox agent prime` via orchestrated session |
| **Codex** | Supported | `ox agent prime` via AGENTS.md / setup hook |
| **Gemini CLI** | Planned | `ox agent prime` via AGENTS.md / setup hook |
| **Amp** | Planned | `ox agent prime` via AGENTS.md / setup hook |
| **Pi** | Planned | `ox agent prime` via workspace init |
| **OpenCode** | Planned | `ox agent prime` via AGENTS.md / setup hook |

Because SageOx injects context through the repo itself — not through a vendor-specific API — a discovery made by a Claude Code session is available to a Codex agent in the next session. No vendor lock-in on your team's accumulated knowledge.

## Checking if it's working

### Agent Has Context

Ask the agent: "Are you using SageOx?"

A primed agent responds with its `agent_id`:

<Terminal title="agent response">
  <TerminalOutput>Yes, I'm using SageOx. My agent ID is: agt_01JQ2X3Y4Z5ABC123DEF456</TerminalOutput>
</Terminal>

### Command Output

Successful prime returns:

<Terminal title="ox agent prime">
  <TerminalOutput>agent_id: agt_01JQ2X3Y4Z5ABC123DEF456</TerminalOutput>
  <TerminalOutput>context_version: 2024-01-15T10:30:00Z</TerminalOutput>
  <TerminalOutput>team: acme-engineering</TerminalOutput>
  <TerminalOutput>injected: true</TerminalOutput>
</Terminal>

### Doctor Check

Run `ox doctor` to verify context injection is configured:

<Terminal title="ox doctor">
  <TerminalOutput>Context Injection</TerminalOutput>
  <TerminalOutput>  [OK] Context injection enabled</TerminalOutput>
  <TerminalOutput>  [OK] CLAUDE.md configured</TerminalOutput>
</Terminal>

## When Context Is Lost

Agents lose injected context when:

| Event | Context Status |
|-------|---------------|
| Session start | Not loaded yet |
| `/clear` command | Cleared |
| `/compact` command | May be lost |
| Context overflow | Truncated |

The agent should re-run `ox prime` after these events.

## Troubleshooting

**No agent_id returned** - Check `ox doctor` for configuration issues

**Context not reflected in responses** - Verify the agent actually ran the command (check for agent_id)

**Stale context** - Context version shows when it was last updated; re-prime to get latest

## Related Commands

- [ox init](/docs/cli/init) - Initialize repository (required first)
- [ox doctor](/docs/cli/doctor) - Diagnose configuration issues
- [ox login](/docs/cli/auth) - Authentication
