Skip to content

Configuration reference

Stash reads one TOML file for each mount. The parser refuses unknown keys and values of the wrong type, and names the closest known key. Use stash configure to edit a file with a wizard, or write it yourself. For the commands, see the command reference.

schema/stash.schema.json is the JSON Schema of the file. The unit suite makes it from the types that read the file. An editor that uses Taplo, such as the Even Better TOML extension for VS Code, checks and completes a config when the first line names the schema, relative to the file:

#:schema ./schema/stash.schema.json
mount_point = "/tmp/stash"

The schema checks keys, types, and most rules between keys. Stash also checks the rules that a schema cannot state, for example that each prefetch reads one of the namespaces of its source.

mount_point = "/tmp/stash"
[sources.team-memory]
kind = "agentcore-memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/example-memory-0123456789"
auth = { sigv4 = {} }

This config shows an AgentCore Memory with no write-back, and signs with the AWS credentials of the host. See the read-only, writable, and full examples. The full example has each kind and most keys.

KeyTypeRequiredDefaultDescription
versionintegerno1The version of the config shape. Stash reads only its own version: another value fails at its line.
mount_pointstringoutside AgentCore RuntimenoneThe folder of the mount. See the rules below. AgentCore Runtime ignores it.
sourcestablenononeUp to 25 sources, by name.
refresh_interval_secondsintegerno0See the cache.
expiry_interval_secondsintegerno0See the cache.
cache_max_bytesintegerno1073741824 (1 GiB)See the cache.
telemetrytablenometrics file onlySee [telemetry.export].
harnesseslist of stringsno[]The harnesses that attach installs into: claude, codex, or kiro, each at most once. With none, attach exits 1. kiro is the Kiro v3 engine.
extractiontablenooffSee Note requests.

mount_point rules, outside AgentCore Runtime:

  • It is an absolute POSIX path, with no ~ and no template variable. Stash does not expand ~ or resolve a relative path.
  • It cannot be inside, or hold, STASH_DATA_ROOT or the mount point of another mount.
  • If it exists, it is an empty folder, or a folder of this mount.

stash update cannot change mount_point, cache_max_bytes, or [telemetry] (stash update).

refresh_interval_seconds = 1800
expiry_interval_seconds = 86400
cache_max_bytes = 1073741824
KeyMeaning
refresh_interval_secondsSeconds after a fetch when Stash fetches the record again and writes the file again. 0 turns it off: a file changes only when a search or the hydration returns it again. Only a source that can get one record by its ID refreshes. A tool result never refreshes.
expiry_interval_secondsSeconds after the last write or read of a file when the file leaves the mount. 0 turns it off. A listing, the hydration, a search, a tool call, or a read in an agent turn starts the clock again. A refresh does not. It applies to each source and to tool results.
cache_max_bytesThe most bytes that the files of the sources and the tool results hold on disk. When it is full, the least recently used files leave until the cache holds at most 80%, or less when a large new file needs the room. A tool result file over 25% of it (256 MiB by default) is not written. The minimum is 10000000 (10 MB).

Each source can set its own refresh_interval_seconds and expiry_interval_seconds, also 0 to turn one off under a top-level value. The platform clock must be able to add each interval to now.

Stash finds the reads of the agent in the tool calls of each turn that a harness reports. It can miss a read, so set an expiry longer than the time between two reads of a file. After a restart, both clocks start from the last write of the file. An agent finds a file that left again with a search, and a tool result with a new call. To remove files now, use stash compact.

Each mount writes its metrics to mounts/NAME/metrics/metrics.jsonl in the data root, as OTLP JSON lines. Stash compacts the file each day and keeps 14 days. This table also sends the metrics and the traces to an OpenTelemetry collector, at {endpoint}/v1/metrics and {endpoint}/v1/traces.

[telemetry.export]
endpoint = "https://collector.example.com:4318"
timeout_seconds = 10
auth = { bearer = { env = "OTLP_TOKEN" } }
signals = ["metrics", "traces"]
KeyTypeRequiredDefaultDescription
endpointstringyesnoneThe base URL of an OTLP/HTTP collector: https, or http on the loopback.
timeout_secondsintegerno10The time limit of one post, from 1 to 120.
authtableno{ none = {} }The header of each post. See below.
signalslist of stringsno["metrics", "traces"]metrics, traces, or both, each once.
authHeader
{ none = {} }none
{ bearer = { env = "VAR" } } or { bearer = { file = "/path" } }Authorization: Bearer <secret>
{ header = { name = "x-api-key", env = "VAR" } } or { header = { name = "x-api-key", file = "/path" } }name: <secret>

env and file follow the rules of secret values. A post whose secret cannot be read is not sent, and the daemon log says so once. The metrics file still gets each snapshot.

Each search and tool_call is one trace, with the spans operation (the root), call (one source), api, and request (one request to a service). A span holds only stash.mount, stash.operation, stash.source.kind, stash.source.name, stash.source.operation, and stash.outcome. A span whose outcome is not ok or unsent has the status Error.

MetricUnitAttributesCounts
stash.operation.requests{request}stash.operation, stash.response.classOperations: search and tool_call.
stash.operation.durationsthe sameHow long they took.
stash.backend.requests{request}stash.source.kind, stash.source.name, stash.source.operation, stash.response.classRequests to a service, by API.
stash.backend.durationsthe sameHow long they took.
stash.content.retrievedBystash.operation, stash.source.kind, stash.source.nameWhat a source returned.
stash.content.surfacedBythe sameWhat the answer showed of it.
stash.content.estimated_tokens_deferred{token}the sameThe estimated tokens that the answer left out.
stash.content.agent_readBystash.source.kind, stash.source.nameThe estimated bytes of source files that the agent read. Each tool call that reads a file adds the whole file. The estimate can miss a read or count one that did not happen.

A tool result with isError counts as 2xx for its backend request, because the server answered. Its tool_call, or the search of a Gateway source, gets the class of the failure: a text format that Stash knows gives its kind, so a bad query is 4xx, and any other text is 5xx (why).

Each source is one table, [sources.NAME]. Its kind says what it reads. The source shows at KIND/NAME/ below the mount point, with a folder for each part of the kind: [sources.web] of kind gateway.web-search is at gateway/web-search/web/.

KindReads
agentcore-memoryAn AgentCore Memory, directly or through a Gateway.
mcpThe tools of an MCP server.
pluginA store that a program serves over the plugin protocol.
gateway.web-searchThe web, through the WebSearch tool of a Gateway.
gateway.bedrock-knowledge-basesA Bedrock knowledge base, through the Retrieve tool of a Gateway.
gateway.aws-contextAn AWS Context knowledge graph, through the AgenticRetrieve tool of a Gateway.

A name has 1 to 255 bytes of ASCII letters, digits, -, _, and .. It is not ., .., or local. Two sources of one kind whose names differ only in case, such as Team and team, do not start: a file system that ignores case, such as the default one on macOS, makes their folders one. An unknown kind is an error that names the closest kind. The local store is not one of the 25 sources.

Each kind takes these keys:

KeyTypeRequiredDefaultDescription
kindstringyesnoneThe kind.
descriptionstringnoemptyThe description in the _sources/NAME.md page.
refresh_interval_secondsintegernothe top-level valueSee the cache.
expiry_interval_secondsintegernothe top-level valueSee the cache.

A key that the kind does not have is an error with the line and path of the key, for example line 14, sources.team.arm, and the closest key.

auth holds exactly one of sigv4, bearer, or none. With no auth, a source sends no credential, as with none. A Gateway with AWS_IAM or CUSTOM_JWT inbound auth then refuses each request, and the error says to add auth.

auth = { sigv4 = {} }
auth = { sigv4 = { profile = "my-profile" } }
auth = { bearer = { env = "STASH_GATEWAY_TOKEN" } }
auth = { bearer = { file = "/home/me/.config/stash/gateway-token" } }
auth = { none = {} }
KeyTypeDescription
auth.sigv4.profilestringThe AWS profile to sign with. Absent: the default chain of the host. See AWS credentials.
auth.bearer.env or auth.bearer.filestringExactly one: the secret value of the token. Stash sends Authorization: Bearer <token> with each request.

The config holds the name of a variable or the path of a file, never the secret.

FormRule
env = "VAR"A nonempty name. The value comes from the environment of the daemon, which is fixed when it starts. A new value needs stash daemon stop and a new start. Use it for a secret that lives as long as the daemon, as in a container or a CI job.
file = "/path"An absolute path with no ~. Stash reads the file for each request, and removes the spaces and line ends around the value. A missing or empty file fails that request. Use it for a token that expires. Write the file atomically (to a temporary file, then rename), and give it mode 600.

The keys of each Gateway source.

KeyTypeRequiredDefaultDescription
gateway_urlstringyesnoneThe URL of the Gateway, with a path.
regionstringconditionalfrom the hostThe signing region. SigV4 only. A custom host name with SigV4 needs it.
authtablenononeEndpoint auth.
headerstableno{}See Gateway endpoint headers.

An AgentCore Gateway serves MCP at /mcp, so a URL with no path, such as https://<id>.gateway.bedrock-agentcore.us-east-1.amazonaws.com, is refused. The error gives the URL with /mcp. A mount whose stored config has such a URL fails when the daemon restores it. Fix the URL, and run stash create again.

headers adds headers to each request, for example an identity token that a Gateway target passes on with allowedRequestHeaders:

headers = { X-ID-Token = { file = "/run/stash/id-token" }, X-Tenant = { env = "TENANT_ID" } }

Each key is a header name. Each value is a table with exactly one secret value, env or file. SigV4 signs each header.

Names are not case-sensitive, so two names that differ only in case are refused. Stash also refuses the names that the request sets itself:

  • authorization (use auth);
  • accept, user-agent, mcp-session-id, and mcp-protocol-version;
  • each name that starts with x-amz- or proxy-;
  • host, the content headers, and the hop-by-hop headers.
sigv4Signs with
{ profile = "x" }Profile x only: its static keys, credential_process, a role that it assumes (role_arn with source_profile or credential_source), web identity, or SSO. Never AWS_ACCESS_KEY_ID or instance metadata. A profile that is missing from the AWS config files fails each request, and the error names it.
{}The default chain of the host: environment keys, the profile files, web identity, the container credentials endpoint, then instance metadata. On AgentCore Runtime, this is the execution role.

To assume a role, name a profile that assumes it. For example, on AgentCore Runtime, ship this file, and set AWS_CONFIG_FILE to its path:

[profile reader]
role_arn = arn:aws:iam::123456789012:role/stash-reader
credential_source = EcsContainer

The daemon gets a credential once, and again when it is less than five minutes from expiry. If a refresh fails, the daemon keeps a credential that has not expired. Static and environment keys do not refresh. For a daemon that runs for hours, use SSO, assume-role, credential_process, or an instance role. The daemon gets its environment once, from the command that starts it (The daemon).

When a source refuses a write-back, for example because a credential expired, the daemon tries again with backoff. Then it moves the write to the terminal/ folder of its writer. stash redrive sends it again.

An mcp source with command and a plugin source run a program as your user. The program gets only these variables of the daemon, when it has them: PATH, HOME, USER, LOGNAME, SHELL, TERM, LANG, TMPDIR, HTTP_PROXY, HTTPS_PROXY, and NO_PROXY (also in lowercase). So it does not get the AWS keys or the tokens of the daemon. It can still read each file that you can read: run only a program that you trust.

Give it each other variable in env:

ValueThe program gets
"text"The text. Use it for a setting, not a secret.
{ from_env = "NAME" }The variable NAME of the daemon, fixed when the daemon starts.
{ file = "/path" }The contents of the file, trimmed. An absolute path with no ~.
{ command = ["program", "arg"] }What the program prints, trimmed, such as a secret from a password manager. A program that fails, prints nothing, or runs more than 30 seconds stops the start, and the error does not show its output.

Stash reads each value when it starts the program. A new value reaches the program at its next start. A variable that is not set, or a file that cannot be read, stops the start, and the error names the variable.

Write-back is off unless a source has a write table. Each table turns on one write, and each works without the other:

[sources.team-memory]
kind = "agentcore-memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/example-memory-0123456789"
auth = { sigv4 = {} }
write.trajectory.actor = "alice" # write each turn back, as alice
write.notes.namespace = "/notes/alice/" # keep a copy of each note here
KeyKindsDescription
write.trajectory.actoragentcore-memorySends each turn and tool call of the agent, as this actor.
write.notes.namespaceagentcore-memoryKeeps a copy of each note of the local store in this namespace.
write.trajectory = {}pluginSends each turn to the plugin.

No other kind writes back. Each value can be a literal or a template. More than one source can write back, and each gets each turn. To change a write table of a mount, run stash update.

A notes namespace is one or more parts of letters, digits, -, _, and :, each after a /, then a last /, for example /notes/alice/. A part does not start or end with :, or hold ::. It has at most 1,024 characters.

The source keeps one record for each note, and each new text of the note updates it. The record has the metadata stash_key = "STORE_ID:SESSION/SLUG", or "STORE_ID:SLUG" for a note with no session. The mount that saved the note shows it only as its file in local/memories/. Another mount shows the copy as any record.

Each user prompt is a USER turn, and each reply is an ASSISTANT turn, in plain text. Thinking blocks and empty messages are not sent. Each tool request and result is a TOOL turn, as one JSON object:

{"type":"tool_use","name":"Bash","input":{"command":"ls"}}
{"type":"tool_result","name":"Bash","is_error":false,"output":"Cargo.toml\ncrates"}

A tool result holds all of the text that the tool returned, for example the whole text of a file that the agent read. Claude Code results drop images and tool references. A Codex result has no is_error. A turn over 100,000 bytes goes in more than one piece. Write back only to a memory that may hold the files and the command output of the session.

[sources.team-memory]
kind = "agentcore-memory"
description = "Team long-term memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/example-memory-0123456789"
write.trajectory.actor = "alice"
namespaces = ["/actor/alice/*"]
auth = { sigv4 = { profile = "my-profile" } }
KeyTypeRequiredDefaultDescription
arnstringyesnonearn:aws:bedrock-agentcore:REGION:ACCOUNT:memory/MEMORY_ID.
namespaceslist of stringsno["/*"]See Memory namespaces.
prefetchlist of tablesnorecent recordsSee Memory prefetch.
writetablenononeSee Write-back.
endpointstringconditionalthe AWS SDK endpointThe URL of each call: https, or http on the loopback. Required with bearer or none.
regionstringnosee belowThe region of the calls. Only with sigv4.
authtableconditionalnoneEndpoint auth. The Memory API needs sigv4.
headerstableno{}Headers. Only with bearer or none.

The region is region; else the region that the endpoint host names, such as us-east-1 in bedrock-agentcore.us-east-1.amazonaws.com; else us-east-1 for a loopback host; else the region of arn.

  • sigv4 uses the AWS SDK. With no endpoint, the SDK uses the endpoint of the region: the regional endpoint, AWS_ENDPOINT_URL_BEDROCK_AGENTCORE, AWS_ENDPOINT_URL, or the endpoint_url of the profile.
  • bearer and none send each call over HTTP to endpoint.

Stash refuses a call to the Memory API without sigv4: no endpoint, or an endpoint with the host bedrock-agentcore.<region>.amazonaws.com.

A memory through the agentcore-memory connector target of a Gateway takes the Gateway URL, then the target name:

[sources.org-memory]
kind = "agentcore-memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/org-memory-9876543210"
endpoint = "https://example.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp/org-memory"
auth = { bearer = { env = "STASH_GATEWAY_TOKEN" } }

A memory through a VPC endpoint signs with SigV4:

endpoint = "https://vpce-0123456789abcdef0.bedrock-agentcore.us-east-1.vpce.amazonaws.com"
auth = { sigv4 = {} }

namespaces limits what one memory source shows and searches.

namespaces = ["/actor/alice/notes/*", "/actor/alice/facts/*"]
  • A list has one to five entries.
  • An entry that ends in /* is a subtree. One without /* is one namespace. A wildcard is allowed only as the last /*. The leading / is optional.
  • Entries do not overlap: /actor/alice/* overlaps /actor/alice/facts/*.

A search at the folder of the source, or a /* search above a namespace, searches each namespace below it, and keeps the best --top-k hits. With the example, --path '/agentcore-memory/team-memory/actor/alice/*' searches both entries. A path outside each entry, such as /agentcore-memory/team-memory/actor/bob/*, fails, and the error names the namespaces.

prefetch selects the records to load when a mount starts. With no prefetch, Stash lists the records of the last seven days in each namespace, up to 25. prefetch = [] turns off the listings. Stash still runs its built-in profile queries.

[[sources.team-memory.prefetch]]
from = "/actor/alice/facts/*"
query = "deployment patterns"
limit = 5
where = [
{ field = "createdAt", op = "gt", value = "now-30d" },
]
KeyTypeRequiredDefaultDescription
fromstringyesnoneThe namespace scope. It must be in one of namespaces.
querystringnonone: a listingA semantic query.
limitintegernono limit for a listing, 10 for a queryThe most records, at least 1.
wherelist of tablesnononeServer-side filters.
where keyValues
fieldcreatedAt
opgt, gte, lt, lte, eq
valueAn RFC 3339 time, or now-Nd, now-Nh, or now-Nm with N a positive whole number. Stash resolves a window at each mount start.

A gateway.CONNECTOR source uses one AgentCore Gateway connector target. When the source starts, Stash lists the tools of the target. Each tool is a file under _tools/, and stash tool call can call it.

[sources.web-search]
kind = "gateway.web-search"
description = "Live web search"
gateway_url = "https://example.gateway.bedrock-agentcore.us-east-1.amazonaws.com/mcp"
target = "web-search-tool"
auth = { sigv4 = { profile = "my-profile" } }

Each connector takes the keys of a Gateway endpoint, and these:

KeyTypeRequiredDefaultDescription
targetstringyesnoneThe connector target, with no whitespace, /, ?, or #.
protocol_versionstringno2025-11-25The MCP version that the client sends. Set it only when the target needs one.
KindOwn keys
gateway.web-searchfetch_pages (boolean, default true): fetch each https page that a result cites, and write it as markdown in the file of the hit. If a fetch fails, the file holds the passages of the search.
gateway.bedrock-knowledge-basesNone. The target names the knowledge base and sets the number of results.
gateway.aws-contextcontext_graph_id (string, required): the knowledge graph to search. The target must take the USER and ASSISTANT roles in AgenticRetrieve.

An mcp source uses a Model Context Protocol (MCP) server: a remote server at url over Streamable HTTP, or a local server that Stash runs as command over stdin and stdout. When the source starts, Stash lists the tools. Each tool is a file under mcp/NAME/_tools/ that holds its JSON schema.

[sources.issues]
kind = "mcp"
description = "Issue tracker tools"
url = "https://mcp.example.com/mcp"
auth = { bearer = { env = "ISSUES_MCP_TOKEN" } }
[sources.github]
kind = "mcp"
description = "GitHub tools"
command = "npx"
args = ["-y", "@modelcontextprotocol/server-github"]
env = { GITHUB_PERSONAL_ACCESS_TOKEN = { file = "/home/me/.config/stash/gh-token" }, LOG_LEVEL = "info" }
KeyTypeRequiredDefaultDescription
urlstringone of url and commandnoneThe MCP endpoint of a remote server: https, or http on the loopback.
commandstringone of url and commandnoneThe program of a local server, such as uvx or npx.
argslist of stringsno[]The arguments of command.
envtableno{}command only. See Local program environment.
authtablenononeurl only. Endpoint auth. sigv4 signs for the bedrock-agentcore service, for a server on AgentCore.
regionstringconditionalfrom the hosturl with sigv4 only, as for a Gateway endpoint.
headerstableno{}url only. Headers.
protocol_versionstringno2025-11-25The MCP version that the client asks for.

A command and args are the ones that the README of a server gives for other MCP clients. Stash starts the program when the mount starts, and stops it when the mount stops. Each source runs its own copy, with the data root as its working folder. Its stderr goes to the daemon log. If it exits, the next request starts it again. A stash tool call in flight is not sent again.

A local server can add tools after its first list. If it says that it sends notifications/tools/list_changed, Stash lists the tools again after each one, until none comes for 3 seconds, or 15 seconds after the first list. So the source starts at least 3 seconds later. A tool added after that shows at the next mount start. A url server gets one list.

The source has tools only. It cannot list records, search, or write back. If the server cannot list its tools, only this source fails, and its _sources/NAME.md page gives the reason.

A plugin source reads a store that a plugin program serves over the plugin protocol. Stash starts the program when the mount starts, and stops it when the mount stops.

[sources.memories]
kind = "plugin"
description = "Alice's long-term memories in mem0"
plugin = "mem0"
settings = { user_id = "alice" }
env = { MEM0_API_KEY = { command = ["op", "read", "op://me/mem0/api-key"] } }
write.trajectory = {}
KeyTypeRequiredDefaultDescription
pluginstringyesnoneThe plugin name, of a-z, 0-9, -, and _. Stash runs stash-source-<plugin> from the PATH of the daemon.
commandlist of stringsno[]The program and its arguments to run instead, such as ["python3", "plugin.py"].
settingstableno{}The keys of the plugin. Stash gives them to the plugin as they are.
envtableno{}See Local program environment.
write.trajectorytablenonone{}: send each turn to the plugin. The plugin settings say where.

Stash reads env again at each start of the plugin. A plugin starts again after it exits, and after it does not answer in 30 seconds. write.trajectory needs a plugin that ingests. Otherwise only this source fails to start.

Each mount has a local store, with no config and no AWS account. Each note is one read-only file, MOUNT_POINT/local/memories/SESSION/SLUG.md, or MOUNT_POINT/local/memories/SLUG.md with no session. The file is the only copy. Stash writes it at each save, and does not track it after that. The cache does not count notes, and a note never refreshes or expires. stash note save gives the rules of a note.

The first start of the store writes a random ID to STASH_DATA_ROOT/mounts/NAME/store-id. The key of each copy of a note starts with it, so two hosts with the same mount name keep apart.

MOUNT_POINT/local/scratchpad/ is the one folder of the mount that the agent writes in. Stash does not track its files. stash delete --remove-data removes the notes and the scratchpad with the mount point.

[extraction]
enabled = true
KeyTypeRequiredDefaultDescription
enabledbooleannofalseThe hooks ask the agent for a note when one is due.

With [extraction], the mount has the notes folder local/memories/, stash note save and the save_note tool of stash mcp work, and the steering tells the agent how to take notes. Note requests says when a note is due. To turn it on or off for a mount, run stash update. The notes stay.

  • The AWS SDK adds app/stash-VERSION to its User-Agent.
  • Other HTTP calls to a source send User-Agent: stash/VERSION (OS).

Use ${NAME} for a value that is not known when you create the mount.

mount_point = "/mnt/team-memory"
[sources.memory]
kind = "agentcore-memory"
arn = "arn:aws:bedrock-agentcore:us-east-1:123456789012:memory/example-memory-0123456789"
auth = { sigv4 = {} }
write.trajectory.actor = "${actorId}"
namespaces = ["/support/${region}/${actorId}/*"]
  • A name has ASCII letters, digits, _, and -.
  • A config has at most ten distinct variables.
  • A variable can be in a TOML string key or value, but not in mount_point.
  • A value is text. It cannot be empty, or hold control characters or line breaks.

create stores the config, and the mount waits in pending_config_resolution. create checks only the TOML, the variables, and the mount point. Give the values with stash bind:

Terminal window
stash bind team-memory --set actorId=alice --set region=us-east-1

When the last variable has a value, Stash checks the whole config. If the check fails, bind refuses the value and writes nothing. When the config uses ${sessionId}, create --session-id ID gives its value.