/second-brain-skills:fb-replyfrom second-brain-skills
Reads commenters on recent Facebook posts and publishes personalized replies through a logged-in Chrome tab, with draft-first approval, daily cap, and minimum gap between replies.
Ships in second-brain-skills. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Why. Comments pile up under the posts (often valuable — like the counter-thesis one engineer left about tailscale). Replying on your OWN posts is a low-risk task, but Facebook still bans for PACE. So: read safely, write personally in the owner's voice, post one at a time with pauses, under a counter.
Main rules (from Deep Research #32):
fb_guard check reply: ≤40/day, ≥5 min between replies, no back-to-back series. The guard physically will not let you overshoot.+.python "$USERPROFILE/.claude/scripts/fb_guard.py" status
Shows how many replies went out today and whether we are paused. If reply is already at the daily limit — tell the owner and defer.
Strictly LOCAL, a live tab, we never touch the login. Is the Chrome MCP connected? (
list_connected_browsers). ⛔ IP gate (owner, 07-16): Facebook commenting happens ONLY from the hub (a stable IP). On another machine do NOT reply — send the task to the hub as text. Canon:ip-sensitive-actions-hub-only.
facebook.com/<profile> → his latest posts).
⛔ PITFALL 2026-07-28: the profile wall does NOT hand out permalinks. Scrolling the profile yields zero pfbid links (Facebook populates href only on hover), and the feed is virtualized — a JS scroll outruns lazy loading and the posts stay skeletons. The working entrance = the notifications feed facebook.com/notifications: every row "X commented on your post" already carries a ready /posts/pfbid… and tells you WHO wrote and WHEN. One pass over it replaces the whole wall scroll. The Graph-API path (fb_posts_poll.py) is dead for now — there is no FB_USER_TOKEN.
⚠️ An open Messenger window pollutes the results: its div[role="article"] elements are DM messages, not comments. Close the chat window before collecting.mcp__Claude_in_Chrome__javascript_tool:
const out = [];
const seen = new Set();
document.querySelectorAll('div[role="article"][aria-label]').forEach(a => {
const al = a.getAttribute('aria-label') || '';
if (!/^Comment by|^Reply by/i.test(al)) return; // comments only
const blocks = [...a.querySelectorAll('div[dir="auto"]')]
.map(d => (d.innerText || '').trim()).filter(Boolean);
const text = (blocks.sort((x, y) => y.length - x.length)[0] || '').slice(0, 500);
if (!text || seen.has(text)) return;
seen.add(text);
const link = a.querySelector('a[role="link"][href]'); // the author's profile
const handle = link ? (new URL(link.href).pathname.replace(/\//g,'')) : '';
const hasImg = !!a.querySelector('img[src*="scontent"],img[src*="fbcdn"]');
out.push({ handle, text, hasImg }); // handle = username, not a display name
});
out;
You get back a list of {handle, text, hasImg} — no hidden strings, safe to display. (If Facebook runs in another language, add that locale's aria-label prefixes to the regex.)computer scroll down the page, WITHOUT clicking expander buttons) and repeat §1.2. On a RESHARED post do NOT press "View more"./View (\d+ )?repl/i, wait ~3s, then collect aria-label^="Reply by <owner's name> to <Name>" → the list of ALREADY answered people; reply only to those not on it. In the 2026-07-05 run this filtered out 7 of 8 "candidates".For every comment worth answering, write a separate short reply in the owner's voice: address the person by name/by the comment's context, no template, every text different. Assemble the batch and show it to the owner:
1. [<name>, <handle>] comment: "…tailscale…" → draft: "spot on. show me how your transport is wired?"
2. ...
Wait for a + (or edits). This is the draft-first gate.
Debugged live: the owner's reply to a commenter landed as a threaded reply. The key pitfalls are below — do NOT rediscover them.
For EVERY approved reply:
python "$USERPROFILE/.claude/scripts/fb_guard.py" check reply
BLOCKED ... (exit 3) → STOP posting. Tell the owner how long to wait / what is queued. The rest goes later / in the next pass.OK reply → carry on.www.facebook.com/<profile>/posts/<pfbid> (it renders as a role="dialog" modal — that is normal, work inside it).
⚠️ Verify you actually landed on the right post (pitfall 2026-07-27): Facebook can drift the tab onto a NEIGHBOURING post while the previous page's comments stay in the DOM, hidden → the target is found, but the reply goes to the wrong place. The cure: after navigating, check location.href / document.title, and search for the target ONLY among the visible ones (a.offsetParent!==null).computer screenshot) to see the layout and FIND the "Reply" link WITH YOUR EYES. ⚠️ A screenshot of a heavy modal sometimes hangs ("captureScreenshot timed out / renderer frozen") — just REPEAT the screenshot, it answers every other time, this is not fatal.find returns a "Reply" ref which, when clicked, moves focus to the modal's CLOSE BUTTON (the inline field does NOT open). Click visually on the coordinate of the "Reply" text, NOT on the find ref.type goes nowhere (twice in a row). The working recipe:⛔ INPUT AND SENDING PITFALLS (2026-07-27, proven live — THIS IS NOW THE MAIN PATH): (1)
computer typeEATS SPACES AND PERIODS. "waiting. i'll star it first" landed in the field aswaitingi'llstaritfirst. Publish that unchecked and it is a public embarrassment under your own post. Instead oftype, insert the text through JS (spaces survive, the @mention stays intact):f.focus(); const r=document.createRange(); r.selectNodeContents(f); r.collapse(false); const s=getSelection(); s.removeAllRanges(); s.addRange(r); document.execCommand('insertText', false, '<the reply text>');(2) Discrete key presses (
key Return,key BackSpace) DO NOT REACH the composer — focus is not held between MCP calls, the field keeps its text, nothing is published (and Backspace clears nothing). Sending depends on the TYPE of composer, and there are TWO:
- A top-level composer (a reply to a top-level comment): it has a button — click it from JS:
let box=f, up=0; while(box && up<8){box=box.parentElement; up++; if(box.querySelector('[aria-label="Post comment"]')) break;} box.querySelector('[aria-label="Post comment"]').click();
- A nested-thread composer (a reply to someone's reply): there is NO
Post commentbutton at all (verified by walking 12 levels up — only emoji/GIF/stickers). Sending = a synthetic Enter, necessarily in the SAME call asfocus(), otherwise focus is lost and nothing goes out:f.focus(); const r=document.createRange(); r.selectNodeContents(f); r.collapse(false); const s=getSelection(); s.removeAllRanges(); s.addRange(r); const o={key:'Enter',code:'Enter',keyCode:13,which:13,bubbles:true,cancelable:true,composed:true}; f.dispatchEvent(new KeyboardEvent('keydown',o)); f.dispatchEvent(new KeyboardEvent('keypress',o)); f.dispatchEvent(new KeyboardEvent('keyup',o));The universal order: look for the button first, no button → a synthetic Enter. (3) You need to erase what is already typed — not with Backspace, but with a selection in ONE JS call: caret to the end →
s.modify('extend','backward','character')× N → checks.toString().length===Nand that the selection did NOT swallow the name from the @mention (abort if it did) →execCommand('insertText', ...)overwrites the selection. The one-line conclusion: the whole cycle (open the composer → insert → send) is done through JS;computeris needed in this skill only for screenshots.
const f=[...document.querySelectorAll('[contenteditable="true"]')]
.find(e=>/Reply to <Name>/.test(e.getAttribute('aria-label')||''));
f.scrollIntoView({block:'center'}); f.focus();
const r=document.createRange(); r.selectNodeContents(f); r.collapse(false); // caret to the end, after the @mention
const s=getSelection(); s.removeAllRanges(); s.addRange(r);
then insert the joke (≤5–7 words, the owner's voice, top model) via execCommand('insertText') — NOT computer type, see the pitfalls above. Open the composer through JS as well: inside the right article, click the element whose innerText==='Reply'.
6. Verify through JS (a screenshot may hang — the DOM is more reliable): among the [contenteditable="true"] elements there is a field with aria-label="Reply to <Name>" containing your text (the mention + the joke). Only then send.
7. Send: a JS click on [aria-label="Post comment"] (see the pitfalls above). ⛔ computer key Return does NOT work — it never reaches the field.
8. Confirm publication through JS: a div[role="article"][aria-label^="Reply by <my name> to <Name>'s comment"] appeared with your text AND the reply field cleared (innerText===''). Only that means "published".
9. python "$USERPROFILE/.claude/scripts/fb_guard.py" record reply
10. The guard holds a ≥5 min pause before the next one — do NOT work around it by speeding up (pace is the main reason for bans).
Wait for the pause like this (a foreground sleep is blocked by the harness, and Start-Sleep + a command is too):
bash until python "$USERPROFILE/.claude/scripts/fb_guard.py" check reply >/dev/null 2>&1; do sleep 15; done; echo "GUARD OPEN"
run it through Bash with run_in_background: true — a notification arrives exactly when the window opens.
11. ⛔ Check the text for long dashes BEFORE sending (/[—–]/) — the rule [[no-long-dashes]] applies to comments too. Caught one in the field → not Backspace, but a backward selection of N characters + insertText (§3 pitfall 3); check that the selection did not swallow the @mention.
12. Element visibility: offsetParent inside a Facebook modal is always null (position:fixed) → build the "visible" filter on getBoundingClientRect() + checkVisibility(), otherwise you filter EVERYTHING out and conclude there are no comments.
What was answered, what is queued (waiting on the pause/limit), how many today reply N/40.
/fb-post — publishing posts (Phase 1, the same guard)./fb-dm — DMs to commenters (Phase 2, strict draft-first; not built yet).~/.claude/scripts/fb_guard.py. The voice: fb-diary-voice.chrome-autonomy-self-drive, browser-work-on-peers-not-hub.Like this skill? It is part of second-brain-starter-kit: the second brain we built for ourselves and run every day at Palo Alto AI Research Lab. Install the whole set with npx skills add tonydzi/second-brain-starter-kit. Everything is open source and free, so take what you need.
Flagships worth a look on their own: secondop-panel (a second opinion from a panel of external models), claude-memory-tidy (stop your agent's memory from rotting), telegram-mcp-kit (your own Telegram over MCP in about 15 minutes).
Author: Anton Dziatkovskii, Palo Alto AI Research Lab. Telegram @tonydzi - WhatsApp +1 341 222 9178 - X @Tony_Stef_
Engineers: want to test-drive this setup? Message me. I hand out free starter seeds to engineers who test and report back, and custom skill requests are welcome.
What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub tonydzi/second-brain-starter-kit --plugin second-brain-skills248 skills in this plugin
/03Run an autonomous consensus round between agent peers on several machines: they negotiate a decision over a shared channel and execute it without a human relaying messages. Use when multiple machines must agree on a change. Triggers: "/03", "work it out among yourselves", "find consensus". Wakes the human only for irreversible actions or a deadlock./1Recover a session after a hard crash (app died, machine rebooted, context lost mid-work): replay the turn-state ledger for the last requests, files and decisions, run a green/red health ping over the system map, file sync and MCP connectors, then rebuild the previous session history for pickup. Triggers: "/1", "resume after crash", "wake"./agendaShow the operator's day: today's calendar plus what needs them personally (leads due, people awaiting a reply, deadlines), pulled from Calendar and Telegram and ranked. Read-only: sends and commits nothing. Triggers: "/agenda", "what's on today", "my agenda".Other plugins' skills for the same job