One capability, every surface

A capability is one named action with a contract and a server-side handler. A contract defines the shared input, output, failures, and metadata. Effect Schema provides types and runtime checks for these values. defineContract owns the name, Effect schemas, annotations, and approval setting. implement binds that contract to its handler.

Here, a surface23 is an interface for calling the action. A projection converts registered capabilities into an interface. The interfaces are command line, HTTP, MCP tools, browser RPC, and code mode21. Each interface derives its input and failure definitions from the same schemas.

The split replaced defineCapability, which bundled contract data and its handler in one definition. The RPC client needed the contract without importing server implementation. toRpcGroup now projects contracts alone; toRpc connects those same contracts to implemented capabilities. The browser docs client imports only the shared contracts and RPC group. Commit 9a7bea5 records the split.

To add a capability, define its contract and implement it beside the data or infrastructure it owns. Register it in capabilities21, then check each interface you keep. packages/capability/test/ exercises projections; apps/site/src/capabilities/index.ts shows the hosted registry.

Michael Arnaldi6 demonstrates Schema decoding17 request input and encoding a frontend-safe result while preserving its output type. Effect Meetup SF, 27:17. In another conversation, the speakers discuss generated schemas and migrations as work agents can maintain, and a rule that rejects ad hoc JSON parsing. Cause & Effect 10, 63:49 67:53.

Analytics18 shows a separate infrastructure cartridge36; interest signup12 shows core ports with a delivery adapter outside core. Neither turns static pages or protocol discovery into domain capabilities.

See lifecycles are machines20 for stateful handlers and cartridges36 for the infrastructure boundary. HATEOAS9 covers links that guide an agent’s next action; hexagonal architecture19 names the ports-and-adapters principle.

Sources

  1. rat-stack/AGENTS.md at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Projection law; used for one contract across every interface. Accessed 2026-10-01.
  2. rat-stack/packages/capability/src/implement.ts at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Handler binding; used for separating contracts from implementations. Accessed 2026-10-01.
  3. rat-stack/packages/capability/src/to-rpc-group.ts at main · joelhooks/rat-stack · GitHub. GitHub joelhooks/rat-stack. Client RPC projection; used for contracts without server handlers. Accessed 2026-10-01.

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

Linked from

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

    One capability, every surface — A schema-typed contract and one handler feed every interface rat-stack keeps.

  2. An MCP your users want. Rhys Sullivan's practical guide gives rat-stack a checklist for useful MCP tools.

    See one capability, every surface and the cartridges page for the contracts and auth boundary.¶

  3. 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.

    See one capability, every surface and infrastructure as effects.¶

  4. Capabilities. Named application actions exposed through generated interfaces share one definition and one server-side implementation.

    See one capability, every surface for why.¶

  5. Cartridges. A cartridge owns one job and brings the infrastructure its service needs.

    See one capability, every surface for the shared contract and a clean playground for the house rule behind these boundaries.¶

  6. Change log. What changed in the files served here, newest first.

    One capability, every surface — edited: docs: point live docs, skills and Brain pages at apps/site

  7. Effect keeps the surfaces on one contract. Schema owns values, projections build interfaces, and Layers supply implementations.

    One capability, every surface states the house rule.

  8. Full agent guide. An Effect stack so pure (aspirational) Kit Langton will blush.
  9. HATEOAS. Links in a representation tell its reader what to do next; rat-stack applies that idea to agent-facing pages and responses.

    One capability, every surface describes the existing projections.

  10. Hexagonal architecture. Ports name the application's jobs; adapters connect them to the outside world.

    One capability, every surface starts with a contract, binds a handler, and projects CLI, HTTP, MCP, RPC, and code mode.

  11. Infrastructure as effects. Sam Goodwin relates application operations to infrastructure requirements in one typed program.

    A contract defines shared input, output, failures, and metadata.

  12. learn-rat-stack. Trace a capability through Effect, XState, five projections, the CLI, and Alchemy. Try hosted search and read.

    A projection builds a callable interface from capabilities.¶

  13. Lifecycles are machines. XState owns finite lifecycle states while declared Effect actors own side effects.

    See one capability, every surface for how a capability can own a machine and the fence for the rule that protects it.¶

  14. Rat Stack lore | rat-stack. Short, source-grounded notes on the ideas and decisions behind rat-stack.

    One capability, every surface — A schema-typed contract and one handler feed every interface rat-stack keeps.

  15. rat-stack. An Effect stack so pure (aspirational) Kit Langton will blush.
  16. Run Effect at the integration boundary. Build the runtime where a calling framework enters, reuse its services, and dispose it when that integration ends.

    In rat-stack, capabilities remain the shared interface for application actions.

  17. Schema projections: 2026-09-18 history. Historical Effect rc.115 proposal and implementation receipts from 2026-09-18; use the one-capability-every-surface lore page for the current pattern.

    Read One capability, every surface for today’s defineContract → implement pattern, including browser RPC, and current pins.

  18. Source change history (log.md). The generated change log as Markdown.

    One capability, every surface — edited: docs: point live docs, skills and Brain pages at apps/site

Unlinked mentions (18)