Conversation
Add a user-driven L1 atomic memory import path that bypasses the
L0->L1 distillation pipeline, letting users bulk-write personal
memory records (from markdown/json/txt files or JSON arrays) directly
into the L1 atomic layer for model recall.
## MemoryCore kernel
- v2-router.ts: add handleAtomicCreate handler, register /atomic/create
route (dual-mounted on /v2 and /v3), batch create up to 500 records
per request with server-generated record_id (m_{timestamp}_{hex})
- Dedup on create: before writing, search existing L1 memories with a
3-tier fallback — vector search (searchL1Vector) -> FTS
(searchL1Fts) -> exact content match (queryL1Records, works in
standalone mode without embedding/FTS5). Modes: skip / update,
configurable threshold (default 0.85). Isolated by team+agent+user.
- generated/schemas.ts + types.ts: atomicCreateRequestSchema /
atomicCreateDataSchema and AtomicCreateRequest / AtomicCreateData
types (with dedup field and skipped/updated response counters)
- v2-schemas.ts: re-export the new schemas and types
## MemoryPanel
- chat-memory.ts: POST /chat-memory/import-memories route accepting a
JSON array or file text (.md/.json/.txt), parsed then forwarded to
/v3/atomic/create
- chat-memory-import-parser.ts (new): markdown/JSON/TXT parser, splits
by ## heading or paragraph
- web: standalone ImportMemories page as a left-menu item (parallel to
Chat Memory, not a tab inside it) — ImportMemoriesPanel supports
paste/upload, live parse preview, optional dedup, and lists existing
L1 memories after import
## SDK
- TypeScript: createMemories method + V3AtomicCreateRequest/Record/
Dedup/Data types
- Python: create_memories method (sync + async)
## Design decisions
- Isolation inherits the V3 router's team+agent+user triple check
- Soft classification via type + scene_name (aligned with existing L1
model); no URI namespace
- handleAtomicUpdate untouched (keeps update-only semantics; create
goes through the new endpoint)
## Tested
- skip mode: identical content -> created=0, skipped=1
- update mode: identical content -> created=1, updated=1, id reused
- distinct content -> created=1
- user isolation: other-user cannot query test-user's memories
- MemoryCore typecheck 0 errors; tsx boots on 8420
Signed-off-by: zhanglongzhan <lawliet.zhan@outlook.com>
Collaborator
|
Thank you so much for your attention and contribution! We will arrange an internal review for this PR shortly, and all feedback will be shared right here in the discussion. |
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.
Add a user-driven L1 atomic memory import path that bypasses the
L0->L1 distillation pipeline, letting users bulk-write personal
memory records (from markdown/json/txt files or JSON arrays) directly
into the L1 atomic layer for model recall.
MemoryCore kernel
route (dual-mounted on /v2 and /v3), batch create up to 500 records
per request with server-generated record_id (m_{timestamp}_{hex})
3-tier fallback — vector search (searchL1Vector) -> FTS
(searchL1Fts) -> exact content match (queryL1Records, works in
standalone mode without embedding/FTS5). Modes: skip / update,
configurable threshold (default 0.85). Isolated by team+agent+user.
atomicCreateDataSchema and AtomicCreateRequest / AtomicCreateData
types (with dedup field and skipped/updated response counters)
MemoryPanel
JSON array or file text (.md/.json/.txt), parsed then forwarded to
/v3/atomic/create
by ## heading or paragraph
Chat Memory, not a tab inside it) — ImportMemoriesPanel supports
paste/upload, live parse preview, optional dedup, and lists existing
L1 memories after import
SDK
Dedup/Data types
Design decisions
model); no URI namespace
goes through the new endpoint)
Tested