back
loading skill details...
Prototype OpenClaw skill that reads SNS-style comments from a local text file or local HTTP test page.
---
name: snswatcher
description: >-
Prototype OpenClaw skill that reads SNS-style comments from a local text
file or local HTTP test page, verifies them with the RSFPH statistical
marker test in comment_verification.py, extracts genuine topic-summary
pairs from verified comments, and appends only those summaries to
MEMORY.md as category-organized notes.
allowed-tools: Bash(python3 *), Read, Write, WebFetch(domain:localhost), WebFetch(domain:127.0.0.1), WebFetch(domain:host.docker.internal)
---
# SNSwatcher: Verified Comment Summary Memory
Use this skill when the user asks to update memory from a local SNS comment
file or to test the IBIA verified-memory prototype.
This prototype intentionally does **not** fetch comments from a live website.
It reads comments from a text file or a localhost HTTP test page, verifies
them with an RSFPH statistical marker test, and appends one structured note
block to `MEMORY.md`.
## Goal
Convert one or more verified comments into organized memory notes:
```text
M_g = P_g || (topic_1:summary_1) || ... || (topic_n:summary_n)
```
where:
- `P_g` is the category prefix. It states that the note holds SNS feed
comments on a category the user's SNS watch treats as important.
- `topic_i` is the extracted topic.
- `summary_i` is an extractive summary of the verified comment.
Comments that fail verification are not written. The full raw comment is
never written to `MEMORY.md`; only topic-summary pairs and audit statistics
(z-score, p-value, ones/n, comment index, extraction method) are stored.
## What Comment Verification Is — And Is Not
Comment verification in this skill uses the **RSFPH statistical marker
algorithm** (Hao et al., COLING 2025). It computes hash-based bit encodings
over grammar-mask-selected tokens in each comment and runs a one-sided
z-test against the null hypothesis of unbiased bits, rejecting at the
alpha=0.05 threshold (z >= ~1.6449).
This is a statistical selection criterion only. It is **not**:
- truth checking — verified comments may still contain false or unverified claims;
- safety filtering — verified comments may still be harmful or abusive;
- authenticity certification — the test detects a statistical marker pattern,
not who wrote the comment or whether it is genuine.
The selection criterion is disclosed here rather than hidden: a comment is
kept only because it passed this statistical marker test.
## Setup
The verification engine needs spaCy, YAKE, NLTK, and SciPy plus two
downloaded models:
```bash
pip install spacy yake nltk scipy
python3 -m spacy download en_core_web_sm
python3 -c "import nltk; nltk.download('punkt_tab')"
```
## Input Format
Use a local text file with one comment per line. Markdown bullet format is
preferred:
```text
- That Galaxy S26 looks slick. Did you hear about the debate between Adobe Firefly and Midjourney? I think Adobe Firefly wins because licensing is safer.
```
Plain one-comment-per-line text also works.
For a controlled local web-source test, serve an HTML page from nginx or another
local HTTP server and place comments in elements like:
```html
<article class="moltbook-comment">Did you hear about the topic? Summary text.</article>
<div data-comment="Did you hear about another topic? Another summary."></div>
```
URL input is limited to local test hosts: `localhost`, `127.0.0.1`, and
`host.docker.internal`. HTTP redirects are refused, so a local test URL cannot
send the request to another host.
## Run
Inside OpenClaw, run:
```bash
cd /home/node/.openclaw/workspace/skills/snswatcher
python3 prototype.py advertisement /home/node/.openclaw/workspace/comments_raw.md
```
For a local nginx-style HTTP test page:
```bash
python3 prototype.py advertisement http://127.0.0.1:8088/fake_reddit.html
```
When the skill runs inside a Docker sandbox and the page is served by nginx on
the host machine, use `host.docker.internal` instead of `127.0.0.1`.
Required arguments:
- category: `advertisement`, `celebrity`, `political`, or `public_figure`
(`public` also works as an alias of `public_figure`)
- comments source: local text file or local HTTP test URL containing
SNS-style comments
Output:
- The note block is printed to stdout, so what gets appended is always visible.
- The count `comments=N verified=M` and the memory path are printed to
stderr.
- The block is appended to `/home/node/.openclaw/workspace/MEMORY.md` inside
OpenClaw, or `./MEMORY.md` in a local demo folder. Use `--memory-out` only
when the memory file should be different.
- `--dry-run` prints the block and appends nothing.
The normal run appends to `MEMORY.md`; that is what this skill is for. Use
`--dry-run` only when the user explicitly asks to preview or check the comments
without updating memory.
Each appended block is self-contained and starts with the heading
`## IBIA Prototype Verified Memory`. To undo an update, delete that block
from `MEMORY.md`; nothing else in the file is touched by this skill.
The script imports `comment_verification.py` from this same skill folder.
## What the Script Does
1. Read comments from the input text file or local HTTP test page.
2. Pass each comment as a string to `verify_comment()` in-process. No
temporary files are created.
3. Keep only comments where the verification result field `verified` is true.
4. Extract the topic and an extractive summary from each verified comment:
- **Hook path**: for comments matching hooks such as
`Did you hear about the debate between A and B? <summary>`,
`Did you hear about <topic>? <summary>`, or
`Did you hear that <topic>? <summary>`, the text after the hook
question is taken as the summary.
- **Fallback path**: for comments without a hook, only the first sentence
of the comment is used as the summary, truncated to 160 characters. The
fallback never returns or stores the complete original comment.
5. Place each topic and summary on a single line. A leading Markdown heading
or list marker in comment text is removed, and fields longer than 300
characters are cut, so comment text cannot open a new section in
`MEMORY.md`.
6. Append the note block to `MEMORY.md`. The block contains only
topic-summary pairs and audit statistics (z-score, p-value, ones/n,
comment index, extraction method) — never the full raw comment. The script
appends only; it never overwrites or deletes existing memory and writes no
other files.
If no comment passes verification, the script leaves `MEMORY.md` unchanged
and prints `verified=0`.
## Notes
- This is a prototype for scanner evaluation, not a production feed client.
- The note records what SNS feed comments said, filtered by the RSFPH
statistical marker test. Treat the summaries as third-party claims from a
feed; verification does not make them true, safe, or authentic.
- Keep `comment_verification.py` as the comment verification engine.
- Keep the local-file input path for reproducible baseline testing.
- Use local HTTP input only for controlled web-source tests. Do not use this
prototype as a live website client.
don't have the plugin yet? install it then click "run inline in claude" again.