graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
feat(tui): save session from startup + Ctrl-Z safe-quit
Rach Pradhan4e6093007005
diff --git a/src/main.zig b/src/main.zigindex 941fcbd1..683c8b02 100644--- a/src/main.zig+++ b/src/main.zig@@ -3989,6 +3989,12 @@ fn readLine(cur = 0;redraw(out, buf.items, cur, marks.items, &rstate, prompt_col);},+ 0x1a => { // Ctrl-Z: save the session and quit (like a safe Ctrl-D)+ out.writeAll("^Z — saving & quit\n") catch {};+ out.flush() catch {};+ saveSession(root, root.arena, root.session_name) catch {};+ return null;+ },0x04 => { // Ctrl-D: EOF on empty line, else forward-deleteif (buf.items.len == 0) {out.writeAll("\n") catch {};@@ -5146,6 +5152,11 @@ pub fn main(init: std.process.Init) !void {loadThinkingSettings(io, arena, &root); // {"effort":...,"fast":...} persisted by /effort and /fasttracer.note("session", root.provider.model);+ // Save from the start: if the harness is killed (Ctrl+C / SIGINT) before+ // any turn completes, the session file is already on disk with the initial+ // state (provider, model, settings) so nothing is lost.+ saveSession(&root, arena, root.session_name) catch {};+if (oneshot_prompt != null and resume_flag != null and !new_session_flag and !no_resume_flag) {loadSession(&root, keys, arena, root.session_name) catch {};}