Skip to main content

OpenHook Protocol SDK — standardized hook payloads for AI coding agents

Project description

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

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

openhook-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

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

openhook-0.1.0-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file openhook-0.1.0.tar.gz.

File metadata

  • Download URL: openhook-0.1.0.tar.gz
  • Upload date:
  • Size: 9.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openhook-0.1.0.tar.gz
Algorithm Hash digest
SHA256 40bc145ac6043cf1a19f2bb2d7ce59d6af1d472f2657a20fc1dbc3016d493e57
MD5 dab50a1e139d2fc8af79421c8e7874cd
BLAKE2b-256 95b5c5c0bc2c88d5145ba37d1aaf8ace74fe6323d5b2fa0fe556af183d1798ec

See more details on using hashes here.

Provenance

The following attestation bundles were made for openhook-0.1.0.tar.gz:

Publisher: publish-python.yml on HikaruEgashira/open-hook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file openhook-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: openhook-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for openhook-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 490916767ace9a65f10db3c4b7b17fb64de340e1e951082a620d953e8d7bcb18
MD5 f37747ef06a01add02d78724fe0811f1
BLAKE2b-256 d0573ca6380c075bdfea38f3e32b635f7fd34319ac8158a898530bfc2819089a

See more details on using hashes here.

Provenance

The following attestation bundles were made for openhook-0.1.0-py3-none-any.whl:

Publisher: publish-python.yml on HikaruEgashira/open-hook

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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