Skip to content

⚡ Bolt: Remove redundant episodic_memory fetch and dead context logic#44

Open
SuvenSeo wants to merge 2 commits into
masterfrom
bolt-remove-redundant-context-fetch-14608404303998954201
Open

⚡ Bolt: Remove redundant episodic_memory fetch and dead context logic#44
SuvenSeo wants to merge 2 commits into
masterfrom
bolt-remove-redundant-context-fetch-14608404303998954201

Conversation

@SuvenSeo

Copy link
Copy Markdown
Owner

💡 What: The optimization removes a redundant episodic_memory database fetch from the buildContext function in frontend/src/lib/services/context.js. It also removes several unused constants and helper functions.

🎯 Why: The conversation history is already available in the messages array passed to the chat completion API. Fetching it again from the database in every iteration of the tool loop is redundant and increases latency.

📊 Impact: Reduces database load by 1 query per tool loop iteration (potentially 5+ queries per user message) and simplifies the context generation logic.

🔬 Measurement: Verified that the episodic_memory fetch is no longer present in the buildContext implementation and that the application tests pass.


PR created automatically by Jules for task 14608404303998954201 started by @SuvenSeo

This optimization removes a redundant database query in the `buildContext` function that was fetching conversation history on every tool loop iteration. Since the history is already managed by the caller and passed as the `messages` array, this extra fetch was unnecessary and added latency.

Additionally, several unused constants and helper functions related to an older context selection logic were removed to clean up the codebase.

Changes:
- Removed `EPISODE_FETCH_LIMIT`, `BACKGROUND_EPISODE_LIMIT`, `SESSION_BREAK_MS`, `CONTEXT_NOISE_PATTERNS`, and `MEANINGFUL_HINTS` constants.
- Removed `selectConversationLines`, `compressVerboseContent`, `scoreEpisodeForContext`, and `isContextNoiseEpisode` functions.
- Removed the `episodic_memory` fetch and related logic from `buildContext`.
- Updated `.jules/bolt.md` with the performance learning.

Co-authored-by: SuvenSeo <263689617+SuvenSeo@users.noreply.github.com>
Copilot AI review requested due to automatic review settings May 28, 2026 20:09
@google-labs-jules

Copy link
Copy Markdown

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!

New to Jules? Learn more at jules.google/docs.


For security, I will only act on instructions from the user who triggered this task.

@vercel

vercel Bot commented May 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
seo-os-agent Ready Ready Preview, Comment May 28, 2026 8:14pm

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot encountered an error and was unable to review this pull request. You can try again by re-requesting a review.

This optimization removes a redundant database query in the `buildContext` function that was fetching conversation history on every tool loop iteration. Since the history is already managed by the caller and passed as the `messages` array, this extra fetch was unnecessary and added latency.

Additionally, several unused constants and helper functions related to an older context selection logic were removed to clean up the codebase.

Changes:
- Removed `EPISODE_FETCH_LIMIT`, `BACKGROUND_EPISODE_LIMIT`, `SESSION_BREAK_MS`, `CONTEXT_NOISE_PATTERNS`, and `MEANINGFUL_HINTS` constants.
- Removed `selectConversationLines`, `compressVerboseContent`, `scoreEpisodeForContext`, and `isContextNoiseEpisode` functions.
- Removed the `episodic_memory` fetch and related logic from `buildContext`.
- Updated `.jules/bolt.md` with the performance learning.

Co-authored-by: SuvenSeo <263689617+SuvenSeo@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants