diff --git a/memory_system.py b/memory_system.py index f2e24eb..059d213 100644 --- a/memory_system.py +++ b/memory_system.py @@ -343,170 +343,165 @@ class SkipDetector: """Semantic-based content classifier using zero-shot classification with category descriptions.""" TECHNICAL_CATEGORY_DESCRIPTIONS = [ - "complete programming code with function definitions class declarations variable assignments import statements or code syntax", - "error messages with stack traces exception types file paths line numbers or error codes without personal context", - "system logs with timestamps severity levels and status indicators like ERROR INFO WARN DEBUG", - "shell terminal commands starting with dollar signs or containing commands like sudo git npm docker apt-get pip curl", - "structured data in JSON XML YAML CSV format with nested objects arrays brackets or key-value pairs", - "technical documentation describing APIs configurations file formats system specifications or protocols", - "formatted tables lists or outputs with multiple rows columns headers or consistent structured entries", - "debugging output diagnostic information performance metrics system status or build reports", - "impersonal technical question asking how technology works explaining programming concepts algorithms data structures protocols without my job my project or my career", - "abstract question about technical comparisons differences theoretical computer science concepts without I am learning or personal development context", - "description of programming algorithm implementation with complexity analysis like O notation time complexity space complexity or algorithmic approach without personal project", - "general technical explanation about software architecture design patterns microservices authentication systems backend implementation without my work my job context", - "discussion of API endpoints HTTP methods request response formats REST GraphQL WebSocket protocols without I am building or personal application", - "explanation of code functionality behavior logic flow with technical terms but without I am struggling I have trouble or career anxiety context", - "Windows file paths with backslashes like C colon backslash Program Files or drive letters in technical context", - "deployment scripts configuration files with multiple technical components paths URLs commands without personal deployment story", - "error stack trace with file paths line numbers exception names like NullPointerException SegmentationFault RuntimeError without personal debugging story", - "system error messages with error codes status codes HTTP codes like 404 500 like Connection refused Timeout Exception without personal context", - "application logs with INFO WARN ERROR DEBUG levels timestamps log entries without my application my system", - "API query syntax like GraphQL query REST endpoint cURL command HTTP request without I am building my API", - "technical error output like compilation errors runtime exceptions segmentation faults core dumps without personal project context", - "code snippet with syntax highlighting language markers like python javascript java without personal implementation story", - "React JSX component code with angle brackets curly braces className props like const Component equals arrow function return JSX", - "HTTP error status codes like 404 Not Found 500 Internal Server Error 403 Forbidden with status messages", - "GraphQL query syntax with query mutation fragment type definitions like query curly brace field arguments", - "debug level logs with DEBUG prefix timestamp log level debug output without personal application debugging story", - "single command line with pipe operators like curl pipe jq grep pipe sed awk pipe without personal story context", - "stack trace with arrow notation like function1 arrow function2 arrow function3 showing call sequence without debugging my code", - "single line DEBUG log with request headers response details authorization content-type without my application my debugging", + "programming code with function definitions class declarations variable assignments import statements or syntax", + "error messages with stack traces exception types file paths line numbers or codes without personal context", + "system logs with timestamps severity levels status indicators like ERROR INFO WARN DEBUG", + "shell terminal commands with dollar signs or sudo git npm docker apt-get pip curl", + "structured data in JSON XML YAML CSV format with nested objects arrays brackets key-value pairs", + "technical documentation describing APIs configurations file formats system specifications protocols", + "formatted tables lists outputs with multiple rows columns headers structured entries", + "debugging output diagnostic information performance metrics system status build reports", + "impersonal technical question about how technology works programming concepts algorithms data structures protocols without my job project career", + "abstract question about technical comparisons theoretical computer science concepts without I am learning or personal development", + "programming algorithm implementation with complexity analysis O notation time space complexity algorithmic approach without personal project", + "technical explanation about software architecture design patterns microservices authentication systems backend without my work job", + "API endpoints HTTP methods request response formats REST GraphQL WebSocket protocols without I am building or personal application", + "code functionality behavior logic flow with technical terms without I am struggling I have trouble career anxiety", + "Windows file paths with backslashes C colon backslash Program Files drive letters", + "deployment scripts configuration files with multiple technical components paths URLs commands without personal story", + "error stack trace with file paths line numbers exception names NullPointerException SegmentationFault RuntimeError without personal debugging story", + "system error messages with codes status codes HTTP codes 404 500 Connection refused Timeout Exception without personal context", + "application logs with INFO WARN ERROR DEBUG levels timestamps entries without my application system", + "API query syntax GraphQL REST endpoint cURL command HTTP request without I am building my API", + "technical error output compilation errors runtime exceptions segmentation faults core dumps without personal project", + "code snippet with syntax highlighting language markers python javascript java without personal implementation story", + "React JSX component with angle brackets curly braces className props const Component equals arrow function return JSX", + "HTTP error status codes 404 Not Found 500 Internal Server Error 403 Forbidden with status messages", + "GraphQL query syntax with query mutation fragment type definitions curly brace field arguments", + "debug logs with DEBUG prefix timestamp log level output without personal application debugging story", + "command line with pipe operators curl pipe jq grep pipe sed awk without personal story", + "stack trace with arrow notation function1 arrow function2 arrow function3 call sequence without debugging my code", + "DEBUG log with request headers response details authorization content-type without my application debugging", ] META_CONVERSATION_CATEGORY_DESCRIPTIONS = [ - "acknowledgment response like thanks for the help got it I understand makes sense that is helpful appreciate it thank you", - "greeting salutation like hello hi hey how are you doing today nice to meet you good morning good evening have a nice day", - "polite filler courtesy phrase like please excuse me sorry to bother you hope you are well no worries all good", - "agreement confirmation acknowledgment like yes that is correct absolutely I agree with you exactly right you are correct indeed totally", - "farewell closing goodbye like goodbye see you later talk soon have a good day take care bye have a great day", - "casual greeting like hey what is up how is it going yo hello there hi friend good to see you", - "extended thanks appreciation like thank you so much really appreciate your help grateful for your assistance thanks again", - "clarification about previous messages like sorry for confusion let me clarify what I meant I should have been more specific I apologize for unclear question", - "feedback about conversation like that was helpful your explanation was clear I appreciate the detailed response your answer exceeded expectations", - "meta discussion about how asking questions like I will try to be more specific next time sorry for vague question I should provide more context", - "informal greeting like hey what is up yo hi there wassup hello friend good morning", - "simple agreement like absolutely exactly totally yes indeed that is right completely agree", + "acknowledgment response like thanks got it I understand makes sense helpful appreciate it", + "greeting like hello hi hey how are you today nice to meet you good morning evening have a nice day", + "polite courtesy phrase like please excuse me sorry to bother you hope you are well no worries all good", + "agreement confirmation like yes correct absolutely I agree exactly right indeed totally", + "farewell closing like goodbye see you later talk soon have a good day take care bye", + "casual greeting like hey what is up how is it going yo hello there hi friend", + "extended thanks like thank you so much appreciate your help grateful for assistance thanks again", + "clarification about previous messages like sorry for confusion let me clarify what I meant I should have been more specific apologize for unclear question", + "feedback about conversation like that was helpful your explanation was clear I appreciate the detailed response exceeded expectations", + "meta discussion about asking questions like I will try to be more specific next time sorry for vague question I should provide more context", + "simple agreement like absolutely exactly totally yes indeed right completely agree", "brief acknowledgment like got it understood makes sense I see okay cool sounds good", - "short greeting without context like hi hello hey good morning good evening how are you", - "casual hello hey hi wassup greeting phrases like hey there hi friend what is up hello good morning yo", - "informal greetings variations like good morning friend how is it going today hello there hey what are you up to", - "simple strong agreement phrases like absolutely agree totally agree exactly right yes indeed that is completely right", + "short greeting like hi hello hey good morning evening how are you", + "informal greeting variations like good morning friend how is it going today hello there what are you up to", + "simple strong agreement like absolutely agree totally agree exactly right yes indeed completely right", "brief positive acknowledgment like I hope so fingers crossed hopefully that works hope it helps", - "extended detailed thanks with multiple points like thank you for A B C really appreciate detailed help grateful for all the assistance", + "extended thanks with multiple points like thank you for A B C appreciate detailed help grateful for assistance", ] FACTUAL_QUERY_CATEGORY_DESCRIPTIONS = [ - "definition question asking what is something what does term mean explain concept define word without personal context or situation", - "factual information request about dates events history geography science facts trivia without personal relevance application or learning goal", - "general how-to question asking for instructions steps process recipe procedure without mentioning personal needs circumstances or projects", - "theoretical explanation request about why how things work in general abstract concepts principles without personal application or career context", - "comparison question asking differences between options technologies concepts products services without stating personal preference situation decision or job requirement", - "who what when where question about historical figures famous people events discoveries inventions without personal connection or story", - "multiple questions about same topic with numbered list several parts complex multi-part query with first second third or bullet points asking many questions", - "academic theoretical question with multiple sub-questions breaking down topic into components analyzing from different angles without personal project or work", - "scientific explanation request about natural phenomena physics chemistry biology astronomy without personal research study or career context", - "general knowledge query about capitals countries populations currencies geography facts without travel plans personal interest or job relevance", - "abstract technology comparison like difference between Python and Java without I am choosing or I work with context", - "theoretical programming question about best practices clean code principles without my project my codebase or work situation", - "what is definition question like what is photosynthesis what is blockchain what does term mean explain concept", + "definition question asking what is something what does term mean explain concept define word without personal context", + "factual information request about dates events history geography science facts trivia without personal relevance application learning goal", + "general how-to question asking for instructions steps process recipe procedure without personal needs circumstances projects", + "theoretical explanation request about why how things work in general abstract concepts principles without personal application career", + "comparison question asking differences between options technologies concepts products services without personal preference situation decision job requirement", + "who what when where question about historical figures famous people events discoveries inventions without personal connection story", + "multiple questions about same topic with numbered list several parts complex multi-part query with first second third bullet points", + "academic theoretical question with multiple sub-questions breaking down topic into components analyzing from different angles without personal project work", + "scientific explanation request about natural phenomena physics chemistry biology astronomy without personal research study career", + "general knowledge query about capitals countries populations currencies geography facts without travel plans personal interest job relevance", + "abstract technology comparison like difference between Python and Java without I am choosing or I work with", + "theoretical programming question about best practices clean code principles without my project codebase work situation", + "what is definition question like what is photosynthesis blockchain what does term mean explain concept", "when did historical question like when did event happen when was invention when did person live", - "how to general instruction like how to tie tie how to change tire how to wash clothes without personal need", - "explain how works question like explain how blockchain works explain neural networks explain quantum mechanics without personal learning goal", + "how to general instruction like how to tie tie change tire wash clothes without personal need", + "explain how works question like explain how blockchain works neural networks quantum mechanics without personal learning goal", "abstract comparison without personal choice like difference between capitalism socialism what is better Python or Java", - "when did short historical question like when did war end when was built when did person born when occurred", - "short when question about past events dates like when did happen when was invention when did discovery", + "short when question about past events dates like when did happen invention discovery", ] OUTPUT_FORMATTING_CATEGORY_DESCRIPTIONS = [ "instruction to format output as JSON YAML CSV table list markdown code block or specific data structure", "request to adjust response style length like make it shorter longer simpler more detailed use bullet points numbered list", - "command to rewrite rephrase translate summarize previous response output or answer differently", + "command to rewrite rephrase translate summarize previous response output or answer", "request to change tone presentation like be more formal casual technical professional explain like I am five years old", - "tone adjustment request like use professional tone more formal language business tone corporate style", - "professional tone instruction like write in professional manner use business language formal style", + "tone adjustment like use professional tone formal language business corporate style", ] PURE_MATH_CALCULATION_CATEGORY_DESCRIPTIONS = [ - "pure arithmetic calculation with explicit numbers like calculate 15 percent of 250 or solve 45 times 67 equals", + "arithmetic calculation with explicit numbers like calculate 15 percent of 250 or solve 45 times 67", "mathematical expression evaluation with operators like 2 plus 3 times 4 divided by 5 minus 6 or what is 123 times 456", - "unit conversion request with specific values like convert 100 kilometers to miles or 72 fahrenheit to celsius", - "percentage calculation with explicit numbers like what is 25 percent of 800 or calculate discount price of 120 minus 30 percent", - "simple algebra equation solving with explicit numbers like solve for x in equation 2x plus 5 equals 15", + "unit conversion with specific values like convert 100 kilometers to miles or 72 fahrenheit to celsius", + "percentage calculation with explicit numbers like what is 25 percent of 800 or discount price of 120 minus 30 percent", + "algebra equation solving with explicit numbers like solve for x in equation 2x plus 5 equals 15", "geometry calculation with specific measurements like area of circle radius 5 or volume of cube side 10", - "direct numerical computation request like square root of 144 or 15 plus 23 minus 8 times 2", + "numerical computation like square root of 144 or 15 plus 23 minus 8 times 2", ] EXPLICIT_TRANSLATION_CATEGORY_DESCRIPTIONS = [ - "explicit translation instruction with text to translate like translate this to Spanish colon Hello how are you in quotes or brackets", - "translation request with provided phrase like how do you say quoted phrase good morning in French with explicit text given", - "language conversion with text block like convert this English text to Japanese here is the text followed by actual content", - "direct phrase translation with quoted or bracketed text like translate I am hungry to Mandarin with explicit phrase provided", + "translation instruction with text to translate like translate this to Spanish colon Hello how are you in quotes or brackets", + "translation request with provided phrase like how do you say quoted phrase good morning in French with explicit text", + "language conversion with text block like convert this English text to Japanese here is the text followed by content", + "phrase translation with quoted or bracketed text like translate I am hungry to Mandarin with explicit phrase", "sentence translation with actual text like what is Spanish translation of quoted sentence or how to say specific phrase in Italian", - "text conversion request with source content like translate following paragraph to Portuguese colon followed by actual text content", + "text conversion with source content like translate following paragraph to Portuguese colon followed by actual text", "translation with colon separator like Translate to German colon followed by English sentence or text to convert", "how do you say question with specific word or phrase like how do you say computer in Russian or what is hello in French", - "translate to language instruction with target language specified like translate to Italian translate to Japanese translate to Portuguese", - "language translation request with explicit source text in quotes brackets or after colon separator indicating text to translate", - "translate to Italian Spanish Portuguese request explicitly asking for translation like how do you say in Italian translate this to Spanish", + "translate to language instruction with target language like translate to Italian Japanese Portuguese", + "language translation with explicit source text in quotes brackets or after colon separator", ] GRAMMAR_PROOFREADING_CATEGORY_DESCRIPTIONS = [ - "proofreading request with incorrect text provided like fix grammar in this text here is my draft check for typos in quoted text", - "grammar correction request with specific wrong text or sentence provided for review and correction like She don't like", - "spelling and punctuation check instruction with specific text content to review and fix errors in provided passage", - "copy editing request with text provided like proofread this paragraph correct errors in this sentence fix mistakes in text block", - "explicit error correction like check this text for mistakes or review this sentence for grammar problems with text included", - "correction request with misspelled or grammatically incorrect text like Their going too the store or Me and him went", - "typo fixing request with text containing errors like Teh quick brown fox or check spelling in this paragraph", + "proofreading request with incorrect text like fix grammar in this text here is my draft check for typos in quoted text", + "grammar correction with specific wrong text or sentence like She don't like", + "spelling punctuation check with specific text to review and fix errors in provided passage", + "copy editing with text like proofread this paragraph correct errors in sentence fix mistakes in text block", + "error correction like check this text for mistakes or review this sentence for grammar problems with text included", + "correction with misspelled or grammatically incorrect text like Their going too the store or Me and him went", + "typo fixing with text containing errors like Teh quick brown fox or check spelling in this paragraph", "sentence correction with wrong grammar like fix this I has three book or correct the punctuation in this text", "check grammar instruction with text to review like check grammar in this or correct grammar in following sentence", "proofreading with specific errors like multiple typos spelling mistakes punctuation errors in provided text passage", ] CREATIVE_FICTION_CATEGORY_DESCRIPTIONS = [ - "request to write fictional story tale narrative about imaginary characters events or fantasy scenarios with no personal autobiography", - "instruction to create fictional dialogue scene conversation between made-up characters in imaginary situation or fantasy setting not real people", - "request for creative writing like story poem song lyrics about generic fantasy themes dragons robots aliens without personal meaning", - "creative writing prompt for fiction like write short story about scenario with no personal connection memoir or autobiography", - "generate fictional content like fairy tale science fiction horror story with invented characters and imaginary events not real life", - "writing request for imaginary scenarios like wizard adventure space exploration fantasy world without personal narrative or memoir", - "creative story generation about made-up situations fictional characters fantasy settings not based on real personal experiences", - "write me a poem request about ocean nature universe or abstract themes without personal significance or emotional connection", + "write fictional story tale narrative about imaginary characters events or fantasy scenarios with no personal autobiography", + "create fictional dialogue scene conversation between made-up characters in imaginary situation or fantasy setting not real people", + "creative writing like story poem song lyrics about generic fantasy themes dragons robots aliens without personal meaning", + "creative writing prompt for fiction like write short story about scenario with no personal connection memoir autobiography", + "generate fictional content like fairy tale science fiction horror story with invented characters imaginary events not real life", + "writing for imaginary scenarios like wizard adventure space exploration fantasy world without personal narrative memoir", + "creative story about made-up situations fictional characters fantasy settings not based on real personal experiences", + "write me a poem about ocean nature universe or abstract themes without personal significance emotional connection", "fiction generation like write short story about dragon knight or create tale about robots aliens without personal context", - "literary creation request like compose poem generate lyrics craft narrative about imaginary topics dragons wizards fantasy", - "write dialogue conversation between characters request like write conversation between detective and suspect or dialogue in coffee shop scene", - "poetry composition request like compose haiku write sonnet create verse about abstract topic nature love without personal story", - "story scene description request like write opening scene describe battle sequence craft exposition about fictional world setting", - "compose poem with specific form structure requirements like write villanelle with strict rhyme scheme write sonnet with iambic pentameter following formal poetry rules", + "literary creation like compose poem generate lyrics craft narrative about imaginary topics dragons wizards fantasy", + "write dialogue conversation between characters like write conversation between detective and suspect or dialogue in coffee shop scene", + "poetry composition like compose haiku write sonnet create verse about abstract topic nature love without personal story", + "story scene description like write opening scene describe battle sequence craft exposition about fictional world setting", + "compose poem with specific form structure like write villanelle with strict rhyme scheme sonnet with iambic pentameter following formal poetry rules", "creative writing with detailed specifications like write science fiction story with exact word count specific setting particular tone detailed requirements without personal narrative", ] ENTERTAINMENT_ROLEPLAY_CATEGORY_DESCRIPTIONS = [ - "instruction to pretend act as roleplay fictional character like pirate wizard robot alien for entertainment fun or game", - "request to respond as if you are specific fictional persona celebrity historical figure or non-human entity like cat computer talking animal for fun", - "game simulation instruction like let us play game where you are character and I am character for entertainment not practice", + "pretend act as roleplay fictional character like pirate wizard robot alien for entertainment fun or game", + "respond as if you are specific fictional persona celebrity historical figure or non-human entity like cat computer talking animal for fun", + "game simulation like let us play game where you are character and I am character for entertainment not practice", "entertainment persona adoption like talk like Shakespeare speak as caveman respond as medieval knight fictional character for fun", - "roleplay request for fun entertainment like act as detective pirate space captain without job interview practice or real preparation", - "pretend play instruction like be a robot from future or talk as talking animal for entertainment not professional practice", + "roleplay for fun entertainment like act as detective pirate space captain without job interview practice or real preparation", + "pretend play like be a robot from future or talk as talking animal for entertainment not professional practice", "act as instruction like act as pirate pretend you are wizard act like dungeon master narrator for game scenario", - "respond as if request like respond as if you were Sherlock Holmes or talk as medieval knight for entertainment game", - "persona adoption request like be a Victorian gentleman talk as computer from 1980s speak as alien visiting Earth", - "roleplay character request like act as talking tree be a mystery game narrator play role of space captain", - "explicit act as character instruction like act as a robot act as detective act as wizard act as knight without write story about", - "pretend you are someone request like pretend you are pirate pretend you are from future pretend you are alien", - "respond as if you were instruction like respond as if you were Shakespeare respond as if you were computer respond as caveman", + "respond as if like respond as if you were Sherlock Holmes or talk as medieval knight for entertainment game", + "persona adoption like be a Victorian gentleman talk as computer from 1980s speak as alien visiting Earth", + "roleplay character like act as talking tree be a mystery game narrator play role of space captain", + "explicit act as character like act as a robot detective wizard knight without write story about", + "pretend you are someone like pretend you are pirate pretend you are from future pretend you are alien", + "respond as if you were like respond as if you were Shakespeare computer respond as caveman", "adopt persona entertainment like talk like Victorian person speak as robot speak like medieval knight for fun game", "game dungeon master narrator roleplay like be the dungeon master act as narrator in adventure game play storytelling game", "roleplay entity character like act as talking animal respond as tree pretend to be alien computer for entertainment", - "interactive character roleplay distinction like respond as knight talk as wizard be detective NOT write story about knight write tale about wizard create narrative about detective", + "interactive character roleplay like respond as knight talk as wizard be detective NOT write story about knight write tale about wizard create narrative about detective", "direct persona instruction like you are the dungeon master you are mystery narrator you will be space captain WITHOUT write about create story generate tale", "second person roleplay like you are wizard you are knight you are alien responding as character NOT third person write story about wizard story about knight", "conversational roleplay like respond as if robot talk as tree answer as alien NOT compose write create generate story about these characters", ] CONVERSATIONAL_CATEGORY_DESCRIPTIONS = [ - "statement about family members by name mentioning spouse children parents siblings or relatives with specific names or roles", + "statement about family members by name mentioning spouse children parents siblings relatives with specific names or roles", "expression of lasting personal feelings emotions core preferences values beliefs or dislikes about life situations", "description of established personal hobbies regular activities consistent interests or meaningful pursuits the person does", "significant career information about current job specific workplace company name professional role or work situation", @@ -521,8 +516,8 @@ class SkipDetector: "question about helping family member child spouse or relative with their interests education or personal needs", "statement about personal challenges struggles confusion with work tasks technology language learning or skill development in personal context", "expression of personal difficulty with writing grammar language skills at job workplace or in professional setting", - "personal language learning statement like I am learning Spanish for move or taking French lessons for job with personal motivation", - "statement about studying language for personal reason like learning Mandarin because my wife speaks it or studying German for university", + "personal language learning like I am learning Spanish for move or taking French lessons for job with personal motivation", + "studying language for personal reason like learning Mandarin because my wife speaks it or studying German for university", "personal tech struggle at work like I am having trouble with React at my job or confused about framework at my workplace", "career anxiety or stress about technology skills like struggling with imposter syndrome feeling overwhelmed at new technical job", "personal request for help with specific technology problem at job workplace or in personal project with named context",