Vision

rat-stack is the reference for how we build: an app and its cloud as one typed program. Effect owns the hard parts, Alchemy infers the infrastructure from the code, and the fence39 raises the floor, so an agent can build it reliably with high-trust.

An Effect stack so pure (aspirational) Kit Langton will blush.

The goal is to build the best Effect + Alchemy application that we can, as close to a perfect Effect application as we can get. Every change here moves toward that, and projects that grow out of rat-stack move toward it too. In practice:

We and our agents use it to understand what we are building. Real projects take it in the way they take a library: vendor it, keep the bins they need, and pull the rest.

It is also the working code behind a YouTube series by Joel Hooks on Alchemy and Effect. Every claim made on camera points at something that runs here. The series arc lives with the content research. ratstack.sh is the teaching surface23.

Public GitHub is a steal-the-ideas surface, not a supported product.

Any project that grows out of rat-stack writes its own vision.

Scope20: joelhooks/rat-stack, the reference repo, and the shape a project inherits when it vendors or clones it.

Audience: The agents that work from this reference, engineers who work through agents and want to trust what an agent built, and people watching the series who want the working code. This is not a support queue, compatibility promise, ghostwriting service, growth automation, thin npm init, or TypeScript tutorial dressed up as a template excited to go out on a Saturday night.

Status: ratstack.sh is deployed. Effect 4 is stable. XState and @xstate/effect are pinned to alphas, and Alchemy to a beta, so their APIs can drift.

Some of it’s still fuckin’ pre-release. It’s fine. Keep track 🙏

Why it exists

Agents will take the shortest path. Lazy mfers.

A skeleton without commandments chiseled in stone produces a ball of mud. A pile of prose without a strong fence is legacy documentation.

This reference gives a project:

  1. Why. VISION.md and AGENTS.md explain the point.
  2. Fence. Pins, pnpm check, lefthook, and harness hooks block hook bypass.
  3. Context. Vendored Effect, effect-solutions, XState, and Alchemy sources support source-first edits.

The stack is the fundamental floor. The foundation. Sam Goodwin’s argument sets the bar: the whole cloud becomes a library7, limited by the accounts you have, and the type system should guarantee that the infrastructure is correct.

Pieces, trust, floor, and range

Four ideas hold this together.

Pieces. Alchemy Layers as literally composable SaaS (next section). Each one is a product you can provide, swap, or pull out.

Trust. Lauren Tan ships thousands of agent-written PRs because she trusts the environment her agents work in. She ranks five places a correction can live, hardest first: the codebase, static analysis (lint, compiler, CI), rules, skills, and the style guide. The hard rungs make a bad pattern impossible to write. Her team built Dune, an agent-friendly framework, on one principle: agents love taking shortcuts, so “what if we designed a framework such that the shortcut, the easy path, is the right path for agents?” Dune enforces process boundaries through the import graph and keeps a single paved path for each blessed pattern. Her point is that the framework itself matters less than owning one. rat-stack is ours. Alchemy puts infrastructure on the compiler rung: remove a binding23 and the code that uses it stops compiling. rat-stack’s fence is the rest of the ladder, built in.

Floor. Theo Browne: “raising the floor is way more beneficial than raising the ceiling.” He gave the same advice about videos on Joel’s channel: “raise the baseline so that you average higher… the floor is the hardest part to get right.” A higher floor also makes failure cheaper: “it’ll also make it hurt less when the video you put a lot of effort into bombs.” The floor is the worst thing that happens on a normal run. His math is about long runs. A step that fails 5% of the time every ten minutes fails about 70% of the time over four hours. Cut that 5% to 3% and the four-hour failure rate drops to about 50%. Small cuts to the failure rate multiply how long the work can run. At CascadiaJS he also said failure got cheap: “experimentation is now significantly cheaper… it costs pennies.” Theo applies the floor to models. We apply it to the environment. Types, the fence, and cartridges36 that pull out cleanly raise the floor for every agent working here. That floor is what makes long-running agent loops worth leaving unattended.

Range. At CascadiaJS 2026 Theo closed with “build bigger.” A month later he refined it: “bigger is probably the wrong word… It’s time to think wider7.” He means range, how much ground your software covers. A team could never match AWS’s range without thousands of engineers. Now “you can build a database platform into your product in a day or two.” He also says to architect products so users can build the features you are missing. And in his words, “wider prompting requires higher floors.” He names the bottleneck too: “building is now like a thirty minute process… but the deploying hasn’t went down at all.” Composable Layers that carry their own infrastructure are our answer to that gap. The compiler checks resource requirements; plans and real-infrastructure checks prove the deployed behavior.

Theo’s case for ambition is to prompt further. Lauren’s method is to build the environment. We take the ambition from him and the method from her.

Layers are composable SaaS

With Alchemy, an Effect Layer can declare the cloud resources it needs. Providing the Layer provisions them on the next deploy. Sam calls this “SaaS as NPM.” We build on it:

Alchemy spans providers. One stack can run Cloudflare next to PlanetScale, and that range is part of the point.

The house rule: a clean playground

The house rule9 is a clean, organized playground where real work gets done. It sets no limit on size. Picture clear, labeled bins on shelves that push in and pull out like game cartridges. Anything good can go in if it passes the cartridge test:

Everything built here is real.

Outcomes

Current priorities

  1. Electrify the trust fence. Fuckin agent cheaters stay uncomfortable and obvious. They will feel shame and we will thwart them.
  2. Hold advocacy and judgment together. Teach the judgment and let Alchemy win on merit.
  3. Prove the claims in code, cheapest first:
    1. Importing apps/infra/alchemy.run.ts deploys nothing, and removing a binding is a type error.
    2. A database service tag with two vendor Layers, Cloudflare D1 and Hyperdrive in front of PlanetScale Postgres, with Drizzle inside each vendor. D1 is the free bin. PlanetScale has no free tier, and its cheapest database is single-node Postgres. The tag sits above Drizzle, so swapping vendors stays one line.
  4. Prove behavior against real infrastructure where local fakes differ. The database suite currently uses local SQLite and PGlite; per-PR deployed-resource tests remain a goal, not existing coverage.
  5. Keep the teaching surface aligned with the running application. /systems records what each shipped system does, the standard it keeps, and how to check it. Request analytics18 runs with a server-set persistent rat_vid cookie; event bodies exclude request bodies and sensitive query keys.
  6. Prove the signup lifecycle through an external list provider behind job-shaped ports. Submission starts double opt-in11; a person confirms their email before joining. Agents apply through joinInterest over MCP27, HTTP, or the CLI with a single-use page ticket and the person’s approval of the exact card; confirmation is still required.
  7. Coming: extract the existing agent front door7 in apps/site (REST, MCP, A2A, code-mode sandbox, rate limits) into a cartridge that a project provides instead of inherits.

Questions this repo answers in code

Open questions

Merge by default

Needs sign-off

Will not do for now

Decision boundaries

Amendment policy

This document changes when the thesis is wrong, not when a downstream project’s product is different. Agents may propose amendments with receipts. Joel approves. A project that grows out of rat-stack writes its own VISION.md instead of stretching this one.


Last changed 2026-10-10 in 978dccc. Source on GitHub. Change log.

Linked from

  1. A clean playground. rat-stack does real work with packages that stay easy to add and remove.
  2. Agent rules for rat-stack (AGENTS.md). What you may change, which commands to run, and which changes need approval.
  3. Build and run rat-stack (README.md). What is in the repo, how the example works, and how to run it.
  4. Effect + Alchemy peer patterns. Source-grounded patterns from repos on nearby Effect and Alchemy pins.
  5. learn-alchemy. Learn how Alchemy 2 turns an Effect program into a planned Cloudflare deployment.
  6. uncomplect. Find responsibilities that a rat-stack design combines, separate them into capabilities, cartridges, machines, features, and clients, and enforce that separation through types and checks. Use when asked to simplify, review, or replace a design, "what would Rich Hickey do", "optimize for deletion", or "define this error out of existence".