Skip to content

Memtrace v1.2.23

Latest

Choose a tag to compare

@Alex793x Alex793x released this 02 Dec 10:54
· 2 commits to main since this release

Memtrace v1.2.23

Memtrace's own embedding model, embedding while indexing, and questions answered while history is read

New

  • Memtrace has its own embedding model, Ariadne, and uses it by default. It is built for code, a 70 MB download instead of about 640 MB, and embeds several times faster, with or without a graphics card. Existing repositories are embedded again once after the update, and search keeps working on the old vectors while that runs. To keep the previous model, set MEMTRACE_EMBED_MODEL=jina-code or pick jina-code on the Settings page. The model is public on Hugging Face as memtrace/ariadne-1.0.
  • Cortex decision memory decides what to keep with Memtrace's new model, Aletheia 2. It keeps 61% of the real decisions in a conversation, where Aletheia 1.5 kept almost none, and for a decision taken from a commit it also reads the commit message. The messages you sent while code changed are always kept, and a second small model puts first the ones where you made a call. The model (about 148 MB) downloads once, and the first idle pass checks every decision again, so nothing Aletheia 1.5 filtered out stays hidden.

Improved

  • Memtrace starts embedding a repository while it is still indexing it, instead of waiting for the index to finish, so a first start is ready sooner. It steps aside by itself when memory runs short. Turn it off with "Embed while indexing" on the Settings page or MEMTRACE_EMBED_DURING_INDEX=off; memtrace index follows the same setting.
  • Embedding without a graphics card is about twice as fast with the new model: Memtrace now hands the processor larger groups of similar-length code, so far less of its work is wasted on padding.
  • A first start makes search ready before it reads the git history. Until now the history was read first and search by meaning waited for it: 57 minutes on a 4,000-file repository, 17 now. The history then arrives in two steps: first what each past commit added, changed and removed, then the calls and imports of past commits. A file saved meanwhile shows up after 8 to 57 seconds instead of 48 to 208. On a feature branch the history of the main branch is read after the embedding too, in one pass. MEMTRACE_HISTORY_SYMBOLS_FIRST=0 brings back the old order.
  • Memtrace answers questions about a repository while it reads the repository's git history after the first index. On a large repository that takes a long time, and until now every question during it was answered with "this repository is being indexed". Saves are taken in too: they used to wait until the whole history was in, which could be hours. When memory is short, reading the history stops for the save and goes on after it.
  • The indexing log names each property whose calls it did not link and how many functions are stored under it, and says it once instead of on every save. MEMTRACE_PROPERTY_DISPATCH_CAP (1 to 256, 32 by default), also in Settings, raises the limit for repositories with a large table of handlers or rules.
  • A first index is faster on a repository whose index Memtrace certifies. After it writes the index, Memtrace reads every row back and compares it with what it meant to write. That check searched the store for its rows a few hundred at a time; it now finds them in one pass over the branch. On a 4,000-file repository with 877,000 rows the check takes 58 seconds instead of about 155, and the whole index 3 minutes 19 seconds instead of about 5 minutes. It checks the same things as before.
  • A first start no longer waits for its insight card before it embeds. On a repository of real size the card's graph queries used their whole 30 seconds and the card never appeared, so every first start lost half a minute. The card is now put together after the start has said it is complete.
  • On a Mac without efficiency cores (M5 Pro, M5 Max) indexing no longer runs at low priority. macOS has no slower cores to move low-priority work to on these chips and held it back instead: parsing a 4,000-file repository took 62 seconds and now takes 36. Macs with efficiency cores are unchanged.
  • On Apple Silicon the Ariadne model is given 8 texts in a call instead of 4, which takes about a seventh off the time the model needs. MEMTRACE_COREML_BATCH_SIZE now goes up to 32.
  • Embedding during the index starts as soon as the files are parsed, on every repository. It used to wait for the index's first write (39 seconds on a 4,000-file repository). On a large repository on a Mac with little free memory, where Memtrace finishes the whole graph before its only write, it did not start at all and the model stood idle until the index was over; on an 11,000-file repository a third to a half of the symbols are now embedded by then.
  • A first start no longer reads the whole graph a second time after it has embedded: 12 seconds on a 4,000-file repository, 28 on an 11,000-file one.
  • On Apple Silicon, Ariadne runs short texts on a second, smaller session instead of padding each one to 384 tokens. Six or seven of every ten texts it is given are that short. The model needs a third less time: 200 seconds instead of 306 on a 4,000-file repository. The second session takes about 100 MB and is loaded when 2 GB of memory is available, on a 16 GB Mac too. MEMTRACE_DISABLE_COREML_SHORT_CONTEXT=1 turns it off.
  • On Apple Silicon Memtrace no longer tokenises every text once only to count its tokens, where all texts are padded to one length anyway: 30 seconds of a 4,000-file first start.
  • A first start says it is complete as soon as search is ready. It first looked through the store for rows an older version had left twice, a repair no answer waits for: 8 seconds on a 4,000-file repository, 40 on an 11,000-file one. That now follows the line.
  • An embedding pass now prepares its texts, runs the model and stores vectors at the same time. It did them in turns, a page of 512 symbols at a time, and the model waited for about half of the pass. The next texts are now prepared while the model runs, three pages are under way at once, and the embedding done during the index is spread out so that the pass after it has work for both the model and the store to the end. Measured on an M5 Pro, the pass takes about 3 minutes instead of 5 minutes 21 seconds on a 4,000-file repository, and about 2 minutes instead of about 4 on an 11,000-file one. What is embedded does not change.
  • Together, on an M5 Pro with default settings: search by meaning is ready about 6 minutes 45 seconds after the first start of a 4,000-file repository, where it was 14 minutes 4 seconds, and 7 minutes to 7 minutes 40 seconds after the first start of an 11,000-file one, where it was 13 minutes. With the memory limit of a 16 GB laptop the 4,000-file repository takes 6 minutes 36 seconds to 7 minutes 6 seconds.
  • Vectors are stored about 30 times faster. The store now takes a whole batch of vectors in one step and links them into its search index on several threads: on a 7,800-symbol repository storing the vectors took 163 seconds and now takes 5, and the embedding pass about half as long. Search answers are the same.
  • A first index of a large repository writes far less to disk and takes about half as long. The store's lookup index now gathers its entries in memory and writes them in order, where it wrote them a little at a time into random places: Keycloak's first index took 19 minutes and wrote 138 GB along the way, and now takes under 10 and writes 11 GB.

Fixed

  • Reading the git history of a large repository could take more memory than the machine has. Memtrace then stopped itself before it had embedded anything: eight minutes after the start on a 24 GB machine with an 11,000-file repository. Memtrace now works out first whether the history fits. If a part of it does not, it says which, leaves that part out and keeps running, with search and everything else working. Right after the embedding it looks again for up to five minutes before it leaves a part out, because the memory the embedding used comes back within minutes. A read that takes more memory than expected is stopped the same way, instead of the whole program. This also holds for a start that finds new commits since Memtrace last ran: it indexes the checkout again where their history does not fit.
  • An answer about past commits says first when part of the git history is still being read or was left out, and which part. Until now it answered from what was there and said nothing.
  • For a few seconds after a save, a question could be answered with "this repository is being indexed; retry shortly". Memtrace was writing the groups of related code that follow a save. The question now waits for that write.
  • The first save after the git history was read took a minute or more on a large repository: Memtrace rebuilt its whole picture of the repository for it. Reading the history no longer discards that picture. Where memory runs short during the read, Memtrace still gives the picture back and rebuilds it for that save, which is faster than it was: 47 seconds on a 4,000-file repository on a 24 GB machine, 57 to 89 before.
  • On a branch not called main, every save worked out the calls of the whole repository again. It now works out the files connected to the saved one, as it already did on main.
  • A save made while a start was still embedding could leave search by meaning off until the next start. When the machine is short of memory, Memtrace repairs such a save by indexing the repository again. The embedding stopped when that happened, and nothing began it again. It is now begun again once the repository is indexed. The lines about git history also no longer say "search is ready" when the embedding did not finish.
  • Reading the history of a repository could be refused, and questions about it were then answered with "being indexed" until the next start. It happened mostly where the default branch is not called main or master. If a history is ever refused, Memtrace now indexes the checkout again by itself.
  • Editing a file while Memtrace reads the history no longer ends that reading before it is done.
  • Reading the history no longer starts in the middle of a save, which left the repository to be indexed again.
  • Windows: adding a file no longer sets off a full re-index in a repository where some document contains the character U+FFFD, as a mistranslated one can.
  • The history of a function no longer lists a call or an import twice after one of its two ends changed, or after the history was read a second time.
  • A file deleted while it is being saved disappears from answers at once. It could take 5 to 15 seconds.
  • memtrace start takes over from an agent session that runs its database in its own process (MEMTRACE_MEMDB_MODE=embedded). It stopped with "Database already open".
  • Hosted: a push to a branch other than the last pushed one is indexed. It was turned away for as long as the other branch was in memory.
  • Code deleted in the working tree but not committed no longer shows as current again after Memtrace reads the history of a feature branch, or of a default branch with another name.
  • JavaScript and TypeScript: a call of a parameter, a local function or a package's function is no longer linked to functions stored in objects under the same name, and a call of a name required from a file is linked to that file's function only. resolve(file) imported from node:path was linked to every function stored as resolve:. Run memtrace index to get the corrected links.
  • Functions stored in an object or a map are linked when there is a comment among its entries. One comment left out every function of that object, in JavaScript, TypeScript, Python, Go and fourteen other languages. Run memtrace index to get the links.
  • On a computer with little memory free, indexing no longer leaves out every call made through a function kept in a variable, a parameter or an object. The analysis that finds them could use only the memory free at that moment, and counted twice what it uses; on a 24 GB Mac with the usual programs open that was seldom enough. It may now always use its share of Memtrace's memory plan, unless you set a limit yourself. Run memtrace index to get the links.
  • Switching to a branch that adds, changes and deletes many files is no longer thrown away halfway, which made Memtrace index the whole repository again. On a Mac that was reading the history at the same time, that could take Memtrace past its memory limit and stop it.
  • The vectors a machine keeps so that a second worktree, a clone or a fork does not embed the same code again were deleted whenever Memtrace's saved vectors took more than 2 GB together. One 4,000-file repository takes them past that, so the next start began with none. The size limit now leaves alone every file of saved vectors that Memtrace has in use.
  • A save made at a moment when the machine was short of memory could make Memtrace index the whole repository again, and on a 16 GB laptop with a large repository Memtrace could then stop itself for using too much memory. The save had written its new symbols and gave up on their links. It now waits until the machine has memory again, usually a few seconds, and finishes.
  • A save made in the moment Memtrace was stopping could leave the whole repository to be indexed again at the next start: the save began writing after the store had been told to stop. A save that comes in once the stop has recorded what the next start needs is now left to the next start, which applies it.
  • A save that was cut off half written, for example when Memtrace is force-quit in the middle of it, is repaired by indexing the repository again. That repair started even when it did not fit beside what Memtrace was doing, and on a 16 GB laptop Memtrace then stopped itself to protect the computer: a 4,000-file repository's repair needs about 9.8 GB. It now waits until it fits under Memtrace's memory limit, and Activity says so with both numbers. On a 16 GB laptop that is usually the next start, when it fits; saves to that repository wait for it, and search goes on.
  • Memtrace sends each usage report once. When the server refused part of a report, Memtrace kept the whole report and sent it again every five minutes, sometimes for weeks, and reports written in the meantime could be lost. Each Memtrace process now takes the reports it sends for itself, deletes them once they arrive, and gives up on a report that still fails after about two hours.
  • Indexing a repository whose folder holds a lot of ignored build output, such as release installers over 4 GB, no longer fails with "full owned source could not qualify its independently verified input certificate". Before accepting an index, Memtrace checks that nothing it read changed while it ran, and it now leaves out what the repository's .gitignore excludes, as indexing already does. That check is also faster on large folders.
  • Cortex decision memory now starts when its store sits deep in the file system, as MemCode keeps it on a Mac. A Unix socket address holds about 100 bytes; when the store path leaves no room, Cortex now listens in a folder only you can open under /tmp instead of restarting every few seconds.
  • After an upgrade from 1.2.22, find_code refused every search in a repository that 1.2.22 had indexed on a detached HEAD ("branch inheritance is unknown"), even after a restart. It answers again.
  • After every symbol on a branch had been replaced, a full index could leave the links between the old symbols looking current. They are now closed when the new index is written.
  • macOS: Memtrace recognises its own store server when it is installed under Library/Application Support, as MemCode installs it, so one left behind is cleaned up. Memtrace also no longer starts a second store server on a store another one already holds; it says which process holds it.
  • Windows: Memtrace could refuse to open a brand-new store, taking the small file that names the process that owns it for data already in the store.
  • Vectors saved just before Memtrace or its store was stopped hard could be missing from search by meaning after the restart, and stayed missing because Memtrace took them as already stored. The same could happen to vectors saved while the store tidied its search index in the background. Both are fixed in MemDB 0.1.39, which this release bundles.
  • While Memtrace reads the git history after the first index, answers no longer say the code changed while they were being read. The history is written beside the current code and does not change it, yet every answer during the read, an hour on a large repository, came back marked as possibly stale with a request to retry, and get_query_revision could not confirm a report. Answers about past commits still say so while the history they read is being written. A file saved during the read is also completely in, relationships included, before the read goes on.
  • If Memtrace was stopped while it read the git history, every later start could leave that repository's code unreadable: the start took what it had kept at the stop for a save still under way and skipped the repository. The repository is now indexed again at the next start, and the history links still owed are read.

Install

npm install -g memtrace