diff
Stitch edit rows into a per-file chronological diff, render unified format, and redact secrets on demand.
Instructions
Stitch edit rows into a per-file chronological diff — the diff verb.
Reproduces the synthesis of session_diff: given the edit events of a
session (query(type="tool_call(edit)", session=…) — plus write /
shell-redirect events), group them per file in chronological order and
render a stitched, readable diff. Bodies are fetched on demand (via each
event's stored message_index), never inlined on the row.
Args:
rows: Edit-event dicts (query output). Each must carry an id
and a refs list with a file entry; unresolvable rows skip.
per_file: Group by file (the only mode today).
format: "unified" (the only rendering today).
redact: When True (default) secrets in the stitched output are
masked as [REDACTED_<TYPE>] and the result carries a
redactions type→count dict when any replacement happened;
False returns raw content.
Returns:
{"files": [{"file", "edits", "diff", "hunks"}], "count", "caveats"}
(same shape + caveats as session_diff, size-bounded the same
way: capped fields named in the per-file truncated_fields, byte
budget → output_truncated) or the standard
{"error": ..., "message": ...} dict on an unsupported format.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| rows | Yes | ||
| format | No | unified | |
| redact | No | ||
| per_file | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||