rehydrator
Category: context · Cloud + Local · Status: v1.0 — production
Detects “remember when…” / “earlier we…” / “go back to…” style triggers in the user message. Searches the archived (compressed-out) context for matches. Pulls the relevant archived turns back into the active prompt.
When to use it
- Long-running coding sessions where the user references work from days ago.
- Research agents revisiting earlier sources.
- Any session where
ipchas compressed something the user now wants to talk about specifically.
Dependency on ipc
The rehydrator reads from blob storage at evictions/{user_id}/* — the same path ipc writes archived turns to in cloud mode. If ipc isn’t in your pipeline (or it hasn’t archived anything yet) the rehydrator is a clean no-op. It logs nothing and adds no latency. You don’t need a guard.
Configuration
rehydrator:
triggerPhrases:
- 'remember'
- 'earlier'
- 'previously'
- 'before'
- 'last time'
- 'we discussed'
- 'we were'
maxRehydrated: 5 # cap on the number of archived turns re-injected
searchDepthDays: 90 # ignore archives older than this
similarityThreshold: 0.7 # cosine similarity floor for a candidate to qualify
blobPrefix: 'evictions' # change if you write archives to a different prefix
maxBlobsScanned: 50 # safety cap per requestAll fields are optional. Defaults shown.
Metrics emitted
rehydrator.matched(number) — turns actually injected (always set, often 0).rehydrator.trigger(string) — which trigger phrase fired (only when matched).rehydrator.scanned_blobs(number) — how many archives were inspected.rehydrator.scores(number[]) — cosine scores of the picked turns.
How it works
- Pre hook scans the latest user message for any configured trigger phrase. If none match, it short-circuits (sets
rehydrator.matched = 0, returns continue). - Lists archive blobs at
evictions/{userId}/. Sorts most-recent-first by key (timestamp leads the file name). - For each archive newer than
searchDepthDays, embeds each archived turn and computes cosine similarity vs. the current user message. - Keeps the top
maxRehydratedturns abovesimilarityThreshold, re-orders them chronologically, and injects them into the system prompt inside a<rehydrated-context>block so the model knows it’s looking at recovered context, not fresh user input.
Pipeline placement
Run it before patterns so any retrieved patterns can build on the rehydrated context:
PRXY_PIPE=ipc,rehydrator,patterns,semantic-cacheSource
Last updated on