docs-hook

A lightweight Git hook that keeps agent documentation in sync when changes are committed or merged. Git hooks are scripts that run automatically during Git actions.

In plain words
What is it for?
Use it to refresh skill tables, agent documentation, registries and related files after commits or merges.
Why use it?
It removes the need to update several generated documentation and registry files by hand after repository changes.

Skill for Claude CodeCodex

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add skills/d-o-hub/github-template-ai-agents/docs-hook
Any agent
npx skills add d-o-hub/github-template-ai-agents --skill docs-hook
Clone the repo
git clone --depth 1 https://github.com/d-o-hub/github-template-ai-agents

Made for: Claude Code, Codex.

Per session 58 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 700 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00058 $0.00700
Opus 5 $0.00029 $0.00350
Sonnet 5 $0.00012 $0.00140
Haiku 4.5 $0.00006 $0.00070

Measured 2d ago against content hash d806b64aeb40, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

docs-hook scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 2d ago.

The scan reads SKILL.md. This mod also ships 1 executable file (scripts/docs-sync.sh), listed below but not scanned — reading those needs a real analyzer, not pattern matching.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.agents/skills/docs-hook/SKILL.md · 89 lines

How it starts

The opening of the file, as written. The whole thing — 89 lines — stays where its author put it; the contents beside it link to each section on GitHub.

Docs Hook

Ultra-lightweight documentation sync via git hooks.

When to Use

  • User asks to update agents-docs on commit or merge events
  • Need to sync documentation with minimal tokens
  • Even if they just say "update the docs" or "sync the agent docs"

Trigger

  • "git hook", "on commit", "pre-commit"
  • "sync docs", "update docs"
  • "merge sync", "push docs"

Usage

# Full automatic sync (recommended):
./scripts/post-commit-docs-sync.sh

# Or use the lightweight docs-sync only:
./scripts/docs-sync.sh HEAD~1 HEAD

Automatic Sync on Commit

The post-commit-docs-sync.sh script provides comprehensive documentation syncing:

  1. Skill table updates: Regenerates AGENTS.md skill table when .agents/skills/ changes
  2. LLM context regeneration: Updates llms.txt and llms-full.txt when markdown changes
  3. Agent registry sync: Updates AGENTS_REGISTRY.md when agent configs change
  4. Docs file sync: Copies changed docs to appropriate directories
  5. Commit amendment: Automatically amends commit with updated documentation

Configuration

Environment variables control behavior:

Variable Default Description
DOCS_SYNC_ENABLED true Enable/disable docs sync
DOCS_SYNC_QUIET false Suppress output messages
DOCS_SYNC_LLM_TXT true Regenerate LLM context files

Minimal Token Workflow

  1. Diff: Get changed .md files between commits
  2. Sync: Copy to target directory
  3. Done: No ML, no logging, no metrics

Working Scripts

  • scripts/post-commit-docs-sync.sh - Full documentation sync orchestrator
  • scripts/docs-sync.sh - Lightweight file synchronization only

See Also

  • learn — Extract learnings into AGENTS.md
  • agents-md — AGENTS.md best practices

Rationalizations

Rationalization Reality
"Docs can sync manually, no need for automation" Manual sync is forgotten within days. Automation ensures consistency.
"The hook is slow, I'll skip it" A few seconds of sync time prevents hours of out-of-date documentation debt.
"Only production docs need syncing" Stale developer docs cause onboarding confusion and incorrect assumptions.

Read the full file on GitHub · 89 lines

Files

What ships with it

2 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. 2d ago First seen · 89 lines · 58 tokens per session scan A d806b64aeb40

Subscribe to this mod's changes

docs-hook is a skill published in the GitHub repository d-o-hub/github-template-ai-agents (2 stars, last pushed 2d ago), licensed MIT. It adds 58 tokens to every session and 700 once invoked, about $0.0003 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.

Related

Other skills, from other repositories

git-flow-pr

Executes the full PR-driven development workflow: create an isolated feature branch from the current work, commit all staged changes, rebase cleanly onto the selected base branch (skipping any ancestor commits already merged), push the branch, and open a GitHub pull request linked to a related issue. Includes guidance…

soulcodex/agentic · 103 tokens

memory-continuity

Preserves cross-session continuity with deterministic MEMORY.md, index.md, and snapshot handoffs under .agentic/memories/.

soulcodex/agentic · 30 tokens

new-gh-issue-orchestration

Orchestrates a GitHub-issue-driven delivery workflow from issue intake to PR creation using reviewer-first then worker execution. Invoked when the user provides a GitHub issue link/number and asks to start end-to-end delivery.

soulcodex/agentic · 54 tokens

git-worktree-workspaces

Sets up and uses Git worktrees for parallel task workspaces in the same repository clone, including safe cleanup of local worktrees. Invoked when the user asks to work on multiple branches at once, isolate tasks without extra clones, or create/remove worktrees.

soulcodex/agentic · 58 tokens

client-approval

Draft a clean client approval request, set a 48h SLA with a 72h escalation, and track revision rounds so the third billable revision never slips through unbilled.

MarcoZorn/agencykit · 41 tokens

client-report

Turn a month of campaign data into a confident client report — executive summary, what worked, what didn't, next month's plan and a clean channel/KPI table with deltas.

MarcoZorn/agencykit · 38 tokens