fix(chat): store knowledge as fact triples, not free text (+ add pyoxigraph) - #178
Draft
sofiiako wants to merge 1 commit into
Draft
fix(chat): store knowledge as fact triples, not free text (+ add pyoxigraph)#178sofiiako wants to merge 1 commit into
sofiiako wants to merge 1 commit into
Conversation
The chat sidecar's sinain_memory_store sent {"content": text} to
/knowledge/import, but that endpoint requires entity/attribute/value triples
({"facts":[...]}) — the same shape the MCP server already uses. Every save was
rejected with "No 'facts' array found". Change the tool to accept a structured
facts list (StoreFact) and POST {"facts": [...]}.
Also add pyoxigraph to sinain-memory/requirements.txt: triplestore.py ->
rdf_store.py imports it unconditionally, so /knowledge/import fails to persist
without it.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
Asking the resident chat agent to remember something always failed with a format
error — the agent surfaced something like:
Two bugs on the knowledge-write path:
Wrong payload shape.
sinain_memory_storeinsinain-chat-agent/tools.pytakes a free-text
textand POSTs{"content": text}to/knowledge/import.But that endpoint requires entity/attribute/value triples —
{"facts":[...]}—the same shape the MCP server's
sinain_memory_storealready sends. So the corerejected every save with
No 'facts' array found. ... Got keys: content.Missing dependency. Even with the right shape, persistence fails: the core
shells out to
python3 -c "... from triplestore import TripleStore ...", andtriplestore.py→rdf_store.pydoesimport pyoxigraphunconditionally.pyoxigraphisn't insinain-memory/requirements.txt, so/knowledge/importerrors with
ModuleNotFoundError: No module named 'pyoxigraph'.Fix
sinain-chat-agent/tools.py—sinain_memory_storenow accepts a structuredfactslist (newStoreFactmodel:entity/attribute/value+ optionalconfidence/domain, matching the MCP tool), drops empty/None fields, skips factsmissing a required key, and POSTs
{"facts": [...]}. Tool description updated todescribe the triple shape.
sinain-hud-plugin/sinain-memory/requirements.txt— addpyoxigraph>=0.4