Skip to content

MEMORY: capture reasoning_content as reflective memory #544

@Hmbown

Description

@Hmbown

Thesis

V4's reasoning_content is a high-fidelity log of the model's internal decomposition — why it took an action. Today the engine sanitizes/placeholders it just to avoid HTTP 400 (the API requires reasoning_content replay on tool-call rounds). Inversion: capture every block as a reflective memory record (#536's taxonomy) tied to the producing turn. The HTTP 400 workaround becomes the load-bearing connection between the model's actual thinking and the persistent memory store.

Soft-blocked on #534/#536 landing.

Current behavior

  • crates/tui/src/client/chat.rs:458-467 substitutes a placeholder string when reasoning_content is missing, just to keep the conversation chain valid for V4 thinking mode.
  • crates/tui/src/client/chat.rs:688-714 scans every assistant message and forces a non-empty reasoning_content for replay.
  • The actual reasoning blocks are surfaced to the UI as ephemeral content; not persisted, not queryable, not searchable.

Proposed change

Open questions / risks

Acceptance signals

  • reasoning_content blocks are persisted via MemoryBackend.
  • Recall surfaces the original reasoning when querying about a specific edit/file.
  • Edge graph shows causes links from reasoning → tool call → file change.
  • A turn 5 sessions ago can be queried: "what was the model thinking when it wrote function X?"

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    Status
    In progress

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions