feat: optional contradiction detection via Tardygrada - #254
Conversation
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
- Guard os.unlink against UnboundLocalError if temp file creation fails - Handle non-zero tardygrada exit codes instead of silently parsing empty output Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
PR Review: feat: optional contradiction detection via TardygradaExecutive Summary
Affected Areas: Business Impact: Enables AI assistants to receive contradiction-flagged search results, reducing hallucination risk from conflicting memories. Flow Changes: Ratings
PR Health
High Priority Issues🐛 #1: All 6 tests use non-existent
|
- Catch OSError (PermissionError etc.) from subprocess.run - Add explicit shell=False for defensive security - Always include both contradictions and verify_warning keys when verify=True for predictable response shape
|
Thanks for the thorough review! Re #1 (seeded_collection fixture): This is a false positive — Re #2, #3, #4 — all addressed in
Re #5 (regex coupling): Noted and accepted for now — both projects are under my control, so format changes can be coordinated. Happy to add version detection if needed. Full test suite still 107/107 passing. |
|
Closing — adding Tardygrada as a dependency for optional contradiction detection is more weight than we want right now. If this becomes a priority we'll revisit. |
Summary
verifyparameter tosearch_memories()and themempalace_searchMCP tooltardygrada verify-docto detect contradictions before the AI sees themverifydefaults tofalseReopens discussion from #75
How it works
.mdfiletardygrada verify-doc <tmpfile>(subprocess, 10s timeout)[CONFLICT]blocks from stdout into structured objectscontradictionslist to the search responseExample
Via MCP:
{"name": "mempalace_search", "arguments": {"query": "project status", "verify": true}}What this catches
What doesn't change
verify=False) — zero impact on existing usersfact_checker.pyuntouched (separate concern)Error handling
contradictions: null+ warning with install linkcontradictions: null+ warningcontradictions: null+ stderr excerptfinallyblockTest plan
🤖 Generated with Claude Code