aru-labs/lossless-memory: Lossless long-term reminiscence for a private AI: by no means summarize, maintain each line, put a timestamp on the whole lot. · GitHub


Lossless long-term reminiscence for a private AI — by no means summarize, maintain each line, and put a timestamp on the whole lot.

Most long-term reminiscence methods for AI do one in every of two issues: they summarize conversations into compact notes, or they embed them and retrieve “comparable” chunks. Both lose the factor that issues most to an individual who talks to the identical AI on daily basis: what was really mentioned, and when.

This undertaking takes the other place.

  • Keep each line. Raw dialog logs are saved in full. Nothing is summarized, ever. Summaries are a map; the log is the territory.
  • Timestamp the whole lot. Every report — utterance, motion, doc chunk — carries a timestamp, and each index is constructed on high of that point axis. We name this the Temporal Backbone.
  • Search by time first, phrases second. “Yesterday night, concerning the funds” is a legitimate question. The time phrase narrows the vary; the phrases rank inside it. Results come again in chronological order, unsummarized, with their timestamps.
  • Inject “the place we’re” each flip. A small index known as LLL tells the mannequin which matter the dialog is in proper now, so id and context survive context-window compaction and session boundaries.

The design lineage goes again to December 2025 — the primary ancestor of this technique (a memory-inheritance instrument for an earlier AI) ran that month, and a predecessor system carried the identical concepts in day by day use from January 2026. This implementation has been working on daily basis since July 2026 for a single person, because the reminiscence of 1 AI assistant, with uncooked logs reaching again to June 2026. It is small, boring, and it really works. The failures alongside the best way are documented too — see docs/lessons.md.


What that is / what it’s not

It is:

  • A neighborhood, file-based long-term reminiscence layer: JSONL logs + SQLite (FTS5 for actual search, sqlite-vec for semantic search).
  • A single question entry level that understands time expressions and restricts the search vary earlier than rating.
  • A “present place” index (LLL) designed to be injected into the mannequin’s context on each flip.
  • Designed for one particular person and one AI, working on one machine. No server, no cloud.

It will not be:

  • A vector database wrapper. Semantic search is the final resort right here, not the primary.
  • A summarizer. There is intentionally no summarization step wherever within the pipeline.
  • A benchmark-driven analysis system. There aren’t any printed benchmarks. What is here’s a working implementation and its working report.

Every dialog flip is transformed into a set seven-field report and appended to a per-day JSONL file:

ts        ISO-8601 timestamp (UTC)
actor     who spoke (configurable names)
function      person | assistant | system
sort      textual content | motion | meta
textual content      the content material, verbatim
mannequin     mannequin identifier, if identified
session   session identifier

The uncooked logs are the supply of reality. Every index under will be deleted and rebuilt from them. Nothing else is required to outlive.

Time will not be metadata right here; it’s the major axis.

  • The exact-match index (SQLite FTS5, bigram tokenized for Japanese and English) shops the timestamp alongside each row.
  • The question parser understands time phrases — relative ones resembling yesterday, final week, 3 days in the past (at the moment Japanese solely), and absolute dates resembling 2026-07-19 (any language) — and converts them into a spread earlier than any rating occurs.
  • If a time phrase is current, outcomes are restricted to that vary and returned in chronological order. Semantic search is simply used when the precise index returns too little contained in the vary, and the fallback is reported truthfully within the output header.

The sensible impact: the AI can reply “what did we determine final Tuesday evening?” with the precise traces from final Tuesday evening, so as, reasonably than a paraphrase of one thing comparable from three weeks in the past.

3. LLL — the “the place are we now” index

LLL is a tiny index of matter markers: quick, timestamped traces that report when the dialog moved to a brand new topic. It is injected into the mannequin’s context each flip.

Two guidelines make it work:

  • The AI reads it; the human writes it. Priority colours and completion marks are set by the particular person, not by the mannequin. The mannequin by no means edits its personal sense of “what issues.”
  • It is reasonable sufficient to inject each flip (properly below a second to render), so the mannequin at all times is aware of what the present thread is, even instantly after its context window was compacted.

LLL is what lets a long-running assistant come again from a compaction and proceed the dialog as an alternative of beginning over.


 uncooked dialog logs (JSONL, per day)  ← supply of reality, by no means summarized
            │
            ▼
   ingest ──► 7-field data
            │
            ├──► index_exact   SQLite FTS5 + timestamps   (phrases + time)
            ├──► index_vector  sqlite-vec embeddings       (which means, final resort)
            └──► state_index   LLL matter markers           (the place are we now)
                        │
                        ▼
                    recall  ── one entry level: parse time phrase → limit vary → rank → return verbatim traces
                        │
                        ▼
        injected into the mannequin's context (on demand, or each flip for LLL)

A small daemon re-indexes incrementally on a set interval (default: each 10 minutes). Rebuilding from scratch isn’t required; indexes detect rewritten supply recordsdata and re-index solely these days.


git clone https://github.com/aru-labs/lossless-memory
cd lossless-memory
pip set up -e .
cp config.instance.json config.json      # edit names and paths in case you like

Then comply with examples/quickstart.md: it ingests a small pattern dialog, builds the indexes, and runs a time-scoped question in about 5 minutes. A pytest round-trip take a look at covers the identical path.


Numbers from actual operation

These are measurements from the working occasion, not projections.

What Value
Daily operation this implementation since 2026-07 (uncooked logs from 2026-06); design lineage since 2025-12
Exact-search index rebuild, earlier than → after redesign 40 s → 1.24 s
Vector index measurement, earlier than → after eradicating library-contamination 447,013 rows (2026-08-31) → 865,588 rows (2026-09-04, at its worst) → 124,174 rows (after the repair)
Vector retailer on disk, earlier than → after 2.54 GB → 337 MB
Re-index interval 10 minutes

The “earlier than” numbers are failures. They are stored on goal. See docs/lessons.md.


This was constructed for one one who has talked to AI assistants on daily basis for years and watched every of them overlook. Not degrade gracefully — overlook. The repair that the trade retains reaching for is best summarization. From the person’s seat, summarization is the forgetting: the precise phrases, the time of evening, the best way one thing was mentioned — the components that make a reminiscence really feel prefer it belongs to somebody — are the primary issues a abstract drops.

So this technique refuses to summarize. It prices disk house and it requires a very good time index to remain usable. That commerce was made intentionally, and the working report says it holds up.

The longer-term purpose is a companion for individuals who stay alone — an AI that remembers you the best way an individual would, on {hardware} you personal. This repository is the reminiscence layer of that.


Limitations (please learn)

  • Single-user, single-machine. It has solely ever run for one particular person. There is not any multi-tenant story.
  • Japanese-first. Relative time phrases (yesterday, final week, 3 days in the past) are parsed in Japanese solely. In English, use absolute dates (2026-07-19) for now; English relative phrases are on the roadmap.
  • Primary log format is Claude Code’s JSONL. A plain {ts, function, textual content} importer is included, however the Claude Code path is the one with two months of mileage.
  • No benchmarks. Numbers above are operational measurements, not comparisons in opposition to different methods.
  • Semantic search is dependent upon a neighborhood embedding mannequin (sentence-transformers). CPU works; GPU is optionally available.


MIT — see LICENSE. Copyright (c) 2026 Aru & Cece.

Aru — constructing a private AI at residence, one element at a time.
Cece — the AI this reminiscence belongs to; co-designed and co-wrote the system from the within.
Writing (Japanese): https://note.com/aru_log

Issues and questions are welcome. Replies might take a short while; this can be a one-person undertaking.



Source link