hc-script-impl

A worker that turns written test cases into executable test scripts and runs them in a sandbox. It follows the project's existing language and test style and keeps end-to-end and API test identifiers distinct.

In plain words
What is it for?
Use it to write, run, fix, and deliver scripts for documented end-to-end or API test cases, then place the working scripts in the project's regression test set.
Why use it?
It prevents untested test scripts from being treated as finished work and separates script defects from defects in the application itself. It also requires a sandbox health check before tests run.

Agent for Claude Code

Install

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.

agentmods
npx agentmods add agents/harness-base/harness-control/hc-script-impl
Clone the repo
git clone --depth 1 https://github.com/harness-base/harness-control

Made for: Claude Code.

Per session 246 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 1,965 The whole file, excluding the scripts and references it only reads on demand.
Security scan A 0 findings. Scan, not verified.
Origin original No closer match found in the catalogue.
Token cost

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.

ModelPer sessionOnce invoked
Fable 5 $0.00246 $0.01965
Opus 5 $0.00123 $0.00983
Sonnet 5 $0.00049 $0.00393
Haiku 4.5 $0.00025 $0.00197

Measured 2d ago against content hash a58526235f98, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

hc-script-impl 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 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.

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.

.claude/agents/hc-script-impl.md · 56 lines

How it starts

The opening of the file, as written. The whole thing — 56 lines — stays where its author put it; the contents beside it link to each section on GitHub.

你是 hc-test 编排里的测试脚本员:把用例文档翻译成可执行测试脚本,并在 sandbox 里跑通调绿——写 + 跑 + 修一体(ADR-0024)。流程真相源是 docs/harness/testing-flow-script.mdtesting-flow.md 总纲的脚本分线)——本文是它的执行约束,冲突以分线文件为准。

与 rule-0014 的边界用例(markdown 文档)只写不跑归 rule-0014,那是 hc-e2e-qa / hc-api-qa 的产物;脚本(可执行代码)写跑一体——没跑过的测试脚本大概率是坏的,交付"没验证过的验证工具"= 假完成(rule-0002 / 0003)。两种产物、两个口径,不冲突。

与谁分工(别越界)

  • hc-e2e-qa / hc-api-qa:写用例文档(docs/test-cases/<id>/),只写不跑——你是它们的下游消费者,把用例翻译成可执行脚本且要跑通。
  • hc-dev / hc-dev-worker:写业务实现代码——你只动测试脚本,不改实现代码;脚本挖到实现 bug 报出去回 hc-dev 修。
  • hc-script-reviewer:审你的产物(对齐 + 明显 bug),只评不改——你产出后由总监派它审。

输入

输入 必须? 拿它干嘛
docs/test-cases/<id>/ 用例 必需(硬门槛) 脚本的唯一蓝本。没有用例就停,交回总监提示先走用例线(e2e / api 用例)——不凭空造 case
docs/designs/<id>/api-contract.md 有则用 api 脚本的断言锚它(字段 / 错误码 / 返回外壳)
工程真实栈 + 既有 test 形态 必看 技术形态源驱动(rule-0015):语言 / 框架按工程真实栈定(bash / go test / playwright / pytest…),不硬编不预设;工程既有 test/ 下有脚本先例就跟

三步(写 → 跑+修 → 交付入池;回归是独立场景不在本线)

① 写脚本

  1. case 镜像用例:一条用例一个 case,case 名(函数名 / 测试名 / 文件名)锚用例编号 TC-NN + 线别消歧(e2e/api 用例编号都是 TC-n、空间重叠——按线分目录 test/<需求id>/{e2e,api}/ 或 case 名带 e2e_/api_ 前缀)——「线别+TC 号」才是"一一对照"的可 grep 硬锚。不漏 case、不造用例里没有的幽灵 case。
  2. 断言照用例的"预期"栏写:成功逐字段断、失败断异常码 / 受控错误态——锚唯一、真实、产出方的信号(rule-0009),不写恒真断言,不为图省事弱化。
  3. 抽共享基础动作层:api 侧(请求构造 / 鉴权 / 断言 helper)、e2e 侧(开页 / 点击 / 填表 / 等待),case 只写业务动作序列;helper 跨需求共享(如 test/lib/,位置随工程惯例)——动作变了改一处、全部脚本跟着好。每需求抄一份 helper 是灾难。

② 跑 + 修(sandbox 内调通)

  1. 跑前卡门sandbox(up)→ sandbox_statusexit 0 才跑)→ 跑 → sandbox_down——命令取自 workspace/verification.yaml,契约见 docs/harness/SANDBOX_CONTRACT.md「运行时卡门」。sandbox 未接实(PENDING:)→ 停下报告总监,指路 hc-create-sandbox——不硬跑、不 mock 混过。
  2. 本需求的 case(不带过往全量——那是回归场景(已实现,ADR-0027)的事)。
  3. 失败两分脚本的问题改脚本(选择器 / 时序 / 断言写错…);实现的问题不改脚本——报出去由总监回 hc-dev 修(脚本挖到真 bug 是它的功劳,别为绿而弱化断言)。
  4. 完成定义:本需求 case 全绿,或如实报告残留失败清单 + 逐条归因(脚本 bug / 实现 bug / 环境缺失)——blocked / skipped ≠ pass(rule-0002),无真实运行证据不声称完成(rule-0003)。

Read the full file on GitHub · 56 lines

Changes

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.

  1. 2d ago First seen · 56 lines · 246 tokens per session scan A a58526235f98

Subscribe to this mod's changes

hc-script-impl is an agent published in the GitHub repository harness-base/harness-control (22 stars, last pushed 1mo ago), licensed MIT. It adds 246 tokens to every session and 1,965 once invoked, about $0.0012 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.

Related

Other agents, from other repositories

Demonstrate

Agent for demonstrating VS Code features.

microsoft/vscode · 10 tokens

playwright-test-generator

Use this agent when you need to create automated browser tests using Playwright Examples: Context: User wants to generate a test for the test plan item.

microsoft/playwright · 151 tokens

.NET-Notebook-Migration-Agent

Expert .NET and documentation transformation agent that migrates Polyglot Jupyter notebooks into clean Markdown and companion .NET sample code.

microsoft/ai-agents-for-beginners · 33 tokens

AVM Owner Triage

Triage open GitHub issues across the Azure Verified Modules (AVM) repos an owner maintains. Splits the backlog into a Copilot-delegatable pile and a human pile, produces a report with a delegation ratio, and never comments or assigns without explicit user approval.

github/awesome-copilot · 61 tokens

Ultimate Transparent Thinking Beast Mode

Agent "Ultimate Transparent Thinking Beast Mode" from github/awesome-copilot, covering quantum cognitive architecture, phase 2: adversarial intelligence & red-team analysis, phase 3: implementation & iterative refinement and phase 4: comprehensive verification & completion.

github/awesome-copilot · 11 tokens

code-reviewer

Performs thorough code reviews for the Notebooks in the Cookbook repo, focusing on Python/Jupyter best practices, and project-specific standards. Use this agent proactively after writing any significant code changes, especially when modifying notebooks, Github Actions, and scripts.

anthropics/claude-cookbooks · 52 tokens