Editing documents
The document tools (read_file, edit_file, write_file,
find_in_file, list_files) work over a workspace, and a workspace can be
anything: a directory, memory, ActiveRecord, or one database column holding
a page.
workspace = Mistri::Workspace::Single.new( read: -> { page.html }, write: ->(html) { page.update!(html: html) }, path: "hero.html",)
agent = Mistri.agent("claude-opus-4-8", tools: Mistri::Tools.files(workspace))Now “edit the hero” is a real agent capability with no filesystem in sight.
The edit engine
edit_file matches exactly first, then whitespace-tolerantly. An ambiguous
match refuses rather than silently editing the wrong place, and a near-miss
error names the closest region it found, so the model’s retry is usually
one-shot.