feat: Implement batch prompt consolidation for scheduled LLM tasks#628
feat: Implement batch prompt consolidation for scheduled LLM tasks#628
Conversation
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@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. |
|
Closing PR because it has merge conflicts with the main branch. Please resolve conflicts and try again. |
Implements Phase 28 Batch Prompt Consolidation, providing the capability to intelligently bundle routine scheduled LLM tasks into single context windows to drastically improve token efficiency.
Features:
src/llm/batching.ts) Queue tasks bybatchingGroupID and set a consolidation timer (e.g. 30s). Once triggered, constructs a single XML-structured prompt and extracts individual responses to resolve caller promises.src/scheduler/trigger.ts,src/daemon.tsandTaskDefinitionto intercept batcheable tasks gracefully while retaining standard task side-effects (writing execution history log files to.agent/logs/).batched_prompts_totaland estimatedtokens_saved_via_batchinginto the Health Monitor MCP API (aggregateCompanyMetrics).batching.test.ts&batch_prompt_consolidation.test.ts), verifying prompt injection logic, parsing integrity, multi-task dispatch, and error handling. Tested thoroughly and correctly mockedcreateLLMutilizingvi.hoistedto avoid reference errors.ROADMAP.md,todo.mdand createddocs/BATCH_PROMPT_CONSOLIDATION.mddetailing architecture, metrics, and best practices.Test results:
vitest run tests/unit/llm/batching.test.ts(3/3 passed)vitest run tests/integration/batch_prompt_consolidation.test.ts(1/1 passed)PR created automatically by Jules for task 3801831292672809587 started by @stancsz