Back to resources

RESOURCE / CODE

Doc-freshness gate: a hook for coding agents

Blocks commits and pushes when code changed but docs did not. Ships with 44 self-test cases, including adversarial ones and explicitly labelled known limitations, so one command tells you whether it actually works.

Version
1.1.0
Updated
License
CC BY 4.0

Downloads

2026-08-11

Drop it in scripts/, rewrite two regexes from rules your repo already documents, wire it up with the README's Claude Code or Codex adapter, then run --self-test and verify inside the host. Includes a prompt you can hand an AI agent to install it itself.

File integrity

Use SHA-256 after downloading to verify file integrity. Each checksum belongs to the immutable file for this release.

doc-freshness-hook-v1.1.0.mjs
074e80363b2f22a2f58d19d5c0e44690c18caa2db511e01ce6365d58afafe480
doc-freshness-hook-v1.1.0-en.md
f19f24b9c9c25a14be50e498358985c42b74c481653147dc8187fee679608c71

Source and license

An original Claude Code hook, running in this site's own repository; contains no third-party or restricted material.

Released under CC BY 4.0; keep appropriate attribution and indicate changes when reusing it.

Release history

  1. v1.1.0

    Aligned with official behavior as of 2026-08-11 and closed three reproducible bypasses: adopts Claude Code's native `if` pre-filter and the ${CLAUDE_PROJECT_DIR} exec form; Stop now returns hookSpecificOutput.additionalContext guarded by stop_hook_active; the blanket --amend and `git push --tags` exemptions are gone; the escape hatch is scoped to the target invocation's env prefix. Adds an installable Codex adapter and a trust-model section, and grows the self-test from 21 to 44 cases including adversarial ones and labelled known limitations. Not tested on Codex.

  2. v1.0.0

    Initial release: commit gate, push gate, and stop advisory; command-position matching to avoid false positives; -z handling for non-ASCII paths; fail-open on any error; 21 self-test cases and an install prompt for AI agents.