Skip to content

Multimodal follow-up: media compaction and offload (checkpoint duplication, per-part limits, workspace offload) #911

Open

Description

@blove

Follow-up from the multimodal sub-project (spec docs/superpowers/specs/2026-10-02-ag-ui-multimodal-design.md §2.5, §9). Deliberately out of scope there: the only bound on media is the 8 MiB request body, and inline bytes are kept wherever a message lives.

What this is about:

  • Checkpoint duplication. An inline (data) image on a user message lands in the HumanMessage and is persisted per LangGraph checkpoint, so one image is stored once per step of that run in SQLite/Postgres.
  • Tool results store media twice. A tool returning inline media keeps the bytes in the model-visible content blocks and in additional_kwargs.b4_content_parts (the UI copy).
  • History re-send cost. Every AG-UI client resends the whole thread on every run; inline media in history costs wire bytes each turn (the runtime forwards only the newest user message to the model, so not model tokens).
  • No per-part limit. Provider ceilings differ (Anthropic 5 MB/image, OpenAI 20 MB); today a part is either carried or dropped, never resized.
  • Offload. Tool-output offloading bounds only the text of a result; media bypass it. Offloading media to the thread workspace (and replacing it with a reference) is the natural extension.
  • Summarization already renders media as a placeholder for counting and for the summarizer prompt; a compaction pass could replace aged media in history the same way.

Design questions: where compaction runs (checkpointer write path vs a maintenance pass like memory consolidate), what replaces a compacted part for the model (a placeholder text, a workspace link, a thumbnail), and whether url sources should ever be fetched and cached by B4.run (currently never — no SSRF surface).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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