NxtHooks
One hook directory, five agent harnesses.
Write a hook once as a script that reads a JSON envelope on stdin. NxtHooks runs it on Claude Code, Codex, OpenCode, pi and Hermes, translating each harness's own event names and verdict shapes to and from one contract:
exit 0 allow (stdout `CTX:` lines become context injected into the turn)
exit 2 block (stderr is the reason the model is shown)
$ pip install git+https://github.com/io-whtnxt/nxthooks # not on PyPI yet
$ nxthooks install
$ nxthooks list
NAME TIER EVENTS MATCHERS POLICY
nxtlint builtin after_tool Write,Edit,MultiEdit,NotebookEdit advise
secret-scan builtin before_tool Write,Edit,MultiEdit,NotebookEdit enforce
Two hooks ship with it: a Python linter that comments on files an agent just wrote, and a secret scanner that refuses a write carrying a credential.
Events
session_start, prompt_submit, before_tool, after_tool, stop,
session_end -- canonical names, mapped per harness. Not every harness
provides every one; nxthooks verify prints the capability matrix for the
machine it runs on rather than a general claim.
Tiers
builtin < library < user, with one deliberate inversion: a user manifest
overrides a builtin, but cannot replace a library hook. A library hook is
administered software and hooks.d/ is an ordinary writable directory, so a
security hook whose implementation can be swapped by dropping a file beside
it would not be a security hook. Collisions are reported, never silently
resolved.
Status
Beta. What has actually been observed, rather than what the design intends:
| Harness | Dispatch observed | Blocking verified |
|---|---|---|
| Claude Code | all tool events, live | live |
| Codex | all tool events, live | live |
| OpenCode | all tool events, live | live |
| pi | all tool events, live | live |
| Hermes | session_start, prompt_submit only |
through its own dispatcher, not a live turn |
The Hermes caveat is worth stating plainly. Its transport was driven through
hermes_cli.plugins._dispatch_pre_tool_call_hooks on hermes-agent 0.21.1,
which returned the block message, and its session_start and prompt_submit
hooks were seen firing in a real session. But no Hermes turn has yet reached
a tool call with these hooks installed, so before_tool and after_tool
there are verified one layer below the harness rather than end to end. Treat
Hermes tool hooks as working-by-construction until someone reports otherwise.
nxthooks verify prints the capability matrix for the machine it runs on,
which is the claim that matters to you rather than any of the above.
Licence
Apache-2.0. Generated from the NxtOS source tree; see NOTICE.
Metadata
Release files for nxthooks 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| nxthooks-0.1.0.tar.gz | 166.3 kB | With provenance | Details for nxthooks-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| nxthooks-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for nxthooks-0.1.0-py3-none-any.whl |
Total release size: 305.8 kB
Release files / nxthooks-0.1.0.tar.gz
| Download URL | nxthooks-0.1.0.tar.gz |
|---|---|
| Size | 166.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
5de091a3df66c74e978bc6314a647f9bdcc3759b44b3ac6006d1e879e5192017
|
|
BLAKE2b-256 checksum How to use checksums |
67ec7af71b0d2db645adccbdf0b764a422ef9c024204fd07eda1d3b546f70708
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency logRelease files / nxthooks-0.1.0-py3-none-any.whl
| Download URL | nxthooks-0.1.0-py3-none-any.whl |
|---|---|
| Size | 139.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aff48dd92d82fd89ba5fe12d52ec8957dbd5855c2d3ab8a779447547bb6a9875
|
|
BLAKE2b-256 checksum How to use checksums |
50bbcfb10b54d8262f5add7db919851782e984e7628a382a24e87455f47f6043
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
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 Sep 15, 2026.
Transparency logSecurity for nxthooks 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for nxthooks-0.1.0.tar.gz
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 Sep 15, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.