@vishalnairv

Adaptive Tone

OpenClaw plugin that adapts the assistant's tone to context (time, channel, repetition, wellbeing).

当前版本
v0.1.0
code-plugin社区source-linked

Adaptive Tone — an OpenClaw plugin

Adjusts an OpenClaw assistant's conversational tone based on context:

  • Time of day — calmer, more concise late at night.
  • Channel ("place") — more formal in work channels, more relaxed in personal ones.
  • Repetition — more patient, and re-explains differently, when you ask the same thing again.
  • Stated wellbeing — gentler and lower-demand when you say you're unwell or having a hard time.
  • Weather — subtly adapts tone to local weather conditions (sunny → cheerful, rainy → cozy, stormy → calm and reassuring).

It does this by registering one OpenClaw lifecycle hook (before_prompt_build) and appending short tone guidance to the system prompt for that turn. No OpenClaw core code is modified.

What this is — and isn't

This is tone steering, not emotion. The underlying model has no feelings; OpenClaw is an orchestration harness that calls a model. This plugin only changes the instructions the model receives so its replies read warmer, calmer, more patient, or more formal depending on context. It never changes the facts, the assistant's accuracy, its capabilities, or its safety behaviour.

The "gentler when unwell" feature softens tone only. It explicitly does not provide medical, crisis, or therapeutic advice, and it never overrides the model's own safety guidance. It is not a mental-health tool.

The "weather-aware tone" feature uses the free Open-Meteo API to fetch current conditions. Results are cached for 15 minutes, and any fetch failure is silently ignored (fail-open), so weather never blocks or breaks a reply.

How it works

StageWhere (in OpenClaw)
Base system prompt is builtsrc/agents/pi-embedded-runner/system-prompt.ts
This plugin's hook runs and appends tone guidancebefore_prompt_build, fired in src/agents/pi-embedded-runner/run/attempt.ts

The hook resolves the current context to exactly one tone state (priority: gentle-carepatient-repeat/patient-lightquiet-latenightprofessional/casualneutral) and returns appendSystemContext. Weather guidance is layered additively on top of whichever tone state is active.

The guidance string is a pure function of the state, so OpenClaw's prompt cache stays warm until the context category actually changes.

Install

# from a local checkout (development)
openclaw plugins install --link /path/to/openclaw-adaptive-tone

# from git, once you've pushed it
openclaw plugins install git:github.com/<you>/openclaw-adaptive-tone

openclaw plugins enable adaptive-tone
openclaw gateway restart

Verify it loaded:

openclaw plugins inspect adaptive-tone --runtime --json

Configure

Settings live under plugins.entries.adaptive-tone.config. All fields are optional; sensible defaults apply. Example:

{
  "enabled": true,
  "time": { "enabled": true, "timezone": "Europe/Berlin" },
  "place": {
    "enabled": true,
    "professionalChannels": ["slack", "teams"],
    "casualChannels": ["whatsapp", "telegram"]
  },
  "repetition": { "enabled": true, "windowTurns": 6, "similarityThreshold": 0.8 },
  "wellbeing": { "enabled": true },
  "weather": { "enabled": true, "latitude": 52.52, "longitude": 13.41 },
  "guidanceOverrides": {
    "casual": "Keep it breezy and use first names."
  }
}

Notes:

  • Timezone: the hook context does not currently expose the user's timezone, so set time.timezone (IANA, e.g. Europe/Berlin) for correct late-night detection. Without it, the Gateway host's local time is used.
  • Disabling an axis: set e.g. wellbeing.enabled: false to turn off just that signal while keeping the others.
  • Weather: defaults to Berlin (52.52, 13.41). Set your own latitude/longitude for accurate local weather. The weather API is rate-limited to one call per 15 minutes. Disable with weather.enabled: false.
  • Overrides must stay static (no per-turn data) to preserve prompt caching.

Weather conditions

The weather signal maps WMO weather codes and temperature into these conditions:

ConditionTriggerTone effect
☀️ SunnyWMO code 0 (clear sky)Slightly more cheerful and energetic
☁️ CloudyWMO codes 1–3, 45, 48Calm, focused, and steady
🌧️ RainyWMO codes 51–65, 80–82Cozy, quiet, and reflective
❄️ SnowyWMO codes 71–75, 85–86Warm, cozy, and comforting
⛈️ StormyWMO codes 95–99Reassuring, stable, and calm
🔥 HotTemperature > 30 °CLight, cool, and brief
🥶 ColdTemperature < 5 °CWarm and comforting

Temperature extremes (hot/cold) take priority over weather codes.

Develop

npm install
npm run typecheck
npm test

Logic lives in src/ as pure, dependency-free functions; index.ts wires them into the hook. Tests cover signal detection, state priority, cache-stable guidance, and weather classification.

Project structure

index.ts          — Plugin entry: registers the before_prompt_build hook
src/
  config.ts       — Config types + normalization (mirrors openclaw.plugin.json schema)
  guidance.ts     — Maps tone states and weather conditions to guidance text
  signals.ts      — Pure signal detectors (time, channel, repetition, wellbeing)
  states.ts       — Priority-ordered tone state resolution
  weather.ts      — Open-Meteo API client with 15-minute cache
test/
  signals.test.ts — Signal detection tests
  states.test.ts  — State priority and guidance tests
  weather.test.ts — Weather classification, guidance, and config tests

License

MIT — see LICENSE.

源码与版本

源码仓库

vishalnairv/openclaw-adaptive-tone

打开仓库

源码提交

0a3b500833f26d69353c937b81b6a7031911f660

查看提交

安装命令

openclaw plugins install clawhub:openclaw-adaptive-tone

元数据

  • 包名: openclaw-adaptive-tone
  • 创建时间: 2026/05/26
  • 更新时间: 2026/05/26
  • 执行代码:
  • 源码标签: main

兼容性

  • 构建于 OpenClaw: 2026.5.25
  • 插件 API 范围: >=2026.5.0
  • 标签: latest
  • 文件数: 19