1. Executive Summary
Strands Stash is a Rust daemon from the Strands Agents project that
mounts an agent's context sources as one directory of files: AgentCore
Memory records, Bedrock knowledge bases, web search, MCP servers and
plugins. A coding agent — Claude Code, Codex, Kiro, or a Strands app —
reads the mount with ls, cat and
grep, and asks the daemon to search or call a tool. Two
things in it are memory: a local store of notes the agent writes for
later sessions, and a write-back path that sends each turn to AgentCore
Memory, whose server-side strategies turn turns into records. It is
unrelated to Stash, a different project of the
same name.
Notable: the note is a checked artifact. The daemon refuses a note with an unknown section, a repeated one, none at all, or a body over 16,000 characters, and the refusal names the fix. A copy of each note goes to the memory under a key naming the store and the session, so a search from the same session leaves its own notes out and a search from the same mount names the local file, not a duplicate. Every send carries a client token, so a retry does not write twice.
Weak: nothing in the tree deletes a record from the memory. A note deleted by hand keeps its copy in the source. Correction is a whole-note overwrite with no history. The namespace filter is per-mount configuration that the project's own security guide calls a view, not a boundary.
Two marks are present and five withheld (section 9).
Licence. Apache-2.0 in LICENSE,
Cargo.toml, package.json and
pyproject.toml, with a NOTICE reading
"Copyright Amazon.com, Inc. or its affiliates" and no rider.
The daemon sends anonymous usage pings by default, which
TELEMETRY.md describes and
stash usage-analytics disable turns off.
SECURITY.md asks that suspected vulnerabilities go to the
AWS Vulnerability Disclosure Program or
aws-security@amazon.com, not a public issue.
2. Mental Model
Two kinds of memory sit in one mount, and they are owned differently.
A note is owned by Stash. The agent writes one per
topic, in four fixed sections — key facts, workflows, decisions,
diagnosis — and the daemon checks it and writes it as a read-only file
under local/memories/<session>/
(crates/backends/local/src/note.rs:135-182). Saving the
same topic in the same session replaces the whole file. Nothing in Stash
records the previous text.
A record is owned by AgentCore Memory. Stash sends
turns as events, and the memory's strategies, which run in the service
and not in this tree, extract summaries, facts and preferences into
namespaces. Stash reads them back into the mount at hydration and on
search. The mount is a cache of the source, and the docs say so:
retention and deletion stay with the source
(docs/user/guides/security.md:106-109).
The two meet when a source takes notes: each note becomes one record,
keyed by stash_key
(crates/stash-backend/src/events.rs:168-181), and that key
decides who sees it again.
Diagram source
%% caption: a note is a checked local file first and a source record second; reads are narrowed to the configured namespaces and drop the searching session's own notes
flowchart TD
A["save_note tool or<br/>stash note save"] --> B{"note check:<br/>sections, topic,<br/>16,000 chars"}
B -- "refused" --> R["error names<br/>the fix"]
B --> C["local/memories/<br/>session/slug.md<br/>0444, whole replace"]
C --> Q["queue log<br/>Record::Note"]
H["turn-end hook<br/>reads transcript"] --> Q
Q --> W["writer per<br/>writable source"]
W --> N["record in notes<br/>namespace, stash_key,<br/>updated in place"]
W --> E["CreateEvent as actor;<br/>strategies extract<br/>outside this tree"]
E --> M["records in<br/>namespaces"]
N --> M
S["stash search<br/>path + session"] --> F{"inside a configured<br/>namespace?"}
F -- "no" --> X["refused,<br/>nothing sent"]
F -- "yes" --> RT["RetrieveMemoryRecords<br/>with namespace"]
M --> RT
RT --> O{"note of the<br/>searching session?"}
O -- "yes" --> D["dropped"]
O -- "no" --> P["file in the mount,<br/>byte budget, expiry"]3. Architecture
A Cargo workspace of 16 crates. stash-daemon owns the
mounts and serves a control socket; stash-cli is the
stash binary, the hooks, the steering writer and the
stash mcp server; stash-core holds the
Index of what each mount has on disk, hydration and search.
The stash-sync crate is the write-back queue and its
writers; stash-backend defines the Source
trait and the shared record types; crates/backends/ holds
one crate per source kind — agentcore-memory,
gateway, local, mcp and
plugin. The Strands integration in
integrations/strands-memory-store/ is a Python and
TypeScript MemoryStore that drives the CLI.
Deployment and ergonomics
One daemon per user runs beside the agent, started by
stash create, on Linux or macOS on Apple silicon. It takes
AWS credentials from the shell that starts it and signs each source only
with what that source's auth names. A mount with no sources
serves the local store, so notes need no AWS account. The end-to-end
suite and the examples assume an AWS account with AgentCore Memory,
Gateway and Runtime.
4. Essential Implementation Paths
- Save a note.
save_noteorstash note save→ controlNoteSave→notes::savechecks the mount takes notes, runsnote::entry, writes the file under thefileslock, and builds aNoteCopyfor writable sources (crates/stash-daemon/src/notes.rs:12-51); the server then hands the copy to the registry, which appends aRecord::Noteto the session's log (crates/stash-daemon/src/control/server.rs:457-469,crates/stash-sync/src/notes.rs:215-222). - Send a note.
SourceWriter::send_notelooks up the record id it made before, skips a text older than the one sent, updates the record or creates one, and stores the id inrecords.json(crates/stash-sync/src/writer.rs:81-119);put_notemaps that toBatchCreateMemoryRecordsorBatchUpdateMemoryRecordsin the notes namespace (crates/backends/agentcore-memory/src/source.rs:223-243,crates/backends/agentcore-memory/src/ops/sdk.rs:265-319). - Send turns. The turn-end hook records the
transcript; the queue actor reads it from its last offset and appends
turns;
append_turnssends oneCreateEventper batch as the configured actor, under a token naming the memory and the actor (crates/stash-sync/src/capture/mod.rs:1-6,crates/backends/agentcore-memory/src/source.rs:197-221). - Search.
run_searchper path →stash_core::search: route the path to a source, widen the limit by the session's own notes, ask the source, drop own notes, place each hit as a file, and return paths with previews (crates/stash-daemon/src/search.rs:36-65,crates/stash-core/src/search.rs:53-155). - Hydrate. At mount start a memory source lists the
last seven days, up to 25 records per namespace, and runs four fixed
profile queries per namespace plus any configured prefetch
(
crates/backends/agentcore-memory/src/hydration.rs:15-125). - Start a session. The
SessionStarthook prints a pointer, a digest of what the mount holds, and — when no source keeps the notes — one line per note of other sessions (crates/stash-cli/src/commands/hook.rs:226-240,:294-343).
5. Memory Data Model
- Note
(
crates/backends/local/src/note.rs:92-133): a slug from the topic, a body, and an optional session. The file ismemories/<session>/<slug>.mdormemories/<slug>.md. A topic holds at most 200 characters, a body 1 to 16,000, and the only##headings allowed areKey facts,Workflows,DecisionsandDiagnosis, each at most once (:26-37,:260-302). A slug that would lose part of the topic ends with eight hex characters of its SHA-256, so two topics that fold to one slug keep two notes (:304-346). - Store id: 32 random hex characters in the data
root, made once, which every copy's key carries so two hosts with one
mount name do not collide (
:220-250). - NoteCopy
(
crates/stash-backend/src/events.rs:183-198): store, name, text andsaved_at; its key is<store>:<session>/<slug>. - MemoryEntry
(
crates/stash-backend/src/memory.rs:20-47): id, folder, title, text,created_at,updated_at, a metadata map, and a search tier.stash_keyin the metadata marks a note copy (:16-18). - Queue
(
crates/stash-sync/src/queue.rs:1-42): per stream, an ordered log ofTurns,IngestandNoterecords with a cursor per consumer. A record goes when every consumer has passed it, so the log is a buffer, not a history.
No field carries a status, a confidence or a validity interval. The
note template asks the agent to write
(true when: …; evidence: …) and
hypothesis [open|confirmed|refuted] as text
(crates/stash-prompts/templates/notes/note_body.md:1-15).
6. Retrieval Mechanics
The agent's first retrieval is the file system: it reads
_sources/ pages, lists folders and greps. The local store
declares no search capability, and the code says why — the agent greps
the notes (crates/backends/local/src/lib.rs:49-53).
stash search (or the search MCP tool) takes
a query and one or more paths. For an AgentCore source,
scopes_of sends the requested namespace when a configured
one encloses it, sends each configured namespace the request encloses,
and refuses otherwise without a call
(crates/backends/agentcore-memory/src/source.rs:40-63).
Each scope is one RetrieveMemoryRecords call with
namespace or namespacePath
(crates/backends/agentcore-memory/src/ops/sdk.rs:182-202);
the hits are merged by the service's score, deduplicated by id and cut
to the limit, then each gets a tier and query-term weights for its
preview (source.rs:139-169). Ranking is the service's
semantic search; Stash adds no lexical arm.
stash_core::search then drops each hit that is a note of
the searching session, places the rest as files, and records the query
words against each file for the next session-start digest
(crates/stash-core/src/search.rs:104-141). A hit that is a
copy of this mount's own note names the local file instead of writing a
second one
(crates/stash-core/src/index/mod.rs:206-221).
Hydration loads records before the first turn. Beside the configured
prefetch, it runs four profile queries in every namespace at every mount
start — preferences, goals, job, and "health conditions, diagnoses,
allergies, or medications" — and the code states that a config
cannot turn them off
(crates/backends/agentcore-memory/src/hydration.rs:15-29).
7. Write Mechanics
Notes. A save blocks the agent for the check and one
atomic rename of a mode-0444 file
(crates/backends/local/src/note.rs:158-182), so the note is
on disk when the call returns. The copy to a source goes through the
queue asynchronously; a crash between the save and the append keeps the
note only in the mount, which the code marks as a known shortcut
(crates/stash-daemon/src/control/server.rs:461-463). A note
request reaches the agent through a hook after 45,000 tokens of new
session text at four characters per token, and the count restarts on any
save (crates/stash-sync/src/notes.rs:22-26,
:83-133). The steering tells the agent to read a note
before changing it and write it in full
(crates/stash-prompts/templates/steering/note_taking.md.j2:41-45).
Turns. The hook queues each turn on disk and
returns; it never exits 2 (docs/design/decisions.md:204).
The daemon sends batches as events of one actor, splitting a turn over
100,000 bytes (crates/stash-sync/src/writer.rs:182,
:235-262). Each tool request and each full tool result is
an event. The lag before a record exists is the strategy's, in the
service.
No background pass rewrites notes. Records in the mount are refreshed
from the source on a per-source interval and evicted least recently used
past the byte budget
(crates/stash-core/src/index/eviction.rs:33-50,
crates/stash-core/src/index/expiry.rs:14-29). Notes count
against neither.
Operational cost
Each mount start costs one list per namespace and four searches per
namespace plus configured prefetch. Each search costs one retrieve call
per namespace it spans, up to five. Write-back costs one
CreateEvent per batch and one record call per note
save.
8. Agent Integration
stash attach writes a generated steering block into
CLAUDE.md, AGENTS.md or a Kiro steering file,
installs hooks, and by default registers the stash MCP
server, whose own tools are search, status and
save_note, beside each source tool as
SOURCE__TOOL
(crates/stash-cli/src/commands/mcp.rs:30-36,
:212-227). Without MCP, the agent runs the same verbs as
shell commands. The Strands StashMemoryStore implements
search through the CLI and add_messages through its ingest
command, with a session id that names the note folder
(integrations/strands-memory-store/python/src/stash_strands/memory_store.py:99-140).
The agent has no delete verb for a note or a record. It can save a
note and search; a person can edit or remove a note file by hand, and
the daemon leaves the edit in place until the next save
(crates/stash-daemon/src/notes.rs:304-330).
9. Reliability, Safety, and Trust
Deletion stops at the mount
No product path deletes an AgentCore record: the only
delete_memory_record call is in the end-to-end crate's
provisioning helper
(crates/stash-tests/src/provision.rs:840-842). The security
guide states the boundary: stash delete --remove-data
removes only the local copy
(docs/user/guides/security.md:106-109). A note file deleted
by hand stays deleted in the mount
(crates/stash-daemon/src/notes.rs:304-316), and its copy in
the notes namespace remains a record that another session's search
returns.
Namespaces narrow, they do not guard
The namespace check is real code on the read path, and the project
says what it is not: "These keys aren't a security boundary"
(docs/user/guides/security.md:23-26). The daemon runs as
the agent's user, and the agent has a shell that can run
stash update. The boundary is the IAM policy of the
credentials the daemon was started with. Notes have no access control:
each agent that reads the mount point reads each note
(docs/user/guides/security.md:96-98).
What write-back sends
A tool result's full text is an event, so a file the agent read reaches the memory; the docs say to write back only to a memory that may hold it. The four profile queries pull health and job records into files at every mount start for any memory that holds them.
Idempotency
Every create carries a client token over the memory and the actor or
namespace, a retry sends the same one, and the writer refuses to send a
note text older than the one the source has
(crates/stash-sync/src/writer.rs:94-97). A removal refuses
to discard an unsent write unless forced
(docs/design/decisions.md:105-115).
Marks
scope_enforced— present. A search outside every configured namespace is refused before any call, and each list and retrieve sends the namespace; per-mount, applied by the service, and not on get by id.negative_eval— present. An in-process search over three note copies must return a different session's note and not the searching session's, with a control search returning the excluded one.tombstone— withheld. A replaced note's text is gone, and nothing records a value the agent or a person rejected; a deleted note's copy is not even removed.trust_state— withheld.hypothesis [open|confirmed|refuted]is a line in a prompt template; no code parses or filters it.bitemporal— withheld.(true when: …)is prose in the same template; records carrycreated_atandupdated_atonly.audit_log— withheld. The queue is trimmed once every consumer passes a record, and a note save overwrites with no history.human_review— withheld. Notes and turns land with no pending state; a person can edit a note file after the fact, which is authoring.
10. Tests, Evals, and Benchmarks
The Rust suite has 2,346 test functions. make test-unit
runs every crate but the end-to-end one, plus the Python tests of two
examples, and CI runs it on Linux x86-64, Linux arm64 and macOS with no
AWS credentials (Makefile:37-42,
.github/workflows/ci.yml:40-91). The end-to-end crate's 202
cases run in CI against a provisioned memory and gateway, behind an
approval gate for pull requests; a missing test resource skips locally
and fails in CI (crates/stash-tests/src/lib.rs:32-48).
The negative case worth reading is
a_search_of_a_session_leaves_out_its_own_notes_and_they_take_no_place_in_the_limit
(crates/stash-core/src/tests/mod.rs:1693-1746): a fake
source holds three note copies, a session search with limit 1 must
return the second, and a search with no session must return the first.
The live twin saves a note, waits for its record, and asserts another
session finds it and the saving session does not
(crates/stash-tests/tests/harness/notes.rs:449-492).
The AgentCore namespace tests assert request shape against a fake
that answers per scope
(crates/backends/agentcore-memory/src/source.rs:472-562),
which is weaker: no case puts a record of another namespace in reach and
asserts it absent.
Cases to want first: a search from a namespace-limited mount over a memory holding another actor's record; a note deleted by hand, then a search from another session.
I ran none of them. No paper describes Stash; there is no
CITATION.cff.
11. For Your Own Build
Steal
- Check the note in code, and make the refusal the instruction. Fixed sections, length bounds and a message naming the allowed headings keep a model's notes greppable across sessions.
- Key a copy by store and session. One key lets a search drop the searcher's own notes and lets the saving mount show its file, not a duplicate.
- Client tokens over the destination. A token per memory and actor or namespace makes retries and two writers safe without a lock.
- Fail the skip in CI. A live test that skips locally and asserts in CI closes the suite-that-skips-itself gap.
Avoid
- Do not ship write-back without a delete. A copy written by the tool should be removable by the tool, or a note deleted by hand returns through search.
- Do not hard-wire sensitive prefetch. A profile query for health records that no config can turn off moves that data into files on every start.
Fit
Fits a team on AWS that has an AgentCore Memory and wants several coding harnesses to read it, search it and feed it, with the agent's notes surviving compaction. The design pays off when the source does the extraction and the access control.
Walk away if you need the memory layer itself to correct, retract or forget values, to separate users on one host, or to run without AWS beyond the local notes.
12. Open Questions
- Whether a note delete verb, or a delete of the copy when the file is gone, is planned.
- Whether
getby record id is meant to stay outside the namespace check. - Whether the health profile query is meant to run for memories that hold no such records, at the cost of one call per namespace per start.
Appendix: File Index
- Notes:
crates/backends/local/src/note.rs,crates/backends/local/src/lib.rs,crates/stash-daemon/src/notes.rs,crates/stash-daemon/src/control/server.rs - AgentCore source:
crates/backends/agentcore-memory/src/source.rs,crates/backends/agentcore-memory/src/ops.rs,crates/backends/agentcore-memory/src/ops/sdk.rs,crates/backends/agentcore-memory/src/config.rs,crates/backends/agentcore-memory/src/hydration.rs - Search and cache:
crates/stash-core/src/search.rs,crates/stash-core/src/index/,crates/stash-core/src/write.rs,crates/stash-daemon/src/search.rs - Write-back:
crates/stash-sync/src/queue.rs,crates/stash-sync/src/writer.rs,crates/stash-sync/src/notes.rs,crates/stash-sync/src/capture/ - Records:
crates/stash-backend/src/memory.rs,crates/stash-backend/src/events.rs - Agent surface:
crates/stash-cli/src/commands/mcp.rs,crates/stash-cli/src/commands/hook.rs,crates/stash-prompts/templates/,integrations/strands-memory-store/ - Design:
docs/design/decisions.md,docs/user/guides/security.md - Tests:
crates/stash-core/src/tests/mod.rs,crates/stash-tests/tests/harness/notes.rs,crates/stash-tests/src/lib.rs
Recorded searches
Run from the repository root at the pinned commit with
/usr/bin/git grep. There is no
.gitmodules.
- No product path deletes a record.
git grep -n -i -E 'delete_?memory_?record|DeleteMemoryRecord|delete_record|BatchDelete' -- .returnscrates/stash-tests/src/provision.rs:840-842and three cleanup calls incrates/stash-tests/tests/harness/notes.rs, all test code. - No rejected-value record.
git grep -n -i -E 'tombstone|blocklist|denylist|reject(ed)?_value|suppress' -- 'crates/*.rs'returns one logging-test string,crates/stash-cli/src/logging/tests.rs:448. - No audit record.
git grep -n -i audit -- cratesreturns nothing; the same pattern over the tree matches two skill files outsidecrates/. - Hypothesis status is prose.
git grep -n -i -E 'confirmed|refuted' -- 'crates/*.rs' 'crates/*.j2' 'crates/*.md'returns the note template, two steering lines, and three unrelated test strings. - No validity field.
git grep -n -i -E 'valid_from|valid_until|valid_to|validity|true when' -- 'crates/*'returns the note template, one note-format test fixture, and two doc comments that use "True when" as English. - No paper.
CITATION.cffis absent;git grep -n -i -E 'arxiv|doi\.org|bibtex' -- .returns a tool name in an MCP naming test,crates/stash-cli/src/commands/mcp.rs:698-699.
History
2026-12-04 — d2de98fb….
First reading, from the 2026-12-04 triage shortlist, at the head of
main. Screened: 44 files scanned; no auto-run surface; 31
dependency surfaces inside the cooldown, a count the depth-1 clone
inflates; two build-time execution points; eight unpinned surfaces;
AGENTS.md, CLAUDE.md and the
.agents/ tree read as data. Nothing was installed, built or
run, and none of the 2,346 Rust test functions was run. Two marks (section 9).