From de04d5e99bc9cc79c47ab6b8aba832bf23df6578 Mon Sep 17 00:00:00 2001 From: "elliot.fouchy" Date: Sat, 31 Oct 2026 02:25:41 +0100 Subject: [PATCH] fix: generate OpenClaw meditations through the published CLI --- README.md | 12 ++++ site.test.mjs | 15 ++++- skills/founder-meditation/SKILL.md | 32 +++++++-- skills/founder-meditation/scripts/meditate.sh | 65 ++++--------------- 4 files changed, 65 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index c75dc8c..fa91b78 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/site.test.mjs b/site.test.mjs index 213237f..99b9d25 100644 --- a/site.test.mjs +++ b/site.test.mjs @@ -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"); diff --git a/skills/founder-meditation/SKILL.md b/skills/founder-meditation/SKILL.md index ad50393..28eecb9 100644 --- a/skills/founder-meditation/SKILL.md +++ b/skills/founder-meditation/SKILL.md @@ -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 @@ -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 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. diff --git a/skills/founder-meditation/scripts/meditate.sh b/skills/founder-meditation/scripts/meditate.sh index 70ad205..e7f33f0 100755 --- a/skills/founder-meditation/scripts/meditate.sh +++ b/skills/founder-meditation/scripts/meditate.sh @@ -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 \"\"" 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="" -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 </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