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 ZhangShenao/harness9 --skill architecture-overviewgit clone --depth 1 https://github.com/ZhangShenao/harness9Wrote 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/zhangshenao/harness9/architecture-overview)<a href="https://agentmods.dev/skills/zhangshenao/harness9/architecture-overview"><img src="https://agentmods.dev/badge/skills/zhangshenao/harness9/architecture-overview/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/zhangshenao/harness9/architecture-overview"><img src="https://agentmods.dev/badge/skills/zhangshenao/harness9/architecture-overview.svg" alt="Reviewed on agentmods" width="80" height="20"></a>- NVIDIA SkillSpector pass
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.00024 | $0.01051 |
| Opus 5 | $0.00012 | $0.00526 |
| Sonnet 5 | $0.00005 | $0.00210 |
| Haiku 4.5 | $0.00002 | $0.00105 |
Grade A, and why
architecture-overview 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 — 129 lines — stays where its author put it; the contents beside it link to each section on GitHub.
harness9 架构概览
核心设计原则
| 原则 | 说明 |
|---|---|
| 简洁 | 最小化抽象层,极少的直接依赖 |
| 完备 | 覆盖 Agent 运行所需的全部核心模块 |
| 生产可用 | 错误恢复、超时控制、路径沙箱、并发安全 |
标准 ReAct 循环
Turn N:
LLM(messages + tools) → 推理 + 工具调用决策
→ 并发执行所有工具调用 → Observation 注入 context
→ Turn N+1
自然终止:模型不再发起工具调用 → 输出最终回复
三重终止保障:
- 自然终止:
len(responseMsg.ToolCalls) == 0 - MaxTurns:默认 50,可通过
WithMaxTurns配置 - Context 取消:外部
cancel()或超时
模块依赖关系
cmd/harness9 (入口)
├── internal/context (System Prompt 组装)
│ └── internal/skills (Skills 解析 + 索引)
├── internal/engine (ReAct 主循环)
│ ├── internal/provider (LLM 调用)
│ ├── internal/tools (工具注册 + 执行)
│ └── internal/schema (数据类型)
└── internal/env (配置加载)
关键设计决策:接口定义在使用者侧
tools.Registry接口定义在tools包,engine包依赖它engine.PromptBuilder接口定义在engine包,context包实现它skills.UseSkillTool通过 Go 结构类型满足tools.BaseTool接口,不需要 importtools包(避免循环依赖)
关键数据流
TUI 模式
用户输入 → RunTUI → eng.RunStream(ctx, prompt)
→ engine.Event stream → 逐 token 追加到对话视图
→ ToolCalls → Spinner 动画 + 耗时计数
→ EventDone → 最终回复渲染到屏幕
CLI 模式(管道 / CI)
用户输入 → RunCLI → eng.Run(ctx, prompt)
→ runLoop → LLM Generate
→ ToolCalls → 并发执行 → ToolResults → 继续循环
→ 最终回复打印到 stdout
System Prompt 组装
DefaultPromptBuilder.Build() 按顺序组装:
- 基础 Prompt:角色定义 + workDir
- AGENTS.md:项目级规范(文件不存在时跳过)
- Skills 索引:
- name: description列表(为空时跳过)
完整内容示例:
You are harness9, an expert coding assistant...
## Project Guidelines (AGENTS.md)
{AGENTS.md 全文}
## Available Skills
Use the `use_skill` tool to load full content of any skill when needed.
- go-coding-standards: Use when writing or reviewing Go code...
- debugging-guide: Use when debugging Go errors...
Provider 抽象
type LLMProvider interface {
Generate(ctx, messages, tools) (Message, error)
GenerateStream(ctx, messages, tools) (<-chan StreamChunk, error)
}
当前实现:
OpenAIProvider:兼容所有 OpenAI Chat Completions API(包括 OpenRouter、Azure)AnthropicProvider:Anthropic Messages API
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 · 129 lines · 24 tokens per session scan A 630805dc0190
architecture-overview is a skill published in the GitHub repository ZhangShenao/harness9 (138 stars, last pushed today), licensed MIT. It adds 24 tokens to every session and 1,051 once invoked, about $0.0001 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
systematic-debugging
Use when encountering any bug, test failure, or unexpected behavior, before proposing fixes.
local-ai-agents
Build local-first AI agents that run entirely on a developer workstation with Microsoft Foundry Local and Qwen function-calling models. Covers Small Language Models (SLMs), the OpenAI-compatible local endpoint, sandboxed local tools, local RAG with Chroma, local MCP servers, hybrid cloud/local routing, and the…
next-cache-components-adoption
Turn on Cache Components in a Next.js app and resolve the blocking routes it surfaces. Use when the user wants to enable, adopt, or migrate to Cache Components, flip the cacheComponents flag, work through a flood of blocking-prerender / instant validation errors, run the cache-components-instant-false codemod, or…
insight-error-page
Write or audit an insight-kind error page for the Next.js dev overlay. Use when creating a new errors/ .mdx page, auditing an existing one, or checking that a page matches the framework fix cards. Covers page structure, title alignment, FixCard cards with Copy prompt button, code snippets, terminology verification…
next-cache-components-optimizer
Drive a Next.js route to instant navigation by setting up an agentic loop, under Cache Components / PPR, on initial load (hard navigation) and client-side navigation (soft navigation). Encode the goal as a failing @next/playwright instant() e2e and work it to green, one verified route at a time; the shipped test then…
next-partial-prefetching-adoption
Turn on Partial Prefetching in a Next.js app and work through the insights it surfaces. Use when the user wants to enable or adopt Partial Prefetching, flip the partialPrefetching flag, opt routes in with export const prefetch = 'partial', audit Link prefetch={true} behavior, preserve existing prefetched UI with…