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 agentmods add instructions/linearuncle/xharness/agents-mdgit clone --depth 1 https://github.com/linearuncle/xharnessWhat 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 | $0.03406 | $0.03406 |
| Opus 5 | $0.01703 | $0.01703 |
| Sonnet 5 | $0.00681 | $0.00681 |
| Haiku 4.5 | $0.00341 | $0.00341 |
Grade B, and why
xharness AGENTS.md scanned grade B with 1 finding 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 2d 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.
Asks for rootmediumPrivilege escalation
A mod that escalates privileges can change anything on the machine, not only the project.
WAL 模式,三个库文件均 chmod 600——侧车不继承主库权限,openDb 时补 chmod)。 How it starts
The opening of the file, as written. The whole thing — 165 lines — stays where its author put it; the contents beside it link to each section on GitHub.
CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
常用命令
npm run build # tsc 编译 src/ → dist/(GUI 依赖 dist,改核心后必须重建)
npx tsc --noEmit # 类型检查
npm test # 单测(vitest unit project,API 全 mock,不耗 token)
npx vitest run --project unit test/unit/loop.test.ts # 跑单个测试文件
npm run test:e2e # E2E(先 build;需 ANTHROPIC_API_KEY/DEEPSEEK_API_KEY,无 key 整体 skip)
node dist/index.js -p "..." # CLI 一次性模式(冒烟最快路径)
cd gui && npm start # 启动 Electron GUI(dev)
cd gui && node scripts/package-app.mjs # 打包 release/xharness.app + mac-<arch>.zip
杀 GUI 进程用 pkill -f "MacOS/xharness"(Electron bundle 已被 postinstall 改名为
xharness.app,匹配 "Electron" 会失手)。GUI 调试/测试走 CDP
(--remote-debugging-port=9223 + 原生 WebSocket 直连,gui/scripts/cdp-eval.mjs
驱动),完整方案与标准冒烟检查见 docs/cdp-testing.md。
仓库形态
两个交付物,一个引擎:
- CLI(
src/→dist/,Node >= 22,ESM):终端 REPL /-p一次性模式。 - GUI(
gui/,Electron):不复制引擎代码,主进程直接import "../dist/..."。 改src/后不npm run build,GUI 看不到变化。
GOAL.md 是产品规格(含各条设计决策与变更日期);docs/internal/ 是开发过程记录
(GoalBuddy 任务板、评审报告),改代码前有疑义先查 GOAL.md 对应条目。
核心架构与硬约束
分层铁律(违反即错,评审按此核对)
src/api/是唯一接触供应商 SDK 与原始流事件的层,对外只发归一化领域事件 (text_delta | thinking_delta | tool_start | tool_end | error | turn_end):client.ts= 接口 + 共享重试/流聚合 + 按config.apiFormat分发;anthropic.ts= Messages 格式(唯一碰@anthropic-ai/sdk);responses.ts= OpenAI Response 格式(零依赖 fetch+SSE,翻译成 RawStreamEvent 复用聚合)。src/agent/loop.ts只做回合编排:不碰 SDK、不读process.env、不解析原始流、不内联压缩。src/ui/render.ts只消费领域事件。src/config.ts的loadConfig()是全项目唯一process.env读取点。- 工具(
src/tools/)只做副作用与返回,不感知会话状态;异常一律转isError:true的 ToolResult,不外抛。registry 禁止按工具名写特殊分支。
不变量:tool_use / tool_result 配对
history 中每个 tool_use 必须有配对 tool_result,否则官方 Anthropic 端点直接 400。
所有取舍(中断、上限 200 触顶、AskUserQuestion 被 SIGINT/EOF 打断)都用 is_error
占位块回填来保住配对——修改 loop/中断路径时此约束优先于其他一切语义。
单测里有 expectAllToolUsesPaired 辅助断言,改动相关逻辑必须覆盖。
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.
- 2d ago First seen · 165 lines · 3,406 tokens per session scan B 8c4893456cc1
xharness AGENTS.md is an instructions file published in the GitHub repository linearuncle/xharness (10 stars, last pushed 29d ago), licensed MIT. It adds 3,406 tokens to every session, about $0.0170 per session on Opus 5. A static security scan graded it B with 1 finding (asks for root). No closer match exists in the catalogue, so it is treated as the original; first seen 2026-08-31.
Other instructions, from other repositories
mulmoterminal CLAUDE.md
Instructions for receptron/mulmoterminal, covering claude.md — mulmoterminal, stack & package manager, run after changes, import a component at module scope, never inside a test and no emojis.
nightshift AGENTS.md
Instructions for orwa-mahmoud/nightshift: AI-assisted contributions are welcome. The same correctness, security, licensing, testing, and quality standards apply regardless of which tools are used.
vibe-coding-ai-rules react.instructions.md
Instructions for obviousworks/vibe-coding-ai-rules, covering react patterns, component structure, state management, performance and error handling.
KDD AGENTS.md
Instructions for MauricioPerera/KDD: Este repositorio usa la metodología KDD (Knowledge-Driven Development). Las reglas obligatorias completas están en .agents/AGENTS.md y la skill local en .agents/skills/kdd-okf-ccdd-hybrid/SKILL.md.
AmbyKit CLAUDE.md
Instructions for ambystechcom/AmbyKit, covering claude code — notes for the ambykit repo and claude-specific.
eai-gofer language-server.instructions.md
Instructions for eai-support/eai-gofer, covering language server development instructions, architecture, key files, mcp tools (6 total) and adding new mcp tools.