ci: refuse a plugins/ directory and agent co-author trailers by hook #272

Open
opened 2026-11-20 21:14:39 +00:00 by Claude · 0 comments
Owner

Spec: Where the last unplaced rules live: architecture, the two positions and the trailer rule (resolution comment, items 2 and 4).

What to build

Two hooks in .pre-commit-config.yaml, each printing its rule as the failure message:

  1. Roles only. A local hook with language: fail and files: ^plugins/. Message: the Collection holds roles only; a plugin needs an ADR in docs/adr/ first, and that ADR's pull request removes this hook. No script.
  2. Agent trailers. A local hook at the commit-msg stage that refuses a Claude-Session: line and a Co-Authored-By: line naming a known agent identity (for example [email protected], Claude, Copilot, Cursor, Gemini, Codex). A human co-author stays allowed. Message: agent-written content carries Assisted-by: <tool>[:<model>], never Co-Authored-By: for an agent or a session link (see docs/contributing/ai-assistance.md). Prefer language: pygrep. Not certain that pygrep runs at commit-msg: check it, and fall back to a short script under scripts/ with a test only if it does not. scripts/dev-setup.sh must install the commit-msg hook type if it does not already (Conventional Commits already runs there, so it probably does).

.pre-commit-config.yaml is an image input: carry the PATCH bump of the ci image version: (scripts/bump_image_versions.py).

Acceptance

  • Committing a file under plugins/ fails with the rule as the message.
  • A commit message with Co-Authored-By: Claude <[email protected]> or Claude-Session: … fails; one with a human Co-Authored-By: and one with Assisted-by: Claude Code pass.
  • Each rule's held-by in the docs names its hook once the docs exist (root AGENTS.md, ai-assistance.md), or the PR notes the docs edit owed.
  • The PR says what was verified and what was not.

Not in scope

Requiring Assisted-by: (no check can tell agent-written content; held by review). Rewriting existing commits.

Spec: [Where the last unplaced rules live: architecture, the two positions and the trailer rule](https://git.rkdr.net/Mortis/Kamino/issues/258) (resolution comment, items 2 and 4). ## What to build Two hooks in `.pre-commit-config.yaml`, each printing its rule as the failure message: 1. **Roles only.** A `local` hook with `language: fail` and `files: ^plugins/`. Message: the Collection holds roles only; a plugin needs an ADR in `docs/adr/` first, and that ADR's pull request removes this hook. No script. 2. **Agent trailers.** A `local` hook at the `commit-msg` stage that refuses a `Claude-Session:` line and a `Co-Authored-By:` line naming a known agent identity (for example `[email protected]`, Claude, Copilot, Cursor, Gemini, Codex). A human co-author stays allowed. Message: agent-written content carries `Assisted-by: <tool>[:<model>]`, never `Co-Authored-By:` for an agent or a session link (see `docs/contributing/ai-assistance.md`). Prefer `language: pygrep`. Not certain that `pygrep` runs at `commit-msg`: check it, and fall back to a short script under `scripts/` with a test only if it does not. `scripts/dev-setup.sh` must install the `commit-msg` hook type if it does not already (Conventional Commits already runs there, so it probably does). `.pre-commit-config.yaml` is an image input: carry the PATCH bump of the `ci` image `version:` (`scripts/bump_image_versions.py`). ## Acceptance - [ ] Committing a file under `plugins/` fails with the rule as the message. - [ ] A commit message with `Co-Authored-By: Claude <[email protected]>` or `Claude-Session: …` fails; one with a human `Co-Authored-By:` and one with `Assisted-by: Claude Code` pass. - [ ] Each rule's held-by in the docs names its hook once the docs exist (root `AGENTS.md`, `ai-assistance.md`), or the PR notes the docs edit owed. - [ ] The PR says what was verified and what was not. ## Not in scope Requiring `Assisted-by:` (no check can tell agent-written content; held by review). Rewriting existing commits.
Claude added this to the Open to contributors milestone 2026-11-20 21:14:39 +00:00
Claude added the
Status
Ready for Agent
label 2026-11-20 21:14:39 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: Mortis/Kamino#272