/agent-guardrails:agent-guardrails-analyzefrom agent-guardrails
Scans Claude Code session logs for recurring agent anti-patterns (hedging, stalling, skipping, etc.) and produces a ranked report with frequency counts and guardrail rule suggestions.
Ships in agent-guardrails. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Scan Claude Code session logs to detect recurring anti-patterns in assistant responses. Produce a ranked frequency report with excerpts and ready-to-use guardrail rule suggestions.
The canonical regex patterns live in the plugin's rules/ directory — one .md file per category. Always read the patterns from those files rather than hardcoding them, so analysis stays in sync with installed/refined rules.
Source of truth: ${CLAUDE_PLUGIN_ROOT}/rules/no-*.md
Read each rule file's YAML frontmatter to extract the name, pattern, and message fields. The nine categories are:
| # | Category | Rule file |
|---|---|---|
| 1 | Guessing | no-guessing.md |
| 2 | Stalling | no-stalling.md |
| 3 | Preference-Asking | no-preference-asking.md |
| 4 | False Completion | no-false-completion.md |
| 5 | Skipping | no-skipping.md |
| 6 | Dismissing | no-dismissing.md |
| 7 | Cosmetic | no-cosmetic.md |
| 8 | Caveats | no-caveats.md |
| 9 | Flagging | no-flagging.md |
Scan for ALL of them plus any novel patterns discovered during analysis.
Find recent Claude Code session logs:
find ~/.claude/projects/ -name "*.jsonl" -mtime -7 ! -path "*/subagents/*" 2>/dev/null | head -30
If the user specifies a project or time range, narrow the search accordingly.
Create a Python script at /tmp/agent-guardrails-analyze.py that:
type: "assistant" entries where message.content[].type == "text"rules/ files (see table above)Script requirements:
--days N (default 7), --project PATH (optional filter)Format the analysis as a ranked report, inline in the response:
## Agent Guardrails Analysis Report
**Sessions scanned:** {count}
**Time range:** {oldest} to {newest}
**Total anti-pattern matches:** {total}
### Rankings (by frequency)
| # | Category | Matches | % of Total |
|---|----------|---------|------------|
| 1 | Guessing | 47 | 38% |
| 2 | Stalling | 28 | 23% |
| 3 | Preference-Asking | 21 | 17% |
| ... | ... | ... | ... |
### Category Details
#### 1. Guessing (47 matches)
**Top phrases:**
- "this should work" (12x)
- "I think" (9x)
- "probably" (8x)
**Example excerpts:**
> "...I think this change will fix the issue. The error was probably caused by..."
> "...this should work now. Let me know if..."
**Recommended rule:** Install via /agent-guardrails:install
---
[Continue for each category...]
After presenting the report, state which categories have the highest frequency and recommend running /agent-guardrails:install to install rules for them. Do not ask the user which ones they want — recommend based on the data.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
agent-guardrails, anti-patterns, session-analysis, guardrails
4 skills in this plugin
/agent-guardrails-installInstall agent behavioral guardrail rules into a project's .claude/ directory. Generates a Stop hook bash script and configures settings.local.json. Includes nine battle-tested rules (no-guessing, no-stalling, no-preference-asking, no-false-completion, no-skipping, no-dismissing, no-cosmetic, no-caveats, no-flagging). Use when user asks to "install guardrails", "set up agent guardrails", "add behavioral hooks", "agent-guardrails install", or wants to enforce assistant discipline./agent-guardrails-testTest installed agent guardrail hooks by sending trigger phrases through the stop hook script. Checks hook installation first, then runs two test phrases per rule. Use when user asks to "test guardrails", "verify hooks", "check guardrail patterns", "agent-guardrails test", or wants to confirm hooks are working./agent-guardrails-updatenpx claudepluginhub florianbuetow/claude-code --plugin agent-guardrailsOther plugins' skills for the same job