change
Some checks failed
CI / test (push) Has been cancelled

This commit is contained in:
2026-07-03 16:26:54 +01:00
parent 873c9a5f51
commit 8cff315496
84 changed files with 3063 additions and 603 deletions

124
packages/domain/src/memory.ts Executable file
View File

@@ -0,0 +1,124 @@
export const MEMORY_CATEGORIES = {
identity: "Identity & background",
long_term_goals: "Long-term goals",
current_goals: "Current goals",
likes: "Likes",
dislikes: "Dislikes",
motivators: "Motivators",
discouragers: "Things that discourage",
daily_routines: "Daily routines",
weekly_routines: "Weekly routines",
spiritual_practices: "Spiritual practices",
reading_preferences: "Reading preferences",
learning_interests: "Learning interests",
exercise_preferences: "Exercise preferences",
work_study: "Work/study commitments",
worries: "Worries & concerns",
ai_tone: "Preferred AI tone",
boundaries: "Boundaries & avoid",
personal_context: "Important personal context",
life_season: "Current life season",
open_questions: "Open questions about user",
} as const;
export type MemoryCategory = keyof typeof MEMORY_CATEGORIES;
export const MEMORY_SOURCE_TYPES = [
"manual",
"chat",
"reflection",
"adventure",
"reading",
"quest",
"teacher",
"cartographer",
"weekly_review",
"correction",
"import",
"summary_rebuild",
] as const;
export type MemorySourceType = (typeof MEMORY_SOURCE_TYPES)[number];
export const MEMORY_SENSITIVITY_LEVELS = ["normal", "private", "sensitive"] as const;
export type MemorySensitivity = (typeof MEMORY_SENSITIVITY_LEVELS)[number];
export const SENSITIVE_MEMORY_CATEGORIES: MemoryCategory[] = [
"personal_context",
"boundaries",
];
export const MEMORY_SUGGESTION_STATUSES = [
"pending",
"accepted",
"rejected",
"ignored",
] as const;
export type MemorySuggestionStatus = (typeof MEMORY_SUGGESTION_STATUSES)[number];
export const DAY_MODES = {
normal: "Normal day",
low_energy: "Low energy",
travel: "Travel",
illness: "Illness",
family: "Family event",
exam: "Exam day",
work_emergency: "Work emergency",
rest: "Rest day",
maintenance: "Maintenance day",
} as const;
export type DayMode = keyof typeof DAY_MODES;
export const FORGIVING_DAY_MODES: DayMode[] = [
"low_energy",
"travel",
"illness",
"family",
"exam",
"work_emergency",
"rest",
"maintenance",
];
export interface MemorySourceRef {
type: string;
id?: string;
date?: string;
}
export interface AiProfileSummary {
summary: string;
generatedAt: string;
sourceMemoryCount: number;
version: number;
}
export interface AiMemoryLearningSettings {
learningEnabled: boolean;
autoSuggestEnabled: boolean;
requireApproval: boolean;
allowedCategories: MemoryCategory[];
suggestAfterReflection: boolean;
suggestAfterChat: boolean;
maxPendingSuggestions: number;
minDaysBetweenNudges: number;
allowSensitiveCategories: boolean;
}
export const DEFAULT_AI_MEMORY_LEARNING: AiMemoryLearningSettings = {
learningEnabled: false,
autoSuggestEnabled: true,
requireApproval: true,
allowedCategories: (Object.keys(MEMORY_CATEGORIES) as MemoryCategory[]).filter(
(c) => !SENSITIVE_MEMORY_CATEGORIES.includes(c)
),
suggestAfterReflection: true,
suggestAfterChat: true,
maxPendingSuggestions: 10,
minDaysBetweenNudges: 3,
allowSensitiveCategories: false,
};
export const DEFAULT_DAY_BOUNDARY_HOUR = 0;