By jan-warchol
Check if the agent's actions comply with project rules defined in agent-rules.yaml, and enforce them using hooks. Requires python and uv package manager.
Framework for defining tool use rules, file access rules, post-tool hooks etc. Because what matters today are the guardrails and tools for steering the agent in the right direction.
Why not CLAUDE.md / AGENTS.md? Instructions written there can be helpful, but they can also be ignored by the agent. Using hooks with deterministic code is better whenever possible.
Why not Claude Code / editor settings? Deny rules in settings do not allow specifying reasons. Without them, agents will try to find workarounds, rather than follow the intent of the user.
Obvious format - agent-rules.yaml file is self-explanatory. Even without
the hooks enforcing the rules, agents can (and do!) read it to understand the
intended behaviour.
Context management - trying to describe all the rules in AGENTS.md / CLAUDE.md would pollute the context. Instead, provide the agent with feedback about the very thing it is doing at the moment.
uv package manager - install it with
curl -LsSf https://astral.sh/uv/install.sh | sh (or see
other installation methods).
First, register the marketplace:
/plugin marketplace add jan-warchol/agentic-rules-framework
Then install the plugin itself:
/plugin install check-agent-rules@agentic-rules-framework
TODO.
agent-rules.yamlThis is where the rules should be defined. This file is loaded from two locations:
~/.config/agentic-rules-framework on Linux)All relative paths will be resolved relative to the directory in which you run your agent.
You can also use {cwd} in the rules to refer to agent base directory:
# Path must be an exact match (regex patterns not supported yet).
deny_edits:
- path: agent-rules.yaml
reason: Only human can edit the agent rules configuration.
- path: src/interfaces.ts
reason: >
Modifying or extending interfaces can only be done by a human operator.
If you think changing an interface is necessary, report that to the user.
# Deny list uses partial matching ("rm -rf" will match "echo test && rm -rf /tmp")
deny_commands:
- pattern: "rm -rf"
reason: Destructive command. Instead, use "trash" to move files to system trash.
- pattern: "cd {cwd}"
reason: No need to cd to current directory, you are already there.
# Allow list uses full matching (anchors ^ and $ are implied)
allow_commands:
- pattern: "trash .*"
The tool defines hooks that run check_agent_rules.py script before tool usage
to check whether the tool should be allowed, denied or confirmed with the user.
check_agent_rules.py loads rules from agent-rules.yaml file located in the
directory where the agentic tool is running.
See .claude-plugin/plugin.json for Claude Code configuration and .github/hooks for GitHub Copilot configuration.
The script check_agent_rules.py has a simple sructure:
Tool use decisions are logged to .claude-sessions/permission-logs.jsonl in the
directory where you run the agent.
To consolidate logs from multiple projects into a single location, set
logs_base_dir in ~/.config/agentic-rules-framework/config.json:
{
"logs_base_dir": "/home/user/agent-logs"
}
Each project will get its own subdirectory under that path (named after the project's path). The value must be an absolute path.
This is not a security enforcement tool. A malicious and determined agent could find a way to bypass the checks.
Matches all tools
Hooks run on every tool call, not just specific ones
Own this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimOwn this plugin?
Verify ownership to unlock analytics, metadata editing, and a verified badge. GitHub access is read-only (username + org membership).
Sign in to claimBased on adoption, maintenance, documentation, and repository signals. Not a security audit or endorsement.
npx claudepluginhub jan-warchol/agentic-rules-framework --plugin check-agent-rulesCreate custom behavioral rules through markdown configuration files - prevent unwanted behaviors with pattern matching
One 👎 becomes a hard rule the agent cannot bypass. Captures thumbs-down feedback, distills it into PreToolUse Pre-Action Checks, enforced across every future Claude Code session.
Block destructive git and filesystem commands before execution
Process discipline for AI coding agents — TDD enforcement and policies.
Achieve flow state safely with Claude Code. Auto-approves routine work, gates risky actions, hard-blocks dangerous patterns. Dual enforcement (skill + hooks), token cap for cost governance, full audit trail. Zero dependencies.
AGT governance hooks and MCP tools for Claude Code sessions