⚡ Bolt: Optimize buildContext and cache knowledge retrieval#48
Conversation
- Removed redundant episodic_memory database fetch in buildContext (history is preserved via the messages array). - Implemented 5-minute TTL in-memory cache for fetchRelevantKnowledge to avoid redundant database queries and expensive LLM-based semantic reranking. - Removed dead code and unused constants related to previous episodic memory processing. - Verified with full test suite (32/32 pass). Impact: Reduces 1 database query per context build and eliminates redundant LLM calls for identical knowledge searches. 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
Optimizes buildContext by removing a redundant episodic_memory DB fetch (history is already in the messages array) and adds a 5-minute TTL in-memory cache for fetchRelevantKnowledge to avoid repeated LLM-based semantic reranks within tool-use loops. Also removes now-unused helpers and constants.
Changes:
- Drop
episodic_memoryquery andepisodesdestructuring frombuildContext. - Cache
fetchRelevantKnowledgeresults by normalized message + sorted keywords for 5 minutes. - Delete dead helpers (
selectConversationLines,compressVerboseContent,scoreEpisodeForContext,isContextNoiseEpisode) and related constants.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| frontend/src/lib/services/context.js | Removes episodic memory fetch, caches knowledge retrieval, prunes dead code |
| .jules/bolt.md | New learning log documenting the optimization rationale |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
💡 What
episodic_memorydatabase fetch from thebuildContextfunction.fetchRelevantKnowledgeresults, keyed by normalized user message and sorted keywords.selectConversationLines,compressVerboseContent,scoreEpisodeForContext,isContextNoiseEpisode) and unused constants.🎯 Why
episodic_memoryfetch was redundant because conversation history is already managed via themessagesarray passed to the LLM.fetchRelevantKnowledgeinvolves an expensive LLM-based semantic reranking step; caching results for identical queries within a short window significantly improves performance and reduces token usage during tool loops.📊 Impact
🔬 Measurement
npm test(32/32 passing).episodeswas unused inbuildContextand that the cache is correctly populated and hit for repeat queries.PR created automatically by Jules for task 16973735803735751205 started by @SuvenSeo