We have just completed our series on Claude Code Harness Patterns. We recently discovered that the Hermes Agent Framework has a compelling harness architecture, and we thought it would be fascinating to compare it with Claude Code. This new series spans 15 chapters. The first 10 chapters revisit the patterns we covered in our Claude Code series, and we have added 5 extra chapters to address other important patterns.
At a high level, Claude Code is TypeScript, SDK-first, and Anthropic-backed — designed to be embedded as a library. Hermes Agent is Python, CLI and gateway-first, and model-agnostic — designed to be deployed as a service. You point it at any of 200+ models via OpenRouter, connect it to Slack or Telegram, and get a self-improving agent with a built-in learning loop.
Several subscribers have written in asking for a comparison between OpenClaw and Hermes Agent, which I understand — it seems like the more direct matchup. After deliberating carefully, I believe the more valuable comparison is between Hermes Agent and Claude Code, and that is the direction this series takes.
That said, if you are still curious about how OpenClaw stacks up against Hermes Agent, I want to point you to my daughter Grace Huang’s Substack. Grace is a product manager turned AI engineer who writes in her signature Gen-Z style — direct, honest, and refreshingly accessible. Her gentle introduction and comparison of both frameworks is especially well-suited for readers from high school through early career, including anyone with a few years of corporate experience who wants to understand these tools without wading through dense technical writing. Her Substack is linked below — it is well worth a subscribe or you can send her substack link to someone who you believe will get inspired and benefit from her post.
https://substack.com/@buildingwithgrace
Now, to celebrate the launch of this series, I am offering 50% off an annual subscription —you can use link here
From a high level: Claude Code — TypeScript, SDK-first, Anthropic-backed. Designed to be embedded as a library.
Hermes Agent — Python, CLI and gateway-first, model-agnostic. Designed to be deployed as a service.
Both are horizontal — domain-independent, production-grade, used by real teams.
Fifteen chapters, each on a distinct harness pattern. Every chapter shows real code from both systems, a side-by-side comparison, and a concrete application to a Defensive Cyber Agent — the vertical domain where these patterns matter most.
1 — The Harness Paradigm. The foundational split: model provides intelligence, harness provides control. QueryEngine vs AIAgent. Async generator streaming vs synchronous loop. The IterationBudget pattern for capping runaway agents.
2 — Tool Architecture and the Tool Contract. Every action the agent can take must be defined, validated, and declared safe or dangerous before it executes. Claude Code’s buildTool factory with Zod schemas vs Hermes’s registry.register() pattern. isConcurrencySafe, isReadOnly, isDestructive — the behavioral declarations that let the harness make intelligent execution decisions.
3 — The Agent Loop. The heartbeat of every autonomous agent: model call → tool execution → result injection → repeat. Claude Code’s while(true) with seven named continue sites and explicit transition reasons vs Hermes’s iteration counter with IterationBudget. How the loop design determines debuggability, error recovery, and audit trail quality.
4 — Permission Systems and Safety Guardrails. The layer that answers “should this be allowed?” before every tool call. Claude Code’s five permission modes (default/auto/plan/acceptEdits/bubble) with classifier-driven automation vs Hermes’s regex-based dangerous command detection and interactive approval callbacks. Three-tier permission design for cyber agents: auto-allow recon, analyst-approve probing, CISO-approve remediation.
5 — Tool Orchestration and Execution. What happens when the model wants to call five tools at once. Claude Code’s partitionToolCalls — grouping by isConcurrencySafe into concurrent and serial batches — vs Hermes’s _should_parallelize_tool_batch heuristic with _PARALLEL_SAFE_TOOLS sets and path-overlap detection. Abort handling and synthetic tool results for interrupted executions.
6 — Context Management at Scale. Every LLM has a finite context window; every real task eventually exceeds it. Claude Code’s five-strategy pipeline (snip → micro-compact → collapse → auto-compact → reactive) ordered by cost, with a circuit breaker after three failures, vs Hermes’s single ContextCompressor backed by Anthropic prompt caching. Compliance-aware compaction that always preserves initial threat indicators.
7 — Multi-Agent Coordination. How complex tasks escape the single-context trap. Claude Code’s AgentTool with five execution modes (sync/async/fork/teammate/remote), git worktree isolation, and SendMessage routing vs Hermes’s delegate_tool with ThreadPoolExecutor, independent IterationBudget per child, and mixture_of_agents for parallel model aggregation. SOC team architecture: coordinator, recon, forensics, remediation agents.
8 — Memory Systems and State Persistence. Three memory tiers: working memory in the conversation, episodic memory across sessions, procedural memory in reusable runbooks. Claude Code’s file-based transcripts with eager flush and auto-injected CLAUDE.md attachments vs Hermes’s SQLite FTS5 session store with LLM-powered search and autonomous skill creation. Threat-actor profiling that persists across sessions.
9 — Observability and Debugging. How you know what the agent is doing and why it failed. Claude Code’s query chain IDs for distributed tracing, headless profiler checkpoints, and branded AnalyticsMetadata type to prevent PII leakage vs Hermes’s JSONL trajectory saving, RedactingFormatter, and _detect_tool_failure for real-time error surfacing. A CyberAuditLogger that outputs SIEM-compatible event streams.
10 — Production Deployment Patterns. Claude Code’s SDK async generator interface, 30 compile-time feature flags, and four-provider abstraction (Anthropic/Bedrock/Vertex/Azure) vs Hermes’s CLI/gateway dual entry points, HERMES_HOME profile isolation for multi-tenant deployments, built-in cron scheduling, and 200+ models via OpenRouter. Air-gapped deployment, SIEM streaming, docker-compose for the full stack.
11 — Hook / Event-Driven Automation. The event layer that lets a harness react to file changes, tool invocations, task completions, and timers without polling. Claude Code’s ten hook event types (preToolUse, postToolUse, agentStop, fileEdited, etc.) with askAgent and runCommand actions vs Hermes’s cron scheduler and gateway callbacks. A complete 24/7 SOC agent hook configuration: confidence gate before remediation, SIEM push after every scan, nightly vulnerability sweep.
12 — The Skill System. How agents accumulate and reuse procedural knowledge. Claude Code’s CLAUDE.md auto-injection (simple, static, no security scanning) vs Hermes’s full skill lifecycle: SKILL.md frontmatter with platform filtering and secret injection, four-tier progressive disclosure, agent-managed creation with atomic writes and rollback on security scan block, skills_guard.py with 80+ threat patterns across nine categories, and the Skills Hub marketplace with GitHub and well-known source adapters.
13 — MCP Integration. The Model Context Protocol as the USB-C of AI agents — a standard that lets any agent connect to any tool server without custom integration code. Claude Code’s TypeScript async client with mcp__server__tool namespacing and requiredMcpServers on sub-agents vs Hermes’s dedicated background event loop, MCPServerTask per server, exponential backoff reconnection, SamplingHandler for server-initiated LLM requests, and _sanitize_error credential stripping.
14 — Model Routing and Provider Abstraction. The decision layer between “agent needs an LLM” and “this specific endpoint gets called.” Claude Code’s compile-time provider abstraction with getRuntimeMainLoopModel, getAgentModel priority chain, and FallbackTriggeredError with thinking-signature stripping vs Hermes’s runtime api_mode auto-detection from URLs, ordered fallback chains, fetch_model_metadata with 1-hour OpenRouter cache, switch_model for live mid-session switching, and smart_model_routing for per-turn cost optimization.
15 — Structured Output and Schema-Constrained Generation. Constraining the model’s free-text output to a validated JSON schema — distinct from tool input validation (cc2). Claude Code’s SYNTHETIC_OUTPUT_TOOL_NAME trick (wrapping the schema as a fake tool), MAX_STRUCTURED_OUTPUT_RETRIES budget, and typed error_max_structured_output_retries result vs Hermes’s tool-use forcing pattern (portable across all providers), explicit retry loop with error feedback injected as messages, and batch_runner.py for parallel structured extraction at scale.
Every chapter ends with a Defensive Cyber Agent code sketch. By chapter 15, those sketches compose into a working SOC automation system.
Cyber defense is the right vertical because the constraints are real and the stakes are high. A port scan without authorization is a legal problem. A host isolation without analyst approval takes down production. A context window that drops the initial indicators of compromise loses the investigation thread. Every harness pattern has a direct, high-stakes analog in this domain — which makes it the best stress test for whether the patterns actually work.
The sketches are composable. Read the series in order and you’ll have a mental model for production agent engineering — and a reference implementation for a domain where getting it wrong has consequences.
If you are still interested in this 15 series article starting next week, please use this link to get 50% off your yearly subscription