OPC - OpsCompanion CLI
Persistent, shared memory plus logs and live application context for AI coding agents across Claude Code, Codex, Cursor, and future runtimes.

Install
brew tap opscompanion/opc
brew install opcTo upgrade:
brew update && brew upgrade opcFrom Source
git clone https://github.com/opscompanion/opc.git
cd opc
make installRequires Go 1.25+.
Quick Start
# 1. Run the guided setup flow
opc setup
# 2. Save a decision to organization knowledge
opc remember "Use connection pooling for Redis - single connections hit latency issues under load" --tags redis,performance
# 3. Search knowledge and memory
opc search "redis connection"
# 4. Search logs and traces
opc logs "timeout" --service api --severity ERROR --since 1h
opc traces "checkout" --service api --since 6h
# 5. View org/user/workspace context
opc contextopc setup combines API configuration, agent selection, skills and plugins, and hook generation in one interactive flow. It verifies your API key against OpsCompanion endpoints automatically, trying production first and then development, and saves the working endpoint to config.
The --agent Flag
Every command accepts --agent <name> to normalize behavior across runtimes:
opc --agent claude recall "auth migration" # from Claude Code hooks
opc --agent codex recall "auth migration" # from Codex hooks
opc search "auth migration" # human mode (auto-detect from env)The flag controls:
- Which env var to read the session ID from (
CLAUDE_SESSION_ID,CODEX_SESSION_ID, and others) - Hook configuration format (
.claude/settings.local.jsonvs.codex/hooks.json) - Session metadata tagging
When omitted, OPC auto-detects the agent from environment variables. Skills and hooks generated by opc setup or opc install include the correct --agent flag automatically.
opc setup is now the recommended onboarding path. opc init and opc install remain available for scripting and compatibility, but are legacy flows and will be deprecated.
Supported values: claude, codex, cursor, openclaw, auto (default).
How It Works
OPC integrates with AI coding agents via hooks: lightweight event handlers that fire on tool calls, prompts, and session lifecycle events.
Agent (Claude Code, Codex, Cursor, etc.)
-> fires hook events
-> opc capture (writes to local JSONL buffer)
-> checkpoint triggers (git commit, every 50 events, session stop)
-> local session artifactsShared knowledge and memory are available via opc search. No MCP required: hooks are deterministic and do not bloat context with tool schemas.
Commands
| Command | Description |
|---|---|
opc setup | Guided onboarding flow for API key verification, endpoint detection, agent install, and hooks |
opc init | Legacy config-only setup |
opc install | Legacy agent install flow (interactive if --agent is omitted) |
opc hooks | Generate hook configuration for the active agent |
opc context | Display org, user, integration, and workspace context |
opc session list | List local sessions |
opc session inspect <id> | Inspect session events and checkpoints |
opc remember <text> | Save a decision or discovery (--tags to add tags) |
opc search <query> | Search stored knowledge and memory |
opc logs [query] | Search logs (opc logs tail for live polling; tail does not accept --since) |
opc traces [query] | Search traces |
opc capture | Capture hook events from stdin (used by hooks) |
opc version | Print version info |
All commands accept the global --agent flag.
Architecture
OPC follows a thin client, smart server design:
- Client: captures events, buffers locally as JSONL, and calls the public API for context, knowledge, and memory
- Server: handles context assembly and knowledge and memory search
- No local database:
/tmp/opc/sessions/is a temporary buffer
This means intelligence improves server-side without shipping binary updates.
Multi-Agent Memory Sharing
Multiple agents can share knowledge in near-real-time:
Agent A discovers a bug -> checkpoint -> API extracts memory
|
v
Agent B asks about the same area -> opc search -> gets Agent A's discoveryMemory Layers
| Layer | Purpose | Shared? |
|---|---|---|
| Raw events | Audit log of every tool call | No |
| Memories | Extracted decisions and discoveries | Yes |
An hour-long session might produce 500 events but only 3-5 memories.
Supported Agents
| Agent | Integration | Status |
|---|---|---|
| Claude Code | opc setup | Supported |
| Codex | opc setup | Supported |
| Cursor | opc setup | Skills only |
| OpenClaw | opc setup | Skills only |
Legacy Commands
opc init and opc install are still supported for compatibility and scripting, but opc setup replaces them for normal onboarding.
opc initis the old config-only flowopc installis the old agent install flow- New users should start with
opc setup
Development
make build # Build binary
make install # Install to $GOPATH/bin
make snapshot # GoReleaser local build
make clean # Remove binaryReleasing
git tag v0.3.1
git push origin v0.3.1
# GitHub Actions -> GoReleaser -> GitHub Release -> Homebrew formula auto-updatesBuilds target darwin and linux on amd64 and arm64.
Contributing
Contributions welcome! Please open an issue or pull request.