feat(mcp): add file_history tool with per-file patch events - #192
Conversation
Add a read-only file_history MCP tool that reports which indexed sessions touched a file. Targets match bidirectionally at path separator boundaries, so relative and absolute forms of the same path find each other. Normalize patch writes into per-file file_write events: Codex apply_patch calls previously landed as target-less tool_call events and OpenCode multi-file patches kept only the first file. Bump both event parser versions so existing sessions backfill on next sync. Order events by COALESCE(timestamp, session activity) so sources that omit event timestamps (Cursor) are not pushed past the limit. Signed-off-by: samzong <samzong.lu@gmail.com>
Merging this PR will improve performance by 13.35%
|
| Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|
| ⚡ | export_jsonl |
21.4 ms | 18.9 ms | +13.35% |
Tip
Curious why performance improved? Comment @codspeedbot explain why performance improved on this PR, or directly use the CodSpeed MCP with your agent.
Comparing feat/mcp-file-history (8b2e343) with main (c4f8af3)2
Footnotes
-
2 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
-
No successful run was found on
main(a45c10e) during the generation of this report, so c4f8af3 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report. ↩
What's changed?
file_historyMCP tool: reports which indexed sessions touched a file, with session id, source, project, title, kind, name, target, event_seq, truncated summary, and event timestamp./or\\boundaries so relative and absolute forms of the same path find each other.file_writeevents: Codexapply_patchcalls previously produced target-lesstool_callevents, and OpenCode multi-file patches kept only the first file. Event parser versions bumped (codex 1→2, opencode 2→3) so existing sessions backfill on the next sync.COALESCE(e.timestamp, s.updated_at, s.started_at)so sources that omit event timestamps (Cursor) still surface by session activity.Why
Verification
make check(audit → fmt → clippy -D warnings → workspace tests incl. bench feature) passes.attrs_jsonnever leaks into tool output.