Dashboard › opencode-lore › Prompt-delta, provenance, and structure…
01a0a580-e8f7-7860-8e5a-b422ae1f5831Prompt-delta insertion must not split assistant tool_use from the following user tool_result or occupy the true tail. safeDeltaInsertIndex() caps before the tail and walks backward across tool calls; keep the memory closer as a separate assistant message. Normalize provider tool_result strings or block arrays into GatewayContentBlock[], preserving multimodal output. Keep provenanceContent replay-only and never copy it into visible or temporal content. Recall follow-ups use structured assistant tool_use plus user tool_result, matching expandRecallMarkers(), rather than plain text that models may echo. Preserve Anthropic thinking/signatures and safe opaque Responses output, but exclude function calls, outputs, and item references from replay. When coalescing assistants, preserve leading thinking or redacted-thinking blocks at content[0].