analyze

A command for comparing an earlier version of code with a corrected version to find violations of stored coding rules.

In plain words
What is it for?
Use it after a code correction to detect violations, count them, and track each issue for resolution.
Why use it?
It helps identify which rules were missed when a user corrects the agent's work and records repeated mistakes for later review.

Command for Claude Code

Install

Getting it into your agent

One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.

agentmods
npx agentmods add commands/spideynolove/memory/analyze
Clone the repo
git clone --depth 1 https://github.com/spideynolove/memory

Made for: Claude Code.

Per session 9 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 372 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

What it costs to keep this loaded

Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.

ModelPer sessionOnce invoked
Fable 5 $0.00009 $0.00372
Opus 5 $0.00005 $0.00186
Sonnet 5 $0.00002 $0.00074
Haiku 4.5 $0.00001 $0.00037

Measured yesterday against content hash b233872122c8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

analyze scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured yesterday.

A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.

Nothing flagged

None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.

.claude/commands/analyze.md · 61 lines

What it actually says

Correction Analysis

Compare before/after code content against stored rules to detect rule violations and track repeated mistakes.

When to Use

Run immediately after the user corrects your work:

  • User says "no", "wrong", "not that" followed by the fix
  • User edits your code and shows the corrected version
  • User provides feedback that reveals a missed rule

Usage

analyze_corrections(
  before_content="[original code that was wrong]",
  after_content="[corrected code]"
)

What It Does

  1. Extracts all stored rules from memory (memory_type = "rule")
  2. Analyzes before_content for rule violations using trigger keywords
  3. Checks if after_content fixes those violations
  4. Logs violations to rule_violations table with frequency tracking
  5. Returns JSON with detected violations

Output Format

{
  "status": "violations_found" | "no_violations",
  "count": 3,
  "violations": [
    {
      "rule_id": "abc123",
      "rule_trigger": "before adding features",
      "violation_id": "viol_xxx"
    }
  ]
}
  • get_rule_violations() — View all tracked violations
  • resolve_rule_violation(violation_id) — Mark a violation as resolved
  • /correct — Review active violations before starting work

Pattern

This implements the correction cycle from claude-memory-engine:

  1. User corrects you → run /analyze to log the mistake
  2. Before next task → violations auto-load as reminder
  3. Same mistake 3+ times → consider upgrading to a hard rule
Changes

What this file has done since we first saw it

Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.

  1. yesterday First seen · 61 lines · 9 tokens per session scan A b233872122c8

Subscribe to this mod's changes

analyze is a command published in the GitHub repository spideynolove/memory (3 stars, last pushed 5mo ago), licensed MIT. It adds 9 tokens to every session and 372 once invoked, about $0.0000 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.