Expand description
Which files a shell command reads or rewrites, for bounce accounting.
The bounce tracker books a correction when a lossy compressed view of a
file is followed by its full content, and cancels it when the file is
edited right after (read-before-edit). Agents read and edit through the
shell as well, so ctx_shell commands are classified here:
- full reads —
cat,bat/batcat(without-r),less,morewhose output reaches the model unfiltered; - partial reads —
head,tail,sedwithout-i,bat -r, or a full reader whose output is piped onward: they never start or complete a correction; - edits —
sed -i,perl -i, output redirections (>,>>,>|,N>,&>),tee,cp/mv/installonto a path, andapply_patchpatch bodies (*** Update File:…).
The parse is deliberately conservative: duplications (2>&1, >&2),
/dev/* targets and targets built from expansions ($VAR, `cmd`)
are never edits, and anything not recognised is ignored rather than
guessed. A missed edit leaves today’s behaviour; a wrongly reported edit
only cancels a provisional correction.
Structs§
- Shell
File Effects - The files one shell command reads and rewrites, paths as written
(relative paths joined onto a preceding
cd DIR).
Enums§
- Shell
Read Kind - How much of a file a shell read delivered.
Functions§
- analyze
- Classify the file reads and edits of
command. A command longer than the shell gate validates is not analysed: the hooks run this before the gate, and each nestedsh -clevel is another recursive pass. - apply_
patch_ targets - Paths an
apply_patchbody touches:*** Update File:,*** Add File:,*** Delete File:and*** Move to:headers. Shared with the host-edit hook, which receives Codexapply_patchcalls as raw patch text.