Skip to main content

cache_key

Function cache_key 

pub fn cache_key(fact_sheet_text: &str, model: &str) -> String
Expand description

The cache key for a narrative: lowercase-hex SHA-256 of "{fact_sheet_text}|{SCHEMA_VERSION}|{PROMPT_VERSION}|{model}".

Bumping either version constant, editing the fact sheet, or pointing at a new model all change the key, so a cached narrative is invalidated exactly when one of its inputs moves. The digest is plain hex (a valid filename on every platform) rather than the sha256:-prefixed form.