Files
hemx/docs/recipes/local-command-log.md
T
slhx agent 1ec68d400c feat(local): decide local stays app territory
Define local/offline truth as commands, domain events, and projections rather than stored DOM patches or EffectBatch payloads; wire the techdemo through a local command-to-projection-to-effect flow; document that hemx-local is not a crate until reusable semantics are proven.

req: local/001

req: local/002

req: local/003

req: local/004

req: examples/001
2026-06-11 19:52:21 +02:00

2.3 KiB

Recipe: local command log

A hemx app may feel local-first without making hemx core a client database or sync framework. The local artifact is an app-owned command/event log plus a projection; hemx effects are rendered output, not stored truth. req: local/001 req: local/002

Decision: no hemx-local crate yet

hemx local remains an app/recipe pattern for now, not a reusable hemx layer. The host capability path proves that thin typed contracts work when the shared semantics are obvious: manifest, call, event, and host-check failure. The local exemplar proves a safer boundary for offline work: command, domain event, projection, then EffectBatch. It does not yet prove common storage, reconciliation, export, deletion, or conflict semantics across apps, so a crate would freeze product policy too early. req: local/002 req: local/003 req: local/004

A future reusable layer must first prove at least two independent apps share the same command-log contract without sharing domain policy, storage provider, sync provider, or conflict rules. Until then, recipes and app-owned integrations are more honest and easier to delete. req: local/002 req: local/003

Shape

user intent
→ LocalCommand
→ domain validation
→ LocalEvent
→ Projection
→ hemx EffectBatch

The log may live in memory, IndexedDB, SQLite, a native host store, or another app-chosen persistence layer. That storage choice is not hemx core. req: local/002

Replay and sync

Replaying local work to a server, remote AI/STT gateway, backup target, or peer sync engine is explicit product policy. The app decides what can be queued, exported, deleted, reconciled, retried, rejected, or redacted. A local projection can render immediate feedback while those decisions remain pending. req: local/003

Boundary

Do not persist DOM patches as truth. Do not persist EffectBatch payloads as the local application log. Those are render instructions produced after app/domain code accepts commands and projects events. req: local/001 req: local/004

Use hemx-host only when the local log needs device or shell capabilities such as secure storage, files, haptics, microphone, or notifications. The host still returns facts; app code still owns the command/event/projection policy. req: host/002 req: local/003