The store

VirtaStore is the client's working set: it replays the sync log from a cursor, folds it in RAM, and answers every query from memory. Writes go to the log first and are applied from what the log returns, so the store never shows a state the log doesn't hold.

This is the implementation floor the design commits to for M1/M2: if the active task list can't fit in a laptop's RAM and filter instantly, there are bigger problems. Nothing smarter is built until a measured board needs it.

The store is framework-free. observe() tells you when tasks changed; the <tosi-virta> component wires that into tosijs bindings.

import { MemoryLog, VirtaStore, counterIds, stepClock } from 'tosijs-virta'

const store = new VirtaStore({ log: new MemoryLog(), identity: 'demo', ids: counterIds(), clock: stepClock() })
await store.load()
const t = await store.create({ title: 'write the docs', tags: ['project:tosijs-virta', 'status:doing'] })
await store.comment(t.id, 'started')
await store.close(t.id, 'shipped')

const lines = []
for (const entry of store.transcript(t.id)) {
  lines.push(entry.type === 'group' ? `(${entry.label})` : `${entry.event.by}: ${entry.event.kind}`)
}
preview.textContent = lines.join('\n')
test('the transcript attributes each event to the identity that wrote it', () => {
  expect(preview.textContent).toBe('demo: created\ndemo: commented\ndemo: closed')
})