Local-first AI coding agent desktop: Electron + Rust host core + pi Agent Harness + user-installable plugins
ADR 0069: Make native-tool path mistakes recoverable
- Status: Accepted for implementation
- Date: 2026-08-10
- Amends: D185, D192
- Amended by: ADR 0087 (§2's byte-faithful
Readcontent is replaced by line-numbered, tagged output)
Context
Recent durable sessions showed repeated path-shape mismatches between the model
and the native tools: Read received a directory after a guessed file name did
not exist, and Grep.path was repeatedly given one explicit file even though the
host accepted only directories. Both were recoverable inspection mistakes reported
as generic execution failures. The transcript compounded this by deriving a
terminal failure for the activity group from any child error, so a recovered turn
could still read as failed.
Decision
- Preserve D185's Agent core and deferred-tool boundary:
GlobandGrepstay on demand, and a new Agent prompt activatesGlobthroughToolSearchwhen a directory must be listed or a file name is uncertain. - Enforce and advertise one portable path contract:
Read.pathaccepts an existing regular text file and never a directory,Glob.pathaccepts a directory, andGrep.pathaccepts either one file or a directory tree, withincludestill filtering a file's basename. - A directory passed to
Readreturns publicINVALID_ARGUMENTrather thanTOOL_FAILED, withsuggestedTool: "Glob"and boundedsuggestedArgscarrying the original path andpattern: "**/*"so the model can correct itself. - Host definitions, runtime TypeBox schemas, main-Agent guidance, and subagent
guidance carry the same semantics; subagents, which never receive
ToolSearch, are told only about tools their definition has. - A tool error stays visible and auto-expanded on its own ToolCallRow, and the activity group covers duration and step containment only. Terminal agent errors, the TurnOutcomeCard, sidebar state, and notifications remain the single turn-outcome surfaces.
No host protocol or storage-schema version changes; the tool result is already
structured JSON and the Grep input shape stays a string. The 2026-09-27 amendment
to ADR 0048 ships Glob and Grep in the first request, superseding decision 1's
deferral only.
Consequences
- Single-file Grep calls stop failing on a directory-only contract.
- A mistaken directory Read yields an actionable correction, not an ambiguous execution failure.
- Recovered turns no longer look terminally failed while the failed call stays auditable in the expanded transcript.
Alternatives
- Return
GlobandGrepto the Agent core: rejected because it reverses D185's bounded first-request context. - Silently run Glob when Read receives a directory: rejected because the audited tool name would disagree with the executed operation.