🎁 Get the FREE AI Skills Starter Guide β€” Subscribe β†’
BytesAgainBytesAgain
πŸ¦€ ClawHub

Hermes Learning Loop

by @mystour

Self-improving learning loop inspired by Hermes Agent. Automatically extracts successful workflows, creates skills, and persists knowledge across sessions.

Versionv1.0.0
Downloads819
TERMINAL
clawhub install hermes-learning-loop

πŸ“– About This Skill


name: hermes-learning-loop description: Self-improving learning loop inspired by Hermes Agent. Automatically extracts successful workflows, creates skills, and persists knowledge across sessions. tags: learning, self-improvement, memory, skill-creation, automation, hermes version: 1.0.0

Hermes Learning Loop for OpenClaw

Inspired by: NousResearch/hermes-agent (Self-improving AI agent)

Implements Hermes Agent's core learning loop in OpenClaw β€” automatically extracts successful workflows, creates reusable skills, and persists curated knowledge across sessions.

When to Use

  • After completing complex multi-step tasks
  • When you discover a workflow worth repeating
  • Automatically via heartbeat (periodic nudge)
  • When user says "remember this" or "save this workflow"
  • Features

  • Periodic Nudge β€” Auto-reflect every N tasks (default: 5)
  • Skill Extraction β€” Convert successful workflows to reusable skills
  • 4-Layer Memory β€” Prompt memory + Session search + Skills + User modeling
  • Curated Memory β€” Agent decides what's worth keeping (not logging everything)
  • Progressive Disclosure β€” Only load skill summaries by default, full content on-demand
  • FTS5 Session Search β€” SQLite-powered historical context retrieval
  • Quick Start

    Install

    clawhub install hermes-learning-loop
    

    Manual Trigger

    # After completing a task
    node learning-loop.js extract --session=

    Create skill from workflow

    node learning-loop.js create-skill --name="my-skill" --description="What it does"

    Periodic nudge (heartbeat)

    node learning-loop.js nudge

    Auto-Trigger (Integration)

    Add to HEARTBEAT.md:

    ## Learning Loop - Periodic Nudge

    Frequency: Every 5 tasks or 30 minutes

    Task: 1. Run node learning-loop.js nudge 2. Review extracted memories 3. Approve/reject skill creations

    Architecture

    Learning Loop Cycle

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  1. Task Execution                                      β”‚
    β”‚     - Agent completes task                              β”‚
    β”‚     - Track tool calls, decisions, outcomes             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  2. Periodic Nudge (every 5 tasks)                      β”‚
    β”‚     - System prompt: "Reflect on recent activity"       β”‚
    β”‚     - Agent evaluates: Is this worth persisting?        β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  3. Memory Extraction                                   β”‚
    β”‚     - If valuable β†’ Write to MEMORY.md / USER.md        β”‚
    β”‚     - If workflow β†’ Create skill file                   β”‚
    β”‚     - If context β†’ Index in session archive             β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                   β”‚
                   β–Ό
    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚  4. Skill Creation                                      β”‚
    β”‚     - Extract steps, tool calls, file references        β”‚
    β”‚     - Write to ~/.openclaw/skills///   β”‚
    β”‚     - Follow agentskills.io specification               β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    

    4-Layer Memory System

    | Layer | Purpose | Location | Load Timing | |-------|---------|----------|-------------| | Prompt Memory | Always-on context | MEMORY.md, USER.md | Every session start | | Skills | Procedural memory (how-to) | ~/.openclaw/skills/ | On-demand (summary β†’ full) | | Session Archive | Episodic memory (what happened) | SQLite + FTS5 | Deliberate retrieval | | User Model | Behavioral patterns | Optional (Honcho-like) | Continuous passive |

    Skill Triggers

    Automatically create skill when:

  • βœ… 5+ tool calls in sequence
  • βœ… Recovered from error successfully
  • βœ… User corrected β†’ fixed approach
  • βœ… Non-obvious workflow that worked
  • βœ… Repeated pattern detected (3+ times)
  • Usage Examples

    Example 1: Post-Task Skill Extraction

    # After completing complex deployment
    export SESSION_ID="2026-04-03-deploy"
    export TASK_OUTCOME="success"
    export TOOL_CALLS="15"

    node learning-loop.js extract

    Output:

    πŸ“Š Learning Loop Analysis

    βœ… Task completed successfully πŸ“ˆ Tool calls: 15 ⚠️ Error recovery: 2 instances πŸ’‘ User corrections: 1

    🎯 Skill-worthy detected: YES

    Proposed skill: Name: deploy-to-k8s Description: Deploy application to Kubernetes with health checks Steps: 7 Tool calls: 15

    πŸ“„ Created: ~/.openclaw/skills/devops/deploy-to-k8s/SKILL.md

    Example 2: Periodic Nudge

    # Heartbeat triggers this
    node learning-loop.js nudge
    

    Output:

    πŸ”” Periodic Nudge - Task #5

    Looking back at tasks 1-5...

    Task 1: βœ… Simple (no extraction needed) Task 2: βœ… Complex workflow detected β†’ Extracted: "github-pr-workflow" Task 3: βœ… Error recovery pattern β†’ Extracted: "debug-python-import" Task 4: βœ… Simple Task 5: βœ… User correction applied β†’ Updated: "github-pr-workflow" (v1.0.1)

    πŸ“Š Summary: - New skills: 2 - Updated skills: 1 - Memory entries: 3

    Example 3: Memory Curation

    # Review what's worth keeping
    node learning-loop.js curate --session="2026-04-03"
    

    Decision Framework:

    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
    β”‚ Should this be persisted?                            β”‚
    β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
    β”‚ ❌ Chat pleasantries β†’ Discard                       β”‚
    β”‚ ❌ Failed attempts β†’ Discard (keep only success)     β”‚
    β”‚ βœ… Successful workflows β†’ Extract as skill           β”‚
    β”‚ βœ… User preferences β†’ Add to USER.md                 β”‚
    β”‚ βœ… Project context β†’ Add to MEMORY.md (project/)     β”‚
    β”‚ βœ… Corrections/feedback β†’ Add to MEMORY.md (feedback/)β”‚
    β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
    

    Configuration

    Environment Variables

    | Variable | Description | Default | |----------|-------------|---------| | LEARNING_NUDGE_INTERVAL | Tasks between nudges | 5 | | LEARNING_MIN_TOOL_CALLS | Min tool calls for skill | 5 | | LEARNING_AUTO_CREATE | Auto-create skills (vs approve) | false | | LEARNING_SKILLS_DIR | Skills directory | ~/.openclaw/skills/ | | LEARNING_MEMORY_DIR | Memory directory | ~/.openclaw/memory/ |

    Config File

    # ~/.openclaw/learning-loop.yaml
    learning:
      nudge:
        enabled: true
        interval: 5  # tasks
        
      skill_creation:
        auto_approve: false  # Review before creating
        min_tool_calls: 5
        categories:
          - devops
          - research
          - productivity
          
      memory:
        max_prompt_chars: 3575  # Hermes-style tight limit
        archive_enabled: true
        fts5_enabled: true
    

    Skill File Format

    Follows agentskills.io specification:

    ---
    name: deploy-to-k8s
    description: Deploy application to Kubernetes with health checks
    version: 1.0.0
    platforms: [linux, macos]
    metadata:
      tags: [kubernetes, devops, deployment]
      category: devops
      created_from: session-2026-04-03
    

    deploy-to-k8s

    Overview

    Deploy any application to Kubernetes cluster with automated health checks and rollback.

    Prerequisites

  • kubectl configured
  • Kubernetes cluster access
  • Docker image ready
  • Steps

    1. Validate cluster connection

    bash kubectl cluster-info
    
    2. Apply deployment manifest
       
    bash kubectl apply -f deployment.yaml
    
    3. Wait for rollout
       
    bash kubectl rollout status deployment/app
    
    4. Health check
       
    bash kubectl get pods -l app=myapp
    
    5. Verify service
       
    bash kubectl get svc app-service
    
    

    Tool Calls Used

  • exec: kubectl commands
  • read: deployment.yaml
  • web_search: Kubernetes docs (if errors)
  • Related Skills

  • docker-build-optimization
  • k8s-troubleshooting
  • Integration with OpenClaw

    Heartbeat Integration

    ## HEARTBEAT.md Update

    Learning Loop - Periodic Nudge

    Frequency: Every 5 tasks

    Steps: 1. Check task counter 2. If counter % 5 == 0 β†’ Run nudge 3. Review proposed skills/memories 4. Approve/reject 5. Reset counter

    PUA Integration

    # Task PUA can trigger learning loop
    if task.failed && task.recovered:
      node learning-loop.js extract --reason="error-recovery"
      
    if task.pua_level >= "L2":
      # Complex task β†’ likely skill-worthy
      node learning-loop.js nudge
    

    Memory PUA Integration

    # Memory health check includes learning loop status
    node memory-pua.js audit

    Output includes:

    - Skills created this week

    - Memories curated

    - Nudge effectiveness

    Comparison: Hermes vs This Implementation

    | Feature | Hermes Agent | This Skill | |---------|--------------|------------| | Periodic Nudge | βœ… Built-in | βœ… Via heartbeat | | Skill Auto-Creation | βœ… Full auto | ⚠️ Opt-in approval | | 4-Layer Memory | βœ… SQLite + FTS5 | ⚠️ Markdown + optional SQLite | | Progressive Disclosure | βœ… Summary β†’ Full | βœ… Same pattern | | User Modeling (Honcho) | βœ… Optional | ❌ Not implemented | | Gateway Integration | βœ… Multi-platform | ⚠️ OpenClaw channels only | | Context Compression | βœ… Lineage-aware | ⚠️ Basic summarization |

    Benefits

  • βœ… Curated not dumped β€” Agent decides what's worth keeping
  • βœ… Token-efficient β€” Progressive disclosure keeps context small
  • βœ… Portable skills β€” Follows agentskills.io standard
  • βœ… Self-improving β€” Gets better the more you use it
  • βœ… OpenClaw native β€” Works with existing memory system
  • Related Skills

  • claude-memory-optimizer: Memory structure and migration
  • task-pua: Task persistence and quality
  • memory-pua: Memory health maintenance
  • References

  • Hermes Agent: https://github.com/NousResearch/hermes-agent
  • Hermes Docs: https://hermes-agent.nousresearch.com/
  • agentskills.io: https://agentskills.io/specification
  • FTS5 Docs: https://www.sqlite.org/fts5.html
  • License

    MIT-0


    *Version 1.0.0: Initial implementation inspired by Hermes Agent learning loop*

    ⚑ When to Use

    TriggerAction
    - When you discover a workflow worth repeating
    - Automatically via heartbeat (periodic nudge)
    - When user says "remember this" or "save this workflow"

    πŸ’‘ Examples

    Install

    clawhub install hermes-learning-loop
    

    Manual Trigger

    # After completing a task
    node learning-loop.js extract --session=

    Create skill from workflow

    node learning-loop.js create-skill --name="my-skill" --description="What it does"

    Periodic nudge (heartbeat)

    node learning-loop.js nudge

    Auto-Trigger (Integration)

    Add to HEARTBEAT.md:

    ```markdown

    βš™οΈ Configuration

    Environment Variables

    | Variable | Description | Default | |----------|-------------|---------| | LEARNING_NUDGE_INTERVAL | Tasks between nudges | 5 | | LEARNING_MIN_TOOL_CALLS | Min tool calls for skill | 5 | | LEARNING_AUTO_CREATE | Auto-create skills (vs approve) | false | | LEARNING_SKILLS_DIR | Skills directory | ~/.openclaw/skills/ | | LEARNING_MEMORY_DIR | Memory directory | ~/.openclaw/memory/ |

    Config File

    # ~/.openclaw/learning-loop.yaml
    learning:
      nudge:
        enabled: true
        interval: 5  # tasks
        
      skill_creation:
        auto_approve: false  # Review before creating
        min_tool_calls: 5
        categories:
          - devops
          - research
          - productivity
          
      memory:
        max_prompt_chars: 3575  # Hermes-style tight limit
        archive_enabled: true
        fts5_enabled: true