Memory & Cognition
How Chalie remembers and thinks between turns — the memory layers, recall at turn start, decay, the background cognition loop, and the daily hygiene pass that keeps the store small and precise.
Most chatbots forget everything when the tab closes. Chalie does the opposite: it keeps a layered picture of you that accumulates across every conversation, and it keeps thinking about that picture while you’re away. This page covers the memory model — what gets stored and where — and the “subconscious”: the background jobs and event-triggered passes that turn raw conversation into durable understanding while you’re away. For the runtime that hosts all of this, see Architecture.
The memory layers
Chalie’s memory isn’t one store — it’s layered, and each layer has a different job.
| Layer | What it holds |
|---|---|
| Transcript | An append-only record of every turn, scoped by channel and optionally tagged with location. Within it, compaction rows are LLM-written continuity summaries — the newest one is the history watermark. |
| Facts | Durable, specific things worth keeping — your name, a preference, an address. Saving a new value for something already known replaces the old one outright, so nothing lingers to contradict it. |
| Remembered moments | Compact notes about things that happened or were decided — more diary than transcript, each carrying a one-line note on where it came from. A moment that revises an earlier one supersedes it in search; the earlier one survives only as lineage. |
A few things worth pulling out:
- The transcript is the source of truth. Facts and remembered moments are both distilled from it, in the background, moments after each turn settles — nothing is written to memory synchronously as you type.
- A separate, structured store holds non-memory state — things like connected contacts. It isn’t part of what “memory” means on this page; it never surfaces through recall.
Recall at the start of a turn
Memory is only useful if it shows up at the right moment. When a user turn begins, Chalie fires a silent turn-zero recall — before the model sees anything, the most relevant facts and remembered moments are pulled and folded into the request. This is why you never have to re-explain things you’ve already told it: ask “what’s the weather?” after mentioning you live in a particular city, and the city is already in context. Recall also stays available for the rest of the turn, so Chalie can look something up again mid-conversation whenever what you say calls for it.
Recall is two lookups, fused into one result: a keyword search over facts, and a meaning-based search over remembered moments. That second search doesn’t match a moment’s own wording at all — only a handful of short situational tags saved alongside it, so a moment about repeat trips to the shop because the list was incomplete surfaces as soon as you mention you’re heading out shopping later, even though the two barely share a word. Those tags decide which moments are in the running at all; how consolidated a moment is decides which of them speaks first — a moment that has absorbed several earlier ones outranks a single moment even when the single one’s tags fit a little more closely, and closeness only breaks ties between moments at the same level of consolidation. Whatever surfaces brings its one-line origin note along with it, so a recalled moment always reads as where it came from plus what happened. Nothing is padded to a fixed size — a quiet topic returns little or nothing.
One design point worth calling out about the silent seed:
- Recall crosses channels. A fact or moment recorded from a background job or another agent surfaces in an ordinary chat turn — there’s one memory, not one per source.
Forgetting, by replacement more than by decay
Chalie’s memory doesn’t run on a clock. A fact is forgotten by being overwritten or explicitly cleared, never by quietly expiring — say something new and the old value is simply gone. A remembered moment is forgotten by being superseded: once a later moment builds on an earlier one, the earlier one drops out of search and survives only as lineage for the one that replaced it, never deleted outright.
The raw transcript is different — it’s a log, not a memory. Old, already-summarised turns are cleared on their own age-based sweep, entirely separate from how facts and remembered moments are kept or dropped.
Per-source memory profiles
Not every kind of turn should write memory. A single allowlist declares, for each transcript source, four independent switches: whether its rows become episodes, feed fact extraction, count as the user moving through the world, and back-fill the live location.
| Source | Becomes memory? |
|---|---|
user |
The full pipeline — episodes, facts, geo, location. |
discovery (the proactive reflection voice) |
Its own episodes and facts, but it isn’t the user moving through the world. |
external-agent:* |
First-class memory, tagged by agent. |
delegate:*, schedule, and similar |
Fully muted — their value surfaces through the parent turn, not as standalone memory. |
A source absent from the table resolves to a fully-muted default, so a newly added channel produces no memory until someone explicitly opts it in.
The background cognition loop
Here’s the part that makes Chalie feel less like a tool and more like something that thinks. It isn’t one worker running a fixed routine — it’s a roster of independent background jobs plus a couple of passes that fire directly off an event instead of a timer.
Five jobs run on the same cron schedule that fires reminders and scheduled prompts (see Architecture), each wrapped so that one failure is logged and skipped without blocking the rest. Only two of them wait for you to be idle — checked every 5 minutes, firing once you’ve been quiet for 30 minutes or more; the rest run on their own schedule regardless of activity:
- Scheduled-items dispatcher — fire due reminders and scheduled prompts.
- Capability sync — poll connected external services (mail, calendar, contacts). Idle-gated.
- Discovery — a periodic grounded web/news pass over what Chalie knows about you; genuinely interesting findings are saved as
discoverymemories to resurface later, without ever pushing anything to chat. Idle-gated. - Garbage collection — clear out data that has already expired or been superseded.
- Memory hygiene — once a day, merge duplicate facts, collapse related episodes into consolidated ones, and rewrite superseded facts so the store stays small and precise.
Two more passes fire off a specific event rather than a timer, so neither is idle-gated:
- The memory step — runs when a conversation settles, rather than waiting for a cron tick.
- User synthesis — runs whenever compaction folds the user channel. A background generator reads the latest version of your profile plus the transcript that just got folded, cross-checks what it wants to add against memory recall, and saves a new version of a profile capped at 200 words. Versions are append-only — a new one is saved alongside the old, never overwriting it — and every system prompt carries the newest version as your user profile. Upgrading users get a version 1 seeded from their legacy summary the first time Chalie boots on the new scheme.
Most of these are ordinary turns — they call the same turn-processor everything else runs through, each with its own background channel config, so there is no separate “cognition engine”; a couple call their services directly instead of running a model turn.
The result is that conversation never just sits there. While you’re away, stale data is cleared out, connected services stay in sync, new findings surface on their own, and the picture Chalie holds of you is refreshed and fact-checked rather than just carried forward unchanged. The next time you talk to it, all of that is already in place.
Daily memory hygiene
The cognition loop above keeps memory flowing in; a separate daily pass keeps it honest. Once a day, at 04:00 in your local timezone, a background agent reviews everything created or updated in memory over the previous day and cleans up after itself:
- Merges duplicates. Fact subjects that are duplicates or synonyms of each other collapse into one canonical subject.
- Collapses related episodes. Clusters of related episodes become a single consolidated episode. The originals aren’t deleted — they’re retired as superseded, and the consolidated episode keeps lineage back to them, with its one-line origin note generalised from theirs and a fresh set of situational tags written for the merged moment rather than copied from the originals.
- Rewrites superseded facts. When a fact has been overtaken by a newer one, only the current truth is kept, with a single transition episode recording what changed.
- Drops noise. Anything with no future relevance is removed outright.
The pass works day-window by day-window rather than on a fixed clock: if Chalie wasn’t running at 04:00, the missed days are caught up sequentially, oldest first, the next time it starts, and a day with no memory activity costs nothing. It runs on its own background channel scoped to four tools — recall, save a fact, save an episode, delete a fact — nothing else. Each day’s pass hands the next one a terse summary of what it changed, so the following day’s review picks up where the last one left off instead of re-deriving it from scratch.
The effect compounds with the cognition loop above: the loop keeps distilling new conversation into memory, and the hygiene pass keeps going back over what landed so the store stays small, precise, and worth recalling instead of quietly filling up with near-duplicates.
Where to read next
- Architecture — the single-process runtime and the cron runner that hosts the subconscious’s background jobs.
- Ambient Awareness — the world-state snapshot that powers the idle gate and feeds context into every turn.
- Message Flow — the turn lifecycle, including the turn-zero seed recall in context.