Documentation
¶
Overview ¶
Package extractcache stores the raw output of a claim-extraction call, addressed by the content that produced it.
Extraction is 80-95% of a run's wall clock. The only reuse before this was --resume, whose ledger is named for today's date and the first source's filename — so redrafting the same paper tomorrow, or after renaming it, re-paid the whole cost. Addressing by content instead makes a redraft, a rename, and a --merge that overlaps an earlier run all free.
A cache entry is never trusted on its own account. The pipeline still runs claims.Parse over the cached text against the freshly read section, so a stale or tampered entry can only ever produce fewer verified claims, never an ungrounded one. That is the same property that makes --resume safe.
Index ¶
Constants ¶
const MaxAge = 30 * 24 * time.Hour
MaxAge bounds how long an entry stays usable. Extraction output is deterministic given the same section, prompt, engine and model, so the limit is about reclaiming disk rather than correctness.
Variables ¶
This section is empty.
Functions ¶
func Clear ¶
Clear removes every entry. It refuses a directory that does not look like a cache, so a mistyped DRAFT_CACHE_DIR cannot delete something else.
func Key ¶
Key derives the address of one extraction. Every input that can change the output is folded in: the reader that produced the section text, a prompt edit, an engine switch or a model change all produce a different key rather than silently serving output that different instructions produced.
The reader is included even though its effect already shows up in the section text it produces, so the key is addressed by the full extraction configuration (reader · prompt-version · engine · model · section) — the same identity the run manifest records for reproducibility. Two readers that happened to emit byte-identical section text are still keyed apart.
Types ¶
type Cache ¶
type Cache struct {
// contains filtered or unexported fields
}
Cache is a content-addressed store under a single directory. The zero value and a nil *Cache are both usable and always miss, so a caller that could not open one does not need a branch at every call site.
func Open ¶
Open returns a cache rooted at dir. An empty dir, or one that cannot be created, yields a cache that always misses: losing reuse is a slow run, and a slow run is a better outcome than a failed one.