@@ -347,91 +347,19 @@ func TestMysisStateEvents(t *testing.T) {
347347 mysis.Stop()
348348 }
349349
350-func TestMysisContextMemoryLimit(t *testing.T) {
351- t.Skip("Obsolete: Tests old compaction strategy. Replaced by loop-based composition (TestLoopContextSlice).")
352- s, bus, cleanup := setupMysisTest(t)
353- defer cleanup()
354-
355- stored, _ := s.CreateMysis("context-test", "mock", "test-model", 0.7)
356- mock := provider.NewMock("mock", "response")
357- mysis := NewMysis(stored.ID, stored.Name, stored.CreatedAt, mock, s, bus)
358-
359- // Add system prompt
360- s.AddMemory(stored.ID, store.MemoryRoleSystem, store.MemorySourceSystem, "System prompt", "", "")
361-
362- // Add more memories than MaxContextMessages
363- for i := 0; i < constants.MaxContextMessages+10; i++ {
364- s.AddMemory(stored.ID, store.MemoryRoleUser, store.MemorySourceDirect, "user message", "", "")
365- s.AddMemory(stored.ID, store.MemoryRoleAssistant, store.MemorySourceLLM, "assistant response", "", "")
366- }
367-
368- // Get context memories
369- memories, err := mysis.getContextMemories()
370- if err != nil {
371- t.Fatalf("getContextMemories() error: %v", err)
372- }
373-
374- // Should have system prompt + MaxContextMessages recent messages
375- expectedCount := constants.MaxContextMessages + 1 // +1 for system prompt
376- if len(memories) != expectedCount {
377- t.Errorf("expected %d memories, got %d", expectedCount, len(memories))
378- }
379-
380- // First memory should be system prompt
381- if memories[0].Role != store.MemoryRoleSystem {
382- t.Errorf("expected first memory to be system prompt, got %s", memories[0].Role)
383- }
384- if memories[0].Content != "System prompt" {
385- t.Errorf("expected system prompt content, got %s", memories[0].Content)
386- }
387-}
388-
389-func TestMysisContextMemoryWithRecentSystemPrompt(t *testing.T) {
390- t.Skip("Obsolete: Tests old compaction strategy. Replaced by loop-based composition (TestContextPromptSourcePriority).")
391- s, bus, cleanup := setupMysisTest(t)
392- defer cleanup()
393-
394- stored, _ := s.CreateMysis("context-test-2", "mock", "test-model", 0.7)
395- mock := provider.NewMock("mock", "response")
396- mysis := NewMysis(stored.ID, stored.Name, stored.CreatedAt, mock, s, bus)
397-
398- // Add system prompt
399- s.AddMemory(stored.ID, store.MemoryRoleSystem, store.MemorySourceSystem, "System prompt", "", "")
400-
401- // Add fewer memories than MaxContextMessages
402- for i := 0; i < 5; i++ {
403- s.AddMemory(stored.ID, store.MemoryRoleUser, store.MemorySourceDirect, "user message", "", "")
404- s.AddMemory(stored.ID, store.MemoryRoleAssistant, store.MemorySourceLLM, "assistant response", "", "")
405- }
406-
407- // Get context memories
408- memories, err := mysis.getContextMemories()
409- if err != nil {
410- t.Fatalf("getContextMemories() error: %v", err)
411- }
412-
413- // Should have all memories (system + 10 messages)
414- expectedCount := 11 // 1 system + 5*2 messages
415- if len(memories) != expectedCount {
416- t.Errorf("expected %d memories, got %d", expectedCount, len(memories))
417- }
418-
419- // First memory should still be system prompt
420- if memories[0].Role != store.MemoryRoleSystem {
421- t.Errorf("expected first memory to be system prompt, got %s", memories[0].Role)
422- }
423-}
424-
425350 func TestSystemPromptContainsCaptainsLogExamples(t *testing.T) {
426- // Check for captain's log guidance in Critical Rules section
427- if !strings.Contains(constants.SystemPrompt, "Captain's log entry field must be non-empty") {
428- t.Fatal("SystemPrompt missing non-empty entry reminder")
351+ // SystemPrompt was simplified - check for core game flow guidance
352+ if !strings.Contains(constants.SystemPrompt, "zoea_claim_account") {
353+ t.Fatal("SystemPrompt missing zoea_claim_account")
429354 }
430- if !strings.Contains(constants.SystemPrompt, "max 20 entries") {
431- t.Fatal("SystemPrompt missing captain's log limit guidance")
355+ if !strings.Contains(constants.SystemPrompt, "login") {
356+ t.Fatal("SystemPrompt missing login guidance")
432357 }
433- if !strings.Contains(constants.SystemPrompt, "100KB each") {
434- t.Fatal("SystemPrompt missing captain's log size limit")
358+ if !strings.Contains(constants.SystemPrompt, "get_status") {
359+ t.Fatal("SystemPrompt missing get_status reminder")
360+ }
361+ if !strings.Contains(constants.SystemPrompt, "get_notifications") {
362+ t.Fatal("SystemPrompt missing get_notifications reminder")
435363 }
436364 }
437365
@@ -490,109 +418,13 @@ func TestFormatToolResult_Success(t *testing.T) {
490418 }
491419 }
492420
493-func TestMysisContextCompaction(t *testing.T) {
494- t.Skip("Obsolete: Tests old snapshot compaction. Loop composition doesn't use compaction.")
495- s, bus, cleanup := setupMysisTest(t)
496- defer cleanup()
497-
498- stored, _ := s.CreateMysis("compaction-test", "mock", "test-model", 0.7)
499- mock := provider.NewMock("mock", "response")
500- mysis := NewMysis(stored.ID, stored.Name, stored.CreatedAt, mock, s, bus)
501-
502- // Add system prompt
503- s.AddMemory(stored.ID, store.MemoryRoleSystem, store.MemorySourceSystem, "System prompt", "", "")
504-
505- // Add multiple get_ship tool results (should be compacted to keep only the latest)
506- for i := 0; i < 5; i++ {
507- s.AddMemory(stored.ID, store.MemoryRoleUser, store.MemorySourceDirect, "check ship", "", "")
508- s.AddMemory(stored.ID, store.MemoryRoleAssistant, store.MemorySourceLLM, constants.ToolCallStoragePrefix+"call_1:get_ship:{}", "", "")
509- s.AddMemory(stored.ID, store.MemoryRoleTool, store.MemorySourceTool,
510- fmt.Sprintf(`call_1:{"ship_id":"ship_%d","hull":100}`, i), "", "")
511- }
512-
513- // Add multiple get_system tool results (should also be compacted)
514- for i := 0; i < 3; i++ {
515- s.AddMemory(stored.ID, store.MemoryRoleUser, store.MemorySourceDirect, "check system", "", "")
516- s.AddMemory(stored.ID, store.MemoryRoleAssistant, store.MemorySourceLLM, constants.ToolCallStoragePrefix+"call_2:get_system:{}", "", "")
517- s.AddMemory(stored.ID, store.MemoryRoleTool, store.MemorySourceTool,
518- fmt.Sprintf(`call_2:{"system_id":"sys_%d","police_level":1}`, i), "", "")
519- }
520-
521- // Add a non-snapshot tool result (should be kept)
522- s.AddMemory(stored.ID, store.MemoryRoleUser, store.MemorySourceDirect, "mine ore", "", "")
523- s.AddMemory(stored.ID, store.MemoryRoleAssistant, store.MemorySourceLLM, constants.ToolCallStoragePrefix+"call_3:mine:{}", "", "")
524- s.AddMemory(stored.ID, store.MemoryRoleTool, store.MemorySourceTool, `call_3:{"result":"mining"}`, "", "")
525-
526- // Get context memories
527- memories, err := mysis.getContextMemories()
528- if err != nil {
529- t.Fatalf("getContextMemories() error: %v", err)
530- }
531-
532- // First memory should be system prompt
533- if memories[0].Role != store.MemoryRoleSystem {
534- t.Errorf("expected first memory to be system prompt, got %s", memories[0].Role)
535- }
536-
537- // Count get_ship tool results - should only have 1 (the latest)
538- shipResults := 0
539- for _, m := range memories {
540- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"ship_id"`) {
541- shipResults++
542- }
543- }
544- if shipResults != 1 {
545- t.Errorf("expected 1 get_ship result after compaction, got %d", shipResults)
546- }
547-
548- // Count get_system tool results - should only have 1 (the latest)
549- systemResults := 0
550- for _, m := range memories {
551- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"system_id"`) {
552- systemResults++
553- }
554- }
555- if systemResults != 1 {
556- t.Errorf("expected 1 get_system result after compaction, got %d", systemResults)
557- }
558-
559- // Non-snapshot tool result should be kept
560- mineResults := 0
561- for _, m := range memories {
562- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"result":"mining"`) {
563- mineResults++
564- }
565- }
566- if mineResults != 1 {
567- t.Errorf("expected 1 mine result (non-snapshot), got %d", mineResults)
568- }
569-
570- // Verify the latest get_ship result is kept (ship_4, not ship_0)
571- foundLatestShip := false
572- for _, m := range memories {
573- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"ship_id":"ship_4"`) {
574- foundLatestShip = true
575- }
576- }
577- if !foundLatestShip {
578- t.Error("expected latest get_ship result (ship_4) to be kept")
579- }
580-}
581-
582421 func TestSystemPromptContainsSearchGuidance(t *testing.T) {
583- // Check for search tools in Swarm Coordination section
584- if !strings.Contains(constants.SystemPrompt, "zoea_search_messages") {
585- t.Fatal("SystemPrompt missing zoea_search_messages reference")
586- }
587- if !strings.Contains(constants.SystemPrompt, "zoea_search_reasoning") {
588- t.Fatal("SystemPrompt missing zoea_search_reasoning reference")
589- }
590- if !strings.Contains(constants.SystemPrompt, "zoea_search_broadcasts") {
591- t.Fatal("SystemPrompt missing zoea_search_broadcasts reference")
422+ // SystemPrompt was simplified - check for core session management
423+ if !strings.Contains(constants.SystemPrompt, "session_id") {
424+ t.Fatal("SystemPrompt missing session_id guidance")
592425 }
593- // Check for context limitation guidance
594- if !strings.Contains(constants.SystemPrompt, "Context is limited") {
595- t.Fatal("SystemPrompt missing context limitation guidance")
426+ if !strings.Contains(constants.SystemPrompt, "Use session_id in ALL game tools") {
427+ t.Fatal("SystemPrompt missing session_id usage reminder")
596428 }
597429 }
598430
@@ -2387,7 +2219,7 @@ func TestBuildSystemPrompt_EdgeCases(t *testing.T) {
23872219 t.Error("expected fallback message when no broadcasts")
23882220 }
23892221 // Should still contain base SystemPrompt content
2390- if !strings.Contains(prompt, "SpaceMolt") {
2222+ if !strings.Contains(prompt, "Nova Zoea") {
23912223 t.Error("expected base system prompt content")
23922224 }
23932225 })