Skip to content

feat: classification persistence via classifications.jsonl#137

Draft
ccage-simp wants to merge 1 commit into
afar1:mainfrom
ccage-simp:feat/classification-persistence
Draft

feat: classification persistence via classifications.jsonl#137
ccage-simp wants to merge 1 commit into
afar1:mainfrom
ccage-simp:feat/classification-persistence

Conversation

@ccage-simp
Copy link
Copy Markdown
Contributor

@ccage-simp ccage-simp commented May 2, 2026

Description

This PR implements "Classification Persistence" to protect classification data if the SQLite database is dropped, and to allow classifications to be synced across machines.

It introduces a secondary source of truth: ~/.ft-bookmarks/classifications.jsonl.

The Use Case: Multi-Machine Syncing

Users who sync their ~/.ft-bookmarks/ folder across computers via Git currently lose their classifications because bookmarks.db is ignored. Running ft index on a second machine builds a fresh database with zero classifications, leading to redundant LLM usage to re-categorize the same data.

The Implementation

  1. The Save Hook: Modified classifyWithLlm and classifyDomainsWithLlm to append a ClassificationRecord to classifications.jsonl whenever a batch successfully returns from the LLM.
  2. The Self-Heal Hook: Modified buildIndex in src/bookmarks-db.ts to read classifications.jsonl into memory prior to rebuilding. Unclassified records that have a backup in JSONL are automatically hydrated with their categories and domains.
  3. The Export Utility: Added ft classify --export to allow existing users to dump their current SQLite classifications into the JSONL backup file.

This ensures that classifications are preserved during index rebuilds and can be tracked in Git alongside bookmarks.jsonl for easier cross-machine syncing.

@ccage-simp ccage-simp force-pushed the feat/classification-persistence branch from 23a74e6 to a0961cc Compare May 3, 2026 15:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant