fix(kg): skip is_pet_of triple when owner is absent in seed_from_entity_facts#797
Closed
arnoldwender wants to merge 10 commits intoMemPalace:developfrom
Closed
fix(kg): skip is_pet_of triple when owner is absent in seed_from_entity_facts#797arnoldwender wants to merge 10 commits intoMemPalace:developfrom
arnoldwender wants to merge 10 commits intoMemPalace:developfrom
Conversation
…mPalace#666) Replace "your memory system" with explicit MemPalace references and tool names (mempalace_diary_write, mempalace_add_drawer, mempalace_kg_add) in stop and precompact hook block reasons. This prevents Claude Code from misinterpreting the hook as a native auto-memory save instruction. Updated in both Python (hooks_cli.py) and standalone shell scripts. Also fix CONTRIBUTING.md Getting Started to show the fork-first workflow, matching the PR Guidelines section.
The current constraint `chromadb>=0.5.0,<0.7` forces pip to install chromadb 0.6.x, but palaces created with chromadb 1.x (which is what the mempalace dev environment actually uses — 1.5.7 per uv.lock) have an incompatible SQLite schema. Specifically, chromadb 0.6.x fails with `KeyError: '_type'` when opening a collection written by 1.x. This means a fresh `pip install mempalace` gives users a chromadb version that cannot read palaces created in the maintainer's own environment. The fix removes the upper bound so pip can resolve to the current stable chromadb release. Reproduction: python3 -m venv .venv && source .venv/bin/activate pip install mempalace # installs chromadb 0.6.3 # Try opening a palace created with chromadb 1.x: # -> _get_collection() returns None, tool_status() returns "No palace found" pip install chromadb==1.5.7 # force upgrade # -> tool_status() returns real data (26k drawers in our case)
…constraint fix: remove chromadb <0.7 upper bound — blocks 1.x installs
PR MemPalace#761 bumped pyproject.toml to 3.2.0 but missed three other version strings, causing test_version_consistency to fail on develop CI (macos, linux 3.11, windows). - mempalace/version.py: 3.1.0 → 3.2.0 (unblocks test_version_consistency) - README.md: version badge shield 3.1.0 → 3.2.0 - integrations/openclaw/SKILL.md: 3.1.0 → 3.2.0 - CHANGELOG.md: rename [Unreleased] → [3.2.0] — 2026-04-13, add entries for MemPalace#685, MemPalace#690, MemPalace#707, MemPalace#716, MemPalace#734, MemPalace#755, MemPalace#757, MemPalace#761 Verified locally: 689/689 tests pass, ruff clean.
* fix: disambiguate hook block reasons to name MemPalace explicitly (MemPalace#666) Replace "your memory system" with explicit MemPalace references and tool names (mempalace_diary_write, mempalace_add_drawer, mempalace_kg_add) in stop and precompact hook block reasons. This prevents Claude Code from misinterpreting the hook as a native auto-memory save instruction. Updated in both Python (hooks_cli.py) and standalone shell scripts. Also fix CONTRIBUTING.md Getting Started to show the fork-first workflow, matching the PR Guidelines section. * fix: remove chromadb <0.7 upper bound — blocks 1.x installs The current constraint `chromadb>=0.5.0,<0.7` forces pip to install chromadb 0.6.x, but palaces created with chromadb 1.x (which is what the mempalace dev environment actually uses — 1.5.7 per uv.lock) have an incompatible SQLite schema. Specifically, chromadb 0.6.x fails with `KeyError: '_type'` when opening a collection written by 1.x. This means a fresh `pip install mempalace` gives users a chromadb version that cannot read palaces created in the maintainer's own environment. The fix removes the upper bound so pip can resolve to the current stable chromadb release. Reproduction: python3 -m venv .venv && source .venv/bin/activate pip install mempalace # installs chromadb 0.6.3 # Try opening a palace created with chromadb 1.x: # -> _get_collection() returns None, tool_status() returns "No palace found" pip install chromadb==1.5.7 # force upgrade # -> tool_status() returns real data (26k drawers in our case) --------- Co-authored-by: z3tz3r0 <kittipan.wang@gmail.com> Co-authored-by: AlyciaBHZ <50111876+AlyciaBHZ@users.noreply.github.com> Co-authored-by: Ben Sigman <1872138+bensig@users.noreply.github.com>
…preserving history) # Conflicts: # CONTRIBUTING.md
…e-3.2.0 sync: merge main into release/3.2.0 (preserve history)
release: v3.2.0
Contributor
Author
…ty_facts
When a dog entity has no 'owner' key, facts.get('owner', name) returned the
pet's own name, creating a reflexive triple (e.g. Rex → is_pet_of → Rex).
Fix: guard the add_triple call with an explicit owner presence check.
Also adds the missing test case for the ownerless-dog path.
b686114 to
49a06dc
Compare
Contributor
Author
|
Rebased on latest main — the version consistency tests were failing because main had already bumped to 3.2.0 (PR #762) after this branch was created. No logical changes to the KG fix itself. |
Contributor
Author
|
Confirmed the fix is already merged in develop. Closing — thanks! |
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.
What and Why
When seeding the knowledge graph from entity facts, dog entities with no
ownerkey created a reflexive triple — the pet pointing to itself as its own owner. This produced semantically invalid data silently.Root Cause
knowledge_graph.py:396—facts.get("owner", name)falls back tonamewhen the"owner"key is absent, soadd_triple("Rex", "is_pet_of", "Rex")was called instead of being skipped.Reproduction
Change Summary
mempalace/knowledge_graph.py:396— guardadd_triplewith an explicit owner presence check; skipis_pet_ofwhen owner is absenttests/test_knowledge_graph_extra.py— addtest_seed_dog_without_ownercovering the missing edge caseTest Plan
test_version_consistency.py— version.py/pyproject.toml sync issue tracked in develop branch: version.py (3.1.0) out of sync with pyproject.toml (3.2.0) #771)test_seed_dog_without_ownerverifies no reflexive triple is created and entity is still registeredtest_seed_dog(with owner) still passes