-
Notifications
You must be signed in to change notification settings - Fork 7
feat(6pm): entity upgrades — per-person search, brain_get_person, entity-tagged store #33
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e4341eb
2fe796f
a5eb7c8
8285cff
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -42,6 +42,7 @@ def store_memory( | |
| outcome: Optional[str] = None, | ||
| reversibility: Optional[str] = None, | ||
| files_changed: Optional[List[str]] = None, | ||
| entity_id: Optional[str] = None, | ||
| ) -> Dict[str, Any]: | ||
| """Persistently store a memory into BrainLayer. | ||
|
|
||
|
|
@@ -57,6 +58,8 @@ def store_memory( | |
| outcome: Optional decision outcome (pending/validated/reversed). | ||
| reversibility: Optional reversibility (easy/hard/destructive). | ||
| files_changed: Optional list of affected file paths. | ||
| entity_id: Optional entity ID to link this memory to via kg_entity_chunks. | ||
| Used for per-person memory tagging. | ||
|
|
||
| Returns: | ||
| Dict with 'id' (chunk ID) and 'related' (list of similar existing memories). | ||
|
|
@@ -136,6 +139,19 @@ def store_memory( | |
| # (The trigger handles this for INSERT INTO chunks, but since we bypass | ||
| # the normal upsert_chunks flow, verify it's there) | ||
|
|
||
| # Link to entity if entity_id provided (per-person memory tagging) | ||
| if entity_id: | ||
| # Validate entity exists to avoid dangling kg_entity_chunks rows | ||
| entity = store.get_entity(entity_id) | ||
| if entity is None: | ||
| raise ValueError(f"Unknown entity_id: {entity_id}") | ||
| store.link_entity_chunk( | ||
| entity_id=entity_id, | ||
| chunk_id=chunk_id, | ||
| relevance=1.0, | ||
| context=f"Stored via brain_store: {memory_type}", | ||
| ) | ||
|
coderabbitai[bot] marked this conversation as resolved.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Entity validation after chunk commit creates orphaned dataMedium Severity The entity_id validation ( Moving the entity existence check before the chunk insert would fix the atomicity issue. |
||
|
|
||
| return { | ||
| "id": chunk_id, | ||
| "related": related, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.