Hook-only command guidance for AI coding agents

Hook Python commands into uv.

A small Go CLI that installs Codex and OpenCode hooks, detects Python-related shell commands, and routes them toward the matching uv workflow.

agent shell python app.py
uv path uv run app.py
tested Codex + Claude + OpenCode
default macOS & Linux first
runtime Pure Go CLI

Install binary

Install the latest stable release.

The installer downloads the matching archive for your OS and CPU, verifies it against checksums.txt, installs the binary, and runs uv-python-hook install for detected Codex/OpenCode hooks.

release installers macOS & Linux first
macOS & Linux
curl -LsSf https://uv-python-hook.jinxiao2010.uk/install.sh | sh
Windows PowerShell
powershell -ExecutionPolicy ByPass -c "irm https://uv-python-hook.jinxiao2010.uk/install.ps1 | iex"

Workflow

Command rewrites stay project-aware.

uv project boundaries are respected. Poetry and PDM projects are left unchanged, while Python tools use uv-native execution paths.

Original Codex target
python app.py -> uv --cache-dir /tmp/uv-python-agent-hooks/uv-cache run app.py
pytest -q -> uv --cache-dir /tmp/uv-python-agent-hooks/uv-cache run pytest -q
pip install requests -> uv --cache-dir /tmp/uv-python-agent-hooks/uv-cache pip install requests
python -m venv -> uv --cache-dir /tmp/uv-python-agent-hooks/uv-cache venv .venv
01

Detects uv projects

pyproject.toml and uv.lock mark uv-managed projects.

02

Leaves other managers alone

Poetry and PDM markers prevent rewriting commands in those projects.

03

Keeps agent cache isolated

Codex suggestions use a temporary uv cache by default.

Support status

Validated tool targets.

Codex CLI, Claude Code, and OpenCode are the validated tool targets. VS Code Copilot is planned for a future adapter.

Status Target Notes
tested Codex CLI

Installs hooks and suggests uv commands before shell tool execution.

tested Claude Code

Installs a Bash PreToolUse hook and suggests uv commands before execution.

tested OpenCode

Installs the OpenCode plugin and rewrites Python-related commands directly.

planned VS Code Copilot

Future editor integration target.

CLI reference

Install, inspect, rewrite, remove.

command list uv-python-hook
uv-python-hook install
uv-python-hook uninstall
uv-python-hook install --project --targets codex
uv-python-hook uninstall --project --targets codex
uv-python-hook install --project --targets claude
uv-python-hook uninstall --project --targets claude
uv-python-hook doctor
uv-python-hook detect-project
uv-python-hook rewrite-command "pip install -r requirements.txt"
uv-python-hook rewrite-command --target opencode "python app.py"