Memory Freshness Decay

Updated at:
Copy as MD

Memory freshness decay applies a recency bias to search results. Recently used memories rank higher, while memories that have not been accessed for a long time rank lower. This helps agents prioritize the most current and relevant information when user preferences or states change over time.

Problems addressed

Without freshness decay, search result ranking may cause the following issues:

  • User preferences change, but old memories rank equally with current ones. The agent sometimes retrieves outdated information.

  • The longer the memory store is in use, the more stale content accumulates. Search results become diluted with historical information.

  • Recent and stale memories have no ranking difference, which does not match the business expectation of prioritizing current state.

Capabilities

Capability

Description

Recency priority

Memories that were recently retrieved by search rank higher. The agent is more likely to receive currently relevant information.

Stale memory downweighting

Memories that have not been used for a long time rank lower but remain retrievable. They are not removed.

Zero-modification integration

After you enable this feature, the search endpoint works without any code changes. The effect is applied automatically.

Toggle on and off

When disabled, ranking immediately returns to the original behavior with no residual effects.

Immediate effectiveness

The system continuously tracks memory usage. When you enable this feature, usage data is already available. No warmup is required.

Use cases

  • User profiles that evolve over time: dietary preferences, travel habits, device settings, and communication styles.

  • State-oriented assistants: in-vehicle systems, smart home, and personal assistants that need to reflect the user's current state.

  • After prolonged use of the memory store, search results should naturally favor recent information.

Note

Not suitable for: memory stores that consist primarily of long-lived facts such as archives or knowledge bases with infrequent repeated recall. Enabling decay for these memories may cause their rankings to drop. Evaluate carefully before enabling.

Evaluation results

A realistic evaluation verified the effectiveness of freshness decay. The evaluation simulated a user interacting with a personal assistant over 30 days, during which the user's life circumstances, preferences, and activities changed continuously. The assistant needed to return the most current and valid information at all times.

Key result: enabling freshness decay improved the accuracy of preference-change questions by 13.1%.

Question type

Disabled

Enabled

Improvement

Preference changes ("What do I currently prefer")

57.5%

76.8%

+19.3%

Usage

Operation

Endpoint

Description

Enable or disable decay

POST /configure

Configuration is persisted and survives restarts. Disabled by default.

View configuration

GET /config

Returns the current instance configuration.

View memory usage stats

GET /memories/{memory_id}/stats

View the last access time of a memory to understand its ranking position.

Enable decay:

curl -sS -X POST "${MEMORY_URL}/configure" \
  -H "Authorization: Token ${MEMORY_API_KEY}" \
  -H "Content-Type: application/json" \
  -d '{"enable_recency_decay": true}'

View the current configuration:

curl -sS "${MEMORY_URL}/config" \
  -H "Authorization: Token ${MEMORY_API_KEY}"

View the usage stats of a memory. You can obtain the memory_id from the memory list or search results.

curl -sS "${MEMORY_URL}/memories/${MEMORY_ID}/stats" \
  -H "Authorization: Token ${MEMORY_API_KEY}"

Sample response:

{"memory_id": "xxxxxxxx", "access_count": 12, "last_accessed_at": "2026-08-15T10:30:00+08:00"}

access_count is the cumulative number of times the memory was retrieved by search. last_accessed_at is the most recent time the memory was used. Together, they determine the current freshness ranking of the memory.

Note

After you enable this feature, all search requests automatically apply freshness-based ranking. No changes to search calls are required. Decay only adjusts ranking and does not filter results. No memory disappears from results due to decay. Only the ranking changes.

Best practices

  • Enable decay first for preference and state scenarios. Applications where user profiles evolve over time benefit the most.

  • Enable decay cautiously for long-lived fact scenarios. Archive-type memories that are rarely recalled may see their rankings drop. Validate on a small scale first.

  • Decay is not deletion. Decay only changes ranking. It does not delete any memories. To remove a memory from search entirely, use memory forgetting.

  • Observe the effect on your own workloads. After you enable decay, compare the top results for a set of typical queries. Use GET /memories/{memory_id}/stats to check the usage stats of individual memories and understand their ranking positions.

  • Combine with memory forgetting. Decay promotes recent information to the top. Forgetting removes long-idle information from search. Together, they keep the memory store both well-ordered and lean.