Use with your agent

Search messages and chats by words or meaning

Find a message, an agreement, a person or a file in your chats by words, word forms or meaning, and check the messages around it.

Find a message, an agreement or a file even when you remember only part of a phrase or what it was about. Your agent searches the history saved on your computer, and the messenger's own search too, then shows the message and what was said around it, so you can check the answer.

Search finds a word in any of its forms, and with a little setup it also finds a discussion by its meaning. It finds what is saved or what the messenger's server returns, so download the chats you need first. An empty result does not prove a message was never sent. The examples use Telegram and MAX, and Search in other tools covers WhatsApp, Slack, mail, calls and documents.

What you can search:

  • Messages and discussions: by text, sender, date, subject and nearby messages.
  • People: by name, username or ID, then what you discussed. People
  • Chats, groups and channels: by title.
  • Files: by name and type, and by the words inside a text file, a Word document or a PDF with a text layer. A scan or a photo needs text recognition first, and your agent can run it.
  • Links, attachments and voice notes: messages with a link, a PDF or a voice note, and the words said in a voice note once its transcript is saved.

How word forms, typos and search by meaning work: How search works. What each kind of content needs before it can be found: What gets indexed.

On this page:

  1. Fetch the relevant chat history first
  2. Find a word or phrase
  3. When you don't remember the exact wording
  4. Read the evidence, then widen
  5. Search everything at once
  6. Search in other tools
  7. If a result is missing
  8. Try it with sample messages
  9. Commands, filters and operators
  10. Search CRM deals and keep work apart
  11. More precise queries and technical details

Fetch the relevant chat history first

Before you search older messages, download the chats for the period you need. Signing in does not download all history. Word search in tg and max also asks the messenger's server by default, so it can find messages you have not downloaded yet. Topic search, counts and file filters read only saved messages, and --backend archive keeps a word search on your computer too. If the chat is missing, an empty result does not mean the message was never sent.

Ask your agent to fetch the selected chats or run your messenger's command. Replace Project with the chat title; this example downloads the past month, up to 1,000 messages per run:

tg personal messages sync "Project" --since-time 30d --limit 1000
max personal messages sync "Project" --since-time 30d --limit 1000

If the limit is reached, that month's history may still be incomplete. Instructions for fetching, resuming and checking history: Telegram and MAX.

Find a word or phrase

Start by asking your agent. For MAX, write “max CLI” instead of “tg CLI”:

Request
Use tg CLI. Find where we agreed the renovation deadline in the group and my chat with the contractor. Show the final agreement, check later replies and cite the messages. If history is missing, tell me what needs fetching. Don't send anything.

You should get the agreed date and the messages behind it. If the date was only proposed or later changed, the answer should make that clear. You do not need to know the search syntax.

Optional: commands for the terminal
tg personal search messages invoice
max personal search messages invoice

For an exact phrase, keep the quotes inside the query:

Optional: commands for the terminal
tg personal search messages 'exact:"final invoice"'
max personal search messages 'exact:"final invoice"'

Results link back to messages. Ask your agent to show nearby messages before interpreting an agreement: one line may miss a correction or a later answer.

To search one chat only:

Optional: commands for the terminal
tg personal search messages 'invoice chat:"Project"'
max personal search messages 'invoice chat:"Project"'

You can also filter by person, date or attachments. The Telegram and MAX guides give examples you can adapt.

When you don't remember the exact wording

Message search offers several approaches:

  • A word or exact phrase: when you remember the wording. Use exact: for literal matching.
  • Part of a word: flat* finds words starting with that part, such as “flat” and “flats”.
  • Word forms and shared stems: “invoice” can find “invoices”. Which forms match depends on the archive's language settings.
  • Typos: the default search does not correct typos. Ask your agent to allow misspellings: it can add --discover, which also tries close spellings of the words in the local archive, or search by the start of the word.
  • Meaning: when you remember the subject, such as “the renovation deadline we agreed”, rather than the words. This needs a prepared discussion index.

Word forms, exact matching, indexes and meaning-based search: How search works. Detailed syntax: Telegram and MAX. The --discover option is listed in the command references for Telegram and MAX. These modes describe message search; chat-title and person-name lookup can behave differently.

Words inside files and transcripts match the exact form only.

Use search conversations when you remember what a discussion was about and not which words were used. Ask in your own words, in any language the model reads. It always returns the nearest conversations, even when none of them answers, so open the messages before you rely on one. For an exact name, number or id, use a field search instead. More: Topic search.

Read the evidence, then widen

Open one hit with its neighbors, or follow its reply chain:

tg personal messages context "msg:telegram/1/77/42" --before-n 3 --after-n 3
tg personal messages context "msg:telegram/1/77/42" --thread

If an answer looks thin, read its missing entry. It names what was not searched and the step that fixes it, such as downloading a chat. Each hit says where it matched (matched_in: text, transcript, filename or file). To compare the count with what you expect, stats messages show counts matches by chat, sender, day or hour.

Search everything at once

When you do not know whether something was written in a chat or in your own notes, search both together:

tg personal search all invoice
max personal search all invoice

Each result says whether it is a message or a note. tg and max do not search mail: wcat search mail does, and wcat search all invoice searches messages, mail and notes at once.

Search in other tools

The same requests work in the other tools: name the tool in your request instead of tg. Each one searches what it copied to your computer, and some ask their service too.

  • WhatsApp: wa search messages searches the messages saved on your computer. WhatsApp search
  • Slack: slk search messages also asks Slack's server by default, as tg does. Slack
  • Mail: mail search messages also asks the mail server for mail not downloaded yet. Search your mail
  • Zoom: zm search meetings finds words in your saved meetings, and searches by meaning with --model. Zoom search
  • Documents: drive search, notion search and ydisk search find words in the documents they copied, and search by meaning once the documents are indexed.

If a result is missing

Topic search, counts and filters such as files or links need saved history: download the missing period, then search again. A word search and a search by meaning find different things, so try both when you remember only roughly how something was said. Check the dates, the chats searched and whether the history is complete.

Open the source of the best hit and compare it with what you remembered. If a kind of content never turns up, check the one step it needs: What gets indexed. If a link between records is missing, see How things are linked.

Try it with sample messages

Practice combining filters and checking sources before connecting an account. This playground contains 50 fictional messages in 6 chats, runs on your device and never connects to a messenger. The sample messages are in English: try invoice, budget or coffee.

  1. Start with a word or choose a filter.
  2. Narrow the results by person, chat, date or attachment type.
  3. Open a match to read its context, then change a filter and compare the results.

Sample dates run from two days before today to two days after it and use UTC. Type a field such as has: or in: to see its values. Press Space after a word or completed filter to see fields and operators; use ↑ / ↓ and Enter to insert a suggestion, or Esc to close it. Clear the query or choose All to browse every message.

Flexible search conditions

Find a message across your chats. See what came before, what changed, and where the answer comes from.

Build a Lucene query

Lucene syntax combines words with fields and logical operators. Start with invoice, then add conditions to narrow the result. Use uppercase AND, OR and NOT, and parentheses to make the grouping clear.

QueryWhat it finds
invoice AND budgetMessages containing both words.
Atlas AND (invoice OR budget)Atlas messages containing either invoice or budget.
invoice NOT has:fileInvoice messages without a file attachment.
"final invoice"The words together, in that order.
text:cof*Words starting with cof, including coffee.
text:*off*Words containing off, such as coffee or office. ? replaces one character.
chat:"Client studio" AND from:MiaMessages from Mia in Client studio. Quote names containing spaces.
in:max AND has:voiceVoice notes from a selected messenger. Choose a messenger from the in: suggestions.

text:coffee finds the word coffee. text:cof searches for the whole word cof, so it does not match coffee; add * when you only remember part of a word.

has: also offers attachment, link, file, photo, image, video, audio, sticker, contact, location and poll. has:attachment includes attached media; has:link finds links in the message text. You can combine them: (has:file OR has:link) AND text:budget.

Choose Date for today's date, the current month or the five-day sample window. The inserted query uses date:YYYY-MM-DD for a day or date:[START TO END] for an inclusive range. An asterisk leaves one end open; braces exclude the boundary. For example, the Before tomorrow suggestion uses date:{* TO YYYY-MM-DD} with tomorrow's date.

This playground implements the supported WireCat Lucene fields, rather than every Apache Lucene feature. Fuzzy matching (~), boosting (^) and fields such as filename: are unavailable here. An unfinished or unsupported query keeps the previous valid results visible and marks the problem; it does not silently broaden the search.

Commands, filters and operators

For running the commands yourself, or for steering what your agent runs. Put the tool name and your profile name in front of each command, as in tg personal search messages.

Choose the command

You wantRunNotes
Words in your Telegram or MAX messagessearch messages in tg or maxReads the local archive and, by default, the messenger's server
A phone, email, link or person's name written in messagessearch messages with phone:, email:, domain: or mentions:, or mentions listFound by rules, in any spelling
Everything about one person, in every messengercontacts eventsNeeds the identities linked with contacts link
A discussion, when you remember the subject and not the wordssearch conversationsNeeds conversations rebuild and conversations embed once for the chat
A picture by what it showssearch messages "dog on a beach"English only, and the picture setting must be on: What gets indexed
Mail, notes, or you do not know where it was writtenwcat search all, wcat search mail, wcat search notesThe answer lists the sources it skipped and why
Messages of every messenger at oncewcat search messagesMessages only
A decision or a promisewcat facts listEach fact links to its evidence
A Drive document, by words or meaningdrive search--exact for words only
A Drive file, by name, type, folder, person or tagdrive catalog list or drive catalog searchMetadata only, works offline

A search that names a chat, a sender and a period reads fewer records and returns fewer wrong ones. Add filters in this order: chat, sender, date, kind, attachment, then the words.

FilterFindsExample
chat:One chat, by name or idchat:"Book club"
from:One senderfrom:"Kai Sample"
date:A period, or everything after a daydate:[2026-01-01 TO 2026-02-01}, date>=2026-10-01
kind:Private chats, groups, channels, botskind:group
has:Messages with a file, photo, voice note, link or texthas:file
filename:A file by its namefilename:*.pdf
mime:A file by its type (Telegram only)mime:"application/pdf"
size:Files by sizesize>10MB
content:Words inside a filecontent:invoice
transcript:Words said in a voice notetranscript:invoice
tag:Your own labelstag:work
phone:, email:, url:, domain:, mentions:A value found in the textphone:"+1 555 010 0100", mentions:"person:7"

Field names are case sensitive, and an unknown field is an error, not an empty answer. The full list of fields is in the query language of Telegram and MAX.

tg personal search messages 'chat:"Book club" from:"Kai Sample" date>=2026-10-01 delivery' --limit 10

When the messenger's own server is asked too, only the words, one chat, one sender and the dates go to it. has:, tag:, negations and wildcards are applied locally. Details: How search works.

The operators

WriteMeaning
invoice paidBoth words, in any order (AND is the default)
alpha OR betaEither word
alpha NOT beta, alpha -betaThe first word without the second
+alphaThe word must be there
(alpha OR beta) gammaA group
from:(alice OR bob)One field for several values
date:[2026-01-01 TO 2026-02-01}A range: [ ] includes the end, { } excludes it
invo*Any ending
text:/pass(port)?/A regular expression, matched against whole words

Three rules prevent most surprises:

  • A query that is only a negation selects nothing. Pair it with a positive condition: has:photo NOT has:text.
  • An explicit AND binds tighter than OR. alpha OR beta gamma means (alpha OR beta) AND gamma.
  • and, or and not in lower case are ordinary words. Typos such as invoice~1 and boosts such as invoice^2 are errors.

Page through the results

The answer says whether more results exist (has_more). That describes the page, not whether the messenger holds more. Repeat the same command with the same filters and ask for the next page. Which flag does it depends on the command:

CommandNext page
search messages in tg and max--page <n>, counting from 1
contacts events--cursor <cursor>, with the cursor from the answer's page.next
mentions list, drive catalog list, drive catalog search--page <n>
wcat search notes, drive search--offset <n>
wcat search all, wcat search mail, wcat search messages--limit only, up to 100: narrow the query instead

Keep the output small

  • --limit <n> caps the hits.
  • --json=<fields> keeps only the fields you name, for example --json=ref,date,text. It is the one option that shrinks every answer: 31% to 64% smaller than full --json in our measurement.
  • --jsonl prints one result per line. It is no smaller than --json. --full returns whole texts.
  • --max-output-bytes caps machine output at 4 MiB by default. A result over the cap fails visibly instead of being cut.
  • --context <n> adds n neighboring messages on each side of a hit. It is 0 when the output is not a terminal.

Recipes

Replace the names with yours.

GoalCommand
An agreement and its sourcetg personal search messages 'chat:"Book club" agreed date>=2026-10-01' --limit 5
Everything about one person this monthtg personal contacts events "Kai Sample" 'at>=2026-10-01'
Where a phone number appearstg personal search messages 'phone:"+1 555 010 0100"'
Files sent in a chat last weektg personal search messages 'chat:"Book club" has:file date>=2026-10-07'
What a Drive document says about a topicdrive personal search 'budget' --exact --limit 5

For longer ones, see the recipes for Telegram and MAX.

Common mistakes

MistakeWhat happensInstead
Searching before the history is downloadedFew or no resultsDownload the chat first; read missing in the answer
Reading an empty answer as "never sent"The archive may be incompleteCheck what the answer says it covered
Quoting a phrase to get the exact formQuotes match any word formexact:"final invoice"
mime:application/pdf without quotesThe / starts a regular expressionmime:"application/pdf", or filename:*.pdf
mime: in MAXMAX does not report file typesfilename:*.pdf
has:photo to find what a picture showsIt only says a photo is attachedPicture search, in English
A message field in a Drive searchDrive has its own filterstag: and --exact, or catalog list
From: instead of from:An errorField names are lower case
Asking a picture search in another languageThe model knows English onlyHave your agent translate first

Search CRM deals and keep work apart

wcat search all also finds the deals and leads a CRM tool such as b24 stored, by the words of their title. --only crm searches them alone:

wcat search all 'renewal' --only crm

People and companies are not in search all. Find them with wcat search people and wcat organizations list. A deal outside the CRM account's sync scope is not found either.

An agent that uses wcat's MCP server sees in search all only what its permissions let it list. When the server denies deals.list or leads.list, those hits are left out, and the answer says so in an issue for crm. crm.list leaves the whole CRM part out, and business.list leaves out invoices, payments, orders, contracts, subscriptions, products and wallets. --only crm and --only business search one part alone, and are refused when that part is denied. These permissions do not limit a search you run yourself in a terminal.

wcat search all 'renewal' --only business

A question about who someone is, or how a person, a company and a deal relate, is better answered from their context than from search. Ask your agent to work in this order:

  1. Find the one record: wcat search people, wcat organizations list or wcat deals list.
  2. Read its context: wcat context person:<id>, wcat organizations context <ref> or wcat deals context <ref> --brief.
  3. Follow only the relationships the question needs, for example wcat relationships list kind:reports-to 'to:"person:12"'.
  4. Search for the evidence after that, with wcat search all.
  5. Cite the references, and name every gap the answer lists under "Not read". A reported relationship is only the CRM's word.

Clients, colleagues and deals shows these answers with examples.

Groups of accounts

A group keeps your work accounts apart from your personal ones. With no group named, a run reads every account: that is the group all, which always exists and never leaves anything out. personal, work and any other group are groups you save yourself. Put the CRM account and your work mailbox in work, then name the group first, and the run reads only its accounts:

wcat groups add work bitrix24:example.bitrix24.com
wcat groups add work email:owner@northstar.example
wcat groups add personal telegram:100
wcat groups add personal email:owner@northstar.example
wcat groups list
wcat work search all 'renewal'

An account can be in two groups. wcat groups list shows each saved group, then all, and marks every account that another group holds too. Duplicates are allowed, and the list ends with them. It also shows each account's profile names in every tool, such as the profile work in tg and in b24, once those tools have run. A profile named like a group is only a suggestion and never puts an account in that group.

$ wcat groups list
work
  bitrix24:example.bitrix24.com
  email:owner@northstar.example  also in personal
personal
  telegram:100
  email:owner@northstar.example  also in work
all
  bitrix24:example.bitrix24.com  all  also in work
  email:owner@northstar.example  all  also in work, personal
  google-calendar:owner@northstar.example  all
  telegram:100  all  also in personal
duplicate: email:owner@northstar.example is in work, personal

wcat groups remove personal email:owner@northstar.example takes the mailbox out of personal, so it is no longer a duplicate, and all still reads it. wcat groups move telegram:100 personal work moves an account in one write: first the account, then the group it leaves, then the group it joins. A group you never saved does not exist: a run that names it is refused, and the answer lists your groups and the profiles named like it. After the first sync of a CRM account that no saved group lists, the sync's answer suggests wcat groups add work with that account. WCAT_GROUP=work works like the first word for every command. --source personal means your own messenger accounts and not the group personal.

A group narrows the messages, mail, calendar events, CRM records and people a run reads. What you make yourself in wcat belongs to no account, so it is in every group: your notes, projects, tasks, invoices, memories and facts. wcat work search all 'renewal' finds the deal and the mail, and wcat personal search all 'renewal' finds only the mail.

A run that names no group still reads every account. To keep an agent inside one group, start its wcat with WCAT_GROUP_LOCK, for example WCAT_GROUP_LOCK=work wcat mcp serve. Under the lock, wcat refuses the messages, mail, calendar events, CRM records and people of accounts outside the group. It also refuses another group, --source all, an account outside the group and a change to the groups, and the agent cannot lift the lock. A command that cannot keep to a group is refused as a whole, so the lock fails closed:

$ WCAT_GROUP_LOCK=work wcat messages show msg:telegram/100/201/1
{"error":{"code":"permission_error","reason":"access.denied","message":"this process is locked to group work (WCAT_GROUP_LOCK) — msg:telegram/100/201/1 belongs to an account outside it","details":{"reference":"msg:telegram/100/201/1"},"retry":{"safe":false}}}

$ WCAT_GROUP_LOCK=work wcat personal search all renewal
{"error":{"code":"permission_error","reason":"access.denied","message":"this process is locked to group work (WCAT_GROUP_LOCK) — group \"personal\" (first word) is refused","retry":{"safe":false}}}

What the group holds still answers. Alice's context under the lock reads only the CRM account and counts the accounts it kept out without naming them. Memories and facts leave out evidence and sources outside the group and say how many they left out. wcat relationships list leaves out a row whose end only an outside account saw. Your own tasks stay visible:

$ WCAT_GROUP_LOCK=work wcat context person:3
Alice  person:3
...
Business
Organizations
  Acme Ltd  organization:1  member-of contact (Procurement manager) reported by bitrix24:example.bitrix24.com
...
Not read: other accounts — 2 outside group work
Read: bitrix24:example.bitrix24.com

$ WCAT_GROUP_LOCK=work wcat tasks list project:ATLA
ATLA-1 · open · chore · ATLA · Follow up on the Acme renewal

Which commands run under the lock: Lock an agent to a group.

More precise queries and technical details

Learn filters and operators in the Telegram query guide or MAX query guide. How search works explains indexing, conversations and ranking after the practical guides.

For the general grammar, read the official Apache Lucene query parser syntax. WireCat's references define which features work in the tools. The search architecture guide explains how message search, conversation graphs and embeddings fit together.