session_diff
Reconstruct agent changes from a session without git, generating chronological per-file diffs and stitched edit history.
Instructions
Reconstruct what the agent changed in one session — without git.
Stitches the session's own edit records (Edit/MultiEdit
old_string→new_string, Write content, codex shell-exec
redirections) into a per-file, chronological diff. Returns
{"files": [...], "count": N, "caveats": [...]}; each file carries
its ordered edits (timestamp + intent + hunks) and a stitched,
readable diff.
caveats always carries two honest blind spots: (1) this is a diff
of the agent's actions, not the git outcome — manual edits / partial
commits / merges are invisible; (2) RISK-3 — inherits the
find_file_edits shell-redirect gap (tee / sed -i / cp /
mv / heredoc writes are not detected and are silently skipped).
redact=True (default) masks secrets in the emitted diff/hunks/
intents as [REDACTED_<TYPE>] and adds a redactions type→count
dict when any replacement happened; redact=False returns raw.
Size-bounded output (mirrors find_file_edits): over-long intent
/ hunk bodies / per-file diff text are cut with a …[truncated]
marker and named in the per-file truncated_fields (indexed paths),
and whole-file emission stops at a total byte budget
(output_truncated; count keeps the true total). The full edit
body stays reachable on demand via get_body / read_session.
Thin wrapper over :func:ai_r.session_diff.session_diff that
translates the core ValueError contract into the
{"error": "invalid_argument", "message": str(exc)} shape the MCP
client expects.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| path | No | ||
| agent | Yes | ||
| redact | No | ||
| session_uuid | Yes |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||