feat(gmail): Add thread message count to search results#99
Merged
steipete merged 1 commit intoopenclaw:mainfrom Jan 21, 2026
Merged
Conversation
Show message count in search output to help agents and users understand when an email is part of a multi-message conversation. Before: ID DATE FROM SUBJECT LABELS xxx Jan 20 John Hello INBOX After: ID DATE FROM SUBJECT LABELS THREAD xxx Jan 20 John Hello INBOX [3 msgs] Problem: When searching Gmail, the results show thread IDs but not the number of messages in each thread. This makes it hard for AI agents to determine if a message is a standalone email or part of a conversation. Agents often miss full thread context when they only fetch a single message. Solution: - Add MessageCount field to threadItem struct - Populate message count from thread.Messages - Add new THREAD column: [X msgs] for threads, - for single messages - Keep LABELS column for backward compatibility - Include messageCount in JSON output for programmatic access - Update tests to verify MessageCount in JSON output Prompt context that inspired this change: > I'm using gogcli from an AI agent and I was looking at recent emails. > I searched for emails from today and found an email from Claire but I > couldn't see that there were replies in the thread. The search results > only showed the original email, not the replies. This change makes it immediately visible when search results contain threads with multiple messages, allowing agents to fetch the full thread when needed.
steipete
added a commit
that referenced
this pull request
Jan 21, 2026
steipete
added a commit
that referenced
this pull request
Jan 21, 2026
Collaborator
|
Landed via temp rebase onto main.\n\n- Gate: pnpm lint && pnpm build && pnpm test\n- Land commit: b6a19e6\n- Merge commit: c2b784a\n\nThanks @jeanregisser! |
vidarbrekke
added a commit
to vidarbrekke/gogcli-enhanced
that referenced
this pull request
Mar 6, 2026
…ounts openclaw#99; changelog only, feature already on main) Made-with: Cursor
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
…icator-new feat(gmail): Add thread message count to search results
klodr
pushed a commit
to klodr/gogcli
that referenced
this pull request
Apr 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Show message count in search output to help agents and users understand when an email is part of a multi-message conversation.
Problem
When searching Gmail via
gog gmail search, the results show thread IDs but not the number of messages in each thread. This makes it difficult for AI agents (and humans) to determine if a message is a standalone email or part of a conversation.Example scenario:
gog gmail search 'newer_than:1d'Solution
This PR adds message count to the search output:
Before:
After:
Single-message emails show
-, multi-message threads show[X msgs].The
LABELScolumn is preserved for backward compatibility.Changes
MessageCountfield tothreadItemstruct (for JSON output)len(thread.Messages)infetchThreadDetails[X msgs]for threads,-for single messagesmessageCountfield for programmatic accessFeedback Requested
[X msgs]format clear, or should we just show the raw count (e.g.,6instead of[6 msgs])?Additional Notes
I considered updating the gogcli skill documentation to reduce confusion around when to use
gog gmail getvsgog gmail thread get. However, having thread message count visible in search results benefits all users, not just agents — similar to how Gmail's web UI shows conversation counts.I was using MiniMax M2.1 for this session. It's unclear if a more capable model like Claude Opus would have been less confused by the lack of thread context, but making this information explicit removes the ambiguity entirely.
Testing
-in THREAD column[X msgs](e.g.,[6 msgs])messageCountfield