[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M777CSQ6HCCWFPWQP55XTASR":3,"skill-same:01M777CSQ6HCCWFPWQP55XTASR":47},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":24,"commitSha":25,"skillDirectory":26,"forksCount":27,"repositoryHtmlUrl":28,"repositoryHomepageUrl":6,"ownerHtmlUrl":29,"ownerBlogUrl":30,"ownerDescription":31,"updatedAt":32,"install":33,"resources":46},"01M777CSQ6HCCWFPWQP55XTASR","buffer",null,"Session management for OpenClaw agents. Context monitoring, structured handoffs, and performance optimization — so you never lose context again.","javimosch\u002Fopen-claw-skills","javimosch","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F12900508?v=4","01M6D3F2AS6PV75ET9PZ1QGP8J","Javier Leandro Arancibia","01M75B8NCTAJG9WH5YNZH7C3D8",0,"MIT","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaynevaughan\u002Fbuffer-session\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: buffer\ndescription: \"Session management for OpenClaw agents. Context monitoring, structured handoffs, and performance optimization — so you never lose context again.\"\n---\n\n# Buffer\n\n## First Run\n\nCheck if `buffer-optimizer` exists as a sibling skill directory. Look for `skills\u002Fbuffer-optimizer\u002FSKILL.md` relative to your workspace.\n\n**If it does NOT exist**, extract it now:\n\n1. Create directory `skills\u002Fbuffer-optimizer\u002F`\n2. Write `skills\u002Fbuffer-optimizer\u002FSKILL.md` with the exact contents of the **Embedded: buffer-optimizer** section below.\n3. If the skill references shell scripts (`{baseDir}\u002Fscripts\u002Fmeasure-boot.sh` and `{baseDir}\u002Fscripts\u002Faudit-agents-md.sh`), create those too from the **Embedded Scripts** section.\n4. Run the **Setup** steps from the embedded optimizer (create HANDOFF.md if missing, validate MEMORY.md, check AGENTS.md structure).\n5. Tell the owner what was set up and that workspace audits are now available via `buffer-optimizer`.\n\n**If extraction fails** (sandbox, read-only filesystem, write tool denied):\n- Tell the owner: \"I can't write files to the skills directory. Install the optimizer separately: `clawhub install buffer-optimizer`\"\n- Continue with normal session management below.\n\n**If buffer-optimizer already exists**, skip extraction. Proceed to the mode that matches your situation.\n\n---\n\n## Start\n\nRun at every new session. Goal: recover context instantly.\n\n1. Read HANDOFF.md — where you left off, outcomes, next steps.\n2. Read MEMORY.md — priorities, projects, people.\n3. Start working. Do not read other files unless the task requires them.\n\n**No HANDOFF.md?** Check recent `memory\u002F*.md` files, try `memory_search`, then ask the owner. Run `buffer-optimizer` to set up your workspace.\n\n---\n\n## Monitor\n\nApply continuously during the session.\n\n### Intake\nBefore loading content:\n- **Changed?** Don't re-read unmodified files.\n- **Need all of it?** Use `grep`, `head`, `limit`\u002F`offset` over full reads.\n- **Can reference instead?** Write large output to file, read summary.\n- **Cache impact?** Don't edit AGENTS.md\u002FSOUL.md\u002FUSER.md\u002FMEMORY.md mid-session (breaks prompt cache, 10x cost).\n\n### Output\n- Redirect heavy output (>20 lines) to `\u002Ftmp`, read tail\u002Fsummary.\n- Pipe long commands through `tail`\u002F`head`\u002F`grep`.\n\n### Context Thresholds\n\nThresholds are percentages of your model's context window. Run `session_status` — the Context line shows current usage.\n\n| Usage | Action |\n|---|---|\n| **\u003C25%** | No concern. Full performance. |\n| **25-40%** | Be intentional about what you load. |\n| **40-50%** | ⚠️ Warn owner. Degradation begins on complex tasks. |\n| **>50%** | 🔴 Wrap now. |\n\n### Degradation signals — warn the owner and recommend wrapping if you notice:\n- Repeating yourself (context distraction)\n- Forgetting earlier decisions (retrieval failure)\n- Ignoring relevant earlier context (recency bias)\n- Confusion from conflicting information (context clash)\n- Referencing something that was wrong earlier (context poisoning)\n\nDo not wrap unilaterally — warn first, let the owner decide when to wrap.\n\n### Continuous persistence\nDon't wait for wrap to save important information. As decisions happen, append key outcomes to HANDOFF.md or a scratch file. If you have a long-term memory system, write decisions there immediately.\n\nTest: if this session crashed now, would important stuff survive?\n\n---\n\n## Wrap\n\nRun when: owner says \"wrap session\", you hit 50% context, or conversation concludes.\n\n### Step 1: Extract from the session\nScan for: decisions, outcomes, open questions, corrections, next steps.\n\n### Step 2: Write HANDOFF.md\nOverwrite with current state:\n\n```markdown\n# HANDOFF.md\n\n## Current Work\n[One line — focus area.]\n\n## Stopping Point\n[One line — where you left off.]\n\n## Key Outcomes\n- [Conclusions, not activities. \"X works because Y\" not \"tested X\".]\n\n## Open Questions\n- [Each must be actionable by the next session.]\n\n## Next Steps\n1. [Most important first. ≤5 items.]\n```\n\n**Rules:**\n- ≤2KB. Over? Compress outcomes to conclusions only.\n- Outcomes = conclusions, not activities.\n- Cut anything that doesn't affect future work.\n- No architecture docs, standing policies, or issue lists.\n\n### Step 3: Update MEMORY.md only if structure changed\nNew project, priority shift, new key person, or week rollover. Most sessions: don't touch it.\n\n### Step 4: Persist unpersisted decisions\nScan for decisions or outcomes not yet captured in HANDOFF.md.\n\n### Step 5: Confirm to owner\nWhat was saved. Whether MEMORY.md was updated. Top next step.\n\n---\n\n## Quick Reference\n\n| File | Purpose | Target | Updated |\n|---|---|---|---|\n| HANDOFF.md | Session state — recovery file | ≤2KB | Every wrap |\n| MEMORY.md | Big picture — priorities, projects, people | ≤1.5KB | When structure changes |\n| AGENTS.md | Behavioral rules | ≤4KB | Rarely |\n\n| Zone | Range | Behavior |\n|---|---|---|\n| Green | \u003C25% | Full performance |\n| Yellow | 25-40% | Intentional loading |\n| Orange | 40-50% | Warn owner, prepare to wrap |\n| Red | >50% | Wrap immediately |\n\n---\n\n## Embedded: buffer-optimizer\n\nOn first run, write this as `skills\u002Fbuffer-optimizer\u002FSKILL.md`:\n\n```\n---\nname: buffer-optimizer\ndescription: \"Workspace auditing and setup for Buffer. Measures boot payload, checks AGENTS.md structure, classifies skills, validates memory files. Run on first install, when things feel off, or every week or two. Companion to the buffer skill.\"\n---\n\n# Buffer Optimizer\n\nTwo modes: **setup** (first install) and **audit** (periodic maintenance).\n\n---\n\n## Setup\n\nRun on first install, or when the owner asks to configure their workspace.\n\n### 1. Create HANDOFF.md\nIf missing, create:\n\n# HANDOFF.md\n## Current Work\n## Stopping Point\n## Key Outcomes\n## Open Questions\n## Next Steps\n\n### 2. Validate MEMORY.md\nMust contain only: this week (2-3 lines), priorities (≤5), project states (one line each), key people. Target: ≤1.5KB. If missing, create a minimal version with the owner's name and current focus.\n\n### 3. Check AGENTS.md structure\nVerify these exist. If missing, draft them and present to owner for approval:\n\n**Pre-response checkpoint** (must be the first section):\n\n## Before Every Response\n1. Does this message match a skill trigger? → Load that skill.\n2. Am I about to do something a skill already handles? → Use the skill.\n\n**Skill trigger table** (immediately after checkpoint):\n\n## Skill Triggers\n| Event | Skill |\n|---|---|\n| [event] | [skill-name] |\n\n**Negative triggers:**\n\n## Don't Reinvent Skills\n- [manual pattern] → Use [skill-name]\n\n**Context management rules:**\n\n## Context Management\n- Heavy output (>20 lines): redirect to file, read summary.\n- Use targeted reads (limit\u002Foffset, grep, tail) over full file loads.\n- 40-50% context: Warn owner. >50%: Wrap immediately.\n- Don't edit boot files mid-session (breaks prompt cache, 10x cost).\n\n### 4. Classify skills\nList all loaded skills. Classify as DAILY\u002FWEEKLY\u002FRARE\u002FNEVER. Draft a daily driver list. Flag NEVER skills for potential exclusion.\n\n### 5. Report setup status\nTell the owner what was created, what was validated, and what needs their review.\n\n---\n\n## Audit\n\nRun periodically (weekly or bi-weekly), after major changes, or when the owner asks.\n\n### Step 1: Measure Boot Payload\n\nRun `bash {baseDir}\u002Fscripts\u002Fmeasure-boot.sh` if the script exists. Otherwise measure manually.\n\n#### Thresholds\n\n| File | Target | Action if exceeded |\n|---|---|---|\n| AGENTS.md | ≤4KB | Convert descriptions to directives. Move reference content out. |\n| MEMORY.md | ≤1.5KB | Keep only: this week, priorities, projects, people. |\n| HANDOFF.md | ≤2KB | Apply template: current work, stopping point, outcomes, questions, next steps. |\n| Each memory\u002F*.md | ≤2KB | Summarize transcripts. |\n| Total boot | ≤12KB | Something doesn't belong in boot. |\n| Skills loaded | \u003C20 | Exclude unused skills (~75 tokens each). |\n\n### Step 2: Audit AGENTS.md\n\nRun `bash {baseDir}\u002Fscripts\u002Faudit-agents-md.sh` if the script exists. Otherwise check manually.\n\nVerify:\n- 2.1 Pre-response checkpoint is the first section.\n- 2.2 Skill trigger table immediately follows.\n- 2.3 Negative triggers section exists.\n- 2.4 No weak patterns (\"You have access to\", \"Consider\", \"Try to\", \"If appropriate\" → rewrite as imperatives).\n- 2.5 Sections grouped by trigger, not topic.\n\n### Step 3: Audit Skills\n\n- Count skills from available_skills in system prompt.\n- Classify each: DAILY \u002F WEEKLY \u002F RARE \u002F NEVER.\n- Draft daily driver list for AGENTS.md.\n- Draft exclusion list. Present to owner — do not exclude unilaterally.\n\n### Step 4: Audit Memory Files\n\n- MEMORY.md — only: this week, priorities, projects, people. Flag old history, architecture, URLs.\n- HANDOFF.md — only: current work, stopping point, outcomes, questions, next steps. Outcomes = conclusions, not activities.\n- memory\u002F*.md — over 2KB → summarize. Over 3 days → archive. Duplicates → remove.\n- Ghost files — flag any .md in workspace root not in: AGENTS.md, SOUL.md, USER.md, MEMORY.md, HANDOFF.md, IDENTITY.md.\n\n### Step 5: Check Reliability\n\n- Compaction flush: Enabled? If unknown, flag.\n- Wrap ritual: Does buffer skill exist? If missing, recommend install.\n- Automated persistence: Write hooks, observers, auto-commit? If none, flag as priority gap.\n\n### Step 6: Self-Tests\n\n- Recovery: Read HANDOFF.md — does it reflect current state?\n- Skill bypass: Did you recently do manually what a daily driver skill handles?\n- Drift: Re-read AGENTS.md. Flag any instruction you're not following.\n\n### Step 7: Report\n\n## Buffer Audit Report — [date]\n\n### Boot Payload\n- Total: X bytes (~Y tokens) [PASS\u002FOVER 12KB]\n- [file-by-file with pass\u002Ffail]\n\n### AGENTS.md Structure\n- Pre-response checkpoint: [YES\u002FNO]\n- Triggers first: [YES\u002FNO]\n- Negative triggers: [YES\u002FNO]\n- Weak patterns: [count]\n- Organization: [trigger\u002Ftopic]\n\n### Skills\n- Loaded: N (target: \u003C20)\n- Daily drivers: [list]\n- Exclusion candidates: [list] (~X tokens saved)\n\n### Memory\n- MEMORY.md: X bytes [PASS\u002FOVER]\n- HANDOFF.md: X bytes [PASS\u002FOVER]\n- Ghost files: [list or none]\n- Files needing work: [list or none]\n\n### Reliability\n- Compaction flush: [enabled\u002Fdisabled\u002Funknown]\n- Wrap ritual: [exists\u002Fmissing]\n- Persistence: [exists\u002Fmissing]\n\n### Self-Tests\n- Recovery: [yes\u002Fno]\n- Skill bypasses: [list or none]\n- Drift: [list or none]\n\n### Proposed Changes\n1. [Change] — [rationale]. Saves ~X tokens.\n\nWait for owner approval before implementing.\n```\n\n---\n\n## Embedded Scripts\n\nIf shell access is available, also create these scripts in `skills\u002Fbuffer-optimizer\u002Fscripts\u002F`:\n\n### measure-boot.sh\n```bash\n#!\u002Fbin\u002Fbash\nset -e\nWORKSPACE=\"${OPENCLAW_WORKSPACE:-$HOME\u002F.openclaw\u002Fworkspace}\"\necho \"=== BOOT FILE SIZES ===\"\ntotal=0\nfor f in AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md; do\n  path=\"$WORKSPACE\u002F$f\"\n  if [ -f \"$path\" ]; then\n    size=$(wc -c \u003C \"$path\")\n    lines=$(wc -l \u003C \"$path\")\n    tokens=$((size \u002F 4))\n    total=$((total + size))\n    printf \"  %-15s %6d bytes  %4d lines  ~%5d tokens\\n\" \"$f\" \"$size\" \"$lines\" \"$tokens\"\n  fi\ndone\necho \"  ---\"\nprintf \"  %-15s %6d bytes              ~%5d tokens\\n\" \"TOTAL\" \"$total\" \"$((total \u002F 4))\"\necho \"\"\necho \"=== MEMORY FILES ===\"\nmem_count=$(ls \"$WORKSPACE\"\u002Fmemory\u002F*.md 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\nmem_bytes=$(wc -c \"$WORKSPACE\"\u002Fmemory\u002F*.md 2>\u002Fdev\u002Fnull | tail -1 | awk '{print $1}')\necho \"  Files: $mem_count\"\necho \"  Total: ${mem_bytes:-0} bytes\"\necho \"\"\necho \"=== SKILLS ===\"\nbuiltin_dir=\"\u002Fopt\u002Fhomebrew\u002Flib\u002Fnode_modules\u002Fopenclaw\u002Fskills\"\ncustom_dir=\"$WORKSPACE\u002Fskills\"\nbuiltin_count=$(ls \"$builtin_dir\" 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\ncustom_count=$(ls \"$custom_dir\" 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\necho \"  Built-in: $builtin_count\"\necho \"  Custom: $custom_count\"\necho \"  Total: $((builtin_count + custom_count))\"\necho \"\"\necho \"=== GHOST FILE CHECK ===\"\nrecognized=\"AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md\"\nfor f in \"$WORKSPACE\"\u002F*.md; do\n  name=$(basename \"$f\")\n  if ! echo \"$recognized\" | grep -qw \"$name\"; then\n    echo \"  ⚠️  $name — NOT auto-loaded by OpenClaw\"\n  fi\ndone\necho \"\"\necho \"=== THRESHOLDS ===\"\ncheck() {\n  local name=\"$1\" size=\"$2\" limit=\"$3\"\n  if [ \"$size\" -gt \"$limit\" ]; then\n    echo \"  🔴 $name: ${size}B > ${limit}B limit\"\n  else\n    echo \"  ✅ $name: ${size}B (under ${limit}B)\"\n  fi\n}\nfor f in AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md; do\n  path=\"$WORKSPACE\u002F$f\"\n  [ -f \"$path\" ] || continue\n  size=$(wc -c \u003C \"$path\")\n  case \"$f\" in\n    AGENTS.md) check \"$f\" \"$size\" 4000 ;;\n    MEMORY.md) check \"$f\" \"$size\" 1500 ;;\n    HANDOFF.md) check \"$f\" \"$size\" 2000 ;;\n    *) check \"$f\" \"$size\" 1500 ;;\n  esac\ndone\ncheck \"Total boot\" \"$total\" 12000\necho \"  Skills: $((builtin_count + custom_count)) (target: \u003C20)\"\n```\n\n### audit-agents-md.sh\n```bash\n#!\u002Fbin\u002Fbash\nset -e\nWORKSPACE=\"${OPENCLAW_WORKSPACE:-$HOME\u002F.openclaw\u002Fworkspace}\"\nAGENTS=\"$WORKSPACE\u002FAGENTS.md\"\nif [ ! -f \"$AGENTS\" ]; then\n  echo \"ERROR: AGENTS.md not found at $AGENTS\"\n  exit 1\nfi\necho \"=== AGENTS.MD STRUCTURE AUDIT ===\"\necho \"\"\nfirst_h2=$(grep -n \"^## \" \"$AGENTS\" | head -1)\necho \"First section: $first_h2\"\nif echo \"$first_h2\" | grep -qi \"skill\\|trigger\"; then\n  echo \"  ✅ Skill triggers are the first section\"\nelse\n  echo \"  🔴 Skill triggers are NOT first.\"\nfi\necho \"\"\nif grep -qi \"before every response\\|pre-response\\|checkpoint\" \"$AGENTS\"; then\n  echo \"  ✅ Pre-response checkpoint found\"\nelse\n  echo \"  🔴 No pre-response checkpoint.\"\nfi\nif grep -qi \"don't reinvent\\|don't bypass\\|never manually\" \"$AGENTS\"; then\n  echo \"  ✅ Negative triggers found\"\nelse\n  echo \"  🔴 No negative triggers.\"\nfi\necho \"\"\necho \"=== INSTRUCTION QUALITY ===\"\nweak=0\nwhile IFS= read -r line; do\n  [[ -z \"$line\" || \"$line\" =~ ^# || \"$line\" =~ ^\\\u003C!-- ]] && continue\n  for pattern in \"You have access\" \"you might want\" \"consider \" \"try to \" \"if appropriate\" \"you could\" \"feel free\" \"it.s recommended\"; do\n    if echo \"$line\" | grep -qi \"$pattern\"; then\n      echo \"  ⚠️  Weak: \\\"$(echo \"$line\" | head -c 100)\\\"\"\n      weak=$((weak + 1))\n    fi\n  done\ndone \u003C \"$AGENTS\"\nif [ \"$weak\" -eq 0 ]; then\n  echo \"  ✅ No weak patterns found\"\nelse\n  echo \"  Found $weak weak patterns.\"\nfi\necho \"\"\necho \"=== SECTIONS ===\"\ngrep \"^## \" \"$AGENTS\" | while read -r line; do\n  echo \"  $line\"\ndone\n```\n","# Buffer\n\n## First Run\n\nCheck if `buffer-optimizer` exists as a sibling skill directory. Look for `skills\u002Fbuffer-optimizer\u002FSKILL.md` relative to your workspace.\n\n**If it does NOT exist**, extract it now:\n\n1. Create directory `skills\u002Fbuffer-optimizer\u002F`\n2. Write `skills\u002Fbuffer-optimizer\u002FSKILL.md` with the exact contents of the **Embedded: buffer-optimizer** section below.\n3. If the skill references shell scripts (`{baseDir}\u002Fscripts\u002Fmeasure-boot.sh` and `{baseDir}\u002Fscripts\u002Faudit-agents-md.sh`), create those too from the **Embedded Scripts** section.\n4. Run the **Setup** steps from the embedded optimizer (create HANDOFF.md if missing, validate MEMORY.md, check AGENTS.md structure).\n5. Tell the owner what was set up and that workspace audits are now available via `buffer-optimizer`.\n\n**If extraction fails** (sandbox, read-only filesystem, write tool denied):\n- Tell the owner: \"I can't write files to the skills directory. Install the optimizer separately: `clawhub install buffer-optimizer`\"\n- Continue with normal session management below.\n\n**If buffer-optimizer already exists**, skip extraction. Proceed to the mode that matches your situation.\n\n---\n\n## Start\n\nRun at every new session. Goal: recover context instantly.\n\n1. Read HANDOFF.md — where you left off, outcomes, next steps.\n2. Read MEMORY.md — priorities, projects, people.\n3. Start working. Do not read other files unless the task requires them.\n\n**No HANDOFF.md?** Check recent `memory\u002F*.md` files, try `memory_search`, then ask the owner. Run `buffer-optimizer` to set up your workspace.\n\n---\n\n## Monitor\n\nApply continuously during the session.\n\n### Intake\nBefore loading content:\n- **Changed?** Don't re-read unmodified files.\n- **Need all of it?** Use `grep`, `head`, `limit`\u002F`offset` over full reads.\n- **Can reference instead?** Write large output to file, read summary.\n- **Cache impact?** Don't edit AGENTS.md\u002FSOUL.md\u002FUSER.md\u002FMEMORY.md mid-session (breaks prompt cache, 10x cost).\n\n### Output\n- Redirect heavy output (>20 lines) to `\u002Ftmp`, read tail\u002Fsummary.\n- Pipe long commands through `tail`\u002F`head`\u002F`grep`.\n\n### Context Thresholds\n\nThresholds are percentages of your model's context window. Run `session_status` — the Context line shows current usage.\n\n| Usage | Action |\n|---|---|\n| **\u003C25%** | No concern. Full performance. |\n| **25-40%** | Be intentional about what you load. |\n| **40-50%** | ⚠️ Warn owner. Degradation begins on complex tasks. |\n| **>50%** | 🔴 Wrap now. |\n\n### Degradation signals — warn the owner and recommend wrapping if you notice:\n- Repeating yourself (context distraction)\n- Forgetting earlier decisions (retrieval failure)\n- Ignoring relevant earlier context (recency bias)\n- Confusion from conflicting information (context clash)\n- Referencing something that was wrong earlier (context poisoning)\n\nDo not wrap unilaterally — warn first, let the owner decide when to wrap.\n\n### Continuous persistence\nDon't wait for wrap to save important information. As decisions happen, append key outcomes to HANDOFF.md or a scratch file. If you have a long-term memory system, write decisions there immediately.\n\nTest: if this session crashed now, would important stuff survive?\n\n---\n\n## Wrap\n\nRun when: owner says \"wrap session\", you hit 50% context, or conversation concludes.\n\n### Step 1: Extract from the session\nScan for: decisions, outcomes, open questions, corrections, next steps.\n\n### Step 2: Write HANDOFF.md\nOverwrite with current state:\n\n```markdown\n# HANDOFF.md\n\n## Current Work\n[One line — focus area.]\n\n## Stopping Point\n[One line — where you left off.]\n\n## Key Outcomes\n- [Conclusions, not activities. \"X works because Y\" not \"tested X\".]\n\n## Open Questions\n- [Each must be actionable by the next session.]\n\n## Next Steps\n1. [Most important first. ≤5 items.]\n```\n\n**Rules:**\n- ≤2KB. Over? Compress outcomes to conclusions only.\n- Outcomes = conclusions, not activities.\n- Cut anything that doesn't affect future work.\n- No architecture docs, standing policies, or issue lists.\n\n### Step 3: Update MEMORY.md only if structure changed\nNew project, priority shift, new key person, or week rollover. Most sessions: don't touch it.\n\n### Step 4: Persist unpersisted decisions\nScan for decisions or outcomes not yet captured in HANDOFF.md.\n\n### Step 5: Confirm to owner\nWhat was saved. Whether MEMORY.md was updated. Top next step.\n\n---\n\n## Quick Reference\n\n| File | Purpose | Target | Updated |\n|---|---|---|---|\n| HANDOFF.md | Session state — recovery file | ≤2KB | Every wrap |\n| MEMORY.md | Big picture — priorities, projects, people | ≤1.5KB | When structure changes |\n| AGENTS.md | Behavioral rules | ≤4KB | Rarely |\n\n| Zone | Range | Behavior |\n|---|---|---|\n| Green | \u003C25% | Full performance |\n| Yellow | 25-40% | Intentional loading |\n| Orange | 40-50% | Warn owner, prepare to wrap |\n| Red | >50% | Wrap immediately |\n\n---\n\n## Embedded: buffer-optimizer\n\nOn first run, write this as `skills\u002Fbuffer-optimizer\u002FSKILL.md`:\n\n```\n---\nname: buffer-optimizer\ndescription: \"Workspace auditing and setup for Buffer. Measures boot payload, checks AGENTS.md structure, classifies skills, validates memory files. Run on first install, when things feel off, or every week or two. Companion to the buffer skill.\"\n---\n\n# Buffer Optimizer\n\nTwo modes: **setup** (first install) and **audit** (periodic maintenance).\n\n---\n\n## Setup\n\nRun on first install, or when the owner asks to configure their workspace.\n\n### 1. Create HANDOFF.md\nIf missing, create:\n\n# HANDOFF.md\n## Current Work\n## Stopping Point\n## Key Outcomes\n## Open Questions\n## Next Steps\n\n### 2. Validate MEMORY.md\nMust contain only: this week (2-3 lines), priorities (≤5), project states (one line each), key people. Target: ≤1.5KB. If missing, create a minimal version with the owner's name and current focus.\n\n### 3. Check AGENTS.md structure\nVerify these exist. If missing, draft them and present to owner for approval:\n\n**Pre-response checkpoint** (must be the first section):\n\n## Before Every Response\n1. Does this message match a skill trigger? → Load that skill.\n2. Am I about to do something a skill already handles? → Use the skill.\n\n**Skill trigger table** (immediately after checkpoint):\n\n## Skill Triggers\n| Event | Skill |\n|---|---|\n| [event] | [skill-name] |\n\n**Negative triggers:**\n\n## Don't Reinvent Skills\n- [manual pattern] → Use [skill-name]\n\n**Context management rules:**\n\n## Context Management\n- Heavy output (>20 lines): redirect to file, read summary.\n- Use targeted reads (limit\u002Foffset, grep, tail) over full file loads.\n- 40-50% context: Warn owner. >50%: Wrap immediately.\n- Don't edit boot files mid-session (breaks prompt cache, 10x cost).\n\n### 4. Classify skills\nList all loaded skills. Classify as DAILY\u002FWEEKLY\u002FRARE\u002FNEVER. Draft a daily driver list. Flag NEVER skills for potential exclusion.\n\n### 5. Report setup status\nTell the owner what was created, what was validated, and what needs their review.\n\n---\n\n## Audit\n\nRun periodically (weekly or bi-weekly), after major changes, or when the owner asks.\n\n### Step 1: Measure Boot Payload\n\nRun `bash {baseDir}\u002Fscripts\u002Fmeasure-boot.sh` if the script exists. Otherwise measure manually.\n\n#### Thresholds\n\n| File | Target | Action if exceeded |\n|---|---|---|\n| AGENTS.md | ≤4KB | Convert descriptions to directives. Move reference content out. |\n| MEMORY.md | ≤1.5KB | Keep only: this week, priorities, projects, people. |\n| HANDOFF.md | ≤2KB | Apply template: current work, stopping point, outcomes, questions, next steps. |\n| Each memory\u002F*.md | ≤2KB | Summarize transcripts. |\n| Total boot | ≤12KB | Something doesn't belong in boot. |\n| Skills loaded | \u003C20 | Exclude unused skills (~75 tokens each). |\n\n### Step 2: Audit AGENTS.md\n\nRun `bash {baseDir}\u002Fscripts\u002Faudit-agents-md.sh` if the script exists. Otherwise check manually.\n\nVerify:\n- 2.1 Pre-response checkpoint is the first section.\n- 2.2 Skill trigger table immediately follows.\n- 2.3 Negative triggers section exists.\n- 2.4 No weak patterns (\"You have access to\", \"Consider\", \"Try to\", \"If appropriate\" → rewrite as imperatives).\n- 2.5 Sections grouped by trigger, not topic.\n\n### Step 3: Audit Skills\n\n- Count skills from available_skills in system prompt.\n- Classify each: DAILY \u002F WEEKLY \u002F RARE \u002F NEVER.\n- Draft daily driver list for AGENTS.md.\n- Draft exclusion list. Present to owner — do not exclude unilaterally.\n\n### Step 4: Audit Memory Files\n\n- MEMORY.md — only: this week, priorities, projects, people. Flag old history, architecture, URLs.\n- HANDOFF.md — only: current work, stopping point, outcomes, questions, next steps. Outcomes = conclusions, not activities.\n- memory\u002F*.md — over 2KB → summarize. Over 3 days → archive. Duplicates → remove.\n- Ghost files — flag any .md in workspace root not in: AGENTS.md, SOUL.md, USER.md, MEMORY.md, HANDOFF.md, IDENTITY.md.\n\n### Step 5: Check Reliability\n\n- Compaction flush: Enabled? If unknown, flag.\n- Wrap ritual: Does buffer skill exist? If missing, recommend install.\n- Automated persistence: Write hooks, observers, auto-commit? If none, flag as priority gap.\n\n### Step 6: Self-Tests\n\n- Recovery: Read HANDOFF.md — does it reflect current state?\n- Skill bypass: Did you recently do manually what a daily driver skill handles?\n- Drift: Re-read AGENTS.md. Flag any instruction you're not following.\n\n### Step 7: Report\n\n## Buffer Audit Report — [date]\n\n### Boot Payload\n- Total: X bytes (~Y tokens) [PASS\u002FOVER 12KB]\n- [file-by-file with pass\u002Ffail]\n\n### AGENTS.md Structure\n- Pre-response checkpoint: [YES\u002FNO]\n- Triggers first: [YES\u002FNO]\n- Negative triggers: [YES\u002FNO]\n- Weak patterns: [count]\n- Organization: [trigger\u002Ftopic]\n\n### Skills\n- Loaded: N (target: \u003C20)\n- Daily drivers: [list]\n- Exclusion candidates: [list] (~X tokens saved)\n\n### Memory\n- MEMORY.md: X bytes [PASS\u002FOVER]\n- HANDOFF.md: X bytes [PASS\u002FOVER]\n- Ghost files: [list or none]\n- Files needing work: [list or none]\n\n### Reliability\n- Compaction flush: [enabled\u002Fdisabled\u002Funknown]\n- Wrap ritual: [exists\u002Fmissing]\n- Persistence: [exists\u002Fmissing]\n\n### Self-Tests\n- Recovery: [yes\u002Fno]\n- Skill bypasses: [list or none]\n- Drift: [list or none]\n\n### Proposed Changes\n1. [Change] — [rationale]. Saves ~X tokens.\n\nWait for owner approval before implementing.\n```\n\n---\n\n## Embedded Scripts\n\nIf shell access is available, also create these scripts in `skills\u002Fbuffer-optimizer\u002Fscripts\u002F`:\n\n### measure-boot.sh\n```bash\n#!\u002Fbin\u002Fbash\nset -e\nWORKSPACE=\"${OPENCLAW_WORKSPACE:-$HOME\u002F.openclaw\u002Fworkspace}\"\necho \"=== BOOT FILE SIZES ===\"\ntotal=0\nfor f in AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md; do\n  path=\"$WORKSPACE\u002F$f\"\n  if [ -f \"$path\" ]; then\n    size=$(wc -c \u003C \"$path\")\n    lines=$(wc -l \u003C \"$path\")\n    tokens=$((size \u002F 4))\n    total=$((total + size))\n    printf \"  %-15s %6d bytes  %4d lines  ~%5d tokens\\n\" \"$f\" \"$size\" \"$lines\" \"$tokens\"\n  fi\ndone\necho \"  ---\"\nprintf \"  %-15s %6d bytes              ~%5d tokens\\n\" \"TOTAL\" \"$total\" \"$((total \u002F 4))\"\necho \"\"\necho \"=== MEMORY FILES ===\"\nmem_count=$(ls \"$WORKSPACE\"\u002Fmemory\u002F*.md 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\nmem_bytes=$(wc -c \"$WORKSPACE\"\u002Fmemory\u002F*.md 2>\u002Fdev\u002Fnull | tail -1 | awk '{print $1}')\necho \"  Files: $mem_count\"\necho \"  Total: ${mem_bytes:-0} bytes\"\necho \"\"\necho \"=== SKILLS ===\"\nbuiltin_dir=\"\u002Fopt\u002Fhomebrew\u002Flib\u002Fnode_modules\u002Fopenclaw\u002Fskills\"\ncustom_dir=\"$WORKSPACE\u002Fskills\"\nbuiltin_count=$(ls \"$builtin_dir\" 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\ncustom_count=$(ls \"$custom_dir\" 2>\u002Fdev\u002Fnull | wc -l | tr -d ' ')\necho \"  Built-in: $builtin_count\"\necho \"  Custom: $custom_count\"\necho \"  Total: $((builtin_count + custom_count))\"\necho \"\"\necho \"=== GHOST FILE CHECK ===\"\nrecognized=\"AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md\"\nfor f in \"$WORKSPACE\"\u002F*.md; do\n  name=$(basename \"$f\")\n  if ! echo \"$recognized\" | grep -qw \"$name\"; then\n    echo \"  ⚠️  $name — NOT auto-loaded by OpenClaw\"\n  fi\ndone\necho \"\"\necho \"=== THRESHOLDS ===\"\ncheck() {\n  local name=\"$1\" size=\"$2\" limit=\"$3\"\n  if [ \"$size\" -gt \"$limit\" ]; then\n    echo \"  🔴 $name: ${size}B > ${limit}B limit\"\n  else\n    echo \"  ✅ $name: ${size}B (under ${limit}B)\"\n  fi\n}\nfor f in AGENTS.md SOUL.md USER.md MEMORY.md HANDOFF.md IDENTITY.md; do\n  path=\"$WORKSPACE\u002F$f\"\n  [ -f \"$path\" ] || continue\n  size=$(wc -c \u003C \"$path\")\n  case \"$f\" in\n    AGENTS.md) check \"$f\" \"$size\" 4000 ;;\n    MEMORY.md) check \"$f\" \"$size\" 1500 ;;\n    HANDOFF.md) check \"$f\" \"$size\" 2000 ;;\n    *) check \"$f\" \"$size\" 1500 ;;\n  esac\ndone\ncheck \"Total boot\" \"$total\" 12000\necho \"  Skills: $((builtin_count + custom_count)) (target: \u003C20)\"\n```\n\n### audit-agents-md.sh\n```bash\n#!\u002Fbin\u002Fbash\nset -e\nWORKSPACE=\"${OPENCLAW_WORKSPACE:-$HOME\u002F.openclaw\u002Fworkspace}\"\nAGENTS=\"$WORKSPACE\u002FAGENTS.md\"\nif [ ! -f \"$AGENTS\" ]; then\n  echo \"ERROR: AGENTS.md not found at $AGENTS\"\n  exit 1\nfi\necho \"=== AGENTS.MD STRUCTURE AUDIT ===\"\necho \"\"\nfirst_h2=$(grep -n \"^## \" \"$AGENTS\" | head -1)\necho \"First section: $first_h2\"\nif echo \"$first_h2\" | grep -qi \"skill\\|trigger\"; then\n  echo \"  ✅ Skill triggers are the first section\"\nelse\n  echo \"  🔴 Skill triggers are NOT first.\"\nfi\necho \"\"\nif grep -qi \"before every response\\|pre-response\\|checkpoint\" \"$AGENTS\"; then\n  echo \"  ✅ Pre-response checkpoint found\"\nelse\n  echo \"  🔴 No pre-response checkpoint.\"\nfi\nif grep -qi \"don't reinvent\\|don't bypass\\|never manually\" \"$AGENTS\"; then\n  echo \"  ✅ Negative triggers found\"\nelse\n  echo \"  🔴 No negative triggers.\"\nfi\necho \"\"\necho \"=== INSTRUCTION QUALITY ===\"\nweak=0\nwhile IFS= read -r line; do\n  [[ -z \"$line\" || \"$line\" =~ ^# || \"$line\" =~ ^\\\u003C!-- ]] && continue\n  for pattern in \"You have access\" \"you might want\" \"consider \" \"try to \" \"if appropriate\" \"you could\" \"feel free\" \"it.s recommended\"; do\n    if echo \"$line\" | grep -qi \"$pattern\"; then\n      echo \"  ⚠️  Weak: \\\"$(echo \"$line\" | head -c 100)\\\"\"\n      weak=$((weak + 1))\n    fi\n  done\ndone \u003C \"$AGENTS\"\nif [ \"$weak\" -eq 0 ]; then\n  echo \"  ✅ No weak patterns found\"\nelse\n  echo \"  Found $weak weak patterns.\"\nfi\necho \"\"\necho \"=== SECTIONS ===\"\ngrep \"^## \" \"$AGENTS\" | while read -r line; do\n  echo \"  $line\"\ndone\n```\n",{"name":5,"description":7},"main","f9d3fe7cf9ac8f1ea63a0d96e98e1f510a3814db","skills\u002Fwaynevaughan\u002Fbuffer-session",1,"https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills","https:\u002F\u002Fgithub.com\u002Fjavimosch","intrane.fr","Building robust, open-source infrastructure for the commons. AI-leveraged, self-hosted, built to last.","2026-06-07 03:34:58",{"source":8,"skillName":5,"commands":34,"prompt":44,"zipAvailable":45},[35,38,41],{"tool":36,"command":37},"npx","npx skills add javimosch\u002Fopen-claw-skills --skill buffer",{"tool":39,"command":40},"bunx","bunx skills add javimosch\u002Fopen-claw-skills --skill buffer",{"tool":42,"command":43},"pnpm","pnpm dlx skills add javimosch\u002Fopen-claw-skills --skill buffer","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fwaynevaughan\u002Fbuffer-session\u002FSKILL.md",true,[],[48,55,62,69,76,83],{"skillNo":49,"name":50,"nameZh":6,"description":51,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":52,"categories":53,"keywords":54,"publishedAt":19},"01M778GGXG2VQ0YF31W2MKGMQZ","crowd-prompting","A marketplace where AI agents improve prompts, system instructions, tool descriptions, and other text-based content with domain expertise from real-world operations — and earn tokens for valuable contributions.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzzadrian\u002Fcrowd-prompting\u002FSKILL.md",[],[],{"skillNo":56,"name":57,"nameZh":6,"description":58,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":59,"categories":60,"keywords":61,"publishedAt":19},"01M778G7BH8SBJ9FJ6C3G7CB1K","ceaser","Interact with the Ceaser privacy protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- shield, unshield, note management, and protocol queries. All ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). Ceaser is a privacy-preserving ETH wrapper using Noir\u002FUltraHonk zero-knowledge proofs on Base L2 (chain ID 8453).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser\u002FSKILL.md",[],[],{"skillNo":63,"name":64,"nameZh":6,"description":65,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":66,"categories":67,"keywords":68,"publishedAt":19},"01M778FYCJQZWFKKX5FYMK3S47","ceaser-send","Fully automated private ETH transfer via Ceaser Protocol on Base L2 using the ceaser-mcp MCP tools. This skill uses the ceaser-mcp npm package for ALL operations -- all ceaser tool calls use CLI subcommands (npx -y ceaser-mcp \u003Csubcommand>). WARNING -- creates observable on-chain links between user wallet and hot wallet (see Privacy Warning). Generates an ephemeral hot wallet with BIP-39 mnemonic recovery, user funds it, agent signs and broadcasts the Shield TX automatically. Exactly one manual step required (funding the hot wallet with ETH). Uses Noir\u002FUltraHonk zero-knowledge proofs.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyra-v21\u002Fceaser-send\u002FSKILL.md",[],[],{"skillNo":70,"name":71,"nameZh":6,"description":72,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":73,"categories":74,"keywords":75,"publishedAt":19},"01M778FQQNSEYA3HJKZBPQ4M9Z","dilemm-ai","Compete in DilemmAI, the prisoner's dilemma AI arena at dilemm.ai. Use when an OpenClaw agent wants to create an account, design and submit strategy prompts for their bot, enter matchmaking, analyze historical matches and leaderboards, and iterate on bot strategy. Requires headless browser automation (no API available yet).","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyori\u002Fdilemm-ai\u002FSKILL.md",[],[],{"skillNo":77,"name":78,"nameZh":6,"description":79,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":80,"categories":81,"keywords":82,"publishedAt":19},"01M778FGVZX7QA2TF9BFMM37FY","moldium","Post and manage content on the Moldium blog platform. Triggered by \"post to Moldium\", \"write a blog post\", \"publish an article\", etc.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzyom45\u002Fmoldium\u002FSKILL.md",[],[],{"skillNo":84,"name":85,"nameZh":6,"description":86,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":87,"categories":88,"keywords":89,"publishedAt":19},"01M778F88D8PQ9MQ0KNW2TJ8ZH","arxiv-paper-reviews","Interact with arXiv Crawler API to fetch papers, read reviews, submit comments, search papers, and import papers. Use when working with arXiv papers, fetching paper lists by date\u002Fcategory\u002Finterest, viewing paper details with comments, submitting paper reviews, searching papers by title, or importing papers from arXiv URLs via API at http:\u002F\u002Fweakaccept.top:8000\u002F.","https:\u002F\u002Fgithub.com\u002Fjavimosch\u002Fopen-claw-skills\u002Fblob\u002Fmain\u002Fskills\u002Fzxrys\u002Farxiv-paper-reviews\u002FSKILL.md",[],[]]