# SageOx + Claude Code (/docs/developers/claude-code)



SageOx + Claude Code [#sageox--claude-code]

Claude Code is the deepest ox integration. It gets the same prime-work-capture loop every agent gets, plus real-time hooks, slash commands, installed rules, and MCP support that no other agent has today.

For the general model — how priming injects Team Context and how sessions are captured — read [how it works](/docs/developers/how-it-works) first. This page covers what's Claude-Code-specific.

Setup [#setup]

<Terminal>
  <TerminalCommand>
    curl -sSL 

    [https://raw.githubusercontent.com/sageox/ox/main/scripts/install.sh](https://raw.githubusercontent.com/sageox/ox/main/scripts/install.sh)

     \| bash
  </TerminalCommand>

  <TerminalCommand>
    ox login
  </TerminalCommand>

  <TerminalCommand>
    cd ~/code/my-project
  </TerminalCommand>

  <TerminalCommand>
    ox init
  </TerminalCommand>
</Terminal>

`ox init` configures Claude Code to run `ox agent prime` at session start. That's the entire setup — start `claude` as normal and Team Context is injected automatically.

Real-time hooks [#real-time-hooks]

ox wires into Claude Code's lifecycle events, so context injection and session capture happen without you thinking about it.

| Hook               | What ox does                                                    |
| ------------------ | --------------------------------------------------------------- |
| `SessionStart`     | Runs `ox agent prime` to inject Team Context                    |
| `Stop`             | Captures the session to the Ledger and summarizes it            |
| `PostToolUse`      | Tracks the work as it happens for richer session capture        |
| `UserPromptSubmit` | Prepends `[ox-recall]` from prior work on question-like prompts |

These fire automatically in any connected repo. No manual `start` or `stop` step is required for the common case.

Slash commands [#slash-commands]

For explicit control, ox installs slash commands you can run inside a Claude Code session.

| Command              | What it does                                    |
| -------------------- | ----------------------------------------------- |
| `/ox-session-start`  | Begin recording a session manually              |
| `/ox-session-stop`   | End recording, commit, and upload to the Ledger |
| `/ox-session-status` | Show the current session's state                |
| `/ox-prime`          | Re-inject Team Context after a clear or compact |

<Terminal>
  <TerminalComment>
    Inside a Claude Code session
  </TerminalComment>

  <TerminalCommand>
    /ox-session-start
  </TerminalCommand>

  <TerminalComment>
    ... work on your feature ...
  </TerminalComment>

  <TerminalCommand>
    /ox-session-stop
  </TerminalCommand>
</Terminal>

Installed rules [#installed-rules]

ox installs a canonical rule at `.claude/rules/ox.md` plus a pointer under the `.claude/rules/sageox/` namespace. The pointer teaches Claude Code to discover your team's rules in their canonical home rather than syncing every team rule into every cloned repo.

The `sageox/` namespace reserves room for future ox-installed rules without cluttering your `.claude/rules/` directory. Uninstalling removes only ox-stamped files — your own rules are left untouched.

MCP support [#mcp-support]

Claude Code can reach SageOx over MCP, giving the agent live access to team knowledge and tools beyond the static prime payload. This is the path that lets the agent query across team-shared content during a session.

Anti-entropy auto-recovery [#anti-entropy-auto-recovery]

ox self-heals rather than failing loudly. If a session upload is interrupted, a hook set drifts, or a summary is missing, the background daemon detects the gap and repairs it on its next tick.

<Callout type="info">
  ox leaves your hand-authored `.claude/settings.json` alone. It only rewrites the hooks shape when Claude Code would actually reject the file — so your formatting, comments, and permission rules survive.
</Callout>

CLAUDE.md setup [#claudemd-setup]

When you run `ox init`, it adds this to your repo's `CLAUDE.md` so priming happens regardless of how the session was started — terminal, IDE, or orchestrator:

```markdown
## SageOx

Run `ox agent prime` at session start, after /clear, and after /compact.
```

The compounding loop [#the-compounding-loop]

The value isn't any single session — it's the loop that makes each one start smarter than the last.

1. **You record a decision** — a Loom walkthrough, a voice memo, a team discussion.
2. **SageOx processes it** into structured Team Context.
3. **Your AI coworker references it** in the next coding session.
4. **That session produces new insights** captured to the Ledger.
5. **Future sessions start smarter** because of steps 1–4.

After a week, Claude Code knows not just your code but *why* it's shaped the way it is. After a month, it carries context that would take a new hire weeks to absorb.

Multiplayer — shared context across coworkers [#multiplayer--shared-context-across-coworkers]

When several people work the same repo, they all receive the same Team Context, and decisions made in one session become available to every future session — human or AI.

<Mermaid
  chart="graph TD
    TC[&#x22;Team Context&#x22;] --> S1[&#x22;Session: Person A&#x22;]
    TC --> S2[&#x22;Session: Person B&#x22;]
    TC --> S3[&#x22;Session: Agent factory&#x22;]
    S1 -->|new insights| TC
    S2 -->|new insights| TC
    S3 -->|new insights| TC"
/>

The integration point is always `ox agent prime` via `CLAUDE.md`. Any tool that starts Claude Code in your repo — terminal, IDE, or orchestrator — gets SageOx context with no extra configuration. For running Claude Code at scale, see [Agent factories](/docs/developers/agent-factories).

Best practices [#best-practices]

**Record decisions, not just code**
The highest-value context is *why* things are the way they are. Record a 2-minute Loom after architecture calls, bug fixes, and design decisions.

**Use descriptive session names**
When you run `/ox-session-start`, the session gets a name. "Auth refactor investigation" is more findable than "Session 47".

**Review your Team Context**
Periodically browse `.sageox/teams/primary/` to see what your AI coworkers are reading. Edit `AGENTS.md` to add conventions they should follow.

**Capture onboarding sessions**
When a new teammate explores the codebase with Claude Code, capture that session. Their questions and the AI's explanations become documentation for the next person.

What's next [#whats-next]

* [How it works](/docs/developers/how-it-works) — the general prime-work-capture model
* [Supported coding agents](/docs/developers/coding-agents) — every agent and its tier
* [Session recording](/docs/developers/session-recording) — how captured sessions become team memory
* [Agent factories](/docs/developers/agent-factories) — orchestrating Claude Code at scale
* [Team Context](/docs/features/team-context) — what's in it and how to edit it
