Bridge between GitHub Copilot CLI hooks and Infinium agent tracing
Project description
Infinium Copilot CLI Connector
Bridge between GitHub Copilot CLI hooks and Infinium agent tracing. Automatically captures Copilot CLI sessions — tool calls, prompts, errors — 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-copilot-cli-connector
infinium-copilot init
infinium-copilot test # verify credentials + network
That's it. Now just use Copilot CLI as you normally would — every session is automatically traced to Infinium. Copilot CLI auto-discovers hooks.json in your working directory.
If
infinium-copilotis not on your PATH, usepython -m infinium_copilot_cli_connectoras a drop-in replacement.
Requirements
- Python 3.9+
- GitHub Copilot CLI (GA as of Feb 2026)
- An Infinium agent ID and secret
How It Works
After infinium-copilot init, everything is automatic. Copilot CLI loads ./hooks.json and fires the connector for each event.
Copilot CLI ──./hooks.json──> python -m infinium_copilot_cli_connector.hook
│
├─ converts Unix-ms timestamps to ISO 8601
├─ normalizes camelCase / PascalCase event names
├─ synthesizes sessionId from parent PID if absent
├─ append event to session JSONL file
│
└─ on sessionEnd (or postToolUse for per-turn):
spawn detached background worker
→ replay events → aggregate → send trace
│
▼
Infinium API
POST /agents/{id}/trace
- Copilot CLI fires a hook for each event (sessionStart, preToolUse, postToolUse, userPromptSubmitted, sessionEnd, errorOccurred).
- The hook normalizes the payload (Unix-ms → ISO 8601, camelCase canonicalization), appends to a session JSONL file, and returns instantly.
- On
sessionEnd(orpostToolUsefor per-turn traces), a detached worker replays, aggregates, and sends to Infinium.
CLI Reference
infinium-copilot init
Interactive setup wizard. Writes ./hooks.json that points at the connector.
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-copilot test
Send a minimal test trace to verify credentials + network.
Options:
-v, --verbose Show the full trace payload before sending
infinium-copilot status
Show current configuration: tracing state, credentials, config source, hook locations, pending retries.
infinium-copilot pause / infinium-copilot resume
Temporarily stop or restart tracing. Hooks stay installed — events are silently skipped while paused.
infinium-copilot history
View recently sent traces.
Options:
-n, --limit N Number of entries (default: 10)
--json Output raw JSON lines
--clear Delete all history
infinium-copilot errors
View the connector error log (network failures, bad payloads, keyring issues).
infinium-copilot retry
Resend traces that failed due to network issues.
infinium-copilot update-credentials
Update your Agent ID or Secret.
infinium-copilot uninstall
Remove the connector completely — hook entries from hooks.json, config file, and keyring secret.
infinium-copilot cleanup
Remove stale session files (housekeeping).
infinium-copilot start
Start HTTP server mode (requires pip install infinium-copilot-cli-connector[server]).
Per-Project Configuration
Each project traces to its own Infinium agent:
cd /path/to/project-a
infinium-copilot init # Agent A credentials
cd /path/to/project-b
infinium-copilot 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 | Initial or first user prompt, truncated |
| description | Initial or first user prompt (full) |
| duration | Total session duration in seconds |
| steps | Ordered list: user prompts, tool calls |
| errors | Tool failures + errorOccurred events |
| environment | Working directory, session source, end reason |
Captured Events
| Event | What It Captures |
|---|---|
sessionStart |
Source (new/resume/startup), initial prompt |
userPromptSubmitted |
User prompt text (truncated) |
preToolUse / postToolUse |
Tool name, parsed args, result type, LLM text |
errorOccurred |
Error message, name, stack |
sessionEnd |
Reason (complete/error/abort/timeout/user_exit) — triggers trace flush |
Trace Granularity
Choose during init or via CONNECTOR_FLUSH_ON_STOP:
- Per-session (default) — one summary trace per session (on
sessionEnd) - Per-turn — a trace after every
postToolUse(noisy but detailed) - Both — per-turn traces plus a final session summary
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=false # Per-turn flush on postToolUse
CONNECTOR_FLUSH_ON_SESSION_END=true # Summary flush on sessionEnd
CONNECTOR_SESSION_TTL=1800 # Stale session cleanup threshold (seconds)
CONNECTOR_SESSION_DIR=... # Override temp directory for session files
Documentation
Full documentation: i42m.ai/docs/copilot-cli
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_copilot_cli_connector-1.0.0.tar.gz.
File metadata
- Download URL: infinium_copilot_cli_connector-1.0.0.tar.gz
- Upload date:
- Size: 44.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 |
0dda799d01b9c2ceca22abf3c6a241d71507d2a66ef12f8839bfcc6b347fafd7
|
|
| MD5 |
a87cded0942bbca871769714b2ef6dfc
|
|
| BLAKE2b-256 |
e5b8b334940a12652142bb52be19d8062324bb25a72945a2febfb1625be720cf
|
File details
Details for the file infinium_copilot_cli_connector-1.0.0-py3-none-any.whl.
File metadata
- Download URL: infinium_copilot_cli_connector-1.0.0-py3-none-any.whl
- Upload date:
- Size: 44.0 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 |
26bba1f1cb814780d54a686095345a62c51af8e8f76e2f23bccea1ffaf6e3811
|
|
| MD5 |
749f87508bc44d2013c4326c3028dde2
|
|
| BLAKE2b-256 |
6fd63d9ea526efefdf03036535be032c219fecd5cf5b773cc1e8a763bc8e73c2
|