agents-md-guard
Inspects local Git repositories and diffs, including staged changes and base/rev comparisons, to detect unapproved or weakened agent-instruction rules.
Runs as a GitHub Action on push and pull_request events to block unapproved or rule-weakening changes to AGENTS.md/CLAUDE.md/.cursorrules, and logs removed rules when changes are approved.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@agents-md-guard lint my AGENTS.md and suggest rewrites for any weak rules"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
agents-md-guard
Blocks silent weakening of AGENTS.md / CLAUDE.md / .cursorrules by an agent.
The problem is measured, not hypothetical: GitHub has roughly 719,000 repositories with agent instruction files, and in the 100 most-starred repositories 33 have at least one commit to those files authored or co-authored by an agent (Sharma, 2026). A one-word change - "MUST ask" to "may ask" - rewrites what the agent is allowed to do, and prose diffs rarely get read.
What it does
On every push or pull request it checks:
which instruction files changed;
whether the commit carries
Human-Reviewed-By: Name <email>;whether a line with a normative keyword (
MUST,NEVER,ALWAYS,FORBIDDEN,OBAVEZNO,NIKAD,NE SMIJE...) was removed or rewritten.
Unapproved changes are blocked. Approved ones pass, with the removed rules printed in the log.
Related MCP server: slop-guard
Use
# .github/workflows/agents-md.yml
name: agents-md-guard
on: [push, pull_request]
jobs:
guard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with: { fetch-depth: 0 }
- uses: gamai-io/agents-md-guard@v1
with: { base: origin/main }Local check before committing:
python3 agents_md_guard.py --stagedMCP server
The same check is available as an MCP tool, so an agent can inspect the rules it is
being given before it acts. Stdlib only, no SDK, JSON-RPC 2.0 over stdio
(protocol 2025-06-18).
pip install agents-md-guard{
"mcpServers": {
"agents-md-guard": {
"command": "agents-md-guard-mcp"
}
}
}tool | input | returns |
|
| findings: |
|
| guarded file names, normative keywords (EN + BS), the approval trailer, lint codes, exit codes |
|
| one concrete rewrite hint per finding, with the offending line |
agents_md_check is deterministic and offline: a permissive bullet ("you may send mail")
is a weak_rule, two rules over the same action where one is negated is a
negation_conflict (an error, so ok is false), and a file with zero normative
keywords is no_rules.
Tests
python3 -m pytest -q tests builds throw-away git repositories and asserts the
exit codes: an unrelated commit passes, an unapproved weakening is blocked, an
approved one passes and prints the rule it removed, .github/copilot-instructions.md
is guarded, and the forty-zeros event.before of a first push is not a usage error.
What it is not
It does not verify at runtime that the agent obeyed a rule. This is a diff-time gate on the rules themselves; runtime proof of an action is a different artefact (see gamai-io/gama-mandate for signed receipts).
MIT.
Available Tools
3 toolsagents_md_checkA
Lint an agent instruction file (AGENTS.md, CLAUDE.md, .cursorrules, copilot-instructions.md) for rules that are not binding: missing normative keywords, weak wording, duplicated rules, contradictions, oversized files. With 'repo' + 'rev'/'base'/'staged' it runs the real diff gate instead and reports whether a commit weakens a rule or lacks the Human-Reviewed-By trailer.
Inputs: rev, base, path, repo, +3 more.
agents_md_fix_suggestionsB
Lint the same input as agents_md_check and return one concrete rewrite hint per finding, with the offending line.
Inputs: path, text.
agents_md_rulesA
Return the rule set agents-md-guard enforces: guarded file names, normative keywords (EN + BS), the human approval trailer, lint codes and exit codes.
Inputs: no named parameters.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 3 tools
agents_md_check and agents_md_fix_suggestions operate on the same input and both produce lint findings, so an agent could initially hesitate between them. The descriptions do resolve it (findings vs. per-finding rewrite hints), and agents_md_rules is clearly a static reference lookup, so boundaries are mostly clear.
All three tools share the same 'agents_md_' prefix and snake_case style, with short action-oriented suffixes (check, rules, fix_suggestions). The pattern is immediately predictable and scannable.
Three tightly scoped tools for a linter/guard server: run the lint, fetch the rule reference, get fix hints. Nothing feels padded or missing at the surface level.
The core lifecycle (diagnose -> understand rules -> remediate) is covered, including the diff-gate mode via check. Minor gaps: no tool to actually apply fixes or to configure/initialize a guard file, so agents must edit files themselves.
Related MCP Connectors
12 read-only MCP tools for AI communication rules, instruction linting & 25-model benchmarks.
Free MCP tools: the only MCP linter, health checks, cost estimation, and trust evaluation.
Statically audits MCP tool surfaces for token cost, schema quality, and design issues.
Free MCP contract auditing for AI agents and developers. Check tool schemas, detect potential breaking changes between versions, and get structured compatibility findings before deployment. Static analysis only.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceProvides deterministic AST graph queries and rule validation for AI coding agents via MCP tools, enabling structural intelligence without LLM calls.MIT
- FlicenseNot gradedqualityAmaintenanceEnables agents to analyze text or files for formulaic AI writing patterns and receive numeric scores, band labels, contextual violations, and concrete advice. It offers programmatic prose linting via MCP tools without using an LLM judge or external API calls.-
- AlicenseNot gradedqualityBmaintenanceEnables deterministic auditing of agent responses against source documents, verification of workspace file paths, line ranges, and AST symbols, rule listing, and reproducible benchmark execution through MCP tools.1MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to enforce deterministic pre-write AST and secret guardrails, compress context with a Git-portable Markdown memory graph, and manage spec-to-code governance through three MCP tools.201 PyPIApache 2.0