Table of Contents
Cache identity (llmcpp)
Cache identity connects an implementation to the inputs that produced it. The generation pass computes its key from the target, prompt, effective policy, and compiler context:
t.m_key = sha256_hex(std::string(CacheVersion) + "\n" + t.m_name + "\n" + t.m_signature + "\n" + t.m_prompt_text + "\n" + policy + "\n" + t.m_cache_salt + "\n" + sha256_hex(t.m_options.m_system_prompt) + "\n" + sha256_hex(t.m_options.m_agent_config) + "\n" + t.m_options.m_backend + "\n" + contextDigest + (!t.m_agent_override ? "" : "\nagent:" + t.m_options.m_agent_command));
The inputs include the signature, prompt, cache salt, system instructions, agent configuration, backend, and compilation-context digest. Attached references are incorporated afterward.
This deliberately invalidates conservatively: changing a header can cause a miss even when the old body might still be usable. Output-path changes do not define a different implementation. Full hashes remain in metadata even when filenames display abbreviated prefixes. Explicit keys select a stored implementation independently of this computed identity.
Source: generation_pass.cpp.
