@@ -86,6 +86,11 @@ export function write(text: string): void {
8686 process.stdout.write(text);
8787 }
8888
89+/** Strip the `linenum:hash| ` prefix that hashline-formatted tool outputs include. */
90+function stripHashlinePrefix(text: string): string {
91+ return text.replace(/^\d+:[0-9a-f]{2}\| /, "");
92+}
93+
8994 // ─── Glyph vocabulary ─────────────────────────────────────────────────────────
9095 // All from the 16-color ANSI palette — inherits terminal theme.
9196
@@ -117,7 +122,8 @@ export const G = {
117122 function toolGlyph(name: string): string {
118123 if (name === "glob" || name === "grep") return G.search;
119124 if (name === "read") return G.read;
120- if (name === "edit") return G.write;
125+ if (name === "create" || name === "replace" || name === "insert")
126+ return G.write;
121127 if (name === "shell") return G.run;
122128 if (name === "subagent") return G.agent;
123129 if (name.startsWith("mcp_")) return G.mcp;
@@ -151,13 +157,19 @@ function toolCallLine(name: string, args: unknown): string {
151157 line || count ? c.dim(`:${line ?? 1}${count ? `+${count}` : ""}`) : "";
152158 return `${G.read} ${c.dim("read")} ${String(a.path ?? "")}${range}`;
153159 }
154- if (name === "edit") {
155- const verb = !a.startAnchor
156- ? "create"
157- : a.insertPosition
158- ? "insert"
159- : "edit";
160- return `${G.write} ${c.dim(verb)} ${c.bold(String(a.path ?? ""))}`;
160+ if (name === "create") {
161+ return `${G.write} ${c.dim("create")} ${c.bold(String(a.path ?? ""))}`;
162+ }
163+ if (name === "replace") {
164+ const range = a.endAnchor
165+ ? c.dim(` ${a.startAnchor}–${a.endAnchor}`)
166+ : c.dim(` ${a.startAnchor}`);
167+ const verb =
168+ a.newContent === undefined || a.newContent === "" ? "delete" : "replace";
169+ return `${G.write} ${c.dim(verb)} ${c.bold(String(a.path ?? ""))}${range}`;
170+ }
171+ if (name === "insert") {
172+ return `${G.write} ${c.dim(`insert ${a.position ?? ""}`)} ${c.bold(String(a.path ?? ""))}${c.dim(` @ ${a.anchor}`)}`;
161173 }
162174 if (name === "shell") {
163175 const cmd = String(a.command ?? "");
@@ -250,7 +262,9 @@ export function renderToolResult(
250262 ? c.dim(" ".repeat(m.file.length + 1))
251263 : c.dim(`${m.file}:`);
252264 seen.add(key);
253- writeln(` ${fileLabel}${c.dim(String(m.line))} ${m.text.trim()}`);
265+ writeln(
266+ ` ${fileLabel}${c.dim(String(m.line))} ${stripHashlinePrefix(m.text).trim()}`,
267+ );
254268 shown++;
255269 }
256270 const rest = r.matches.length - shown;
@@ -279,14 +293,23 @@ export function renderToolResult(
279293 return;
280294 }
281295
282- if (toolName === "edit") {
296+ if (toolName === "create") {
283297 const r = result as { path: string; diff: string; created: boolean };
284- const verb = r.created ? c.green("created") : c.dim("edited");
298+ const verb = r.created ? c.green("created") : c.dim("overwritten");
285299 writeln(` ${G.ok} ${verb} ${r.path}`);
286300 renderDiff(r.diff);
287301 return;
288302 }
289303
304+ if (toolName === "replace" || toolName === "insert") {
305+ const r = result as { path: string; diff: string; deleted?: boolean };
306+ const verb =
307+ toolName === "insert" ? "inserted" : r.deleted ? "deleted" : "replaced";
308+ writeln(` ${G.ok} ${c.dim(verb)} ${r.path}`);
309+ renderDiff(r.diff);
310+ return;
311+ }
312+
290313 if (toolName === "shell") {
291314 const r = result as {
292315 stdout: string;