← Back to Skills Marketplace
xinian5216

agent resilience

by xinian5216 · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ⚠ suspicious
279
Downloads
0
Stars
1
Active Installs
1
Versions
Install in OpenClaw
/install agent-resilience
Description
Agent resilience patterns for surviving context loss, capturing critical details, and self-improvement. Use when: starting complex/long sessions, asked to 'r...
README (SKILL.md)

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 \x3C 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
Usage Guidance
This skill is internally coherent for 'durable memory' behavior but it will persist and read conversational content and may consult other notes/logs. Before installing or enabling it, decide where the memory files will live and who/what can read them. Recommended safeguards: - Restrict the memory directory to a controlled, access-restricted path (not a system or home directory with broad access). - Add filtering or redaction steps before writing to files to avoid storing secrets, credentials, or PII. - Clarify what 'today's + yesterday's daily notes' means in your environment or remove that step if you don't want the agent to scan other files. - Disable or review any 'spawn sub-agent' behavior; limit network access for spawned agents if possible. - Audit memory/working-buffer files regularly and set a retention policy (automatic expiry or manual review). If you cannot enforce those constraints in your agent runtime, treat this skill as higher risk and consider not enabling it.
Capability Analysis
Type: OpenClaw Skill Name: agent-resilience Version: 1.0.0 The skill bundle implements 'Agent Resilience' patterns designed to help an AI agent maintain state and recover from context loss. It uses a 'Write-Ahead Logging' (WAL) approach to store task details, corrections, and conversation history in local markdown files (e.g., memory/SESSION-STATE.md and memory/working-buffer.md). The instructions focus on improving reliability and self-correction without any evidence of data exfiltration, malicious execution, or harmful prompt injection.
Capability Assessment
Purpose & Capability
Name and description (agent resilience, WAL, working buffers, compaction) align with the instructions: writing session state, maintaining a working buffer, compaction/recovery, and verification steps. The files and protocols the SKILL.md defines are coherent with the stated purpose.
Instruction Scope
The runtime instructions tell the agent to write persistent files (memory/SESSION-STATE.md and memory/working-buffer.md) and to log every exchange when 'context reaches ~60%'. They also instruct reading 'today's + yesterday's daily notes', 'grep logs for past successes', and 'spawn a research sub-agent'. Those steps can cause the agent to read/write broader user files or logs and to create sub-agents that may access more resources. This increases the risk of capturing PII, secrets, or other sensitive data and of the agent accessing files outside a narrowly-scoped memory directory.
Install Mechanism
Instruction-only skill with no install spec and no code files. Nothing will be written to disk by an installer; only the agent's runtime behavior (file read/write) is relevant.
Credentials
The skill requests no environment variables or external credentials (proportionate). However, the SKILL.md implicitly expects access to local notes and logs (unspecified locations). That implicit file access is not declared in requires.env or config paths and may require or result in access to unrelated files.
Persistence & Privilege
The skill does not set always:true and requests no special platform privileges, but it explicitly instructs persistent storage of conversational content in memory/*.md. Persistent logging of interactions increases the blast radius (longer retention of captured data) and should be considered a privileged behavior even without explicit platform-level flags.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-resilience
  3. After installation, invoke the skill by name or use /agent-resilience
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release providing resilient patterns for agent memory and self-improvement: - Introduces Write-Ahead Logging (WAL) for capturing corrections, key decisions, and details before responding. - Specifies structure and use of `SESSION-STATE.md` as active task memory. - Details the working buffer protocol for handling potential context loss in long sessions. - Defines compaction and recovery steps to restore state from logs and buffers. - Includes guardrails for self-improvement and a checklist for session reliability.
Metadata
Slug agent-resilience
Version 1.0.0
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 1
Frequently Asked Questions

What is agent resilience?

Agent resilience patterns for surviving context loss, capturing critical details, and self-improvement. Use when: starting complex/long sessions, asked to 'r... It is an AI Agent Skill for Claude Code / OpenClaw, with 279 downloads so far.

How do I install agent resilience?

Run "/install agent-resilience" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is agent resilience free?

Yes, agent resilience is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does agent resilience support?

agent resilience is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created agent resilience?

It is built and maintained by xinian5216 (@xinian5216); the current version is v1.0.0.

💬 Comments