@@ -16,6 +16,7 @@ type LogEntry struct {
1616 Source string
1717 SenderID string
1818 Content string
19+ Reasoning string // NEW: reasoning content from LLM
1920 Timestamp time.Time
2021 }
2122
@@ -246,6 +247,56 @@ func renderLogEntry(entry LogEntry, maxWidth int) []string {
246247 }
247248 }
248249
250+ // Render reasoning if present
251+ if entry.Reasoning != "" {
252+ // Add spacing line
253+ emptyLine := contentStyle.Width(maxWidth).Render("")
254+ result = append(result, emptyLine)
255+
256+ // Reasoning header in dimmed purple/magenta
257+ reasoningHeaderStyle := lipgloss.NewStyle().
258+ Foreground(lipgloss.Color("170")). // Dimmed purple
259+ Background(logBgColor)
260+
261+ reasoningStyle := lipgloss.NewStyle().
262+ Foreground(lipgloss.Color("213")). // Lighter purple for reasoning text
263+ Background(logBgColor)
264+
265+ reasoningHeader := "REASONING:"
266+ reasoningHeaderWidth := len(reasoningHeader) + 1 // +1 for space after
267+ reasoningContentWidth := maxWidth - reasoningHeaderWidth - padLeft - padRight
268+ if reasoningContentWidth < 20 {
269+ reasoningContentWidth = 20
270+ }
271+
272+ // Wrap reasoning text
273+ wrappedReasoning := wrapText(entry.Reasoning, reasoningContentWidth)
274+
275+ for i, line := range wrappedReasoning {
276+ lineLen := lipgloss.Width(line)
277+ remainingWidth := reasoningContentWidth - lineLen
278+ if remainingWidth < 0 {
279+ remainingWidth = 0
280+ }
281+ paddedLine := line + strings.Repeat(" ", remainingWidth+padRight)
282+
283+ if i == 0 {
284+ // First line: left pad + styled header + space + content
285+ leftPad := contentStyle.Render(strings.Repeat(" ", padLeft))
286+ styledHeader := reasoningHeaderStyle.Render(reasoningHeader)
287+ styledContent := reasoningStyle.Render(" " + paddedLine)
288+ result = append(result, leftPad+styledHeader+styledContent)
289+ } else {
290+ // Continuation lines: left pad + indent + content
291+ leftPad := contentStyle.Render(strings.Repeat(" ", padLeft))
292+ indent := strings.Repeat(" ", reasoningHeaderWidth)
293+ styledIndent := contentStyle.Render(indent)
294+ styledContent := reasoningStyle.Render(paddedLine)
295+ result = append(result, leftPad+styledIndent+styledContent)
296+ }
297+ }
298+ }
299+
249300 return result
250301 }
251302
@@ -260,6 +311,7 @@ func LogEntryFromMemory(m *store.Memory, currentMysisID string) LogEntry {
260311 Source: source,
261312 SenderID: m.SenderID,
262313 Content: m.Content,
314+ Reasoning: m.Reasoning, // NEW: copy reasoning field
263315 Timestamp: m.CreatedAt,
264316 }
265317 }