---
title: "Commit the manifest, not the build"
date: 2026-10-20
summary: "Apps that need a build step now keep their output out of git: each built file goes to the mind's file storage under its content hash, uploaded straight to a signed URL, and only a small manifest is committed and served from."
tags: ["deployment", "caching", "agents"]
url: https://blog.misherate.com/posts/commit-the-manifest-not-the-build
thumbnail: https://blog.misherate.com/thumbnails/commit-the-manifest-not-the-build-mwfgk5zk.jpg
---

Misha's [iterate](https://iterate.com) mind is a git repository of its own code, published by every commit; this is about the apps whose code has a build step, and how much of them belongs in that repository.

Vibe-coded apps grow up fast. One day an app is a single file of HTML; the next it is a bundler's output folder of hashed scripts, fonts and sounds, and somebody has to decide where all those generated bytes go.

Most of the small apps here are a single TypeScript file that returns a page: inline styles, inline script, libraries from a CDN. The mind writes it, commits it, and the commit is the deploy. That stops working as soon as an app has a real build. A [Vite](https://vite.dev) build produces a folder of hashed JavaScript, CSS, images, fonts and sounds, and none of that belongs in the config repo.

There were two bad options on the table. Commit the build output, and the repo fills with generated bytes that change on every rebuild. Or have the agent push the files into the mind through its `run` tool, which means every byte of every asset travels through a tool call that was meant for short scripts. On 20 October we made a third way the shared pattern; one older app already worked this way, and this generalised it.

## Files by hash, a manifest in git

A built file goes into the mind's file storage at a path made from its content: `/<app>/assets/<sha256>/<name>`. The only thing committed is a manifest that maps each path the site answers to (`/index.html`, `/assets/index-B5F0.js`) to where its bytes are:

```ts
type Manifest = Record<string, { path: string; type: string; hash: string; size: number }>;

async function manifestFor(app: string, files: { path: string; bytes: Uint8Array }[]) {
  const manifest: Manifest = {};
  for (const { path, bytes } of files) {
    const hash = hex(await crypto.subtle.digest("SHA-256", bytes));
    const name = path.split("/").at(-1)!;
    manifest[path] = { path: `/${app}/assets/${hash}/${name}`, type: typeOf(name), hash, size: bytes.byteLength };
  }
  return manifest;
}
```

Naming by hash buys a few things at once. The same bytes always go to the same file, whatever build they came from, so a rebuild that changed one script uploads one file. An upload can't break the live site, because nothing points at a new file until a manifest does. And uploading publishes nothing: the commit of the manifest is the deploy, as it is for every other change in this config, with a message saying why and a revert that works.

## Bytes go around the agent, not through it

The upload is done from wherever the build ran, usually the sandbox of the agent that built it. A script there walks the build folder, writes the manifest into `apps/<app>/assets.generated.ts`, and prints the storage paths that need uploading. The agent then asks the mind, through its `run` tool, for a signed PUT URL for each path that isn't there yet, and hands those back to the script, which uploads each file directly:

```sh
node scripts/static-manifest.mjs dist my-game          # writes the manifest, prints the uploads
# run tool: for each printed path not already stored, mint a signed PUT URL; save them as urls.json
node scripts/static-manifest.mjs dist my-game urls.json # PUTs each file to its own URL
```

Only the URLs pass through the tool call. The script uses the same manifest function the server does, so the hashes it uploads under are the hashes the server looks for. The agents' instructions now carry these steps, so a session that builds an app does all of it with the tools it already had.

## Serving it with the right caches

The worker serves a built app through one shared function. It looks the request's path up in the manifest (`/` means `/index.html`), and returns `null` for anything the manifest doesn't have, so the app's own routes still get a turn:

```ts
async function serveStatic(request: Request, itx, manifest: Manifest) {
  const { pathname } = new URL(request.url);
  const file = manifest[pathname === "/" ? "/index.html" : pathname];
  if (!file || !["GET", "HEAD"].includes(request.method)) return null;
  const headers = {
    "content-type": file.type,
    "cache-control": pathname.startsWith("/assets/") ? "public, max-age=31536000, immutable" : "no-cache",
    etag: `"${file.hash}"`,
  };
  if (request.headers.get("if-none-match") === headers.etag) return new Response(null, { status: 304, headers });
  if (request.method === "HEAD") return new Response(null, { headers: { ...headers, "content-length": String(file.size) } });
  return new Response(await itx.files.get(file.path).bytes(), { headers });
}
```

The cache rule follows from how Vite names things. Everything under `/assets/` already has a hash in its file name, so a given path never changes what it serves, and browsers can keep it for a year. The HTML keeps its name across builds, so it is `no-cache`: the browser asks every time, and since the etag is the content hash, an unchanged page costs a 304 and no body. A `HEAD` answers the size from the manifest without reading the file.

## Tried before committing

The pattern was checked live before the commit: two files uploaded from a laptop through URLs minted by a `run`, then a candidate worker using `serveStatic` answered 200 with the right cache headers, 304 on a matching etag, and 404 for a path not in the manifest. The test files were deleted afterwards. The unit tests cover the same ground: files answer to their build paths, a browser holding the file gets a 304, `HEAD` gives a size without a read, paths the build doesn't have (and a `POST`) are left to the app, and the same bytes map to the same stored file across builds.

## What we'd reuse

- Keep generated output out of the repo, but keep the *pointer* to it in the repo, so deploys and rollbacks stay commits.
- Content-address the stored files. It makes uploads idempotent, rebuilds incremental and the cache headers obvious.
- When an agent needs to move large bytes, give it a signed URL rather than a bigger pipe. The agent coordinates; the bytes go directly from where they are to where they're going.
