chatgroup-architecture
ChatGroup architecture — how conversation data flows from raw JSONL to rendered chat groups. Use when working on UserGroup, AIGroup, SystemGroup, display…
Markdown search logic — how in-session and cross-session search works. Use when working on SearchBar, search highlighting, searchHighlightUtils, markdownTextSearch, or SessionSearcher.
How it fires
How this command gets triggered: by you, by Claude, or both.
/markdown-search-logicContext preview
What this command does when you run it.
Markdown search logic — how in-session and cross-session search works. Use when working on SearchBar, search highlighting, searchHighlightUtils, markdownTextSearch, or SessionSearcher.
name: claude-devtools:markdown-search description: Markdown search logic — how in-session and cross-session search works. Use when working on SearchBar, search highlighting, searchHighlightUtils, markdownTextSearch, or SessionSearcher.
How in-session and cross-session markdown search works end-to-end.
Current in-session search intentionally covers:
Current in-session search intentionally excludes:
Primary source files:
`SearchMatch` (renderer store) in `src/renderer/store/types.ts`:
Important distinction:
`SearchBar` updates the query with tab-scoped conversation data:
`setSearchQuery` in `src/renderer/store/slices/conversationSlice.ts`:
Search highlighting is rendered in markdown component trees through:
Each rendered highlight mark includes:
`ChatHistory` collects rendered `<mark>` elements in DOM order and calls:
Why this exists:
Safety guard:
`nextSearchResult` / `previousSearchResult` in `src/renderer/store/slices/conversationSlice.ts`:
`ChatHistory` scroll effect:
`src/shared/utils/markdownTextSearch.ts` is used by both renderer and main process:
Design principle:
Main process search path:
`SessionSearcher` also uses shared markdown search utils, and returns:
These are passed into tab navigation context so opening a search result can jump to the exact in-session match.
When changing markdown/search code, keep these invariants:
1. Parser and renderer must agree on searchable text boundaries. 2. `matchIndexInItem` semantics must stay stable per item. 3. `currentSearchIndex` must represent the global nth visible match. 4. `searchResultCount` must reflect actual rendered match count after canonicalization. 5. Search source scope must be explicit (no accidental inclusion of hidden/internal text).
If you make a new markdown surface searchable:
1. Ensure it uses search context + `highlightSearchInChildren`. 2. Ensure emitted marks include `data-search-item-id` and `data-search-match-index`. 3. Ensure the content is included in `setSearchQuery` source scanning. 4. Ensure parser collection logic in `src/shared/utils/markdownTextSearch.ts` still mirrors render behavior. 5. Add/adjust alignment tests.
Enable debug logs:
Useful logs:
Quick checks when behavior is off:
1. Compare `searchResultCount` vs number of rendered marks. 2. Verify `currentSearchIndex` increments exactly once per click. 3. Check whether exact mark selector exists for current match. 4. Confirm the active tab conversation is the same one used for `setSearchQuery`. 5. Confirm virtualization is disabled during active search.
Main tests relevant to this logic:
The alignment test ensures parser match indexes and rendered mark indexes stay identical across representative markdown cases.
The missing DevTools for Claude Code — inspect session logs, tool calls, token usage, subagents, and context window in a visual UI. Free, open source.
Repo: matt1398/claude-devtools
ChatGroup architecture — how conversation data flows from raw JSONL to rendered chat groups. Use when working on UserGroup, AIGroup, SystemGroup, display…
Design system and visual language — theming, CSS variables, Tailwind config, component styling patterns, icon usage, animations, and z-index layers. Use when…
Explains what "Visible Context" is — the 6 trackable token categories, what falls outside tracking, how it's displayed, and why it matters. Use when someone…
Navigation and scroll orchestration — tab navigation, error highlights, search scrolling, auto-scroll coordination, and common bug patterns. Use when working…