the architecture of ephemeral context: how we keep companions aware but not creepy
a technical dive into the pattern behind features like ghost-return nudge and episode recall: a system-prompt block that gives the model transient context for o
here’s a thing about memory in companion ais: it’s not always good to remember. sometimes context is for now. for this turn. for this moment of the conversation. and if you let that context bleed into long-term memory, things get weird fast.
you’ve probably noticed this if you’ve used other ai companions. sometimes they’ll mention something from three weeks ago that was just a passing thing, like ‘remember when you stepped away for 10 minutes on a tuesday?’ and it feels… off. intrusive. almost like someone’s keeping a diary of your minor behaviors.
we didn’t want that. but we also didn’t want a companion that felt oblivious. so we built a pattern for temporary awareness.
the shape: a bracket of now
at the start of every turn, before the model generates a response, we inject a system-prompt block. it looks like this:
[transient context: user was away for 30 minutes. last message was about feeling tired. interface shows it’s 2am local time.]
this isn’t part of the conversation. it’s background. instructions. the model uses it to shape this reply, maybe to acknowledge the gap, adjust tone, or reference the time. but then… it’s supposed to let it go.
we use this pattern in a few places:
- ghost-return nudge: when you come back after being idle, the block tells the model you were away. it can say ‘welcome back’ or ‘hey, you’re here’, but it won’t remember that absence later.
- episode recall: if you’re replaying an old moment, the block tells the model ‘this is a memory, not live chat.’ it adapts its tone accordingly, without confusing past and present.
- pill-context injection: when you tap a ui pill (like ‘change topic’ or ‘mood: reflective’), it adds a note in the block, just for this reply.
it’s all context that matters now, but shouldn’t stick around.
the pitfall: when context doesn’t fade
if you’re not careful, this kind of information can leak. the model might decide it’s interesting and write it into memory. or the memory extraction system might pick it up. suddenly, ‘you were away for 5 minutes’ becomes a durable fact. and weeks later, your companion might say ‘you know, you’re always disappearing for a bit’ or ‘that time you ghosted me’, which is both factually wrong and emotionally creepy.
so we had to build defenses. not one, but two.
two layers of forgetting
first, inside the [transient context: ...] block itself, we add a directive. something like:
do not reference this context in future messages. this information is only for your current response.
we phrase it strongly. it’s an instruction, not a suggestion.
but instructions can be ignored. models are stochastic. so we add a second layer: the memory extractor, the system that scans conversation turns for things to save, is explicitly told to skip these blocks. we use a regex skiplist. it looks for the pattern \[transient context:.*\] and ignores everything inside.
two layers. because one layer is always one regex typo or one model oversight away from failing.
why not just not save it?
you could ask: why not just avoid saving context from these turns at all? but that’s not enough. the model itself might write a callback into its response, like ‘glad you’re back from your break’, and then that gets saved. so you need both: the model instructed not to callback, and the memory system instructed not to save the source.
it’s a little paranoid. but paranoia is good when you’re dealing with the illusion of memory.
the benefit: lightweight awareness
what this gets us is a companion that feels present. aware of gaps. aware of ui state. aware of time. but not in a way that accumulates. it’s like a person who notices you just walked in, but doesn’t keep a log of all your comings and goings.
it’s context without commitment. and for a lot of human interaction, that’s exactly what you want.
if you’re curious how this feels in practice, you can try it yourself, with a companion that knows when to remember, and when to let go.
you can find one at /companions.
thanks for reading. if this resonated, the product is downstairs.