AGENT MEMORY · RETRIEVAL WORKBENCH

Incident recall: relevance versus recency

Follow real ranking calculations from stored memory cards through scope filters into a bounded context tray.

30-second inspection at 1× · actual TF-IDF cosine

Scroll the memory cards horizontally to inspect all ten records. The table below provides their full text and exclusion reasons.

Your experiment

Ask about a timeout with all stores enabled. Increase recency weight and compare the past incident with the current ticket. Newer does not necessarily mean stronger evidence.

Make a prediction, capture a baseline, change one policy and advance through all four stages. An empty context is a valid result; the table explains every exclusion.

Selected context

    The tray is populated at the final stage. No answer is generated: compare the selected source facts yourself.

    Inspect every record

    IDMemory textCosineBlended scoreOutcome

    Offline teaching model, not an ADK service implementation or a trained semantic encoder. The ten records and supporting-fact labels are synthetic fixtures. Retrieval uses lexical TF-IDF cosine; semantic refers to the type of stored fact, not neural similarity. Score = (1 − recency weight) × cosine + recency weight × 2^(−age/24h). Zero lexical matches are excluded. Greedy packing skips records that do not fit. Budgets count whitespace-separated words, not model tokens. Memory types, tenant rules, age limits and latest-key replacement are explicit application policies; no LLM accuracy, production capacity or privacy guarantee is measured. ADK memory concepts · Cosine similarity reference.

    Recall an incident without treating it as a rule

    An episodic record describes what happened in a particular event. M3 says a database timeout ended after reducing batch size. That history can be useful precedent, but does not establish that the same action will fix a new incident. The fixture contains one relevant past incident, a current working ticket, a procedural runbook and an unrelated meeting. It does not extract episodes, model causality, generate answers or check whether two incidents share the same root cause. The readings describe richer structured episodes and multi-source retrieval beyond this deliberately small lexical experiment.

    Watch recency displace the past incident

    Choose the timeout-incident Question, Team A and All stores. Enable previous sessions and latest-fact filtering, set age 168, budget 80 and maximum retrieved records one. At recency weight zero, M3 wins on lexical cosine, approximately 0.548. At weight one, M5 wins: its age is 0.1 hours, so its recency score is approximately 0.997. M5 is a current ticket, not the past incident. Select Episodic events while keeping weight one: M3 is selected because M5 belongs to a different store. M8 is a newer episode but has no shared query terms, so even a weight of one cannot admit it.

    Make missing precedent visible

    With Episodic events selected, maximum age 48 includes M3 and 47 excludes it. Restore age 168. A budget of ten words fits M3; nine yields an empty context. Restore budget 80 and disable previous sessions: M3 is excluded again, independently of its relevance. Re-enable previous sessions and switch to Team B: the Team A incident cannot cross the tenant boundary. The supporting-fact counter describes fixed fixture labels and does not measure incident diagnosis or answer accuracy. Use the full record text and exclusion reason to explain an empty tray.

    Scope before similarity

    Question selects one of four fixed queries. Active tenant is a hard filter: Team A and Team B cannot select one another's records. Memory store chooses semantic facts, episodic events, procedural steps, working context or all stores. Include previous sessions admits older conversations; disabling it leaves only current-session records. Maximum age is an inclusive retention boundary, measured in fixture hours. Keep latest fact per key excludes an older record whenever a newer record with the same tenant and key exists, even if other filters later exclude that newer record. It does not resurrect stale facts. These are application policies in a local example, not a tested production authorization or deletion service.

    Read the actual score

    The model lowercases words, removes a fixed stop-word list and computes log term frequency with smoothed inverse document frequency over ten fixed records. Cosine is the dot product divided by the two vector lengths. Recency weight blends that cosine with 2 raised to minus age divided by twenty-four hours. At zero, ranking uses only cosine; at one, it uses only recency, but records with no shared query terms remain excluded. This lexical method does not understand paraphrases or negation. A recent or high-scoring record can still be the wrong evidence. The table exposes each full text, cosine, blended score and exclusion reason.

    Pack and inspect

    Context word budget limits the sum of whitespace-separated record lengths. Maximum retrieved records imposes a separate count limit. Greedy packing visits ranked candidates, skips those too large for the remaining budget, and continues. It neither truncates records nor solves an optimal packing problem. The result is computed immediately. Play reveals stored records, scope filters, ranking and the final context over thirty inspection seconds at normal speed. Pause settles elapsed time and freezes it; Next stage pauses at the next ten-second boundary. Restart inspection preserves policy settings and speed while clearing playback. Speed offers quarter, half, normal and double pace; changing it settles time at the old pace first. Input changes restart inspection, and a hidden tab pauses. Reduced-motion preference prevents automatic playback after input changes.

    Keep a reproducible observation

    Capture baseline saves the visible preview and settings, Replace baseline refreshes them, and Clear baseline removes the comparison. Record selected record IDs and exclusions in the notebook; Export notes downloads your observations and the notebook survives reload. Expand experiment enters fullscreen; Exit full screen returns. The diagram and record table scroll horizontally by keyboard on a phone to preserve readable labels. Supporting-fact coverage counts declared fixture IDs; it is not a measured answer-quality score. No language model generates an answer, no embedding service is called, and no persistent bank is modified. Read the source text before treating a retrieved fact as true.