Repository navigation
memory.import writes distilled facts from another memory system through every memory.bulk_set check - #161
Merged
Conversation
zlareb1
force-pushed
the
pufit/memory-import
branch
4 times, most recently
from
November 1, 2026 19:12
59709c5 to
411982b
Compare
memory.assign_category resolves the name and writes the link through server/memory/store/categories.py, which resolves any number of names in one read, so a batch writer can link through the same statements. Its answers are unchanged; the analyzer corpus records the batched lookup. Signed-off-by: pufit <[email protected]>
Keys are `import:` and 24 hex characters of the text's SHA-256, and rows are source_class=imported, so a re-run writes nothing new; each entry reports written, reinforced, skipped or refused. dry_run stops the bulk write after its verdicts. The Python client spells the keyword verb with a trailing underscore (agent.client.memory.import_). Signed-off-by: pufit <[email protected]>
…lict check 200 is memory.bulk_set's default conflict-check cap, so the response drops its unchecked count, and 201 or more entries are refused with 422. The docs say a re-run still reinforces each stored row once. Signed-off-by: pufit <[email protected]>
…cap setting says The import passes its own conflict-check cap to handle_memory_bulk_set, so a lowered LOOM_BULK_CONFLICT_CHECK_MAX_ENTRIES no longer writes entries unchecked; memory.bulk_set keeps the setting. Signed-off-by: pufit <[email protected]>
handle_memory_bulk_set takes reinforce_own_key, which only memory.import turns off: a restatement of a row under the entry's own key records no evidence event, while a merge or the same text under another key still reinforces that row. Signed-off-by: pufit <[email protected]>
Before the write it reads each key's newest version in every session of the identity, tombstones and superseded rows included, and answers skipped/deleted or skipped/superseded. Outcomes come from models_bulk.REFUSED and an explicit unchanged case; any other bulk result raises, and a repeat of a refused entry is refused too. Signed-off-by: pufit <[email protected]>
…te beside memory.bulk_set Its rate-limit class is sized like knowledge.add (10 burst, 2/s) and its p99 budget is an import's, 30 s as for memory.import_curated. A user-pinned token may call it, as memory.bulk_set, and links no category (category_refused); the sharing summary and the mentor count it as a write. Signed-off-by: pufit <[email protected]>
…very outcome The docs and the dry_run field name the embeddings it pays for, the blacklist hit it counts and the conflicted preview. A unit test runs one request reaching every outcome dry and for real; the integration test drives agent.client.memory.import_ through the SDK. Signed-off-by: pufit <[email protected]>
… a batch after writing A key whose newest readable version is rejected or proposed answers skipped/rejected or skipped/proposed, as deleted and superseded ones do; unchanged is what the bulk skip gate reports (unchanged_into) or identity dedup finding the key in another session, so a concurrent import landing between the read and the write is unchanged. Any other result after the write is logged and answered skipped/unknown instead of raising. Signed-off-by: pufit <[email protected]>
…ts read covers A re-import after memory.delete, memory.clear or a tombstoning expiry answers skipped/deleted; memory.restore within 14 days or an erasure with purge=true brings the keys back. The read of each key's newest version covers the sessions the token may read. Signed-off-by: pufit <[email protected]>
….import's cap handle_memory_bulk_set sets the import's conflict_check_cap in a request-scoped context variable that _bulk_conflict_verdicts reads, as detect_updates_override does, instead of a new keyword: the check is called as before, and so is every replacement of it. Signed-off-by: pufit <[email protected]>
It imports the pinned memory's exact text, which identity dedup matches by content hash before any embedding is compared: the entry reinforces the pinned row and nothing lands under its import key. A merely close text depends on the embedder's similarity. Signed-off-by: pufit <[email protected]>
A key of exactly the shape memory.import derives (import: and 24 lowercase hex characters, is_digest_key) gets no (#key) suffix from build_excerpt and no key-axis text, on the import and on any later memory.set or memory.bulk_set of the key, so the digest never reads as words and the two vectors stay comparable. Any other key keeps its suffix. loom reembed sends no empty key text to the embedder and writes such a row at key dim 0, as the write paths leave it. Signed-off-by: pufit <[email protected]>
… and tests every skip against ClickHouse - The conflict cap travels on the bulk write's state instead of a context variable. - The heads read groups by key alone and returns only what the import reads. - `reason` is a Literal on the wire; KeyState, a dead fallback and a dead slice are gone. - The value bound names its real reason, and the docs say only the first 1,200 characters of an item are embedded and indexed. - Integration cases for rejected and proposed keys, a user-bounded token's category and every stored field of an imported row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… entry why its category is not linked - A re-run reads the links of its keys and adds only pairs never stored, so a link the owner rescinded stays rescinded and an unchanged re-run writes no link or audit row. - `note` is a Literal and names category_not_linked and category_rescinded too. - The bulk write loses `unchanged_into`: a version-0 result no check refused, no merge took and no other key holds is the key's own unchanged answer. - The digest-key helpers live in `memory/domain/digest_keys.py`, which the excerpt and key-axis code import; the recall-importer comparison is gone. - The docs name the window between the heads read and the write, and the written reason is the conflict verdict's status. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… on any run - A live key holding other text than the item's is skipped as `revised`: the heads read returns the head's content hash, so a re-run no longer overwrites an owner's revision. - The bulk write's `reinforce=False` (was `reinforce_own_key`) records no evidence event for a restatement, merge or identity duplicate, so re-runs never raise reinforcement; the outcome is `held`. - Entries repeating a text must be identical, or the request is a 422 naming both. - The link-states read is sequentially consistent, since it decides a write. - The docs state the text-key trade-off: an item edited in the source arrives as a new fact. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… bulk dedup scope - A live head holding the item's text is `unchanged` before the bulk write, so a re-run from another session writes nothing even with LOOM_MEMORY_BULK_DEDUP_SCOPE=session, and the stored labels stay as written. - The category links are read before the write; only the new links' insert follows it. - Reasons and notes are spelled as their Literal values only. - Shorter comments, category_refused names session-bounded tokens, `unknown` is listed on the reason field, and the rate-limit test checks only the import's own class. - `mint_test_token` takes `read_user_id`, which the user-bounded integration case uses. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ves its link read - `skipped` is a key left as it is; the skip-reasons and retry comments say what happens. - The link-states read uses the shared `_SEQUENTIAL` clause and is in the analyzer corpus. - The docs name text deleted under another key as imported again. - The 422 integration case checks the refused field and its type. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… its conflict cap is its batch - `digest_keys.is_digest_key` is `import_keys.is_import_key`; the wire models are `_MemoryImportEntry`, `_MemoryImportResult` and `_MemoryImportTotals`. - The import passes the number of entries it writes as the conflict-check cap. - The docs say a re-run is unchanged in every session the token may read, name the rescind race, and warn that a key confirms a guessed text. - Integration cases: a re-run from another session, and a dry run that leaves no memory, embedding, link or audit row. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…e pass - A unit case scripts a `conflict` verdict and checks the entry answers written/conflicted with the peer mark asked for its new row. - `_categorize` decides each entry's note and new link in one loop. - The docs say pinned and locked refusals come only from a pin or lock landing between the import's read and write; the rate-limit comments read ~120/min; the repeat 422 says "different fields"; two tests that restated constants are gone. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…hat holds a held one - A `refines` verdict (newest_wins) answers written/refines, and the docs say an imported item can retire a live memory it updates there. - A held identity duplicate names its keeper in `held_by`. - The refusal for being too close to a pinned memory is `pinned_peer`, distinct from the written `conflicted`. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… a racing pin meets - A head stored with status `tombstoned` is `deleted`; `unknown` is left for a status a newer schema adds. - A unit case pins and locks the keys between the import's read and its write and expects refused/pinned and refused/locked; `link_states` has a test of its own. - The op's docstring opens with one full line, which both SDKs publish. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…y run drops an unreachable guard - `bulk_conflict_check_max_entries` says memory.import checks every entry; the settings reference, schema and example are regenerated. - The dry run no longer special-cases entity resolution: the import's entries carry no entities, so resolution writes nothing. - The dry-run docs name `refines` beside `conflicted` as previewed before the peers settle. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t the earlier entry - Under newest_wins, a templated pair inside one batch whose earlier row carries the later `valid_at` is no longer retired by the later row, as the store path's `later_valid_peers` already decides. An import exported newest-first keeps its newest facts. - memory.import: `content_shas` names the stored content hash apart from the key's digest; one warning per call lists the keys with an unknown head status; the category loop reads a stored link once; field descriptions are one sentence each. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ve and aware times compared as UTC - The pair is swapped, not dropped, when its earlier row carries the later `valid_at`, so the older-dated row is superseded in either order. - `valid_at` values are compared as naive UTC, so a batch mixing naive and aware times no longer turns the in-batch pass off. - A bulk-write test covers newer-first, older-first with mixed time zones, and undated pairs; the import test now expects the older fact retired in both orders. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ur checks lose a dead clause - `where_sql` takes the table and builds the key-only import-key predicate from its `key_text` and `key_dim`, as `in_database_sql` does. - The provider rebuild tests `is_import_key` alone; `skip_reasons` reads the named sensitivity once; the bulk state groups the two caller options under one comment. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
- `where_sql` takes `table` as a required keyword, so a key-only call without one is a TypeError, not a KeyError on ''. - The NARROW_SAFE_OPS reason for memory.import parses; the bulk state's two options have one comment line each; the request-size docstring counts a full memory.import. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…space.inventory Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ed keys - Each imported item lands once under its own `import:` key with no key vector, so counting it lowered the reuse share and a large import could switch the key axis off for every hand-written key of the namespace. The probe now skips keys of the import shape; a unit test pins the clause, and the architecture page says so. - The request-size docstring gives the largest memory.import as about 10 MB of ASCII. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
… a named tuple - `valid_at` is converted to naive UTC when the request is parsed, so two repeats of one time in different zone spellings are the same entry, and the sort and the bulk input no longer convert it again. - `IMPORT_KEY_MATCH`, the anchored pattern, is the one spelling the re-embed SQL and the key-axis probe use. - `_Answer` is a NamedTuple with `held_by` defaulting to ''. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ort docs split the key bullet - `in_database_settings` sets short_circuit_function_evaluation=force_enable, so an import key's row, whose `if` takes the empty branch, never calls the provider. - The import section splits the key, re-run and edited-item points into three bullets, says the newest version across sessions decides, and shortens the skipped cell. - Two comments read as meant. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t key - `--key-only` skips an import key without a key vector and clears one an older build embedded; the re-embed bullet says so. - The `IMPORT_KEY_MATCH` comment gives the real reason for the anchors. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…t imported under their stub A module first imported during an import test (namespace_ontology, on the newest_wins path) bound the stub client with `from server.core.ch import get_client`, so a later test in the process, the analyzer corpus among them, wrote into that test's fake store. The harness now restores those modules on teardown, as the corpus does. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…ch a coded column accepts `INSERT … SELECT` skips the insert path's padding, and a coded (Quantized) vector column refuses an empty array, so the import-key branch wrote `[]` into a column that rejects it. It now writes the zero vector of the target width at key dim 0, as every write path stores "no key vector"; the architecture page names `sensitivity_kept` beside the other live outcomes. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…code span stays on one line Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
force-pushed
the
pufit/memory-import
branch
from
November 1, 2026 20:11
5323781 to
df4cc90
Compare
…its statuses come from one place - The dry-run field comment and docs say no memory, link or audit row is written and the vectors it pays for land in `loom.embedding_cache`, instead of "writes nothing". - `_LEFT_AS_IS` keys superseded and proposed by the shared status constants. - The in-database re-embed builds the import-key predicate in the two branches that use it, with no fallback; a test pins the whole-namespace heads read. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
The output `dry_run` field, the bulk docstring and the architecture page now match the input field and the feature docs: no memory, link or audit row is written; the vectors it embeds land in `loom.embedding_cache`, and a blacklist hit is counted. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
- `holds_item` reads a module-level `_HOLDS_ITEM` set. - The in-database re-embed asks one local helper for the import-key predicate. - The request-size docstring says printable ASCII. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…s and the content hash The analyzer drives the heads read with the identity that goes with each scope. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…nd two comments read true - The unknown-status warning moves from `_write` to the handler, right after `skip_reasons`, so `_write` only partitions and writes. - `skip_reasons` reads the named sensitivity only in the branch that uses it. - The key-axis probe comment gives the real reason import keys are left out. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
…eads cleanly Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 1, 2026
…his PR's callers use The blacklist check takes the write's captured policy generations and the conflict mark names its namespace in this PR; the fakes #161 added accept both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…his PR's callers use The blacklist check takes the write's captured policy generations and the conflict mark names its namespace in this PR; the fakes #161 added accept both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…import reads the authority Under Postgres, a by-id tombstone whose publication is pending mirrors its search rows' status and hands its changes to the caller on the pending error, so the blacklist sweep, dedup_resolve and conflicts.resolve announce them and finish what they owe before answering it. memory.import decides what to skip from the authority's heads. memory.search_trace waits at the search barrier; a tier whose check fails leaves its rows out. The decision-record statement has a corpus case under both authorities and an integration test under Postgres. Test fakes take the bulk options #161 added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…his PR's callers use The blacklist check takes the write's captured policy generations and the conflict mark names its namespace in this PR; the fakes #161 added accept both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…import reads the authority Under Postgres, a by-id tombstone whose publication is pending mirrors its search rows' status and hands its changes to the caller on the pending error, so the blacklist sweep, dedup_resolve and conflicts.resolve announce them and finish what they owe before answering it. memory.import decides what to skip from the authority's heads. memory.search_trace waits at the search barrier; a tier whose check fails leaves its rows out. The decision-record statement has a corpus case under both authorities and an integration test under Postgres. Test fakes take the bulk options #161 added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…his PR's callers use The blacklist check takes the write's captured policy generations and the conflict mark names its namespace in this PR; the fakes #161 added accept both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…import reads the authority Under Postgres, a by-id tombstone whose publication is pending mirrors its search rows' status and hands its changes to the caller on the pending error, so the blacklist sweep, dedup_resolve and conflicts.resolve announce them and finish what they owe before answering it. memory.import decides what to skip from the authority's heads. memory.search_trace waits at the search barrier; a tier whose check fails leaves its rows out. The decision-record statement has a corpus case under both authorities and an integration test under Postgres. Test fakes take the bulk options #161 added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…his PR's callers use The blacklist check takes the write's captured policy generations and the conflict mark names its namespace in this PR; the fakes #161 added accept both. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
zlareb1
added a commit
that referenced
this pull request
Nov 2, 2026
…import reads the authority Under Postgres, a by-id tombstone whose publication is pending mirrors its search rows' status and hands its changes to the caller on the pending error, so the blacklist sweep, dedup_resolve and conflicts.resolve announce them and finish what they owe before answering it. memory.import decides what to skip from the authority's heads. memory.search_trace waits at the search barrier; a tier whose check fails leaves its rows out. The decision-record statement has a corpus case under both authorities and an integration test under Postgres. Test fakes take the bulk options #161 added. Co-Authored-By: Claude Opus 5.5 <[email protected]> Signed-off-by: zlareb1 <[email protected]>
This was referenced Nov 2, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changelog category (leave one):
Changelog entry (one or two sentences a user of Loom can read without the diff; the release pull request collects these into the release notes):
A new operation,
memory.import(MCP toolloom_memory_import), imports memory items that another memory system already distilled into a namespace, up to 200 per call. Each key is derived from the item's text, so a re-run writes nothing new and reinforces nothing, and every item goes through the same dedupe, conflict, blacklist, pinned and lock checks asmemory.bulk_set; items the owner deleted, superseded, rejected, corrected or left as proposals stay as they are. In a namespace onnewest_winsan imported item can retire a live memory it updates, as any write there does, and its entry says so (refines). The import never runs the extraction path's value-update linker (detect_updates=False).Why
An agent that moves to Loom from another host arrives with a memory store of its own: a few thousand distilled items plus manual notes. Over the wire the paths are
memory.setone fact at a time (slow),memory.set_from_messages(re-runs the extraction over text that is already distilled) andmemory.bulk_set(hidden from MCP on purpose, with no idempotency across re-runs). Theloom import-recall,loom import-brainandloom import-clickgapCLI importers each read one source format from the operator's machine.import-recallwrites onememory.setper item underrecall_<table>_<source_id>keys, a content digest only when the table has no id column; it stays as it is, since moving it ontoimport:keys would land every earlier import's items a second time. The import needs an idempotent bulk write that keeps every check of the bulk path and that an MCP client can call by name (loom_memory_import; it is listed on no toolset) during the agent's first start.Scope and risk
server/memory/api/{models_import,ops_import}.py,server/memory/app/memory_import.py,server/memory/domain/{memory_import,import_keys}.py,server/memory/store/categories.py(category lookups, link states and links in one store module, used bymemory.assign_categoryand the import —assign_categoryanswers exactly as before), one new readkey_heads_across_sessionsinserver/memory/store/reads.py.handle_memory_bulk_setgains three keyword options with defaults that keep its behaviour:dry_run(returns after the verdicts, writing no memory, link or audit row; its vectors still reach the embedding cache and a blacklist hit is counted),conflict_check_cap(the import passes its batch size so every entry is checked whateverbulk_conflict_check_max_entriessays) andreinforce(the import turns it off: no restatement, merge or identity duplicate records anevidenceevent, so a re-run never raises a memory's reinforcement; a merge or identity duplicate answersheld).ns_writethrough the shared gates; the op is admitted for user-pinned tokens (NARROW_SAFE_OPS) and then links no category (memory.assign_categoryis refused to such tokens; the entry notescategory_refused). Not in_MCP_HIDDEN_OPS, on no roster; reachable throughloom_op.source_trace≤ 512,category≤ 256; own rate-limit class (10 burst, 2/s, likeknowledge.add); latency budget 30,000 ms likeimport_curated.notesays why its category is not linked.bulk_set's hash-only row, plus onememory.importrow with keys and category names when new links are added; no item text inloom.audit_log.loom.embedding_cache) and counts a blacklist hit, as the docs say.unchanged(orsensitivity_keptwhen the entry names another sensitivity), so a re-run from another session writes nothing under eithermemory_bulk_dedup_scopeand the stored labels stay; one holding other text (an owner's correction, a pin) isrevised; entries repeating a text must be identical, or the request is a 422.source_tracewas not taken because it may be a path several items share. Text that was deleted, retired or rejected under a different key is still imported under itsimport:key, because the bulk write's dedup sees live rows only; and the heads read and the write are not atomic, so a delete landing between them is written over, and likewise a category rescind between the link read and the insert. A key is a digest of the text, so a guessable text can be confirmed from its key; the docs say not to import a secret as an item.valid_at, an undated one counting as now, then request order), so undernewest_winsthe newest statement of an attribute survives whatever order the source exported. The bulk write's own in-batch rule is unchanged. Identity dedup binds the live statuses as a parameter (LIVE_STATUSES), shared with the import.import:digest shape is embedded and lexically indexed by its value alone on every write path and inloom reembed(no(#key)suffix and no key-axis vector;server/memory/domain/excerpt.py,embed_text.py,server/memory/app/reembed.py, including--in-database). A key vector a build before this one wrote on such a key is cleared byloom reembed --key-only, and a provider migration rebuilds it from the key instead of failing (provider_rebuild_batch.py).agent.client.memory.import_(TypeScriptloom.memory.import); the wire name and the TypeScript SDK are unchanged.Compatibility, rollout and rollback
memory.import; no existing op or field changed; defaults unchanged.import:key with its(#key)suffix and a key-axis vector on its next write or re-embed of that key.Tests
make format,make lint(every codegen--check, reach census, secrets) andmake typecheckpass.tests/unit/test_memory_import.pyandtest_memory_categories.py) cover: key derivation and idempotency; re-runs adding no rows and no events; the cap governing the conflict check atbulk_conflict_check_max_entries0, 50 and 200 (entry 150 refused as too close to a pinned memory); deleted, superseded, rejected, proposed and unknown-status heads; the race of a second import landing between the heads read and the bulk lookup;dry_runreaching every outcome and writing no memory, link or audit row; bounds (201 entries → 422);category_unregistered/category_refused/category_not_linked; a rescinded link left rescinded and no link or audit row on an unchanged re-run; the import's oldest-first order undernewest_wins(dated, undated and mixed batches, naive and aware times, each result keeping its own entry's key); theassign_categoryrefactor;memory.bulk_setunchanged by default.make test-unit(24,403 unit and 199 bench tests) andtests/analyzer(12) pass locally. Not exercised here:loom reembed --in-databaseagainst a ClickHouse 26.7 server with anaiEmbedcollection (its SQL is unit-tested as text and its import-key expression was run on ClickHouse with a constant in place ofaiEmbed).tests/integration/test_memory_import.py(17 cases, through the SDKAgentand raw HTTP/MCP) passes at the head against a private ClickHouse and server (withtest_memory_bulk.py, 25 cases) and runs in CI; it covers the deleted, rejected, proposed and revised skips against the real read, a rescinded category link and a user-bounded token'scategory_refused.AI assistance in the code (leave one; writing this description with AI is fine):
AI-generated (an agent wrote most of the diff): Claude Code. Checked: an independent reviewing agent read every commit with probe tests against the real handler path; the inheritance of every
bulk_setcheck, the authorization path, the SQL of the new read (ReplacingMergeTree semantics, read-scope filter), the generator change and the generated files were verified; the full unit suite and the integration file ran against a private stack at each head.I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
make format-check,make lint,make typecheckandmake test-unitpass; the integration suite passes if server behaviour changed. (The integration file andtest_memory_bulk.pypass locally against a private stack; the full integration suite runs in CI.)docs/reference/configuration.mdand thedocs/reference/tables (python scripts/codegen/docs_reference.py), the reach manifest,schemas/schema.sql(make schema-dump) and the Codex plugin copies (python3 scripts/codegen/agent_plugin_sync.py).main; no merged migration is edited. (No migration.)hooks/,lib/,bin/,skills/,.mcp.json, the Codexplugin-defaults.json) bumps both plugin manifests' version, and no other open PR uses that version. (No plugin file changed.)npm --prefix frontend run build) and its tests pass, iffrontend/changed. (Unchanged.)docs/describe the system as it now is, and this description names any operator steps and wire changes.CI
CI runs on every push; the integration file and the targeted unit suites pass locally against a private ClickHouse at the head.
🤖 Generated with Claude Code