diff --git a/README.md b/README.md index 1e6500d..0503513 100644 --- a/README.md +++ b/README.md @@ -5,6 +5,7 @@ A collection of Claude Code skills. ## Skills - [`create-onboarding-video`](skills/create-onboarding-video/SKILL.md) — Build app onboarding videos with Remotion. +- [`ask-bookmarks`](skills/ask-bookmarks/SKILL.md) — Answer a question from your X/Twitter bookmarks via the local `ft` CLI, with a References section of tweet links. ## Usage diff --git a/skills/ask-bookmarks/SKILL.md b/skills/ask-bookmarks/SKILL.md new file mode 100644 index 0000000..f5ff260 --- /dev/null +++ b/skills/ask-bookmarks/SKILL.md @@ -0,0 +1,42 @@ +--- +name: ask-bookmarks +description: Answer a question using the user's own X/Twitter bookmarks via the local `ft` CLI. Runs several full-text searches with query variations, ranks the matching bookmarks, synthesizes an answer, and ends with a References section of tweet links. Use when the user asks a question and wants it answered from their saved bookmarks, says "search my bookmarks", "what did I bookmark about X", "find the tweet about X", or invokes /ask-bookmarks. +--- + +# Ask Bookmarks + +Answer the user's question from their X/Twitter bookmarks stored locally by the `ft` CLI, then cite the source tweets. + +## Workflow + +1. **Extract intent.** Pull the key concepts from the question. List 3–6 search angles: the literal terms, synonyms, related jargon, author handles, and product/tool names. + +2. **Run several searches.** For each angle, query the local DB as JSON: + ```bash + ft list --query "" --json --limit 15 + ``` + - FTS5 syntax: space = AND, `OR`, `NOT`, `"exact phrase"`. Use `OR` to broaden (`"claude code" OR "coding agent"`), quotes for multi-word phrases. + - Run a mix: one narrow phrase query, one broad OR query, plus per-synonym queries. Prefer many small queries over one giant one. + - Optional filters: `--author `, `--after YYYY-MM-DD`, `--before YYYY-MM-DD`. + +3. **Merge & rank.** Combine results, dedupe by `id`. Rank by relevance to the question first, then by engagement (`bookmarkCount`, `likeCount`) and recency (`postedAt`) as tie-breakers. Drop obvious non-matches. + +4. **Read closely if needed.** The JSON `text` is often truncated mid-tweet. For the top candidates, get the full text: + ```bash + ft show --json + ``` + +5. **Answer.** Write a direct answer grounded ONLY in what the bookmarks say. Attribute claims to authors inline (e.g. "@handle notes …"). If the bookmarks don't cover the question, say so plainly — don't pad with outside knowledge unless the user asks. + +6. **Always end with References.** Use the `url` field from each cited bookmark verbatim: + ``` + ## References + - [@authorHandle — short description](https://x.com/authorHandle/status/) + ``` + Only list tweets actually used in the answer. Number-match them to inline citations if you used `[1]`-style markers. + +## Notes +- `ft search ` is the human-readable variant; `ft list --query ... --json` is preferred here because it's structured and exposes `url`, `id`, and engagement counts. +- Bookmarks are unclassified by default, so `--category`/`--domain` filters are usually empty — rely on full-text search. +- If a search errors on FTS5 syntax (e.g. a stray special char), retry with the terms quoted as an exact phrase. +- If zero results across all angles, broaden terms and try again before concluding nothing is bookmarked.