
Product
Socket Threat Intel Now Shows Which Malware Campaigns Were Blocked or Detected
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.
@opik/ccsync
Advanced tools
A command-line tool to export Claude Code conversations to Opik for observability and analytics.
npm install -g @opik/ccsync
Or run directly without installing:
npx @opik/ccsync --help
The best way to use @opik/ccsync is with Claude Code hooks for automatic syncing:
Set up Opik connection:
npx @opik/ccsync config
This will guide you through an interactive setup process. Alternatively, you can set environment variables:
export OPIK_API_KEY="your-api-key"
export OPIK_BASE_URL="http://localhost:5173" # Optional, defaults to Opik cloud
Add automatic syncing hooks to your Claude Code settings (~/.claude/settings.json):
{
"hooks": {
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {}"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {}"
}
]
}
]
}
}
That's it! Now every time you finish a Claude Code conversation, it will automatically sync to Opik.
You can also run syncing manually:
# Sync all conversations at once
npx @opik/ccsync sync --all
Configure Opik connection using environment variables or a config file:
export OPIK_API_KEY="your-api-key"
export OPIK_BASE_URL="http://localhost:5173" # Optional
export OPIK_PROJECT_NAME="your-project" # Optional
Create ~/.opik.config:
api_key = your-api-key
url_override = http://localhost:5173
workspace = your-workspace
ccsync sync - Export conversations to OpikExport Claude Code data to Opik for analysis and observability.
# Export all sessions across all projects (recommended)
npx @opik/ccsync sync --all
# Export specific session
npx @opik/ccsync sync --session ce61eece-2274-40ec-8b15-3a1189c04c4a
# Export all sessions in a project
npx @opik/ccsync sync --project /path/to/project
# Watch for new conversations and sync automatically
npx @opik/ccsync sync --watch
# Preview what would be exported (dry run)
npx @opik/ccsync sync --all --dry-run
# Force export (bypass duplicate detection)
npx @opik/ccsync sync --all --force
ccsync ls - List available conversationsList all Claude Code sessions available for export.
# List all sessions
npx @opik/ccsync ls
# List sessions for specific project
npx @opik/ccsync ls --project /path/to/project
ccsync config - Configure Opik connectionInteractive setup for Opik connection. Guides you through configuration and validates the connection.
# Interactive configuration setup
npx @opik/ccsync config
# Just show current configuration
npx @opik/ccsync config --show
ccsync state - Manage export trackingManage the state system that tracks which sessions have been exported.
# Show export history
npx @opik/ccsync state --show
# Clear export history (forces re-export)
npx @opik/ccsync state --reset
# Clean up lock files
npx @opik/ccsync state --clean
Watch mode automatically monitors your Claude Code conversations and syncs them to Opik in real-time:
# Start watching for new conversations
npx @opik/ccsync sync --watch
Watch Mode Features:
Watch Mode Options:
--force - Force sync all changes (bypass smart detection)--dry-run - Preview what would be synced without actually syncing--verbose - Show detailed logging including debug informationConfigure connection:
npx @opik/ccsync config
List available sessions:
npx @opik/ccsync ls
Export a session:
npx @opik/ccsync sync --session <session-id>
Start automatic syncing:
npx @opik/ccsync sync --watch
--verbose): Shows detailed debug information--dry-run): Shows what would be synced without actually doing it~/.opik/sync-state/--force to re-export sessions that have already been exported--dry-run to preview exports without actually sending dataConfiguration Issues:
npx @opik/ccsync config # Interactive setup
npx @opik/ccsync config --show # Check current settings
No sessions found:
~/.claude/projects/--project /path/to/projectLock file errors:
npx @opik/ccsync state --clean # Remove stale locks
Force re-export:
npx @opik/ccsync sync --session <id> --force
Watch mode issues:
# Test with dry-run first
npx @opik/ccsync sync --watch --dry-run
# Enable verbose logging for debugging
npx @opik/ccsync sync --watch --verbose
Performance tuning:
--verbose only when debugging (creates more output)Claude Code hooks provide automatic syncing by executing @opik/ccsync commands in response to Claude Code events. This eliminates the need to manually run sync commands or use watch mode.
Add hooks to your Claude Code settings file (~/.claude/settings.json or .claude/settings.json):
{
"hooks": {
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {} --force"
}
]
}
],
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {}"
}
]
}
]
}
}
Real-time sync after each tool call:
{
"hooks": {
"PostToolUse": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {} --force"
}
]
}
]
}
}
Sync only when conversations end:
{
"hooks": {
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {}"
}
]
}
]
}
}
Conditional sync with error handling:
{
"hooks": {
"Stop": [
{
"matcher": "*",
"hooks": [
{
"type": "command",
"command": "jq -r '.session_id' | xargs -I {} npx @opik/ccsync sync --session {} 2>/dev/null || echo 'Sync failed'"
}
]
}
]
}
}
Claude Code provides JSON input to hooks via stdin with these fields:
session_id - Current session ID for targeted syncingtranscript_path - Path to the conversation's JSON log filehook_event_name - The specific hook event type (e.g., "PostToolUse", "Stop")The command examples above use jq to extract the session_id from the JSON input that Claude Code provides via stdin.
--force with PostToolUse to ensure incremental updates are captured--dry-run before enabling automatic syncing⚠️ Warning: Hooks execute shell commands with full user permissions. Only configure hooks you trust and understand.
| Feature | Hooks | Watch Mode |
|---|---|---|
| Setup | One-time configuration | Manual command each time |
| Performance | Event-driven (efficient) | File system polling |
| Scope | Per-session automatic | All projects continuous |
| Control | Integrated with Claude Code | Independent process |
Recommendation: Use hooks for automatic per-session syncing, watch mode for continuous monitoring of all projects.
FAQs
Sync Claude Code conversations to Opik for observability and analytics
The npm package @opik/ccsync receives a total of 0 weekly downloads. As such, @opik/ccsync popularity was classified as not popular.
We found that @opik/ccsync demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.

Product
Socket Threat Intel now shows which malware campaigns were blocked or detected in your organization, with links to scans and Firewall events.

Security News
Fixes for eMudhra and Brotli are out. Getting them everywhere they’re needed means tracking down bundled libraries, runtimes, and certificate stores.

Threat Research
/Security News
Socket uncovered secret-stealing workflows that ran in LiteLLM’s GitHub repository 11 days before the supply chain attack on PyPI and Docker.