small gleam coding and persistent agent daemon with a detachable cli and a canvas ui forked from okami.mom/albedo
albedo robot-docs cache-ttl.md
2.1 kB · 44 lines
Markdown
at main

Prompt cache TTL table #

The TTL table supplies initial cache-warmth estimates. Provider request measurements can replace those estimates. The table also supplies a clock and price inputs to cache warming. Its values are priors, not guarantees about a provider's current behavior. It is the cache section of the model facts, which own the layers, merge, matching, and refresh. cache_ttl owns the types and lookup.

Format #

A cache section has a policy, a clock, and optional tiers, read multiplier, and survival estimate. A tier contains seconds and an optional write multiplier. The entry's evidence and source metadata describe it. The accepted shapes and values are defined by entry_decoder and its helper decoders in cache_ttl.gleam. The shipped entries are in priv/model-facts.json.

Refresh and Fixed entries with a tier provide a clock. Evict and Unknown do not. lifetime uses the shortest explicit cache mark when present, otherwise the first clock tier. for_call resolves the profile's extension and the endpoint host before lookup. The first matching entry with a cache section wins.

HTTP API #

GET /models?view=cache-policy returns paginated entries with a cache section, every model-facts layer's report, a matching entry, and a continuation when needed. Each entry is flat, its cache fields beside its provenance, as before the model facts. The lookup uses extension, host, and model parameters, defaulting absent values to empty strings. Provider parameters are rejected for this view. See the route in http_resources.gleam and its contract in openapi.yaml.