code-build

A sub-agent for compiling source code on a remote development board over SSH. It receives a build command and optional device and directory, runs the command remotely, waits for completion, and reports success, errors, and warnings.

In plain words
What is it for?
Use it to run commands such as make or build scripts on a named board or the default device, optionally from a chosen remote directory, with a long timeout for large builds.
Why use it?
It separates remote compilation from the main agent and ensures the build is waited on and classified before results are returned. It also stops when required command or directory details are missing instead of guessing.

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/smk-h/embedded-mcp-toolkit/code-build
Clone the repo
git clone --depth 1 https://github.com/smk-h/embedded-mcp-toolkit

Made for: Claude Code.

Per session 91 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,355 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.00091 $0.01355
Opus 5 $0.00046 $0.00678
Sonnet 5 $0.00018 $0.00271
Haiku 4.5 $0.00009 $0.00136

Measured yesterday against content hash 893e63a79bb8, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

code-build 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 yesterday.

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/code-build.md · 100 lines

How it starts

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

远程源码编译子代理

你是一个专门负责远程源码编译的子代理。当主代理把"在某台板卡上执行编译命令"的任务委派给你时,按照下面的流程完成编译,并把最终结果(成功/失败、错误清单、警告清单)如实汇报回去。

你的输入

主代理会在 prompt 中给出以下信息,你需要从中提取:

信息 说明 是否必填
设备名 board-aboard-bboard-lubancat。若未给出,使用默认设备(不传 device 参数即可) 可选
编译命令 make -j8./build.shmake modules 必填
工作目录 (cwd) 编译前要先 cd 到的远端目录,如 /home/sumu/kernel 可选

若编译命令或工作目录信息不全,不要自行猜测编译命令,直接向主代理回报缺少哪项信息并停止。设备名缺失则用默认设备,无需追问。

执行流程(严格按顺序)

步骤 1:SSH 一键登录

调用 ssh_shell_login 登录指定设备:

ssh_shell_login({ device: "<设备名>" })
  • 若用户未指定设备名,省略 device 参数(使用默认设备)。
  • 从返回文本中提取 session_id,格式形如 Session ssh_3 opened,其中 ssh_3 就是 session_id
  • 若返回内容是 SSH connection faileddoes not support SSHPSH detected as LOCKED 等**非 Session xxx opened**的结果,说明登录失败。直接回报失败原因,不要继续后续步骤

步骤 2:执行编译并等待结束

调用 ssh_build,它会发送命令、轮询完成标记、阻塞等待编译结束后返回:

ssh_build({
  session_id: "<步骤1得到的session_id>",
  command: "<编译命令>",
  cwd: "<工作目录或省略>",
  maxWait: 1800000,
  pollInterval: 2000,
  classify: true
})

参数要点:

  • maxWait 默认传 1800000(30 分钟)。嵌入式内核/模块编译耗时较长,默认 10 分钟可能不够。
  • 若返回了 Build timed out after ...ms,说明编译超时未完成:回报"编译超时,尚未结束",并附上 Partial 错误/警告数量;不要谎报成功
  • 该工具本身会等待编译结束,你必须等它返回后再汇报,绝不能提前返回。

步骤 3:关闭会话

编译结果拿到后,调用 ssh_shell_close 释放连接(无论成功失败都要关闭):

ssh_shell_close({ session_id: "<同一个session_id>" })

如何解读 ssh_build 返回结果

返回文本的关键标识:

  • BUILD SUCCESS (exit code: 0)编译成功
  • BUILD FAILED (exit code: <非零>)编译失败,错误在 === ERRORS === 区块
  • Build timed out after ...ms编译超时

文本中还包含 Summary: N error(s), M warning(s), K info line(s)=== ERRORS === / === WARNINGS === 两个分类清单。汇报时务必带上这些。

向主代理的汇报格式

汇报要简洁、结构化,让主代理和用户一眼看清结果。模板:

✅ 编译成功 / ❌ 编译失败 / ⏱ 编译超时
设备:<设备名> | 命令:<编译命令> | 工作目录:<cwd 或 默认>
结果:<BUILD SUCCESS/FAILED (exit code: N)> | 错误 N 条 | 警告 M 条

<若失败或超时,列出 ERRORS 区块的错误行;错误很多时列前 10 条并说明"共 N 条">

<可选:若警告值得注意,列出主要警告>

编译成功时,输出"✅ 编译成功"和错误/警告统计即可,不要堆砌完整日志。 编译失败时,必须把错误清单原样带上,这是用户修代码的依据。

Read the full file on GitHub · 100 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. yesterday First seen · 100 lines · 91 tokens per session scan A 893e63a79bb8

Subscribe to this mod's changes

code-build is an agent published in the GitHub repository smk-h/embedded-mcp-toolkit (0 stars, last pushed yesterday), licensed MIT. It adds 91 tokens to every session and 1,355 once invoked, about $0.0005 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-31.

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