Published November 23, 2026
| Version v0.3.1
Software
Open
long-term-memory-structure/long-term-memory-structure: long-term-memory-structure 0.3.1
Authors/Creators
Description
ltms records <folder>: the loop the message gives holds the folder's name as written; a name with$&,$`or$$in it was changed by the pattern rules of the replace that built the message.- Every command: when a file cannot be opened for a reason other than the four named ones (a symbolic link loop, a name too
long), Node's own words, which repeat the path, are printed with their control characters escaped; they were printed raw. The
path ltms quotes before them is escaped by
ltms recordsalone, so in the other commands a newline in a path still splits that message (Known limits). ltms shapes --vocabulary: the closing line says to read the words of the vocabulary given, naming its file as it was given, beside the report's allowed list, as the README and--helpsay; it named the allowed list alone.ltms shapes --vocabulary: akinds.subentry for a kind thatvaluesdoes not list atkinds.pathis taken, as before, and applies once--allowlists the kind there (the route--unlistedsuggests); a run in which neither lists it now gets a warning on stderr naming the entry, since such records print as(unlisted)before their sub-kind is read.- README,
ltms shapes: the order of a map's keys is stated as ltms writes it and--checkholds it: the keys that are array indices (a whole number from 0 to 4294967294 written without leading zeros, such as a value200given with--allow) first, in numeric order, then the others by their text; it said "in ltms's order", and the code's comment "by their text". The format is unchanged (ltms-shapes/0). ltms shapes: a directory met again under a path given (the same device and inode as one already entered in that path's walk, as a bind mount of a directory inside itself makes) is counted in a warning, each once, in the wordssearchprints for the same case (one function writes them for both); it was passed over without a word. Each directory is now entered once per path given, assearchenters it, and its entries are still counted once.ltms shapes: a path given through a symbolic link to a directory is known by that directory's device and inode, assearchknows it, not by the link's: a directory met again under it is counted (above), and the directory given also as itself is listed once, where each of its entries was counted twice (one FIFO named.jsonlmade "2 entries").- Every message that calls an error a bug in ltms (an internal error in
search,index,skeleton,stats,shapes,recordsandpin; ashapesreport refused at the write;records' count that does not balance) says where to report it: "a bug in ltms (report it at https://github.com/long-term-memory-structure/long-term-memory-structure/issues; an issue there is public)", package.json'sbugs, written once in the code. They named no place. ltms shapes --check: a report whose first line's allowed list holds an entry that--allowrefuses (a path that breaks the rule for a name, a value that breaks the label rule, a value with:at the kind path or at a sub-kind's path) is refused with a line for each such entry, naming it by its index (allowed[0]) and the rule it breaks, never by its text; one message stood for any such entry, naming neither.- The receiver's validator,
test/shapes-validate.mjs(in the repository; the package does not ship it): at a kind it takes only the vocabulary's kinds, the allowed list's and the format's four words for a kind,(none),(not a string),(unlisted)and(all); its check of the token took any word of the format there (int,(rare),version), and only its check of the line refused one. Its verdict on a report is the same. ltms shapes, at the write and with--check, and the receiver's validator: a path line with afirstversion and nolast, or alastand nofirst, one whosefirstis later than itslast(in the versions' numeric order), and one whosenis in a lower bucket than itsfiles(n2-3infiles4-7: each file a path occurs in holds it once at least) are refused, by the line, each in words of its own, as the README's "Before you send one" now says; ltms never writes such a line, and each passed both checks.dist/shapes.jsexportsvcmp, the comparison under the order of versions, for the tests alone: no report reaches its tie-break (versions equal as numbers ordered by their text), since the version rule gives each version one spelling, so a unit test holds it. It is not a part of the module's use.ltms recordsandltms shapes: the line that says a write to stdout failed puts the number of lines written in agreement with its words, in one function both commands use: "after 1 of their lines was written" (records, whose first write is its header), "after 0 of its 1 line were written" (a shapes list of one line); it said "1 of their lines were written" and "its 1 lines".ltms records: the README and--helpgive the balance line in full, with every form it takes:line,recordandrootin the singular for 1,(the last without a newline), no list of kinds when no record was written, andTHE COUNT DOES NOT BALANCE; the README gave one example of it, and--helpnamed its parts in words. A path records prints on stderr, on the balance line and on every other, has its control characters escaped (\n,\tand\r, any other as\xHH), so a path that holds a newline no longer splits a line in two.ltms records' folder loop (the README,--help, and the messages for a folder or no path; one loop in all of them): its status is 1 when a run failed, where it was 0 (its last command was anecho), set by its last command, never byexit, which would close the shell it is pasted into; it names on stderr each entry named.jsonlthat is not a regular file (a FIFO, a directory), which it skips (skipped, not a regular file: <path>), where it passed over them without a word; and zsh runs it over a folder with no.jsonlfile, where zsh stopped it with "no matches found" (the loop sets zsh'snullglobin its own subshell). The tests run it as written by bash, zsh and sh.ltms records: a record that has a parentUuid and no uuid that is a string (none, or a number) gets its parent link as any record does:parent, the address of the record its parentUuid names, ornull;parent_by"supplied"; andsupplier.parent, by the label rule, counted among the balance line's parents; it gotparent_by"none", and its parentUuid was not printed. records'--helpand the README's Privacy give the label rule as 1 to 64 characters (an empty value prints(withheld)); they said "at most 64".ltms records: a uuid link (parent,leaf,logical_parent) is the address of the first record with a uuid and a parentUuid that carries the id, else of the first record without a parentUuid (a sidecar, such as anai-titlerecord) that carries it; an id that only a sidecar carries wasnulland counted on the balance line as not in this file. A sidecar that only repeats a record's uuid never takes its links.dup_ofstill goes by the records with both.ltms records --helpgives the check of the balance for a file still being written, as the README does: count only the bytes the header names,head -c <bytes> <file> | wc -l(plus one whenlast_line_unterminatedistrue); it gave only the file'swc -l, which reports a false imbalance once the file has grown since the run.ltms records --help'stimerow says which stamps get autc, as the README's does: an ISO 8601 date and time in the extended format (2026-01-05T09:00:00, a fraction allowed) with its zone (Zorz, or an offset of hours and minutes); it said "an ISO 8601 date and time with its zone", which2026-01-01T10:00Z,2026-01-01T10:00:00+02and20260101T100000Zare, and none gets one.- README,
ltms records: thecallsrow says it is on a user record of any kind that holds tool_result blocks; its "(a tool result's)" gave the kind astool result, where a record whose first block is text, and so of kindinput, holds one too. ltms recordsinto a pipe whose reader keeps up is about as fast as into a file: a full pipe is waited on 0.1 ms at first, the wait doubling up to 5 ms while it stays full, and 0.1 ms again once a write goes through; it was waited on 5 ms at a time, which made it up to about twice as slow. Measured on one machine, a file of 120 MB (274,853 lines), the median of 3 runs each: into| cat > file4.87 s (5 ms a wait: 8.01 s; into a file: 4.81 s), into| wc -l4.64 s (5.52 s), into a reader that waits 3 s before it reads 6.70 s (10.49 s), with records' own CPU time no more than with the fixed wait (into| cat, 4,765 ms against 4,895).ltms searchandltms index: a directory's entries are listed with their names as bytes, asltms shapeslists them, and a name is used as text only when its text gives its bytes back: a name that is not valid UTF-8 is reported with its bytes written as\xHHand counted as failed, as before, and a twin beside it, a valid name that decodes the same (U+FFFD.jsonlbeside\xff.jsonl: a file, a directory, or a symbolic link, counted as any link), is read as any other name; it was passed over without a word (found1,read0,failed1, and a twin link not counted). search and shapes read the same files again, as the README says (index reads them too, but for what the README says it counts and does not read: a session's own files, set-aside copies, a pin directory), but where a bind mount or two hard links reach one transcript (Known limits).ltms searchandltms index: what the walk counts under the directories given is counted once however many of the paths given reach it (a folder given twice, or with its parent), asltms shapescounts it, each by the directory it was met in (its device and inode) and its name, so that two names of one inode (hard links) are two: a symbolic link (files.symlinks); an entry named.jsonlthat is not a regular file (a FIFO, a socket), not counted again in the warning line when a no-.jsonlwarning named it; a directory met again; a name that is not valid UTF-8, reported and counted as failed once. A folder holding two FIFOs, given twice, made "4 entries"; a directory met again, with its folder given twice, "2 directories"; and a name that is not UTF-8 was reported twice and counted as 2 failed; two names of one symbolic link were 1 link.ltms searchandltms index:--maxand--skiptake a whole number from 0 to 9007199254740991 (2^53 - 1), as--help, the README and the usage message now say, the ruleltms shapes --floortakes; a larger one is a usage error (exit 2) that names the value. They took any run of digits, and applied and printed the nearest number a double holds:--skip 9007199254740993printed--skip 9007199254740992 passes over all, and--skip 99999999999999999999999,--skip 1e+23.- The address prefix, every command's (
records'source.idand ids too), is a file name's first 8 characters counted in code points (for an agent's transcript,agent-and the 8 code points after it), computed by one function, which the library now exports asaddressPrefix(name)(docs/library.md) for theprefixofsearchTranscriptandindexTranscript. It was the first 8 UTF-16 code units, so a character outside the Basic Multilingual Plane at the 8th place was cut in two: the ids of a file namedabcdefgand an emoji,.jsonl, held a lone\ud83d, and jq refusedltms records' output (exit 5, at its header); at the 1st or the 7th place, the prefix held 7 characters. A name whose first 8 code points are all in the Basic Multilingual Plane, as a session id is, keeps its prefix byte for byte. - Tests: 771 → 807 (801 passing, 0 failing, 6 skipped: 0.3.0's six).
Known limits
Each was run on this release's code with a synthetic input (S377).
- skeleton and stats print an internal error met while reading their arguments, or after the files while checking for shared address prefixes, as Node prints it, with its message and stack, and no line calls it a bug in ltms (exit 1).
- skeleton's
ekdrops the hook's name (a plainhook-block) for a bracket longer than 300 UTF-16 code units, not 300 characters: a bracket of 161 characters, 140 of them emoji, is over it. - search and index read a transcript twice when two paths given reach it through a bind mount (a folder and a bind mount of it inside itself, both given): they tell files apart by their real path, which a bind mount does not change; their warning still says the directory met again was not read again, and shapes reads the transcript once.
- Two hard links of one transcript under a directory are read twice by search and index and once by shapes;
ltms indexcounts the two names once insessionParts, insetAsideand in a session'sagents, where its other counts of the walk count names, so itsfoundis not search's on the same folder. - search and index count as one link a symbolic link named by the single byte FF (not UTF-8) and a link beside it named
ff, that byte written in hex; shapes, and 0.3.0, count two. A regression of this release, in a warning's count. - search and index print the warning that a folder holds no
.jsonlfile once for each time the folder is given, each naming the entries named.jsonlthere that are not regular files (shapes prints one). - The window command that
ltms search --helpand the README give counts its 600 characters in UTF-16 code units, as a hit'satis counted, so a window can start or end inside a character outside the Basic Multilingual Plane (an emoji), which then prints as U+FFFD. - shapes reports an internal error met while it walks a directory given, and
--checkone met while it reads the report, ascannot read '<path>' (<kind> at <place>), without calling it a bug in ltms or saying where to report it. - shapes words its count of the symbolic links met under the directories given apart from search and index, and not as a warning (
1 symbolic link met under the directories given was not followed.). - A vocabulary given with
--vocabularymay list a value holding:at the kind path or at a sub-kind's path, which--allowrefuses: records with that value print as the kind and sub-kind it spells, so two kinds of record share one line. ltms shapes --checkholds a path line'snagainst itsfiles, and no other count the buckets decide: within a line, a version or kind line whoserecordsis in a lower bucket than itsfiles(or than one of itsversions), or a rare line whosenis in a lower bucket than itspaths; across lines, a kind line in more files than the first line'sfiles.read, or a path line in more files than its kind's line. Such a report passes; ltms never writes one.ltms shapes --checkprints one line for each entry of a report's allowed list that--allowrefuses, with no cap (1,000 such entries gave 1,001 lines), where it shows at most 20 problems of any other kind.- records escapes a path's control characters on stderr but not its backslashes, so a path holding a backslash and
nprints as one holding a newline, and U+2028 or U+2029 prints as it is; the commands its messages give (cat '<path>' > transcript.jsonlfor a FIFO) name the escaped text, not the file. ltms records --helpsays memory holds a piece of 1 MiB, the line that crosses it and the uuids, and gives no factor for a long line, which costs several times its length while it is read (measured: a line of 32 MiB, about 287 MiB at the peak; with one Hebrew letter in it, about 383 MiB).- skeleton, stats, search, index, shapes and pin print a path given that holds a newline as given in the message that it cannot be read (it does not exist, it is a symbolic link loop), so that message splits across lines; records escapes it.
- shapes' closing line with
--vocabularyprints the vocabulary's path as it was given, so a path holding a newline splits that line (the--checkcommand after it is quoted, and runs as printed). ltms --helpsays an internal error is reported by its kind and where in ltms it happened, not that its line also says where to report it (the README's What it reads does); it gives the label rule's length as at most 64, as the message for an--allowvalue that breaks the rule does, where the rule is 1 to 64 (an empty label prints(withheld), and--allow .type=is refused); and it names package.json among the filesskillreads, whererecordsreads it too, for its version (the README's What it reads says so).ltms shapes --helpandltms records --helpcall a report refused at the write and a count that does not balance a bug in ltms without saying where to report it (the messages themselves say).- records gives a
utcto a stamp with a lowercasetbetween its date and its time, which thetimerow does not name, and none to one whose fraction is written with a comma, which ISO 8601 allows. - In the library's
dist/records.d.ts,time.as_writtenis described as the stamp as written andgroupas the requestId or message id; each is(withheld)when it fails the label rule, asltms recordsprints it. - 0.3.0's Known limits stand but its last eleven: nine are repaired here (shapes' closing line with
--vocabulary; a name that is not UTF-8 beside its twin, a directory met twice, a FIFO counted once for each argument; where to report a bug, but for the two cases above; the address prefix in code points;--maxand--skipbounded; records' folder loop; records' parentUuid on a record without a uuid, and its stderr path; records into a pipe whose reader keeps up;leafandlogical_parent); akinds.subentry for a kind the vocabulary does not list is still taken, as decided, and a run where it cannot apply now warns; and the order of a count map's keys is unchanged, and now stated in the README.
Files
long-term-memory-structure/long-term-memory-structure-v0.3.1.zip
Additional details
Related works
- Is supplement to
- Software: https://github.com/long-term-memory-structure/long-term-memory-structure/tree/v0.3.1 (URL)