latent.context.diffs¶
Diff compaction utilities for iterative context.
Functions¶
compact_diffs¶
Keep the max_recent_full most recent full diffs, collapse older ones.
Expects markdown-formatted context where diff blocks are delimited by
section headers such as ### Iteration N or ## Diff from iter N.
Older diffs are collapsed to a one-liner::
iter N: +X/-Y lines in file1.py, file2.py
Parameters¶
context: Markdown string potentially containing multiple diff sections. max_recent_full: Number of most-recent diff sections to preserve in full.
Returns¶
str Compacted markdown string.