← 返回
未分类 中文

Bootstrap Optimizer — Lean OpenClaw Bootstrap Architecture

Optimizes OpenClaw MD files by splitting TOOLS.md, enforcing atomic rules, and loading scenes on demand to keep bootstraps lean under 3KB.
通过拆分 TOOLS.md、执行原子规则并按需加载场景来优化 OpenClaw MD 文件,使启动文件保持在 3KB 以下。
warren2008-2020-spec warren2008-2020-spec 来源
未分类 clawhub v2.0.0 2 版本 100000 Key: 无需
★ 0
Stars
📥 330
下载
💾 0
安装
2
版本
#bootstrap#file-architecture#latest#lean-context#memory-management#openclaw

概述

SKILL.md — Bootstrap Optimizer

> Version: 2.0 | Updated: 2026-05-22

> Skill Name: md-bootstrap-optimizer

> Tags: bootstrap, memory-management, openclaw, file-architecture, lean-context

> Install: npx clawhub@latest install md-bootstrap-optimizer


What This Is

A design guide and audit tool for keeping OpenClaw's bootstrap file system lean and maintainable as it grows. Prevents rules from scattering, keeps context usage low, and makes every file's purpose clear.

Core problem it solves: As OpenClaw agents accumulate rules, MEMORY.md and TOOLS.md bloat, critical rules get truncated, and context is wasted on rules that aren't relevant to the current session.


The Three-Layer Architecture

Every file in the bootstrap layer belongs to exactly one of three layers:

LayerWhen LoadedRules
---------------------------
Core (Permanent)Every session, full loadAtomic principles only — things that are always true
Execution (On-demand)Triggered by scene or task typeDetailed procedures for specific situations
ArchiveNever auto-loadedHistorical, reference-only — no rule participation

Layer 1: Core — Always in Context

Files here load on every session start. Keep them small and permanent.

MEMORY.md        — Atomic rules (Why), not facts (What)
AGENTS.md        — Core operating procedures
CLAUDE.md / SOUL.md / IDENTITY.md — Identity anchors

Atomic rules only: Store principles that never expire, not event logs or temporary facts.

Good: "When the user says 'confirm', check if decisions.md needs updating before acting"

Bad: "The user owns 1 million in assets" (fact, not rule)


Layer 2: Execution — Loaded on Demand

Files here load only when their trigger fires. Keep them comprehensive.

SCHEDULING.md     — Loaded when scheduling tasks
INSTRUCTIONS.md   — Loaded when handling instructions
TOOLS.md          — Mother file (index only), children loaded on demand
PROJECT.md        — Loaded for specific projects

Mother-Child split for TOOLS.md: The mother file is an index (< 3KB). Child files contain the details. The child loads only when called.

TOOLS.md (mother, index only)
├── TOOLS_skills.md      — Detailed skill inventory
├── TOOLS_feishu.md      — Channel/protocol details
└── TOOLS_custom.md      — Your custom tool docs

Layer 3: Archive — Reference Only

These files exist on disk but never participate in bootstrap. Use them for historical context, but don't count on them for current behavior.

AGENTS_full.md    — Full ruleset (verbose version)
DREAMS.md         — Past session insights
HEARTBEAT.md      — Maintenance logs

The Lean Rules

Rule 1: Atomic MEMORY.md

MEMORY.md stores only permanently true principles. When something in MEMORY.md becomes a fact rather than a principle, move it to a project file or daily log.

Rule 2: Mother-Child Separation

When any bootstrap file exceeds ~3KB, split it:

  • Mother: Index and summaries only
  • Child: Full detail, loaded on demand

Rule 3: One Owner Per Rule

Every rule lives in exactly one file. Cross-references between files are OK for navigation, but rule ownership is singular.

Rule 4: Scene Loading Over Global Loading

Detailed procedures belong in scene-specific files, not in always-loaded core files. The session loads what's needed, not everything.


Audit Checklist

Run this monthly or whenever bootstrap feels slow:

# Check bootstrap file sizes
ls -lh ~/.openclaw/workspace/*.md | awk '{print $5, $9}'

# Check total bootstrap size
cat ~/.openclaw/workspace/*.md | wc -c

# Flag files over 3KB
for f in ~/.openclaw/workspace/*.md; do
  size=$(wc -c < "$f")
  if [ "$size" -gt 3000 ]; then
    echo "OVER 3KB: $f ($size bytes)"
  fi
done

Audit Thresholds

MetricWarningAction
-------------------------
Bootstrap total> 15KBReview for bloat
Any single file> 3KBPlan split
MEMORY.md growthAnyCheck if facts vs rules

Bootstrap File Size Budget

FileTarget MaxReason
-------------------------
MEMORY.md< 3KBLoaded every session
AGENTS.md< 5KBCore rules, always loaded
TOOLS.md (mother)< 3KBIndex only
Execution layer filesNo limitLoaded on demand

Anti-Patterns to Avoid

Don't pile everything into MEMORY.md

> Symptoms: Version drift, critical rules truncated, facts mixed with principles

Don't load detailed procedures in bootstrap

> Symptoms: Context wasted, slow session start, rules irrelevant to current task

Don't cross-reference without ownership

> Symptoms: "Where does this rule actually live?" — nobody knows

Don't keep facts in bootstrap files

> Facts belong in project files or daily logs. Bootstrap is for rules, not state.


Installation

# Install via ClawHub
npx clawhub@latest install md-bootstrap-optimizer

# Or manual: copy to your skills directory
cp -r md-bootstrap-optimizer ~/.openclaw/skills/

Prerequisites

  • OpenClaw workspace with bootstrap files
  • Basic understanding of your agent's bootstrap structure
  • No external dependencies beyond OpenClaw

Customization

This skill describes a general architecture. Adapt the layer definitions and thresholds to your workflow:

  • Change 3KB thresholds based on your context budget
  • Adjust layer assignments based on what actually triggers in your sessions
  • Add or remove layer categories to match your file inventory

版本历史

共 2 个版本

  • v2.0.0 当前
    2026-05-23 16:34 安全 安全
  • v1.0.0
    2026-05-21 15:30 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

dev-programming

CodeConductor.ai

larsonreever
AI驱动平台,提供快速全栈开发、智能体、工作流自动化及低代码AI集成的可扩展产品创建。
★ 75 📥 182,319
knowledge-management

Obsidian Dual-Layer Knowledge Base

warren2008-2020-spec
将Obsidian打造为双层知识库,实现每日增量摄入、结构化索引以及AI可访问的摘要,提供流畅的上下文支持。
★ 0 📥 383
dev-programming

Github

steipete
使用 `gh` CLI 与 GitHub 交互,通过 `gh issue`、`gh pr`、`gh run` 和 `gh api` 管理议题、PR、CI 运行及高级查询。
★ 681 📥 328,972