Skip to content

Fix managing episodes#142

Merged
torrmal merged 3 commits into
export-sessionfrom
manage-episodes
May 8, 2026
Merged

Fix managing episodes#142
torrmal merged 3 commits into
export-sessionfrom
manage-episodes

Conversation

@ea-rus
Copy link
Copy Markdown
Collaborator

@ea-rus ea-rus commented Apr 29, 2026

Changed managing memory episodes
Was:

  • list: all of episode sessions (list of files in episodes folder)
  • delete: remove a whole episode file

After update:

  • list: conversation table for the current session
turn    question                   answer
1       aaa                        bbbb
2       ccc                        dddd
  • delete: to delete turn (a question-pair)

https://linear.app/mindsdb/issue/STRC-1000/fix-managing-episodic-memory

@entelligence-ai-pr-reviews
Copy link
Copy Markdown

EntelligenceAI PR Summary

Refactors episodic memory management to operate at the conversation-turn level and consolidates history conversion logic into HistoryStore.

  • anton/memory/history_store.py: Adds episodes_to_api_history static method (handles user, tool_call, scratchpad, tool_result, assistant roles with UUID-based tool IDs), rebuild_from_episodic orchestration method, and from_episodes classmethod stub
  • anton/core/memory/episodes.py: Replaces del_episode with del_episode_entry(turn_num) for targeted in-place JSONL line removal by turn number
  • anton/memory/manage.py: Rewrites memory UI to render turns as a Rich Table grouped by defaultdict; delete action now calls del_episode_entry and triggers history rebuild; adds history_store and session as constructor and handle() parameters
  • anton/chat.py: Passes history_store and session to MemoryManager constructor and handle() call
  • anton/commands/share.py: Removes duplicate _episodic_to_api_history function, delegating to centralized HistoryStore.episodes_to_api_history

Confidence Score: 5/5 - Safe to Merge

Safe to merge — this PR cleanly refactors episodic memory management by introducing del_episode_entry(turn_num) in episodes.py and consolidating history conversion logic into HistoryStore via episodes_to_api_history, rebuild_from_episodic, and from_episodes. The automated review found zero issues across all five changed files, and the design decisions — UUID-based tool IDs, conversation-turn-level granularity, and centralizing history conversion — appear sound and well-scoped. No logic bugs, data loss risks, or security concerns were identified.

Key Findings:

  • episodes_to_api_history in history_store.py handles all relevant roles (user, tool_call, scratchpad, tool_result, assistant) with UUID-based tool IDs, which is a correct approach for maintaining referential integrity between tool calls and their results across turns.
  • Replacing del_episode with del_episode_entry(turn_num) in episodes.py narrows the deletion scope to conversation-turn granularity, reducing the risk of accidentally removing more episodic context than intended.
  • The from_episodes classmethod is noted as a stub, which is an acceptable pattern for incremental development as long as callers handle the incomplete implementation — no callers appear to depend on it yet.
  • Full 5/5 file coverage by the automated review with zero flagged issues across all changed files supports a high confidence merge decision.
Files requiring special attention
  • anton/memory/history_store.py
  • anton/core/memory/episodes.py

Copy link
Copy Markdown
Contributor

@torrmal torrmal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good to me

@torrmal
Copy link
Copy Markdown
Contributor

torrmal commented Apr 30, 2026

@sejubar can you please test this end to end

@torrmal torrmal requested a review from sejubar April 30, 2026 07:53
@torrmal torrmal merged commit b0334ac into export-session May 8, 2026
1 check passed
@github-actions github-actions Bot locked and limited conversation to collaborators May 8, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants