handleMemoryCommand handles the /memory command. Usage: /memory — show today's notes /memory yesterday — show yesterday's notes /memory 2026-03-04 — show notes from a specific date /memory week — show last 7 days of notes /memory load — load a day's notes into
(ctx context.Context, input string)
| 31 | // /memory facts [cat] — list facts, optionally filtered by category |
| 32 | // /memory compact — force memory compaction |
| 33 | func (cli *ChatCLI) handleMemoryCommand(ctx context.Context, input string) { |
| 34 | if cli.memoryStore == nil { |
| 35 | fmt.Println(colorize(" "+i18n.T("memory.error.not_available"), ColorYellow)) |
| 36 | return |
| 37 | } |
| 38 | |
| 39 | args := strings.TrimSpace(strings.TrimPrefix(input, "/memory")) |
| 40 | |
| 41 | switch { |
| 42 | case args == "" || args == "today": |
| 43 | cli.showDayNotes(time.Now()) |
| 44 | |
| 45 | case args == "yesterday": |
| 46 | cli.showDayNotes(time.Now().AddDate(0, 0, -1)) |
| 47 | |
| 48 | case args == "week": |
| 49 | cli.showWeekNotes() |
| 50 | |
| 51 | case args == "longterm" || args == "long-term" || args == "lt": |
| 52 | cli.showLongTermMemory() |
| 53 | |
| 54 | case strings.HasPrefix(args, "load "): |
| 55 | dateStr := strings.TrimSpace(strings.TrimPrefix(args, "load ")) |
| 56 | cli.loadMemoryIntoContext(dateStr) |
| 57 | |
| 58 | case args == "list": |
| 59 | cli.listMemoryNotes() |
| 60 | |
| 61 | case strings.HasPrefix(args, "profile set "): |
| 62 | cli.setMemoryProfile(strings.TrimSpace(strings.TrimPrefix(args, "profile set "))) |
| 63 | |
| 64 | case args == "profile": |
| 65 | cli.showMemoryProfile() |
| 66 | |
| 67 | case strings.HasPrefix(args, "remember "): |
| 68 | cli.rememberMemoryFact(strings.TrimSpace(strings.TrimPrefix(args, "remember "))) |
| 69 | |
| 70 | case strings.HasPrefix(args, "forget "): |
| 71 | cli.forgetMemoryFact(strings.TrimSpace(strings.TrimPrefix(args, "forget "))) |
| 72 | |
| 73 | case args == "topics": |
| 74 | cli.showMemoryTopics() |
| 75 | |
| 76 | case args == "projects": |
| 77 | cli.showMemoryProjects() |
| 78 | |
| 79 | case args == "stats": |
| 80 | cli.showMemoryStats() |
| 81 | |
| 82 | case strings.HasPrefix(args, "facts"): |
| 83 | category := strings.TrimSpace(strings.TrimPrefix(args, "facts")) |
| 84 | cli.showMemoryFacts(category) |
| 85 | |
| 86 | case args == "compact": |
| 87 | cli.runMemoryCompact(ctx) |
| 88 | |
| 89 | default: |
| 90 | // Try to parse as a date |
no test coverage detected