graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs
Python
fold: six rarely used natives load on demand
justrachd2962416edec
diff --git a/docs/adr/0224-six-rare-natives-join-the-fold.md b/docs/adr/0224-six-rare-natives-join-the-fold.mdnew file mode 100644index 00000000..913bab57--- /dev/null+++ b/docs/adr/0224-six-rare-natives-join-the-fold.md@@ -0,0 +1,31 @@+# 0224. Six rarely used natives join the fold++Status: accepted 2026-09-30++## Context++`native_fold.folded` keeps late-use natives out of the eager root catalog:+their names ride the `load_tool_schemas` listing and a confident call loads+the schema on the spot. Six natives stayed eager although a root turn loop+seldom calls them: `render_html`, `agent_message`, `install_agent_tool`,+`read_tool_result`, `subagent_resume` and `schedule_task`. Their schemas+were paid on every request, and cold on every first request.++A hill-climb round against a reference harness measured folding them: cost+per task fell on the train and the held-out split with pass rate held, and a+confirmation round with the arms in the opposite order agreed.++## Decision++Add the six names to `native_fold.folded`. They stay advertised (the+tool-catalog kernel is unchanged) and callable: the listing names them, and+the auto-load path runs a confident call without a refuse-load-retry round+trip. `read_tool_result` needs no schema to be called right: the spill+marker spells out `read_tool_result(handle, offset, limit)`.++## Consequences++The eager root catalog is smaller on every provider. A session that does+use one of these tools pays one schema load, once. Subagents are unaffected;+their catalogs are comptime-baked full surfaces. `GRAFF_NO_NATIVE_FOLD`+still restores every schema.diff --git a/docs/adr/README.md b/docs/adr/README.mdindex 15b3eca8..428e9aa7 100644--- a/docs/adr/README.md+++ b/docs/adr/README.md@@ -247,6 +247,7 @@ record only when you need the evidence or the edge cases.| [0218](0218-background-jobs-survive-a-crash.md) | A finite root job started in the background writes its output to `.graff/job-output/<id>/` with an exit receipt from its own shell, so it outlives a crashed graff. Loading the session re-attaches this session's unreported jobs under their old ids, reports what ended while graff was down, and sweeps other sessions' stale captures. Foreground commands, servers, subagent jobs and Windows keep pipes. || [0219](0219-claude-5-5-era-request-contract.md) | Claude Opus 5.5, Sonnet 5.5 and Fable 5.1 are never forced to a tool, get `drop_block` thinking binding (with its beta header), take `/effort` as `output_config.effort` (left off at graff's default), and get 64K/128K `max_tokens`. Claude errors take the same retry-without ladder as other providers; a refusal ends the turn outside history. Default model `claude-opus-5-5`, ladder opus-5-5 → sonnet-5-5. || [0220](0220-claude-prompt-cache-forks-and-pricing.md) | On the Anthropic API, compaction's note and summary fork the conversation while its cache is warm. They use the same tools, system prompt and history, with the instruction appended, so they read the history instead of rewriting it. Otherwise the old shape runs without breakpoints. A turn-opening request keeps the TTL of the last gap inside a turn. 1-hour writes bill at 2x. 5.5-era models get graff's effort as shown; titles and recaps run at low. A second breakpoint marks where the previous request wrote. |+| [0224](0224-six-rare-natives-join-the-fold.md) | `render_html`, `agent_message`, `install_agent_tool`, `read_tool_result`, `subagent_resume` and `schedule_task` join `native_fold.folded`: listed by `load_tool_schemas`, auto-loaded on a confident call, no longer paid on every request. |## When to write onediff --git a/src/native_fold.zig b/src/native_fold.zigindex c6b8b528..cdf9b775 100644--- a/src/native_fold.zig+++ b/src/native_fold.zig@@ -55,6 +55,15 @@ pub const folded = [_][]const u8{"agent_output","skill","webfetch",+ // ADR 0224: rare on the root turn loop, measured as a cost win against a+ // reference harness with pass rate held. A confident call auto-loads, and+ // the spill marker spells out read_tool_result's arguments.+ "render_html",+ "agent_message",+ "install_agent_tool",+ "read_tool_result",+ "subagent_resume",+ "schedule_task",// ADR 0022 / 0140: isFolded is false under --old so the structured-only// catalog stays byte-stable. While available, rlm is on the catalog// from turn one — no batch-size or compactAt gate.