Skip to content
99 changes: 99 additions & 0 deletions examples/skills/ov_dream/OV_LITE_INSTALL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# OV Lite Install

This guide installs OV Lite for OpenClaw through the `ov_dream` skill. It syncs OpenClaw chat sessions to OpenViking serverless without installing the OpenViking `contextEngine` plugin or consuming a plugin slot.

## Prerequisites

Set these values before running sync or recall:

- `OPENVIKING_API_KEY`: OpenViking serverless API key
- `OPENVIKING_AGENT_ID`: OpenViking serverless agent ID

Do not print API keys in logs, shell history snippets, or replies.

## Install Or Update

Choose the OpenViking source ref explicitly. Use `main` after this guide has been merged, or replace `SOURCE_BASE` with another trusted raw source when testing an unmerged change.

```bash
SOURCE_BASE=https://raw.githubusercontent.com/volcengine/OpenViking/main

mkdir -p ~/.openclaw/skills/ov_dream/scripts

curl -fsSL "$SOURCE_BASE/examples/skills/ov_dream/SKILL.md" \
-o ~/.openclaw/skills/ov_dream/SKILL.md
curl -fsSL "$SOURCE_BASE/examples/skills/ov_dream/scripts/dream.py" \
-o ~/.openclaw/skills/ov_dream/scripts/dream.py

touch ~/.openclaw/skills/ov_dream/__init__.py
touch ~/.openclaw/skills/ov_dream/scripts/__init__.py
```

If any download fails, stop and verify `SOURCE_BASE`.

## Verify Files

```bash
grep -q 'SERVERLESS_BASE_URL' ~/.openclaw/skills/ov_dream/scripts/dream.py
grep -q 'OPENVIKING_AUTH_MODE' ~/.openclaw/skills/ov_dream/scripts/dream.py
grep -q 'viking://user/default' ~/.openclaw/skills/ov_dream/scripts/dream.py
grep -q 'is_chat_session_key' ~/.openclaw/skills/ov_dream/scripts/dream.py
grep -q 'raw jsonl fallback can accidentally sync cron/subagent transcripts' ~/.openclaw/skills/ov_dream/scripts/dream.py
grep -q 'client.add_session_message(session.session_id' ~/.openclaw/skills/ov_dream/scripts/dream.py
```

If any check fails, the downloaded `dream.py` is not the expected OV Lite version.

## Configure Serverless Auth

Create `~/.openclaw/ov_dream.env` if it does not exist. If it already exists, keep real `OPENVIKING_API_KEY` and `OPENVIKING_AGENT_ID` values and only add missing non-secret defaults.

```bash
cat > ~/.openclaw/ov_dream.env <<'EOF'
OPENVIKING_BASE_URL=https://api.vikingdb.cn-beijing.volces.com/openviking
OPENVIKING_API_KEY=<replace with OpenViking serverless API key>
OPENVIKING_AGENT_ID=<replace with OpenViking agent ID>
OPENVIKING_AUTH_MODE=serverless
EOF
chmod 600 ~/.openclaw/ov_dream.env
```

## Verify Sync And Recall

```bash
cd ~/.openclaw/skills/ov_dream
set -a
. ~/.openclaw/ov_dream.env
set +a
python3 scripts/dream.py dream
python3 scripts/dream.py recall "最近我在聊什么"
```

## Schedule Sync

Add or update an OpenClaw cronjob to sync every 5 minutes. If `ov-dream-sync` already exists, update or replace it instead of creating a duplicate.

```bash
openclaw cron add ov-dream-sync \
--schedule "*/5 * * * *" \
--command 'cd ~/.openclaw/skills/ov_dream && set -a && . ~/.openclaw/ov_dream.env && set +a && python3 scripts/dream.py dream'
```

## Recall Command

When the user asks for `ov recall <query>`, run:

```bash
cd ~/.openclaw/skills/ov_dream
set -a
. ~/.openclaw/ov_dream.env
set +a
python3 scripts/dream.py recall "<query>"
```

## Behavior Notes

- OV Lite reads chat sessions from `~/.openclaw/agents/main/sessions/sessions.json`.
- OV Lite does not fall back to scanning latest raw jsonl files.
- OV Lite filters non-chat sessions containing `:cron:`, `:heartbeat:`, `:subagent:`, `:acp:`, or `:hook:`.
- OV Lite reuses the OpenClaw `session_id` when writing to OpenViking serverless.
85 changes: 85 additions & 0 deletions examples/skills/ov_dream/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
---
name: ov_dream
description: Use when the user explicitly types `ov dream` or `ov recall <query>` and the request should be routed to the OpenViking sync/recall CLI instead of handled as normal chat.
---

# OV Dream

Use this skill for manual OpenViking sync and recall without occupying the OpenClaw `contextEngine` slot.

## When To Use

Use this skill when the user message begins with one of these exact prefixes:

- `ov dream`
- `ov recall `

Do not treat those messages as normal conversation. They are explicit operator commands.

## Commands

- `ov dream`
Manual sync. Read OpenClaw's `sessions.json`, sync eligible chat transcripts to OpenViking, then commit each session when new messages exist.

- `ov recall <query>`
Manual recall. Search OpenViking under the default user root URI, `viking://user/default`.

## Sync Behavior

Trigger when the user message is exactly `ov dream`.

Execution flow:

1. Run:

```bash
python3 scripts/dream.py dream
```

2. Return the sync summary.

The sync command reads OpenClaw session metadata from `~/.openclaw/agents/main/sessions/sessions.json` when available. It syncs chat-like session keys such as `agent:main:main`, `:direct:`, `:channel:`, `:group:`, and `:room:`.

It must not sync explicitly non-chat sessions, including keys containing `:cron:`, `:heartbeat`, `:subagent:`, `:acp:`, or `:hook:`.

Each source session keeps an independent sync cursor in `~/.openclaw/memory/ov_dream_sync.json`.

## Recall Behavior

Trigger when the user message starts with `ov recall `.

This is a hard routing rule for this skill:

- If the user says `ov recall <query>`, do not answer from general reasoning.
- Do not summarize what recall would do.
- Do not ask whether recall should be run.
- Immediately execute the local recall command.

Execution flow:

1. Extract everything after `ov recall` as the recall query.
2. Run:

```bash
python3 scripts/dream.py recall "<query>"
```

3. Return the relevant memory rows to the user.
4. If no memories are found, return `No memories found.`

Rules:

- Treat `ov recall ...` as a manual recall request, not a normal conversation turn.
- Treat the command text after `ov recall` as the exact recall query.
- Run the recall command from the skill directory so `scripts/dream.py` resolves correctly.
- Do not auto-inject retrieved memories into prompt context.
- Do not trigger `ov dream` unless the user separately asks for sync.
- If the query is empty, ask the user for the recall query instead of guessing.

## Notes

- This skill is manual-only in the first version.
- It does not auto-inject recall into prompts.
- It does not replace the OpenViking context-engine plugin.
- Disk-based sync is for recently recorded chat transcripts. It is not a precise "currently running sessions" detector.
- For OpenViking serverless, configure `OPENVIKING_BASE_URL`, `OPENVIKING_API_KEY`, `OPENVIKING_AGENT_ID`, and optionally `OPENVIKING_AUTH_MODE=serverless`. The CLI will use Bearer auth and the serverless session message format automatically.
1 change: 1 addition & 0 deletions examples/skills/ov_dream/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""OV Dream skill package."""
1 change: 1 addition & 0 deletions examples/skills/ov_dream/scripts/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Scripts for the OV Dream skill."""
Loading
Loading