src / constants.ts
/**
* @file constants.ts
* Single source of truth for every tunable parameter.
*/
export const DB_FILENAME = "memory.db";
export const MAX_MEMORIES_TOTAL = 10_000;
export const MAX_MEMORY_CONTENT_LENGTH = 4_000;
export const MAX_TAGS_PER_MEMORY = 10;
export const MAX_TAG_LENGTH = 50;
export const MAX_CATEGORY_LENGTH = 30;
export const DEFAULT_CONTEXT_MEMORIES = 5;
export const MAX_CONTEXT_MEMORIES = 15;
export const DEFAULT_SEARCH_RESULTS = 8;
export const MAX_SEARCH_RESULTS = 25;
export const MIN_RELEVANCE_THRESHOLD = 0.05;
export const MIN_QUERY_LENGTH = 2;
export const MAX_INJECTED_CONTEXT_CHARS = 3_000;
export const MEMORY_SEPARATOR = "\n\u2022 ";
export const MIN_TERM_LENGTH = 2;
export const MAX_VOCAB_SIZE = 50_000;
export const MAX_TERMS_PER_DOC = 200;
export const DECAY_HALF_LIFE_DAYS = 45;
export const DECAY_WEIGHT = 0.2;
export const FREQUENCY_WEIGHT = 0.1;
export const SIMILARITY_WEIGHT = 0.55;
export const CONFIDENCE_WEIGHT = 0.15;
export const AI_EXTRACT_MAX_TOKENS = 800;
export const AI_EXTRACT_TEMPERATURE = 0.1;
export const AI_CALL_TIMEOUT_MS = 12_000;
export const AI_RELEVANCE_MAX_TOKENS = 200;
export const AI_RELEVANCE_TEMPERATURE = 0.05;
export const AI_CONFLICT_MAX_TOKENS = 400;
export const AI_CONFLICT_TEMPERATURE = 0.1;
export const VALID_SCOPES = ["global", "project", "session"] as const;
export type MemoryScope = (typeof VALID_SCOPES)[number];
export const MAX_PROJECT_NAME_LENGTH = 60;
export const MAX_SESSION_MEMORIES = 200;
export const VALID_CATEGORIES = [
"fact",
"preference",
"project",
"note",
"instruction",
"relationship",
"context",
] as const;
export type MemoryCategory = (typeof VALID_CATEGORIES)[number];
/** Stop words excluded from TF-IDF indexing. */
export const STOP_WORDS = new Set([
"the","a","an","is","in","of","and","or","for","to",
"how","what","why","when","does","with","from","its",
"that","this","are","was","were","be","been","being",
"have","has","had","do","did","will","would","could",
"should","may","might","shall","can","it","he","she",
"they","we","you","i","me","my","your","our","his",
"her","their","not","no","but","if","so","at","by",
"on","up","out","about","into","over","after","before",
"between","again","then","here","there","all","each",
"every","both","few","more","most","other","some",
"such","than","too","very","just","also","now",
]);