Claude conversation_search vs recent_chats: How to Search Past Conversations
Claude's conversation_search performs keyword-based full-text searches inside past conversation content, while recent_chats retrieves chronological lists of chat metadata without inspecting message content.
The asgeirtj/system_prompts_leaks repository reveals how Anthropic implements two distinct tools for accessing conversation history in Claude. Understanding the difference between content search and session listing is essential for developers building integrations that leverage Claude's memory capabilities.
Core Differences Between conversation_search and recent_chats
These tools serve fundamentally different purposes in Claude's architecture:
conversation_search: Finds relevant past conversation snippets by matching a keyword query against message content. It returns excerpts containing the search terms, ranked by relevance.recent_chats: Retrieves the most recent chat sessions (metadata only) without any keyword matching. It provides a chronological overview of conversation history.
The implementation details in Anthropic/old/claude-opus-4.5.md (lines 1096-1100) show that conversation_search is backed by a full-text index over the conversation store, while recent_chats queries the chat metadata table directly.
When to Use conversation_search for Content Retrieval
Use conversation_search when you need to find what was said about a specific topic in previous conversations.
Full-Text Search Capabilities
The tool performs keyword matching against the actual content of past messages. According to the source code, it searches through the conversation store using the provided query string and returns excerpts containing matching terms.
Input Parameters and Limits
The JSON schema defines these parameters:
query(string, required): The search terms to match against conversation content.max_results(optional integer, default: 5, range: 1-10): Maximum number of matching excerpts to return.
{
"name": "conversation_search",
"input": {
"query": "OAuth token handling",
"max_results": 3
}
}
The response includes chat IDs and relevant excerpts, allowing the model to reference specific prior discussions about the query topic.
When to Use recent_chats for Session Management
Use recent_chats when you need a list of conversations without searching their content, such as offering users quick access to their latest sessions.
Chronological Listing Without Content
Unlike conversation_search, this tool returns only metadata: chat IDs, timestamps, project tags, and other session attributes. It does not examine or return message content.
Pagination with Timestamps
The tool supports cursor-based pagination through time-based filters:
n(optional integer, default: 3, range: 1-20): Number of recent chats to retrieve.sort_order(optional string,ascordesc, default:desc): Chronological direction.before(optional ISO-8601 timestamp): Return chats updated before this time.after(optional ISO-8601 timestamp): Return chats updated after this time.
{
"name": "recent_chats",
"input": {
"n": 5,
"sort_order": "desc"
}
}
For pagination through large histories:
{
"name": "recent_chats",
"input": {
"n": 20,
"before": "2026-02-10T00:00:00Z",
"sort_order": "desc"
}
}
Implementation Details from Source Code
The tool definitions reside in Anthropic/old/claude-opus-4.5.md at lines 1096-1100 of the asgeirtj/system_prompts_leaks repository. This file contains the JSON schemas that Claude uses to validate tool inputs.
The conversation_search schema specifies a full-text search interface requiring a query parameter, while recent_chats defines a listing interface with pagination controls. These schemas demonstrate Anthropic's architectural separation between content retrieval and session enumeration.
Summary
conversation_searchperforms full-text keyword searches inside past conversation content, returning relevant excerpts (max 10 results).recent_chatsprovides chronological metadata lists of recent sessions without content inspection (max 20 results, supports pagination).- Use
conversation_searchwhen you need to find what was said about a specific topic. - Use
recent_chatswhen you need to display or navigate which conversations occurred recently. - Both tools are defined in
Anthropic/old/claude-opus-4.5.mdwithin theasgeirtj/system_prompts_leaksrepository.
Frequently Asked Questions
Can conversation_search return full conversation transcripts?
No, conversation_search returns only excerpts containing the matching query terms, not complete conversation transcripts. The tool is designed to surface relevant snippets from past chats based on keyword relevance, with a maximum of 10 excerpts per query.
Does recent_chats allow filtering by project or tags?
The source code in claude-opus-4.5.md shows that recent_chats accepts parameters for time-based pagination (before, after) and sort order, but does not expose filters for specific projects or tags in its JSON schema. The response includes project metadata, but filtering must occur client-side after retrieval.
What is the maximum number of results for conversation_search?
According to the tool definition in the Anthropic system prompts, conversation_search accepts a max_results parameter with a default value of 5 and a hard maximum of 10. Valid inputs range from 1 to 10 inclusive.
How does pagination work in recent_chats?
recent_chats implements cursor-based pagination using ISO-8601 timestamps. You provide before or after parameters to retrieve chats relative to a specific point in time, combined with sort_order (asc or desc) to control the chronological direction. This allows traversal through large conversation histories beyond the single-request limit of 20 chats.
Have a question about this repo?
These articles cover the highlights, but your codebase questions are specific. Give your agent direct access to the source. Share this with your agent to get started:
curl -s "https://instagit.com/install.md" Maintain an open-source project? Get it listed too →