Install
openclaw skills install @milesnee/workspace-auditSoftware-engineering system audit for Agent workspaces. Uses DDIA reliability + DDD bounded-context analysis to diagnose schema drift, consistency gaps, query degradation, lifecycle bloat, and architectural coupling. Triggers during periodic health checks or when the workspace feels stale, bloated, or inconsistent.
openclaw skills install @milesnee/workspace-audit当工作区出现文件膨胀、上下文耦合、查询质量退化、Schema漂移等问题时,用软件工程视角系统化诊断和修复。
Dual lens:
Five problem domains:
| 域 | 核心问题 | 典型症状 |
|---|---|---|
| Schema | 无Schema约束,自由文本退化 | 字段不一致,无法程序化解析 |
| Consistency | 多存储间状态脱节 | 配置文件写了旧状态,实际已变 |
| Query | 无去重、无联合搜索 | 搜出重复,漏掉归档 |
| Lifecycle | 无GC、无过期标记 | 历史项目堆积,噪音淹没信号 |
| Coupling | 配置/运维/理论混杂 | 改一处牵一片,token浪费 |
python3 scripts/audit_baseline.py --workspace . --report /tmp/audit-baseline.json
Collect: file counts, line counts, Front Matter coverage (by directory category), duplication rate (per-category), staleness score.
Reading the output (v1.1+): The baseline report splits
memory/into categories (toplevel,archive,clawcast, plus any other subdirs auto-detected). The headline FM coverage is thetoplevelrate — that's the one to chase to 100%.fm_coverage_allis the cross-directory aggregate and will look low because archive/diary dirs are historically un-FM'd; that's expected and not a P0.
Duplicate dates are per-category, not global. A toplevel daily log and a clawcast study note sharing the same date is normal multi-event logging, not a duplicate. The script tags duplicates as
category:YYYY-MM-DDso you can tell. Only act on duplicates within the same category (e.g. twotoplevel:2026-04-25files).
python3 scripts/audit_diagnose.py --baseline /tmp/audit-baseline.json --output /tmp/audit-report.md
Each finding → priority bucket (P0-P4):
Work P0 → P4 sequentially. Each fix:
Conservative file ops default. When fixing duplicate-date or stale files, prefer mv → archive/ over rm. Deletion is irreversible and the user wasn't in the loop to approve a specific file. Only delete a file when its content is provably empty or already byte-identical to another file (e.g. an 85-byte NO_REPLY stub whose info is in the main log). When in doubt, move not delete, and report what was moved.
Don't over-merge "duplicate dates". Two files with the same FM date but different filenames and different content type (e.g. 2026-04-04.md daily log vs travel-2026-04-malaysia-singapore.md travel itinerary) are not duplicates — they are the same day recording different events. Merging them destroys the topical separation. The per-category duplicate check in v1.1 baseline already filters most of these; manually verify any remaining flags before acting.
python3 scripts/audit_validate.py --report /tmp/audit-report.md
| Script | Source | Purpose |
|---|---|---|
audit_baseline.py | this skill | Collect workspace metrics |
audit_diagnose.py | this skill | Generate prioritized findings |
audit_validate.py | this skill | Verify fixes passed |
memory_gc.py | workspace | Semi-auto GC scan → suggestions |
staleness_check.py | workspace | Detect stale entries (>60d) |
unified_search.py | workspace | Cross-store federated search |
knowledge_graph.py | workspace | Node/edge graph from memory |
gen_references_index.py | workspace | Auto-generate INDEX.md |
This skill assumes an OpenClaw-style workspace but the audit framework is general:
workspace/
MEMORY.md # long-term semantic memory
AGENTS.md # operational handbook
SOUL.md # persona/behavior rules
TOOLS.md # ops reference
IMPLEMENT.md # task tracker
memory/*.md # daily episodic logs
references/*.md # archived source materials
traces/ # agent execution traces
docs/ # migrated detailed docs
For other Agent frameworks or layouts, adapt audit_baseline.py path constants and the checklist thresholds.
Hermes Agent (~/.hermes/): The baseline scripts do NOT work here — Hermes
uses SQLite (state.db) instead of flat files, and has no SOUL.md/AGENTS.md.
Use references/hermes-audit-procedure.md
instead, which covers state.db schema queries, memory truncation detection,
cron delivery error diagnosis, and the correct column names (timestamp REAL,
not created_at).
memory/*.md + memory/archive/*.md + memory/clawcast/*.md together and computed duplicate dates across the union. This reported 48 "duplicates" when only 3 were real file-name collisions — the rest were a daily log and a same-day clawcast note legitimately coexisting. Fixed in v1.1: duplicates are now detected per-category and tagged category:date. If you ever adapt this script to a new workspace, keep the per-category isolation; do not collapse back to a flat list.archive/, diary/, agent-productivity/ historically have little or no front matter. This is expected and not a P0. Chase the toplevel FM coverage to 100% first; subdirectory FM is a P3/P4 cleanup at best.approvals.cron_mode: approve), execute_code is denied. Write ad-hoc Python to /tmp/script.py and run it via terminal instead — the baseline/diagnose/validate scripts already work this way.~/.hermes/sessions/ (.jsonl transcripts, session_*.json checkpoint dumps) are raw exports that session_search never reads — search uses FTS on state.db. Before deleting or compressing old session files, verify they overlap with state.db's date range; if so, they're 100% redundant. The default cleanup is tar.gz compress (~80% reduction), not rm.last_status: ok but last_delivery_error: [99992402] = delivery problem (fixable, clear stale thread_id). A cron job where last_status: ok but the output content shows repeated upstream API 401/rejection = dead service problem (remove the job entirely, don't debug the key). Different root causes, different fixes.session_*.json checkpoint dumps (the #1 disk consumer, not just *.jsonl), lsp/ node_modules, logs/, ghost sessions. Always du -sh every top-level subdirectory — the 5-dir command in the original procedure is too narrow.[99992402] stale thread_id root cause + fix, dead cron job removal (upstream API dead), session archive compression (tar.gz middle path), state.db redundancy verification before cleanup, correct column names timestamp REAL not created_at, ghost session detection, second-pass audit shift patterns, session_*.json as #1 disk consumer (14-day archive threshold)/root/.openclaw/workspace