agentic-harness-patterns-skill

作者 keli-wen已验证

Agent skill for harness engineering — memory, permissions, context engineering, multi-agent coordination. Distilled from Claude Code, with Codex CLI and Gemini CLI on the roadmap. EN/ZH. Install via npx skills add.

298
Stars
48
Forks
2026/8/23
添加时间

⚠️ 第三方软件声明

本 Skill 为第三方开源软件,独立托管于 GitHub。SkillTip 仅为信息目录,不控制或维护底层仓库。所显示的安全检查为自动化且范围有限,安装前请自行审查源码。

阅读服务条款

安装

添加到你的 Claude Code skills 目录:

# Add to your Claude Code skills
git clone https://github.com/keli-wen/agentic-harness-patterns-skill

快速入门

使用 agentic-harness-patterns-skill 等 Skills 的指南。

安全报告

已验证

上次扫描:—

{
  "status": "PASSED",
  "issues": []
}

README.md

Agentic Harness Patterns

License: MIT Skills Compatible Claude Code

Production design patterns for AI coding agents, distilled from 512,000 lines of Claude Code.

English · 中文


[!TIP] How this was built: Read the Distilling Claude Code Source — A Harness Engineering Practice Log for the full story of how Codex and Claude Code collaborated, the PCA-inspired taste injection, and what worked (and didn't).

The model loop is easy. User -> LLM -> tool_use -> execute -> loop fits on a napkin. What makes a production agent actually work — reliably, safely, at scale — is everything around the loop: memory that persists across sessions, permissions that fail closed, context budgets that don't explode, multi-agent coordination that doesn't collapse into chaos, and extensibility that doesn't become a security hole.

Anthropic calls this the harness. This repo teaches you how to build one.

[!NOTE] This skill is compatible with the open agent skills ecosystem. Install with npx skills add — works with Claude Code, Codex, and 40+ other agents.

What This Is

6 design-pattern chapters and 11 deep-dive references, extracted from systematic source-level analysis of the Claude Code runtime — the production AI coding agent behind Claude's 512,000-line TypeScript codebase.

[!IMPORTANT] This is not a code dump or a source mirror. Every pattern is expressed as a portable, runtime-agnostic design principle. Claude Code is used as grounding evidence, not as the only possible implementation. If you're building an agent on a different stack, these patterns still apply.

Also not: A Claude Code user guide / prompt engineering tutorial / "agents 101" / model selection guide.

Who Should Read This

Engineers building or extending:

  • Coding-agent runtimes (like Claude Code, Codex CLI, Gemini CLI, Cursor, Windsurf)
  • Custom agents and agent plugins
  • Multi-agent orchestration systems
  • Any production system where an LLM calls tools in a loop and needs to be reliable

The Six Harness Layers

#PatternThe Problem It SolvesKey Insight
1Memory"My agent forgets everything between sessions"Separate instruction memory (human-curated) from auto-memory (agent-written) from session extraction (background-derived). Each has different trust, persistence, and review needs.
2Skills"I re-explain workflows every conversation"Skills are lazy-loaded instruction sets. Discovery must be cheap (~1% of context window); full body loads only on activation. Front-load trigger language — tails get truncated.
3Tools & Safety"I want tools powerful but not dangerous"Default to fail-closed. Concurrency is per-call, not per-tool. The permission pipeline has side effects — it tracks denials, transforms modes, and updates state.
4Context Engineering"My agent sees too much, too little, or the wrong thing"Four operations: select (just-in-time loading), write (the learning loop), compress (reactive compaction), isolate (delegation boundaries).
5Multi-agent"I need parallelism without chaos"Three patterns: Coordinator (zero-inheritance), Fork (full-inheritance, single-level), Swarm (flat peer roster). The coordinator must synthesize, not delegate understanding.
6Lifecycle"I need hooks, background tasks, startup sequence"Hook trust is all-or-nothing. Task eviction is two-phase. Bootstrap is dependency-ordered with trust as the critical inflection point.

[!TIP] Each pattern includes: Problem -> Golden Rules -> Start Here (actionable first step) -> Tradeoffs -> Gotchas -> Claude Code Evidence. Start with the "Choose Your Problem" table in SKILL.md.

Deep-Dive References

11 reference documents, each following the same structure: Problem (universal) -> Golden Rules (portable) -> Implementation Patterns (no code) -> Gotchas -> Claude Code Evidence (natural language).

ReferenceCovers
memory-persistence-patternFour-level instruction hierarchy, four-type auto-memory, background extraction with mutual exclusion
skill-runtime-patternFour-source discovery, YAML frontmatter contract, budget-constrained listing, graceful degradation
tool-registry-patternFail-closed builder, per-call concurrency, partition-sort-concatenate for cache stability
permission-gate-patternSingle gate, three behaviors, strict layered evaluation, atomic claim for race-safe resolution
agent-orchestration-patternMutual exclusion of modes, fork cache optimization, flat swarm topology, tool filtering layers
context-engineeringIndex: select / compress / isolate sub-pattern routing
select-patternPromise memoization, three-tier progressive disclosure, manual cache invalidation
compress-patternTruncation with recovery pointers, reactive compaction, snapshot labeling
isolate-patternZero-inheritance default, single-level fork boundary, worktree-based filesystem isolation
hook-lifecycle-patternSingle dispatch, all-or-nothing trust, six hook types, exit-code discipline
task-decomposition-patternTyped prefixed IDs, strict state machine, disk-backed output, two-phase eviction
bootstrap-sequence-patternDependency-ordered init, trust-split env vars, memoized concurrent callers, fast-path dispatch

How This Was Built

[!NOTE] Not by reading docs or guessing from external behavior.

  1. Deep exploration — 4 parallel agents mapped the full source tree (~1,900 files)
  2. Source-grounded drafting — 7 parallel agents each drafted one reference, tracing claims to source files
  3. Factual review — 3 independent review rounds verified each claim against source code
  4. Abstraction uplift — Implementation details pushed into "Evidence" sections; principles generalized to be runtime-portable
  5. UX audit — Discoverability, audience fit, and principle-to-action gap reviewed from user perspective

For the full story — how Codex and Claude Code collaborated, the handoff protocol, what worked and what didn't — see Distillation Process.

Installation

[!TIP] Two skills available: agentic-harness-patterns (English) and agentic-harness-patterns-zh (Chinese). Install via the Vercel Skills CLI — works with Claude Code, Codex, and 40+ other agents.

npx skills add github:keli-wen/agentic-harness-patterns-skill

npx skills add screenshot

Just reading: Open SKILL.md (EN) or SKILL.md (ZH).

Project Structure

agentic-harness-patterns/
├── README.md                                       # This file (EN)
├── README_ZH.md                                    # 中文版
├── LICENSE
└── skills/
    ├── agentic-harness-patterns/                   # English skill
    │   ├── SKILL.md
    │   ├── metadata.json
    │   └── references/                             # 11 deep-dive documents
    │       ├── memory-persistence-pattern.md
    │       ├── skill-runtime-pattern.md
    │       ├── permission-gate-pattern.md
    │       ├── agent-orchestration-pattern.md
    │       ├── tool-registry-pattern.md
    │       ├── hook-lifecycle-pattern.md
    │       ├── task-decomposition-pattern.md
    │       ├── bootstrap-sequence-pattern.md
    │       ├── context-engineering-pattern.md       # Index → 3 sub-files
    │       └── context-engineering/
    │           ├── select-pattern.md
    │           ├── compress-pattern.md
    │           └── isolate-pattern.md
    └── agentic-harness-patterns-zh/                # 中文 skill
        ├── SKILL.md                                # Chinese translation
        ├── metadata.json
        └── references/                             # Chinese references
            └── ...

Roadmap

This skill currently covers patterns distilled from Claude Code — arguably the most mature open-source-available agent harness. The long-term goal is to build a unified, cross-runtime pattern library by analyzing additional production agent systems:

RuntimeStatusNotes
Claude CodeDoneCurrent release — 6 chapters, 11 references
Codex CLIPlannedOpenAI's agent CLI; distinct context and delegation model
Gemini CLIPlannedGoogle's approach to tool orchestration and memory
Unified synthesisFutureCross-runtime patterns that survive all three implementations

The hypothesis: patterns that independently emerge across Claude Code, Codex, and Gemini CLI are likely fundamental to the problem domain, not artifacts of any single team's design taste.

Further Reading

For a deeper exploration of context engineering, see the author's blog One Poem Suffices:

A deep dive into context engineering in Claude Code is currently in progress.

Related Work


[!WARNING] Disclaimer: These patterns were distilled by studying the Claude Code source code that was made publicly available. This project is for educational and learning purposes only. No proprietary source code is reproduced. All content represents independently extracted design principles expressed in the author's own words. Claude Code is a trademark of Anthropic, PBC.

License

MIT — see LICENSE.

常见问题

What is agentic-harness-patterns-skill?

agentic-harness-patterns-skill is an open-source ai agents skill for AI coding assistants such as Claude Code, Codex CLI, and ChatGPT, built by keli-wen. Agent skill for harness engineering — memory, permissions, context engineering, multi-agent coordination. Distilled from Claude Code, with Codex CLI and Gemini CLI on the roadmap. EN/ZH. Install via npx skills add. It has 298 GitHub stars.

Is agentic-harness-patterns-skill safe to use?

Yes. agentic-harness-patterns-skill passed SkillsLLM's automated security scan — a dependency vulnerability audit plus prompt-injection heuristics — with no high-severity issues. You can read the full report in the Security Report section on this page.

How do I install agentic-harness-patterns-skill?

Clone the repository with "git clone https://github.com/keli-wen/agentic-harness-patterns-skill" and add it to your Claude Code skills directory (see the Installation section above).

Are there alternatives to agentic-harness-patterns-skill?

Yes. SkillsLLM lists many other AI Agents skills you can browse and compare side by side. Open the AI Agents category from the badge at the top of this page, or use the Related Skills and comparison links further down to weigh agentic-harness-patterns-skill against similar tools.

评论 (0)

暂无评论,成为第一个分享想法的人!

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情

claude-code

by anthropics

Claude Code is an agentic coding tool that lives in your terminal, understands your codebase, and helps you code faster by executing routine tasks, explaining complex code, and handling git workflows - all through natural language commands.

120,03119,897Shell
AI 智能体
查看详情

开发者还喜欢

基于喜欢此 Skill 的开发者投票和收藏

ECC

by affaan-m

10

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

242,21936,702JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情
15

An agentic skills framework & software development methodology that works.

234,96620,863Shell
AI 智能体ai-agentsbrainstorming
查看详情

hermes-agent

by NousResearch

10

The agent that grows with you

234,43747,175Python
AI 智能体ai-agentsagent-orchestration
查看详情

n8n

by n8n-io

12

Fair-code workflow automation platform with native AI capabilities. Combine visual building with custom code, self-host or cloud, 400+ integrations.

201,88160,308TypeScript
MCP 服务器apisai-tools
查看详情

The agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.

185,94028,768JavaScript
AI 智能体ai-agentsanthropicclaude-code
查看详情

cc-switch

by farion1231

3

A cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Grok Build & Hermes Agent. Only official website: ccswitch.io

128,8688,826Rust
AI 智能体claude-codeai-tools
查看详情