feat: ship agentfile as a Claude Code plugin - #37
Merged
Conversation
A linter nobody remembers to run reports nothing, which is the failure agentfile exists to describe. The configuration it reads is configuration someone is editing in Claude Code, so it can speak at the moment of the edit. The repository is its own marketplace, so installing takes no listing from anyone: claude plugin marketplace add dennishavermans/agentfile claude plugin install agentfile@agentfile A skill carries the permission-matching behaviour that makes a rule grant more than it reads. Every measured claim in it is copied from diagnostic text already shipped and already corrected in 2.3.1, rather than restated, so it carries nothing that has not been checked once. A PostToolUse hook runs the analysis after an edit to agent configuration and reports only the findings in the file that changed, so one edit does not print the repository's backlog. It informs and never blocks, and every failure path exits 0, so a missing binary cannot wedge an edit. It prefers an agentfile on PATH and falls back to npx. Python rather than shell, matching the hook scripts in Anthropic's own plugins. An earlier shell version embedded Python for the JSON filtering and failed silently on quoting. The plugin carries the same two drift points the pre-commit hooks did, a pinned CLI version and a version of its own, so both are covered by the same test. Verified: `claude plugin validate` passes on the plugin and on the marketplace manifest. The hook was exercised across five arms, including a payload for an unrelated file, a clean repository and malformed input, and the case that matters, where editing one file reports only its own findings.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A linter nobody remembers to run reports nothing, which is the failure agentfile exists to describe. The configuration it reads is configuration someone is editing in Claude Code, so it can speak at the moment of the edit instead of waiting to be invoked.
The repository is its own marketplace, so this needs no listing from anyone.
What installs
A skill, covering the permission-matching behaviour that makes a rule grant more than it reads: that everything before the first
*is matched as written and is the only thing limiting the rule, and the five rule shapes that follow from it.Every measured claim in it is copied from diagnostic text already shipped and already corrected in 2.3.1, rather than restated. It carries nothing that has not been through review once.
A hook on
PostToolUse, running after an edit toCLAUDE.md,AGENTS.md,.mcp.json,.claude/or.cursor/, reporting only the findings in the file that changed.Design decisions
It informs, never blocks. A hook that refuses a write on a warning gets uninstalled the same day, and a finding is advice rather than a verdict: static analysis cannot see intent. Every failure path exits 0, so a missing binary cannot wedge an edit.
It reports only the edited file.
checkhas no per-file scoping, so the hook filters the JSON report by path. Without that, one edit would print the whole repository's backlog.Python, not shell. Matching the hook scripts in Anthropic's own plugins. An earlier shell version embedded Python for the JSON filtering and failed silently on quoting, which is the kind of thing that ships broken.
Prefers a local binary.
AGENTFILE_BIN, thenagentfileonPATH, thennpx. Faster, works offline, and testable.Drift
The plugin carries the same two drift points the pre-commit hooks did: a pinned CLI version and a version of its own. Both are now covered by the existing invariant test, verified non-vacuous by reverting each and watching it fail.
Verification
claude plugin validatepasses on the plugin and on the marketplace manifest.Not included
Filling agentfile's own
.claude/skills/..claude/is gitignored here, so keeping per-developer configuration out of the repository is a deliberate choice, and adding files would contradict it.