AGENT SKILL

loom-architecture

Apply the repository-wide Loom Architecture—Log-Oriented Outcomes and Materializations—when designing, implementing, reviewing, debugging, or documenting NATS and JetStream event-sourced applications. Use for work involving NATS account boundaries, a primary event stream, optimistic concurrency control, projections and read-your-writes, snapshots or checkpoints, snapshot repositories, durable workers, or reliable external effects.

License 许可
AGPL-3.0
所属仓库
chattocorp/chatto
最近更新
2026-11-15
Stars
★ 3.0k
Forks
152

01 前言 Front Matter

name
loom-architecture
description
Apply the repository-wide Loom Architecture—Log-Oriented Outcomes and Materializations—when designing, implementing, reviewing, debugging, or documenting NATS and JetStream event-sourced applications. Use for work involving NATS account boundaries, a primary event stream, optimistic concurrency control, projections and read-your-writes, snapshots or checkpoints, snapshot repositories, durable workers, or reliable external effects.

02 资源文件 1

03 SKILL.md 正文

Loom Architecture

Loom stands for Log-Oriented Outcomes and Materializations. It is an architecture for building event-sourced applications on NATS and JetStream.

commands -> event log (EVT role) -> materializations
                                 -> durable workers -> outcomes

Log-oriented

Each application runs in its own NATS account. Within that account, one primary JetStream stream holds the application's durable domain events. Loom calls the stream's logical role EVT; the application chooses its physical resource name.

The event log is the source of truth. Commands decide what should happen and append new events only if the relevant history has not changed. This is optimistic concurrency control: concurrent changes cannot silently overwrite each other. Applications define their own events, subjects, and aggregate boundaries. Events may use Protobuf, but Loom does not require a particular encoding.

Materializations

Materializations are views of the event log built for a particular use. They are commonly called projections or read models. A materialization may live in RAM, in NATS, in a local database, or in an external system.

Materializations are derived state, not another source of truth. They can be discarded and rebuilt by replaying the event log. Snapshots and checkpoints can make that rebuild faster, but they are still disposable and are not backups of the event log.

A Loom framework can provide reusable projection bases, especially for in-memory projections, plus snapshot repository interfaces and implementations for storage such as NATS Object Store or S3-compatible object storage.

Outcomes

Outcomes are reliable asynchronous work caused by committed events: sending an email, calling a webhook, updating another system, or performing any other follow-up that must survive a restart.

Durable workers use named JetStream consumers so unfinished work remains available after crashes or handoffs between processes. Delivery is at least once, so outcome handlers must tolerate receiving the same event more than once. Projections only derive state; durable workers perform external effects.

Storage conventions

ADR-114 gives the storage rules for each Loom application:

  • Resource names, configurations, subjects, key shapes, value encodings, and durable consumer names are persisted contracts. Change them only with a migration that is safe when replicas of different versions run together.
  • Use an existing resource first. A new resource needs a lifecycle, retention, storage type, or backup policy that no existing resource gives.
  • Declare each resource once: name, configuration, and backup policy. Pin the configuration with a test.
  • Encode new records as protobuf from the package for their storage contract.
  • Build each key family in one place: prefix first, then owner identifiers from the widest to the narrowest scope. Each application selects one key style.
  • Classify OCC conflicts with jetstreamutil.IsSequenceConflict, and read the key again after a Create conflict.
  • Report every durable consumer in the operator diagnostics.

Framework and application

The framework supplies the reusable mechanics for publishing events, replaying materializations, taking and restoring snapshots, and running durable workers. The application supplies the domain: its event types, subjects, decisions, projection logic, outcome handlers, and operational policy.

In short: events record what happened, materializations make those facts easy to use, and durable workers reliably turn them into external outcomes.

04 同仓库更多 Skills

chattocorp
chattocorp/chatto

writing-tests

Instructions and hints for writing tests.

内容创作者写作与文案
★ 3.0k
chattocorp
chattocorp/chatto

update-project-dependencies

Update Chatto Go and frontend dependencies within their compatible version ranges, then run tests.

前端开发
★ 3.0k
chattocorp
chattocorp/chatto

svelte-docs

Look up official Svelte, SvelteKit, and Svelte CLI documentation.

★ 3.0k
chattocorp
chattocorp/chatto

svelte-core-bestpractices

Guidance on writing fast, robust, modern Svelte code. Load this skill whenever in a Svelte project and asked to write/edit or analyze a Svelte component or module. Covers reactivity, event handling, styling, integration with libraries and more.

★ 3.0k
chattocorp
chattocorp/chatto

svelte-code-writer

CLI tools for Svelte 5 documentation lookup and code analysis. MUST be used whenever creating, editing or analyzing any Svelte component (.svelte) or Svelte module (.svelte.ts/.svelte.js). If possible, this skill should be executed within the svelte-file-editor agent for optimal results.

开发工程师Skill与智能体开发
★ 3.0k
chattocorp
chattocorp/chatto

session-wrap-up

Review a completed, paused, or blocked coding-agent session to identify friction, mistakes, near misses, missing context, and opportunities to improve future work. Use when the user asks to wrap up, run a retrospective, explain what issues the agent faced, capture lessons learned, or recommend improvements to repository instructions, documentation, skills, tooling, tests, or workflows. Produce an evidence-based, propose-only report; do not apply follow-up changes unless the user asks.

★ 3.0k