Skip to main content

Module cache

Module cache 

Source
Expand description

LiveCache — the M1 cache surface that the MCP server consumes.

Keying philosophy: every cache entry is keyed by a deterministic blake3 hash of the tool’s inputs, where “inputs” includes any file content the tool’s output is a function of. The store payload is the exact formatted bytes the MCP tool fed back to the model on the first execution. A subsequent identical call hits when (a) the input hash matches AND (b) every recorded file root revalidates clean against the current filesystem. If either fails, the entry is treated as invalid and the registered metadata is removed so a stale entry does not linger. M1 keeps the registry in memory; M2 will persist it.

The cache surface is deliberately tool-agnostic: callers compute the input bytes (we provide canonicalization helpers in key), invoke lookup or lookup_revalidate, and on miss they execute the real tool and call persist. The cache does not run tools itself; that lives one layer up in verdant-mcp.

Structs§

FileRoot
One file dependency of a cache entry. The tool computed its output as a function of (path, contents at expected_hash). On every green hit we re-blake3 the file and require the hash to still match; if it does not, the entry is invalidated.
LiveCache

Enums§

CacheError
LookupOutcome

Functions§

hash_file