Add Runtime.DynamicIdentityHint, a live, per-turn identity fact

Runtime.StaticSystemPrompt is cached and reused verbatim every turn —
right for anything that doesn't change mid-conversation, wrong for a
fact a caller needs to update live (e.g. after a runtime model switch)
and have the model actually notice. A model tends to just repeat what
it already told the user earlier in the same conversation over a
background instruction it read once near the top of a large cached
block, so updating only the static prompt after a switch left the
model insisting it was still whatever it started as.

DynamicIdentityHint rides the same per-turn (uncached) system prompt
slot Run/RunTurn already use for the date line and KG hint, so setting
it takes effect on the very next turn with the same recency the model
grants its own last statement.
This commit is contained in:
sausheong committed 2026-09-07 00:15:23 +08:00
1 parent f624e4c7bd
commit 0ccfdb2a24
5 files changed
+41 -14

No files matched your search

+2 -2
View File
@@ -443,8 +443,8 @@ func TestRuntimeDynamicSuffixIncludesDate(t *testing.T) {
// this proves the date is stable across turns of a single Run.
func TestRuntimeDateLineComputedOncePerRun(t *testing.T) {
dl := "Today's date is 2026-05-01."
a := buildDynamicSystemPromptSuffix(dl, "")
b := buildDynamicSystemPromptSuffix(dl, "")
a := buildDynamicSystemPromptSuffix("", dl, "")
b := buildDynamicSystemPromptSuffix("", dl, "")
require.Equal(t, a, b)
}