Skip to main content

Hindsight for Strands Stash

Give your coding agent what Hindsight knows about your project, as plain files. This plugin mounts one Hindsight memory bank in Strands Stash. The agent reads it with ls, cat and grep, and each of its sessions goes back to the bank, so the next session knows more.

The mount has two folders:

Folder What is in it
pages/ The bank's knowledge pages, in their folders. Each page answers one question about the project, and Hindsight keeps it current.
memories/ The bank's observations, grouped by topic, with an index.md overview in each folder. The links between the files open.

stash search finds pages by meaning and by keyword, and files in memories/ that hold the words of the query. A search also brings in a page or a topic that the bank learned after the mount started.

Requirements

  • Strands Stash 0.1.0 or later, with a harness that it supports: Claude Code, Codex, or Kiro.
  • Python 3.10 or later, and pipx.
  • A Hindsight server: a Hindsight Cloud account and an API key, or a self-hosted server.

Install

pipx install hindsight-stash
command -v stash-source-hindsight

Stash runs the program stash-source-hindsight from the PATH of its daemon. pipx puts it in ~/.local/bin. If command -v finds nothing, run pipx ensurepath and open a new terminal.

Upgrade

Upgrade the plugin, then restart the Stash daemon, so that it starts the new version:

pipx upgrade hindsight-stash
stash daemon stop && stash daemon start

PyPI lists each version. The daemon keeps the files of each mount across the restart.

To remove the plugin: pipx uninstall hindsight-stash.

Configure

Add a source of kind plugin to a Stash config file:

mount_point = "/tmp/hindsight-mount"
harnesses = ["claude"]

[sources.project]
kind = "plugin"
plugin = "hindsight"
description = "What Hindsight knows about this project"
settings = { bank = "my-project" }
env = { HINDSIGHT_API_KEY = { from_env = "HINDSIGHT_API_KEY" } }
write.trajectory = {}

The files show under <mount_point>/plugin/<source name>/, here /tmp/hindsight-mount/plugin/project/.

settings key Required Default Description
bank yes The id of the memory bank.
url no https://api.hindsight.vectorize.io The Hindsight API, for a self-hosted server. It must be https, except on localhost.
actor no stash Who writes the sessions. It goes in the actor: tag of each document.
  • env gives the plugin its API key. from_env reads the variable from the environment of the command that starts the Stash daemon. You can also read it from a file, { file = "/path/to/key" }, or a command, { command = ["op", "read", "..."] }. For a server with no authentication, leave env out.
  • write.trajectory = {} sends each session of the agent to the bank. Leave it out for a mount that only reads.
  • harnesses is claude, codex, or kiro.

The Stash configuration reference has the other keys of a mount.

Which bank to use

  • A new bank, to try it. Any name works. The trial below makes one.
  • The bank of the Hindsight coding-agents plugin. It names each bank after the git repository, coding-agent::<repo>, for example coding-agent::my-service. Use the same name to read what it learned. If the coding-agents plugin also runs, it writes each session too: set "retainSessions": false in its config, so each session goes to the bank one time.

Try it

This trial takes about 10 minutes. It makes a bank with some facts about an example project, mounts it, and asks Claude Code a question that only the bank can answer.

1. Put some knowledge in a new bank

export HINDSIGHT_API_KEY=<your API key>
export HS=https://api.hindsight.vectorize.io/v1/default/banks/stash-trial

for fact in \
  "Kestrel must be deployed with make ship-kestrel, never with kubectl, so the migration checks run first." \
  "Kestrel deploys are frozen every Thursday after 14:00 UTC for the weekly release review." \
  "A failed Kestrel deploy is rolled back by the on-call engineer with make rollback-kestrel REV=<previous>." \
  "When vLLM runs out of GPU memory on Kestrel, lower max_num_seqs from 64 to 32. Keep the 16k context."
do
  curl -s -X POST "$HS/memories" \
    -H "Authorization: Bearer $HINDSIGHT_API_KEY" -H "Content-Type: application/json" \
    -d "{\"items\": [{\"content\": \"$fact\"}]}"
  echo
done

curl -s -X POST "$HS/pages" \
  -H "Authorization: Bearer $HINDSIGHT_API_KEY" -H "Content-Type: application/json" \
  -d '{"name": "Deploying Kestrel", "source_query": "How do we deploy Kestrel, when are deploys frozen, and how do we roll back?"}'

Hindsight now extracts the facts, groups them into observations, and writes the page. Wait 2 or 3 minutes, until the page has text:

curl -s "$HS/pages/export" -H "Authorization: Bearer $HINDSIGHT_API_KEY" | grep -c ship-kestrel

A number above 0 means that it is ready.

2. Mount the bank

Make an empty project folder, and save this as stash.toml in it:

mount_point = "/tmp/hindsight-mount"
harnesses = ["claude"]

[sources.kestrel]
kind = "plugin"
plugin = "hindsight"
description = "What Hindsight knows about the Kestrel project"
settings = { bank = "stash-trial" }
env = { HINDSIGHT_API_KEY = { from_env = "HINDSIGHT_API_KEY" } }
write.trajectory = {}

In the same terminal, so that the daemon gets HINDSIGHT_API_KEY:

mkdir -p ~/kestrel-trial && cd ~/kestrel-trial   # with stash.toml in it
git init -q
stash daemon stop 2>/dev/null   # a daemon that runs already has no API key
stash create kestrel --config stash.toml --attach
stash ls                        # wait until kestrel is ready
find /tmp/hindsight-mount/plugin/kestrel -type f

You see the page and the observations:

/tmp/hindsight-mount/plugin/kestrel/pages/deploying-kestrel.md
/tmp/hindsight-mount/plugin/kestrel/memories/index.md
/tmp/hindsight-mount/plugin/kestrel/memories/<topic>.md

Search the bank:

stash search kestrel "roll back a failed deploy" --path /plugin/kestrel

The page comes first, then the memory files that hold the words.

3. Ask the agent

Start Claude Code in ~/kestrel-trial, and ask:

For the Kestrel project: when are deploys frozen, how do I roll back a failed deploy, and what should I do when vLLM runs out of GPU memory? Name each file you read.

The agent reads the mount, and answers: Thursday after 14:00 UTC, make rollback-kestrel REV=<previous>, and lower max_num_seqs from 64 to 32. It names files under /tmp/hindsight-mount/plugin/kestrel/.

4. See the session in the bank

When the agent finishes its turn, Stash sends the session to the bank. After a minute:

curl -s "$HS/documents?limit=100" -H "Authorization: Bearer $HINDSIGHT_API_KEY" | grep -o '"id":"stash::[^"]*"'

You see one document, stash::<session id>. Hindsight makes new observations from it, so a later session can find what this one learned. The Hindsight Cloud console shows the bank too.

5. Clean up

stash delete kestrel --remove-data --yes
curl -s -X DELETE "$HS" -H "Authorization: Bearer $HINDSIGHT_API_KEY"

How it works

  • Reads. One download of the page tree, the pages, and the observation tree answers every read for 60 seconds. When Stash refreshes the files of a mount, one round costs three calls to Hindsight. A file that the download does not have makes one more download, at most once in 5 seconds.
  • Write-back. Each session goes to the bank as an async retain of its transcript, in the shape that the Hindsight coding-agents plugin uses: the conversation strategy, with the tags source:chat, harness:stash, and actor:<actor>. On Hindsight 0.8.6 and later, a session is one document, stash::<session>, and each batch adds to it. On an older server, or a bank with store_document_text = false, each batch is its own document, so that a batch that Stash sends again is not stored two times.

Limits

  • Stash reads the list of files only when the mount starts. A page or a topic that the bank gets later shows when a search finds it, or after stash delete NAME --remove-data --yes and stash create.
  • A search of memories/ matches words, not meaning.
  • Two pages in one folder whose titles give the same file name both show, and Stash adds an id to the second name.

Troubleshooting

  • The mount shows no files. Run stash status <mount>. The page <mount_point>/_sources/<source>.md says why the source failed. The Stash daemon logs are in ~/.stash/logs/daemon/, one file a day.
  • access_denied. The daemon has no API key, or a wrong one. Stop the daemon, export HINDSIGHT_API_KEY, and run stash create again.
  • The plugin is not found. The daemon's PATH has no stash-source-hindsight. Run pipx ensurepath, or give the full path in the source: command = ["/home/me/.local/bin/stash-source-hindsight"].

Develop

git clone https://github.com/vectorize-io/hindsight-stash && cd hindsight-stash
python3 -m venv .venv
.venv/bin/pip install -e .
.venv/bin/python -m unittest discover -s tests

src/stash_source_hindsight/_sdk.py is a copy of the Stash plugin SDK. Copy it again from the Stash repository to upgrade it.

License

MIT. _sdk.py is from Stash, under the Apache License 2.0 (LICENSE-APACHE).

Metadata

Release files for hindsight-stash 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for hindsight-stash 0.1.0
File Size Uploaded Provenance Actions
hindsight_stash-0.1.0.tar.gz 23.3 kB With provenance Details for hindsight_stash-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for hindsight-stash 0.1.0
File Interpreter ABI Platform Actions
hindsight_stash-0.1.0-py3-none-any.whl Python 3 none any Details for hindsight_stash-0.1.0-py3-none-any.whl

Total release size: 45.2 kB

Release files / hindsight_stash-0.1.0.tar.gz

Download URL hindsight_stash-0.1.0.tar.gz
Size 23.3 kB
Tags Source
SHA-256 checksum
How to use checksums
a351943559af9bcecea0caa47b8c9960ddf4372b17d1d761062adc7040eb842e
BLAKE2b-256 checksum
How to use checksums
706e1aded0cb157c5180d44fa906a6929340b07e240bd524a23a1aaa82d9fce5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Release files / hindsight_stash-0.1.0-py3-none-any.whl

Download URL hindsight_stash-0.1.0-py3-none-any.whl
Size 21.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4afde90588e7aa6a954f5d723510833dc461093868f13bc628fa7a9b4da8abcc
BLAKE2b-256 checksum
How to use checksums
4ca68d5fc25765e81eb427f6b783a366790401850e5e39dc39f2eea62b17aa40
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

Security for hindsight-stash 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for hindsight_stash-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Dec 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page