Skip to main content

Module diff

Module diff 

Source
Expand description

Token-efficient diffs (§6.1): emit minimal unified hunks, never full-file rewrites. Small context radii keep the token cost proportional to what actually changed.

Functions§

changed_lines
The number of changed (inserted or deleted) lines between old and new — a cheap proxy for edit size, useful for budgeting and for choosing whole-file vs diff transport.
unified_diff
A compact unified diff between old and new, with context unchanged lines around each hunk. Returns an empty string when the inputs are identical.