uniichat-recall
An independent Python memory-provider for Hermes Agent that reads the UniiChat log format.
Credit: the UniiChat log format and the memory-tree design come from
VictorTaelin/uniichat (Victor
Taelin) — an AI chat with one endless conversation and a binary-tree
memory. This repo is a from-scratch Python implementation for a different
runtime (a Hermes plugin); it shares no code or history with the original.
Fork the original if you want the app itself.
What it does
Hermes agents get recall over a UniiChat log: ask "what did we decide about
X" and the provider ranks the log's records, returns the original text with
record/session IDs, and abstains when nothing in the log answers — no
hallucinated memory, ever.
- Ranking: coverage-primary scoring with a BM25-lite tie-break over
cold-window candidates, L1-cached - Query expansion: when the query's own words rank no candidate, one cheap
model call re-expresses it in the log's vocabulary and the variant hits join
the candidate pool — the fix for paraphrased questions (offline = no-op) - Two-tier evidence: candidate-first routing with a strong-gate
(second-opinion model) tier for ambiguous windows - Negative gate: adversarial queries never leak; the provider returns
nothing rather than guessing
Design notes from the original implementation are preserved in
README-original.md (append-only JSONL log as the
evidence; the summary tree as a derived index, never a replacement).
Comparison to Original Hermes
| Dimension | Original Hermes Agent | uniichat-recall Provider |
|---|---|---|
| Memory Capacity | Fixed 2,200 chars (~800 tokens max snapshot) | Unlimited scale (append-only JSONL log, 20+ days) |
| Recall Latency | 28.5 s (multi-hop menu walk) | 0.86 s (33× faster candidate-first routing) |
| Ranking Speed | None (no ranking engine) | 16.7 ms p50 (in-process L1 cached) |
| Retrieval Accuracy | 0.742 hit@1 (BM25 baseline) | 0.933 hit@1 (+19.1% improvement) |
| Hallucination Defense | Unbounded (guesses when missing) | 100% Zero-Leak Abstention (20/20 refused) |
| Evidence Grounding | Lossy summaries only | Exact JSONL character offsets & session IDs |

Benchmarks
Measured over a 20-day real UniiChat log (120 gold queries, tier L; strict
hit@1 — the gold record ranked first):
| Variant | hit@1 | hit@3 | hit@6 |
|---|---|---|---|
| BM25 only | 0.742 | 0.875 | 1.000 |
| Keyword first-pass | 0.858 | 0.967 | 1.000 |
| Coverage + re-rank (shipped) | 0.933 | 0.975 | 1.000 |
Latency: end-to-end recall 28.5 s → 0.86 s (33× faster); in-process
ranking p50 16.7 ms / p95 28.9 ms; LLM-judged tier p50 23.5 ms / p95
47.5 ms.
Negative baseline: 20/20 adversarial queries abstained; 0 secrets
leaked; 0.0 false-positive gate rate on real queries. Re-checked live
2026-11-17 with expansion on: 4/4 adversarial/injection queries abstained,
and credential-shaped tokens in outbound transcripts are masked
(apikey_*, sk-*, vck_*, gh* patterns) — the local log stays
complete, only bytes leaving for the model endpoint are redacted.
Paraphrase recall (the old honest gap): lexical ranking misses rephrased
wording — 3/6 on the frozen 20-day bench. Query expansion (one model call
re-expressing the query into search variants) is the shipped fix; measured
2026-11-17 on a fresh 8-item paraphrase set over a 3-day log snapshot with
glm-5.3-flash: judged-correct 5/8 -> 6/8, gold-in-window unchanged (6/8),
zero regressions, median latency 4.4 s -> 12.3 s. The remaining misses: one
true retrieval miss (variants still didn't reach the gold session) and one
strict-judge case. The frozen 20-day bench remains the hard case to re-run.
LLM-free alternatives (pseudo-relevance feedback, query-term co-occurrence
mining — bench/offline_expanders.py) were built and measured on the same
set: both 6/8 retrieval, identical to baseline — a 120-record chatty log has
no statistically visible co-occurrence breadcrumbs, exactly as predicted for
corpus-local expansion. They may pay off on a large old log; re-run the tool
against the frozen 20-day bench before adding an offline expansion tier.




Infographics styled in the Hermes Duet design language — every number
grounded in bench/ result files.
Install & test
Drop this directory into your Hermes plugins folder (e.g.
<HERMES_HOME>/plugins/uniichat-recall) or install from the Hermes plugin
catalog (hermes plugins install uniichat-recall), then enable the provider
in your agent config.
Configuration
All options are exposed through get_config_schema() / Hermes plugin settings:
root— Storage directory for the append-only log, summary tree,
vectors/, andmisses.jsonl. Defaults per-profile to
<the served profile's hermes_home> / "uniichat", bound ininitialize()
from that profile'shermes_home; set an explicit path to share one log
across profiles.summarize(trueby default) — Use the configured Hermes provider
(ctx.llm) to summarize tree nodes (false= clipped verbatim excerpts,
offline).query_expansion(trueby default) — On a weak keyword match,
re-express the query viactx.llminto search variants (no-op offline).dense_recall(trueby default) — Widen the candidate pool with
cosine-similar records from a local vector index using a user-configured
OpenAI-compatible embeddings endpoint, model, and secret (disabled / no-op
when unconfigured). The key is read only fromembedding_api_key_env
through Hermes's secret scope; a plaintextembedding_api_keyin
config.yamlis ignored. Redirects that leave the configured origin are
refused, and a configured key is only sent over HTTPS.second_opinion(falseby default) — Opt-in second-opinion check via
theagyCLI on semantic misses.
Tests
Tests are stdlib unittest:
pip install ruamel.yaml
PYTHONPATH=<hermes-agent> python -m unittest discover -s tests
# 113 tests, ~13s
store.py tests are dependency-free; the provider tests import
agent.memory_provider / hermes_cli.config from a hermes-agent checkout,
which is the only reason PYTHONPATH and ruamel.yaml are needed. CI runs
the full suite on both ubuntu-latest and windows-latest.
The bench (bench/bench.py, bench/misses.py) needs your own UniiChat log
snapshot — none is bundled, on purpose: real logs contain private
conversations.
Disclosure
What this plugin does beyond local storage, so you can decide before installing:
- Model calls via your configured Hermes provider (
ctx.llm). Chat,
summary-tree compression, recall routing/answering, and query-expansion
calls use the user's configured Hermes provider viactx.llm(no hardcoded
third-party endpoint or API key). Runs fully offline whensummarize: false
(clipped verbatim nodes, no model calls). Credential-shaped tokens are
masked in transcripts before transmission. - Optional
dense_recallembeddings. Whendense_recallis enabled and
a user-configured OpenAI-compatible embeddings endpoint, model, and secret
are set, redacted record excerpts (first 4,000 characters) and query text
are sent to that configured endpoint to build and query a local cosine index
under<root>/vectors/. The secret is resolved at call time from
embedding_api_key_envvia Hermes's secret scope; plaintext
embedding_api_keyvalues are ignored. A redirect that changes origin
(scheme, host, or port) is refused, and a configured key is only sent over
HTTPS. Disabled / no-op when unconfigured; this plugin stores nothing
remotely. - Optional
agyCLI and background work. Opt-in only (second_opinion: falseby default). Whensecond_opinion: trueand theagy
(Antigravity/Gemini) binary is present, on a semantic miss the provider may
spawnagyas a second-opinion reviewer with a minimal environment and
redacted prompt (agy -p=, asagydoes not accept plain-text stdin). Separately, a background thread rebuilds the
summary tree after turns are appended. - Local logs. The append-only log, derived tree,
vectors/, and
misses.jsonldefault per-profile under that profile's
hermes_home / "uniichat"(configurable viarootfor a shared log).
Cross-platform: cross-process
append locks usefcntlon POSIX and anmsvcrtbyte-range-lock shim on
Windows; directory fsync around atomic renames is POSIX-only (Windows
renames are atomic without it).
Status
Working, benchmarked, 113/113 tests on Linux and Windows. The store.py
ranking, two-tier evidence routing, and negative gate are considered
stable; query expansion addresses the paraphrase gap (see Benchmarks), and
re-running the frozen 20-day bench against it is the remaining work item.
Recall now fuses three candidate sources — lexical coverage ranking, query
expansion variants, and cosine similarity over a local vector sidecar
(dense_recall, venice-embed-1 at a measured ~$0.000004/request) — behind
an unchanged strong gate: dense hits widen the semantic tier and never
promote to raw mode, and the offline behavior is identical. Judged
14/16 on the 16-item paraphrase tier; the residual miss shape is
"right neighborhood, wrong instance" (same-topic impostors fuse above the
gold), which a record-level reranker is the next lever for
(bench/README.md, fourth wave of 2026-11-28).
Every provider-side model call is now hard-bounded by the 90 s semantic
deadline (_bounded_chat): a hung or slow-drip endpoint is abandoned at the
budget and the recall returns honest partial evidence — two recalls measured
at 90.1 s / 188.1 s against the budget before the fix (see bench/README.md,
2026-11-27). The answer stage is shaped by query type, one call each:
question-shaped queries answer from quoted passages first (grounded,
negation-aware — P003/P009-class rescues); keyword-shaped queries get an
all-terms lookup prompt whose abstention line is enforced locally (a claimed
record must verifiably contain every query term, else NOT FOUND — no extra
model call). The 20/20 negative baseline holds with glm-5.3-flash, the only
model in use, at a measured $0.0043/request (bench/README.md, third wave of
2026-11-28, which also records the dead-ends: morphological variants,
session-vote seeding, a third candidate window, char-ngram retrieval).
README from the reviewed commit 9a1e457; it updates when the author re-pins.

DevvGwardo