Xpersona
B

Battle-Tested Agent

CLAWHUB · Unverified

19 production-hardened patterns for AI agents — memory, verification, ambiguity handling, compaction survival, delegation, proof-based handoffs, stale-worker... Skill: Battle-Tested Agent Owner: zurbrick Summary: 19 production-hardened patterns for AI agents — memory, verification, ambiguity handling, compaction survival, delegation, proof-based handoffs, stale-worker... Tags: battle-tested:1.0.2, compaction:1.0.2, delegation:1.0.2, heartbeat:1.0.2, latest:1.5.0, memory:1.0.2, multi-agent:1.0.2, production:1.0.2, reliability:1.0.2, security:1.0.2, self-improvement:1.0.2 Vers

62
Rank
84
Safety
1.4k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.4K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17644fr465554b2j12pdyaxrh83ekff:battle-tested-agent
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-zurbrick-battle-tested-agent/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

148,836 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: battle-tested-agent
version: 1.5.0
description: >
 19 production-hardened patterns for AI agents — memory, verification, ambiguity
 handling, compaction survival, delegation, proof-based handoffs, stale-worker recovery,
 and self-improvement. Use when hardening an agent for production reliability, when an
 agent keeps hallucinating or losing context, when handoffs between agents drop details,
 when delegated work silently fails, or when someone says "my agent is unreliable" or
 "how do I make this more robust." Works with OpenClaw, Claude Code, Cowork, or any
 SKILL.md-based agent setup. Includes the Isolated Agent Fabrication Guard plus new
 delegation hardening patterns for brief quality, completion contracts, acceptance gates,
 silent-worker recovery, and scoped verifier use.
author: Zye ⚡ (Don Zurbrick)
license: MIT
tags: [production, reliability, memory, compaction, multi-agent, security, self-improvement, heartbeat, delegation, battle-tested]
homepage: https://github.com/zurbrick/battle-tested-agent
metadata:
  openclaw:
    emoji: "⚔️"
    requires:
      bins: ["bash", "grep", "find", "wc"]
      optionalBins: ["openclaw"]
---

# Battle-Tested Agent

**19 production-hardened patterns for AI agents. Every one earned from failure.**

Use this skill when you are:
- hardening an agent that will run repeatedly or autonomously
- tightening memory, verification, or anti-hallucination behavior
- reducing compaction failures, weak handoffs, or orchestration drift
- reviewing an agent workspace for missing production patterns
- debugging why an agent keeps losing context, guessing, or dropping work

Do not use this skill for:
- persona writing or onboarding polish
- one-off prompt tweaks with no reusable pattern behind them
- adding new tools, servers, or runtime capabilities
- turning a simple workspace into process theater

## Default workflow

1. **Audit first**
   Run `bash scripts/audit.sh <workspace>` to see which patterns are present.
   The script checks for all 16 patterns and tells you what to fix first.

2. **Start with the smallest tier that fits**
   Implement starter patterns first, then intermediate, then advanced.
   Do not cargo-cult every pattern into every agent.

3. **Patch the actual failure mode**
   Change the mechanism, not just the wording. "ALWAYS check X" is not a fix —
   a verification gate is a fix.

4. **Keep patterns lightweight**
   Add only the pieces that materially reduce failures or operator burden.

## Pattern tiers

- **Starter (5):** baseline reliability for almost every agent
- **Intermediate (5):** daily-driver patterns for briefs, heartbeats, and recurring work
- **Advanced (6):** multi-agent orchestration, handoffs, and self-improvement discipline

### Pattern clusters

Some patterns reinforce each other naturally. Adopt them together when the failure
mode calls for it:

- **Trust chain:** WAL Protocol + Anti-Hallucination + Agent Verification — ensures
  data is captured, sourced, and measured 

_meta.json

{
  "ownerId": "kn7djv795e64dqrtm8trp0wmnx822a1d",
  "slug": "battle-tested-agent",
  "version": "1.5.0",
  "publishedAt": 1774727080622
}

references/advanced-patterns.md

# Advanced Patterns

These patterns are for agents that orchestrate other agents, survive long sessions, and improve from repeated failures without turning into a governance cosplay rig.

## 11. Multi-Agent Delegation

**Failure mode:** One agent tries to code, research, audit, draft, and coordinate everything in a single context window.

**Pattern:** Spawn specialists when the work earns it.

```markdown
### Delegation Rules
- 50+ lines of code or 3+ files? Spawn a coding agent
- Research needing web crawling? Spawn a research agent
- Write detailed specs — sub-agents don't see the conversation
- One task per agent. Review before delivering.
- KEEP TALKING to the human while agents work
```

## 12. Brief Quality Gate

**Failure mode:** A worker gets a vague task, improvises the deliverable, and the mismatch is only discovered at the end.

**Pattern:** Before delegation, define the work sharply enough that completion is testable.

```markdown
### Brief Quality Gate
Before spawning a worker, the brief must define:
1. **Deliverable** — what exact thing is being produced
2. **Artifact** — what file/output/proof object should exist at the end
3. **Verification** — how the result will be checked
4. **Success definition** — what must be true before it counts as done

If any are missing, stop and tighten the brief.
```

## 13. Completion Contract

**Failure mode:** A sub-agent finishes with "done" and leaves the orchestrator to reverse-engineer the actual work.

**Pattern:** Every delegated completion must include proof, not vibes.

```markdown
### Completion Contract
Every delegated completion must include:
1. **What was done** — summary of changes/output
2. **Where artifacts are** — exact file paths
3. **Exact commands run** — no hand-waving
4. **Verification performed** — what was checked and result
5. **Known gaps / what's next** — anything incomplete or risky

Bad: "Done, check the files."
Good: "Built auth at /workspace/scripts/auth.sh. Ran `bash auth.sh test`.
       Test passed. No retry logic yet. Next: main agent reviews and delivers."
```

## 14. Acceptance Gate + Fail-Closed Rule

**Failure mode:** The worker self-certifies success. Artifact missing or unverifiable. Cleanup falls back to the orchestrator.

**Pattern:** Delegated work is not done until the parent verifies it.

```markdown
### Acceptance Gate
Before treating delegated work as done, verify:
1. expected artifact exists
2. artifact matches the brief
3. commands actually ran
4. verification actually happened
5. result is non-empty and specific
6. known gaps are named

### Fail-Closed Rule
If the result is empty, artifact-free, vague, or self-certifying without proof:
- NOT done
- mark `Revision Needed`, `Blocked`, or `Failed`
- never report completion upstream
```

## 15. Orchestrator Doesn't Build

**Failure mode:** The orchestrator starts "just quickly" doing implementation work and loses oversight of active threads.

**Pattern:** If the task is real build work, delegate it.

``

references/audit-usage.md

# Audit Usage

## Run the audit

```bash
bash scripts/audit.sh ~/workspace
```

Or point it at any workspace:

```bash
bash scripts/audit.sh /path/to/workspace
```

The script checks for all **19** patterns and prints:
- what is present
- what is missing
- a total score
- the first missing pattern to address next

## Suggested rollout order

1. Fix missing **starter** patterns first
2. Add **intermediate** patterns for recurring operational work
3. Add **advanced** patterns only when the workspace actually orchestrates other agents or needs recurrence tracking

## Optional bootstrap snippets

If starting from scratch, copy the included assets into a workspace and then merge or customize them deliberately:

```bash
cp assets/AGENTS-additions.md ~/workspace/   # Review and merge into AGENTS.md
cp assets/QA-gates.md ~/workspace/QA.md
mkdir -p ~/workspace/.learnings
cp assets/learnings-template.md ~/workspace/.learnings/LEARNINGS.md
cp assets/errors-template.md ~/workspace/.learnings/ERRORS.md
cp assets/features-template.md ~/workspace/.learnings/FEATURE_REQUESTS.md
```

## What good looks like

- `SKILL.md` stays lean and discoverable
- the audit script remains the fast entrypoint
- detailed pattern content lives in `references/`
- assets stay optional and reusable
- teams implement only the patterns they actually need

## Notes

- This skill is not an onboarding wizard or persona pack
- Do not cargo-cult every pattern into every agent
- The point is fewer production failures, not more ceremony

references/intermediate-patterns.md

# Intermediate Patterns

These patterns harden an agent that already has the basics and now needs to survive recurring operational use.

## 6. Agent Verification Rules

**Failure mode:** The agent reports numbers that were never actually measured.

**Pattern:** No command, no number.

```markdown
### Verification Rule
For every metric you report, include the command you ran.
No command = no number. Never estimate from memory.

✅ "Disk: 868 MB (`du -sh ~/.openclaw | cut -f1`)"
❌ "Disk: ~800 MB"
```

## 7. Working Buffer (Compaction Survival)

**Failure mode:** A long session compacts and the last stretch of important context disappears.

**Pattern:** Use a small buffer file that survives compaction.

```markdown
## Create: memory/working-buffer.md
# Working Buffer — Status: INACTIVE

## Add to SOUL.md:
### Working Buffer
When context is getting long:
1. Append key exchanges to memory/working-buffer.md
2. After compaction: read buffer FIRST, extract context, then clear
```

Suggested thresholds:

| Context % | Action |
|-----------|--------|
| < 70% | Normal |
| 70-84% | Activate buffer |
| 85-94% | Emergency checkpoint |
| 95%+ | Survival mode — save essentials, suggest new session |

### How to estimate context usage

Most agent frameworks do not expose a precise "context %" meter. Practical proxies:
- **Message count:** If the conversation is 30+ exchanges deep, assume 70%+
- **Tool call count:** 15+ tool calls in a session usually means 60-80% context consumed
- **OpenClaw:** Check `/compact` status or compaction warnings in the session log
- **Claude Code:** The status bar shows token usage; watch for the yellow/red zone
- **Rule of thumb:** If you are thinking "this session is getting long" — activate the buffer.
  False positives are cheap; lost context is expensive.

## 8. QA Gates

**Failure mode:** A deliverable reaches a human with the wrong date, broken links, or leaked internal context.

**Pattern:** Match review intensity to output risk.

```markdown
### Gate 0: Verify mechanism changed, not just text
### Gate 1: Internal (workspace files) — auto-pass, lowest risk
### Gate 2: Human-facing (briefings, summaries)
  - Concise, structured, actionable, accurate, scannable in 30 sec
### Gate 3: External (emails, posts, client materials)
  - Gate 2 + recipient-appropriate tone, no internal context leaked,
    no private data, links verified, proofread
```

## 9. Decision Reasoning Logs

**Failure mode:** A non-obvious choice is made, then nobody knows why in the next session.

**Pattern:** Log reasoning when the choice matters.

```markdown
### 🧠 Decision: [what you decided]
- **Context:** [situation]
- **Options:** [what you considered]
- **Chose:** [what and why]
- **Rejected:** [what and why not]

Log when: escalating, choosing tools/agents, suppressing alerts, acting vs asking.
Skip: routine acks, obvious tool choices.
```

## 10. Verify Implementation, Not Intent

**Failure mode:** The agent changes wording and declares success, but th

Sponsored

Ads related to Battle-Tested Agent and adjacent AI workflows.