birdclaw 0.1.1 → 0.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -2,6 +2,34 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## 0.2.1 - 2026-04-27
6
+
7
+ ### Changed
8
+
9
+ - Use Twitter wording in public descriptions, docs, CLI help, and release notes.
10
+
11
+ ## 0.2.0 - 2026-04-27
12
+
13
+ ### Added
14
+
15
+ - Add live likes and bookmarks sync through `xurl`/`bird`, local search filters, archive import support, and dedicated Likes/Bookmarks web views.
16
+ - Add Git-friendly JSONL backup sync, export, import, validation, and stale-aware auto-sync for rebuilding or merging the local SQLite store from text shards across machines.
17
+ - Add a scheduled bookmark sync job with launchd installation, JSONL audit logging, overlap locking, and automatic Git backup sync after each refresh.
18
+ - Add launchd env-file support so scheduled bookmark sync can source `bird` credentials without storing secrets in the plist.
19
+
20
+ ### Changed
21
+
22
+ - Update the README tagline and package description for local Twitter memory across archives, DMs, likes, bookmarks, and moderation.
23
+ - Refresh dependencies, including `jsdom` 29.1.0.
24
+ - Hide reply state and reply actions in saved likes/bookmarks web lanes.
25
+ - Shard backup DMs by year and route unknown tweet dates to `data/tweets/unknown.jsonl` so Git backups stay compact and avoid bogus 1970 files.
26
+ - Speed up archive imports plus JSONL backup export, import, and validation for large local datasets.
27
+
28
+ ### Fixed
29
+
30
+ - Fix live bookmark sync to use stored Twitter user ids, force OAuth2 for `xurl` collection reads, and tolerate large/current `bird` bookmark payloads.
31
+ - Fix fresh-machine backup sync so demo data is never exported into Git backups, and keep no-op syncs from creating metadata-only commits.
32
+
5
33
  ## 0.1.1 - 2026-04-27
6
34
 
7
35
  ### Added
@@ -16,7 +44,7 @@ All notable changes to this project will be documented in this file.
16
44
 
17
45
  ### Added
18
46
 
19
- - Add X web cookie fallback for block and unblock actions when the X API rejects OAuth2 block writes.
47
+ - Add Twitter web cookie fallback for block and unblock actions when the Twitter API rejects OAuth2 block writes.
20
48
  - Add `profiles replies` so moderation triage can inspect a user's recent reply pattern before blocking.
21
49
  - Add `blocks import <path>` for one-shot blocklist application from a file.
22
50
  - Add paged `mentions export --mode xurl --all --max-pages <n>` so moderation loops can scan the full retrievable mentions window.
package/README.md CHANGED
@@ -1,12 +1,12 @@
1
- # birdclaw
1
+ # birdclaw 🪶 — Local Twitter memory in SQLite: archives, DMs, likes, bookmarks
2
2
 
3
- `birdclaw` is a local-first X workspace: archive import, cached live reads, focused triage, and reply flows in one local web app + CLI.
3
+ `birdclaw` is a local-first Twitter workspace: archive import, cached live reads, focused triage, and reply flows in one local web app + CLI. Built by [@steipete](https://github.com/steipete/).
4
4
 
5
5
  Status: WIP. Real and usable. Not done. Expect schema churn, transport gaps, and rough edges while the core settles.
6
6
 
7
7
  ## What It Does
8
8
 
9
- - keeps your X data in local SQLite
9
+ - keeps your Twitter data in local SQLite
10
10
  - stores media and avatar cache under `~/.birdclaw`
11
11
  - imports archives when you have them
12
12
  - still works when you do not
@@ -21,7 +21,10 @@ Status: WIP. Real and usable. Not done. Expect schema churn, transport gaps, and
21
21
  - FTS5 search over tweets and DMs
22
22
  - archive autodiscovery on macOS
23
23
  - archive import for tweets, likes, profiles, and full DMs
24
- - profile hydration from live X metadata
24
+ - archive import for bookmark exports when present
25
+ - live likes and bookmarks sync through `xurl` or `bird`
26
+ - Git-friendly text backups with yearly tweet shards and per-conversation DM shards
27
+ - profile hydration from live Twitter metadata
25
28
  - local avatar cache
26
29
  - local media cache root under `~/.birdclaw`
27
30
 
@@ -29,6 +32,7 @@ Status: WIP. Real and usable. Not done. Expect schema churn, transport gaps, and
29
32
 
30
33
  - `Home` timeline
31
34
  - `Mentions` queue
35
+ - `Likes` and `Bookmarks` review lanes
32
36
  - `DMs` workspace with two-column layout
33
37
  - `Inbox` for mixed mention + DM triage
34
38
  - `Blocks` for local blocklist maintenance
@@ -44,6 +48,7 @@ Status: WIP. Real and usable. Not done. Expect schema churn, transport gaps, and
44
48
  - AI-ranked inbox for mentions + DMs
45
49
  - OpenAI scoring hook for low-signal filtering
46
50
  - cached live mentions export in `xurl`-compatible JSON
51
+ - liked/bookmarked tweet filters for archive and live-synced collections
47
52
  - live profile-reply inspection for borderline AI/slop triage
48
53
  - one-shot blocklist import from a file for batch moderation passes
49
54
 
@@ -56,7 +61,7 @@ Status: WIP. Real and usable. Not done. Expect schema churn, transport gaps, and
56
61
  - import batch blocklists in one call
57
62
  - add / remove local mutes
58
63
  - sync remote blocks through `xurl` when available
59
- - fall back to the X web cookie session when OAuth2 block writes are rejected
64
+ - fall back to the Twitter web cookie session when OAuth2 block writes are rejected
60
65
 
61
66
  ### Safety
62
67
 
@@ -77,8 +82,9 @@ If you need polished product-grade sync parity today, this is not there yet.
77
82
 
78
83
  ## Screens
79
84
 
80
- - `Home`: read and reply without fighting the main X timeline
85
+ - `Home`: read and reply without fighting the main Twitter timeline
81
86
  - `Mentions`: work the reply queue with clean filters
87
+ - `Likes` / `Bookmarks`: revisit saved posts from archive or live sync
82
88
  - `DMs`: triage by sender context, follower count, and influence
83
89
  - `Inbox`: let heuristics / OpenAI float likely-important items
84
90
  - `Blocks`: maintain a local-first account-scoped blocklist
@@ -110,6 +116,7 @@ export BIRDCLAW_HOME=/path/to/custom/root
110
116
  - `pnpm`
111
117
  - macOS recommended for Spotlight archive discovery
112
118
  - `xurl` optional for live reads / writes
119
+ - `bird` optional for cookie-backed likes, bookmarks, mentions, DMs, and write fallback
113
120
  - OpenAI API key optional for inbox scoring
114
121
 
115
122
  ## Install
@@ -158,6 +165,18 @@ birdclaw import archive ~/Downloads/twitter-archive-2025.zip --json
158
165
  birdclaw import hydrate-profiles --json
159
166
  ```
160
167
 
168
+ Back up the local SQLite store as canonical JSONL text:
169
+
170
+ ```bash
171
+ birdclaw backup sync --repo ~/Projects/backup-birdclaw --remote https://github.com/steipete/backup-birdclaw.git --json
172
+ ```
173
+
174
+ Merge the backup into the current `BIRDCLAW_HOME`:
175
+
176
+ ```bash
177
+ birdclaw backup import ~/Projects/backup-birdclaw --json
178
+ ```
179
+
161
180
  Start the app:
162
181
 
163
182
  ```bash
@@ -180,6 +199,18 @@ pnpm cli blocks import ~/triage/blocklist.txt --account acct_primary --json
180
199
  pnpm cli search tweets "local-first" --json
181
200
  pnpm cli search tweets "sync engine" --limit 20 --json
182
201
  pnpm cli search tweets --since 2020-01-01 --until 2021-01-01 --originals-only --hide-low-quality --limit 500 --json
202
+ pnpm cli search tweets --liked --limit 20 --json
203
+ pnpm cli search tweets --bookmarked --limit 20 --json
204
+ ```
205
+
206
+ ### Sync likes and bookmarks
207
+
208
+ `auto` tries `xurl` first, then falls back to `bird`. Use `bird` directly when the API path is unavailable for the account/token you have locally.
209
+
210
+ ```bash
211
+ pnpm cli sync likes --mode auto --limit 100 --refresh --json
212
+ pnpm cli sync bookmarks --mode auto --limit 100 --refresh --json
213
+ pnpm cli sync bookmarks --mode bird --all --max-pages 5 --limit 100 --refresh --json
183
214
  ```
184
215
 
185
216
  ### Export mentions for agents
@@ -205,13 +236,13 @@ Home config lives in `~/.birdclaw/config.json`. Example:
205
236
 
206
237
  ```json
207
238
  {
208
- "actions": {
209
- "transport": "auto"
210
- },
211
- "mentions": {
212
- "dataSource": "bird",
213
- "birdCommand": "/Users/steipete/Projects/bird/bird"
214
- }
239
+ "actions": {
240
+ "transport": "auto"
241
+ },
242
+ "mentions": {
243
+ "dataSource": "bird",
244
+ "birdCommand": "/Users/steipete/Projects/bird/bird"
245
+ }
215
246
  }
216
247
  ```
217
248
 
@@ -226,6 +257,7 @@ Notes:
226
257
  - `actions.transport` accepts `auto`, `bird`, or `xurl`
227
258
  - `bird` mode uses your local `bird` CLI and caches its mentions output into birdclaw's canonical store
228
259
  - filters still work in `xurl` mode; filtered payloads are rebuilt from the local canonical store after sync
260
+ - `sync likes` and `sync bookmarks` store live results in the same local timeline table, so `search tweets --liked` and `search tweets --bookmarked` work across archive and live data
229
261
 
230
262
  ### Search and triage DMs
231
263
 
@@ -263,7 +295,7 @@ Notes:
263
295
  - `ban` / `unban` accept `--transport auto|bird|xurl`
264
296
  - `auto` tries `bird` first, then falls back to `xurl` when bird fails
265
297
  - forced `xurl` writes still verify through `bird status` before sqlite changes
266
- - X still rejects pure OAuth2 block writes, so `auto` is the safe default for block/unblock
298
+ - Twitter still rejects pure OAuth2 block writes, so `auto` is the safe default for block/unblock
267
299
  - `blocks import` accepts newline-delimited blocklists with comments and markdown bullets
268
300
  - `blocks sync` is for slow/manual remote reconciliation; not for a hot cron loop
269
301
  - `blocks record` stores a known-good remote block locally without issuing another live write
@@ -324,10 +356,83 @@ pnpm cli compose reply tweet_004 "On it."
324
356
  pnpm cli compose dm dm_003 "Send it over."
325
357
  ```
326
358
 
359
+ ### Text Backup
360
+
361
+ `birdclaw backup export` writes deterministic JSONL shards that can rebuild the local SQLite index without committing SQLite WAL/SHM files, FTS shadow tables, or transient live caches.
362
+
363
+ Layout:
364
+
365
+ ```text
366
+ manifest.json
367
+ data/accounts.jsonl
368
+ data/profiles.jsonl
369
+ data/tweets/YYYY.jsonl
370
+ data/tweets/unknown.jsonl
371
+ data/collections/likes.jsonl
372
+ data/collections/bookmarks.jsonl
373
+ data/dms/conversations.jsonl
374
+ data/dms/YYYY.jsonl
375
+ data/moderation/blocks.jsonl
376
+ data/moderation/mutes.jsonl
377
+ ```
378
+
379
+ Tweets are sharded by year for human browsing and yearly analysis. Collection-only tweets whose real creation date is unknown go into `data/tweets/unknown.jsonl` instead of pretending they belong to 1970. DMs are sharded by year with `conversation_id` in each row; this keeps Git fast while preserving conversation membership. Likes and bookmarks are stored as collection edges in `data/collections` and mirrored into the timeline rows for current query compatibility.
380
+
381
+ Use `backup sync` when the target is a private Git repo. It pulls first, merge-imports the remote backup into local SQLite, exports the local union back into text shards, commits, and pushes.
382
+
383
+ ```bash
384
+ pnpm cli backup sync --repo ~/Projects/backup-birdclaw --remote https://github.com/steipete/backup-birdclaw.git --json
385
+ pnpm cli backup validate ~/Projects/backup-birdclaw --json
386
+ ```
387
+
388
+ Configure stale-aware backup reads in `~/.birdclaw/config.json`:
389
+
390
+ ```json
391
+ {
392
+ "backup": {
393
+ "repoPath": "/Users/steipete/Projects/backup-birdclaw",
394
+ "remote": "https://github.com/steipete/backup-birdclaw.git",
395
+ "autoSync": true,
396
+ "staleAfterSeconds": 900
397
+ }
398
+ }
399
+ ```
400
+
401
+ Read paths such as CLI search, inbox, API status/query, and web startup pull + merge from Git only when the last backup check is stale. Data-changing commands run a full backup sync afterward when this config is enabled. Set `BIRDCLAW_BACKUP_AUTO_SYNC=0` to disable that behavior for one process.
402
+
403
+ ### Scheduled Bookmark Sync
404
+
405
+ `birdclaw jobs sync-bookmarks` refreshes live bookmarks and appends one JSONL audit entry per run. Each entry includes host, timestamps, duration, before/after bookmark counts, source transport, fetched count, backup sync result, and any error.
406
+
407
+ ```bash
408
+ birdclaw --json jobs sync-bookmarks --mode auto --limit 100 --max-pages 5 --refresh
409
+ tail -n 5 ~/.birdclaw/audit/bookmarks-sync.jsonl | jq .
410
+ ```
411
+
412
+ After a successful bookmark refresh, the job runs the normal backup auto-sync path. If `~/.birdclaw/config.json` has `backup.autoSync` enabled, the changed local data is merged into the configured Git backup repo, committed, and pushed. The audit entry records that backup result so scheduled runs are inspectable later.
413
+
414
+ On macOS, install the 3-hour LaunchAgent after choosing the Birdclaw executable path for that machine:
415
+
416
+ ```bash
417
+ birdclaw --json jobs install-bookmarks-launchd --program /opt/homebrew/bin/birdclaw
418
+ ```
419
+
420
+ If the machine uses `bird` with browser cookies that are not available to launchd, write an export-only env file with mode `0600` and install with `--env-file ~/.config/bird/env.sh`. Birdclaw sources that file inside the scheduled process without storing the secrets in the plist.
421
+
422
+ The LaunchAgent writes `~/Library/LaunchAgents/com.steipete.birdclaw.bookmarks-sync.plist`, runs at load, then every 10,800 seconds. It writes the audit log to `~/.birdclaw/audit/bookmarks-sync.jsonl` and stdout/stderr to `~/.birdclaw/logs/bookmarks-sync.*.log`. A lock file prevents overlapping runs and records an `already-running` skip when needed. The default job fetches up to 5 pages every 3 hours; pass `--all` if you want every retrievable page each run.
423
+
424
+ Useful checks:
425
+
426
+ ```bash
427
+ launchctl print gui/$(id -u)/com.steipete.birdclaw.bookmarks-sync
428
+ launchctl kickstart -k gui/$(id -u)/com.steipete.birdclaw.bookmarks-sync
429
+ tail -n 1 ~/.birdclaw/audit/bookmarks-sync.jsonl | jq .
430
+ ```
431
+
327
432
  ## Typical Workflow
328
433
 
329
434
  1. import your archive if you have one
330
- 2. hydrate imported profiles from live X metadata
435
+ 2. hydrate imported profiles from live Twitter metadata
331
436
  3. use `Home` for reading
332
437
  4. use `Mentions` for reply triage
333
438
  5. when one account feels borderline, inspect `profiles replies`
@@ -341,8 +446,9 @@ pnpm cli compose dm dm_003 "Send it over."
341
446
  Current preference:
342
447
 
343
448
  - `xurl` first
449
+ - `bird` fallback for surfaces where cookie-backed reads work better
344
450
 
345
- Without `xurl`, `birdclaw` still works in local/archive mode.
451
+ Without `xurl` or `bird`, `birdclaw` still works in local/archive mode.
346
452
 
347
453
  Check transport:
348
454
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "birdclaw",
3
- "version": "0.1.1",
4
- "description": "Local-first X workspace for archives, DMs, mentions, and moderation",
3
+ "version": "0.2.1",
4
+ "description": "Local Twitter memory in SQLite for archives, DMs, likes, bookmarks, and moderation",
5
5
  "homepage": "https://github.com/steipete/birdclaw#readme",
6
6
  "license": "MIT",
7
7
  "repository": {
@@ -41,6 +41,7 @@
41
41
  "test": "env -u NODE_OPTIONS node ./scripts/run-vitest.mjs run",
42
42
  "coverage": "env -u NODE_OPTIONS node ./scripts/run-vitest.mjs run --coverage",
43
43
  "e2e": "playwright test",
44
+ "typecheck": "tsgo --noEmit",
44
45
  "format": "oxfmt --write src scripts playwright vite.config.ts vitest.config.ts playwright.config.ts",
45
46
  "format:check": "oxfmt --check src scripts playwright vite.config.ts vitest.config.ts playwright.config.ts",
46
47
  "lint": "oxlint --import-plugin --node-plugin --vitest-plugin --deny-warnings -A require-mock-type-parameters -A no-control-regex src scripts playwright vite.config.ts vitest.config.ts playwright.config.ts",
@@ -80,7 +81,7 @@
80
81
  "@types/react": "^19.2.14",
81
82
  "@types/react-dom": "^19.2.3",
82
83
  "@vitest/coverage-v8": "^4.1.5",
83
- "jsdom": "^29.0.2",
84
+ "jsdom": "^29.1.0",
84
85
  "oxfmt": "^0.46.0",
85
86
  "oxlint": "^1.61.0",
86
87
  "typescript": "^6.0.3",