Skip to content

[Bug] remember drops a negated correction as DUPLICATE because tokenization removes not #133

Description

@ivkiwi

Describe the bug

remember drops a negated correction as a duplicate of the opposite statement. After storing Production deployment is allowed, storing Production deployment is not allowed returns action: "skipped" and diff_suggestion: "DUPLICATE". Subsequent recall still returns only the affirmative statement.

These are synthetic statements, not an actual deployment request. Both writes use maximum importance (--imp 5), and the store contains only these test inputs.

To reproduce

With mnemon 0.2.8 on PATH:

export MNEMON_DATA_DIR="$(mktemp -d)"
export MNEMON_STORE=negation-repro
export MNEMON_EMBED_ENDPOINT=http://127.0.0.1:1

mnemon remember 'Production deployment is allowed' --cat decision --imp 5
mnemon remember 'Production deployment is not allowed' --cat decision --imp 5
mnemon recall 'Production deployment'

Actual behavior

The first write returns action: "added". Relevant fields from the second write:

{
  "action": "skipped",
  "content": "Production deployment is not allowed",
  "diff_suggestion": "DUPLICATE"
}

Recall returns one result, with content: "Production deployment is allowed". Every command exits successfully. The correction was never inserted.

Expected behavior

An affirmative statement and its negation must not be treated as the same fact. Preserve the correction and expose the contradiction for deliberate resolution. Keeping both, as the existing CONFLICT path does, would be safer than silently skipping the new statement.

An exact repetition should still deduplicate; a regression test should distinguish exact repetition from a change in polarity.

Environment

  • mnemon 0.2.8, official darwin_arm64 release; archive SHA-256 verified against the release checksums.
  • macOS 26.6.2, Apple Silicon.
  • Fresh synthetic store, direct CLI calls, no LLM host integration or embeddings.
  • The relevant source files also match master at 9c8e760e0143f5d66b5d57609a60e1c4e620da96.

Additional context

Likely cause

This is a remaining false-duplicate case after the related work in #23, #25, and #84. It is different from the earlier false-CONFLICT problem on unrelated scientific text. Simply adding a broad not conflict trigger back would risk reintroducing that issue; the duplicate check needs to preserve meaning-bearing differences.

Workaround

Repeating the two writes in another fresh store with --no-diff retains both statements, and recall returns both. This avoids this particular loss, but leaves contradiction resolution to the caller and disables automatic deduplication.

Validation scope: direct CLI reproduction only; no code changes or full test-suite run.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions