Add a store

A service is a named interface for one job. Its port declares the operations that callers need. An adapter implements those operations for a storage provider.ΒΆ

Effect describes work with typed failures36 and required dependencies. Schema defines accepted values and their runtime checks.ΒΆ

A Layer builds services and supplies their construction dependencies. Alchemy declares and deploys cloud resources through Effect programs.ΒΆ

A capability is one named action with shared value definitions and a server-side implementation.ΒΆ

Read AGENTS.md first. Follow its source-first rules before changing Effect or Alchemy code. Start from packages/database and check which storage requirements it meets.ΒΆ

1. Name the facts and their owner

Read skills/rat-stack-mode/principles/name-the-system-of-record.md and skills/rat-stack-mode/principles/no-dual-writes.md.ΒΆ

2. Define operations for the application job

The existing port has no atomic multi-write operation. Do not imply that two port calls share a transaction. If a source write and cursor must commit together, design that operation before building the adapter.ΒΆ

3. Validate input and decode stored rows

Read skills/rat-stack-mode/principles/validate-before-durable-write.md.ΒΆ

4. Implement each vendor and bound reads

Read skills/rat-stack-mode/principles/bound-every-read.md and skills/rat-stack-mode/principles/measure-real-limits.md.ΒΆ

5. Carry schemas, migrations, and resources together

6. Prove the behavior on every storage implementation

Use packages/database/test/run-log.test.ts and packages/database/test/local-layers.ts as the executable references.ΒΆ

The current tests compare both storage implementations with examples. Deployed-provider behavior and vendor switching remain unproven. Name those gaps when reporting. Add real-infrastructure proof when the runtime differs from these substitutes.ΒΆ

7. Compose, validate, and report

Provide the chosen Layer at the app’s composition root16. Expose new actions through add-a-capability. For stateful workflows, also follow add-a-lifecycle-machine. Run pnpm turbo run check test build and fix failures without weakening the fence39. The fence is the compiler checks, lint rules, and hooks that reject prohibited code and shortcuts.ΒΆ

Report:ΒΆ


Last changed 2026-10-07 in f1a00f2. Source on GitHub. Change log.

Unlinked mentions (2)
  • rat-stack-mode β†’ md: copying a fact across stores or maintaining a read model.ΒΆ
  • uncomplect β†’ In domain-driven design (DDD), a read model is derived data arranged for queries.