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-claude init
infinium-claude 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
infinium-claudeis not on your PATH, usepython -m infinium_connectoras a drop-in replacement.
How It Works
After infinium-claude 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-claude 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-claude test
Send a test trace to verify your setup works end-to-end.
Options:
-v, --verbose Show the full trace payload before sending
infinium-claude status
Show current configuration: tracing state, credentials, config source, hook locations, pending retries.
infinium-claude pause / infinium-claude resume
Temporarily stop or restart tracing. Hooks stay installed — events are silently skipped while paused.
Aliases: stop / continue
infinium-claude history
View recently sent traces.
Options:
-n, --limit N Number of entries (default: 10)
--json Output raw JSON lines
--clear Delete all history
infinium-claude retry
Resend traces that failed due to network issues.
Options:
--dry-run Show what would be retried without sending
infinium-claude update-credentials
Update your Agent ID or Secret.
infinium-claude uninstall
Remove the connector completely — hooks, config file, and keyring secret.
Options:
-y, --yes Skip confirmation prompt
infinium-claude cleanup
Remove stale session files (housekeeping).
infinium-claude 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-claude init # Enter Agent A credentials
cd /path/to/project-b
infinium-claude 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 (200-char preview) |
| input_summary | First user prompt, up to 3000 chars — what Maestro reads as the request |
| output_summary | Last assistant response, up to 8000 chars — what Maestro reads as the deliverable |
| duration | Total session duration in seconds |
| steps | Ordered list: user prompts, tool calls, subagent spawns (input_preview up to 200 chars, output_preview up to 1500 chars) |
| 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 (200-char step preview; the first prompt is kept up to 3000 chars as input_summary) |
PreToolUse / PostToolUse |
Tool name, input (up to 200 chars), output (up to 1500 chars), duration |
PostToolUseFailure |
Error details |
SubagentStart / SubagentStop |
Subagent lifecycle (cowork, agent teams) |
Stop |
Assistant's final response (1500-char step preview; the last response is kept up to 8000 chars as output_summary) — 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
# Payload caps (characters) — defaults match what Maestro's trace judge renders
CONNECTOR_MAX_INPUT_PREVIEW=200 # Per-step input_preview
CONNECTOR_MAX_OUTPUT_PREVIEW=1500 # Per-step output_preview (tool results, turn responses)
CONNECTOR_MAX_INPUT_SUMMARY=3000 # Top-level input_summary (first user prompt)
CONNECTOR_MAX_OUTPUT_SUMMARY=8000 # Top-level output_summary (last assistant response)
Documentation
Full documentation: i42m.ai/docs/claude-code
License
MIT
Metadata
Release files for infinium-claude-code-connector 1.4.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| infinium_claude_code_connector-1.4.0.tar.gz | 66.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| infinium_claude_code_connector-1.4.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 119.0 kB
Release files / infinium_claude_code_connector-1.4.0.tar.gz
| Download URL | infinium_claude_code_connector-1.4.0.tar.gz |
|---|---|
| Size | 66.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e1747a11fdbd6ea289e9e8532aab78b59e53724087ae0e323b65f200a5407d0c
|
|
BLAKE2b-256 checksum How to use checksums |
90b78f8dad9329cbb669eeca4435c30974750d00a6e78553349c8d9c912d9377
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|
Release files / infinium_claude_code_connector-1.4.0-py3-none-any.whl
| Download URL | infinium_claude_code_connector-1.4.0-py3-none-any.whl |
|---|---|
| Size | 52.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0cc84b5a99d40a6cfe1e74871ca5ae14f109419daad86ad562d06188a4b6594f
|
|
BLAKE2b-256 checksum How to use checksums |
e31801094969fb8b20bb23514ce90afc85e844cf4a964a751b4631aa44207f65
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/7.0.0 CPython/3.14.2
|