Skip to content

Include thinking/reasoning logs in shared context (Gist, clipboard, HTML export) #560

@kianhub

Description

@kianhub

Problem

When sharing conversation context via Publish as GitHub Gist, Copy Context, or other export methods, thinking/reasoning logs are silently stripped out. The formatLogsForClipboard() function in src/renderer/utils/contextExtractor.ts (line 667) explicitly filters to only user, ai, and stdout sources — excluding thinking, tool, system, stderr, and error entries.

This means shared conversations are missing potentially valuable reasoning context. When a user shares a conversation to show how an agent arrived at a solution (not just the final output), the thinking logs are essential.

Note: HTML export (generateTabExportHtml in src/renderer/utils/tabExport.ts) already includes thinking logs — this inconsistency makes the gap more noticeable.

Proposed Solution

Add an "Include thinking/reasoning" toggle to the context sharing flow. When enabled, thinking blocks are included in the exported content.

Affected export paths

Export method Current behavior Proposed
Copy Context (clipboard) Thinking excluded Opt-in toggle
Publish as GitHub Gist Thinking excluded Opt-in toggle in GistPublishModal
HTML Export Thinking already included No change needed

Implementation notes

  • formatLogsForClipboard() (src/renderer/utils/contextExtractor.ts:667) — Add an optional includeThinking?: boolean parameter. When true, include source: 'thinking' entries, formatted with a clear THINKING: header to distinguish them from assistant responses.
  • GistPublishModal.tsx — Add a checkbox/toggle: "Include reasoning/thinking logs". Pass the flag through to formatLogsForClipboard() via the export handler.
  • useTabExportHandlers.tshandleCopyContext() and handlePublishTabGist() both use formatLogsForClipboard(). Both should respect the toggle. For clipboard copy (which has no modal), consider either a settings-level preference or a secondary menu option.
  • Formatting — Thinking blocks should be visually distinct in the markdown output (e.g., wrapped in a <details> tag or prefixed with THINKING:) so they don't get confused with assistant responses.

UX considerations

  • Default should be off (current behavior preserved) — thinking logs can be verbose and many users won't want them in shared gists.
  • The toggle should be per-export, not a global setting, since the same user may want thinking in some shares but not others.
  • Consider also including tool source entries as an additional option, since tool calls (file reads, searches, etc.) provide important context for understanding the conversation flow.

Files involved

  • src/renderer/utils/contextExtractor.tsformatLogsForClipboard()
  • src/renderer/components/GistPublishModal.tsx — Toggle UI
  • src/renderer/hooks/tabs/useTabExportHandlers.ts — Pass flag through
  • src/renderer/types/index.tsLogEntry.source type (reference only)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions