fix(desktop): persist persona/skill/profile across turns (#54)#62
Merged
Conversation
…every turn) (#54) Persona (ADR-0007), bundled skill (ADR-0029), and the <user-profile> personalization recall (P9.2) were delivered only on the FIRST user turn of a session, then never re-sent — so in a multi-turn chat the standing guidance faded and the model 'forgot' the active skill/persona and the learned profile (the custard/knowledge-graph case). Re-deliver them on EVERY turn. They live AFTER the cache breakpoint (invariant #5/#6), so re-sending does not bust the frozen-prefix KV cache; the only cost is a few input tokens per turn — the tradeoff that makes the guidance actually stick. The profile is re-read each turn (recallPreamble()), so facts learned mid-session show up next turn. The cross-session <recalled-memory> block stays ONCE per session (a session-start recall of prior-session facts, not standing guidance). Supersedes the 'delivered once per session' delivery noted in ADR-0007/0029 for standing guidance. Extracted the assembly into a pure buildUserTurnPreamble() (desktop/preamble.ts) and removed the now-unused personaDelivered/skillDelivered/recallDelivered flags. 5 new unit tests prove persona/skill/profile persist across turns while memory-recall is once; full desktop suite (277) green; tsc clean. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #54.
Problem
Persona, bundled skill, and the
<user-profile>personalization recall were delivered only on the first user turn of a session, then never re-sent. So in a multi-turn chat the standing guidance faded and the model 'forgot' the active skill/persona and the learned profile — e.g. it searched workspace files instead of using the knowledge-graph facts it had just learned.Fix
Re-deliver persona + skill + profile on every turn. They live after the cache breakpoint (invariant #5/#6), so re-sending does not bust the frozen-prefix KV cache — the only cost is a few input tokens per turn, which is the tradeoff that makes the guidance stick. The profile is re-read each turn so mid-session learning shows up next turn. The cross-session
<recalled-memory>block stays once per session (a session-start recall, not standing guidance).Supersedes the 'delivered once per session' model in ADR-0007/0029 for standing guidance (worth an ADR note if you want one).
Verification
Extracted the assembly into a pure
buildUserTurnPreamble()(desktop/preamble.ts) and removed the now-unused delivered flags. 5 new unit tests prove persona/skill/profile persist across turns while memory-recall is delivered once; full desktop suite (277) green; tsc clean.🤖 Generated with Claude Code