Agent skill

rg_history

Search your conversation history using ripgrep. Use when you need to find previous messages, file edits, tool calls, or decisions from earlier in the session.

Stars 50
Forks 3

Install this agent skill to your Project

npx add-skill https://github.com/backnotprop/rg_history/tree/main/skill/rg_history

SKILL.md

rg_history

Search your session history with ripgrep.

CRITICAL: Search Strategy

Each event is one long JSON line. Full output will overwhelm you. Always start broad with limited output, then narrow in.

The Pattern

bash
# 1. COUNT first - how many matches?
rg -c 'search_term' session.jsonl

# 2. SNIPPETS - get context around matches (not full lines)
rg -o '.{0,60}search_term.{0,60}' session.jsonl | head -20

# 3. NARROW - pipe to filter further
rg -o '.{0,60}search_term.{0,60}' session.jsonl | rg 'new_string'

# 4. FULL CONTEXT - only when you know what you want
rg '"name":"Edit".*search_term' session.jsonl -M 500

Never run raw rg 'pattern' file.jsonl - you'll get walls of JSON.

Always use one of:

  • -c to count matches
  • -o '.{0,60}pattern.{0,60}' for snippets
  • -M 200 to truncate lines
  • | head -20 to limit results

Find Your Session Files

Run the helper script:

bash
scripts/list-sessions.sh /path/to/project  # defaults to cwd

Or construct manually:

~/.claude/projects/{encoded_project_path}/{session_id}.jsonl

Where encoded_project_path = project path with / replaced by -.

File Structure

~/.claude/projects/-Users-ramos-my-project/
├── abc123-def4-5678-....jsonl    # Main session (UUID format)
├── agent-a1b2c3d.jsonl           # Sub-agent spawned by Task tool
└── ...
  • Main session: Full UUID, your conversation
  • Agent files: agent-{7-char-id}.jsonl, from Task tool
  • Agent IDs appear in results as "agentId": "a1b2c3d"

JSONL Structure Reference

Each line is one JSON object. Key fields:

Message types:

  • "type":"user" + "userType":"external" = actual human input
  • "type":"assistant" = Claude's responses
  • "type":"tool_result" = tool output

Tool calls (in assistant messages):

  • "name":"Edit""input":{"file_path":"...", "old_string":"...", "new_string":"..."}
  • "name":"Write""input":{"file_path":"...", "content":"..."}
  • "name":"Bash""input":{"command":"..."}
  • "name":"Task""input":{"prompt":"...", "subagent_type":"..."}

Content blocks:

  • "type":"text" - message text
  • "type":"thinking" - Claude's reasoning
  • "type":"tool_use" - tool invocation

Other fields:

  • "timestamp":"2025-12-20T..." - when it happened
  • "agentId":"..." - links to agent file
  • "isCompactSummary":true - compacted context

Example Search Patterns

Remember: always use snippets or limit output!

bash
# Find human messages (not tool results)
rg -o '.{0,40}"userType":"external".{0,40}' session.jsonl | head -10

# Find file edits
rg -c '"name":"Edit"' session.jsonl  # count first
rg -o '.{0,50}"name":"Edit".{0,50}' session.jsonl | head -10

# Find edits to specific file
rg -o '.{0,30}auth.{0,30}' session.jsonl | rg 'file_path'

# Find commands that were run
rg -o '.{0,80}"command":".{0,80}' session.jsonl | head -10

# Find code in file writes
rg -o '.{0,60}function.{0,60}' session.jsonl | rg 'new_string\|content'

Quick Reference

Goal Command
Count matches rg -c 'pattern' file
Snippets rg -o '.{0,60}pattern.{0,60}' file
Limit output | head -20
Truncate lines -M 200
Case insensitive -i
Chain filters rg 'a' | rg 'b'

Expand your agent's capabilities with these related and highly-rated skills.

backnotprop/plannotator

plannotator-compound

Analyze a user's Plannotator plan archive to extract denial patterns, feedback taxonomy, evolution over time, and actionable prompt improvements — then produce a polished HTML dashboard report. Falls back to Claude Code ExitPlanMode denial reasons when Plannotator data is unavailable.

4,112 274
Explore
backnotprop/plannotator

release-plannotator

Prepare and execute a Plannotator release — draft release notes with full contributor credit, bump versions across all package files, build in dependency order, and kick off the tag-driven release pipeline. Use this skill whenever the user mentions preparing a release, bumping versions, writing release notes, tagging a release, or publishing. Also trigger when the user says things like "let's ship", "prep a release", "what's changed since last release", or "time to cut a new version".

4,112 274
Explore
backnotprop/plannotator

pierre-guard

Guard against breaking the @pierre/diffs integration in Plannotator's code review UI. Use this skill whenever modifying DiffViewer.tsx, upgrading the @pierre/diffs package, changing unsafeCSS injection, adding new props to FileDiff, or touching shadow DOM selectors or CSS variables that cross into Pierre's shadow boundary. Also trigger when someone asks "will this break the diff viewer", "is this safe to change", or when reviewing PRs that touch the review-editor package.

4,112 274
Explore
backnotprop/plannotator

review-renovate

Review Renovate bot PRs that update GitHub Actions dependencies. Verifies supply chain integrity by checking pinned commit SHAs against upstream tagged releases, reviews changelogs for breaking changes, and confirms compatibility with existing workflow configurations. Use when a Renovate PR updates GitHub Actions in .github/workflows/.

4,112 274
Explore
davila7/claude-code-templates

verl-rl-training

Provides guidance for training LLMs with reinforcement learning using verl (Volcano Engine RL). Use when implementing RLHF, GRPO, PPO, or other RL algorithms for LLM post-training at scale with flexible infrastructure backends.

23,776 2,298
Explore
davila7/claude-code-templates

openrlhf-training

High-performance RLHF framework with Ray+vLLM acceleration. Use for PPO, GRPO, RLOO, DPO training of large models (7B-70B+). Built on Ray, vLLM, ZeRO-3. 2× faster than DeepSpeedChat with distributed architecture and GPU resource sharing.

23,776 2,298
Explore

Didn't find tool you were looking for?

Be as detailed as possible for better results