Skip to main content

Module ctx_edit

Module ctx_edit 

Source

Structs§

EditParams
Parameters for a file edit operation: path, old/new strings, and flags.

Enums§

CacheEffect
A cache mutation that an edit needs after its disk I/O completes.

Constants§

NO_CHANGE_PREFIX
Prefix of the result for an edit whose end state already holds: nothing is written, and the call is a success, not an error.

Functions§

apply_cache_effect
Applies a deferred CacheEffect to the session cache.
captured_solution_decision_kinds
handle
Performs a string replacement edit on a file with CRLF/LF and whitespace tolerance. Thin wrapper that runs the I/O and applies the resulting cache effect to cache in one shot (used by tests and any in-process caller that already holds the cache exclusively).
record_outcome
Quality loop (#494): classify the edit result and feed it into lean_ctx::core::edit_quality. Only two outcomes carry a compression signal: a clean replacement (success) and an old_string miss (failure — the body the agent quoted wasn’t what’s on disk). Parameter mistakes (empty/identical strings, preimage mismatch, missing file) and already-applied edits say nothing about the read mode and are skipped.
run_io
Performs the full edit on disk without touching the session cache, and reports back the CacheEffect the caller should apply afterwards.