@@ -529,49 +529,14 @@ func TestMysisContextCompaction(t *testing.T) {
529529 t.Errorf("expected first memory to be system prompt, got %s", memories[0].Role)
530530 }
531531
532- // Count get_ship tool results - should only have 1 (the latest)
533- shipResults := 0
534532 for _, m := range memories {
535- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"ship_id"`) {
536- shipResults++
533+ if m.Role == store.MemoryRoleTool {
534+ t.Fatalf("expected no tool memories in context, found: %s", m.Content)
537535 }
538- }
539- if shipResults != 1 {
540- t.Errorf("expected 1 get_ship result after compaction, got %d", shipResults)
541- }
542-
543- // Count get_system tool results - should only have 1 (the latest)
544- systemResults := 0
545- for _, m := range memories {
546- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"system_id"`) {
547- systemResults++
536+ if m.Role == store.MemoryRoleAssistant && strings.HasPrefix(m.Content, constants.ToolCallStoragePrefix) {
537+ t.Fatalf("expected no assistant tool-call memories in context, found: %s", m.Content)
548538 }
549539 }
550- if systemResults != 1 {
551- t.Errorf("expected 1 get_system result after compaction, got %d", systemResults)
552- }
553-
554- // Non-snapshot tool result should be kept
555- mineResults := 0
556- for _, m := range memories {
557- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"result":"mining"`) {
558- mineResults++
559- }
560- }
561- if mineResults != 1 {
562- t.Errorf("expected 1 mine result (non-snapshot), got %d", mineResults)
563- }
564-
565- // Verify the latest get_ship result is kept (ship_4, not ship_0)
566- foundLatestShip := false
567- for _, m := range memories {
568- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"ship_id":"ship_4"`) {
569- foundLatestShip = true
570- }
571- }
572- if !foundLatestShip {
573- t.Error("expected latest get_ship result (ship_4) to be kept")
574- }
575540 }
576541
577542 func TestSystemPromptContainsSearchGuidance(t *testing.T) {
@@ -642,28 +607,14 @@ func TestZoeaListMysesCompaction(t *testing.T) {
642607 if err != nil {
643608 t.Fatalf("getContextMemories() error: %v", err)
644609 }
645-
646- // Count zoea_list_myses tool results - should only have 1 (the latest)
647- listResults := 0
648610 for _, m := range memories {
649- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"id":"mysis-`) {
650- listResults++
611+ if m.Role == store.MemoryRoleTool {
612+ t.Fatalf("expected no tool memories in context, found: %s", m.Content)
651613 }
652- }
653- if listResults != 1 {
654- t.Errorf("expected 1 zoea_list_myses result after compaction, got %d", listResults)
655- }
656-
657- // Verify the latest result is kept (mysis-4, not mysis-0)
658- foundLatest := false
659- for _, m := range memories {
660- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"id":"mysis-4"`) {
661- foundLatest = true
614+ if m.Role == store.MemoryRoleAssistant && strings.HasPrefix(m.Content, constants.ToolCallStoragePrefix) {
615+ t.Fatalf("expected no assistant tool-call memories in context, found: %s", m.Content)
662616 }
663617 }
664- if !foundLatest {
665- t.Error("expected latest zoea_list_myses result (mysis-4) to be kept")
666- }
667618 }
668619
669620 func TestMysisContextCompactionNonSnapshot(t *testing.T) {
@@ -686,16 +637,13 @@ func TestMysisContextCompactionNonSnapshot(t *testing.T) {
686637 if err != nil {
687638 t.Fatalf("getContextMemories() error: %v", err)
688639 }
689-
690- shipResults := 0
691640 for _, m := range memories {
692- if m.Role == store.MemoryRoleTool && strings.Contains(m.Content, `"ship_id"`) {
693- shipResults++
641+ if m.Role == store.MemoryRoleTool {
642+ t.Fatalf("expected no tool memories in context, found: %s", m.Content)
643+ }
644+ if m.Role == store.MemoryRoleAssistant && strings.HasPrefix(m.Content, constants.ToolCallStoragePrefix) {
645+ t.Fatalf("expected no assistant tool-call memories in context, found: %s", m.Content)
694646 }
695- }
696-
697- if shipResults != 2 {
698- t.Fatalf("expected 2 travel results to be kept, got %d", shipResults)
699647 }
700648 }
701649