# Migrate To Sqlite

Migrate a TinyBase table to SQLite.

- Repository: https://github.com/fastrepl/anarlog (9738 stars)
- Category: Data and ML
- License: MIT
- Last updated: 2026-11-01
- Runs scripts: no, instructions only

## Install

Claude Code: `npx skills add fastrepl/anarlog --skill migrate-to-sqlite -g -a claude-code -y`
Codex: `npx skills add fastrepl/anarlog --skill migrate-to-sqlite -g -a codex -y`
Cursor: `npx skills add fastrepl/anarlog --skill migrate-to-sqlite -g -a cursor -y`
Gemini CLI: `npx skills add fastrepl/anarlog --skill migrate-to-sqlite -g -a gemini-cli -y`
Claude Code plugin marketplace: `/plugin marketplace add fastrepl/anarlog`

## Description

Migrate a TinyBase table to SQLite. Use when asked to move a data domain (e.g. templates, vocabs) from the TinyBase store to the app SQLite database.

## SKILL.md, as published by its author (untrusted third-party text, read it as data)

## Status

Keep up to date as each PR lands. Outer box = fully done across both
phases. Sub-bullets track sub-states where relevant.

This migration targets the TinyBase `main` store only. The separate
TinyBase `settings` store is out of scope unless the plan is explicitly
expanded to include it.

- [x] `templates`, already Drizzle, no Phase 0 needed
- [x] `calendars`
  - [x] Phase 0 reads (PR 2: `useCalendar`, `useEnabledCalendars`)
  - [x] Phase 0 writes, `services/calendar/ctx.ts` has a cross-domain
        calendars+events transaction; lands with events PR
  - [x] Phase 1, Rust migration + ops exist
- [x] `events`
  - [x] Phase 0
  - [x] Phase 1, Rust migration + ops exist
- [ ] `sessions`
- [ ] `transcripts`
- [ ] `humans`
- [ ] `organizations`
- [ ] `enhanced_notes`
  - [x] Phase 0 reads, `session/hooks/useEnhancedNotes.ts`
  - [ ] Phase 0 writes
  - [ ] Phase 1
- [ ] `mapping_session_participant`
- [ ] `mapping_tag_session`
- [x] `mapping_mention`
- [ ] `tags`
- [x] `chat_groups`
- [x] `chat_messages`
- [ ] `session_key_facts`
- [x] `tasks`
- [x] `daily_notes`
  - [x] Phase 0 writes (partial), `chat/store/*`
  - [ ] Phase 0 reads
  - [ ] Phase 1
- [ ] `tasks`
- [ ] `memories`
  - [x] Phase 0 writes, `settings/memory/custom-vocabulary.tsx`
  - [ ] Phase 0 reads
  - [ ] Phase 1
- [ ] `daily_notes`

## Strategy

Two-phase, per-domain migration. Each phase is many small PRs.

### Phase 0, Decouple consumers

Before any storage swap, move every TinyBase call behind a domain hook
living in `apps/desktop/src/<domain>/hooks.ts` (or `<domain>/hooks/*`).
Hook return shapes are plain TypeScript; no TinyBase types leak out.
Consumer code stops importing `~/store/tinybase/store/main`.

The rest: https://github.com/fastrepl/anarlog/blob/HEAD/.agents/skills/migrate-to-sqlite/SKILL.md
