From 6b96a687dbd842f7164530baa0362ce6aab600bf Mon Sep 17 00:00:00 2001 From: Alexander Morales-Panitz Date: Tue, 28 Apr 2026 00:54:00 -0500 Subject: [PATCH] feat(extraction): preserve first-person negations in extraction prompt MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit BEAM CR diagnostic showed extraction was silently dropping user negative-tense statements like 'I have never used Flask-Login'. Without these, contradiction resolution is structurally unscoreable — only the positive side reaches storage. Validated with retrieval inspector: target negative statement now extracted verbatim and ranks #1 (sim=0.665) for the matching CR query. --- src/services/extraction.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/extraction.ts b/src/services/extraction.ts index 3ce6730..418fa29 100644 --- a/src/services/extraction.ts +++ b/src/services/extraction.ts @@ -212,6 +212,11 @@ RULES: - **CORRECTION/REVISION PRESERVATION**: When the conversation contains an explicit correction, revision, or supersession of a previous statement (e.g. "Correction:", "Actually,", "Changed my mind"), the extracted fact MUST preserve the corrective relationship. Include phrasing like "instead of Y", "replacing Y", "corrected from Y", or "no longer Y" so the system can detect the supersession. WRONG: "User wants PostgreSQL for the production backend." RIGHT: "User wants PostgreSQL for the production backend, replacing the earlier MongoDB choice." +- **NEGATIVE STATEMENT PRESERVATION**: When the user makes a negative-tense factual assertion in FIRST PERSON about themselves (e.g. "I have never used X", "I haven't tried Y", "I did not configure Z", "I never integrated W"), the extracted fact MUST preserve the negation explicitly. Do NOT normalize to a positive statement, do NOT drop the fact as non-actionable, and do NOT confuse it with assistant tutorial text containing "haven't" (e.g. "if you haven't already installed..."). Negative facts establish what the user has NOT done and are critical for contradiction detection across long conversations. + WRONG: "User is using Flask-Login for authentication." (when user said "I have never integrated Flask-Login") + WRONG: dropping the fact entirely. + RIGHT: "User has never integrated Flask-Login for session management in the project." + RIGHT: "User has never written Flask routes or handled HTTP requests in this project." - Skip pleasantries, filler, acknowledgments, and meta-conversation. - Skip generic assistant chatter (acknowledgments, "sure!", "got it", "as an AI"). - DO extract specific factual content from assistant responses: named entities, recommendations with proper nouns, schedules, data tables, creative writing with specific details. Prefix these with "Assistant mentioned:" or "Assistant recommended:".