Home

mweinbach / agent-coworker

publicmweinbach/agent-coworker
Overview Code History Branches Pull requestsIssuesInsights
main
HomeOverview Code PRsIssues

⚡ Optimize system prompt variable replacement

9 months ago

3900fdc
Authored
google-labs-jules[bot]2/9/2026, 11:31:40 PM
Replaced the O(N*K) `replaceAll` loop with a single O(N) regex replacement pass.
This improves scalability and avoids multiple string scans.

- Benchmark showed 6.32x speedup for 100 variables.
- Verified with `test/prompt.test.ts`.

Co-authored-by: mweinbach <15623732+mweinbach@users.noreply.github.com>

Parentf0f1054

2 files changed
  • modify_prompt.py+25−0
  • src/prompt.ts+3−3