Bridge between Cline (VS Code extension) hooks and Infinium agent tracing
Project description
Infinium Cline Connector
Bridge between Cline (VS Code extension) hooks and Infinium agent tracing. Automatically captures Cline tasks — tool calls, prompts, token usage — 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-cline-connector
infinium-cline init
infinium-cline test # verify credentials + network
Then in VS Code: Settings → Extensions → Cline → Features → Enable Hooks.
That's it. Now just use Cline as you normally would — every task is automatically traced to Infinium.
If
infinium-clineis not on your PATH, usepython -m infinium_cline_connectoras a drop-in replacement.
Requirements
- Python 3.9+
- Cline VS Code extension v3.36+ with hooks enabled (Settings → Cline → Features → Enable Hooks)
- An Infinium agent ID and secret
How It Works
After infinium-cline init, Cline fires a command hook for each event. The hook writes a JSON response on stdout (required by Cline), stores the event, and returns instantly.
Cline (VS Code) ──command hook──> python -m infinium_cline_connector.hook
│
├─ IMMEDIATELY writes stdout response (required)
├─ append event to session JSONL file
│
└─ on TaskComplete / TaskCancel:
spawn detached background worker
→ replay events → aggregate
→ read ui_messages.json for tokens
→ send trace
│
▼
Infinium API
POST /agents/{id}/trace
- Cline fires a command hook for each event (tool call, prompt, etc.) with a nested JSON payload.
- The hook writes
{"cancel": false, "contextModification": null, "errorMessage": null}to stdout — Cline hangs without it. - On
TaskCompleteorTaskCancel, a detached background worker replays all events, reads Cline'sui_messages.jsonfor token usage, aggregates, and sends a trace.
CLI Reference
infinium-cline init
Interactive setup wizard. Writes hook scripts into .clinerules/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-cline test
Send a minimal test trace to verify credentials + network.
Options:
-v, --verbose Show the full trace payload before sending
infinium-cline status
Show current configuration: tracing state, credentials, config source, hook locations, pending retries.
infinium-cline pause / infinium-cline resume
Temporarily stop or restart tracing. Hooks stay installed — events are silently skipped while paused.
infinium-cline history
View recently sent traces.
Options:
-n, --limit N Number of entries (default: 10)
--json Output raw JSON lines
--clear Delete all history
infinium-cline errors
View the connector error log (network failures, bad payloads, keyring issues).
infinium-cline retry
Resend traces that failed due to network issues.
infinium-cline update-credentials
Update your Agent ID or Secret.
infinium-cline uninstall
Remove the connector completely — hook scripts, config file, and keyring secret.
infinium-cline cleanup
Remove stale session files (housekeeping).
infinium-cline start
Start HTTP server mode (requires pip install infinium-cline-connector[server]).
Per-Project Configuration
Each project traces to its own Infinium agent:
cd /path/to/project-a
infinium-cline init # Agent A credentials
cd /path/to/project-b
infinium-cline init # Agent B credentials
Config resolution order:
- Project config (
.infinium/config.jsonat or above 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 | First user prompt, truncated |
| description | First user prompt (full) |
| duration | Total task duration in seconds |
| steps | Ordered list: user prompts, tool calls |
| errors | Tool failures (success: false in postToolUse) |
| environment | Model (provider/slug), workspace root, Cline version |
| llm_usage | Input / output / cache-read / cache-write tokens, total cost (from ui_messages.json) |
Captured Events
| Event | What It Captures |
|---|---|
TaskStart / TaskResume |
Task description, model, workspace root |
UserPromptSubmit |
User prompt text (truncated) |
PreToolUse / PostToolUse |
Tool name, parameters, result, success, duration |
PreCompact |
Conversation length + estimated tokens before compact |
TaskComplete / TaskCancel |
Triggers trace 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_SESSION_END=true
CONNECTOR_SESSION_TTL=1800 # Stale session cleanup threshold (seconds)
CONNECTOR_SESSION_DIR=... # Override temp directory for session files
Documentation
Full documentation: i42m.ai/docs/cline
License
MIT
Project details
Release history Release notifications | RSS feed
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_cline_connector-1.0.0.tar.gz.
File metadata
- Download URL: infinium_cline_connector-1.0.0.tar.gz
- Upload date:
- Size: 46.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c728a94e9b28519d8956375a60ee13bbf45968d16f6ac1f84813700333c9e4d2
|
|
| MD5 |
2c420b22af9ece2b53f76906b120068f
|
|
| BLAKE2b-256 |
c2f1a72c048da92e4ca4859da33e90659e15265d0301eba149ed2a0700ad717d
|
File details
Details for the file infinium_cline_connector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: infinium_cline_connector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 46.2 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 |
fec1ca9a95ed20bfd06223052deb5ff20f78fc40aa1333756615780b663b423c
|
|
| MD5 |
276d5a65e2ee9eb73d2cbfa1fcee8310
|
|
| BLAKE2b-256 |
876653aeab9e7dfcbf358743f2efa6ede3ad653087cfb3c5942be896fcc39c21
|