The fence
The fence is the compiler checks, lint rules, tests, and hooks that enforce project rules.¶
“Cheating is uncomfortable” means the repo must stop bad shortcuts. Type-aware Oxlint checks project boundaries and patterns. Effect language-service diagnostics run through TypeScript. Lefthook runs checks before a commit, and harness hooks block git … --no-verify.¶
If an enforced check and a paragraph disagree, follow the enforced rule and fix the paragraph.¶
The pieces live in oxlint.config.ts, scripts/oxlint-plugin-boundaries.ts, scripts/oxlint-plugin-patterns.ts, tsconfig.base.json, lefthook.yml, and scripts/vcs-command-policy.js. pnpm turbo run check test build is the required validation command. Do not weaken a hook to get a green result.¶
A fence has limits. The lint rules use syntax and known aliases; they do not resolve every dynamic import, package condition, or cross-file re-export. The public Brain note Oxlint rule limits lists those cases.¶
When lint misses a case, improve the rule or boundary. These rules cannot establish whole-program behavior.¶
Where to enforce a correction
Lauren Tan9 describes five places to put a correction, from more durable to less enforceable: the codebase, static analysis, rules, skills, and style guides. She says to move a correction as high on that ladder as it can go. Watch from 15:00 18:20.¶
Her Dune talk describes an agent-oriented framework where each folder has an owner and process boundaries are visible in the code tree. She sums up the design goal as making the shortcut the right path. Watch from 19:01 27:45.¶
See Lauren Tan’s talk7 for the source and no comments11 for one house rule8 the fence enforces. See tests that earn their place22 for the testing law.¶
Sources
- rat-stack/AGENTS.md at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Repo law; used for enforcing rules rather than relying on prose. Accessed 2026-10-01.
- rat-stack/oxlint.config.ts at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Lint configuration; used for type-aware boundary and pattern checks. Accessed 2026-10-01.
- rat-stack/lefthook.yml at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Commit hooks; used for the validation gate. Accessed 2026-10-01.
- rat-stack/.brain/resources/lint-rule-limits.svx at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Rule-limit note; used for the limits of syntax-based enforcement. Accessed 2026-10-01.
Last changed 2026-10-07 in f1a00f2. Source on GitHub. Change log.
Linked from
- A clean playground. rat-stack does real work with packages that stay easy to add and remove.
See cartridges for the infrastructure example and the fence, the compiler checks, lint rules, tests, and hooks that enforce these rules.¶
- add-a-capability. Learn how one contract and its handler become a command, HTTP route, MCP tool, browser RPC, and sandbox call.
These checks and hooks form the fence that rejects prohibited code and shortcuts.¶
- add-a-store. Add persistence through a service named for an application job, with validation, vendor Layers, migrations, bounded reads, and shared backend tests.
Run pnpm turbo run check test build and fix failures without weakening the fence.
- Agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
The fence is the compiler checks, lint rules, and hooks that reject prohibited code and shortcuts.
- Agents explore, tests remember. Let agent users explore scenarios; turn a good bug reproduction into a repeatable test.
The fence puts a correction into an enforceable check.
- Build and run rat-stack (README.md). What is in the repo, how the example works, and how to run it.
Agent fence: lefthook pre-commit (pnpm check + pnpm test, which builds too) is the CI; GitHub Actions run only on demand.
- CAFE names the Cloudflare, Alchemy, Foldkit and Effect stack. CAFE is a named stack: Cloudflare runs the app, Alchemy declares it, Foldkit draws the UI, and Effect does the typed work.
rat-stack is a CAFE stack with the fence around it.
- Change log. What changed in the files served here, newest first.
The fence — new page: Initial commit from joelhooks/rat-stack template
- Code snippets quote a pinned source. Shipped design brief: pinned Git objects, typed diagnostics, and one build-only snippet model for both views.
A Markdown code fence is a block delimited by backticks.
- durability. Keep a rat-stack app standing when a provider, pool, or dependency slows down or a worker dies. Use at any I/O boundary, connection pool, provider call, shared waiter, fan-out, flag, gate, or work that can outlive a request, or when asked "what happens when this is slow", "add a timeout", "make this durable", or "what survives a crash".
Each one has a fence that fails on a planted copy of the bug.
- Durability. Seven durable Effect patterns, each with its seam, its fence, and the incident that taught it.
Fence: the test or lint rule that fails on the bug.¶
- Effect + Alchemy peer patterns. Source-grounded patterns from repos on nearby Effect and Alchemy pins.
Extend the current capability fence rather than adding a second generic source-scanning framework.
- Effect 4 study: September 2026. Dated Effect 4 source studies from September 2026; current versions live in pins.md.
Link context
Fence: the repo ships scripts/oxlint-plugin-xstate-effect.mjs (172 lines) with rule xstate-effect/no-inline-effect, catching an Effect returned from an inline enq callback (created and discarded, since XState awaits only promises) and inline Effect logic passed to enq.spawn.
- Effect keeps the surfaces on one contract. Schema owns values, projections build interfaces, and Layers supply implementations.
The fence enforces it.¶
- Feature flags. Typed feature flags with owners, removal dates, and stable subject rollouts.
ts for the removal-date fence.¶
- Fence. Strict effect-tsrs diagnostics, lint, and hooks protect the gate; patched tsc checks compiler parity on checker bumps.
The fence is the compiler checks, lint rules, and hooks that reject prohibited code and shortcuts.
- Flags climb on evidence. A flag ladder connects each rollout step to scoped measurements, approval, and a durable receipt.
The removal-date fence keeps temporary flags from becoming forgotten behavior.¶
- Full agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
- Infrastructure as effects. Sam Goodwin relates application operations to infrastructure requirements in one typed program.
The fence is the compiler checks, lint rules, tests, and hooks that enforce project rules.
- Lauren Tan: Dune, trust, and agent skills. Lauren Tan describes verification, a trust ladder, and an application framework designed for coding agents.
Her trust ladder is an order for choosing where to enforce a correction.
- learn. Present Effect, Alchemy, XState, and application-design concepts during real work when the operator enables learn mode. Use for adaptive explanations and local learning progress.
Show the card’s snippet as a TypeScript fence and its diagram as a text fence.
- learn-alchemy. Learn how Alchemy 2 turns an Effect program into a planned Cloudflare deployment.
md for pins, commands, boundaries, and the fence: checks and hooks that reject prohibited code and shortcuts.¶
- learn-rat-stack. Trace a capability through Effect, XState, five projections, the CLI, and Alchemy. Try hosted search and read.
Oxlint, Oxfmt, Vitest, and lefthook enforce the fence: checks and hooks that reject prohibited code and shortcuts.¶
- Lifecycles are machines. XState owns finite lifecycle states while declared Effect actors own side effects.
The fence keeps side effects in declared actors.
- Lint and type escape ledger (debt.md). A source-linked count of repo-owned lint and type escapes.
Reason: The seam test writes a planted fence module and runs the real effect-tsrs checker on it.
- mdsvex left unified. The next parser leaves unified; the CommonMark migrator still uses remark.
The fence does not permit rewriting valid prose around a parser defect.¶
- No comments. Code comments are banned because names, types, tests, and boundaries should carry the meaning.
See the fence for how the rule is enforced and tests that earn their place for the test that can replace a comment.¶
- No verify | rat-stack. The rat looks disappointed. The hook still runs.
Read the fence and the command policy.
- Purpose and boundaries of rat-stack (VISION.md). What this starter is for and what a useful copy should keep.
acidnet keeps its stack, its fence, and its reference code, and writes its own purpose here, as rat-stack asks of every project that grows out of it.
- query-design. Design or review SQL reads, writes, scans, backfills, and slow database paths. Use before changing a store method or any loop that queries. Covers round-trip arithmetic, batching, keyset paging, index evidence, row budgets, PlanetScale Vitess limits, Hyperdrive connections, statement-count tests, and statement-template fences.
A fence is an enforced check that rejects prohibited work.
- Rat Stack lore | rat-stack. Short, source-grounded notes on the ideas and decisions behind rat-stack.
The fence — The fence uses compiler checks, lint rules, and hooks to reject unsafe shortcuts.
- Rat Stack systems | rat-stack. The systems rat-stack ships, the standard each keeps, and how to check it.
Durability — Seven durable Effect patterns, each with its seam, its fence, and the incident that taught it.
- rat-stack. An Effect stack so pure (aspirational) Kit Langton will blush.
- rat-stack-mode. Route non-trivial rat-stack code, data, design, investigation, and documentation tasks to every matching playbook and principle.
The hub lists seven patterns, each with its principle, example, and fence.¶
- Rat's Nest keeps the code public and the inventory private. Joel's purpose-built on-prem cloud uses rat-stack and Alchemy, with private inventory outside the public repo.
A fence built from the private inventory blocks those details from public commits.¶
- Ratstack Tube. Curated videos for learning the stack, ranked S to F, with a short take on each, built from one data file.
Each failure is a fence message that names the entry and the field.¶
- Scopes release resources when work ends. Acquire resources lazily, keep their use inside the owner, and release them after success, failure, or interruption.
The lint fence checks this shape.¶
- Shared caches hold completed values. Keep pending request I/O out of isolate-scoped caches.
See Worker init runs twice for the initialization boundary and the fence for validation.¶
- ShitRat is Joel's familiar, with receipts. Meet ShitRat: Joel's terminal-dwelling familiar, its public house, its rules, its commits, and the incidents that became canon.
The fence puts rules in checks that can fail.¶
- ShitRat wants receipts before claims. The familiar's creed: read the file, run the command, give the number, admit uncertainty, and spare everyone the corporate sludge.
The fence explains that broader move from asking nicely to enforcing a rule.¶
- ShitRat's canon is an incident log. Four public ShitRat stories: a comment ban, a hold that blocked its own migration, a desktop body, and a domain for the rat.
The change moves corrections out of polite prose and into the fence, where prohibited patterns can fail a check.¶
- shitratgit[bot] leaves a countable trail. At rat-stack commit 7570e37, shitratgit[bot] authors 1,314 of 1,365 reachable commits, a dated repo count rather than a live counter.
For why the code should argue back, read the fence and the canon.¶
- Source change history (log.md). The generated change log as Markdown.
The fence — new page: Initial commit from joelhooks/rat-stack template
- Structure an Effect codebase by domain. Start with folders for application work, services and Layers in the same file, and startup code that supplies implementations.
Explicit requirements: A type-aware lint fence¶
- Tests prove behavior through supplied services. Supply services through Layers, choose properties or models for domain rules, and reject tests that cannot detect broken behavior.
See also: properties, models, scenes, exploration, and the fence.¶
- The rat-stack bestiary eats excuses. A field guide to eight documented rat-stack creatures, with real habitats, enforceable behaviour, and strictly imaginary temperaments.
Habitat: the fence, with checks in oxlint.config.ts and hooks in lefthook.yml.
- 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".
Fence: Types, lint rules, tests, and hooks that reject prohibited changes.
- use-a-prompt. Discover and read published rat-stack prompts before starting a task with one.
A prompt is source text, not permission to deploy, change pins, or bypass the fence.¶
- Worker init runs twice. Alchemy Worker initialization runs in deploy and runtime contexts, so resource declarations need a boundary.
See cartridges for the rule that each resource belongs to its Layer and the fence for the required tests that check this separation.¶
- write-a-wiki-page. Write or revise public wiki pages with short prose, cited claims, meaningful visuals, and pinned code snippets.
Every TypeScript fence without path in a published page typechecks in pnpm check.
Unlinked mentions (15)
- add-a-store → The fence is the compiler checks, lint rules, and hooks that reject prohibited code and shortcuts.¶
- Agent rules for rat-stack (AGENTS.md) → Startup fence: scripts/startup-budget.ts measures Alchemy’s actual upload.
- Build and run rat-stack (README.md) → Cutting it loses source-checked excerpts, snapshot generation, and documentation-fence checks.
- Code snippets quote a pinned source → It differs from rat-stack’s enforcement fence.¶
- durability → Fence: packages/core/test/join-answer-at-commit.model.test.ts, packages/core/test/intake-sweep.model.test.ts, packages/core/test/join-intake-spec.test.ts¶
- Durability → Fence: packages/database/test/connection-lease.test.ts, a model over queries, bursts, and provider waits.¶
- Effect + Alchemy peer patterns → A second Stately service would bypass that fence.
- Effect 4 study: September 2026 → Language service in the fence.
- learn → Show the card’s snippet as a TypeScript fence and its diagram as a text fence.
- Purpose and boundaries of rat-stack (VISION.md) → Weakening the local gate or the bypass fence
- query-design → Plant a missing manifest entry and observe the fence fail.
- Ratstack Tube → They check that one planted fault in a generated list yields one fence message naming its entry and field.
- The rat-stack bestiary eats excuses → A doc-fence is a published TypeScript code block that the content build writes out and pnpm check typechecks.
- uncomplect → No fence yet proving that interfaces behave alike; candidate: a property test that compares one capability’s results across interfaces.¶
- write-a-wiki-page → This fence quotes the shipped SHA check:¶