Skip to content

⚡ Bolt: Parallelize context building and cache semantic knowledge#71

Open
SuvenSeo wants to merge 1 commit into
masterfrom
bolt/optimize-context-building-14794145917188117207
Open

⚡ Bolt: Parallelize context building and cache semantic knowledge#71
SuvenSeo wants to merge 1 commit into
masterfrom
bolt/optimize-context-building-14794145917188117207

Conversation

@SuvenSeo

Copy link
Copy Markdown
Owner

💡 What:

  • Moved STOP_WORDS to a top-level constant.
  • Implemented in-memory TTL caching (5 minutes) for fetchRelevantKnowledge semantic reranking results.
  • Refactored buildContext to extract keywords early and include fetchRelevantKnowledge in the parallel Promise.all block.
  • Intentionally avoided caching working_memory and tasks to ensure state freshness in multi-turn tool loops.

🎯 Why:
The previous implementation of buildContext was sequential for the most expensive part (semantic knowledge retrieval via LLM). In multi-turn tool loops, buildContext is called repeatedly, leading to redundant LLM calls and database queries for the same user message, significantly increasing latency.

📊 Impact:

  • Reduces latency of buildContext by parallelizing knowledge retrieval with other DB queries (estimated ~30-50% reduction in context building time).
  • Eliminates redundant LLM reranking calls in multi-turn interactions through semantic caching.

🔬 Measurement:

  • Verified that all existing tests pass with npm test.
  • Visual inspection of frontend/src/lib/services/context.js confirms parallelized Promise.all and caching logic.

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

- Moved STOP_WORDS to a top-level constant.
- Implemented in-memory TTL caching for semantic knowledge reranking.
- Parallelized knowledge fetch with other database queries in buildContext.
- Ensured state freshness by excluding working_memory from caching.

Co-authored-by: SuvenSeo <263689617+SuvenSeo@users.noreply.github.com>
@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 Jun 12, 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 Jun 12, 2026 7:46pm

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.

1 participant