Skip to content

An agent that starts from scratch each session repeats the same work. A feedback loop sends what the agent did and what it learned back to a source, so the next session, or another agent, starts closer to the answer.

A loop has three parts:

  1. Capture. At the end of each turn, Stash saves the turn to a queue on disk.
  2. Send. Stash sends each saved turn to each source that you made writable. It keeps the turn until the source accepts it, and tries again after a failure.
  3. Read back. The source turns what it got into records. The next session finds those records in the mount, like any other file.

A feedback loop. At the end of each turn, Stash captures the turn to a queue on disk. It sends each saved turn to each writable source, which turns it into records. The next session reads those records back from the mount.

Notes take the same path. A note that the agent saves can also go to a writable source. See Local memory.

A source is read-only until you give it a write table. That table says how Stash turns a turn into something the source stores:

  • An agentcore-memory source sends each prompt, reply, and tool call as an event of one actor. Amazon Bedrock AgentCore Memory strategies then make long-term records, such as summaries and facts.
  • A plugin source passes each turn to its plugin, and the plugin decides how to store it.

The same rule holds for each part of a source: its config decides what Stash reads from it, how it shows as files, and what Stash writes back. More than one source can be writable, and retention and deletion stay with each source.

With first-party sources. AgentCore Memory gives the loop the most: its strategies turn raw turns into summaries and facts, and the next session hydrates them. A plugin gets the same turns, and its own logic decides what to keep.

Start with an AgentCore Memory that has a strategy for the records you want. Configure AWS credentials with the read and write permissions. Create stash.toml, and replace REPLACE-ME with your memory ID:

mount_point = "/tmp/ops-context"
harnesses = ["claude"]
[sources.incidents]
kind = "agentcore-memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/REPLACE-ME"
auth = { sigv4 = {} }
write.trajectory.actor = "ops-agent"

Create and attach the mount:

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

Repeat stash status ops until it shows state: ready and the incidents source shows started. Then work on INC-4412 in the attached agent and end the turn.

AgentCore Memory processes the events asynchronously. After its strategy creates a record, start another session and search for it:

Terminal window
stash search ops "INC-4412" --path "/agentcore-memory/incidents/*"

Write-back sends the full text of each tool result, which can include a file that the agent read. Write back only to a source that may hold that data.

If a source refuses a write, the write waits on disk. Fix the cause, then send it again with stash redrive ops.