Skip to content

⚡ Bolt: Use vault.append for chat history to improve performance#18

Open
ArnBdev wants to merge 3 commits intomasterfrom
bolt-performance-optimization-history-append-9877129272880067641
Open

⚡ Bolt: Use vault.append for chat history to improve performance#18
ArnBdev wants to merge 3 commits intomasterfrom
bolt-performance-optimization-history-append-9877129272880067641

Conversation

@ArnBdev
Copy link
Copy Markdown
Owner

@ArnBdev ArnBdev commented Feb 8, 2026

💡 What: Optimized SessionHistory.addEntryToSession to use vault.append instead of reading the entire file and rewriting it.
🎯 Why: The previous implementation read the entire chat history file into memory and rewrote it for every new message. This is an O(N) operation that scales poorly as chat history grows. vault.append is O(1) (or close to it) and much more efficient for logging/history use cases.
📊 Impact: Significantly reduces I/O and memory usage for long chat sessions.
🔬 Measurement: Verified with a new regression test test/agent/session-history-perf.test.ts that mocks vault and asserts append is called instead of read/modify.


PR created automatically by Jules for task 9877129272880067641 started by @ArnBdev

- Replaced O(N) `read` + `modify` pattern with O(1) `vault.append` in `SessionHistory.addEntryToSession`.
- Added regression test `test/agent/session-history-perf.test.ts`.
- Recorded learning about `vault.append` optimization.

Co-authored-by: ArnBdev <207385326+ArnBdev@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.

google-labs-jules bot and others added 2 commits February 8, 2026 19:00
- Replaced O(N) `read` + `modify` pattern with O(1) `vault.append` in `SessionHistory.addEntryToSession`.
- Added regression test `test/agent/session-history-perf.test.ts`.
- Formatted code to pass linting checks.
- Recorded learning about `vault.append` optimization.

Co-authored-by: ArnBdev <207385326+ArnBdev@users.noreply.github.com>
- Replaced O(N) `read` + `modify` pattern with O(1) `vault.append` in `SessionHistory.addEntryToSession`.
- Added regression test `test/agent/session-history-perf.test.ts`.
- Recorded learning about `vault.append` optimization.

Co-authored-by: ArnBdev <207385326+ArnBdev@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.

1 participant