Skip to content

A folder that only grows becomes noise: old results, stale records, and files nobody will read again. Stash manages the workspace for you. It refreshes, expires, and compacts the files according to the mount config.

  • Refresh. After a time that you set, Stash fetches a record again and writes the new version in place. A tool result is never fetched again, because a call can change data.
  • Expiry. A file that nobody wrote or read for a time that you set leaves the mount. Stash learns which files the agent read from the tool calls of each turn.
  • Budget. The mount has a size limit, 1 GiB by default. When it is full, the files that were used least recently leave first.

Refresh and expiry are off by default. Notes never refresh or expire, and they don’t count against the budget.

A source record that leaves the mount stays in its source. The agent can search for it again when the source supports search. A list-only source can load it again at the next mount start when its hydration plan selects it. An expired tool result needs a new tool call, and the new result can differ.

With first-party sources. A memory record refreshes in place, because Stash can fetch it again by its ID. A tool result of an MCP server never refreshes: it only expires, and a new call makes a new one.

Give the ops mount a refresh of 30 minutes, an expiry of one day, and a budget of 512 MiB:

mount_point = "/tmp/ops-context"
refresh_interval_seconds = 1800
expiry_interval_seconds = 86400
cache_max_bytes = 536870912

Use a new ops mount because cache_max_bytes cannot change after creation. Create the mount and wait for it to become ready:

Terminal window
stash create ops --config stash.toml
stash status ops

Repeat stash status ops until it shows state: ready. You cannot change cache_max_bytes with stash update. For an existing mount, keep its current budget or re-create it only after you have saved any data that you need. The same status command shows how full the mount is:

Terminal window
stash status ops
# Typical output:
# Mount
# name: ops
# state: ready
# ...
# directory consumption: 12.4% (63.5 MiB of 512 MiB)

Trim it by hand when you want to:

Terminal window
stash compact ops --target-percent 50
stash compact ops --older-than 1d