feat(bird): read X cookies from Brave only
Bird 0.8.0 asks Keychain for Chrome Safe Storage, but Brave stores its key under Brave Safe Storage, so the reader fails before it can use Brave. Manage the Bird config in Nix and add a wrapper at ~/.pi/agent/bin/bird. The wrapper decrypts auth_token and ct0 from Brave cookie database with the Brave Safe Storage key and passes them to bird as env vars. It has no browser fallback, writes no Keychain item, and never opens the credentials file. Add an end-to-end shell check with a fake Brave cookie source and keychain. The check fails before the wrapper exists and passes after implementation.
This commit is contained in:
1 parent
fd96dc6dc0
commit
aae4dfd6d0
8 files changed
+413
-9
No files matched your search
@@ -5,15 +5,15 @@ description: Use when the user asks to read, fetch, or show the content of an X
|
||||
|
||||
# Read X/Twitter Tweet Content with bird
|
||||
|
||||
When the user asks to read, fetch, view, or summarize a tweet (or thread), use the locally installed `bird` CLI instead of `webfetch` — it authenticates via the active browser session and returns full tweet content + metadata.
|
||||
When the user asks to read, fetch, view, or summarize a tweet (or thread), use the local `bird` CLI instead of `webfetch`. It authenticates through the Brave cookie session and returns full tweet content and metadata.
|
||||
|
||||
## Commands
|
||||
|
||||
Use `/opt/homebrew/bin/bird` (absolute path since PATH can be sparse in non-interactive shells):
|
||||
Use `$HOME/.pi/agent/bin/bird`, the Brave-only wrapper. It reads the X cookies from Brave and execs the installed bird. Use an absolute path because PATH can be sparse in non-interactive shells. Do not call `/opt/homebrew/bin/bird` directly, since that skips the wrapper and asks Keychain for Chrome Safe Storage.
|
||||
|
||||
- Single tweet: `bird read <tweet-url-or-id> --json`
|
||||
- Full thread/conversation: `bird thread <tweet-url-or-id> --json`
|
||||
- Replies to a tweet: `bird replies <tweet-url-or-id> --json`
|
||||
- Single tweet: `$HOME/.pi/agent/bin/bird read <tweet-url-or-id> --json`
|
||||
- Full thread/conversation: `$HOME/.pi/agent/bin/bird thread <tweet-url-or-id> --json`
|
||||
- Replies to a tweet: `$HOME/.pi/agent/bin/bird replies <tweet-url-or-id> --json`
|
||||
|
||||
Prefer `--json` for parseable output (author, text, media, created_at, metrics). Drop `--json` only if the user wants pretty-printed terminal output.
|
||||
|
||||
@@ -25,11 +25,12 @@ Prefer `--json` for parseable output (author, text, media, created_at, metrics).
|
||||
|
||||
## When NOT to use
|
||||
|
||||
- User asks to post, reply, like, bookmark, follow, or search tweets — use other `bird` subcommands directly (see `bird --help`)
|
||||
- User asks to post, reply, like, bookmark, follow, or search tweets — use other subcommands through the same wrapper (see `$HOME/.pi/agent/bin/bird --help`)
|
||||
- User asks about article content linked FROM a tweet — `bird` only returns tweet text/metadata, not outbound article bodies; fall back to `webfetch` on the linked URL
|
||||
|
||||
## Notes
|
||||
|
||||
- `bird` reads `auth_token` and `ct0` cookies from Safari/Chrome/Firefox; no paid dev account needed
|
||||
- If a fetch fails with auth errors, tell the user to sign in to x.com in their browser and retry
|
||||
- The wrapper reads `auth_token` and `ct0` from Brave only and passes them to bird as env vars. No paid dev account needed.
|
||||
- If the wrapper cannot read Brave Safe Storage, approve the Keychain dialog and retry. Do not switch browsers or call the Homebrew binary directly.
|
||||
- If a fetch fails with auth errors, tell the user to sign in to x.com in Brave and retry
|
||||
- Quote tweets and retweets include the referenced tweet in the JSON payload
|
||||
Reference in new issue
Block a user