Memory & Context

Most assistants forget everything when the chat closes. LexiChat has two ways to carry things forward: context variables for the handful of facts that are always true about you, and a persistent wiki it writes to and reads back on its own. Both are plain files on your own disk.

compare_arrows Two kinds of memory

They solve different problems and are worth keeping separate.

Context variables The wiki
HoldsA few short facts that rarely changeAnything worth keeping, and as much of it as you like
Who writes itYou, by handThe AI, on its own — or you, in any editor
When it's readEvery message, automaticallyWhen the AI decides it's relevant, by searching
ScopePer profileShared by every profile that has it on
Costs contextA few tokens per fact~560 tokens of instructions, plus whatever it reads

A rule of thumb: if you would put it on a business card, it's a context variable. If it's something you told the assistant once and expect it to remember, it belongs in the wiki.

badge Context variables

Name/value pairs attached to a profile, added to every conversation as facts about you. The AI uses them when they're relevant and stays quiet about them when they aren't — you don't have to keep saying where you live.

Find them in Settings → Profiles, in the profile editor under Context Variables. Add a row, give it a name and a value, save the profile.

Name Value What it saves you
locationGravesend, Kent, UK"What's the weather?" works without naming the town
timezoneEurope/LondonTimes in answers land in your day, not UTC
occupationSoftware consultantExplanations pitched at the right level
telegram_chat_id764986304"Send me a Telegram" needs no ID pasted in
Because they are per profile, a work profile and a personal profile can answer to different facts. They also travel with a profile when you export it — so review them before sharing a profile, the same as you would its credentials.

menu_book The wiki — long-term memory

The wiki is a folder of Markdown pages that outlives any single conversation. Tell LexiChat something worth keeping and it files the fact away without being asked; ask about it weeks later in a brand-new chat and it searches the wiki, reads the page back, and answers from it.

groupPeople — who they are, what you last discussed
eventDates — birthdays, anniversaries, deadlines
checklistLists — todos, projects, things in flight
tunePreferences — how you like things done

toggle_on Turning it on

Memory is off until you enable it. There are two levels:

Global default
In Settings → Tools, listed as 🧠 Persistent Wiki Memory. Sets the behaviour for every profile that hasn't chosen for itself.
Per-profile override
In the profile editor. A profile can switch memory on or off regardless of the global default; leave it unset to follow along.
Useful split: memory on for a personal assistant profile, off for a research or scratch profile that would otherwise fill the wiki with one-off findings.
Not to be confused with the Memory setting on the Defaults tab (Standard / Extended). That one sets the model's context window — 32K or 128K — and has nothing to do with the wiki.

folder_open Where the files live

Plain .md files in a folder you own — no database, no cloud, no sync:

macOS~/Library/Application Support/lexichat/wiki
Linux~/.local/share/lexichat/wiki
Windows%LOCALAPPDATA%\lexichat\wiki

Pages are organised into folders as the AI sees fit — people/alice.md, events/birthdays.md, projects/. Two files are special:

index.md
A one-line entry per page. Read at the start of a conversation to get oriented, and kept current as pages are added.
log.md
A dated line for every change, so you can see what was remembered and when — and undo it if it got something wrong.
Edit any of it by hand. The AI reads whatever is there, so correcting a page in your editor corrects what it believes. Deleting a page makes it forget.

psychology What it does on its own

With memory on, LexiChat is told to do these without being prompted:

  • searchSearch before answering anything about a date, plan, person, project or past conversation — rather than guessing from the current chat alone.
  • saveStore durable facts immediately — a name, a date, a preference, a goal — without waiting to be told to remember it.
  • mergeUpdate rather than duplicate — search first, then patch the existing page instead of creating a second one on the same subject.
  • history_eduLog every change to log.md with the date and a one-line reason.
  • cleaning_servicesTidy up occasionally — a lint pass surfaces empty pages, missing index entries and broken links, which it then fixes.

You can also drive it directly: "remember that my sister's birthday is 3 March", "what do you know about the Hartley project?", or "forget what I told you about the old address".

It decides what's worth keeping. That is the point of it, but it does mean the wiki accumulates things you didn't explicitly ask it to save. log.md is the place to check, and every page is a file you can edit or delete.

travel_explore How it finds things

A memory you can't retrieve isn't a memory. Searching the wiki runs two passes, because the obvious approach on its own quietly loses things.

By wording
Exact text matching. Precise, instant, and needs nothing installed — but it finds a page about “sibling DOB” only if you happen to ask in those words.
By meaning
The same question compared against what each page is about, so “my sister's birthday” finds that page anyway. Related results are listed under the exact ones, labelled as such.

Meaning-based search needs an embedding model — a small model that turns text into a position in meaning-space. If you have one installed in Ollama, LexiChat finds it and uses it automatically. If you don't, search stays exact and nothing breaks or complains.

To switch it on, pull one model — nothing else to configure:
ollama pull nomic-embed-text

Everything stays local. Pages are sent to your own Ollama to be indexed, exactly like a chat message — no third-party embedding service is involved at any point.

The index

  • check_circle Built the first time you search and kept up to date after that. Only pages you've actually edited are re-read, so the first search costs a second or two and later ones are quick.
  • check_circle Stored outside the wiki folder, in LexiChat's data folder. Your Markdown stays yours — no machine files mixed in with it.
  • check_circle Entirely disposable. Delete it and the next search rebuilds it; nothing you wrote lives only there.
  • check_circle Rebuilt from scratch if you change embedding model, since positions from two different models can't be compared.

hub Seeing it all at once

Memory that only surfaces when you ask about it is hard to trust. The Memory Map — the 🧠 button in the toolbar — draws the whole wiki, so you can see what LexiChat has kept about you without asking it a single question.

The Memory Map showing nine wiki pages as coloured circles joined by grey link lines and thicker indigo relatedness lines, with a legend and a relatedness slider

Every page is a circle, coloured by its folder and sized by how much is written on it. Two kinds of line connect them, and the difference is the point:

Grey — links you wrote
An actual link from one page to another. Structure you put there deliberately.
Indigo — pages about the same thing
Drawn from the same index that powers search. The thicker the line, the more alike the pages — nothing had to be written down for it to appear.

Click any page to read it alongside the map, with its closest relatives listed and scored so you can walk from one to the next. Drag pages around, scroll to zoom, and pull the Relatedness slider down to reveal looser connections or up to keep only the strong ones.

The thickest line is usually worth acting on. Two pages that are almost identical are normally the same subject written down twice — the map is the quickest way to spot that and merge them. It also shows the opposite: a page nothing links to, sitting off on its own.

Without an embedding model the map still draws your written links; the indigo lines simply aren't there. The 🧠 button only appears for profiles that have memory switched on.

build The wiki tools

Enabling memory adds eight tools. You rarely need to name them, but they show up in the trace when you're checking what happened:

Tool What it does
wiki_searchFind pages, by wording and by meaning. The usual first step — see How it finds things.
wiki_readRead a page back in full.
wiki_listList every page in the wiki.
wiki_writeCreate a page, or replace one outright.
wiki_patchChange part of a page, leaving the rest alone.
wiki_appendAdd to the end of a page — how log.md grows.
wiki_deleteRemove a page.
wiki_lintReport empty pages, missing index entries and broken links.

Every path is confined to the wiki folder — these tools cannot read or write anywhere else on your disk, regardless of what the model asks for.

speed What it costs

Memory isn't free, which is why it's opt-in. With it on, every step of every conversation carries roughly 560 tokens of memory instructions plus the eight tool definitions, before your question contributes anything — and the AI spends real time searching and reading pages.

On a small local model with a tight context window that trade can hurt. Two ways to keep it in hand:

  • check_circleEnable memory only on the profiles that benefit from it, rather than globally.
  • check_circlePrefer context variables for the handful of facts that are always true — a few tokens each, and no searching.

The Debug panel breaks down exactly what each step is carrying, so you can see the cost rather than guess at it.

Meaning-based search, separately

The second search pass costs nothing in context — it runs before the model is asked anything, and only the handful of results it returns are ever shown. What it does cost is a small model on disk (a few hundred megabytes), a second or two the first time you search after editing pages, and an index file that scales with how much you've written.

If you'd rather not have any of that, don't install an embedding model. Search stays exact and everything else works the same.

lock Privacy & portability

Everything here stays on your machine. The wiki is Markdown in a local folder; context variables live in the profile. With a local model, nothing you ask it to remember leaves the computer at all.

backupBack it up by copying the folder — it's just files
edit_noteEdit or correct any page in your usual editor
deleteDelete a page to forget it; delete the folder to forget everything
swap_horizMove it to another machine by copying it across
One caveat if you use a hosted model. When the AI reads a wiki page to answer, that page's contents go to whichever model is answering — the same as anything else in the conversation. If a profile points at a remote endpoint, treat the wiki as things you're willing to send there. Local models keep it entirely on the machine.