← 返回
AI智能

agent resilience

Agent resilience patterns for surviving context loss, capturing critical details, and self-improvement. Use when: starting complex/long sessions, asked to 'r...
智能体韧性模式:应对上下文丢失、捕获关键细节与自我改进。使用时机:开始复杂/长会话时,被要求...
xinian5216
AI智能 clawhub v1.0.0 1 版本 100000 Key: 无需
★ 0
Stars
📥 547
下载
💾 15
安装
1
版本
#latest

概述

Agent Resilience

Patterns for surviving context loss, capturing corrections, and continuously improving.

WAL Protocol (Write-Ahead Logging)

The Law: Chat history is a buffer, not storage. Files survive; context doesn't.

Trigger — scan every message for:

  • ✏️ Corrections — "It's X, not Y" / "Actually..." / "No, I meant..."
  • 📍 Proper nouns — names, places, companies, products
  • 🎨 Preferences — styles, approaches, "I like/don't like"
  • 📋 Decisions — "Let's do X" / "Go with Y"
  • 🔢 Specific values — numbers, dates, IDs, URLs

If any appear:

  1. WRITE FIRST → update memory/SESSION-STATE.md
  2. THEN respond

The urge to respond is the enemy. Write before replying.

SESSION-STATE.md

Active working memory for the current task. Create at memory/SESSION-STATE.md:

# Session State
**Task:** [what we're working on]
**Key decisions:** [decisions made]
**Details:** [corrections, names, values captured via WAL]
**Next step:** [what happens next]

Reset when starting a new unrelated task.

Working Buffer (Danger Zone)

When context reaches ~60%, start logging every exchange to memory/working-buffer.md:

# Working Buffer
**Status:** ACTIVE — started [timestamp]

## [time] Human
[their message]

## [time] Agent
[1-2 sentence summary + key details]

Clear the buffer at the START of the next 60% threshold (not continuously).

Compaction Recovery

Auto-trigger when session starts with a summary tag, or human says "where were we?":

  1. Read memory/working-buffer.md — raw danger-zone exchanges
  2. Read memory/SESSION-STATE.md — active task state
  3. Read today's + yesterday's daily notes
  4. Extract key context back into SESSION-STATE.md
  5. Respond: "Recovered from buffer. Last task was X. Continue?"

Never ask "what were we discussing?" — read the buffer first.

Verify Before Reporting

Before saying "done", "complete", "finished":

  1. STOP
  2. Actually test from the user's perspective
  3. Verify the outcome, not just that code exists
  4. Only THEN report complete

Text changes ≠ behavior changes. When changing how something works, identify the architectural component and change the actual mechanism.

Relentless Resourcefulness

Try 10 approaches before asking for help or saying "can't":

  • Different CLI flags, tool, API endpoint
  • Check memory: "Have I done this before?"
  • Spawn a research sub-agent
  • Grep logs for past successes

"Can't" = exhausted all options. Not "first try failed."

Self-Improvement Guardrails

When updating behavior/config based on a lesson:

Score the change first (skip if < 50 weighted points):

  • High frequency (daily use?) → 3×
  • Reduces failures → 3×
  • Saves user effort → 2×
  • Saves future-agent tokens/time → 2×

Ask: "Does this let future-me solve more problems with less cost?" If no, skip it.

Forbidden: complexity for its own sake, changes you can't verify worked, vague justifications.

Quick Start Checklist

For long/complex tasks:

  • [ ] Create memory/SESSION-STATE.md with task + context
  • [ ] Apply WAL: write corrections/decisions before responding
  • [ ] At ~60% context: start working buffer
  • [ ] After any compaction: read buffer before asking questions
  • [ ] Before reporting done: verify actual outcome

版本历史

共 1 个版本

  • v1.0.0 当前
    2026-03-19 15:51 安全 安全

安全检测

腾讯云安全 (Keen)

安全,无风险
查看报告

腾讯云安全 (Sanbu)

安全,无风险
查看报告

🔗 相关推荐

communication-collaboration

wechat mp draft

xinian5216
代写微信公众号文章并保存到公众号草稿箱。使用场景:用户需要撰写公众号文章并直接发布到微信公众号后台草稿箱。触发词:"写公众号文章"、"保存到公众号草稿"、"微信文章"、"公众号发文"。
★ 0 📥 751
ai-intelligence

self-improving agent

pskoett
捕获经验教训、错误和纠正,以实现持续改进。使用时机:(1)命令或操作意外失败;(2)用户纠正……
★ 4,058 📥 797,720
ai-intelligence

Self-Improving + Proactive Agent

ivangdavila
自我反思+自我批评+自我学习+自组织记忆。智能体评估自身工作、发现错误并持续改进。
★ 1,353 📥 317,937