zarvis: codex-style minimal tool surface (shell + edit_file + write_stdin)#329
Merged
Conversation
…tdin) Replace the granular filesystem tools (read_file/write_file/list_dir/ find_files) with a codex-style minimal coding surface, leaving the agentd-control, subagent, and browser tools untouched. - edit_file: now multi-hunk / multi-file. Pass an `edits` array applied in order (each find matches against the file as modified by earlier edits); validated up-front and applied atomically (a single failed match writes nothing). Creates files when `find` is empty on a non-existent path, absorbing write_file. - tools/proc.rs: persistent process sessions. `shell interactive:true` keeps a process alive and returns a session_id instead of killing it at the timeout; the new write_stdin tool feeds its stdin and drains incremental output. Children are killed when the session ends. - Reading / searching / listing now go through `shell` (cat/sed/rg/ls), matching codex. System prompts updated to steer toward batched reads and multi-hunk edits. 144 tests pass (8 new: proc sessions, multi-hunk/atomic/create edits, interactive shell + write_stdin round-trip).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Replaces zarvis's granular filesystem tools with a codex-style minimal coding
surface — three tools — keeping all agentd-control, subagent, and browser tools.
shell,read_file,write_file,edit_file,list_dir,find_filesshell,edit_file,write_stdinWhy
Benchmark analysis (DeepSWE, gpt-5.5, same Codex-OAuth backend, only the harness
differs) showed zarvis issuing ~1.2× codex's tool calls but ~1.9× the model
round-trips. A big driver is the tool surface: codex exposes essentially a
shell (
exec_command) + a multi-hunk patch editor (apply_patch), so the samework maps to fewer, denser calls. zarvis's granular read/edit/list tools fan out
into many small serial calls — on one task, 62 single-hunk edits + 38 re-reads
of 5 files vs codex's 17 multi-hunk patches. This change aligns zarvis with
codex's surface.
Changes
edit_file→ multi-hunk + create. Passedits: [{find, replace, path?}]applied in order (each
findmatches the file as modified by earlier hunks),validated up-front and applied atomically — a single failed match writes
nothing. An empty
findon a non-existent path creates the file,absorbing
write_file. The single{path, find, replace}form still works.tools/proc.rs) +write_stdin.shellgains
interactive: true: instead of killing a process at the timeout it keepsit alive and returns a
session_idafter a brief wait. The newwrite_stdintool writes to that process's stdin (optional
eof) and drains incrementaloutput. A
ProcRegistryis shared across the session'sToolCtxs; childrenare killed when the session ends (
kill_on_drop).shell. Removedread_file,write_file,list_dir,find_files; the model usescat/sed -n/rg/ls. Both systemprompts updated to steer toward batched reads and multi-hunk edits.
agentd_*), subagent (agentd_subagent_*), browser.Notes / decisions
find_fileswasn't in the explicit remove list but is dropped here fortrue 3-tool parity (a search convenience now covered by
rg/findinshell). Trivial to restore if you'd rather keep it.write_stdinuses pipes, not a PTY. Line-oriented programs and promptswork; full-screen / TTY-detecting programs may behave differently. PTY
allocation is a possible follow-up.
on a bad
find); cross-file write failures are I/O-only and reported.Tests
144 pass (8 new): proc sessions (echo / exit / unknown id), multi-hunk
apply-in-order, atomic-on-failure, empty-find create, single edit, and an
interactive
shell+write_stdinround-trip. Updated the auto-approve test(
write_file→edit_file) and the skills prose test.Relevant binary:
agentd-adapter-zarvis— this PR only touchescrates/adapter-zarvis;agent/agentd/agentd-mcpbuild unchanged.🤖 Generated with Claude Code