Claude Code

Connect Claude Code to OpsCompanion so coding agents can investigate with better system awareness.

Claude Code connected to OpsCompanion

What It Does

  • Installs Claude Code hook configuration for OpsCompanion
  • Installs Claude Code skills, plugin wiring, and local hooks through the CLI setup flow
  • Captures local agent session events and checkpoints
  • Makes org, user, workspace, and integration context available through opc context
  • Lets Claude Code search shared knowledge and memory with opc search
  • Keeps investigations grounded in logs and traces with opc logs and opc traces

Status

Available now.

Install

First install the CLI:

brew tap opscompanion/opc
brew install opc

Then run the guided setup flow:

opc setup

Choose Claude Code during setup to install the right skills, plugin configuration, and hooks for this workspace.

Automations

Claude Code can also re-run prompts on a schedule, which is useful when you want OpsCompanion context available in recurring checks.

Use this as a simple starting point:

  • Run opc setup first so Claude Code already has the right OpsCompanion hooks and skills installed
  • Use Claude Code scheduled tasks for lightweight recurring checks inside an active Claude Code session
  • Start with prompts that call OpsCompanion directly, such as opc --agent claude context, opc --agent claude logs, or opc --agent claude search
  • For durable automations that should survive restarts, use Claude's persistent scheduling options instead of session-only loops

Example starter prompts:

/loop 30m opc --agent claude logs "timeout" --service api --severity ERROR --since 30m
/loop 1h opc --agent claude search "recent incident notes"

For the complete scheduling model, session limits, and /loop behavior, see Claude Code scheduled tasks.

How It Works

The Claude Code integration uses local hooks generated by the CLI. Those hooks call opc capture, which writes session events to a local buffer and checkpoints important moments so they can be searched later.

opc setup handles the full onboarding flow in one pass:

  • Verifies your API key and working OpsCompanion endpoint
  • Lets you pick Claude Code as the active agent
  • Installs the Claude Code skills and plugin wiring
  • Generates the local hook configuration for the workspace

Claude Code sessions can also call the CLI directly:

opc --agent claude context
opc --agent claude search "auth migration"
opc --agent claude logs "timeout" --service api --severity ERROR --since 1h
opc --agent claude traces "checkout" --service api --since 6h

What Gets Installed

Running opc setup and selecting Claude Code sets up the Claude-specific pieces needed for the workflow:

  • Claude Code hook configuration in .claude/settings.local.json
  • Claude Code skills and plugin registration for the local environment
  • The correct agent metadata so sessions are tagged as Claude Code activity
  • Session lookup using the Claude environment, including CLAUDE_SESSION_ID
  1. Run opc setup
  2. Select Claude Code during the guided flow so the CLI installs skills and hooks for you
  3. Use opc context at the start of a task to load the current operating picture
  4. Search memory before debugging with opc search "<query>"
  5. Investigate production behavior with opc logs and opc traces
  6. Save key discoveries with opc remember "<decision or finding>"

Troubleshooting

If Claude Code is not picking up the integration:

  1. Re-run opc setup
  2. Confirm .claude/settings.local.json exists in the workspace
  3. Run opc --agent claude context to verify the CLI is configured
  4. If needed, fall back to the legacy flow with opc init and opc install --agent claude

For the full CLI reference, see OPC - OpsCompanion CLI.

On this page