Skip to content

graff — a fast agentic coding harness in Zig: multi-provider, MCP, workflows, DGM evolution loop, TS/Python SDKs

Python

merge: prompt-cache max HUD and /btw parent prefix onto release/v0.0.267

Cursor Agent462f5707d0a9
diff --cc docs/adr/0011-prompt-cache-max-is-visible.md
index 00000000,ff573360..7e364460
mode 000000,100644..100644
--- a/docs/adr/0011-prompt-cache-max-is-visible.md
+++ b/docs/adr/0011-prompt-cache-max-is-visible.md
@@@ -1,0 -1,50 +1,45 @@@
-# 0010. Prompt-cache max is a visible posture, not a new default
++# 0011. Prompt-cache max is a visible posture, not a new default
+
+ Status: accepted 2026-08-19
+
+ ## Context
+
+ v0.0.266 already earned the cacheable prefix: sticky `prompt_cache_key`,
+ names-only skill catalog pinned once, standing goal as one prefix line,
+ Anthropic `cache_control`, GPT-5.6 explicit breakpoint (ADR 0009), per-agent
+ partitions, no timestamps. #476 still listed cache-rate as the remaining gap
+ (~45–58% vs opencode ~85%). The leftover automatic bust is `load_tool_schemas`
+ rewriting tools JSON. `GRAFF_STABLE_CATALOG=1` exists for that and **measured
+ empty** on the v0.0.246 audit, so it stays off.
+
+ What you could not see: whether this session's prefix was still the same
+ bytes, which named mutation last moved it, or which remaining levers are
+ intentional. `/debug` counted tokens; it did not say why a miss happened.
+
+ ## Decision
+
+ - `/cache` is the content-free cache HUD: prefix hash, last read/write,
+ session hit rate, catalog mode, last bust reason, xAI affinity
- (`x-grok-conv-id` + `prompt_cache_key`, same project id), and the
++ (`x-grok-conv-id` + `x-grok-session-id` + `prompt_cache_key`), and the
+ remaining max levers. No prompt text, paths, or tool bodies.
+ - `/debug` gets one cache row from the same snapshot.
+ - Named busts (`goal`, `playbook`, `compact`, `persona`, `tools`, `mcp`) are
+ recorded at the mutation site and counted only when the next request's
+ system+tools hash actually changes. Startup compose is not a bust.
+ - Do not default `GRAFF_STABLE_CATALOG`. Do not move playbook / compact notes
+ / standing goal off the prefix — those ride the system prompt on purpose
+ (ADR 0005, #381, #391) and already share the compaction boundary.
+ - `/btw` is a grok-build side-call: same system prompt, same tools JSON, same
+ `prompt_cache_key` as the parent. The side-question note is appended as a
+ user message. Tools are advertised for the prefix and not executed.
+
+ ## Consequences
+
+ A `/cache` after a miss names the lever. Revisit defaulting stable-catalog
+ only if a new live measurement shows load-after-load cache-read returning
+ from 0% without discovery or compaction regressions.
+
+ Live Grok 4.6 (Responses, SuperGrok OAuth, 2026-08-19): same-process
-append-only turn 2 cached 3,712 of turn 1's 3,721 input tokens. A new
-process in the same folder started cold at 128 — the official first-request
-write, not a routing miss. That is the xAI contract working: sticky
-`x-grok-conv-id` / `x-grok-session-id` / `prompt_cache_key`, exact prefix,
-reasoning replay. Session-id is grok-build's extra sticky header: always
-the project id, even when a child isolates `x-grok-conv-id`. `/btw` shares
-that key and the parent tools/system so a side question can hit the warm
-prefix instead of evicting it.
++append-only turn 2 cached 3,712 of turn 1's 3,721 input tokens. `/btw` after
++that turn reused **3,712** tokens (99.8% of the prior prompt). A new process
++in the same folder started cold at 128 — the official first-request write.
diff --cc docs/adr/README.md
index c7559b00,8fe92c11..5619f8a2
--- a/docs/adr/README.md
+++ b/docs/adr/README.md
@@@ -20,7 -20,7 +20,8 @@@ record only when you need the evidence
| [0007](0007-plugins-are-read-in-place.md) | Cursor/Claude/Grok/Codex plugins and MCP are read in place (Claude/Cursor cache via installed_plugins.json, Codex via config.toml PluginStore, never walked); skills stay on-demand; MCP stays consent-gated. |
| [0008](0008-synthetic-evals-use-external-verifiers.md) | Synthetic coding evals promote only external-verifier passes; model judges may tiebreak correctness, never decide it. |
| [0009](0009-gpt-5-6-explicit-prompt-cache-boundary.md) | GPT-5.6 OpenAI Platform marks the stable prefix explicitly; Codex and xAI stay on their supported keyed automatic-cache paths. |
-| [0010](0010-prompt-cache-max-is-visible.md) | Prompt-cache max is `/cache` posture, not a new default; `GRAFF_STABLE_CATALOG` stays opt-in. |
+| [0010](0010-background-jobs-wait-for-exit.md) | `bash_output`/`agent_output` `wait_ms>0` blocks until exit (10h cap); do not poll every 30s. |
++| [0011](0011-prompt-cache-max-is-visible.md) | Prompt-cache max is `/cache` posture, not a new default; `/btw` rides the parent prefix. |
## When to write one