Skip to content

Ingest Hooks CLI

Use provon ingest hooks install to write trace hooks into AI coding tools so agent sessions are reported to Provon as OTLP traces. Unlike provon ingest sync, which backfills persisted transcript files, hooks fire on session events and report while the agent is running.

View as Markdown Open the plain-text version of this page.
text
agent session event -> tool hook -> provon ingest trace <source> <hook> -> OTLP -> POST /v1/traces

The hook command hands the payload to a detached reporter and returns immediately, so it does not block the agent or trip a hook timeout.

Supported Tools#

Tool Hook events Config location
Claude PostToolUse, Stop ~/.claude/settings.json (or <dir>/.claude/settings.json)
Codex PostToolUse, Stop ~/.codex/hooks.json plus trust entries in ~/.codex/config.toml
OpenCode session.idle Plugin ~/.config/opencode/plugins/provon-trace.js
dsh agent/turn-stopping, tools/post-execute Plugin $DSH_HOME/provon-trace-plugin.mjs (global only)
Cursor stop, sessionEnd ~/.cursor/hooks.json (or <dir>/.cursor/hooks.json)
Pi agent_settled, session_shutdown Extension ~/.pi/agent/extensions/provon-trace.ts

Installation is idempotent: re-running ingest hooks install updates existing entries rather than duplicating them. Provon-owned entries are replaced; entries owned by other tools are left untouched.

Current Live-Capture Status#

The baked command differs by tool; not every target uploads in this build:

  • Claude, Codex, Cursor — hook files invoke provon ingest trace <source> <hook>, the runtime entry this CLI registers. Live capture works.
  • OpenCode, dsh, Pi — the generated plugin currently execs provon trace <source> <hook> without the ingest segment. This build has no top-level trace command, so these three targets do not upload traces today.

Workarounds in this build:

  • Pi persists sessions under ~/.pi/agent/sessions, which ingest sync scans:

    bash
    provon ingest sync ~/.pi/agent/sessions --once
  • OpenCode and dsh do not persist transcripts into a directory that ingest sync scans, so there is no CLI backfill path for them in this build. Prefer Claude, Codex, or Cursor for live capture until the plugin invocation is aligned to provon ingest trace.

Prerequisites#

  1. Resolve credentials before install. Hooks install reads the --project / --api-key flags or the active profile; it does not read PROVON_API_KEY / PROVON_PROJECT_ID from the environment:

    bash
    provon auth login
    # or
    provon auth token set --api-key "$PROVON_API_KEY" --project "$PROVON_PROJECT_ID"
    # or pass flags directly:
    provon --project <project-id> --api-key <key> ingest hooks install
  2. The provon binary must be resolvable by the agent shell; the installer records the command path at install time.

Install#

Install hooks for every detected tool:

bash
provon ingest hooks install

The command auto-detects targets from config directories or commands on PATH; skipped tools are listed in the output with the reason.

Install for a single tool or a subset:

bash
provon ingest hooks install --claude
provon ingest hooks install --codex --cursor

Force installation when detection misses a tool:

bash
provon ingest hooks install --pi --skip-check

Project-Level vs Global#

By default hooks are written to the user's global config and apply to every project. To install only for a specific project:

bash
provon ingest hooks install --project-dir /path/to/project

This writes to <project-dir>/.claude/settings.json, <project-dir>/.cursor/hooks.json, and similar project-level files. dsh has no project-level config and is skipped when --project-dir is set.

Install Options#

| Option | Purpose | | --------------------------------------------------------------------- | -------------------------------------------------------------------------- | ----------------------------------------- | | --project-dir <path> | Install into project-level directories instead of global config | | --claude / --codex / --opencode / --dsh / --cursor / --pi | Limit install to the listed targets | | --skip-check | Skip tool detection and write to all selected targets | | --mode <mode> | Recording mode: coding, coding_write, in_repo, all (default all) | | --report-level <level> | full (default) or summary | | --disable <0 | 1> | Install entries switched off; default 0 | | --append | Add an additional reporting target instead of replacing the existing one | | --repo <slug> | Record a repository selector (repeatable) | | --path <dir> | Record a directory selector (repeatable) | | --skill <name> / --skill-keyword <kw> | Record skill selectors (repeatable) | | --mcp <name> | Record an MCP selector (repeatable) | | --keyword <kw> / --cli <name> | Record content/command selectors (repeatable) |

The selectors above are stored inside the baked PROVON_TRACE_CONFIG target record for use by downstream processing; treat them as recorded metadata rather than a guaranteed runtime filter in the current build.

Multiple Reporting Targets#

By default, installing for a project replaces the existing reporting target in the same hooks file. Append an additional target instead:

bash
provon --project <second-project> --api-key <second-key> ingest hooks install --append

If another tool already reports to the same project in the same file, installation aborts with TARGET_CONFLICT to prevent double reporting. --append also aborts (APPEND_CONFLICT) when the target already owns a reporting entry.

Uninstall#

Remove Provon entries from every tool:

bash
provon ingest hooks uninstall

Limit removal to specific tools:

bash
provon ingest hooks uninstall --claude --codex

Only Provon-owned entries are removed; other tools' hooks and unrelated config keys are preserved. For Codex, trust-state entries in config.toml are also cleared.

Runtime Environment Variables#

Variable Purpose
PROVON_TRACE_CONFIG Baked into hooks; carries project id, API key, endpoints, and recorded selectors
PROVON_TRACE_MODE Runtime override for recording mode
PROVON_TRACE_REPORT_LEVEL Runtime override for report level (full / summary)
PROVON_TRACE_DISABLE Set to 1 to switch off all reporting
PROVON_TRACE_PATH Runtime session-directory filter override
PROVON_TRACE_DEBUG Set to 1 to write debug logs to stderr
PROVON_TRACE_SYNC Set to 1 to run reporting in-process for manual testing

Success Check#

  1. Install output lists installed targets and an empty skipped list for the tools you expect.

  2. Run one agent turn in a supported tool, then open the project Traces view; a new conversation appears after the tool's hook fires.

  3. Manual sanity check with debug logging:

    bash
    echo '{"transcript_path":"/path/to/session.jsonl"}' \
      | PROVON_TRACE_DEBUG=1 PROVON_TRACE_SYNC=1 \
        provon ingest trace claude stop

Troubleshooting#

Symptom Likely cause Fix
MISSING_PROJECT_ID No project in flags or profile provon project use <id>, provon auth token set, or pass --project <id>
TARGET_CONFLICT Existing entry reports another project Re-run with --append, or uninstall first
Target listed under skipped Tool not detected Verify the tool exists, or use --skip-check with the target flag
No traces for OpenCode / dsh / Pi Plugin invocation inactive in this build Use the sync workaround for Pi; use Claude/Codex/Cursor live hooks
Codex hooks parked as pending trust Codex was running during install Re-run ingest hooks install --codex, then restart Codex
Hook payload errors hidden Debug logging off Re-run the manual command with PROVON_TRACE_DEBUG=1 PROVON_TRACE_SYNC=1
Duplicate traces for one session Two targets report the same project uninstall and reinstall a single target; remove stale plugin files
telemetry:ingest errors on upload Key lacks ingest capability Recreate the key with telemetry:ingest