Stow

Embeddable object storage

S3 storage, without the server.

Your application needs somewhere to put its working data. Start an S3 test endpoint without Docker, keep an agent's files, or save an edit without a connection. Stow supplies local object storage, file history and portable checkpoints. Embed it in Go or WebAssembly, or connect your S3 client to a native endpoint.

stow-s3 workspace prepare --manifest task.json > ready.json
stow-s3 workspace checkpoint --id "$(jq -r .workspace_id ready.json)" > saved.json
stow-s3 workspace resume --id "$(jq -r .workspace_id ready.json)"

task.json declares what to seed. Prepare creates the workspace, checkpoint captures it, resume reopens it. Full manifest and limits.

Go · TypeScript · Python · WebAssembly

v0.4.4 fixes browser persistence and adapter copy conditions Native downloads: GitHub Releases; npm publishes 0.4.4 with its matching native binary; the v0.4.4 native downloads are on GitHub Releases.

Start with the problem

Four places storage gets in the way.

Start S3 for a test, keep files beyond a disposable task, or work with local data when the network drops.

01 / CI & integration tests

CI is waiting for a storage container.

A test needs to upload a file. First comes Docker setup, an image pull, service startup and a readiness check. Storage adds another service to start, wait for and tear down on the runner.

With Stow Start the packaged native process from your test. The helper handles readiness and cleanup, with a private bucket for each run. No Docker daemon or storage image required.

Run S3 tests without Docker

02 / Agent workspaces

A temporary checkout is easy to lose.

An agent edits files on a disposable machine. Before that machine goes away, you need to keep the result, inspect what changed, and move saved work to the next host.

With Stow Prepare a task workspace, checkpoint its files, and export a verified archive before cleanup.

Keep an agent's work

03 / Browser editing

A lost connection leaves edits unsent.

If saving waits for a server, a dropped connection interrupts the workflow. Reloading the page can lose work that only exists in memory.

With Stow Save stages in IndexedDB, undo or redo locally, then sync a selected version with remote conflict detection.

Try editing offline

04 / Local read cache

A remote object can hold up local work.

Your tool needs the same assets or dataset again. Fetching from upstream adds a network dependency; an outage stops reads that only exist remotely.

With Stow Fetch through a local disk cache or prewarm known keys. Read retained copies while offline.

Keep needed files nearby

Stow in practice

Put the right workflow to work.

Start S3 from your test, save an agent workspace, edit locally in the browser, or cache upstream objects. Open a walkthrough to see what Stow changes and how to set it up.

TypeScript: npm · Python: source checkout · Go: embedded API · Installation and first steps

CI & integration testsStart S3 from the test. Skip the Docker setup.

The problem Your CI job needs an S3 endpoint before the tests can start. Pulling a storage image, starting its container, wiring the service, waiting for readiness and cleaning it up all add setup work and startup time to the job.

With Stow Use the native binary included with the npm package. withStow starts a loopback endpoint, waits for readiness and cleans up after the callback. Your test uses a real S3 client without a Docker daemon, storage image or CI service definition.

A native process, a ready client, automatic cleanup

The session starts the packaged server on loopback and waits until it is ready. Store an artifact, read it back, and let the callback clean up—even if it throws. Each run also gets a private bucket and generated credentials, so parallel tests can use the same object keys. Pass s3 and bucket to your application's storage code.

TypeScript creates the bucket automatically. Python creates it explicitly. Go uses an embedded object runtime without an HTTP server.

Setup: install the TypeScript package from npm with its native binary. Python uses a source checkout. A session is a separate server process, isolated from your cloud environment and bounded by its own quota.

TypeScript · store and read a report

import { GetObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
import { withStow } from "@chester-hill-solutions/stow-s3";

// Ordinary application code: any S3 client and bucket will do.
async function publishReport(s3, bucket, report) {
  await s3.send(new PutObjectCommand({
    Bucket: bucket,
    Key: "reports/latest.json",
    Body: JSON.stringify(report),
    ContentType: "application/json",
  }));
  const stored = await s3.send(new GetObjectCommand({
    Bucket: bucket,
    Key: "reports/latest.json",
  }));
  return JSON.parse(await stored.Body.transformToString());
}

const report = { service: "checkout", ok: true, durationMs: 128 };

// Stow: a private bucket, generated credentials, cleanup on exit.
await withStow(async ({ s3, bucket }) => {
  const roundTripped = await publishReport(s3, bucket, report);
  console.log("stored reports/latest.json:", JSON.stringify(roundTripped));
});

Bucket created automatically · cleanup on exit
TypeScript API

Python · store and read a report

"""Store an artifact in a disposable S3 bucket and read it back.

    make build
    export STOW_BIN="$PWD/bin/stow-s3"
    python examples/stow-recipes/start_small.py

The application code takes an S3 client and a bucket and does not know Stow
exists. Only the ``with_session`` block is Stow-specific. A Python session
starts a private loopback server and cleans it up; it does not create a bucket,
so the example names one and creates it.
"""

import json

from stow_s3 import with_session


def publish_report(s3, bucket, report):
    """Ordinary application code: any S3 client and bucket will do."""
    s3.put_object(
        Bucket=bucket,
        Key="reports/latest.json",
        Body=json.dumps(report).encode(),
        ContentType="application/json",
    )
    response = s3.get_object(Bucket=bucket, Key="reports/latest.json")
    try:
        return json.loads(response["Body"].read())
    finally:
        response["Body"].close()


report = {"service": "checkout", "ok": True, "duration_ms": 128}

with with_session() as session:
    s3 = session.s3_client()
    bucket = session.new_bucket_name()
    s3.create_bucket(Bucket=bucket)
    print("stored reports/latest.json:", json.dumps(publish_report(s3, bucket, report)))
    s3.close()

Create your bucket explicitly · cleanup on exit
Python API

Go · embedded runtime

// Store a report in an embedded object runtime and read it back.
//
//	go run ./examples/stow-recipes/go/start-small
//
// This is the embedded Go runtime: it stores objects in process with no HTTP
// server and no S3 client. Use a scoped TypeScript or Python session when the
// application already speaks S3.
package main

import (
	"context"
	"encoding/json"
	"fmt"
	"log"

	stow "github.com/chester-hill-solutions/stow-s3/pkg/stow"
)

func main() {
	if err := run(); err != nil {
		log.Fatal(err)
	}
}

func run() error {
	ctx := context.Background()
	store, err := stow.Open(stow.Options{Backend: stow.BackendMemory})
	if err != nil {
		return err
	}
	defer store.Close()

	if err := store.CreateBucket(ctx, "reports"); err != nil {
		return err
	}
	report := map[string]any{"service": "checkout", "ok": true, "durationMs": 128}
	body, err := json.Marshal(report)
	if err != nil {
		return err
	}
	if _, err := store.PutObject(ctx, "reports", "latest.json", body, stow.PutOptions{ContentType: "application/json"}); err != nil {
		return err
	}
	object, err := store.GetObject(ctx, "reports", "latest.json")
	if err != nil {
		return err
	}
	fmt.Println("stored reports/latest.json:", string(object.Data))
	return nil
}

Embedded object runtime · no HTTP server
Go API

Keep the artifacts

Name a data directory and the objects survive the session. The server stops; the directory is yours; the next session on it reads what the previous one wrote.

keep-artifacts.mjsTypeScript
// Keep the artifacts: the same round trip, but the objects outlive the session.
//
//   make build
//   STOW_BIN=./bin/stow-s3 node examples/stow-recipes/keep-artifacts.mjs ./artifacts
//
// The only change from start-small.mjs is naming a data directory and a bucket:
// withStow(...) becomes openStow({ dataDir, bucket }). A named directory selects
// the filesystem backend, so the bytes survive close, and a fixed bucket name
// lets the next session find them.
import { GetObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
import { openStow } from "@chester-hill-solutions/stow-s3";

const dataDir = process.argv[2] ?? "./artifacts";
const bucket = "artifacts";

// First session: write the artifact, then stop the server.
const first = await openStow({ dataDir, bucket });
await first.s3.send(new PutObjectCommand({
  Bucket: bucket,
  Key: "notes/design.md",
  Body: "# Design\n\nFirst draft.\n",
  ContentType: "text/markdown",
}));
await first.close();
console.log(`wrote ${bucket}/notes/design.md; server stopped`);

// Second session on the same directory: the caller-owned data is still there.
const second = await openStow({ dataDir, bucket });
const stored = await second.s3.send(new GetObjectCommand({
  Bucket: bucket,
  Key: "notes/design.md",
}));
console.log("read back after reopen:", JSON.stringify(await stored.Body.transformToString()));
await second.close();

One option changes memory-backed scratch into filesystem storage. Pass a fixed bucket so the reopened session finds the same objects.

Re-run a processing stage

Workers read input objects by key and write results. Keep both and a stage can be inspected or rerun. Your application owns the queue and the retries; Stow is not a durable job queue.

processing-stage.mjsTypeScript
// One unit of work: read an input key, write its result under results/.
async function classifyOne(s3, key) {
  const source = await s3.send(new GetObjectCommand({ Bucket: bucket, Key: `inputs/${key}` }));
  const category = categorize(await source.Body.transformToString());
  await s3.send(new PutObjectCommand({
    Bucket: bucket,
    Key: `results/${key}.json`,
    Body: JSON.stringify({ input: key, category }),
    ContentType: "application/json",
  }));
  return `${key} -> ${category}`;
}

// The application builds the queue and runs two workers over it. Stow does not
// schedule this or retry it; if a worker fails, the application retries the key.
async function runWorkers(s3, keys) {
  const queue = [...keys];
  const worker = async () => {
    for (let key = queue.shift(); key !== undefined; key = queue.shift()) {
      console.log(await classifyOne(s3, key));
    }
  };
  await Promise.all([worker(), worker()]);
}

Full runnable examples

Reject a stale update

A conditional write compares the ETag you read with the object's current ETag and refuses the write if they differ, so two writers cannot clobber one another. A create-only write is refused when the store cannot confirm the object is absent, so it never replaces bytes it could not read.

conditional-write.mjsTypeScript
// Reject a stale update: overwrite only the version you actually read.
//
//   make build
//   STOW_BIN=./bin/stow-s3 node examples/stow-recipes/conditional-write.mjs
//
// A conditional write compares the object's current ETag with the one you pass
// and refuses the write if they differ. Two writers can read the same version;
// the second update is rejected instead of silently overwriting the first.
import { GetObjectCommand, PutObjectCommand } from "@aws-sdk/client-s3";
import { withStow } from "@chester-hill-solutions/stow-s3";

await withStow(async ({ s3, bucket }) => {
  const created = await s3.send(new PutObjectCommand({
    Bucket: bucket,
    Key: "config.json",
    Body: '{"version":1}',
  }));

  // The first writer updates the version it read.
  await s3.send(new PutObjectCommand({
    Bucket: bucket,
    Key: "config.json",
    Body: '{"version":2}',
    IfMatch: created.ETag,
  }));

  // The second writer still holds the original ETag, so its update is refused.
  // The refusal has to be the precondition failure and not some other error:
  // a request that failed for another reason has proved nothing about the
  // write it was supposed to make.
  let rejection;
  try {
    await s3.send(new PutObjectCommand({
      Bucket: bucket,
      Key: "config.json",
      Body: '{"version":3}',
      IfMatch: created.ETag,
    }));
  } catch (error) {
    rejection = error;
  }
  if (!rejection) throw new Error("the stale update was accepted");
  if (rejection.name !== "PreconditionFailed" && rejection.$metadata?.httpStatusCode !== 412) {
    throw rejection;
  }
  console.log("stale update rejected:", rejection.name, rejection.$metadata?.httpStatusCode);

  // The version that was saved is still the one that is stored. A refusal is
  // only worth anything if the object it refused to replace is intact.
  const stored = await s3.send(new GetObjectCommand({ Bucket: bucket, Key: "config.json" }));
  const retained = await stored.Body.transformToString();
  if (retained !== '{"version":2}') {
    throw new Error(`the stored object is ${retained}, want the version that was saved`);
  }
  console.log("retained:", retained);
});
Agent workspacesKeep the result when the checkout is gone.

The problem An agent's changes live in a task directory, alongside inputs and generated files. Deleting the checkout or replacing the host can discard the files needed to review or continue the work.

With Stow Declare the inputs, prepare a workspace, pause its writers and capture a checkpoint. Export the saved files before disposal. Your host still owns agent execution, permissions and restart.

1. Declare the task checkout

In a fresh directory, save this as task.json. Git fetches the URL first; Stow resolves the local clone's HEAD and prepares a separate detached checkout.

task.jsonJSON
{
  "version": 1,
  "root": "./tasks/task-42",
  "working_directory": "repo",
  "repositories": [{
    "source": "./source-repo",
    "destination": "repo",
    "ref": "HEAD"
  }],
  "ttl_seconds": 3600,
  "registry_dir": "./stow-registry"
}

Your host starts the agent in the returned working directory and controls its process permissions. Expiry requires a collection call; it does not delete the workspace automatically. Git input limits and cleanup.

2. Fetch and prepare

Replace the URL and branch. These commands use Git, Stow, and jq to read the returned IDs.

prepare.shShell
git clone --depth 1 --branch main \
  https://github.com/your-org/your-repo.git source-repo
mkdir -p tasks
stow-s3 workspace prepare --manifest task.json > task-ready.json
jq -r .working_directory task-ready.json
# Run your agent in that directory.

3. Save the result, then dispose

Stop the agent's writers, then checkpoint and export before cleanup. The archive is kept; the task directory and its internal checkpoints are removed.

finish.shShell
WORKSPACE_ID=$(jq -r .workspace_id task-ready.json)
stow-s3 workspace checkpoint --id "$WORKSPACE_ID" \
  --registry-dir ./stow-registry > checkpoint.json
CHECKPOINT_ID=$(jq -r .checkpoint_id checkpoint.json)
stow-s3 workspace export --checkpoint-id "$CHECKPOINT_ID" \
  --registry-dir ./stow-registry --output result.tar.gz
stow-s3 workspace destroy --id "$WORKSPACE_ID" \
  --registry-dir ./stow-registry
Browser editingSave locally. Sync when you choose.

The problem A user keeps editing after the connection drops. Sending every save straight to the server leaves the app to handle unsent edits, local history and a remote file that may have changed.

With Stow Save file stages locally and keep undo/redo available. Sync a selected stage when connected; a changed remote version is reported as a conflict for your app to resolve.

Run the real browser demo

WASM, IndexedDB, offline reload, undo/redo, explicit sync, and remote conflicts. A private local S3 fixture supplies the remote.

make browser-editor
Demo setup & walkthrough →

The real file-history API retains whole-file stages; project revisions share unchanged content. Browsers can evict local storage. Sync detects remote conflicts; your app chooses how to resolve them. Limits and recovery.

Local read cacheRead retained files when upstream is unavailable.

The problem A local tool needs objects from S3 to do its work. Without a retained copy, an upstream outage or a disconnected host turns a read into a blocked task.

With Stow Fetch through a filesystem cache or prewarm specific keys before going offline. Cached objects remain available within the cache's limits and TTL; an uncached key still needs upstream.

1. Start the disk cache

Install the native server, configure upstream credentials in your environment, and replace the endpoint and bucket below. These demo credentials are for the local endpoint.

cache.shShell
STOW_ENDPOINT=https://s3.example.com \
STOW_BUCKET=assets \
stow-s3 serve --mode run-through \
  --backend filesystem \
  --port 9000 \
  --access-key demo-local \
  --secret-key demo-local-secret \
  --data-dir ./stow-data \
  --cache-dir ./stow-cache \
  --cache-max-bytes 2147483648 \
  --cache-ttl 24h

The disk layer retains up to 2 GiB with a 24-hour TTL. Stow revalidates cached objects online. Offline reads require retained bytes. Upstream credentials and offline setup.

2. Put a small memory cache in front

Install @aws-sdk/client-s3 and lru-cache. Save this as read-assets.mjs and run it with Node. Replace the image key with an object already in your upstream bucket.

read-assets.mjsJavaScript
import { LRUCache } from "lru-cache";
import { S3Client, CreateBucketCommand,
  GetObjectCommand } from "@aws-sdk/client-s3";

const memory = new LRUCache({
  maxSize: 32 * 1024 * 1024,
  ttl: 30_000,
  sizeCalculation: bytes => Math.max(1, bytes.byteLength),
});
const s3 = new S3Client({
  endpoint: "http://127.0.0.1:9000",
  region: "us-east-1", forcePathStyle: true,
  credentials: {
    accessKeyId: "demo-local",
    secretAccessKey: "demo-local-secret",
  },
});
try {
  await s3.send(new CreateBucketCommand({ Bucket: "assets" }));
  async function readAsset(key) {
    const hit = memory.get(key);
    if (hit) return hit;
    const result = await s3.send(new GetObjectCommand({
      Bucket: "assets", Key: key,
    }));
    if (!result.Body) throw new Error("Missing object body");
    const bytes = await result.Body.transformToByteArray();
    memory.set(key, bytes);
    return bytes;
  }
  await readAsset("images/cover-v1.png"); // disk → S3 on miss
  await readAsset("images/cover-v1.png"); // memory hit
} finally {
  s3.destroy();
}

The app owns the memory cache. Its byte budget counts retained payloads, not total process memory. Use versioned keys or invalidate memory entries when content changes.

The next machine needs more than a Git checkout.

An unfinished task can include input data, generated files and edits that were never committed. Capture those files in a checkpoint, export a verified archive, and adopt it into a new workspace.

Native v0.4.0 introduced scoped MCP file resources, managed file saves and immutable checkpoint reads. Your host chooses access roots and pauses writers.

Pause writers before capture. Archives transfer saved files; your host restarts the tools or agent.

Explore workspaces

One object model, four ways in.

All API references
Embedded Go + WASM
Call the object engine directly from Go, Node or a compatible WebAssembly host.
Embedded API
Native S3
Use familiar SDKs with memory or filesystem storage. Conditional requests, multipart uploads and presigned URLs.
S3 compatibility
Browser projects + workers
Shared content, atomic revisions, range reads and bounded streams over durable browser storage.
Workers and streams
S3 read-through cache
Fetch upstream objects, prewarm keys and use retained bytes offline. Select run-through explicitly.
Cache guide

Embedded runtime defaults: 64 MiB and 10,000 objects. Scoped sessions have their own limits; read your instance's capabilities. Stow manages storage; your host owns execution and sandbox enforcement. The native service supports development and controlled private deployments. Supported operations and limits.

Measured on Railway

Agent storage, measured.

Stow, MinIO, S3Proxy and RustFS: compare S3 server startup, first write, transfer, quarantine and memory.

Development snapshot2026-10-19

Ready to work

Median · whiskers show observed range

ms↓ Lower is better
  1. Stow28.1125.28–41.63
  2. RustFS124.284.57–196.7
  3. MinIO248.5218.8–538
  4. S3Proxy1,0201,003–1,138

Time to first write

Median · whiskers show observed range

ms↓ Lower is better
  1. Stow44.4136.42–63.76
  2. RustFS180.3154.6–251.4
  3. MinIO263.4231.5–558.5
  4. S3Proxy1,1291,095–1,237

Fresh S3 server processes with empty data directories. Startup ends on authenticated readiness; first write includes bucket creation and a 4 KiB PUT over target loopback. Nine launches per product; 10 ms readiness polls. Images and binaries are already present. This measures storage server startup, not an agent’s full startup.

SHA-256 + length verifiedZero failed or dropped workflowsDownload results
Test settings and what these comparisons cover

AMD EPYC 9655P 96-Core Processor. One target at a time; separate generator. Each S3 server uses the same resource ceilings and client workflows. Filesystem and memory backends are compared separately. Bars use a linear scale from zero; ranges describe observed samples.

These peers expose S3-shaped blob storage. The workloads exercise bucket creation, PUT, GET and DELETE; they do not establish full S3 feature parity. Durability guarantees differ: Stow filesystem publishes with rename and fsync; S3Proxy’s filesystem adapter differs; RustFS uses one drive with strict durability.

These are exploratory development measurements. Image downloads, deployments, browser startup, cold OS caches, real scanners, flagged-file promotion, replication and failover are unmeasured. Some target runs reach the CPU ceiling; the fixed generator and concurrency can also constrain rates.

Build with storage you control.

Read the documentation

Free and open source. Install the TypeScript client and its matching native binary from npm (0.4.4), or get the v0.4.4 native downloads from GitHub Releases. See the v0.4.4 release notes. Linux and macOS on x64 and ARM64 are supported. The Go module is published. The Python client is not yet published to PyPI; use a source checkout for Python.

Add the TypeScript client

npm install @chester-hill-solutions/stow-s3@0.4.4

Add the Go module

go get github.com/chester-hill-solutions/stow-s3/pkg/stow

No daemon, no root, loopback-only, one data directory. A committed save survives a killed process (0.4.3): workspace resume reopens the work. Run the corpus against your own adapter.