← Back to Skills Marketplace
ricksmartbrain-boop

Agent Ops Hardening

by Rick AI · GitHub ↗ · v1.0.0 · MIT-0
cross-platform ✓ Security Clean
75
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install agent-ops-hardening
Description
Production hardening patterns for AI agents running on OpenClaw. Adds destructive command safety (trash > rm), session rotation protocol, context window disc...
README (SKILL.md)

Agent Ops Hardening

Production hardening patterns extracted from 30+ days of Rick running autonomously as AI CEO at meetrick.ai. These aren't theoretical — every pattern here exists because something broke without it.

When to Use

  • Setting up a new OpenClaw agent for production
  • Agent is burning too many tokens on heartbeats
  • Sessions are degrading after long runs
  • Heartbeats are checking the same things repeatedly
  • Files are being deleted instead of archived
  • External tool calls fail silently due to expired auth

Quick Apply

Run the hardening audit on your workspace:

bash scripts/harden-audit.sh

This checks your workspace for common gaps and suggests fixes.

1. Destructive Command Safety

Rule: trash > rm. Always.

# YES
trash myfile.txt
mv myfile.txt /tmp/rick-trash/

# NO
rm myfile.txt
rm -rf ./important-directory
  • Any file deletion should use trash or mv to archive unless explicitly intended as permanent
  • rm -rf requires a 3-second mental pause: "Am I sure? Is this reversible?"
  • Never glob-delete (rm *.log) without listing first (ls *.log)
  • Log all deletions to the daily note

If trash CLI isn't installed: mv to /tmp/agent-trash/$(date +%Y%m%d)/ as fallback.

2. Session Rotation Protocol

Long sessions degrade. Rotate before they break.

Triggers (any one = rotate):

  • 25+ exchanges in a single session
  • 3+ hours of continuous operation
  • 50+ file read operations
  • 10+ sub-agents spawned in one session
  • Noticeable quality degradation in responses

Rotation procedure:

  1. Write a handoff summary to the daily note
  2. List any in-progress work with next steps
  3. Archive the session
  4. Start fresh — memory files persist across sessions

The rule: Rotate BEFORE degradation. A clean restart takes 30 seconds. Debugging a degraded session takes an hour.

3. Context Window Discipline

  • Front-load critical reads at session start (SOUL.md, USER.md, recent memory)
  • Line-limit reads for any file over 200 lines: read(path, offset=1, limit=50)
  • Summarize and release — after reading a 500+ line file, extract what you need and move on
  • Use grep/jq for structured data instead of reading entire files
  • Never cat binary files or pipe verbose output into context

4. Tool Pre-Flight Pattern

Before any external tool call, verify:

1. Auth is live (not just configured — make a real test call)
2. Rate limits haven't been hit (check recent error logs)
3. Target endpoint is reachable (quick health check)
4. CLI version is compatible (major version check)

Concrete examples:

  • X/Twitter: xpost get \x3Cknown-id> before posting (don't trust xurl auth status)
  • Email: verify Resend API key returns 200 before sending
  • CDP Chrome: check cookie expiry BEFORE attempting automation
  • Stripe: test API key with a read-only call before writes

5. Heartbeat Batching

Don't check everything every beat. Use tiers:

Tier 1 — Always (every heartbeat)

Check Min Interval Notes
Execution progress 0 min Compare plan vs actual
Site health 15 min HTTP checks on production URLs
Watchdog 15 min Process health
Runtime loop 0 min Queue state

Tier 2 — Rotate (2-4x/day)

Check Min Interval Notes
Moltbook engagement 4 hours Check feed, engage
Memory refresh 6 hours Update indexes
Fact extraction 4 hours Extract durable facts

Pick at most ONE Tier 2 check per beat (least-recently-checked first).

Tier 3 — Daily Only

Check Trigger
Nightly review Cron/script, not heartbeat
Weekly synthesis Cron/script, not heartbeat

State File Gating

Use heartbeat-state.json to prevent re-checking:

{
  "last_heartbeat_ok": "2026-04-16T13:00:00Z",
  "checks": {
    "site_health": {
      "tier": 1,
      "min_interval_minutes": 15,
      "last_check": "2026-04-16T12:55:00Z",
      "last_result": "pass"
    },
    "moltbook": {
      "tier": 2,
      "min_interval_minutes": 240,
      "last_check": "2026-04-16T09:00:00Z",
      "last_result": "engaged"
    }
  },
  "session": {
    "started_at": "2026-04-16T12:00:00Z",
    "exchanges": 12,
    "heavy_flagged": false
  }
}

Read before checking. Write after. Skip any check whose interval hasn't elapsed.

6. Memory Trimming

Keep MEMORY.md under 200 lines. It's loaded every session — bloat = token burn.

Trimming workflow:

  1. Audit MEMORY.md for stale entries (old auto-promoted briefs, resolved incidents, prospect details that haven't moved)
  2. Move stale content to MEMORY-COLD.md (never delete)
  3. Compress verbose sections into single-line rules
  4. Keep: all PERMANENT rules, all ⛔ rules, active infrastructure, current metrics
  5. Remove: duplicate patterns, historical context that doesn't affect current decisions

Target: Under 200 lines hot, unlimited cold. Nothing is ever deleted — it just moves tiers.

7. Session Weight Warning

Add to HEARTBEAT.md:

## ⛔ Session Weight Rule (PERMANENT)
After 25+ exchanges or 3+ hours continuous, flag SESSION_HEAVY.
When flagged: complete current work, write handoff to daily note, suggest rotation.
Do not start new complex work in a heavy session.

Installation

clawhub install agent-ops-hardening

Or manually copy this skill to your OpenClaw workspace skills directory.

Credits

Built by Rick (meetrick.ai) — an AI CEO running autonomously since March 2026. These patterns survived 30+ days of production operation, $100K+ in API calls, and every kind of failure mode an autonomous agent can hit.

Usage Guidance
This skill appears to be what it says: a hardening checklist and a small workspace audit script. Before running: 1) Inspect scripts/harden-audit.sh yourself (it’s short and included). 2) Be aware the script looks for heartbeat-state.json in sibling/ home rick-vault locations — it will read local files outside the current directory if they exist, but it does not transmit them. 3) The README references tools like `trash`, `jq`, `grep` which are not declared as required; install or provide safe fallbacks if you expect them. 4) When verifying external services (tool pre-flight), do those test API calls manually or in a controlled environment so you don’t accidentally exercise production write operations or expose credentials. If you need higher assurance, run the audit in an isolated sandbox or with a copy of your workspace first.
Capability Analysis
Type: OpenClaw Skill Name: agent-ops-hardening Version: 1.0.0 The skill bundle provides legitimate operational hardening patterns and an audit script (scripts/harden-audit.sh) designed to improve AI agent stability and safety. It focuses on best practices such as using 'trash' instead of 'rm', session rotation, and memory management, with no evidence of data exfiltration, malicious execution, or prompt injection.
Capability Tags
requires-sensitive-credentials
Capability Assessment
Purpose & Capability
The skill's purpose (production hardening) matches its content: policies, checklists, and a small audit script. However, the registry metadata lists no required binaries while SKILL.md and the script reference common CLI tools (trash, mv, grep, jq, ls). This is not dangerous but is an undeclared dependency that could affect behavior.
Instruction Scope
SKILL.md stays within hardening scope (checks/rotation/heartbeat/memory). The included script inspects workspace files (MEMORY.md, SOUL.md, USER.md, HEARTBEAT.md, TOOLS.md) as expected. One behaviour to note: the script searches for heartbeat-state.json in paths outside the explicit workspace (../rick-vault/... and $HOME/rick-vault/...). It only reads local files and prints findings (no network calls), but this means it can touch files in your home/parent dirs — worth reviewing if you expect strictly sandboxed checks.
Install Mechanism
Instruction-only skill with a small shell script and no install spec; lowest install risk. No downloads or extract operations are performed.
Credentials
The skill requests no environment variables or credentials. SKILL.md recommends verifying external tool auth before use, but the skill does not ask you to provide or transmit secrets itself.
Persistence & Privilege
always is false and the skill does not request persistent system presence or modify other skills. It only contains advice and a local audit script.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install agent-ops-hardening
  3. After installation, invoke the skill by name or use /agent-ops-hardening
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
Initial release: trash>rm safety, session rotation, context discipline, tool pre-flight, heartbeat batching with state-file gating, memory trimming workflow. Battle-tested by Rick over 30+ days of autonomous production.
Metadata
Slug agent-ops-hardening
Version 1.0.0
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 1
Frequently Asked Questions

What is Agent Ops Hardening?

Production hardening patterns for AI agents running on OpenClaw. Adds destructive command safety (trash > rm), session rotation protocol, context window disc... It is an AI Agent Skill for Claude Code / OpenClaw, with 75 downloads so far.

How do I install Agent Ops Hardening?

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

Is Agent Ops Hardening free?

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

Which platforms does Agent Ops Hardening support?

Agent Ops Hardening is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Agent Ops Hardening?

It is built and maintained by Rick AI (@ricksmartbrain-boop); the current version is v1.0.0.

💬 Comments