You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat: cache-results key decouples blob caching from content-type (closes #319)
Caching was a side effect of declaring a mime: MCP allows mimeType only on
resource blocks, resource blocks need a URI, so content-type (text path) and
script-emitted mimeType (mcp-result path) forced a madder write on EVERY
output — and since virtually all ~55 mcp-result tools stamp a mime on every
block, each small status-y output paid a blob write (folio.ls 1.8k calls/mo,
jq 740/mo, all of freud/sisyphus/piers; measured via freud over 30 days).
Sampling showed small-output cache URIs are essentially never consumed,
while large outputs were already independently protected by the token
threshold.
New schema-3 key `cache-results = "always" | "threshold" | "never"`
(omitted = threshold), honored by both result paths:
- threshold (default): blob-cache only above the token threshold; small
outputs are plain text blocks — no blob write, mime dropped (there is
nowhere to put a mime without a resource block).
- always: every non-empty output cached; small outputs become resource
blocks (URI + text + mime). For small-but-composable outputs.
- never: the blob store is never touched; even oversized output stays
plain inline text. The author owns the context cost.
content-type is now a pure mime label stamped onto whatever resource block
caching produces. no-truncate is orthogonal (inlining above threshold) and
unchanged.
Annotated cache-results = "always" where small-output URIs are genuinely
re-piped: jq.jq, grit.diff, man.list/toc/section. Everything else moves to
threshold — the intended churn reduction; large outputs keep URIs
everywhere.
Also: the moxy.native:// → madder://blobs/ code migration happened
previously; this fixes the three folio read* TOML descriptions still
advertising the old scheme (doc-only per review — no legacy resolver).
moxin(7) gains a RESULT SHAPING section documenting result-type /
content-type / cache-results / no-truncate as one system; CLAUDE.md gets
the summary. Covered by unit tests (parse + all three modes on both paths)
and updated/extended bats: folio 36/36, native 44/44, mcp_proto 46/46 —
old-shape assertions updated to the new contract, fixtures that test the
resource mechanic opt into "always", new threshold-drops-mime cases on
both paths.
🤡 Generated with Clown (https://github.com/amarbel-llc/clown)
0 commit comments