Claude Code, Codex CLI, Gemini CLI, Kimi CLI, Grok Build, OpenCode, Hermes, GLM/Z.ai, and DeepSeek Harness — compared at the level that matters: the harness. System prompts read directly from source, tool inventories, context management, and the techniques that repeat — distilled into a playbook for building your own.
Every product here is the same ~200-line loop wearing different clothes: send the conversation + tool schemas to the model, execute whatever tool calls come back, append results, repeat until the model answers in plain text. Everything else — the six boxes below — is where harnesses actually differ and compete.

The feature-maximal harness that popularized CLAUDE.md, subagents, hooks, skills, and plan mode. Design center: context is the scarcest resource — progressive disclosure everywhere (skills load on demand, tool schemas load via ToolSearch), rules attached to the tools they govern.
hooksskillssubagentsdeferred tools
The minimalist: three core tools, OS-level sandboxing instead of per-tool prompts, and per-model system prompts — codex-tuned models get a prompt ⅓ the size because the behavior is trained in, not written down. The cleanest permission model in the field.
3 toolsapply_patchsandbox × approval
The most engineered prompt: a "Context Efficiency" section with an in-repo warning that it must be re-benchmarked on SWE-bench before edits. Teaches the model to estimate token cost of its own strategy, self-heal sandbox failures, and distinguish Directives from Inquiries.
context efficiencyself-healing sandboxuntrusted_context
The most inventive on context: D‑Mail lets the model roll its own context back to a checkpoint, replacing dead-end exploration with a note to its past self. Declarative YAML agent specs, persistent resumable subagents, schema-constrained XML compaction.
D-Mail rollbackYAML agentsK3: 1M ctx
The smallest general prompt in the field (668 words, templated per config) and the most novel edit tool: hashline anchors — content-hashed line references instead of exact strings, with atomic batch edits that return fresh anchors on staleness. Two-level compaction, including mid-turn tool-result summarization.
hashline edits668-word promptintra-turn compaction
The model-agnostic harness: ships seven different system prompts (anthropic.txt, codex.txt, kimi.txt, gemini.txt…) and picks one per model family — hard evidence that prompts must be written per model, not per product.
per-model promptsagents as markdown
The harness-as-text school: tool schemas live inside the system prompt in <tools> tags, calls come back as JSON in <tool_call> tags — portable to any inference stack. Since Feb 2026 also a product: Hermes Agent, a server-resident agent that writes its own skills after each task.
schema-in-prompt<think> togglesself-writing skills
The contrarian: builds no general harness at all. Ships an Anthropic-compatible API and trains GLM to fit Claude Code's conventions (preserved thinking, tool wire format), selling a coding plan that plugs into Claude Code, Cline, and OpenCode. The harness is a commodity; the model is the product.
borrow the harnessslime RL1M ctx
The kernel: everything is a plugin — model adapter, tools, session log, sandbox, and the agent loop itself, on the Cordis composition framework (405 packages). No prompt file exists: the 702-word system prompt is assembled from plugin-owned sections. Sessions are event-sourced; it even runs Claude Code and Codex as subagent backends. 206K stars in 18 days.
all-pluginevent-sourced logrival CLIs as subagentsWord counts measured directly from the cloned repos (core system prompt, excluding tool schemas). The spread is 10×. The headline: OpenAI ships a 3,917-word prompt to general GPT-5 models but only 1,221 words to codex-tuned models — when behavior is trained in, the prompt shrinks to just editing constraints and formatting rules. Grok Build's general template is smaller still (668 words), and Hermes goes furthest: the whole harness fits in 374 words plus schemas. DeepSeek Harness (added Aug 2026) lands near the bottom by construction: no prompt file exists in the repo — the 702-word default is assembled at runtime from sections each tool plugin owns, and pinned by deterministic snapshot fixtures.
What each harness ships. ● native ◐ partial / via convention · absent. GLM column reflects what the model is trained to exploit in borrowed harnesses.
| Technique | Claude Code | Codex CLI | Gemini CLI | Kimi CLI | Grok Build | OpenCode | Hermes Agent | GLM/Z.ai | DeepSeek dsh |
|---|---|---|---|---|---|---|---|---|---|
| Plan / todo toolupdate_plan, TodoWrite, SetTodoList | ● | ● | ● | ● | ● | ● | ◐ | ◐ | ● |
| Plan mode (read-only gate) | ● | ◐ | ● | ● | · | ● | · | · | ◐ |
| Subagents / task delegation | ● | ◐ | ● | ● | ● | ● | ● | · | ● |
| Persistent / resumable subagents | ● | · | · | ● | · | · | ◐ | · | ● |
| Auto-compactiondedicated summarization prompt | ● | ● | ● | ● | ● | ● | ◐ | ◐ | ● |
| Intra-turn tool-result compaction | ● | · | · | · | ● | · | · | · | ● |
| Model-initiated context rollbackKimi D-Mail | · | · | · | ● | · | · | · | · | · |
| Memory filesAGENTS.md / CLAUDE.md / GEMINI.md | ● | ● | ● | ● | ● | ● | ● | ◐ | ● |
| Auto-memory directoryagent-curated persistent facts | ● | · | ● | ◐ | ◐ | · | ● | · | · |
| Skills / progressive disclosure | ● | ● | ● | ● | ● | ◐ | ● | · | ● |
| Hooks (deterministic guardrails) | ● | ● | ◐ | · | ● | ● | · | · | ● |
| OS-level sandboxSeatbelt / Landlock / containers | ● | ● | ● | · | · | ◐ | ● | · | ● |
| Per-model system prompts | · | ● | ◐ | · | · | ● | · | · | ◐ |
| Preserved thinking across turns | ● | ● | ◐ | ● | ◐ | ◐ | ● | ● | ◐ |
| Deferred tool loadingschemas fetched on demand | ● | ● | · | · | · | · | · | · | · |
| MCP client | ● | ● | ● | ● | ● | ● | ◐ | · | ● |
| Background / long-running tasks | ● | ● | ◐ | ● | ● | ◐ | ● | · | ● |
Compiled from direct repo reads (Codex, Kimi, Gemini, OpenCode, Hermes FC, DeepSeek dsh) + research on docs/changelogs for closed or product-level features. Treat ◐/· cells as "as of Jul 2026" (DeepSeek column: Aug 2026). DSH plan mode is ◐ because it is deliberately soft guidance — sandbox/approval enforce independently.
Quotes marked ✓ read from source were read directly from the
cloned repos today. Everything else is flagged as reported. Full verbatim files live in
prompts/.
shell, apply_patch (a custom freeform diff grammar with *** Begin Patch envelopes), update_plan. The shell is the universal tool.gpt-5.2-codex_prompt.md (1,221 words) vs prompt_with_apply_patch_instructions.md (3,917 words) for general GPT-5. Trained-in behavior needs no prose."Skip using the planning tool for straightforward tasks (roughly the easiest 25%). Do not make single-step plans."✓ read from source — codex-rs/core/gpt-5.2-codex_prompt.md
"Do not waste tokens by re-reading files after calling `apply_patch` on them. The tool call will fail if it didn't work."✓ read from source — prompt_with_apply_patch_instructions.md
"When doing frontend design tasks, avoid collapsing into 'AI slop' or safe, average-looking layouts… No purple bias or dark mode bias."✓ read from source — gpt-5.2-codex_prompt.md
"You must keep going until the query is completely resolved, before ending your turn… Do NOT guess or make up an answer."✓ read from source — prompt_with_apply_patch_instructions.md
Read the source: codex-tuned prompt base prompt + apply_patch GPT-5.2 variant all variants + notes
"Lead with the outcome… Being readable and being concise are different things, and readable matters more."✓ first-hand — from a live session's system prompt (communication section)
"Report outcomes faithfully: if tests fail, say so with the output… state it plainly without hedging."✓ first-hand — anti-sycophancy rule
Read the source: first-hand harness notes
snippets.ts warns: "You must run the major benchmarks, such as SWEBench, prior to committing any changes to the Context Efficiency section." ✓ read from source<untrusted_context> tags to be treated as passive data.additional_permissions, surfacing an approval modal — turning failures into permission requests."Operate as a strategic orchestrator. Your own context window is your most precious resource… When you delegate, the sub-agent's entire execution is consolidated into a single summary in your history."✓ read from source — packages/core/src/prompts/snippets.ts
"Validation is the only path to finality. Never assume success or settle for unverified changes."✓ read from source — snippets.ts, Primary Workflows
"If you have attempted to fix a failing implementation more than 3 times without success… List your current assumptions and identify which ones might be wrong. Propose a different architectural approach."✓ read from source — Strategic Re-evaluation rule
Read the source: snippets.ts (current) snippets.legacy.ts
agent.yaml with extend, allowed_tools, exclude_tools, role text injected into one shared system.md — users define custom agents the same way.agent_id.<system> = supplementary info; <system-reminder> = authoritative directives that may override behavior.<current_focus>, <code_state>…) with priorities: current task → errors+solutions → final code versions only."You are basically folding the recent messages in your context into a single message, which can significantly reduce the waste of context window… DO NOT explain to the user. The user do not care about this. Just explain to your past self."✓ read from source — src/kimi_cli/tools/dmail/dmail.md
"If you anticipate making multiple non-interfering tool calls, you are HIGHLY RECOMMENDED to make them in parallel… This is very important to your performance."✓ read from source — agents/default/system.md
"ALWAYS, keep it stupidly simple. Do not overcomplicate things."✓ read from source — Ultimate Reminders, system.md
Read the source: system prompt D-Mail tool compaction agent.yaml explore.yaml K2/K3 notes
hashline_read returns every line as an anchor LINE:hash:salt→content; edits reference anchors, not exact strings. Batch edits are atomic — one stale anchor rejects the whole batch, and the error returns fresh anchors so the model retries immediately. Kills the ambiguous-match/stale-file failure mode of exact-string editors.tools.by_kind.read/edit/search/execute/plan/monitor/lsp/memory_* — written against roles, bound to whatever implementation is active. One prompt serves many tool configurations.prompt_encrypted.rs, auto-generated) — the harness is public, parts of the prompt text are obfuscated. Docs live as markdown in ~/.grok/docs/ that the agent reads on demand."Weigh each action by how easily it can be undone and how far its effects reach… One approval is not a blank check. Approving something once (e.g. a git push) does not approve it in every later situation."✓ read from source — xai-grok-agent/templates/prompt.md, action_safety
"Edits are atomic — if any anchor is stale, ALL edits are rejected. Retry the full batch. Never fabricate or modify anchors."✓ read from source — templates/subagent_prompt.md, hashline workflow
"If you find unexpected state — unfamiliar files, branches, or configuration — investigate before deleting or overwriting; it may be the user's in-progress work."✓ read from source — action_safety
Read the source: main prompt subagent + hashline compaction intra-turn compaction notes
anthropic.txt, codex.txt, kimi.txt, gemini.txt, beast.txt, trinity.txt… Its kimi.txt is essentially Kimi CLI's own prompt; gemini.txt mirrors Gemini's Core Mandates. Each model gets the dialect it was trained on.<previous-summary> block and merges new history into it — an incrementally-updated anchor, not a fresh summary each time. ✓ read from source"VERY IMPORTANT: When exploring the codebase… that is not a needle query for a specific file/class/function, it is CRITICAL that you use the Task tool instead of running search commands directly."✓ read from source — session/prompt/anthropic.txt
Read the source: Claude variant GPT variant Kimi variant Gemini variant beast mode compaction
<tools> tags in the system message; calls emitted as JSON inside <tool_call> tags; results in <tool_response>. No API-level tools param needed — became the de-facto standard for open-weights serving (vLLM's hermes parser). ✓ read from source (Hermes-Function-Calling repo)<think> CoT depending on the system prompt — steerability-first, the user's prompt is sovereign.SOUL.md, memory in MEMORY.md, user model in USER.md; post-task reflection auto-writes skills; /learn turns docs into SKILL.md files; trajectories export for training the next model — a closed data flywheel. (reported — repo/docs research)"You are a function calling AI agent with self-recursion… Please keep a running summary with analysis of previous function results… Do not stop calling functions until the task has been accomplished or you've reached max iteration of 10."✓ read from source — prompt_assets/sys_prompt.yml
Read the source: function-calling prompt Hermes 4 + Agent notes
api.z.ai/api/anthropic) + env vars in Claude Code's settings puts GLM-5.2 in the OPUS slot, glm-4.7 in the HAIKU slot. Officially supports Claude Code, Cline, OpenCode. (reported — docs.z.ai)"When develop the fullstack, write the frontend first to let user see the result, then write the backend."✓ read from source — Z.ai Code captured system prompt
Read the source: Z.ai Code prompt GLM strategy notes
cordis.yml composition files.read guidance lives in the read-tool plugin); assembly concatenates, scoped registrations shadow globals, a waterfall event lets experts rewrite. Default render: 702 words, pinned by deterministic snapshot fixtures.compaction/start → summary as a user/message surface-replace → compaction/end; a crash leaves a detectable orphaned lock. Deterministic tool-result pruning (head/tail, code-point-safe) runs first and can avoid the summary call entirely.spawn-in-process, fork-in-process, ACP, Codex, and Claude Code — plus hook bridges that speak Claude Code's hooks.json and Codex's hook formats. Capability flags are checked up front: unsupported requests are "rejected with a typed error rather than accepted-then-ignored.".agents/notes/ (proposed → implemented → archived) are cited by the docs as design authority; type blocks in docs are drift-checked against source in CI. Ships first-party workflow (JS fan-out) and ralph (fresh-agent loop) tools."Your bash tool runs under a file sandbox — a `[sandbox: file access denied …]` result is policy, not a command bug."✓ read from source — snapshots/session/text-turn/system-prompt.expected.md
"Use subagent in the background by default. Start independent delegations together in one assistant message and continue useful work while they run."✓ read from source — rendered default system prompt
"Mark blocked only after the same blocking condition persists for at least 3 consecutive goal rounds… difficulty, uncertainty, or useful remaining work is not blocked."✓ read from source — goal-tools prompt section
"Releasing the lock last turns a crash mid-operation into a detectable orphaned lock… rather than a `compaction/end` that falsely claims compaction finished."✓ read from source — docs/subsystems/compaction.md
Read the source: rendered system prompt Ralph variant repo AGENTS.md full notes
Tool schemas are the silent context tax — dozens of MCP tools can cost 10k+ tokens per request. The fix: ship names only, let the model fetch full schemas on demand via a search tool. Both major harnesses converged on this within months.
Models are now trained expecting their reasoning blocks back in subsequent turns. K3's docs warn that dropping thinking history makes generation "highly unstable"; GLM-5 ships an explicit "Preserved Thinking" mode. Harness and model are co-designed artifacts now — you can no longer treat the transcript as freely editable.
Every read line carries a content-hash anchor; edits target anchors, batches are atomic, and stale-anchor errors return fresh anchors for immediate retry. The first structural answer to the two classic edit-tool failures: ambiguous matches and files that changed underneath you.
Compaction has always been harness-initiated. D-Mail inverts it: the model decides its recent context is waste, picks a checkpoint, and folds everything since into one note to its past self. Expect others to copy this.
The era of one prompt for all models is over. Codex-tuned models get ⅓ the words of general GPT-5; OpenCode ships a different dialect per model family. Corollary: as behavior moves into training, prompts shrink toward pure constraints.
Gemini's repo literally gates edits to the Context Efficiency prompt section behind SWE-bench runs. System prompts have CI now. If you build a harness, version your prompt and regression-test it.
Zhipu treats Claude Code as a commodity interface: Anthropic-compatible API, model trained to the harness's conventions, subscription priced per prompt. The moat moved from scaffold to model-fits-scaffold.
Hermes Agent reflects after tasks and writes its own SKILL.md files; /learn converts docs into skills. The skills format (markdown + frontmatter, lazily loaded) has become the cross-vendor convention — AGENTS.md itself is now a Linux Foundation standard used by 60k+ repos.
Harnesses now tag channel authority explicitly: harness-authored directives vs. supplementary info vs. untrusted external content. The model is taught which wrapper outranks which — a security architecture made of XML tags.
dsh applies "everything is a plugin" to the agent itself: loop, model adapter, session log, sandbox, compaction — all swappable, composed per session from preset files. The system prompt follows: no prompt file, just plugin-owned sections assembled at request time. Claude Code's rules-live-on-tools idea taken to its structural conclusion.
The session is an append-only event log; the model-visible transcript is a projection over it. Compaction becomes a logged, lock-bracketed transaction (crashes leave detectable orphaned locks), token accounting is replayable via shadow-price events, and 175 snapshot fixtures pin the exact rendered prompt — the whole harness is regression-tested like a database.
Instead of only borrowing a harness (GLM) or only building one, dsh absorbs the ecosystem: Claude Code and Codex are subagent backends, and their hook formats are supported natively. Your existing hooks.json works; your existing CLIs become delegation targets. Interop as a wedge for selling V4 tokens.
Everything above compresses into one loop, ten decisions, and a build order. The loop is genuinely this small — ship v0 in a day, then earn each layer of sophistication.
msgs = [system_prompt(cwd, os, date, agents_md)] # stable prefix — never edit, only append
msgs.append(user_msg)
while True:
resp = model(msgs, tools=[shell, read, edit, write, todo])
msgs.append(resp)
if not resp.tool_calls:
break # plain text = final answer
for call in resp.tool_calls: # execute (parallel if independent)
gate(call) # permission check / sandbox
msgs.append(tool_result(call, run(call), cap=25_000)) # cap output tokens
if tokens(msgs) > 0.8 * window:
msgs = [msgs[0], compact(msgs), *msgs[-K:]] # dedicated summarizer prompt
Stable prompt prefix, append-only transcript, no timestamps in the system prompt, mask/defer tools instead of adding/removing them. Manus: cache hit rate is the single most important metric (10× cost difference).
Codex proves 3 tools suffice. Start: shell + read + exact-string edit + write + todo. Every tool schema is a permanent tax on every request.
Uniqueness-checked old/new strings (Claude/Gemini/Cline style) is easier to implement and debug than Codex's diff grammar. Fail loudly on ambiguity.
1–2k words: identity, editing rules, git safety ("never reset --hard", "don't commit unless asked"), verification-before-done, output format. Write per-model variants. Version it, benchmark it.
Let the agent write notes/plans to disk and re-read them. Compress context by dropping bodies but keeping restorable pointers (paths, URLs). Recite the todo list near the context tail.
Dedicated summarizer prompt with a structured schema (Kimi's XML sections, OpenCode's anchored previous-summary merge). Keep: current task, errors+solutions, decisions, file paths. Preserve thinking blocks if the model expects them.
Adopt AGENTS.md (it's a standard now; closest-file-wins, chat overrides everything). Add an auto-memory dir with an index file. No vector DB until markdown fails you.
Codex's two axes: sandbox (what's technically possible: read-only / workspace-write / full) × approval (when to stop and ask). Add hooks so policy is deterministic, not model-obeyed.
Fan out read-only explore agents that return 1–2k-token reports; keep a single writer. This is the cheapest 10× on effective context you can build.
Wrap harness injections, tool output, and external content in distinct tags; teach the model the precedence order. This is your prompt-injection defense and your steering channel.