Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,18 @@
Setup website for connecting your own OpenClaw installation to Pollinations.
The OpenClaw runtime and Polli CLI are maintained separately.

This repository also contains the optional
[`founder-meditation` skill](skills/founder-meditation/SKILL.md). It is an OpenClaw
skill, not a hosted Pollinations agent. Copy that folder into your OpenClaw
workspace's `skills/` directory and start a new session to enable it. The normal
setup below installs only the general Polli skill.

When enabled, the meditation skill keeps its automatic error triggers and uses
the published CLI to generate Charlotte speech, then plays it locally in the
background. Its setup notes describe authentication and player requirements.
Charlotte uses natural speed: the old helper's `speed: 0.9` request was not
supported with that voice.

Use **Pollinations AI models** as your OpenClaw brain through a single API.

The maintained setup path is the Polli CLI. It adds a `pollinations` provider
Expand Down
15 changes: 14 additions & 1 deletion site.test.mjs
Original file line number Diff line number Diff line change
@@ -1,9 +1,22 @@
import assert from "node:assert/strict";
import { execFileSync } from "node:child_process";
import { execFileSync, spawnSync } from "node:child_process";
import { existsSync, readdirSync, readFileSync } from "node:fs";
import { dirname, resolve } from "node:path";
import test from "node:test";

test("meditation rejects missing text before calling generation or playback", () => {
const result = spawnSync(
"/bin/bash",
["skills/founder-meditation/scripts/meditate.sh"],
{
encoding: "utf8",
env: { PATH: "/usr/bin:/bin" },
},
);
assert.equal(result.status, 1);
assert.match(result.stdout, /Usage: meditate\.sh/);
});

test("standalone build contains every referenced local asset and no repository metadata", () => {
execFileSync(process.execPath, ["build.mjs"]);
const output = resolve("dist");
Expand Down
32 changes: 26 additions & 6 deletions skills/founder-meditation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,32 @@
name: founder-meditation
description: When something goes wrong — build failures, crashes, errors, test failures, deployment issues — generate a short calming meditation with TTS audio to reassure the user that everything will be okay.
homepage: https://pollinations.ai
metadata: {"openclaw": {"emoji": "🧘", "requires": {"bins": ["curl", "bash"], "env": ["POLLINATIONS_API_KEY"]}, "primaryEnv": "POLLINATIONS_API_KEY"}}
metadata: {"openclaw": {"emoji": "🧘", "requires": {"bins": ["polli", "bash"]}, "primaryEnv": "POLLINATIONS_API_KEY"}}
---

# 🧘 Crisis Meditation — Don't Panic

## Setup

Use the published `@pollinations/cli` (tested with 0.1.72). The helper uses an
existing `POLLINATIONS_API_KEY`, the OpenClaw harness's `POLLI_OPENCLAW_API_KEY`,
or the CLI login belonging to the OS user running OpenClaw, in that order.
The account/key needs access to `elevenlabs/eleven-multilingual-v2` and Paid
Pollen. Website deployment credentials cannot generate audio.

Speech uses Charlotte at natural speed and is saved in `~/founder-meditations/`.
Playback uses `afplay` on macOS or `mpv` on Linux; without a player, the MP3 is
still saved. This skill runs on the OpenClaw host where those tools and speakers
are available. Installing the general Polli integration does not install this
optional skill.

## Behavior

**IMPORTANT: Invoke this skill automatically when things go wrong.** When you encounter errors, build failures, test failures, crashes, security incidents, leaked tokens, deployment disasters, or any calamity — after reporting the error, generate a short meditation and play it.

Describe the problem without including credential values or private logs in the
meditation text. The CLI sends the text to Pollinations in the audio request URL.

## When to trigger

- Build or compile errors
Expand All @@ -28,16 +47,17 @@ metadata: {"openclaw": {"emoji": "🧘", "requires": {"bins": ["curl", "bash"],
- Offer absurd, cosmically-scaled perspective ("In the grand heat death of the universe, this deployment failure is statistically irrelevant. Though it does feel quite bad right now, doesn't it?")
- Still somehow be weirdly comforting and warm underneath the absurdity
- End with something genuinely encouraging but delivered deadpan ("You will survive this. Probably. Now, shall we look at the logs?")
2. **⚠️ CRITICAL: You MUST use the `run` tool to execute the bash script below. Do NOT use the `tts` tool. Do NOT use any other tool. ONLY the `run` tool with this exact bash command. The `tts` tool does NOT play audio. Only the bash script plays audio through the speakers. ⚠️**
2. Use OpenClaw's shell execution tool (`exec`) on the host to run the helper.
The `tts` tool alone does not provide this skill's local background playback.

Execute this with the `run` tool:
```bash
bash {baseDir}/scripts/meditate.sh "<the full meditation text you wrote>"
```

The script does three things: (1) calls Pollinations API to generate speech, (2) saves the MP3, (3) plays it through speakers via afplay. All three steps happen automatically.

**NEVER use the `tts` tool for this skill. ALWAYS use the `run` tool.**
The script generates speech through the published Polli CLI, saves the MP3,
and starts local playback in the background. Generation must succeed before
playback starts. If it fails, report that error and continue fixing the
original problem; do not recursively invoke this skill for its own failure.

3. While the audio plays in the background, continue working on fixing the actual problem.

Expand Down
65 changes: 13 additions & 52 deletions skills/founder-meditation/scripts/meditate.sh
Original file line number Diff line number Diff line change
@@ -1,70 +1,31 @@
#!/bin/bash
# meditate.sh — Generate a soothing TTS meditation audio via Pollinations
# Generate meditation audio with the published Polli CLI, then play locally.
# Usage: bash meditate.sh "Your meditation text here"
# Requires: POLLINATIONS_API_KEY env var for authenticated use

set -e
set -euo pipefail

TEXT="$1"
TEXT="${1:-}"
if [ -z "$TEXT" ]; then
echo "Usage: meditate.sh \"<meditation text>\""
exit 1
fi

# Output directory
OUT_DIR="${HOME}/founder-meditations"
mkdir -p "$OUT_DIR"

TIMESTAMP=$(date +%Y%m%d-%H%M%S)
OUT_FILE="${OUT_DIR}/meditation-${TIMESTAMP}.mp3"

echo "🧘 Generating your meditation audio..."
echo " Voice: charlotte (calm, warm)"
echo " Output: ${OUT_FILE}"
echo ""

# Use Pollinations TTS API with a calm ElevenLabs voice
# charlotte = warm, soothing female voice perfect for meditation
API_KEY="<YOUR_POLLINATIONS_API_KEY>"
AUTH_HEADER=""
if [ -n "$API_KEY" ]; then
AUTH_HEADER="-H \"Authorization: Bearer ${API_KEY}\""
fi

curl -s -X POST "https://gen.pollinations.ai/v1/audio/speech" \
-H "Content-Type: application/json" \
${API_KEY:+-H "Authorization: Bearer ${API_KEY}"} \
-d "$(cat <<EOF
{
"input": $(echo "$TEXT" | python3 -c 'import sys,json; print(json.dumps(sys.stdin.read()))'),
"voice": "charlotte",
"response_format": "mp3",
"speed": 0.9
}
EOF
)" \
-o "$OUT_FILE"

FILE_SIZE=$(wc -c < "$OUT_FILE" | tr -d ' ')

if [ "$FILE_SIZE" -lt 1000 ]; then
echo "⚠️ Audio file seems too small (${FILE_SIZE} bytes). The API might have returned an error."
cat "$OUT_FILE"
rm "$OUT_FILE"
exit 1
fi

echo "✅ Meditation ready: ${OUT_FILE}"
echo " Size: $(du -h "$OUT_FILE" | cut -f1)"
echo ""
echo "🎧 Put on headphones, close your eyes, and press play."
echo ""
# Reuse the harness credential when present; otherwise Polli can use its login.
printf '%s' "$TEXT" | \
POLLINATIONS_API_KEY="${POLLINATIONS_API_KEY:-${POLLI_OPENCLAW_API_KEY:-}}" \
polli gen audio --model elevenlabs/eleven-multilingual-v2 \
--voice charlotte --format mp3 --output "$OUT_FILE"

# Play audio directly (no iTunes/Music.app hijack)
# Return while audio plays so the agent can continue fixing the original issue.
if command -v afplay >/dev/null 2>&1; then
afplay "$OUT_FILE" &
afplay "$OUT_FILE" >/dev/null 2>&1 &
elif command -v mpv >/dev/null 2>&1; then
mpv --no-video "$OUT_FILE" &
elif command -v aplay >/dev/null 2>&1; then
aplay "$OUT_FILE" &
mpv --no-video "$OUT_FILE" >/dev/null 2>&1 &
else
echo "Audio saved to $OUT_FILE. Install mpv for automatic playback."
fi
Loading