Chronos DB 0.3.2
Agents can check their reads between steps, and a vetoed effect's record is safer to keep
Agents can check their reads between steps, and a vetoed effect's record is safer to keep. Most of this came from the 0.2.0 release threads on r/AI_Agents: CHECK READS (Abhishekxdg/chronosdb#35) and the keyed hash for discarded effects (Abhishekxdg/chronosdb#36). Also trigram indexes and per-metric pgvector graphs.
Upgrading from 0.3.1: SHOW OUTBOX DISCARDED's payload_sha256 column is now payload_hmac (keyed), and it has a new column, recipient_domains. Effects discarded before the upgrade show no payload_hmac.
- A vetoed effect's hash is keyed, and its record says where it was going.
SHOW OUTBOX DISCARDEDkept a plain SHA-256 of each discarded payload, so a short, guessable one ("refund approved") could be confirmed by hashing candidates. Itspayload_sha256column is nowpayload_hmac: an HMAC-SHA256 under a key the database makes for itself (outbox.keyin the folder, sealed when the folder is encrypted, never shown in SQL). A newrecipient_domainscolumn lists the domains of the email addresses in the payload (example.com,x.org), so a vetoed email to an outside domain shows without keeping its addresses. Records made before this have nopayload_hmac. Raised on r/AI_Agents: Abhishekxdg/chronosdb#36. - Stopping
chronos serveorchronos mcpno longer forgets what worlds read. Both close the database and then exit the process, and what dropping the database keeps for the next open (worlds' read sets, the reads recorded forDIFF ... READERS, agents' hourly merge counts) was kept only by the drop, which an exit skips. After every clean stop, a world that checks its reads was held as after a crash (relies on reads made before the database restarted), androws_per_hour/deletes_per_hourstarted again from zero. Closing the database now keeps them. CHECK READS: has anything I read changed?CHECK READS [OF WORLD w]lists what a world that checks its reads (check_reads) read that changed since it forked (rows, key ranges and filtered scans, an empty result included), and changes nothing: no rebase, the world's view stays as it was. Meant for an agent between steps of a long task: re-read and decide again before writing, instead of finding out at its merge. In a folder attached to Postgres it checks a world of main's reads against Postgres as it is now too. Also the MCP toolcheck_readsand the HTTP opcheck_reads. See stale reads. (Asked for on r/AI_Agents: Abhishekxdg/chronosdb#35.)- Trigram indexes (pg_trgm).
USING gin (name gin_trgm_ops)andUSING gist (name gist_trgm_ops), on a column or an expression, were accepted and kept as btrees, so%andLIKE '%...%'read every row. They are now indexes of each text's trigrams:name % 'jon'reads only the rows with enough of the constant's trigrams to reach the similarity threshold, andLIKE(andILIKE, for an ASCII pattern) only the rows with every trigram of the pattern's literal runs, each row checked again. Kept up by writes, branches and merges like any index;pg_indexesand dumps show the operator class, andchronos importkeeps it instead of reporting it dropped. On 200,000 two-word names (examples/trigram_index.rs),LIKE '%...%'went from 10.8 ms to 1.0 ms and%from 70 ms to 25 ms;%gains less on that data's small alphabet, where every trigram is in thousands of rows. Issue #33. - pgvector indexes keep their operator class, and cosine and L2 get a graph of their own.
USING hnsw (e vector_cosine_ops)(orvector_ip_ops) is kept and shown bypg_get_indexdefandpg_indexesas Postgres shows it, sopg_dumpcarries it; an unknown class is 42704, as in Postgres. The search index ranks every vector column by inner product, the cosine and L2 order only for vectors of unit length; for vectors that aren't, a cosine or L2 index now gets a graph of its own (over unit-length copies for cosine, by Euclidean distance for L2), soORDER BY e <=> q LIMIT kwalks a graph instead of comparing every row: on 200,000 vectors of 384 dimensions and mixed lengths, cosine went from 15.6 ms to 0.57 ms (97.7% recall@10) and L2 from 15.1 ms to 1.24 ms (98.5%) (examples/metric_graphs.rs).chronos importno longer reports pgvector's operator classes as dropped. Issue #32.
The macOS builds need macOS 13 or later, as for 0.2.0.