Skip to content

prompt_history stores parse as kind='history', so the default --type prompts search skips them #37

@tony

Description

@tony

Summary

Every backend's prompt-history store — the audit log of what the user typed — is parsed with kind="history" (and role="user"). Because search and grep default to --type prompts, the dedicated prompt-history log is excluded from the default search; it only surfaces under --type history or --type all.

Typed prompts still appear in a default search via the conversation transcripts' user turns, so nothing is unreachable — but a bare agentgrep search <term> --agent <backend> does not return the purpose-built prompt-history store. This is a shared convention, not a single-backend bug: Grok's prompt_history.jsonl and Cursor CLI's prompt_history.json (#27) behave identically.

Mechanism

The role→kind default would map role="user"kind="prompt":

…but the prompt-history parsers set kind="history" explicitly, overriding it even though each entry is a user prompt (role="user"):

The --type prompts gate then drops any record whose kind != "prompt":

…and the default --type is prompts:

Reproduction

find discovers the prompt-history store (Cursor CLI shown; Grok is the same):

$ agentgrep find --agent cursor-cli --json | jq -r '.results[] | "\(.store)\t\(.adapter_id)\t\(.path_kind)"' | sort | uniq -c
    296 cursor-cli.transcripts           cursor_cli.transcripts_jsonl.v1    session_file
    290 cursor-cli.subagent_transcripts  cursor_cli.transcripts_jsonl.v1    session_file
      1 cursor-cli.prompt_history        cursor_cli.prompt_history_json.v1  history_file
      1 cursor-cli.ai_tracking           cursor_cli.ai_tracking_sqlite.v1   sqlite_db

But its records parse as history/user (so do Grok's):

cursor-cli.prompt_history -> kinds={'history'} roles={'user'} n=219
grok.prompt_history       -> kinds={'history'} roles={'user'} n=100

So the same query returns the prompt-history log only under history/all:

$ agentgrep grep --agent cursor-cli <term> --type prompts
893 matches
$ agentgrep grep --agent cursor-cli <term> --type history
8638 matches
$ agentgrep grep --agent cursor-cli <term> --type all
9531 matches

--type prompts (the default) = 893, all from transcript user-turns — prompt_history.json is not among them. --type history (8638) includes it; --type all = 9531. (Counts from a real local store; file paths and prompt text omitted.)

Options (no code change proposed here)

  1. Keep as-is, document it. Prompt-history files are audit logs; kind="history" is defensible, and transcripts already answer the default prompt search. Document that the dedicated prompt-history store needs --type all/history.
  2. Reclassify prompt-history → kind="prompt" so a bare --agent <backend> search returns the typed-prompt log. Repo-wide — affects Grok (shipped) and Cursor CLI (Split Cursor into cursor-cli and cursor-ide, add missing stores #27) — so it would be a cross-backend behavior change warranting a ### Breaking changes CHANGES note.

This issue documents the behavior only; it does not change code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions