Skip to content

perf(plugin): reduce PostToolUse hook per-call I/O#942

Merged
JeremyDev87 merged 1 commit intomasterfrom
perf/post-tool-use-io-optimization-931
Mar 25, 2026
Merged

perf(plugin): reduce PostToolUse hook per-call I/O#942
JeremyDev87 merged 1 commit intomasterfrom
perf/post-tool-use-io-optimization-931

Conversation

@JeremyDev87
Copy link
Owner

Summary

  • HistoryDB singleton: get_instance()/close_instance() classmethods for DB connection reuse across tool calls (1 open per session instead of per-call)
  • SessionStats in-memory accumulation: record_tool_call() accumulates in memory, auto-flushes every N calls (default 10) or on explicit flush()
  • Conditional notification: checks config.notifications.enabled before importing notification modules — fully skips when disabled
  • Stop hook integration: flushes pending stats + closes DB singleton at session end

Test plan

  • 158 tests passing (143 existing + 15 new)
  • HistoryDB singleton: identity, connection reuse, close/recreate, noop close (4 tests)
  • SessionStats in-memory: no immediate write, flush works, auto-flush at interval, finalize flushes, summary reflects memory (5 tests)
  • Conditional notification: skip when disabled, still notify when enabled (2 tests)
  • Singleton wiring: uses get_instance not constructor, no close after each call (2 tests)
  • Stop hook flush: calls flush() and close_instance() (2 tests)

Closes #931

… batching

- HistoryDB singleton: get_instance()/close_instance() for connection reuse
- SessionStats in-memory accumulation with configurable flush_interval
- Conditional notification: skip when config.notifications.enabled=false
- Stop hook: flush pending stats + close DB singleton at session end
- 15 new tests covering singleton, flush, conditional notification

Closes #931
@JeremyDev87 JeremyDev87 added the optimization Performance and optimization tasks label Mar 25, 2026
@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
codingbuddy-landing Ready Ready Preview, Comment Mar 25, 2026 7:24am

@JeremyDev87 JeremyDev87 self-assigned this Mar 25, 2026
@JeremyDev87 JeremyDev87 merged commit 396931f into master Mar 25, 2026
25 checks passed
@JeremyDev87 JeremyDev87 deleted the perf/post-tool-use-io-optimization-931 branch March 25, 2026 07:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

optimization Performance and optimization tasks

Projects

None yet

Development

Successfully merging this pull request may close these issues.

optimization: PostToolUse hook performance — reduce per-call I/O

1 participant