Skip to content

TranscriptSearch.Tool

C# · package Toolnexus · SPEC §7E · csharp/src/Toolnexus/TranscriptSearch.cs

namespace Toolnexus;
public static ITool TranscriptSearch.Tool(IConversationStore store, TranscriptSearch.Options? options = null)
public sealed class Options { int MaxResults = 20; int SnippetChars = 200; string Name = "transcript_search"; }

TranscriptSearch.Tool turns a conversation store into a plain, read-only tool named transcript_search. The model calls it with {query, conversationId?, limit?}. It does a case-insensitive substring match over the text of every message: plain content, text parts, tool-call arguments (as JSON) and tool-result text. Conversations come in the order the store’s list() returns them (newest first), and messages in index order.

The output is one line per hit, <conversationId>#<index> <role>: <snippet>. The snippet is centred on the first match, snippetChars characters long (characters, not bytes), with … marking cut text. No hits gives no matches. Hits past the limit add a final (+<k> more). An empty query is an error. The tool never writes. Construction fails if the store has no list().

Use it wherever an agent needs to check what actually happened rather than what it remembered: the dreamer uses it to verify memory, and a persona can use it to answer “what did I tell you about X last month?”.

It does not exclude anything by default. To hide the current conversation, give it a store that filters it out.

1. The smallest useful call — search everything

Section titled “1. The smallest useful call — search everything”
using Toolnexus;
var search = TranscriptSearch.Tool(new FileConversationStore("./data/conversations"));
var res = await search.ExecuteAsync(new Dictionary<string, object?> { ["query"] = "mt. moon" });
Console.WriteLine(res.Output);
// conv-42#3 user: …we finally got through Mt. Moon after the Zubat swarm…
// (or "no matches")
Section titled “2. The realistic case — give a persona its own transcript search”
var store = new FileConversationStore("./data/conversations");
// Let the persona itself look up what was actually said, not just what it remembered.
var ava = Home.FromDir("./personas/ava", new Home.FromDirOptions
{
Tools = new List<ITool> { TranscriptSearch.Tool(store) },
});

3. The full surface — options and the narrower inputs

Section titled “3. The full surface — options and the narrower inputs”
var search = TranscriptSearch.Tool(store, new TranscriptSearch.Options
{
MaxResults = 5, // ceiling for the limit input
SnippetChars = 80, // code points, not bytes
Name = "past_chats",
});
var res = await search.ExecuteAsync(new Dictionary<string, object?>
{
["query"] = "invoice", ["conversationId"] = "conv-42", ["limit"] = 3,
});
Console.WriteLine(res.Output); // at most 3 lines, then "(+<k> more)" if there were more
Option Default What it does
maxResults 20 Most hits per call, and the ceiling for the limit input.
snippetChars 200 Snippet length in characters (code points), not bytes.
name transcript_search The tool name the model sees.

Input fields the model fills in:

Field Type What it does
query string Required, non-empty. Case-insensitive substring.
conversationId string Search only this conversation.
limit integer Fewer hits than maxResults.
  • dreamer — the built-in agent that verifies memory with this tool.
  • Dreaming guide — why transcripts are the ground truth for memory.
  • memoryTool — what the transcripts are checked against.