Signed-off-by: Matt Bruce <mbrucedogs@gmail.com>

This commit is contained in:
Matt Bruce 2026-02-24 09:25:40 -06:00
parent fb924a7fa6
commit 405433bb7f
6 changed files with 127 additions and 8 deletions

View File

@ -154,7 +154,7 @@ Outputs:
## 10) Acceptance Criteria
- AC-1: Running `bash ./scripts/model_profile_switch.sh free` changes default to `ollama/qwen3:14b`.
- AC-2: Running `bash ./scripts/model_profile_switch.sh paid` restores default to `moonshot/kimi-k2.5`.
- AC-2: Running `bash ./scripts/model_profile_switch.sh paid` restores default to `openrouter/moonshotai/kimi-k2.5`.
- AC-3: With schedule enabled (`21`/`7`), profile changes correctly by local time window.
- AC-4: If operator manually drifts model during scheduled window, schedule guard re-aligns on next run.
- AC-5: Budget guard warns and reverts when high model remains active beyond thresholds.
@ -186,4 +186,3 @@ Outputs:
- Per-channel session key mapping (Telegram/Discord-specific switching).
- Daily spend estimator from model usage telemetry.
- Optional provider locking profile policies.

View File

@ -1,7 +1,7 @@
# OpenClaw Setup Max (Paid + Free Model Switching)
This workspace runs OpenClaw with:
- A paid high-quality model profile (`moonshot/kimi-k2.5`)
- A paid high-quality model profile (`openrouter/moonshotai/kimi-k2.5`)
- A free local profile (Ollama-only)
- One-command live switching
- Optional automatic day/night switching (example: free from 9pm-7am)
@ -27,7 +27,7 @@ Everything else is grouped by function:
## 1) What You Get
- `paid` profile:
- Primary: `moonshot/kimi-k2.5`
- Primary: `openrouter/moonshotai/kimi-k2.5`
- Fallbacks: `ollama/qwen3:14b`, `ollama/llama3.2:3b`
- `free` profile:
- Primary: `ollama/qwen3:14b`
@ -102,6 +102,17 @@ Check current model state:
bash ./scripts/model_profile_switch.sh status
```
Run a web research task from terminal:
```bash
./scripts/research.sh latest swiftui observation patterns
```
Optional flags:
- `--sources <count>` minimum source count (default `3`)
- `--thinking <level>` sets OpenClaw thinking level
- `--deliver` sends the final response back to the current channel
## 5) How Live Switching Works
When you run:

View File

@ -3,8 +3,9 @@
"sessionKey": "agent:main:main",
"lowModel": "ollama/qwen3:14b",
"highModels": [
"moonshot/kimi-k2.5",
"xai/grok-4-fast"
"openrouter/moonshotai/kimi-k2.5",
"xai/grok-4-fast",
"xai/grok-code-fast-1"
],
"warnAfterMinutes": 2,
"revertAfterMinutes": 45,

View File

@ -2,7 +2,7 @@
"profiles": {
"paid": {
"description": "High-quality paid model for deep work",
"primary": "moonshot/kimi-k2.5",
"primary": "openrouter/moonshotai/kimi-k2.5",
"fallbacks": [
"ollama/qwen3:14b",
"ollama/llama3.2:3b"

View File

@ -2,7 +2,7 @@
This setup adds two model profiles:
- `paid` -> `moonshot/kimi-k2.5` with local Ollama fallbacks
- `paid` -> `openrouter/moonshotai/kimi-k2.5` with local Ollama fallbacks
- `free` -> local Ollama-only stack
## On-demand switch (immediate)

View File

@ -0,0 +1,108 @@
#!/usr/bin/env bash
set -euo pipefail
usage() {
cat <<'USAGE'
Usage:
research <topic...>
research --sources <count> <topic...>
research --thinking <off|minimal|low|medium|high> <topic...>
research --deliver <topic...>
Examples:
research swiftui state management in 2026
research --sources 5 best local llm coding setups
research --thinking high ai coding agents comparison
USAGE
}
source_count="3"
thinking_level=""
deliver="false"
agent_id="${RESEARCH_AGENT_ID:-main}"
while (( "$#" )); do
case "$1" in
--sources)
shift
if [[ $# -eq 0 ]]; then
echo "[research] --sources requires a number" >&2
usage
exit 1
fi
source_count="$1"
;;
--thinking)
shift
if [[ $# -eq 0 ]]; then
echo "[research] --thinking requires a level" >&2
usage
exit 1
fi
thinking_level="$1"
;;
--deliver)
deliver="true"
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
-*)
echo "[research] unknown argument: $1" >&2
usage
exit 1
;;
*)
break
;;
esac
shift
done
if [[ $# -eq 0 ]]; then
echo "[research] topic is required" >&2
usage
exit 1
fi
if ! [[ "$source_count" =~ ^[0-9]+$ ]] || [[ "$source_count" -lt 1 ]]; then
echo "[research] --sources must be a positive integer" >&2
exit 1
fi
if ! command -v openclaw >/dev/null 2>&1; then
echo "[research] openclaw CLI is required" >&2
exit 1
fi
topic="$*"
message=$(
cat <<EOF
Research topic: $topic
Instructions:
- Search the web for up-to-date, reputable sources.
- Review at least $source_count distinct sources.
- Summarize the key points in concise bullet points.
- Include a short "Sources" section with direct links.
- Mention relevant publish/event dates when time-sensitive.
EOF
)
cmd=(openclaw agent --channel last --message "$message")
if [[ -n "$agent_id" ]]; then
cmd+=(--agent "$agent_id")
fi
if [[ -n "$thinking_level" ]]; then
cmd+=(--thinking "$thinking_level")
fi
if [[ "$deliver" == "true" ]]; then
cmd+=(--deliver)
fi
"${cmd[@]}"