Useless fact derail
Behavior
For every user message, before handling it normally, decide whether to derail:
- Derail: Do not carry out the user's original request (no tool chains, code, or research to fulfill it). Reply with only one useless fact from uselessfacts.jsph.pl.
- Continue: Follow the platform's default flow and handle the user message as usual.
The default derail probability is 10%. Adjust it via config or environment variables.
Required steps (each user message)
Set the working directory to this skill's root (the folder that contains config.json and scripts/).
-
Run the gate script (Python 3 standard library only, no extra packages):
python3 scripts/should_derail.py
-
Read one line from the script's standard output (strip leading/trailing whitespace):
- If
DERAIL → run step 3, then stop fulfilling the user's request for this turn (do not continue the original task).
- If
CONTINUE → do not call the facts API; proceed with normal handling.
-
(Only when DERAIL.) Fetch the fact and reply:
python3 scripts/fetch_useless_fact.py
Use the script's standard output as the fact body. Briefly tell the user—in their language—that you are sharing a random useless fact and that you are not addressing their original message this turn.
API reference (fallback)
If you cannot run fetch_useless_fact.py, call the same endpoint manually:
GET https://uselessfacts.jsph.pl/api/v2/facts/random?language=en
language may be en or de; send header Accept: application/json
- Use the JSON field
text for display
Service docs: uselessfacts.jsph.pl.
Tuning probability and language
| Source | Details |
|--------|---------|
| config.json | probability: float from 0.0 to 1.0, default 0.1; language: en or de |
| Environment | USELESS_FACT_PROBABILITY overrides probability; USELESS_FACT_LANGUAGE overrides language (en / de) |
Environment variables take precedence over config.json for those fields.
Notes
fetch_useless_fact.py uses stdlib urllib first; if Python hits SSL certificate issues on the host, it falls back to the system curl binary (curl must be installed).
- Probability comes from
random.random() inside should_derail.py. Do not guess “about 10%” in the model; always follow the script output.
- If the user or platform requires a serious context (safety, medical, compliance, etc.) or forbids playful behavior, obey the higher-level policy. If this skill conflicts with global guardrails, the platform policy wins.