Hindsight AI Agent Memory Tuning: Faster, Cheaper, No Fake Facts
AI agents forget everything between sessions. Hindsight is an open-source, self-hosted memory server that fixes that, so your agent remembers what you told it last week. This guide shows how I set up and tuned Hindsight AI agent memory on my homelab: what it does, how to set it up, how to make it fast and accurate, and how to keep its LLM bill low, with the real numbers behind every decision.
Last updated: November 12, 2026
I run a personal AI assistant plus seven specialist bots on one small VM, and all of them share one Hindsight server. Earlier, in Level Up Hermes, I installed it and switched it to a cheap model. It worked, but it wasn’t tuned. Every turn it injected about 4,400 tokens of mostly off-topic “memories”. It also made up facts about me, timed out on 7% of its LLM calls, and its cheapest model setting cost the most. Finally, one evening of measuring and tuning fixed all of it.
THE SHORT VERSION //
- Recall dropped to ~240 tokens per turn (-95%), and every result is on topic.
- Recall got twice as fast (4.4 s → 2.2 s).
- The fake facts are gone, and date-aware recall works again.
- The memory LLM bill is an estimated ~$3 a month, with zero timeouts since the last fix.
- Want your AI to do this for you? Jump to the copy-paste prompt.
In this guide: why agents need memory · AI prompt · setup · measure · performance · cost · accuracy · results ·checklist · FAQ
Why your AI agent needs a long-term memory system
Out of the box, an LLM agent has no memory between sessions, so each conversation starts from zero. Because of that, most agent frameworks bolt on one of two things:
- A notes file (
MEMORY.md, “custom instructions”, and so on). It’s useful but small; my agent’s built-in one caps at about 2,200 characters. Someone has to curate it by hand, and it goes into every prompt whether it’s relevant or not. - A long context window. It works until it doesn’t. Eventually, context gets compacted or truncated, and you pay for every token on every turn.
Neither fits the questions you actually ask a long-running assistant:
- “What did we decide about the NAS firewall last month?”
- “Which version of that service did we pin, and why?”
- “What’s the backup schedule for the NAS?”
What AI agent memory does, in plain English: an assistant with a notebook
Picture your AI agent as a brilliant consultant with amnesia. They’re sharp and fast, but every morning they show up having forgotten everything you’ve ever told them.
Hindsight gives that consultant a personal assistant with a notebook:
- During every meeting, the assistant takes notes (retain). You don’t dictate them. The assistant writes down what matters: “the NAS runs DSM 7”, “we pinned version 1.2.1 on Tuesday because 1.2.0 broke dates”.
- After the meeting, the assistant tidies the notebook (consolidation). Scribbles then become clean index cards: one card per fact, duplicates merged, outdated cards replaced.
- Before the next meeting, the assistant hands over only the cards that matter (recall). When you ask about the firewall, you get the three firewall cards rather than the whole filing cabinet.
What tuning teaches the assistant
So most of the tuning in this post comes down to training that assistant:
- Out of the box, it hands over 100 cards for every question. It’s thorough, but you have to read the whole stack to find the three you needed. Steps 4–5 teach it to hand over only the relevant ones, and also to pick them faster.
- A cheap assistant can be sloppy. For example, mine copied the sample cards from its training manual (“has a dog named Rex”) into my real file. Steps 10 and 13 cover hiring a better note-taker and checking its work.
- Also, the assistant is paid by the page. Steps 8–11 cover making sure you aren’t paying it to rewrite the same notes four times because the phone line keeps dropping.
In short, a real memory system handles this in three steps:
- it captures facts automatically as you work
- it organizes them (who, what, when, how they relate)
- it recalls only the relevant ones, at the moment they’re needed
The agent stays small and cheap per turn, and it still knows months of history.
What is Hindsight, and how does it work?
Hindsight (from Vectorize) is an open-source, local-first memory server built for agents. These are the parts that matter:
| Concept | What it means |
|---|---|
| Banks | Isolated memory stores. One per agent, user or project. |
| Retain | Feed it conversation text. An LLM pulls out world facts (“the NAS runs DSM 7”) and experience facts (“we fixed the soft-404s on Tuesday”), plus entities and timestamps. |
| Consolidation | A background LLM pass that merges raw facts into durable observations, the clean knowledge that recall returns by default. |
| Recall | Multi-strategy retrieval (semantic vectors, BM25 keywords, an entity graph, temporal) fused and then reranked by a cross-encoder. |
| Reflect | LLM synthesis across many memories (“summarize everything we know about X”). |
It runs fully local (embedded PostgreSQL, CPU embedding and reranking models). As a result, the only outbound traffic is the LLM calls for extraction and consolidation, and those go to whatever provider you configure.
In practice, my agent remembers decisions, configs, versions and project history across hundreds of sessions and eight different bots. I never edit a memory file by hand, and each turn carries a few hundred tokens of context instead of thousands.
My Hindsight setup, for scale
- Proxmox VM: 8 vCPU, ~7.4 GB RAM, no GPU
- Hermes Agent with the Hindsight memory plugin
- One Hindsight daemon (
hindsight-api1.2.1) serving 8 banks: the main assistant plus 7 bots (accountant, artist, developer, recruiter, researcher, secops, secretary) - ~2,400 memory units in total. The main bank holds about 790 world facts, 420 experience facts and 370 observations.
- The memory LLM runs through OpenRouter
If your setup is smaller, everything below still applies; it just matters less at first.
PRO TIP //
Use a strong reasoning model for the tuning work. When you diagnose and fine-tune a memory system like this, run your agent on a model like Claude Opus 5.5, not the cheap models Hindsight uses for its own background work. That’s because memory problems rarely show up as clean errors. Instead, they hide in thousands of log lines, Postgres tables and prompt files, and finding them takes real reasoning, like:
- working out that fake “facts” about me came from the few-shot examples in Hindsight’s own consolidation prompt
- noticing that a reranker floor of 0.25 wasn’t “less noise” but “no results at all”
- realizing that an early cost estimate was off by a factor of four because consolidation, not extraction, used most of the tokens
A stronger model costs more per hour of troubleshooting, but it’s a one-off session. Meanwhile, the cheap models do the day-to-day memory work.
Use the expensive model to fix the system, and the cheap ones to run it.
Let your AI assistant tune Hindsight for you
You don’t have to work through all 14 steps by hand. Instead, you can replicate my findings on your own setup with the copy-paste prompt below. Give it to an AI assistant that can read web pages and run commands on the machine where Hindsight runs (Hermes, Claude Code, Codex and similar agents can). It reads this article, then measures your system the same way I measured mine, compares your numbers to my results, and walks you through each fix that applies, one change at a time.
That’s essentially how I did it: the agent did the measuring and digging, and I approved each change. The rest of this guide explains every step the prompt checks, so you’ll know what your assistant is doing and why.
A few ground rules make this go well:
- Use a strong reasoning model for the session (see the tip above). This is diagnosis work, not chat.
- Make it measure first and propose second. My numbers are a reference rather than settings to copy, so your reranker floor, provider list and model costs need to be calibrated on your data.
- Approve every change. Config edits, restarts, re-embeds and memory deletes should each wait until you say yes.
- Back up first. Export every bank and copy the database before it touches anything.
Copy and paste this prompt into your assistant:
Read this article in full: https://labsmith.dev/hindsight-ai-agent-memory-tuning/
It documents how the author tuned a self-hosted Hindsight memory server for an AI
agent: recall size, latency, embeddings, upgrades, LLM cost and memory hygiene, with
measured before/after numbers. I want you to audit MY Hindsight setup against those
findings and help me apply the ones that fit.
Work in this order and stop for my approval between phases:
PHASE 1 — Inventory (read-only)
- Find how Hindsight runs here: mode (cloud / local_embedded / local_external),
server version, how the daemon is started (systemd unit or spawned by the agent),
number of banks, GPU or CPU, RAM and disk use.
- Show the live settings: plugin config (recall_budget, recall_max_tokens,
recall_min_scores, retain_every_n_turns, recall_types), the embedding and reranker
models, RERANKER_MAX_CANDIDATES, and the extraction and consolidation LLM models
and providers. Read the values from the RUNNING process's environment, not just
the env files.
PHASE 2 — Measure (read-only)
- Write a small recall probe: 8–10 realistic queries for how I use my agent,
including 2 whose answers are NOT in memory. Report results, approximate tokens
and latency per query on the current settings.
- From the logs, count LLM timeouts and errors, failed retain/consolidation
operations, and "Temporal query analysis" warnings.
- Estimate token volume per stage (retain vs consolidation) over the last 24 hours,
and the monthly memory LLM cost at current prices.
- Search the banks for leaked prompt examples: match memory text against the
quoted example strings in Hindsight's consolidation prompt file, and list hits.
PHASE 3 — Recommend (no changes yet)
- Compare my numbers to the article's. For each of its steps, say whether it
applies to me, what you'd change, the expected effect, and the risk.
- Calibrate, don't copy: sweep the reranker floor (e.g. 0.0 / 0.05 / 0.1 / 0.25)
on my probe and show the results before picking one. Benchmark LLM providers
on my own workload before pinning any.
- Give me a ranked plan (biggest win first) with a cost estimate for each model
change, worked out from my measured token volumes.
PHASE 4 — Apply (only after I approve each item)
- Before the first change: export every bank and back up the database.
- Make one change at a time, re-run the probe after each, and report before/after.
- Stage any server upgrade or embedding-model change on a copy of the database
first, exactly as the article describes.
- Never delete memories without showing me the list and saving a dump first.
Finish with a before/after table like the article's "Results" section, and write
down what you changed and how to roll each change back.
If your agent can’t browse, paste the article text in below the prompt.
Part 1: Set up Hindsight memory
Step 1: Install the Hindsight memory provider
In Hermes, run this for each profile. (If you followed Level Up Hermes, the setup wizard already did this for your main profile.)
hermes plugins install hindsight --yes-deps --no-enable
hermes -p <profile> config set memory.provider hindsight
Each profile gets a hindsight/config.json. The important keys:
| Key | What it does |
|---|---|
mode | cloud sends turns to Vectorize’s hosted API. local_embedded runs the server and Postgres on your box. local_external points at a server you already run. |
bank_id | Which bank this agent reads and writes |
auto_retain / retain_every_n_turns | Automatic capture and how often it runs |
auto_recall | Inject relevant memories into the next turn |
memory_mode | hybrid (auto-inject plus tools), context, or tools |
recall_types | Default observation; widen to observation,world,experience for raw facts |
Lock the file down (chmod 600), because it can hold keys.
Step 2: Run one Hindsight daemon for many agents (memory banks)
Initially, my setup gave every bot its own local_embedded daemon. As a result, each one loaded its own embedding and reranker models:
- 255–423 MB RSS per bot daemon
- ~1.1 GB for the main one
- 385 MB of RAM free on the VM
The fix: the main profile runs local_embedded, and every bot runs local_external against http://127.0.0.1:9177 with bank_id set to its own name. Memories stay isolated per bank, but there is only one copy of the models.
Result: ~1.6 GB of RAM freed (385 MB → ~2 GB available), and one model and environment to maintain instead of eight.
To move existing memories between daemons without paying to re-extract them, use the transfer API:
# on the source daemon
POST /v1/default/banks/<bank>/transfer/export?include_data=true&include_bank_config=true
# poll the operation, download result_metadata.download_url, then on the target:
POST /v1/default/banks/<any-existing-bank>/transfer/import?mode=restore&target_bank_id=<new-bank>
# multipart: [email protected] (the target bank must NOT exist yet)
TRADE-OFF //
One daemon is now a single point of failure. If it’s down, every bot loses memory. Also, a local_external client won’t start it for you. That’s what step 3 is for.
Step 3: Run the Hindsight daemon as a systemd service
By default the daemon is spawned by the agent process and ends up in the agent’s cgroup. On my box, every gateway restart killed memory for all eight bots until a later turn respawned it. Give it its own user unit:
# ~/.config/systemd/user/hindsight-daemon.service
[Service]
EnvironmentFile=%h/.hindsight/profiles/hermes.env
Environment=HINDSIGHT_API_DATABASE_URL=pg0://hindsight-embed-hermes
Environment=UV_TORCH_BACKEND=cpu
ExecStart=uvx [email protected] --host 127.0.0.1 --port 9177
Restart=always
[Install]
WantedBy=default.target
systemctl --user daemon-reload && systemctl --user enable --now hindsight-daemon
loginctl enable-linger $USER # keep it running without a login session
The plugin checks /health before spawning, so it reuses this daemon instead of starting a second one. When I ran a crash test (SIGKILL the API process), it recovered in ~14 seconds.
Three details that matter:
- Pin the version (
[email protected]). Because upgrades run DB migrations, you want them to happen on your schedule. UV_TORCH_BACKEND=cpuif you have no GPU. Otherwise, uv pulls in the CUDA/Triton wheels. My environment went 6.6 GB → 2.1 GB (~6 GB of disk freed, uv cache 7.3 → 3.4 GB) with no change in speed.- Put tuning in a systemd drop-in (
hindsight-daemon.service.d/tuning.confloading separate env files), not in the plugin-managed env file. That’s because the plugin may rewrite its own file.
GOTCHA //
Env changes only take effect when the daemon restarts, because values are read once at spawn. Check what’s actually live with tr '\0' '\n' < /proc/<pid>/environ | grep HINDSIGHT_, not by re-reading the file.
Part 2: Measure Hindsight recall before you tune it
This is the most important step, and the one most people skip. You can’t tune recall you haven’t looked at, and Hindsight AI agent memory is no exception.
I wrote a 40-line probe that runs a fixed set of 10 realistic queries against a bank and reports result count, characters and approximate tokens. The heart of it:
body = {"query": q, "budget": "mid", "max_tokens": 4096,
"types": ["observation"],
"min_scores": {"reranker": 0.05}} # omit for the untuned baseline
r = requests.post(f"{API}/v1/default/banks/{BANK}/memories/recall", json=body).json()
chars = sum(len(x["text"]) for x in r["results"])
Pick queries that match how you actually use the agent: a few the bank should answer well, and a couple whose answers live somewhere else (your notes, the web). The second kind should return nothing.
My baseline on default settings:
| Metric | Value |
|---|---|
| Results per query | ~100 (always the cap) |
| Injected per turn | ~4,376 tokens, right up against the plugin’s 4,096-token cap |
| Recall latency | ~4.4 s |
| Relevance | Mostly off-topic. Every query hit the 100-result cap, including ones whose answers aren’t in memory at all. |
I re-ran the untuned settings on November 12, with a bigger bank, and got the same picture: 100 results on every query and ~3,200 tokens per turn. In other words, defaults return everything the budget allows, relevant or not.
While digging I found more problems:
| Symptom | Evidence |
|---|---|
| Fake facts about me | “has a dog named Rex”, “favorite framework is React”, “ledger-sink listens on port 8444” |
| LLM timeouts | 714 timeout errors in two days; ~7% of calls; each one retried 4 × 120 s |
| Date-aware recall silently broken | ~1,250 Temporal query analysis raised ValueError warnings on 1.2.0 |
| Lost memories | 190 failed operations from one bad day, which meant 14 sessions never stored |
Part 3: Tune Hindsight performance
Step 4: Tighten recall with a reranker score floor (the biggest win)
Three plugin settings, in config.json for every profile:
{
"recall_budget": "mid",
"recall_max_tokens": 1500,
"recall_min_scores": { "reranker": 0.05 }
}
The reranker floor matters most, and you have to calibrate it on your own data. So I swept it across the probe set:
reranker floor | Result |
|---|---|
| 0.25 (the commonly suggested value, and what I suggested in Level Up Hermes) | Returned nothing for on-topic queries. Far too strict for hs-rerank-1. |
| 0.10 | Borderline; dropped some good hits |
| 0.05 | Kept every relevant hit and cut the noise |
Result: ~4,376 → ~240 tokens per turn (-95%), and every result on topic. Also, queries about things that live in my vault and not in memory now correctly return nothing.
Re-measured on November 12 on the larger bank: ~319 tokens per turn with the same settings, against ~3,205 untuned. These settings are read per session, so no restart is needed.
Step 5: Cap reranker candidates to halve recall latency
Since cross-encoder reranking on CPU scales linearly with candidate count, fewer candidates means faster recall. The default sends up to 300 candidates to the reranker; mine was seeing ~260 per query at ~17 ms each.
HINDSIGHT_API_RERANKER_MAX_CANDIDATES=100
Result: recall ~4.4 s → ~2.2 s with an identical result set on the probe. (A spot check on November 12: 10 queries in 18 s, ~1.8 s each.)
I also tried the ONNX build of the reranker, expecting it to be faster. It was slower (~21 vs ~17 ms per candidate) and used +500 MB RAM, so I kept torch. So on CPU, candidate count is the lever, not model format.
Step 6: Upgrade the embedding model to hs-embed-1
The old default, BAAI/bge-small-en-v1.5, has a 512-token context, so longer memories get truncated before they’re embedded. I switched to hindsight-ai/hs-embed-1 (ONNX int8, CPU, 384-d, 8K context, multilingual):
HINDSIGHT_API_EMBEDDINGS_PROVIDER=onnx
HINDSIGHT_API_EMBEDDINGS_ONNX_MODEL_ID=hindsight-ai/hs-embed-1
HINDSIGHT_API_EMBEDDINGS_ONNX_FILE=onnx/model.onnx
HINDSIGHT_API_EMBEDDINGS_ONNX_DIMENSIONS=384
HINDSIGHT_API_EMBEDDINGS_ONNX_MAX_TOKENS=8192
Vectors are model-specific, so you must re-embed:
- Run
hindsight-admin reembed --schema publicwith the new env while the server still runs the old model. - Restart the daemon.
- Run
hindsight-admin reembed --finish.
Re-embedding 1,962 memories took 20 seconds. Probe quality barely moved (72 vs 73 results, one extra relevant hit), so the gain is mostly headroom: long memories are no longer cut off at 512 tokens.
Step 7: Upgrade the Hindsight server safely
The move from 1.2.0 to 1.2.1 fixed the temporal-query bug, so date-aware recall (“what did we do last Tuesday?”) had been silently off. Upgrades run DB migrations you can’t undo, so stage them:
- Export every bank (
transfer/export). These zips restore into any version. pg_basebackupthe live DB into a scratch Postgres instance.- Run the new
hindsight-apion a spare port against the copy; migrations run there first. - Compare per-bank fact counts and probe recall, and run an old-client retain and recall.
- Only then bump the version pins and restart.
Result: identical counts, and temporal warnings went from ~1,250 to 0. Staging also caught a config bug that would have crashed the live daemon on start (see step 11). Note that new versions may rank results differently. However, the same facts in a different order is expected, not data loss.
Part 4: Optimize Hindsight LLM costs
The memory LLM is the only part of Hindsight that costs money per use. It’s also where I made my most expensive mistakes.
Step 8: Choose the extraction LLM on measured cost, not list price
My first extraction model was qwen/qwen3.5-9b: small and cheap on paper. In practice:
- $9.35 in a single day: 3,829 requests, 79% of my entire OpenRouter bill
- 1,881 connection errors and 145 failed extractions in 13.5 hours
- each failure retried up to 4×, and every retry billed
I switched to mistralai/mistral-nemo and ran the same workload: 101 requests, 1 connection error, 0 failures, at ~$0.00021 per request vs ~$0.0024.
That’s more than 10× cheaper per request, and it actually finished.
Count failure and retry rates as part of the price.
Step 9: Measure where your memory tokens actually go
I assumed extraction (retain) was the main cost and consolidation was a small background job. Then I measured 24 hours of token usage:
| Stage | Input tokens | Output tokens | Share |
|---|---|---|---|
| Consolidation | 1.79 M | 88 k | ~75% |
| Retain (extraction) | 0.61 M | 66 k | ~25% |
In fact, consolidation was three times the volume of extraction. My first cost estimate for a consolidation-model change (“+$1–2/month”) was wrong by a factor of four because of that bad assumption. Measure token share before estimating anything.
It also tells you where to spend. retain_every_n_turns sets extraction volume, but with consolidation dominating, model choice per stage was the real cost lever, not retain cadence.
Step 10: Use separate LLMs for extraction and consolidation
Hindsight lets you set the consolidation model separately:
HINDSIGHT_API_CONSOLIDATION_LLM_MODEL=mistralai/mistral-small-3.2-24b-instruct
Why bother? Cheap models are fine at pulling facts out of a turn, but they struggle with consolidation’s longer, example-heavy prompt (see step 13). Here’s the monthly consolidation cost, worked out from the measured token volumes above (heavy day × 30; a normal day is about half):
| Option | $/M in / out | Heavy month | Normal month |
|---|---|---|---|
| Nemo via DeepInfra (before) | 0.029 / 0.03 | $1.65 | ~$0.80 |
| Nemo via Mistral’s endpoint (interim) | 0.15 / 0.15 | $8.45 | ~$4.20 |
| Mistral Small 3.2 via DeepInfra (chosen) | 0.075 / 0.20 | $4.55 | ~$2.30 |
| Mistral Small 24B 2501 (DeepInfra only) | 0.05 / 0.08 | $2.90 | ~$1.45 |
The math for the chosen option: (1.79 M × $0.075 + 0.088 M × $0.20) ≈ $0.15/day × 30 ≈ $4.55.
I didn’t take the cheapest row. Small 24B 2501 has one provider, and it’s the same one where Nemo’s consolidation calls were hanging. Small 3.2 costs ~$0.85/month more, but it has a second provider to fall back to. Overall, paying a little for resilience on a background job is usually worth it.
Extraction stays on Nemo: 0.61 M × $0.029 + 0.066 M × $0.03 ≈ $0.02/day, ~$0.30–0.60/month.
Step 11: Pin OpenRouter providers for reliable background jobs
OpenRouter routes to the cheapest provider by default, and for an interactive chat that’s fine. However, for an unattended job that needs JSON output, “cheapest” landed me on providers that hung or broke. I benchmarked Nemo across providers with a 23k-token JSON prompt:
| Provider | Result |
|---|---|
| DeepInfra | ~9 s, steady |
| Parasail | 11–16 s |
| Mistral | 3 s, but 5× the price |
| DekaLLM | 32 s, then HTTP 429 |
| Io Net | HTTP 400: rejected JSON mode |
So pin the order and exclude the bad ones:
HINDSIGHT_API_LLM_EXTRA_BODY='{"provider":{"order":["deepinfra","parasail","mistral"],"ignore":["io-net","dekallm"],"allow_fallbacks":true}}'
HINDSIGHT_API_CONSOLIDATION_LLM_EXTRA_BODY='{"provider":{"order":["deepinfra","mistral"],"allow_fallbacks":true}}'
HINDSIGHT_API_CONSOLIDATION_LLM_TIMEOUT=90 # default 120; failures were hung reads, so fail fast
HINDSIGHT_API_CONSOLIDATION_LLM_BATCH_SIZE=4 # default 8; smaller prompts
GOTCHA //
Keep the single quotes around the JSON. Without them, bash and systemd strip the inner double quotes, and the daemon crashes on start with a JSONDecodeError. This one would have taken all my memory down if staging hadn’t caught it.
Result: timeouts ~7% → ~2% from routing alone, then zero in the window after the consolidation model switch (a small sample, so keep watching).
Step 12: Tighter recall cuts your main model’s token bill (the hidden saving)
This one doesn’t appear on the memory bill, but it’s probably the biggest saving. That’s because every recalled token is sent to your main agent model, which is usually far more expensive than the memory LLM.
Going from ~4,376 to ~240 recalled tokens saves about 4,100 input tokens per turn. As an illustration only (your model price and turn count will differ): at $3 per million input tokens and 100 turns a day, that’s about $1.23/day, or ~$37/month. That’s more than ten times my whole memory LLM bill. Prompt caching reduces this in practice, but recalled context changes every turn, so it usually misses the cache.
Part 5: Keep AI agent memory accurate and clean
Step 13: Audit memory for leaked prompt examples (fake facts)
This was the strangest finding. Hindsight’s consolidation prompt includes few-shot examples (“Alice sold her Honda Civic”, “has a dog named Rex”, “the on-call rotation is Ana/Ben/Dev”, “ledger-sink listens on port 8444”). However, Mistral Nemo copied them into my banks as facts about me. As a result, my agent “remembered” a dog and a car I don’t have.
How I found them: I matched every memory against the quoted strings in the server’s prompt file (engine/consolidation/prompts.py).
SELECT bank_id, id, left(text, 80) FROM memory_units
WHERE text ~* '(dog named Rex|has 2 dogs|on-call rotation|Cleo|favorite framework|ledger-sink|port 8444|Honda Civic)';
- First pass: 16 junk observations across 4 banks, plus 2 stale facts (“UI not running”, an old version number).
- Three more leaked within an hour of the cleanup, which proved the model was the root cause and led to the consolidation-model switch in step 10.
- Two days after the switch (November 12): 115 new observations, 0 leaks.
Cleanup notes:
- World and experience facts can be soft-invalidated through the API, which is reversible, so prefer that.
- Observations can’t be patched or invalidated. Delete them the way the engine does (
DELETEfrommemory_unitswherefact_type='observation', plusobservation_history, in one transaction), and dump them first.
Step 14: Keep your own transcripts for memory recovery
On one bad day, 190 retain operations failed. operations/{id}/retry turned out to be a no-op: the server doesn’t keep the payload. As a result, fourteen sessions were simply missing.
They were recoverable only because the agent keeps its own session transcripts (SQLite). I rebuilt them and re-retained under their original document_id:
| Bank | Facts recovered |
|---|---|
| secops | +58 |
| recruiter | +34 |
| main | ~+26 |
| researcher | +8 |
“Retry” isn’t a backup. Keep the source.
Results: Hindsight AI agent memory before and after tuning
| Metric | Before | After |
|---|---|---|
| Recall injected per turn | ~4,376 tokens | ~240 tokens (~319 on Nov 12, bigger bank) |
| Recall latency | ~4.4 s | ~2.2 s |
| LLM timeout rate | ~7% | ~0% (small sample) |
| Date-aware recall | broken | working |
| Known junk memories | 16 (+3 re-leaked) | 0 (0 of 115 new observations) |
| Embedding context | 512 tokens | 8,192 tokens |
| RAM (8 bots) | 385 MB free | ~2 GB free |
| Disk (server env) | 6.6 GB | 2.1 GB |
| Memory LLM cost | ~$1/mo (flaky) / $9.35 in one day on qwen | est. ~$3/mo (up to ~$5 in a heavy month), reliable |
The memory LLM costs about two dollars a month more than its cheapest unreliable option. In return, recall is about 18× smaller, twice as fast, accurate, and doesn’t fall over.
Hindsight tuning checklist
Setup
- Run one
local_embeddeddaemon; point other agents at it withlocal_externaland their ownbank_id - Give the daemon its own systemd unit with
Restart=always, a pinned version and linger enabled - Set
UV_TORCH_BACKEND=cpuif there’s no GPU - Put tuning in a systemd drop-in, not the plugin-managed env file
Performance
- Write a 10-query recall probe and record a baseline
- Set
recall_max_tokens 1500,recall_budget mid, and sweeprecall_min_scores.reranker(start at 0.05 forhs-rerank-1, not 0.25) - Set
HINDSIGHT_API_RERANKER_MAX_CANDIDATES=100 - Switch to
hs-embed-1and re-embed
Cost
- Measure token share per stage (retain vs consolidation) before estimating
- Use a cheap, reliable model for extraction and a stronger one for consolidation
- Benchmark providers and pin them with
*_LLM_EXTRA_BODY(single-quoted) - Count retries and failure rates as part of the price
Hygiene
- Audit banks against the prompt file’s few-shot examples after any model change
- Stage upgrades on a DB copy; export banks first
- Keep your own transcripts so you can re-retain
Lessons learned
- Measure recall before tuning it. The defaults injected ~4k tokens per turn, mostly noise.
- Reranker floors are model-specific. The “standard” 0.25 threw away every good result.
- Cheap models can leak prompt examples into memory. Use a stronger model for consolidation and audit regularly.
- Don’t trust default price-first routing for background jobs. “Cheapest” included a provider that rejected JSON mode and one that rate-limited.
- Know where your tokens go. Consolidation, not extraction, was 75% of the bill.
- Candidate count is the CPU latency lever. Model format wasn’t.
- Stage upgrades on a copy. It caught a crash-on-start bug.
- Retry isn’t recovery. Keep the source transcripts.
- Troubleshoot with a strong model and run with cheap ones. Use a model like Opus 5.5 for fine-tuning work like this; the background memory work runs fine on models that cost pennies.
Hindsight AI agent memory FAQ
What Hindsight is and what it costs
Hindsight is an open-source, local-first long-term memory server for AI agents, from Vectorize. It automatically pulls facts out of your conversations (retain), merges them into clean knowledge (consolidation), and then returns only the relevant memories when your agent needs them (recall). Retrieval combines semantic search, keyword search, an entity graph and time, and then reranks the results.
A notes file is small and hand-curated, so it goes into every prompt whether it’s relevant or not. A long context window costs tokens on every turn, and eventually it gets compacted or truncated. Hindsight, however, stores thousands of facts and injects only the few that matter for the current question. In my setup that’s a few hundred tokens per turn.
The software is open source and free to self-host. However, it makes LLM calls to extract and consolidate memories, and those cost money. My setup has eight agents sharing one server, so that comes to an estimated ~$3 a month on OpenRouter after tuning. Hindsight also offers a hosted cloud mode.
Not if you use a local mode (local_embedded or local_external). In those modes the database, embeddings and reranker all run on your machine. The only data that leaves is the text sent to whichever LLM provider you configure for extraction and consolidation. In cloud mode, however, conversation turns go to Vectorize’s hosted API.
Hardware and models
No. My server runs on a CPU-only Proxmox VM (8 vCPU, ~7.4 GB RAM). If you have no GPU, set UV_TORCH_BACKEND=cpu so the install skips the CUDA libraries. That shrank my environment from 6.6 GB to 2.1 GB with no change in speed.
In my setup, one daemon with its models used about 1.1 GB. Each extra per-agent daemon added 255–423 MB. So running one shared daemon with a separate memory bank per agent freed about 1.6 GB.
Pick a cheap model that is reliable, and judge it on measured cost, including retries. For example, mistralai/mistral-nemo handled extraction for me at ~$0.00021 per request with almost no errors. Meanwhile, qwen/qwen3.5-9b cost over 10× more per request in practice ($9.35 in one day) because of failures and billed retries. For consolidation, use a stronger model; I use mistralai/mistral-small-3.2-24b-instruct.
It’s optional, but worth it. Switching from BAAI/bge-small-en-v1.5 (512-token context) to hindsight-ai/hs-embed-1 (8,192-token context, multilingual) stops long memories from being truncated. Afterwards you have to re-embed existing memories with hindsight-admin reembed. For me that took 20 seconds for 1,962 memories.
Tuning and troubleshooting
Calibrate it on your own data. With the hs-rerank-1 reranker, the commonly suggested 0.25 returned nothing for on-topic questions. By contrast, 0.05 kept every relevant result and cut recall from ~4,376 to ~240 tokens per turn. So run a small probe of 8–10 real queries and sweep values like 0, 0.05, 0.1 and 0.25.
One common cause is a weaker model copying the few-shot examples from Hindsight’s consolidation prompt into your memory as if they were real facts. For example, mine “learned” about a dog named Rex I don’t have. To fix it, search your banks for the example strings in the server’s prompt file, delete the hits (dump them first), and then switch consolidation to a stronger model. Stale facts are another cause; however, world and experience facts can be invalidated through the API.
On CPU, reranking cost grows with the number of candidates. Setting HINDSIGHT_API_RERANKER_MAX_CANDIDATES=100 (the default is 300) cut my recall latency from ~4.4 s to ~2.2 s with an identical result set. Switching the reranker to ONNX, on the other hand, made it slower, not faster.
A fresh bank has nothing to recall until at least one retain cycle has run, and extraction is an LLM call. So have a conversation and give it a moment to process. The answer should then show up in a later session.
Cost, scaling and upgrades
First, measure token volume per stage; for me, consolidation was ~75% of tokens, not extraction. Then choose a model for each stage on measured cost, including retries, and pin reliable OpenRouter providers instead of the default cheapest-first routing. Finally, tighten recall, because that also cuts the input tokens your main, more expensive model pays for on every turn.
Yes. Run one daemon and give each agent its own memory bank with bank_id. Memories stay separate per bank, and an agent can also be given read access to other banks later. The trade-off is that if that one daemon goes down, every agent loses memory, so run it as a systemd service with Restart=always.
Not if you stage the upgrade. Export every bank, copy the database, and then run the new version against the copy first. Compare fact counts and recall before you upgrade the live server. Because upgrades run database migrations, never start an older version against a database a newer one has migrated. New versions may also rank results differently; that’s expected, not data loss.
Yes, if it can read web pages and run commands on the Hindsight host. Use the copy-paste prompt near the top of this guide. It measures first, then recommends, and only changes things after you approve each step. Also, use a strong reasoning model for the session.
What’s next
Tuned well, Hindsight AI agent memory is the difference between a consultant who starts every day as a stranger and one whose assistant walks in with the right three index cards. Hindsight gives you that assistant cheaply and privately. Just check what it’s handing over before you trust it.
FORGE YOUR OWN STACK //
- New to Hermes? Start with Building the Brain, the Hermes Agent Install Guide and Level Up Hermes, where Hindsight first goes in.
- Tuned your own memory server? Send me a message. I’d love to hear what your probe numbers look like.
