Skip to content

shicchi-7913/codex-hook-gate

v0.1.0

Run project quality checks after edits and before Codex stops

Codex Hook Gate

Installation

  1. Download codex-hook-gate.zip from the GitHub Release and extract it to a stable directory. Keep the .agents directory alongside codex-hook-gate.

  2. Register that extracted directory: codex plugin marketplace add /absolute/path/to/extracted-directory.

  3. In Codex desktop, install Codex Hook Gate from the Codex Hook Gate local marketplace and approve its hooks. Restart or start a new chat if Codex does not load the new plugin in the current chat.

  4. In the project to check, create .codex/gate.yaml, for example:

    rules:
      - match: "**/*.{ts,tsx}"
        run:
          - name: lint
            cmd: pnpm lint
        run_checks: [test]
    
    consistency_checks:
      - name: test
        run:
          - name: test
            cmd: pnpm test
    

No Go or Node.js runtime is needed for the plugin. Commands configured in gate.yaml still require their own project dependencies. match can be a string or list. Commands run in order; set dir on a rule or consistency check to run from a project-relative directory, and timeout in seconds on a rule, check, or command. A failed edit check is repeated at Stop. After five unsuccessful Stop attempts, the gate allows completion and reports the unresolved failure.

The bundled command hooks require a local Codex executor and trust approval. Codex does not run local plugin hooks in cloud-orchestrated environments. File detection covers tracked and nonignored untracked files in a Git project. A native Git installation is used for file enumeration when present; projects without Git use a filesystem walk. Specialized Codex tools can bypass normal tool hooks, so verify the required tool paths in the target Codex environment.