Skip to main content

OpenHook

A lightweight protocol that standardizes hook payloads for AI coding agent tools.

Problem

Every AI coding tool (Claude Code, Cursor, Gemini CLI, GitHub Copilot, Kiro, etc.) implements its own hook format — different field names, event types, and configuration mechanisms. Hook consumers must write per-tool adapters with fragile heuristic detection.

Solution

OpenHook defines a self-describing JSON envelope. A single openhook field identifies conforming payloads, eliminating heuristic detection entirely.

{
  "openhook": "0.1",
  "id": "550e8400-e29b-41d4-a716-446655440000",
  "source": "claude-code",
  "type": "session.end",
  "time": "2026-02-23T10:15:30.123Z",
  "session_id": "sess_abc123",
  "data": {
    "transcript_path": "/path/to/session.jsonl"
  }
}

Event Types

Type Required Description
session.end REQUIRED Session ends. Minimum conformance.
session.start OPTIONAL Session begins.
prompt.submit OPTIONAL User submits a prompt.
tool.start OPTIONAL Agent starts using a tool.
tool.end OPTIONAL Agent finishes using a tool.

SDKs

Python

pip install openhook
from openhook import OpenHookEvent, EventType, parse_stdin

# Consume hook events
event = parse_stdin()
print(event.source, event.type, event.transcript_path)

# Produce hook events
event = OpenHookEvent.create(
    source="my-tool",
    type=EventType.SESSION_END,
    session_id="sess_123",
)
event.emit()

TypeScript

npm install @openhook/sdk
import { parseStdin, OpenHookEvent, EventType } from '@openhook/sdk';

const event = await parseStdin();
console.log(event.source, event.type, event.transcriptPath);

Specification

See spec/openhook-0.1.md for the full protocol specification.

License

Apache-2.0

Metadata

Release files for openhook 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for openhook 0.1.0
File Size Uploaded
openhook-0.1.0.tar.gz 9.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for openhook 0.1.0
File Interpreter ABI Platform
openhook-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.6 kB

Release files / openhook-0.1.0.tar.gz

Download URL openhook-0.1.0.tar.gz
Size 9.1 kB
Tags Source
SHA-256 checksum
How to use checksums
40bc145ac6043cf1a19f2bb2d7ce59d6af1d472f2657a20fc1dbc3016d493e57
BLAKE2b-256 checksum
How to use checksums
95b5c5c0bc2c88d5145ba37d1aaf8ace74fe6323d5b2fa0fe556af183d1798ec
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.

Transparency log

Release files / openhook-0.1.0-py3-none-any.whl

Download URL openhook-0.1.0-py3-none-any.whl
Size 6.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
490916767ace9a65f10db3c4b7b17fb64de340e1e951082a620d953e8d7bcb18
BLAKE2b-256 checksum
How to use checksums
d0573ca6380c075bdfea38f3e32b635f7fd34319ac8158a898530bfc2819089a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Feb 27, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page