Skip to main content

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 infinium is not on your PATH, use python -m infinium_connector as 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
  1. Claude Code fires a command hook for each event (tool call, prompt, etc.)
  2. The hook script appends the event to a session JSONL file on disk
  3. On turn completion (Stop) or session end, all events are replayed, aggregated into a structured trace, and sent to Infinium via the Python SDK
  4. 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:

  1. Project config (.infinium/config.json in the working directory)
  2. 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

infinium_claude_code_connector-1.2.1.tar.gz (55.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

File details

Details for the file infinium_claude_code_connector-1.2.1.tar.gz.

File metadata

File hashes

Hashes for infinium_claude_code_connector-1.2.1.tar.gz
Algorithm Hash digest
SHA256 404f7d7ab3a1a6744b0c5ed2310aa068de8fc4fc052792d9c642cafd2dcc85f0
MD5 51a58796681d9de17ddc9ac6337b198c
BLAKE2b-256 b05937d87bad272c54f3b302acffb849f825006e8bf803af6fb6bfa268d47335

See more details on using hashes here.

File details

Details for the file infinium_claude_code_connector-1.2.1-py3-none-any.whl.

File metadata

File hashes

Hashes for infinium_claude_code_connector-1.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 1d80d280b94166d22dfea077e92581352805c2c154ceb494c390d3a152a5cd02
MD5 d8985e3282f1f2a1746bbc361bd18647
BLAKE2b-256 179f1e66f0304e5abfb8b3d3e58e76d4972a62f2ed6e9c040d7d818d8d0d0485

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page