Expand description
weave edit: how an agent changes code, addressed by entity.
An edit names a function, class or method and says what becomes of it: replace it, change one piece of text inside it, delete it, or add a new entity before or after it. Text edits without an entity cover everything else (imports, module-level statements, files weave has no grammar for), and an edit to a file that does not exist creates it.
Every edit is resolved against the file as it is on disk now, so nothing
has to be read first and nothing another agent changed elsewhere in the
file is overwritten. A text edit’s old must match exactly once (or set
all), which is what keeps a stale edit from landing somewhere else.
A batch is all or nothing: every edit is planned in memory, in order, and files are written only when all of them resolved.
Structs§
- Edit
- Edit
Error - Why a batch was refused. Nothing was written.
- File
Report - What a batch did to one file, entity by entity.
- Report
Enums§
Functions§
- review_
external - Review an edit another tool made (an agent’s own edit or patch tool):
for each
(file, content before the edit)(Nonebefore: the file is new or its content at HEAD stands in), what the edit broke in the parse and which callers a signature change or deletion left behind. Then start the agent’s last test command on the new tree, as after a weave edit. - run
- Apply
editsunderroot. Withdry_run, plan and report only. - speculate
- Start the agent’s last test command on the tree just written, in the
background. Agents follow an edit by rerunning the same command after
thinking for some seconds; by then this run is done or under way, and
sem check --runjoins it instead of starting over. - then
- Run
cmdthroughsem check --runonce the edits are written, so an edit and its check take one call; it joins the speculative run if there is one. - version
- sem’s entity version:
v:+ FNV-1a (32 bits) of the source without trailing newlines.