AI guides

Same model, different agent: tools, memory and execution across five harnesses

By AINRK 编辑0 viewsSource: 特工宇宙
Same model, different agent: tools, memory and execution across five harnesses

A look at TinyAgent, Pi, OpenCode, Hermes and OpenClaw through a version-pinned personal guide. Storage, compaction and permissions matter; isolation is not a no-leak guarantee.

Why can the same model behave differently inside another agent harness? Context organization, tool execution, memory storage and when to return to the user all depend partly on the surrounding system.

Model evaluation across different harnesses

This article follows Maarten Grootendorst’s November 30 personally authored A Visual Guide to Agent Harnesses and the Chinese adaptation by Tegong Universe. It is a source-code explainer, not a Google-issued performance report. Architectural differences below are not converted into guaranteed benchmark gains.

The guide pins TinyAgent v0.1.1, Pi v1.2.0, OpenCode v2.0.29, Hermes commit 0e427d7 and OpenClaw v2026.10.3. Tool counts, code sizes, compaction thresholds and schedules belong to those snapshots, not permanent defaults for every release.

Pi, OpenCode, Hermes and OpenClaw capabilities

What the model and harness each do

Here, the model receives input and generates text or tool calls. The harness assembles prompts, provides tools, executes actions, stores sessions and applies permissions. Together they form an agent that can interact with an environment.

Agent model connected to memory and tools

Ordinary inference does not update model weights after a conversation. History and preferences usually live in harness-managed context, files or databases and are supplied to the model as needed. Calling the model stateless means its weights do not automatically remember the chat, not that runtime caches or session state do not exist.

Boundary between model weights and the harness

Harnesses make different choices about tools, connectors, sessions, safeguards and background work. More code does not automatically mean greater capability, and including plugins or tests can change size comparisons substantially.

Code-size comparison of educational and production harnesses

Pi and OpenCode focus on coding loops. Hermes and OpenClaw add personal-assistant layers such as chat channels, preferences and scheduled wake-ups. Comparisons should distinguish a coding task from a continuously running service.

Coding core and personal-assistant layer

TinyAgent: repeat generation, execution and observation

TinyAgent is an educational framework built by the guide’s author and co-author for their book. Around 600 lines of Python connect a local Gemma 4 to reasoning, memory, tools, planning and subagents, without a full production server or connector layer.

TinyAgent six-module structure

Its core follows a ReAct-like loop: generate an action, execute a tool, append the observation and continue until stopping. The pattern comes from the 2022 ReAct research; modern implementations need not expose every internal reasoning step to the user.

ReAct reasoning, action and observation loop

A model deciding to call a tool is distinct from the tool actually running. Interfaces, errors and receipts shape the next model input. The loop also needs termination conditions to avoid endless repetition.

TinyAgent tool calls and stored observations

The guide’s core code follows. Spaces and indentation lost in the collected version are restored from the original. It is a reading example and is not executed here:

def _step(self) -> str | None: response = self.llm.generate( self.memory.get_messages(), tools=self.tools.schemas ) self.memory.add( "assistant", response.content, tool_call=response.tool_call ) if self.tools.is_done(response): return response.content result = self.tools.execute(response) role, observation = self.tools.observation(result) self.memory.add(role, observation) return None

Pi: compaction, targeted editing and steering

In the guide, Pi runs in a terminal without a shared server, with read, write, edit and bash as its four default tools. It adds session persistence, input/output handling and reception of messages during execution.

Pi core tools and execution loop

The example compacts at around 184K tokens, summarizing older turns while retaining the latest 20K verbatim. This preserves recent working details, but a summary can omit information, so compaction is not lossless memory.

Pi compaction preserving recent context

Turns are written to JSONL and linked through id and parent fields into a tree. Users can return to an earlier node and branch. The full disk record is distinct from the context currently sent to the model.

Pi JSONL session tree linked by id and parent

The edit tool changes a matching fragment rather than rewriting a whole file for one line. It reduces output, while still needing to handle failed matches or changed files.

Whole-file writing versus targeted edits

For long tool logs, the harness keeps the full file and returns a tail plus path—2,000 lines in the guide’s example. The model can inspect the end first and retrieve more if needed. Costs depend on truncation, later reads and task needs.

Full log storage with a returned tail

Messages during execution split into steering and follow-up. Steering enters the current task before the next call, while follow-up waits until the harness is about to stop. Immediate steering still has tool and message-processing boundaries; it cannot undo actions already completed.

Pi steering and follow-up message timing

The guide illustrates the timing with this control flow:

while (hasMoreToolCalls || pendingMessages.length > 0) { // ... run turn and execute tools ... explicitContinuation = decision?.action === "continue"; pendingMessages = (await config.getSteeringMessages?.()) || []; if (hasMoreToolCalls || pendingMessages.length > 0) { explicitContinuation = false; } } // Agent would stop here. Check for follow-up messages. const followUp = (await config.getFollowUpMessages?.()) || []; if (followUp.length > 0) { explicitContinuation = false; pendingMessages = followUp; continue; }

OpenCode: shared service, code orchestration and subagents

OpenCode adds an HTTP service and SQLite sessions so terminal, desktop and web clients can share state. Continuing after a client closes depends on the service remaining alive; storing a session does not automatically recover every in-flight operation.

OpenCode shared HTTP-service architecture

The server loads history, runs a step and persists its result. Separating display from execution enables multiple entry points, while adding responsibilities for service lifecycle, identity and concurrent state.

OpenCode SQLite sessions shared by clients

Code Mode lets the model write a script to chain tools and return an aggregate result. This CodeAct-style orchestration can reduce round trips, but exceptions, partial success and permissions still need explicit handling.

Code Mode chaining tool calls in a script

The planning example keeps the same loop and restricts editing to a plan file, then restores target-file editing in build mode. Mode differences can come from permissions rather than a different model. Actual paths and policies vary by release and configuration.

Planning-mode edit restrictions

Subagents can explore a repository in separate contexts and return summaries, reducing intermediate noise for the main agent. Summaries may omit conditions, so important findings should retain locations or evidence. Isolation does not eliminate every context-quality problem.

OpenCode subagents isolating search context

Hermes: preferences, on-demand skills and review

Hermes adds chat gateways, approval judgment, sandbox backends and parallel workers. The guide’s snapshot has more than 50 tools and 50 skills, supporting personal-assistant work as well as code changes.

Hermes gateway, tools and assistant architecture

Memory is split between MEMORY.md for environment facts, project structure and technical lessons, and USER.md for roles, communication habits and preferences. Separation helps retrieval, but stored facts can still become stale or incorrect.

MEMORY.md and USER.md memory separation

Skills are not all loaded in full at startup. Names and descriptions are shown first, with skill_view fetching complete instructions when needed. They cover productivity, development, security and external agents; having a skill does not grant service accounts or execution permission.

On-demand loading of Hermes skill instructions

In the inspected version, more than ten tool calls can trigger end-of-session review to create or update a skill. This stores procedures in files rather than training model weights. A pattern extracted from one success still needs checks against overgeneralizing accidental conditions.

Session review creating or updating skills

Parallel subagents handle files or directories and return summaries. Independent exploration benefits, while edits still need ownership and dependency boundaries to avoid conflicts or reliance on unfinished findings.

Hermes parallel subagent summaries

OpenClaw: channels, heartbeats and memory consolidation

OpenClaw targets an always-on personal assistant, with over 30 chat channels in the snapshot and a broad set of tools and backends. That breadth also requires more configuration, permissions and operations.

OpenClaw always-on multi-channel architecture

The gateway separates main and group sessions to reduce private context entering group conversations. Shared files, tool access, routing configuration and model output can still cross boundaries, so it cannot guarantee that personal information never leaks.

Separation of direct-message and group sessions

A heartbeat wakes the agent periodically to check rules in HEARTBEAT.md—every 30 minutes in the example. It stays quiet when nothing needs attention and notifies on relevant changes. This differs from a fixed-time cron report and is not necessarily enabled with the same schedule in every installation.

Cron report and thirty-minute heartbeat timeline

Before compaction, memory flush writes important information into daily logs for later retrieval. Disk storage aids traceability, but policies must still decide accuracy and what sensitive information should not be stored.

Memory flush into daily logs before compaction

Hybrid retrieval combines BM25 keyword matching and embeddings, then applies recency weighting and MMR deduplication/reranking. The guide’s 30-day decay is a policy example, not proof that older facts are unimportant or that retrieval always finds the correct record.

Hybrid keyword and embedding retrieval with reranking

Scheduled Dreaming divides consolidation into scoring, extraction and long-term storage, using light sleep, deep sleep and REM as metaphors. It is scheduled data processing, not human sleep. Scheduling, expense and written-back results still require management.

Scheduled scoring, extraction and memory consolidation

When choosing, inspect what enters and leaves the loop

Overhead begins before user input: system prompts, workspace files and tool schemas occupy context. Hermes and OpenClaw have similar initial token counts in the guide, but Hermes spends more on 21 default tool schemas and OpenClaw more on persona, memory and rule files with seven core tools.

System-prompt and tool-schema token overhead

Earlier compaction is not automatically cheaper: summary calls, rereads after omissions and effects on later work all matter. Hermes compacts relatively early, while OpenClaw relies more on persistent logs—different tradeoffs.

Compaction strategies across harnesses

From TinyAgent’s memory to Pi’s JSONL tree, OpenCode’s SQLite, Hermes’ split files and OpenClaw’s logs and retrieval, the differences concern where state lives, how it is recalled and who can read it. Each capability adds maintenance and privacy boundaries.

Session persistence and cross-session memory comparison

For a coding task, start with tools and feedback. Multi-client work needs shared-state and service-lifecycle checks. Long-term assistants also need memory governance, channel permissions, scheduling cost and stopping controls. Code size does not determine a universal winner.

Harness-selection considerations by task

A harness can substantially change behavior without changing weights. Determining suitability still requires tests with matched models, tasks, budgets and tools, rather than ranking releases from an unmatched score chart.

Complete agent diagram with model, memory, tools and feedback

Source: Maarten Grootendorst’s original guide (opens in a new tab). This article follows Tegong Universe’s adaptation and checks the original. It is not a complete line-by-line audit or independent benchmark of all five frameworks, and no background service or scheduled job was installed.

Edited by AINRK. Reporting lead: Original AITNT report (opens in a new tab); original reporting: TeGong YuZhou; original author: YuZhou Editorial Team; source date: 2026-12-04 09:55 (Beijing time, UTC+8).

Reference: Maarten Grootendorst original personal guide (opens in a new tab)

After reading

Join the AINRK community

Read how to join the community and connect with people working in AI.

Community information (opens in a new tab)