How hanyang06/cairn works
Cairn is an early-stage, local-first content-addressed object store and desktop workbench. The intended user flow is a workbench interaction through the desktop IPC/sidecar boundary into a transport-independent Python command API and the kernel’s storage engine, which records block data in pack files and authoritative identity/location metadata in a SQLite catalog. The sampled UI chiefly implements a customizable card board; note-domain types are being rebuilt. Retrieval, garbage-collection triggers, search, and networking are not yet complete. Some desktop and event wiring is documented or indexed but not shown in excerpts, so those relationships are omitted or marked unverified.
Main entry points: engine.py Storage engine · workbench.tsx Workbench page · api.py Kernel command API · init.py Kernel assembly
Components 27
Desktop workbench
- Workbench page
app/src/pages/workbench/workbench.tsx - Card board
app/src/composites/board/board.tsx - Board layout
app/src/board/layout.ts - Board preferences
app/src/board/storage.ts - Card definitions
app/src/board/cards.ts - Font handling
app/src/board/fonts.ts
Desktop boundary
- IPC commands
app/src/ipc/index.ts - Tauri host
app/src-tauri/src/lib.rs - Python sidecar
py_src/app/sidecar.py
Kernel services
- Kernel command API
py_src/core/api.py - Kernel assembly
py_src/core/init.py - Event bus
py_src/core/event/bus.py - Event logging
py_src/core/event/logs.py - Event catalog
py_src/core/event/catalog.py - Kernel errors
py_src/core/exc.py
Object storage
- Storage engine
py_src/core/storage/engine.py - Block identity
py_src/core/storage/db/id.py - SQLite catalog
py_src/core/storage/db/engine.py - Payload encoding
py_src/core/storage/db/payload.py - Block indexes
py_src/core/storage/index/index.py - Hub and packs
py_src/core/storage/hub.py - Storage reclamation
py_src/core/storage/gc.py - Index declarations
py_src/core/storage/types.py
Note domain
- Canvas model
py_src/model/note/types/canvas.py - Line model
py_src/model/note/types/line.py - Note types
py_src/model/note/types
Other components
- User
Connections 33
- User → Workbench page: interacts with
- Workbench page → Card board: renders
app/src/pages/workbench/workbench.tsx - Workbench page → Board layout: settles layout
app/src/pages/workbench/workbench.tsx - Board layout → Card definitions: lays out
app/src/board/storage.ts - Workbench page → Board preferences: serializes preferences
app/src/pages/workbench/workbench.tsx - Workbench page → Font handling: normalizes fonts
app/src/pages/workbench/workbench.tsx - Workbench page → IPC commands: reads and writes
app/src/pages/workbench/workbench.tsx - IPC commands → Tauri host: forwards commands
- Tauri host → Python sidecar: launches sidecar
- Python sidecar → Kernel command API: dispatches commands
py_src/app/sidecar.py - Kernel command API → Kernel assembly: uses kernel
py_src/core/api.py - Kernel assembly → Storage engine: assembles
py_src/core/init.py - Kernel assembly → Event bus: creates
py_src/core/init.py - Kernel assembly → Event logging: subscribes logger
py_src/core/init.py - Event logging → Event bus: subscribes to
py_src/core/event/logs.py - Event logging → Event catalog: routes events
py_src/core/event/logs.py - Kernel command API → Storage engine: reads and deletes
py_src/core/api.py - Storage engine → Block identity: uses identities
py_src/core/storage/engine.py - Storage engine → SQLite catalog: records locations
py_src/core/storage/engine.py - Storage engine → Payload encoding: encodes payloads
py_src/core/storage/engine.py - Storage engine → Block indexes: queries indexes
py_src/core/storage/engine.py - Storage engine → Hub and packs: reads and writes slots
py_src/core/storage/engine.py - Storage reclamation → Storage engine: uses storage
py_src/core/storage/gc.py - Storage reclamation → Hub and packs: reclaims pack space
py_src/core/storage/gc.py - Block indexes → Storage engine: reads index blocks
py_src/core/storage/index/index.py - Block indexes → Payload encoding: decodes index values
py_src/core/storage/index/index.py - Canvas model → Storage engine: uses storage
py_src/model/note/types/canvas.py - Canvas model → Index declarations: declares fields
py_src/model/note/types/canvas.py - Line model → Index declarations: declares fields
py_src/model/note/types/line.py - Line model → Block identity: uses IDs
py_src/model/note/types/line.py - Note types → Storage engine: uses storage
py_src/model/note/types/canvas.py - Python sidecar → Kernel errors: translates errors
py_src/app/sidecar.py - Kernel command API → Kernel errors: raises command errors
py_src/core/api.py