Getting it into your agent
One page per mod, every tool's command on it. A separate URL per tool would split the same page into five that compete with each other.
npx skills add keli-wen/agentic-harness-patterns-skill --skill agentic-harness-patterns-zhgit clone --depth 1 https://github.com/keli-wen/agentic-harness-patterns-skillWrote this? Show the measurements
A badge with what this costs and how it scanned, read live from this page, so it follows the numbers instead of freezing them. Markdown for a README, HTML for a documentation site or a project page.
[](https://agentmods.dev/skills/keli-wen/agentic-harness-patterns-skill/agentic-harness-patterns-zh)<a href="https://agentmods.dev/skills/keli-wen/agentic-harness-patterns-skill/agentic-harness-patterns-zh"><img src="https://agentmods.dev/badge/skills/keli-wen/agentic-harness-patterns-skill/agentic-harness-patterns-zh/github.svg" alt="Measured on agentmods" height="20"></a>Or the 80×15 button, for a site that already has a row of RSS and ATOM ones. Only the verdict fits; the numbers stay here.
<a href="https://agentmods.dev/skills/keli-wen/agentic-harness-patterns-skill/agentic-harness-patterns-zh"><img src="https://agentmods.dev/badge/skills/keli-wen/agentic-harness-patterns-skill/agentic-harness-patterns-zh.svg" alt="Reviewed on agentmods" width="80" height="20"></a>What it costs to keep this loaded
Counted locally with the o200k_base tokenizer, which is exact for GPT models; Claude uses its own tokenizer and its counts differ. Treat this as one consistent yardstick across the catalogue rather than a bill. Prices are per million input tokens.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00037 | $0.04210 |
| Opus 5 | $0.00018 | $0.02105 |
| Sonnet 5 | $0.00007 | $0.00842 |
| Haiku 4.5 | $0.00004 | $0.00421 |
Grade A, and why
agentic-harness-patterns-zh scanned grade A with 0 findings against 26 rules in 11 categories — prompt injection, anti-refusal, data exfiltration, privilege escalation, supply chain, agent snooping, system-prompt leakage, SSRF and excessive agency — measured 10d ago.
A static scan of the body, not an audit. Every finding is printed with the line that produced it so you can judge whether it matters here. A mod is markdown that instructs an agent; that is exactly why what it instructs is worth reading.
Nothing flagged
None of the 26 patterns this scan looks for appear in this file: no shell pipes, no recursive deletes, no credential paths, no hidden text, no instruction-override or anti-refusal phrasing, no agent-config snooping. That is not a guarantee, it is the absence of the things that are checkable.
How it starts
The opening of the file, as written. The whole thing — 251 lines — stays where its author put it; the contents beside it link to each section on GitHub.
Agentic Harness Patterns(中文版)
生产级 AI 编程助手不只是"大模型 + 工具调用循环"。循环本身很简单。Harness — 记忆、技能、安全、上下文控制、委派、可扩展性 — 才是让 Agent 可靠、安全、大规模运行的关键。
适合: 正在构建或扩展 AI Agent 运行时、自定义 Agent、或高级多 Agent 工作流的工程师。 不适合: Prompt 工程、模型选择、通用软件架构、LLM API 入门。
所有原则均从生产级运行时决策中提炼而来。Claude Code 作为实证依据,而非唯一实现。
选择你的问题
| 你想要... | 阅读 |
|---|---|
| 让 Agent 跨会话记住并持续改进 | 记忆系统 |
| 打包可复用的工作流和专业知识 | 技能系统 |
| 让 Agent 强大地使用工具但不危险 | 工具与安全 |
| 给 Agent 正确的上下文、合理的成本 | 上下文工程 |
| 将工作拆分给多个 Agent 而不失控 | 多 Agent 协调 |
| 通过 Hook、后台任务或启动逻辑扩展行为 | 生命周期与可扩展性 |
开始构建之前: 先读 踩坑指南 — 这些是最不直觉但最烧时间的失败模式。
1. 记忆系统
用户痛点: "我的 Agent 下次对话就忘了所有纠正和项目规则。"
黄金法则: 区分 Agent 知道的(指令记忆)、Agent 学到的(自动记忆)、和 Agent 提取的(会话记忆)。三层的持久性、信任度、审查需求各不相同。
适用场景: 任何跨会话运行或需要持续积累项目知识的 Agent。
工作原理:
- 指令记忆 是人工策划的、分层的配置,按优先级注入系统上下文(组织级 → 用户级 → 项目级 → 本地级;本地优先)。项目编码规范、行为规则都在这里。它是人类编写的,稳定不变。
- 自动记忆 是 Agent 自主写入的持久知识,带有类型分类法(用户 / 反馈 / 项目 / 引用)和有上限的索引。写入是两步操作:先写主题文件,再更新索引。上限防止无限增长 — 不清理的话,新条目会被静默截断。
- 会话提取 以后台 Agent 的形式在会话结束时运行。它直接写入自动记忆 — 先主题文件再索引 — 遵循相同的两步保存不变式。互斥锁确保:如果主 Agent 在当轮已经写过记忆,提取器直接跳过。这是自主学习循环。
- 审查与晋升 审计所有记忆层并提议跨层移动(自动记忆 → 项目规范、个人设置或团队记忆)。它永远不自主应用更改 — 提议需要用户明确批准。
从这里开始: 定义你的记忆层(指令、自动、提取)。实现两步保存不变式(先主题文件,再索引)。核心写入路径稳定后再加后台提取。
在 Claude Code 中: 使用
/remember审计和晋升各层自动记忆条目。
权衡:
- 更多记忆层 = 更丰富的回忆但更高的维护负担。不定期清理的话,索引上限导致静默数据丢失。
- 会话提取在会话结束时增加延迟,但大幅提升跨会话学习能力。
深入阅读: references/memory-persistence-pattern.md
2. Skills 系统
用户痛点: "我想让 Agent 复用工作流和领域知识,不用每次重新解释。"
黄金法则: 技能是懒加载的指令集,不是立即注入的 prompt。发现必须廉价(仅元数据);完整内容只在激活时加载。
适用场景: 任何需要可复用、可组合工作流并根据用户意图匹配激活的 Agent。
工作原理:
- 发现 是预算约束的:Agent 看到所有可用技能的紧凑列表(名称、描述、触发提示拼接在一起),每条硬限在固定字符数,总量限制在上下文窗口的约 1%。把触发关键词放在前面 — 后面会被截断。
- 加载 是懒的:只有元数据进入始终在线的上下文。完整技能内容只在激活时加载,闲置 token 成本接近零。
- 执行 可以是内联的(共享上下文)或隔离的(fork 子 Agent,有自己的 token 预算)。隔离防止重型技能耗尽父级上下文。
- 来源 可以是内置的、用户安装的、或从插件动态加载的。通过规范路径去重,防止同一技能在重叠的源目录中出现两次。
What ships with it
13 files beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.
- metadata.json 459 B
- references/agent-orchestration-pattern.md 12 KB
- references/bootstrap-sequence-pattern.md 12 KB
- references/context-engineering-pattern.md 2.1 KB
- references/context-engineering/compress-pattern.md 7.2 KB
- references/context-engineering/isolate-pattern.md 8.4 KB
- references/context-engineering/select-pattern.md 7.8 KB
- references/hook-lifecycle-pattern.md 13 KB
- references/memory-persistence-pattern.md 12 KB
- references/permission-gate-pattern.md 13 KB
- references/skill-runtime-pattern.md 13 KB
- references/task-decomposition-pattern.md 7.9 KB
- references/tool-registry-pattern.md 11 KB
What this file has done since we first saw it
Hashed on every crawl. A supply-chain change to an agent config is a question of when, not whether, so the history is kept rather than the latest state alone.
- 10d ago First seen · 251 lines · 37 tokens per session scan A c660f405de2d
agentic-harness-patterns-zh is a skill published in the GitHub repository keli-wen/agentic-harness-patterns-skill (302 stars, last pushed 5mo ago), licensed MIT. It adds 37 tokens to every session and 4,210 once invoked, about $0.0002 per session on Opus 5. A static security scan graded it A with 0 findings. No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-30.
Other skills, from other repositories
harness-creator
Build, audit, and improve harnesses that make AI coding agents reliable: AGENTS.md/CLAUDE.md instruction files, feature/state tracking, verification gates, scope boundaries, session handoff, memory persistence, context budgets, tool-permission safety, and multi-agent coordination. Use this whenever a coding agent is…
openloomi-memory
OpenLoomi Memory is the long-lived context layer of OpenLoomi — a tiered, locally-stored knowledge graph that grows on its own from your Connectors, chats, and Screen Capture. Memory is what makes Chat grounded and what Loop reads before it produces a Decision. It is always on your machine (local-first), always…
continual-learn
Persist learning across turns by actively maintaining MENTALMODEL.md in the workspace. Use for iterative coding, debugging, benchmarking, or any feedback-driven task; read and update the file with actual filesystem writes before every response, never just hidden/internal memory.
algorithmic-art
Creating algorithmic art using p5.js with seeded randomness and interactive parameter exploration. Use this when users request creating art using code, generative art, algorithmic art, flow fields, or particle systems. Create original algorithmic art rather than copying existing artists' work to avoid copyright…
slack-gif-creator
Toolkit for creating animated GIFs optimized for Slack, with validators for size constraints and composable animation primitives. This skill applies when users request animated GIFs or emoji animations for Slack from descriptions like "make me a GIF for Slack of X doing Y".
mcp-builder
Guide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external agents through well-designed tools. Use when building MCP servers to integrate external APIs or agents, whether in Python (FastMCP) or Node/TypeScript (MCP SDK).