Workspace Hygiene
Maintains clean, RAG-friendly workspaces across all agents. Runs on demand or weekly.
Quick Start
CODEBLOCK0
Or for a specific agent:
CODEBLOCK1
What It Does
1. Structure Audit
Reads
STRUCTURE.md from the workspace root. Scans for:
- - Files at root that aren't agent config (AGENTS.md, SOUL.md, etc.)
- Folders that don't match the canonical layout
- Files in wrong locations (e.g. Claire scripts in Maggie's workspace)
2. Memory Health
Scans
memory/ for:
- - Files using timestamp format (YYYY-MM-DD-HHMM.md) instead of date or topic
- Daily logs older than 30 days that haven't been distilled into MEMORY.md
- Gaps in daily logging (missing dates during active periods)
- MEMORY.md line count — flag if over 150
3. Project README Audit
Checks every folder in
projects/ for a
README.md. Missing READMEs degrade RAG retrieval —
memory_search can't find project context without them.
4. Memory Format Check
Validates that recent memory entries (last 7 days) use the tagged format:
CODEBLOCK2
Untagged entries are flagged for manual review, not auto-tagged.
5. Health Report
Writes a report to
projects/system/hygiene-YYYY-MM-DD.md with:
- - Structure violations (with suggested fixes)
- Memory health score
- Missing project READMEs
- Untagged memory entries
- Recommended actions (prioritized)
Auto-Fix vs Flag
| Issue | Action |
|---|
| Timestamp-format memory files | Auto-consolidate into date file |
| Missing project README |
Flag — agent should write it with project context |
| Files in wrong location | Flag with suggested move command |
| MEMORY.md over 150 lines | Flag for manual trimming |
| Root-level junk files | Flag with suggested archive command |
| Untagged memory entries | Flag — don't auto-tag (context needed) |
Deployment
Install to each agent workspace's skills/ folder, or install to ~/.openclaw/skills/ for global access.
Add to HEARTBEAT.md:
CODEBLOCK3
Reference Docs
| File | Purpose |
|---|
| INLINECODE9 | Canonical memory entry format and tagging rules |
| INLINECODE10 |
How to write project READMEs for optimal RAG retrieval |
|
audit.md | Detailed audit rules and canonical structure |
技能名称: workspace-hygiene
详细描述:
工作区卫生
在所有智能体间维护整洁、适合RAG的工作区。可按需运行或每周运行。
快速开始
bash
python3 skills/workspace-hygiene/scripts/hygiene.py --workspace ~/.openclaw/workspace
或针对特定智能体:
bash
python3 skills/workspace-hygiene/scripts/hygiene.py --workspace ~/.openclaw/workspace-claire
功能说明
1. 结构审计
读取工作区根目录的 STRUCTURE.md。扫描内容:
- - 根目录下非智能体配置文件(如AGENTS.md、SOUL.md等)的文件
- 不符合规范布局的文件夹
- 位置错误的文件(例如Maggie工作区中的Claire脚本)
2. 记忆健康
扫描 memory/ 目录:
- - 使用时间戳格式(YYYY-MM-DD-HHMM.md)而非日期或主题命名的文件
- 超过30天且未提炼至MEMORY.md的日常日志
- 日常日志记录中的缺失(活跃期间缺少日期)
- MEMORY.md行数——超过150行时标记
3. 项目README审计
检查 projects/ 中每个文件夹是否包含 README.md。缺少README会降低RAG检索质量——没有README,memory_search 无法获取项目上下文。
4. 记忆格式检查
验证最近7天的记忆条目是否使用标签格式:
markdown
[DECISION] 决策内容及原因
[FACT] 值得保留的持久事实
[PROJECT] 项目名称——状态更新
[RULE] 已建立的规则或偏好
[EVENT] 发生的事件
未加标签的条目会被标记供人工审查,不会自动添加标签。
5. 健康报告
向 projects/system/hygiene-YYYY-MM-DD.md 写入报告,包含:
- - 结构违规(附建议修复方案)
- 记忆健康评分
- 缺失的项目README
- 未加标签的记忆条目
- 建议操作(按优先级排序)
自动修复 vs 标记
| 问题 | 操作 |
|---|
| 时间戳格式的记忆文件 | 自动合并为日期文件 |
| 缺失项目README |
标记——智能体应根据项目上下文编写 |
| 位置错误的文件 | 标记并附建议移动命令 |
| MEMORY.md超过150行 | 标记供手动修剪 |
| 根目录垃圾文件 | 标记并附建议归档命令 |
| 未加标签的记忆条目 | 标记——不自动添加标签(需上下文) |
部署
安装至每个智能体工作区的 skills/ 文件夹,或安装至 ~/.openclaw/skills/ 实现全局访问。
添加至 HEARTBEAT.md:
markdown
每周卫生(周一)
- - 运行 python3 skills/workspace-hygiene/scripts/hygiene.py --workspace <路径>
- 审查 projects/system/hygiene-YYYY-MM-DD.md 中的报告
- 修复标记问题或上报至Steve
参考文档
| 文件 | 用途 |
|---|
| memory-format.md | 规范记忆条目格式及标签规则 |
| rag-index.md |
如何编写项目README以实现最佳RAG检索 |
| audit.md | 详细审计规则及规范结构 |