agent-pattern-verification — independently scanned and version-tracked by SaferSkills.
SaferSkills independently audited agent-pattern-verification (Agent Skill) and scored it 100/100 (green). The audit ran 55 deterministic rules across Security, Supply Chain, Maintenance, Transparency, and Community; it found 0 high-severity and 0 lower-severity findings. The full rule-by-rule trace and per-finding evidence are below. Free, methodology-open.
Findings & checks · 0 flagged
Every scanned point with the score it earned and what moved between them.
First recorded scan — no prior version to compare against.
The primary manifest — the file an agent reads to learn what this artifact does.
Verify AI agent code for common anti-patterns that can cause infinite loops, runaway retries, tool mismatches, and context overflow. This skill complements ControlKeel's security and compliance validation with agent-specific pattern detection.
Trigger this skill when:
ck_finding for each issue discoveredAll checks are classified as:
[PATTERN] - Mechanical check, high reliability (applied exactly as specified)[HEURISTIC] - Judgment-based, best-effort (requires interpretation)[PATTERN]Apply mechanically. Do not pass a loop because it "looks like it might terminate."
| Pattern to find | Pass condition | Severity |
|---|---|---|
while True: in Python | A break statement exists within the same block scope | ⚠️ Warning if absent |
for { } in Go | A break or return exists within the block | ⚠️ Warning if absent |
while (true) in TypeScript/JavaScript | A break or return exists within the block | ⚠️ Warning if absent |
| Recursive function calls | A non-recursive return path exists (base case), OR a depth/counter parameter is present | ⚠️ Warning if absent |
Heuristic Fallback: After applying pattern table, scan for:
yield indefinitely without documented exitFlag as ⚠️ Warning: "Potential unbounded loop not matching known patterns — verify termination condition manually"
[PATTERN]Apply mechanically. If required parameter is absent, flag as ❌ Issue.
Python — Decorator-based:
| Library/Pattern | Required parameter | Fail condition |
|---|---|---|
@retry (tenacity) | stop=stop_after_attempt(n) or stop=stop_after_delay(n) | stop= absent |
@backoff.on_exception | max_tries=n | max_tries= absent |
Python — HTTP client retry:
| Library/Pattern | Required parameter | Fail condition |
|---|---|---|
urllib3.Retry(...) | total=n where n > 0 | total= absent or total=0 |
HTTPAdapter(max_retries=Retry(...)) | Retry object must have total=n | total= absent |
httpx.HTTPTransport(retries=n) | retries=n where n > 0 | retries= absent or retries=0 |
Python — AWS SDK (boto3):
| Library/Pattern | Required parameter | Fail condition |
|---|---|---|
Config(retries={...}) | max_attempts > 1 | max_attempts absent or ≤ 1 |
Note: boto3 without explicit retry config uses SDK defaults (3 attempts) — do not flag absence.
JavaScript/TypeScript:
| Library/Pattern | Required parameter | Fail condition |
|---|---|---|
retry(...) (async-retry) | retries: n in options | retries: absent |
pRetry(...) (p-retry) | retries: n in options | retries: absent |
Custom retry loops (all languages):
| Pattern to find | Pass condition | Fail condition |
|---|---|---|
Loop + try/except + continue | Integer counter with max check | No counter → ❌ Issue |
Heuristic Fallback: Scan for:
stamina, aiohttp_retry)max_retries, retry_count, attemptsFlag as ⚠️ Warning: "Potential retry pattern not matching known libraries — verify retry bounds manually"
[PATTERN]Step 1: Collect defined tools
Scan tool definition files. A name found by any pattern counts as registered.
Python — decorator patterns:
| Pattern | How to extract name |
|---|---|
@tool (LangChain) on def | Function name below decorator |
@function_tool (OpenAI Agents SDK) on def | Function name below decorator |
@tool(name="...") | Use name= argument value |
Python — dict/list patterns:
| Pattern | How to extract name |
|---|---|
{"type": "function", "function": {"name": "..."}} (OpenAI) | Value of "name" inside "function" |
{"name": "...", "input_schema": {...}} (Anthropic) | Top-level "name" |
{"name": "...", "description": "...", "parameters": {...}} | Top-level "name" |
ToolNode([func1, func2, ...]) (LangGraph) | Each function name in list |
tools = [func1, func2] / TOOLS = [...] | Each identifier in list |
TypeScript/JavaScript:
| Pattern | How to extract name |
|---|---|
{ type: "function", function: { name: "..." } } (OpenAI) | name: inside function: |
tool({ description: "...", parameters: z.object({...}) }) | The const variable name |
new DynamicTool({ name: "...", ... }) (LangChain.js) | Value of name: |
zodFunction({ name: "...", ... }) | Value of name: |
Step 2: Collect tool references from prompts
Scan .md, .txt, prompts.py for backtick-quoted identifiers naming capabilities.
Step 3: Cross-reference
| Finding | Severity |
|---|---|
| Reference not in definition list | ❌ Issue (hallucinated tool) |
| Defined tool not in any prompt | ⚠️ Warning (undocumented tool) |
Heuristic: Find where tools are defined and where LLM is invoked. If tools exist but are never connected to the LLM call, flag as ❌ Issue: "Tools defined but never connected to LLM invocation"
Heuristic Fallback: Scan for tool-like structures:
"description" and "parameters" keystools, tool_list, available_tools, functionsrun(), execute(), or __call__() methodsInclude in count and note: "Tool detected via heuristic — verify this is an intended agent tool."
[PATTERN]Formula: token_estimate = len(file_content_chars) / 4
| Content | ⚠️ Warning threshold | ❌ Issue threshold |
|---|---|---|
| System prompt file | > 4,000 tokens | > 8,000 tokens |
| Single tool description | > 500 tokens | > 1,000 tokens |
| All tool descriptions combined | > 2,000 tokens | > 4,000 tokens |
Exclude: skills/ directories (loaded on demand, not embedded)
Heuristic Fallback:
.format()) → flag if template alone is large[PATTERN](Only when LangGraph is detected)
Detection steps: a. Find graph file (graph.py, graph.ts, or file with StateGraph/MessageGraph) b. Build edge map:
workflow.add_edge(source, dest) — unconditional edgeworkflow.add_conditional_edges(source, fn, mapping) — extract destinations from mappingc. Identify cycles: nodes reachable from themselves d. For each cycle, check if END (or "__end__") is reachable via conditional edge
| Condition | Severity |
|---|---|
Cycle exists, END reachable via conditional | ✅ Pass |
Cycle exists, no path to END | ❌ Issue |
Graph has no END node | ❌ Issue |
Node has no outgoing edges and is not END | ⚠️ Warning (dead-end) |
Identify the agent framework by checking imports:
| Import Pattern | Framework |
|---|---|
from langgraph or import langgraph | LangGraph |
from crewai or import crewai | CrewAI |
from autogen or import autogen | AutoGen |
from langchain or import langchain | LangChain |
Direct openai/anthropic SDK only | Custom |
Also check for framework config files: langgraph.json, crew.yaml.
Priority files:
graph.py, graph.ts - Agent workflow definitionstools.py, tools.ts, tools/*.py, tools/*.ts - Tool implementationsstate.py, state.ts - State schemasprompts.py, prompts/*.md, system.md - Prompt templatesagent.py, agent.ts - Main agent logicDirectories to check:
src/agent/, agent/, src/, project rootlib/, app/, packages/Exclude from analysis:
skills/ directory — these are skill definitions, not agent system promptsGenerate a structured report with the following format:
# Agent Pattern Verification Report
**Project:** [project name or path]
**Date:** [current date]
**Framework:** [LangGraph | CrewAI | AutoGen | LangChain | Custom | None]
**Files analyzed:** [count]
## Summary
✅ X checks passed | ⚠️ Y warnings | ❌ Z issues
### By Category
| Category | Pass | Warn | Issue |
|----------|------|------|-------|
| Loop Safety | X | X | X |
| Retry Limits | X | X | X |
| Tool Consistency | X | X | X |
| Context Size | X | X | X |
| Graph Cycles | X | X | X |
## Detailed Findings
> `[P]` = pattern-matched (structurally reliable) · `[H]` = heuristic (best-effort judgment)
### ✅ Passing
- `[P]` All retry decorators have stop conditions
- `[P]` Tool registry consistent with prompt references
### ⚠️ Warnings
- `[P|H]` [Check name]: [Description]
- **Location:** [file:line]
- **Category:** [Loop Safety | Retry Limits | Tool Consistency | Context Size]
- **Suggestion:** [How to address]
### ❌ Issues
- `[P|H]` [Check name]: [Description]
- **Location:** [file:line]
- **Category:** [Loop Safety | Retry Limits | Tool Consistency | Context Size]
- **Rule:** [Which rule this violates]
- **Fix:** [Specific remediation steps]
## Recommendations
1. **[Highest priority]** - [Specific action]
2. **[Second priority]** - [Specific action]
3. [Additional improvements]
---
*Report generated by ControlKeel Agent Pattern Verification v1.0*ck_validateFor pattern-matched checks that can be expressed as code patterns, use ck_validate with:
artifact_type: "source"intended_use: "code"domain_pack: "software" or relevant domainsecurity_workflow_phase: "analysis"ck_findingPersist each issue with structured metadata:
ck_finding(
category: "security",
finding_family: "agent_pattern",
affected_component: "agent/loop.py:45",
severity: "warning", # or "issue"
evidence_type: "code_pattern",
description: "Potential unbounded loop detected",
suggested_fix: "Add MAX_ITERATIONS constant or break condition",
check_type: "pattern" # or "heuristic"
)ck_contextCall at the start to:
For detailed check specifications and examples, see references/pattern-checklist.md.
~30 seconds. Free. No account. Every finding cites a rule and a line of evidence.