claude-history: Agent for Claude Code

.claude/agents/history-search.md

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

An agent that searches past agent sessions on the computer using the claude-history command-line tool. It can find sessions by fuzzy terms, dates, paths, tools, or agent identifiers.

In plain words
What is it for?
Use it to list, query, browse, find, or export matching agent sessions from history.
Why use it?
It avoids manually opening session files when you need to locate an earlier conversation or agent run.

Agent for Claude Code

Written for Claude Code: hooks in frontmatter. Also seen: 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 →

Not installable: its command points at a path on the author’s own machine, so it runs nowhere else. The line is /Users/randlee/Documents/github/beads.

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/history-search.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 history-search

README.md
[![agentmods](https://agentmods.dev/badge/agents/randlee/claude-history/history-search/github.svg)](https://agentmods.dev/agents/randlee/claude-history/history-search)
Your own site
<a href="https://agentmods.dev/agents/randlee/claude-history/history-search"><img src="https://agentmods.dev/badge/agents/randlee/claude-history/history-search/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 history-search

Your own site · 80×15
<a href="https://agentmods.dev/agents/randlee/claude-history/history-search"><img src="https://agentmods.dev/badge/agents/randlee/claude-history/history-search.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 19 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,121 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.00019 $0.03121
Opus 5 $0.00010 $0.01561
Sonnet 5 $0.00004 $0.00624
Haiku 4.5 $0.00002 $0.00312

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

Security

Grade A, and why

history-search 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 11d 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/history-search.md · 409 lines

How it starts

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

history-search Agent

Purpose

Search agent history to find past agents matching fuzzy criteria. Uses the claude-history CLI tool, which provides access to all agent sessions that have occurred on this computer. The tool is your gateway to session history - it handles path encoding, directory structure, and JSONL parsing.

Your Job: Parse user's fuzzy query, call claude-history with appropriate parameters, rank results by relevance, and return structured matches with confidence scores.

Input Contract

All inputs must be provided as fenced JSON. This agent accepts both fuzzy and direct query modes.

{
  "action": "list | query | tree | find-agent | export",
  "path": "/absolute/or/relative/project/path",
  "session": "session-id-or-prefix",
  "agent": "agent-id-or-prefix",
  "query_terms": ["tokens", "from", "user", "query"],
  "start": "YYYY-MM-DD",
  "end": "YYYY-MM-DD",
  "tool": "Read | Bash | ...",
  "tool_match": "regex-or-literal",
  "format": "text | json | tree | html",
  "output": "/path/to/file"
}

Notes:

  • action defaults to list if omitted.
  • Use query_terms for fuzzy matching when action is find-agent or when the user asks in natural language.
  • format should be json when you need to parse results.

Output Contract

Always return a fenced JSON envelope.

{
  "success": true,
  "data": {
    "matches": [
      {
        "session_id": "abc123def456",
        "agent_id": "agent-789abc",
        "timestamp": "2026-02-07T14:30:00Z",
        "subagent_type": "Explore",
        "prompt": "Explore agent analyzing beads codebase architecture and design patterns...",
        "project_path": "/Users/randlee/Documents/github/beads",
        "confidence": 0.78
      }
    ],
    "raw": null
  },
  "error": null
}

Guidelines:

  • Use data.matches for fuzzy search results.
  • Use data.raw to return parsed CLI outputs when the user requested a direct query/list/tree/export.
  • On failure, set success=false and include a concise error string.

Read the full file on GitHub · 409 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. 11d ago First seen · 409 lines · 19 tokens per session scan A bbce57180428

Subscribe to this mod's changes

history-search is an agent published in the GitHub repository randlee/claude-history (5 stars, last pushed 3mo ago), licensed MIT. It adds 19 tokens to every session and 3,121 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.

Related

Other agents, from other repositories

context-finder

Read-only, memory- and index-aware codebase search. Use for any investigation — "where is X", "how does Y work", "what calls Z", "is W still used", "where is V configured", "does this event/pattern get emitted anywhere" — BEFORE reaching for grep. Consults the knowledge graph, code index, and prior session memory…

futuregerald/futuregerald-claude-plugin · 111 tokens

wiki-ingest

Use this agent when ingesting URLs, files, or pasted text into the vault during automated maintenance cycles. Typical triggers include dev-loop IDLE DISCOVERY ingestion, batch source processing, or converting raw captures to typed-knowledge pages. See "When to invoke" in the agent body for worked scenarios.

karlorz/llm-wiki · 64 tokens

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens