Openclaw本地存储文件架构说明

OpenClaw 本地存储架构

复制代码
 ~/.openclaw/
  ├── openclaw.json              # 核心配置文件
  ├── openclaw.json.bak*         # 自动备份
  ├── .env                       # 环境变量
  │
  ├── agents/                    # Agent 配置目录
  │   ├── main/                  # 默认 agent
  │   │   ├── agent/
  │   │   │   ├── models.json       # 模型配置
  │   │   │   └── auth-profiles.json # 认证信息
  │   │   └── sessions/
  │   ├── will/                  # 自定义 agent
  │   │   ├── agent/
  │   │   │   ├── models.json
  │   │   │   └── auth-profiles.json
  │   │   └── sessions/
  │   └── ollama_test/           # 测试 agent
  │
  ├── workspace/                 # 主工作空间 (Git 仓库)
  │   ├── .git/                  # 版本控制
  │   ├── AGENTS.md              # Agent 行为指南
  │   ├── BOOTSTRAP.md           # 首次运行配置
  │   ├── SOUL.md                # Agent 人格定义
  │   ├── USER.md                # 用户信息
  │   ├── TOOLS.md               # 工具说明
  │   ├── HEARTBEAT.md           # 心跳/状态
  │   └── memory/                # 记忆存储
  │       └── YYYY-MM-DD.md      # 每日记忆
  │
  ├── workspace-will/            # Will agent 工作空间
  ├── workspace-ollama_test/     # Ollama 测试工作空间
  │
  ├── subagents/                 # 子 agent 配置
  ├── memory/                    # 全局记忆
  ├── identity/                  # 身份认证
  ├── credentials/               # 加密凭据存储
  ├── completions/               # 补全历史
  ├── canvas/                    # Canvas 数据
  ├── cron/                      # 定时任务
  │   └── jobs.json
  ├── devices/                   # 设备信息
  ├── extensions/                # 扩展插件
  ├── logs/                      # 日志文件
  │   ├── gateway.log
  │   ├── gateway.err.log
  │   └── commands.log
  └── update-check.json          # 更新检查

核心组件说明

复制代码
目录/文件                                                   │ 用途                                                       │ 关键文件
  ─────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────
   openclaw.json                                               │ 全局配置                                                   │ 模型、网关、插件、渠道配置
   agents/                                                     │ 多 agent 支持                                              │ 每个 agent 独立的模型和认证
   workspace/                                                  │ 工作空间                                                   │ Git 管理的记忆和配置
   credentials/                                                │ 安全存储                                                   │ 加密后的 API keys
   memory/                                                     │ 持久记忆                                                   │ 跨会话的记忆保持
   logs/                                                       │ 运行日志                                                   │ 排查问题用

我的多 Agent 架构示例

复制代码
┌─────────────────────────────────────┐
│           OpenClaw Gateway           │
│         (端口 18789)                 │
└─────────────┬───────────────────────┘
                │
      ┌─────────┼─────────┐
      ▼         ▼         ▼
  ┌───────┐ ┌───────┐ ┌───────────┐
  │ main  │ │ will  │ │ollama_test│
  │agent  │ │agent  │ │  agent    │
  └───┬───┘ └───┬───┘ └─────┬─────┘
      │         │           │
      ▼         ▼           ▼
  ┌───────┐ ┌───────┐ ┌───────────┐
  │workspace│ │workspace-will│ │workspace-ollama│
  └───────┘ └───────┘ └───────────┘

每个 agent 有独立的:

  • 模型配置 (models.json)

  • 认证信息 (auth-profiles.json)

  • 工作空间 (workspace-{name}/)

  • 会话历史 (sessions/)

记忆系统

复制代码
   类型                                                        │ 位置                                                       │ 用途
  ─────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────┼────────────────────────────────────────────────────────────
   每日记忆                                                    │ workspace/memory/YYYY-MM-DD.md                             │ 原始对话记录
   长期记忆                                                    │ workspace/MEMORY.md                                        │ 提炼的重要信息
   Agent 指南                                                  │ workspace/AGENTS.md                                        │ 行为准则
   用户画像                                                    │ workspace/USER.md                                          │ 用户偏好
相关推荐
dyxal2 小时前
openclaw如何如何命令行配置不要自动启动,命令是什么
openclaw
laplace01232 小时前
Kv cache
人工智能·agent·claude·rag·skills
laplace01232 小时前
KL 散度1
人工智能·算法·agent·qwen
君哥聊编程3 小时前
生产级AI战斗机NanoBot 体验(OpenClaw极简实现)
人工智能·ai·大模型·openclaw·nanobot
三寸3374 小时前
ChatGPT Plus国内订阅三种方案深度对比:风险、成本分析
人工智能·ai·chatgpt
laplace01234 小时前
浮点数精度
人工智能·算法·agent·qwen
Baihai IDP4 小时前
Prompt caching 技术是如何实现 1 折的推理成本优化的?
人工智能·ai·llm
spencer_tseng5 小时前
Break the Sequential Dependency of LLM Inference Using Lookahead Decoding
ai·llm
spencer_tseng5 小时前
Soft Adaptive Policy Optimization
ai