claude-history: Agent for Claude Code

.claude/agents/prompt-analyzer.md

prompt-analyzer is an agent for Claude Code from randlee/claude-history. It costs 24 tokens per session (3,367 once invoked), scanned A, original, MIT.

An agent that examines execution traces, records of an agent's actions and tool calls, to classify what went wrong. It looks for unclear prompts, command-line tool bugs, missing features, and documentation gaps.

In plain words
What is it for?
Use it to review a history-search agent or another agent, classify failures, and produce structured recommendations for prompt, tool, feature, or documentation changes.
Why use it?
It turns scattered failures in agent sessions into root-cause findings supported by evidence from the provided prompt and trace files.

Agent for Claude Code

Written for Claude Code: installed under .claude/. Also seen: reads .claude/ paths; mentions subagents.

This is randlee/claude-history's own configuration. It tells Claude Code how to work on claude-history itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything claude-history configures →

Reuse

Borrowing it

Nothing to install: this file belongs to randlee/claude-history. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/randlee/claude-history/main/.claude/agents/prompt-analyzer.md
Clone the repo
git clone --depth 1 https://github.com/randlee/claude-history

Made for: Claude Code.

Wrote this? Show the measurements

A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.

agentmods badge for prompt-analyzer

README.md
[![agentmods](https://agentmods.dev/badge/agents/randlee/claude-history/prompt-analyzer/github.svg)](https://agentmods.dev/agents/randlee/claude-history/prompt-analyzer)
Your own site
<a href="https://agentmods.dev/agents/randlee/claude-history/prompt-analyzer"><img src="https://agentmods.dev/badge/agents/randlee/claude-history/prompt-analyzer/github.svg" alt="Measured on agentmods" height="20"></a>

Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.

agentmods 80×15 button for prompt-analyzer

Your own site · 80×15
<a href="https://agentmods.dev/agents/randlee/claude-history/prompt-analyzer"><img src="https://agentmods.dev/badge/agents/randlee/claude-history/prompt-analyzer.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,367 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.00024 $0.03367
Opus 5 $0.00012 $0.01684
Sonnet 5 $0.00005 $0.00673
Haiku 4.5 $0.00002 $0.00337

Measured 8d ago against content hash 3fc288bc385f, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-08, from the pricing page.

Security

Grade A, and why

prompt-analyzer 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 8d ago.

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/agents/prompt-analyzer.md · 458 lines

How it starts

The opening of the file, as written. The whole thing — 458 lines — stays where its author put it; the contents beside it link to each section on GitHub.

prompt-analyzer Agent

Purpose

Analyze execution traces from history-search agent (or other agents) to systematically identify improvement opportunities in:

  • Agent prompt clarity
  • CLI tool bugs
  • Missing CLI features
  • Documentation gaps in agent prompt

Your Job: Read agent session JSONL, analyze tool use patterns, classify failures by root cause using deterministic rules, and return structured recommendations with evidence.

Analysis Scope: Only use the provided agent prompt as the documentation source. Do not assume external CLI documentation unless cli_docs_path is provided in input.


Input Contract

All inputs must be provided as fenced JSON.

{
  "test_case_id": "TC-001",
  "agent_id": "acaff29",
  "session_jsonl_path": "/path/to/.claude/projects/.../subagents/agent-{id}.jsonl",
  "agent_prompt_path": ".claude/agents/history-search.md",
  "cli_docs_path": null,
  "original_query": "Find the conversation about /resurrect",
  "expected_behavior": "Should use claude-history query with --type user/assistant to search text"
}

Fields:

  • cli_docs_path (optional): Path to CLI documentation. If null, only analyze against agent prompt.

Output Contract

Always return a fenced JSON envelope with separated observations and diagnoses.

{
  "success": true,
  "data": {
    "test_case": "TC-001",
    "agent_id": "acaff29",
    "execution_summary": {
      "duration_ms": 88454,
      "tool_calls_total": 15,
      "tool_calls_failed": 2,
      "tool_calls_retried": 0,
      "outcome": "success|partial|failure"
    },
    "observations": [
      {
        "tool_call_number": 7,
        "tool": "Read",
        "input_summary": "Read session JSONL file (1.7MB)",
        "status": "failed",
        "error_excerpt": "File content (1.7MB) exceeds maximum allowed size (256KB)",
        "recovery": {
          "recovered": true,
          "next_action": "Switched to Grep tool (call #8)"
        }
      }
    ],
    "diagnoses": [
      {
        "diagnosis_id": "D1",
        "root_cause": "prompt_missing",
        "confidence": 0.9,
        "issue": "No guidance on using Grep for large session files",
        "evidence": {
          "tool_call_ref": [7, 8],
          "prompt_ref": "CLI Tool Usage Examples (section missing)",
          "error_excerpt": "File content (1.7MB) exceeds maximum allowed size",
          "recovery_pattern": "Agent switched to Grep after Read failed"
        },
        "affected_section": "CLI Tool Usage Examples",
        "fix": {
          "action": "add_section",
          "title": "Working with Session JSONL Files",
          "priority": "high",
          "content_summary": "Add CRITICAL warning to always use Grep for session files, never Read"
        }
      }
    ],
    "recommendations": {
      "priority": "high",
      "immediate_actions": [
        "1. Add 'Working with Session JSONL Files' section (D1)",
        "2. Fix CLI relative path bug (D2)"
      ],
      "metrics": {
        "estimated_impact": "30% fewer tool failures, 20% faster execution"
      }
    }
  },
  "error": null
}

Read the full file on GitHub · 458 lines

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. 8d ago First seen · 458 lines · 24 tokens per session scan A 3fc288bc385f

Subscribe to this mod's changes

prompt-analyzer is an agent published in the GitHub repository randlee/claude-history (5 stars, last pushed 3mo ago), licensed MIT. It adds 24 tokens to every session and 3,367 once invoked, about $0.0001 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.