Claude Code
Connect Claude Code to OpsCompanion so coding agents can investigate with better system awareness.
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 logsandopc traces
Status
Available now.
Install
First install the CLI:
brew tap opscompanion/opc
brew install opcThen run the guided setup flow:
opc setupChoose 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 setupfirst 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, oropc --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 6hWhat 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
Recommended Workflow
- Run
opc setup - Select Claude Code during the guided flow so the CLI installs skills and hooks for you
- Use
opc contextat the start of a task to load the current operating picture - Search memory before debugging with
opc search "<query>" - Investigate production behavior with
opc logsandopc traces - Save key discoveries with
opc remember "<decision or finding>"
Troubleshooting
If Claude Code is not picking up the integration:
- Re-run
opc setup - Confirm
.claude/settings.local.jsonexists in the workspace - Run
opc --agent claude contextto verify the CLI is configured - If needed, fall back to the legacy flow with
opc initandopc install --agent claude
For the full CLI reference, see OPC - OpsCompanion CLI.