Skip to content

A plugin source mounts any store that has no built-in kind: a third-party memory service, a folder of team notes, an internal API. You write a small program that answers the plugin protocol, and Stash runs it. The agent sees the store as files, the same as any other source.

The source shows at plugin/NAME/. The plugin chooses the folder, the file name, and the text of each record:

/tmp/ops-context/plugin/oncall-notes/
checkout/handoff-2026-11-21.md
payments/known-issues.md

A record with no name gets the file name <date>__<words of the body>.md. A .md file ends with a YAML block that holds stash-fetched-at. Any other file, such as a .json or .csv file, is the body alone, so it stays valid.

A plugin declares its capabilities when it starts. Stash sends only those methods.

CapabilityWhat it gives the agent
listRecords to browse.
getOne whole record, for refresh.
searchstash search on the source, best hits first.
planThe records the mount loads when it starts. With no plan, the mount loads nothing at start.
ingestWrite-back: the turns of each session, with write.trajectory = {}.

A plan has at most 10 steps, and each step has a limit of at most 100.

[sources.oncall-notes]
kind = "plugin"
description = "On-call handoff notes"
plugin = "team-notes"
settings = { folder = "/srv/oncall/notes" }
env = { NOTES_TOKEN = { command = ["op", "read", "op://ops/notes/token"] } }
KeyDefaultWhat it does
pluginrequiredThe name. Stash runs stash-source-<plugin> from the daemon’s PATH.
command[]The program and its arguments to run instead, such as ["python3", "notes.py"].
settings{}The plugin’s own keys. Stash passes them as they are.
env{}The plugin’s variables: text, { from_env }, { file }, or { command }.
write.trajectorynone{} sends each turn to the plugin. The plugin must declare ingest.

plugin takes only a-z, 0-9, -, and _, because it’s part of a program name. See plugin for every rule.

  • Stash starts the plugin when the mount starts, and stops it when the mount stops.
  • Stash talks to it with JSON-RPC 2.0, one object for each line, on stdin and stdout. Logs go to stderr, and Stash writes them to the daemon log.
  • The plugin gets the same short list of variables as a local MCP server, plus env.
  • Stash starts a new process after the plugin exits, and after a request gets no answer in 30 seconds. It reads env again at each start, so a plugin can exit to get a new token.
  • An answer can have at most 16 MiB.
  • Errors carry a kind. Stash retries throttled, unavailable, and timeout, and no other kind.

The Python SDK, strands-stash-plugin, speaks the protocol for you. You write one function for each capability. See Write a plugin, or the plugin protocol to write one in another language.