安装与入门

1. 安装

apt update
apt install git vim zsh tmux -y
sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
# uv
curl -LsSf https://astral.sh/uv/install.sh | sh
# nodejs
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.1/install.sh | bash && \
export NVM_DIR="$HOME/.nvm" && \
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" && \
nvm install --lts

curl -fsSL https://openclaw.ai/install.sh | bash

2. 配置

配置火山

curl -fsSL https://openclaw.tos-cn-beijing.volces.com/setup.sh | bash -s -- \
    --ark-coding-plan "true" \
    --ark-model-id "ark-code-latest" \
    --ark-api-key "xxx"

远程访问dashboard

ssh -N -L 18789:127.0.0.1:18789 root@huoshan.shinerio.site

然后通过http://127.0.0.1:18789即可访问远程部署openclaw(通过openclaw dashboard获取登录token)

root@shinerio-huoshan:~# openclaw dashboard

🦞 OpenClaw 2026.2.25 (4b5d4a4) — I can't fix your code taste, but I can fix your build and your backlog.

Dashboard URL: http://127.0.0.1:18789/#token=xxxxxxxx
Copy to clipboard unavailable.
No GUI detected. Open from your computer:
ssh -N -L 18789:127.0.0.1:18789 root@192.168.0.2
Then open:
http://localhost:18789/
http://localhost:18789/#token=xxxxxxxxxx
Docs:
https://docs.openclaw.ai/gateway/remote
https://docs.openclaw.ai/web/control-ui

3. system prompt

以下文件每次都会加载

  • AGENTS.md:工作方式和操作规范
  • SOUL.md:openclaw风格、习惯
  • TOOLS.md:skill是共享的,tools是私人的
  • IDENTITY.md:who are openclaw?
  • USER.md:who are you?
  • HEARTBEAT.md
  • BOOTSTRAP.md (only on brand-new workspaces)
  • MEMORY.md and/or memory.md (when present in the workspace; either or both may be injected)
Tip
  1. 每日的记忆文件memory/*.md不会被自动加载,只会被memory_search和memory_get两个工具显示获取
  2. subagent只会加载agents.md和tools.md
  3. 手动修改后,需要执行openclaw daemon restart

4. memory

4.1. 📁 文件分类说明

/root/.openclaw/workspace/
├── MEMORY.md                           ← 长期记忆(手动维护)
├── memory/
│   └── 2026-02-27.md                   ← 每日会话记录
├── SOUL.md                             ← agent身份/性格
├── IDENTITY.md                         ← agent元数据
├── USER.md                             ← 用户信息
└── ... 其他工作文件

4.1.1. 1️⃣ Workspace 根目录文件(工作成果)

vps-comparison-2025.md ← VPS调研报告
hn-ai-hot-topics-2025-02-27.md ← HackNews热点分析
AGENTS.md, SOUL.md, ... ← 配置/身份文件

用途:具体的工作成果、文档、报告
生成时机:完成特定任务时
保留策略:长期保留,作为工作成果和知识库

4.1.2. 2️⃣ memory/ 目录文件(openclaw的记忆)

memory/2026-02-27.md ← 今日会话详细记录
memory/2026-02-26.md ← 昨日记录(如果有)

用途:记录每次会话的详细过程、决策、用户信息
生成时机:每次会话结束时
保留策略:滚动保留(如保留最近30天),然后总结到 MEMORY.md

4.1.3. 3️⃣ MEMORY.md(长期记忆精华)

MEMORY.md ← 长期记忆的精华版

用途: distilled 的持久记忆(用户偏好、重要事实、长期目标)
生成时机:定期从 memory/ 文件中总结
保留策略:永久保留,持续更新

4.1.4. 🔄 文件之间的关系

┌─────────────────────────────────────────────────────┐
│  Workspace 根目录                                    │
│  ├── vps-comparison-2025.md      ← 工作成果          │
│  ├── hn-ai-hot-topics-*.md       ← 工作成果          │
│  ├── AGENTS.md, SOUL.md...       ← 配置/身份         │
│  └── ...                                            │
└─────────────────────────────────────────────────────┘
                          │
                          │ 定期总结
                          ▼
┌─────────────────────────────────────────────────────┐
│  memory/ 目录                                        │
│  ├── 2026-02-27.md     ← 今日会话详细记录              │
│  ├── 2026-02-26.md     ← 昨日记录                     │
│  └── ... (滚动保留30天)                               │
└─────────────────────────────────────────────────────┘
                          │
                          │ 定期提炼
                          ▼
┌─────────────────────────────────────────────────────┐
│  MEMORY.md                                          │
│  ← 长期记忆精华(永久保留)                             │
└─────────────────────────────────────────────────────┘

4.1.5. 🧹 清理策略

文件/目录 清理策略 说明
vps-comparison-2025.md ❌ 不清理 工作成果,长期保留
hn-ai-hot-topics-*.md ❌ 不清理 工作成果,长期保留
memory/*.md ✅ 滚动清理 保留最近30天,旧文件删除
MEMORY.md ❌ 不清理 永久保留,持续更新

• 📚 完整记录:所有工作成果都保留
• 🧠 记忆管理:会话记录定期清理,精华永久保存
• 🔄 持续学习:从日常记录中提炼长期记忆

5. 5.agent的sqlite

OpenClaw 将本地的 Markdown 文件(如 MEMORY.md)进行切片(Chunking)并生成向量,然后存储在 ~/.openclaw/memory/{agentId}.sqlite 中。主要包含以下表结构:

  • files 表: 追踪文件修改时间(mtime)和哈希值,实现增量索引。
  • chunks 表: 存储文本片段、行号和 JSON 序列化后的向量数据。
  • chunks_vec (虚拟表): 利用 sqlite-vec 扩展进行高效向量搜索。
  • chunks_fts (虚拟表): 利用 SQLite 的 FTS5 模块进行全文关键字搜索。
    OpenClaw 会监视本地指定的知识库文件夹(通常是 memory/**/*.md)。写入过程由以下逻辑驱动:
  • 增量扫描: 系统会检查文件的修改时间(mtime)、文件大小以及内容哈希值(Content Hashes)。
  • 触发条件: 当系统检测到某个 Markdown 文件是新添加的,或者现有文件内容发生了变化时,会触发重新索引。
  • 写入内容: 系统将文本切片(Chunking)、生成 Embedding 向量,然后将更新后的数据写入 SQLite 的 fileschunks 以及对应的虚拟向量表和全文搜索表中。

5.1. 用途

用途 说明
🔍 向量检索 当用户说"找和 XX 相关的文件"时,系统用向量相似度搜索
📝 全文搜索 快速搜索文件内容,不用遍历所有文件
🤖 工具使用 某些工具可能需要检索相关文件时会用这个索引
🔧 后台系统 用户和agent都不会直接读这个数据库
Tip

agent不会直接读取sqlite,agent的记忆主要来自于memory.md文件

6. 配置定时任务

6.1. hack news

帮我使用openclaw cron配置一个定时任务,每天早上8点和晚上8点各推送一次 Hacker News 今日 Top 10报告

  1. 使用 API https://hacker-news.firebaseio.com/v0/topstories.json 获取topn列表
  2. 使用 API https://hacker-news.firebaseio.com/v0/item/{id}.json 获取元数据。
  3. 分析每篇文章原始内容,输出文章标题(标题可以保留英文但需要有中文说明)、发布时间、链接和评论数,以及摘要信息(简体中文)。
  4. 对获取到的所有文章进行技术趋势分析,识别出当前热门的技术话题和趋势
  5. 使用message 工具推送给我

6.2. qveris

Install the qveris-official skill via clawhub.ai and add the environment variable QVERIS_API_KEY=xxxxx to your configuration file.

7. ref

评论