Skip to main content

Declarative agent hooks manager.

Project description

agenthook

Declarative agent hooks manager.

Overview

Single-file lint hook for agentic coding. Runs fix commands sequentially, then check commands in parallel, and blocks the edit on failure. Define commands in agenthook.yml. Currently supports Claude Code only.

Requirements

Setup

.claude/settings.json:

{
  "hooks": {
    "PostToolUse": [
      {
        "matcher": "Edit|MultiEdit|Write",
        "hooks": [
          {
            "type": "command",
            "command": "uvx agenthook",
            "timeout": 45
          }
        ]
      }
    ]
  }
}

agenthook.yml (see agenthook.example.yml for all options):

fix:
  commands:
    ruff-format:
      glob: "*.py"
      run: uv run ruff format {file}

check:
  commands:
    ruff-check:
      glob: "*.py"
      run: uv run ruff check {file}
    mypy:
      glob: "*.py"
      run: uv run mypy {file}

How it works

  1. Claude Code triggers the hook after each file edit
  2. Fix commands run sequentially (formatting, auto-fix)
  3. Check commands run in parallel (linting, type checking)
  4. On failure, the edit is blocked with a report describing the issues

Git-ignored files are skipped. Config is discovered by searching upward for agenthook.yml. Override with --config <path>.

Development

just setup-dev

Tooling

Dependencies

Automated via Renovate. Dependency update PRs are created automatically.

Release

Automated via release-please. Merge the auto-generated Release PR to bump version, update CHANGELOG.md, and create a tag.

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

agenthook-0.0.1.tar.gz (92.9 kB view details)

Uploaded Source

Built Distribution

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

agenthook-0.0.1-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file agenthook-0.0.1.tar.gz.

File metadata

  • Download URL: agenthook-0.0.1.tar.gz
  • Upload date:
  • Size: 92.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agenthook-0.0.1.tar.gz
Algorithm Hash digest
SHA256 dd92175de704a62843ce2e2a92ab47189beae3511960768160ef12e6279c08e5
MD5 275dfb4191aeada8629a598a23c4b858
BLAKE2b-256 afcd8d4ae0410079f87b14101eaeddcd292e63534cda8d34d397518f7a7be7a5

See more details on using hashes here.

File details

Details for the file agenthook-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: agenthook-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.10.11 {"installer":{"name":"uv","version":"0.10.11","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for agenthook-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 72ea491f78c77e79b45a583f1e19de0a6485878760e83a991adb64d5d6dda2c7
MD5 710af40a7e8268964a9e50c341647a51
BLAKE2b-256 88bc3ff2cad58f6a43da00c42da433140d3093eaaeeda88bc2d4a277a7dfb650

See more details on using hashes here.

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