Bridge between Claude Code hooks and Infinium agent tracing
Project description
Infinium Claude Code Connector
Bridge between Claude Code hooks and Infinium agent tracing. Automatically captures Claude Code sessions — tool calls, prompts, subagent activity — and sends structured traces to the Infinium platform for Maestro analysis.
Quick Start
Navigate to your project, install, and set up:
cd /path/to/your/project
pip install infinium-claude-code-connector
infinium init
infinium test
That's it. Now just use Claude Code as you normally would — every session is automatically traced to Infinium. No server to run, no extra terminal, nothing to remember.
If
infiniumis not on your PATH, usepython -m infinium_connectoras a drop-in replacement.
How It Works
After infinium init, everything is automatic. You use Claude Code exactly as before — the connector works silently in the background via hooks.
Claude Code ──command hook──> python -m infinium_connector.hook
│
├─ append event to session JSONL file
│
└─ on Stop/SessionEnd:
replay events → aggregate → send trace
│
▼
Infinium API
POST /agents/{id}/trace
- Claude Code fires a command hook for each event (tool call, prompt, etc.)
- The hook script appends the event to a session JSONL file on disk
- On turn completion (
Stop) or session end, all events are replayed, aggregated into a structured trace, and sent to Infinium via the Python SDK - Maestro interprets the trace (grading accuracy, efficiency, prompt adherence)
CLI Reference
infinium init
Interactive setup wizard. Configures credentials and Claude Code hooks.
Options:
--agent-id TEXT Agent ID (skip prompt)
--agent-secret TEXT Agent Secret (skip prompt)
--base-url TEXT API base URL
--no-interactive Use flags only, no prompts (for CI/scripting)
infinium test
Send a test trace to verify your setup works end-to-end.
Options:
-v, --verbose Show the full trace payload before sending
infinium status
Show current configuration: tracing state, credentials, config source, hook locations, pending retries.
infinium pause / infinium resume
Temporarily stop or restart tracing. Hooks stay installed — events are silently skipped while paused.
Aliases: stop / continue
infinium history
View recently sent traces.
Options:
-n, --limit N Number of entries (default: 10)
--json Output raw JSON lines
--clear Delete all history
infinium retry
Resend traces that failed due to network issues.
Options:
--dry-run Show what would be retried without sending
infinium update-credentials
Update your Agent ID or Secret.
infinium uninstall
Remove the connector completely — hooks, config file, and keyring secret.
Options:
-y, --yes Skip confirmation prompt
infinium cleanup
Remove stale session files (housekeeping).
infinium start
Start HTTP server mode (alternative to command hooks, requires pip install infinium-claude-code-connector[server]).
Per-Project Configuration
Each project traces to its own Infinium agent:
cd /path/to/project-a
infinium init # Enter Agent A credentials
cd /path/to/project-b
infinium init # Enter Agent B credentials
Config resolution order:
- Project config (
.infinium/config.jsonin the working directory) - Environment variables (
INFINIUM_AGENT_ID,INFINIUM_AGENT_SECRET— override for CI/Docker)
Add .infinium/ to your .gitignore.
Credential Storage
- Agent ID and API URL are stored in the project config file (
.infinium/config.json) - Agent Secret is stored in your OS keyring:
- Windows: Credential Manager
- macOS: Keychain
- Linux: Secret Service (GNOME Keyring / KWallet)
- Environment variables (
INFINIUM_AGENT_ID,INFINIUM_AGENT_SECRET) override stored values — useful for CI/Docker
What Gets Traced
| Field | Source |
|---|---|
| name | Session summary (e.g., "Claude Code session (3 turns)") |
| description | First user prompt |
| duration | Total session duration in seconds |
| steps | Ordered list: user prompts, tool calls, subagent spawns |
| errors | Tool failures with error messages |
| environment | Model, session source, working directory, permission mode |
Captured Events
| Event | What It Captures |
|---|---|
SessionStart |
Model, source (startup/resume), working directory |
UserPromptSubmit |
User prompt text (truncated to 500 chars) |
PreToolUse / PostToolUse |
Tool name, input, output, duration |
PostToolUseFailure |
Error details |
SubagentStart / SubagentStop |
Subagent lifecycle (cowork, agent teams) |
Stop |
Assistant's final response — triggers trace flush |
SessionEnd |
Session cleanup — triggers final flush |
Configuration
Environment variables (all optional — init handles the common case):
# Credentials (override config file + keyring)
INFINIUM_AGENT_ID=...
INFINIUM_AGENT_SECRET=...
INFINIUM_BASE_URL=...
# Connector behavior
CONNECTOR_QUIET=false # Suppress output
CONNECTOR_FLUSH_ON_STOP=true # Send trace after each turn
CONNECTOR_FLUSH_ON_SESSION_END=true
CONNECTOR_SESSION_TTL=3600 # Stale session cleanup threshold (seconds)
CONNECTOR_SESSION_DIR=... # Override temp directory for session files
Documentation
Full documentation: i42m.ai/docs/claude-code
License
MIT
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file infinium_claude_code_connector-1.1.1.tar.gz.
File metadata
- Download URL: infinium_claude_code_connector-1.1.1.tar.gz
- Upload date:
- Size: 54.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
06a9b92b5cc1d45fe9aec28da296213602ff4f99db238cf2c98ac031bb4eb982
|
|
| MD5 |
9736dec894aa68a24b88040227ce63e6
|
|
| BLAKE2b-256 |
3dcec7f63942a23e2aa5d09743c7c2fa8158bec4f776b4b32beffc7d6bf066a1
|
File details
Details for the file infinium_claude_code_connector-1.1.1-py3-none-any.whl.
File metadata
- Download URL: infinium_claude_code_connector-1.1.1-py3-none-any.whl
- Upload date:
- Size: 45.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6a97aafc5f4bf5d90cbd50346cc9d44a97af504724be7f9f3ed634241b0ec0a3
|
|
| MD5 |
eb7b7753511ed80abdf400cf67bc7c53
|
|
| BLAKE2b-256 |
d7cd2166b93a44d9a0000be4dd8def4ced728c5a5ad34084b695fc177e0e6e11
|