Skip to content

Count CONTRADICTS edges without a resolved flag as unresolved - #52

Open
stevepridemore wants to merge 1 commit into
mainfrom
fix/contradictions-missing-resolved
Open

stevepridemore wants to merge 1 commit into
mainfrom
fix/contradictions-missing-resolved

Conversation

@stevepridemore

Copy link
Copy Markdown
Owner

Before: graph_contradictions, graph_stats and graph_build_context only counted CONTRADICTS edges with resolved = false. An edge written without the resolved property never showed, so the live graph reported 0 unresolved contradictions while 2 existed (both without resolved, detected_date or description).

After: a missing resolved counts as unresolved, every new CONTRADICTS edge gets resolved: false and a detected_date, and the nightly dream is told to always send those fields along with a description.

How:

  • findContradictions and getStats filter on coalesce(r.resolved, false) = false. A missing detected_date falls back to ingested_at for display and sort order. Sorting uses toString() so ISO strings and datetimes order together.
  • createRelationship and batchRelate run CONTRADICTS_DEFAULTS after the MERGE. It uses coalesce, so asserting a resolved contradiction again doesn't reopen it.
  • prompts/dream-nightly.md gets a new 4g-1 section on flagging contradictions. The unresolved-contradictions queries in docs/GRAPH_SCHEMA_REFERENCE.md and skills/graph-ask/SKILL.md are fixed too; the skill's query also read r.properties.x, which isn't valid on a Neo4j relationship.
  • scripts/backfill-contradicts-resolved.cypher is a one-time backfill for existing edges, with a read-only preview first. It needs a write session (cypher-shell or Browser), since graph_cypher is read-only.
  • 4 new tests in neo4j-client.test.ts cover: a legacy edge with no flag, defaults on a single write, defaults on a batch write, and no reopen on re-assertion.

Testing: tsc --noEmit is clean. The Neo4j-backed suite didn't run where this was written, because Docker wasn't available there. It needs npm run test:local or CI.


Generated by Claude Code

graph_contradictions, graph_stats and graph_build_context matched only
resolved = false, so edges written without the flag never showed. Treat a
missing flag as unresolved, fill resolved=false and detected_date on every
CONTRADICTS write (single and batch, without reopening resolved ones), tell
the nightly dream to set description/detected_date/resolved, and add a
one-time backfill script.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

2 participants