dropInheritedPrefix

fun dropInheritedPrefix(allMessages: List<Message>, inherited: List<Message>): List<Message>

Strips a common prefix of inherited messages from a full message list.

Used to extract only the messages that a subgraph added to the prompt, excluding messages inherited from the parent context (relevant when freshHistory = false). Messages are compared by role and content.

Return

Only the messages added by the subgraph.

Parameters

allMessages

The full prompt messages at the end of subgraph execution.

inherited

The prompt messages captured before the subgraph started.