Skip to content

perf: light PostToolUse hook (perf subset of ac2a001) [follow-up #31]#32

Merged
acidkill merged 1 commit into
mainfrom
perf/light-post-tool-use-hook
Jun 22, 2026
Merged

perf: light PostToolUse hook (perf subset of ac2a001) [follow-up #31]#32
acidkill merged 1 commit into
mainfrom
perf/light-post-tool-use-hook

Conversation

@acidkill

Copy link
Copy Markdown
Owner

Follow-up to merged #31. light PostToolUse hook (perf subset of ac2a001). Local make verify green. See .goal/runs/002-followup-port-2026-06.

…lter, lock-safe append [follow-up #31]

- Add _NOISE_TOOLS frozenset for O(1) skip of high-frequency no-signal tools
  (TodoRead/Write, WebSearch/Fetch, smem_recall/session/stats/index, preview logs)
  before any config file I/O — fastest possible exit path
- Replace lazy `from surreal_memory.utils.timeutils import utcnow` with inline
  stdlib datetime.now(UTC) in _format_event — zero non-stdlib imports on hot path
- Merge two separate config.toml reads (_is_enabled + _get_blacklist) into one
  _read_tool_memory_config call per invocation
- Lock-safe JSONL append via fcntl.flock(LOCK_EX) on POSIX; plain append fallback
  on platforms without fcntl (Windows)
- Handle CODEX_SESSION_ID as fallback when CLAUDE_SESSION_ID is absent
- Extract _get_data_dir() helper; _get_session_id() as testable function
- Tests: 48 tests covering _NOISE_TOOLS, _utcnow_iso, _get_session_id (CLAUDE+CODEX),
  single-config-read API, concurrent append JSONL validity, noise fast-path
@acidkill acidkill marked this pull request as ready for review June 22, 2026 22:51
@acidkill acidkill merged commit f41fd48 into main Jun 22, 2026
7 checks passed
@acidkill acidkill deleted the perf/light-post-tool-use-hook branch June 22, 2026 22:51
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