Skip to content

feat: add scope and shared_with columns for multi-scope memory (PR 1/3)#42

Open
kenyonxu wants to merge 1 commit into
qualixar:mainfrom
kenyonxu:pr/scope-schema-migration
Open

feat: add scope and shared_with columns for multi-scope memory (PR 1/3)#42
kenyonxu wants to merge 1 commit into
qualixar:mainfrom
kenyonxu:pr/scope-schema-migration

Conversation

@kenyonxu

Copy link
Copy Markdown

Summary

PR 1/3 of the multi-scope memory feature (RFC #20).

Adds scope and shared_with columns to 5 core tables for multi-scope memory support (personal / shared / global). Pure schema change — no retrieval or interface modifications.

Changes

File Change
storage/schema.py Add scope TEXT NOT NULL DEFAULT 'personal' and shared_with TEXT to 5 tables + 10 composite indexes
storage/models.py Add scope / shared_with fields to 5 dataclasses (MemoryRecord, AtomicFact, CanonicalEntity, GraphEdge, TemporalEvent)
storage/migrations/M016_add_scope_support.py Deferred migration for existing databases
storage/migration_runner.py Register M016

Design

  • Backward compatible: all existing data retains scope='personal'
  • Follows upstream pattern: deferred migration like M006/M011/M013
  • Tables: memories, atomic_facts, canonical_entities, graph_edges, temporal_events

Dependencies

  • PR 2/3 (retrieval layer) builds on this
  • PR 3/3 (external interface) builds on PR 2/3

Test Results

  • 755 passed on Ubuntu (all 3 Python versions)
  • 75 passed on macOS (all 3 Python versions)
  • The 1 failure per platform (test_cache_exact_replay_all_byte_identical on Ubuntu, test_vscode_user_dir_darwin on macOS) are pre-existing upstream issues — reproducible on the upstream main branch CI.

Ref: #20

…a only)

Add scope (TEXT, default 'personal') and shared_with (TEXT, nullable)
columns to 5 core tables, plus composite indexes on (scope) and
(profile_id, scope):

  - memories
  - atomic_facts
  - canonical_entities
  - temporal_events
  - graph_edges

Models updated with scope/shared_with fields. Migration M016 handles
ALTER TABLE for existing databases — all existing data defaults to
'personal' for full backward compatibility.

This is PR 1/3 of the multi-scope memory feature — pure storage layer.
No retrieval logic or interface changes included.

Ref: qualixar#20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant