Deep Dive into AI Agents: Inside Claude Code, OpenClaw, and Hermes

This article dissects the internal architecture of three distinct AI agents—Anthropic’s Claude Code, the open‑source OpenClaw, and Nous Research’s Hermes—explaining their command layers, ReAct loops, instruction files, toolsets, memory systems, skill formats, extensions, and multi‑agent communication, and shows how to configure them for optimal performance.

AI Waka
AI Waka
AI Waka
Deep Dive into AI Agents: Inside Claude Code, OpenClaw, and Hermes

Surface: What You See

Claude Code is Anthropic’s CLI agent accessed via claude, offering REPL‑style pair programming, file editing, shell execution, and safety prompts. OpenClaw is an open‑source agent that can be reached through WhatsApp, Telegram, Slack, Discord, Teams, Signal and over 20 other platforms, proactively sending messages without a prompt. Hermes Agent, released under the MIT license by Nous Research, provides a rich TUI, 40+ built‑in tools, and a gateway to Telegram, Discord, Slack, WhatsApp, Signal and Email; it learns by creating reusable skills after solving problems and works with any LLM provider.

Agent Loop: The Neural System

All three agents implement a variant of the ReAct (Reasoning + Acting) cycle:

Observe : read user message and context.

Think : decide the next step.

Act : invoke a tool (read file, run command, browse web, etc.).

Observe : read tool output.

Think : check if the task is complete.

Repeat until convergence.

OpenClaw documents this as five named stages (Orchestrate, Resolve Model, Build Prompt, Guard Context, Act & Repeat). Claude Code follows the same pattern implicitly via its system prompt. Hermes formalises the loop in its **AIAgent** class and adds a “learning checkpoint” where new skills are authored and memories are persisted.

Instructions and Identity: The Agent’s DNA

Each agent starts with a system prompt that defines its core personality and safety rules. Claude Code hides a ~10,000‑token system prompt; OpenClaw exposes it as a SOUL.md file that users can edit and version‑control; Hermes also uses SOUL.md but allows it to replace the built‑in identity when present.

Project‑ and user‑specific instruction files further customise behavior. Claude Code merges ***CLAUDE.md*** files from global, project, and sub‑directory levels, with later files overriding earlier ones. OpenClaw distributes configuration across SOUL.md, AGENTS.md, USER.md, TOOLS.md, etc., each with a clear responsibility. Hermes applies a “first‑match‑wins” rule across .hermes.md, HERMES.md, AGENTS.md, CLAUDE.md, and .cursorrules.

Tools: The Agent’s Hands

Claude Code ships with a dozen built‑in tools, each explicitly preferred over generic alternatives (e.g., use Read instead of cat). OpenClaw registers tools via api.registerTool() and can load additional plugins from an extensions/ directory. Hermes bundles over 40 tools organised into selectable toolsets (e.g., hermes chat —toolsets "web,terminal"), allowing users to enable only the needed subset.

Tool schemas are JSON objects that describe name, description, and parameters. Agents consume these schemas to match user intent to the appropriate tool. To reduce context‑window pressure, Claude Code supports lazy‑loaded tools via a ToolSearch function, while Hermes lets users pick toolsets to keep token usage proportional to the task.

Skills: Composable Expertise

Skills are markdown‑based recipes that tell an agent *how* to solve a class of problems. A typical skill consists of a YAML front‑matter with name and description, followed by a detailed markdown body that is loaded only when the skill is activated. Claude Code stores skills under ~/.claude/skills/, OpenClaw offers a public marketplace (ClawHub) with >2,800 skills and a priority chain (workspace > user > global > built‑in), and Hermes maintains a Skills Hub with 643 skills, including self‑generated skills that grow as the agent learns.

Memory and Persistence: The Long‑Term Brain

All three agents implement cross‑session memory by reading a file at session start and writing back at the end. Claude Code uses MEMORY.md (≈4 KB) and optional vector stores such as ChromaDB MCP. OpenClaw separates user context ( USER.md, ~1.5 KB) from long‑term memory ( MEMORY.md, ~4 KB) and logs each session in memory/YYYY‑MM‑DD.md plus a HEARTBEAT.md task list. Hermes enforces strict size limits (2.2 KB for MEMORY.md, 1.4 KB for USER.md) and uses a memory tool to add, replace, or prune entries, with optional SQLite full‑text search and external memory plugins.

Extensions, MCP, and Plugins

Model Context Protocol (MCP) servers let agents discover external capabilities. Both Claude Code and OpenClaw support MCP natively; a typical MCP config maps names to commands (e.g., a ChromaDB memory server or an SSH manager). OpenClaw’s plugin system registers tools, channels, routes, and hooks via register(api). Hermes loads Python plugins from ~/.hermes/plugins/ or project‑level directories, each described by a plugin.yaml and capable of registering tools, hooks, CLI commands, and delegating tasks.

Hooks: Event‑Driven Automation

Hooks are shell commands or callbacks triggered by agent events (tool call, session start, notification, etc.). Claude Code configures hooks in settings.json; OpenClaw registers them through its plugin API; Hermes exposes a rich set of lifecycle hooks ( pre_tool_call, post_llm_call, on_session_start, etc.) that can inject context or perform side‑effects.

Multi‑Agent Communication and Proactivity

Claude Code can spawn isolated sub‑agents (Explore, Plan, Code‑Reviewer) stored under .claude/agents/ or ~/.claude/agents/, each with its own worktree to avoid token bloat. OpenClaw supports child sessions via sessions_spawn and direct messaging via sessions_send, with configurable turn limits and a REPLY_SKIP signal. Hermes provides a delegate_task tool and a built‑in cron scheduler for natural‑language task scheduling. OpenClaw also runs a heartbeat daemon that periodically evaluates HEARTBEAT.md and takes autonomous actions (e.g., email summarisation). Claude Code remains passive, awaiting user input.

Practical Configuration Checklist

Instruction files : edit CLAUDE.md, SOUL.md or AGENTS.md to encode project specifics and preferences.

Memory files : populate MEMORY.md with facts about your environment, tools, and learned solutions.

Skills : install or author skills relevant to your workflow; reuse across agents when possible.

Extensions & MCP : add MCP servers or plugins for external services (SSH, vector stores, design tools).

Permission settings : adjust safety guards according to the sensitivity of the tasks.

Context budget : be mindful of token consumption from tool schemas, skills, and instruction files; prune unused items.

Understanding the common anatomy of Claude Code, OpenClaw, and Hermes lets you switch between them, configure them intelligently, and build more capable AI agents.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

memory managementAI agentsReActtool integrationHermesClaude CodeOpenClawskill system
AI Waka
Written by

AI Waka

AI changes everything

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.