agentleFS
w-winterw-winter/dot314/skills/text-search/SKILL.md

text-search

Skill142 starsChanged 18 days agoMITView on GitHub

Search indexed text corpora with qmd. For indexed content, prefer qmd over grep.

  • Installs packages

1 other project uses a version of this.

Adopted by

Most recently taken up by

  • Other versions1 project uses a version of this.

    Word for word · 0

    None found.

    Edited · 0

    None found.

    Wrote their own version · 1

    1. JinwangMok/openclaw-simple-skills★ 0same name

    How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.

  • In this repository2 other files it gives its agents.

The file

Show its rules and text

We split this skill into the rules it gives an agent

24 rules. About 0 are common, 12 are distinctive, and 12 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈12

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 12

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Very specific:

    Use qmd to search indexed text corpora such as session logs, notes, docs, and logs.

    line 9
  2. Distinctive:

    Before searching, confirm what is indexed:

    line 13
  3. Distinctive:

    Do not assume collection names, paths, or contexts.

    line 21
  4. Very specific:

    Do not use grep/find/jq/cat directly on indexed files to search for meaning.

    line 27
  5. Very specific:

    Use qmd search for exact clues: tool names, error strings, repo names, JSON fields, literal phrases

    line 39
  6. Very specific:

    Use qmd query when lexical search is weak, the request is conceptual, or you want hybrid retrieval + reranking

    line 40
  7. Very specific:

    Use qmd vsearch only when you specifically want pure semantic similarity

    line 41
  8. Very specific:

    Use get, multi-get, and ls to retrieve or browse content after discovery.

    line 115
  9. Distinctive:

    Use this three-step process:

    line 147
  10. Distinctive:

    Do not try to understand a session from raw JSONL snippets alone.

    line 152
  11. Distinctive:

    Use one reliable inspection path:

    line 156
  12. Distinctive:

    If the transcript is enough, stop there.

    line 163
  13. Distinctive:

    If exact raw-session details matter:

    line 165
  14. Very specific:

    If the effective session dir cannot be determined, try the default path first, then ask the user for their Pi session directory rather than …

    line 205
  15. Distinctive:

    If the request is fuzzy, ask for:

    line 217
  16. Distinctive:

    After 2-3 bad searches, stop iterating blindly and ask for more context.

    line 223
  17. Very specific:

    Start here when you have hard clues.

    line 227
  18. Distinctive:

    If lexical search returns many same-score candidates because the clue is broad or common, do not keep repeating broad lexical searches.

    line 236
  19. Very specific:

    Use query, add intent, and scope to sessions when exact search is weak or the request is conceptual.

    line 240
  20. Very specific:

    Use it when a session transcript points you at an original_session and you need exact raw-session details.

    line 270
  21. Distinctive:

    Default rendered output looks like this:

    line 301
  22. Very specific:

    If you opt in to tool results with --include-tool-results, you'll also see bounded output blocks:

    line 319
  23. Distinctive:

    Use it for time-windowed or operational reporting rather than ranked corpus search.

    line 354
  24. Very specific:

    Use qmd for ranked discovery across the corpus.

    line 366

≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

text-search

Use qmd to search indexed text corpora such as session logs, notes, docs, and logs. For indexed content, use qmd for discovery instead of raw grep.

First checks

Before searching, confirm what is indexed:

qmd status
qmd collection list
qmd context list

Do not assume collection names, paths, or contexts.

Core rule

For indexed corpora, use qmd for discovery.

Do not use grep/find/jq/cat directly on indexed files to search for meaning. This is especially important for session JSONL, which is noisy and hard to interpret raw.

Shell usage is still fine for:

  • filtering tool output after discovery
  • housekeeping and file targeting
  • non-indexed content
  • helper scripts in this skill

Choose the right qmd command

For exact clues, start with qmd search.

  • Use qmd search for exact clues: tool names, error strings, repo names, JSON fields, literal phrases
  • Use qmd query when lexical search is weak, the request is conceptual, or you want hybrid retrieval + reranking
  • Use qmd vsearch only when you specifically want pure semantic similarity
qmd search '"toolName":"rp_exec"'
qmd search 'apply_edits'
qmd query "OAuth redirect flow"
qmd vsearch "the session where we changed direction"

Operational notes:

  • qmd query may trigger local model startup or model downloads, so it is not always the fastest first step
  • For session discovery, prefer --files first so you get compact path output instead of long snippets

Build better queries

Use --intent when the request is ambiguous

intent is a steering hint. Use it when the same words could refer to multiple things or when the user remembers the topic better than the exact wording.

qmd query --intent "Pi/Codex/Claude agent sessions about repo editing failures" \
  -c sessions \
  "apply_edits error"

Use structured query documents for important searches

Multi-line query documents are useful when you have both exact clues and fuzzy memory.

  • lex: exact terms, phrases, identifiers, JSON fields
  • vec: natural-language meaning
  • hyde: what the answer likely looked like
  • intent: optional steering context
qmd query $'intent: agent sessions about RepoPrompt edits and patch failures
lex: apply_edits rp_exec "search block not found"
vec: debugging failed file edits in agent sessions
hyde: The agent tried to edit a file several times, the edit did not match, and it switched to a narrower or different approach'

Operational details:

  • The first typed query gets 2x fusion weight, so put the strongest signal first
  • expand: must stand alone; do not mix it with typed lines
  • lex queries support quoted phrases and exclusions such as -sports or -"test data"

Useful output and tuning flags

qmd query --files -n 20 "agent session about flaky tests"
qmd query --json -n 10 "session where we redesigned the search flow"
qmd query --json --explain -c sessions "apply_edits error"
qmd query -C 20 --min-score 0.3 -c sessions "OAuth redirect flow"

Use:

  • --files for compact discovery output and path-based follow-up
  • --json for structured inspection when you need scores/snippets
  • --explain when ranking looks wrong
  • -C, --candidate-limit to reduce reranking work
  • --min-score to drop weak matches
  • -c, --collection to scope the search

For session hunting, --files is usually the best first output mode.

Retrieval commands

qmd get "#abc123"
qmd multi-get "docs/*.md" --json
qmd ls sessions
qmd ls sessions/claude

Use get, multi-get, and ls to retrieve or browse content after discovery.

For session discovery, use this inspection path:

# 1. Discover a session transcript
qmd search -c sessions --files 'apply_edits' -n 5

# 2. Read the session transcript directly
qmd get "qmd://sessions/path/to/session-transcript.md" --full

Each session transcript includes original_session metadata in frontmatter. When exact commands, SQL, edits, or ad-hoc code matter, recover them from the original session JSONL with session_ask or session-view --include-tool-calls. Add --include-tool-results only when tool outputs are evidence.

If qmd is missing

npm install -g @tobilu/qmd
qmd --version
qmd status

Sessions

Agent session transcripts are indexed as the sessions collection.

The sessions collection is a corpus of agent session transcripts generated from session JSONL via session-view. It is optimized for readable search. Very large sessions may be split across multiple transcript documents; use the original_session metadata when you need exact raw-session recovery.

Required workflow

Use this three-step process:

  1. Discover candidate sessions with qmd or analyze-sessions.sh
  2. Inspect the session transcript with qmd get
  3. Recover exact raw-session details only when needed via original_session + session_ask or session-view --include-tool-calls

Do not try to understand a session from raw JSONL snippets alone.

Inspecting session transcript paths

Use one reliable inspection path:

# Read the session transcript directly
qmd get "qmd://sessions/path/to/session-transcript.md" --full

If the transcript is enough, stop there.

If exact raw-session details matter:

# 1. Read the transcript and note its `original_session` frontmatter
qmd get "qmd://sessions/path/to/session-transcript.md" --full

# 2. Recover exact tool-call details from the original session
session-view --include-tool-calls /absolute/path/to/original/session.jsonl

Or use session_ask against that original_session path when you want targeted recovery without reading the whole session.

If original_session is missing or stale

A session transcript's original_session frontmatter may point to a materialized indexing path rather than the live Pi session JSONL. If that path does not exist, use relative_session plus Pi's configured session directory.

For Pi sessions:

  • relative_session: pi/<session-path>.jsonl
  • live path: <PI session dir>/<session-path>.jsonl

Resolve the Pi session dir using Pi's documented precedence:

  1. --session-dir if known from the command/session context
  2. PI_CODING_AGENT_SESSION_DIR if set
  3. sessionDir in Pi settings
  4. default: ~/.pi/agent/sessions

Example:

relative_session: pi/--Users-ww-project--/session-id.jsonl

with the default session dir maps to:

~/.pi/agent/sessions/--Users-ww-project--/session-id.jsonl

If the effective session dir cannot be determined, try the default path first, then ask the user for their Pi session directory rather than assuming the qmd original_session path is still valid.

Filtering transcript output is fine:

qmd get "qmd://sessions/path/to/session-transcript.md" --full | grep -iE 'USER:.*(error|bug|regression)'

Session search playbook

Ask for narrowing clues when memory is vague

If the request is fuzzy, ask for:

  • approximate timeframe
  • which agent/tool produced the session
  • repo or project involved
  • remembered phrase, error text, or tool name

After 2-3 bad searches, stop iterating blindly and ask for more context.

Exact session search

Start here when you have hard clues. Use --files first to avoid wasting tokens on snippets. If lexical search returns an obvious hit, inspect it immediately instead of escalating to query.

qmd search -c sessions --files 'rp_exec' -n 20
qmd search -c sessions --files 'apply_edits' -n 20
qmd search -c sessions --files 'git rebase' -n 20
qmd search -c sessions --files 'search block not found' -n 20

If lexical search returns many same-score candidates because the clue is broad or common, do not keep repeating broad lexical searches. Tighten the query with a more distinctive phrase, tool name, error string, or timeframe clue, or switch to qmd query --intent ....

Escalate when lexical search is weak

Use query, add intent, and scope to sessions when exact search is weak or the request is conceptual. Keep --files on unless you specifically need snippets.

qmd query --intent "Pi/Codex/Claude agent sessions about git trouble during implementation work" \
  -c sessions \
  --files \
  -n 10 \
  "git rebase gone wrong"

Mixed exact + fuzzy session search

qmd query -c sessions --files $'intent: agent sessions about broken code edits in RepoPrompt workflows
lex: apply_edits rp_exec "oldText" "search block not found"
vec: session where file edits failed repeatedly and the agent had to retry'

Browse after narrowing

qmd ls sessions
qmd ls sessions/claude
qmd ls sessions/pi

Inspect with session-view

session-view lives at ~/.pi/agent/skills/text-search/scripts/session-view.

Use it when a session transcript points you at an original_session and you need exact raw-session details. It also accepts RepoPrompt AgentSession-*.json files when you want the compressed RP-side view plus its codexRolloutPath. For Codex sessions, session-view strips the leading injected AGENTS/environment preamble through </environment_context> before rendering the transcript.

# Default: prose-only; omit tool calls and tool result/output blocks
session-view /absolute/path/to/original/session.jsonl

# Opt-in: include assistant tool invocations with full arguments
session-view --include-tool-calls /absolute/path/to/original/session.jsonl

# Escalate only when tool outputs are evidence
session-view --include-tool-calls --include-tool-results /absolute/path/to/original/session.jsonl

# RepoPrompt AgentSession JSON
session-view ~/Library/Application\ Support/RepoPrompt/Workspaces/.../AgentSessions/AgentSession-ABC123.json

You can also inspect the latest local session directly:

# Default: prose-only; omit tool calls and tool result/output blocks
session-view --latest pi
session-view --latest codex
session-view --latest claude
session-view --latest rp

# Opt-in: include full tool-call arguments
session-view --include-tool-calls --latest pi

Default rendered output looks like this:

USER: message

ASSISTANT: response text

With --include-tool-calls, assistant tool invocations are rendered with full JSON arguments:

ASSISTANT:
  [tool_name]
    {
      "path": "file.txt"
    }

If you opt in to tool results with --include-tool-results, you'll also see bounded output blocks:

TOOL [name]: ✓ truncated_output

Example workflows

Find a specific session with hard clues

# 1. Start with lexical search and compact path output
qmd search -c sessions --files 'git rebase' -n 20

# 2. Inspect the transcript
qmd get "qmd://sessions/path/to/session-transcript.md" --full

# 3. If exact details matter, recover full tool calls from original_session
session-view --include-tool-calls /absolute/path/to/original/session.jsonl

Escalate when lexical search is weak

qmd query --intent "Pi/Codex/Claude sessions about git trouble during coding work" \
  -c sessions \
  --files \
  -n 20 \
  "git rebase gone wrong"

Supplemental helper: analyze-sessions.sh

Location: ~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh

Use it for time-windowed or operational reporting rather than ranked corpus search.

~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 24 --report
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 48 --pattern "apply_edits|rp_exec"
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 36 --edit-diagnostics
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 48 --tool-errors
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 24 --tool-stats
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 72 --report --project pi-mono
~/.pi/agent/skills/text-search/scripts/analyze-sessions.sh --hours 72 --tool-stats --tool rp_exec

Use qmd for ranked discovery across the corpus. Use analyze-sessions.sh for recent-window reports and regex-style operational triage.

Session JSONL structure reference

Each JSONL line has a type field:

TypeKey fields
messagerole, content, toolCall
toolResulttoolName, isError, content
customcustomType, data

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.