⚡ Bolt: Optimize context service by removing redundant fetches and adding caching#49
⚡ Bolt: Optimize context service by removing redundant fetches and adding caching#49SuvenSeo wants to merge 1 commit into
Conversation
- Removed redundant episodic_memory database fetch in buildContext - Implemented 5-minute TTL cache for semantic knowledge retrieval - Implemented 1-minute TTL cache for working memory queries - Cleaned up unused constants and dead functions previously used for episodic history processing Co-authored-by: SuvenSeo <263689617+SuvenSeo@users.noreply.github.com>
|
👋 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 New to Jules? Learn more at jules.google/docs. For security, I will only act on instructions from the user who triggered this task. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Pull request overview
This PR optimizes prompt context generation by removing redundant episodic-memory fetching from buildContext and introducing short-lived in-memory caching to reduce repeated database/LLM reranking work.
Changes:
- Removed the
episodic_memoryfetch (and related unused helpers/constants) frombuildContext, relying on the existingmessagesarray passed to chat completions for history. - Added in-memory caching for
fetchRelevantKnowledge(5 min) andworking_memory(1 min). - Added an internal performance journal entry documenting the change.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| frontend/src/lib/services/context.js | Removes redundant episodic-memory query, adds caching for knowledge retrieval and working memory, and deletes unused episode-selection helpers. |
| .jules/bolt.md | Documents the performance learning and action taken for the redundant episodic-memory fetch. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| supabase.from('tasks').select('id, title, description, deadline, priority, status, follow_up_count, tier').in('status', ['open', 'snoozed']).order('priority', { ascending: true }), | ||
| // Cached 1 min: working memory | ||
| supabase.from('working_memory').select('key, value, expires_at').or(`expires_at.is.null,expires_at.gt.${now.toISOString()}`), | ||
| cachedWorking ? Promise.resolve({ data: cachedWorking }) : supabase.from('working_memory').select('key, value, expires_at').or(`expires_at.is.null,expires_at.gt.${now.toISOString()}`), |
| } | ||
|
|
||
| async function fetchRelevantKnowledge(userMessage, keywords) { | ||
| const cacheKey = `knowledge:${userMessage.trim().toLowerCase().replace(/\s+/g, ' ')}:${[...keywords].sort().join(',')}`; |
💡 What:
🎯 Why:
📊 Impact:
🔬 Measurement:
PR created automatically by Jules for task 18256203493480311723 started by @SuvenSeo