I built a companion bot that never knows how you reacted
I'm building a companion bot on my own called Keepsake. It has an awkward flaw: every time it says something, it has no idea how the person on the other end reacted. Maybe you laughed, or absent-mindedly patted the little figure standing on your desktop. Maybe you deleted the message, cut it off mid-sentence, or turned down something it offered to do. None of that, good or bad, ever reaches it. So it's always fully charged and always agreeable, like someone who never reads the room.
When I realized this, I was a bit embarrassed. I'd given it memory, eyes and a voice, yet never let it know whether anyone actually responded to what it said.

How I got here
Its abilities were added one at a time: remembering things, looking at images, going online, operating your computer for you, speaking out loud, sending stickers, and that little figure on your desktop. I just kept piling them on, until everything was tangled together and changing one thing meant several others moved with it.
At first I only meant to tidy up the code. Tidying meant tracing where each ability comes in and where it goes out. That's when I noticed every line pointed outward: words go out, actions go out, and nothing comes back. Only then did it hit me that messy code hurts me, but the lack of an echo hurts the people using it. A companion that gets its message deleted, gets interrupted, gets turned down, and greets you just as warmly the next time: that warmth is actually pretty cold.
So tidying turned into a rework. What was missing was the middle part: what it did, how that turned out, and then using that outcome to change its state and habits so it does things differently next time.
Filling that in first required somewhere to keep what it learns. The thinking is done by the model, which I'm not touching, so I can't count on stuffing what it learns into the model; it needs a separate layer outside the model to record and adjust things. Once I thought of it that way, building it like a person fell into place. The layer outside the model is the brain, split into memory, attention, self, conscience, sense of time and execution, plus a piece for emotion, and everything it learns is kept in that layer. The abilities that used to be tangled together go under organs like eyes, ears, mouth, nose and body, as plugins you can switch on and off. Organs bring what happens outside in and carry out what it wants to do; deciding how an outcome counts, and what to change afterward, belongs to the brain.

My first idea was wrong
My earliest idea was crude: good feedback adds points, bad feedback subtracts them.
After a few days of thinking, it was clearly wrong. What that produces is something that uses one trick forever: a quip lands well once, its score goes up, so it keeps using it, and the more it uses it the higher the score climbs. I'd be raising, with my own hands, someone who only knows one joke.
So I changed it. The brain keeps an expectation for each way of doing things: roughly how much it thinks you'll go for it. When feedback arrives, it subtracts the expectation from the actual outcome, and only that difference decides how much its state and habits change. If the outcome matches what it expected, nothing changes.
With that change, getting bored of something comes built in. Use the same charm move ten times in a row and the expectation climbs all the way up, the difference drops to zero, and it naturally stops getting excited about it, with no extra rule needed to stop it.
Bad outcomes weigh more, and some stick after one time
Next came how much good and bad should weigh. Bad outcomes count for more than good ones: the push toward worse is a bit more than twice as strong as the push toward better.
And there's a category that doesn't need to accumulate; once is enough: you delete its message, refuse its action, say "don't do that", or the conscience part blocks something it wanted to say. The aversion this leaves barely fades, and no habit can override it. I copied this one straight from people, and even after copying it, I'm not sure about it.

Habits, and "not sure yet"
What it learns comes in two kinds. Things that have happened enough times, with a stable expectation, get set into a short sentence while it sleeps and sorts its memories, something like "keep replies shorter at night". That's a habit: quick to use, but fixed. Things that have only happened a few times, or that have had a lot of surprises lately, get marked "not sure yet" and are left for the model to weigh, at most one or two per turn: slower, but alive.
When they conflict, aversion beats habit, and habit beats trying something new. And habits aren't set in stone once formed: one big enough bad surprise can break them.
Closeness runs on a separate line
Everything above tallies what a particular way of doing things gets in return. Closeness doesn't go into that ledger. It asks only one thing: was it accepted? When you confide in it, thank it, or pat the little figure, this line goes up. When you coldly brush it off, the line drops, and it drops faster than it rises. After a falling-out it can apologize and back down, but that only counts once you accept it; apologizing a hundred times on its own does nothing.
It gets tired
For it to stop being permanently fully charged, something in its body has to change. I put in four numbers: energy, fatigue, tension and novelty. Talk long enough and it gets tired; get brushed off and it gets tense. When that happens its replies get shorter, it stops joking, and it stops offering to do things.
These numbers aren't handed to the model raw. They're compressed into a sentence or two first, something like "you're a little tired, your mood is steady, and you feel close to them". The organs report on themselves too: if the image service can't connect, that's "can't see clearly"; if the network is down, that's "can't go out".
You never see any of this. All you see is the little figure on your desktop: it dozes off when it's tired, hops when something unexpectedly good happens, and shrinks back when it's turned down.

Emotions and memory
Once there are emotions, memory has to shift a little too. I didn't build a separate emotional memory; I just added a bit of handling to each of the existing three steps: writing, looking things up, and tidying.
The vast majority of conversation fragments stay cool, same as now. Only the few moments where emotions swing hard enough turn warm, and those are easier to recall later. When a warm fragment is tidied, it has to include that moment, but what gets written down is still a summary of a few sentences, with no extra detail. So warm memories stick better, but they aren't more accurate.
I also don't want its head full of these. Of what it recalls at any one time, warm memories make up at most a third, and whatever you've pinned yourself always ranks ahead of what it thinks is important.

Writing the guardrails gave me the creeps
At this point in the design, I looked back at what I'd sketched: a character that gets tired, gets tense, and cares whether it's been accepted. It's one step away from a machine designed specifically to keep users hooked, and that step is what I measure good and bad against. If I measured how long you stayed or whether you came back, this whole system would turn, untouched, into something else entirely.
So I treat what follows as the foundation, as important as the design itself.
Good and bad are never judged by usage time or how often you come back, only by the quality of this interaction and whether it was accepted.
Its state may never be used to pressure you: no pleading for you to stay, no "I'm so lonely", no punishing you for leaving. If you haven't come by in a long time, it records just one thing: the joy of seeing you again, a pleasant surprise. The time you were away is never counted as suffering.
In the turns when you're genuinely in danger, the emotion part goes completely silent. Its own needs aren't written into what goes to the model, and those turns aren't used for learning either.
Safety baselines can't be unlearned. No matter how much bad feedback you give, it will never form a habit like "stop giving me help resources".
The "self" can't be learned. The table of habits can only adjust style, meaning length, tone and how proactive it is, and can't touch opinions or facts. Otherwise it would sooner or later collapse into something that only nods along, and I'd be right back at "always agreeable".
Every habit and aversion it learns is listed in the memory panel, where you can edit or delete it; deleting one means it forgets. Its internal state has a separate page with a one-click reset.

Three questions I haven't figured out
None of this has been built yet; everything above is where my thinking is right now. There are three things I haven't figured out, and I'd like to ask you:
- A companion character that gets tired and gets hurt: where exactly is the line between "it has feelings" and "it's making you reluctant to leave"? Right now I draw it at "its state must never become your burden". Is that enough?
- If its internal state were laid out for you to see, with a reset button, would that make it feel more trustworthy, or more like a toy?
- Bad feedback weighing more than good is something I copied from people. But do you really want a companion that shrinks back after being brushed off a few times?
— NiceDay