A2C pre-commit hooks (mandatory)
Normative requirements for the shared a2c-pre-commit-hooks repository in A2C-governed software projects. Recorded as ADR-0003.
Requirement
Every A2C-governed software repository must:
- have root
.pre-commit-config.yaml - include
a2c-pre-commit-hookspinned by release tag - enable
check-changelogat minimum
Non-A2C repositories may use these hooks optionally.
Shared hooks repository
| Property | Value |
|---|---|
| GitLab project | libesys/ai-workflows/a2c-pre-commit-hooks |
| HTTPS URL | https://gitlab.com/libesys/ai-workflows/a2c-pre-commit-hooks.git |
| SSH URL | git@gitlab-ai:libesys/ai-workflows/a2c-pre-commit-hooks.git |
| Current recommended tag | v0.3.0 |
Hook catalog and maintainer documentation are authored in a2c-pre-commit-hooks and published under the portal category Pre-commit hooks (see composite sections in portal docs).
Required hook set
| Hook id | Role |
|---|---|
check-changelog | When any file other than CHANGELOG.md is staged, CHANGELOG.md must also be staged |
check-web-sources (optional) | When docs/web-source-mapping.md exists and docs are staged, validate [web:NNN] tags vs mapping (ADR-0011) |
Additional hooks may be added to a2c-pre-commit-hooks over time. A2C may extend the required set via new ADRs. Until then, check-changelog is the mandatory baseline. check-web-sources is optional for projects using ADR-0011 web source tags.
Projects may add stack-specific hooks (Ruff, Black, mypy, YAML hygiene, gitlint, etc.). The A2C hooks entry is a floor, not a ceiling.
Example .pre-commit-config.yaml
Minimal A2C baseline (add stack hooks below this block):
repos:
- repo: https://gitlab.com/libesys/ai-workflows/a2c-pre-commit-hooks.git
rev: v0.3.0
hooks:
- id: check-changelog
# Optional for ADR-0011 adopters:
# - id: check-web-sources
Copy from templates/pre-commit/a2c-hooks-snippet.yaml.
Pinning rules
revmust be a release tag — e.g.v0.3.0- Do not pin to
develop,master, or a floating branch in production repos - Bump
revdeliberately when adopting a new hooks release; record in changelog when release-relevant
Exceptions
Removing or disabling required A2C hooks requires a project-specific ADR explaining why (for example environments that cannot run Git hooks). Do not silently omit the hooks entry.
AI behavior
| Situation | Expected behavior |
|---|---|
| Bootstrap | Create .pre-commit-config.yaml with A2C hooks entry and check-changelog |
| Edit config | Preserve A2C hooks entry and required hook ids; add non-conflicting hooks only |
| Release prep | Assume hooks are present; ensure changelog and config satisfy hook assumptions |
| Cannot use hooks | Cite exception ADR or propose creating one |
See rules/12-a2c-pre-commit-hooks.md.
Related policy
- pre-commit-policy.md — changed-file scope, CI model (ADR-0001)
- changelog-policy.md — changelog format (ADR-0002)