vscode-cube-mcp: Instructions file for Codex

AGENTS.md

vscode-cube-mcp AGENTS.md is an instructions file for Codex, OpenCode from h666zhang/vscode-cube-mcp. It costs 1,606 tokens per session, scanned A, original, MIT.

An AGENTS.md instruction file for an MCP server that configures STM32 microcontrollers with STM32CubeMX, a tool for setting up embedded hardware projects. It defines the server's limits and its available configuration commands.

In plain words
What is it for?
Creating and configuring STM32CubeMX projects, including pins, peripherals, clocks, toolchains, project files, and generated hardware-abstraction skeletons.
Why use it?
It tells coding agents what the tool can configure and prevents them from expecting it to write application behavior such as sensor drivers or display logic.

Instructions file for CodexOpenCode

Written for Codex and OpenCode: the file is AGENTS.md. Also seen: mentions AGENTS.md.

This is h666zhang/vscode-cube-mcp's own configuration. It tells Codex and OpenCode how to work on vscode-cube-mcp itself, so it is not a mod to install elsewhere. Copy it as a starting point and replace the rules that are about this project. Everything vscode-cube-mcp configures →

Reuse

Borrowing it

Nothing to install: this file belongs to h666zhang/vscode-cube-mcp. Take a copy, put it at the same path in your own repository, and replace the rules that are about this project with yours.

Copy the file
curl -O https://raw.githubusercontent.com/h666zhang/vscode-cube-mcp/master/AGENTS.md
Clone the repo
git clone --depth 1 https://github.com/h666zhang/vscode-cube-mcp

Made for: Codex, OpenCode.

Wrote 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.

agentmods badge for vscode-cube-mcp AGENTS.md

README.md
[![agentmods](https://agentmods.dev/badge/instructions/h666zhang/vscode-cube-mcp/agents-md/github.svg)](https://agentmods.dev/instructions/h666zhang/vscode-cube-mcp/agents-md)
Your own site
<a href="https://agentmods.dev/instructions/h666zhang/vscode-cube-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/h666zhang/vscode-cube-mcp/agents-md/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.

agentmods 80×15 button for vscode-cube-mcp AGENTS.md

Your own site · 80×15
<a href="https://agentmods.dev/instructions/h666zhang/vscode-cube-mcp/agents-md"><img src="https://agentmods.dev/badge/instructions/h666zhang/vscode-cube-mcp/agents-md.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 1,606 This file is loaded in full into every session.
When invoked 1,606 The same file — it is already loaded in full.
Security scan A 0 findings. A grade says what 26 rules found in the file — not that it is safe.
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.1 $0.01606 $0.01606
Opus 5.5 $0.00642 $0.00642
Sonnet 5.5 $0.00321 $0.00321
Haiku 4.5 $0.00161 $0.00161

Measured 22d ago against content hash 4d1526af65d5, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

vscode-cube-mcp AGENTS.md 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 22d 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.

AGENTS.md · 70 lines

How it starts

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

Vscode_cube_mcp — AGENTS.md(项目约定,agent 必读)

本目录是 Vscode_cube_mcp:封装 STM32CubeMX 命令行(-q) 的 MCP server。

能力边界(最高优先)

  • 只做配置层:.ioc 工程配置 + HAL 骨架生成(引脚 / 外设 / 时钟 / 工具链),不做应用层。
  • 不生成、不修改、不负责业务代码(LED 闪烁、OLED 显示、传感器驱动、中断处理逻辑等)—— 用户在生成后的工程里自己写。
  • 给本工具提需求 / 加功能,同样到骨架为止。

接入后的路径

  1. 先调 cubemx_help —— 工具清单、可用模板、各外设写法与已知坑都在那里; 不要凭经验猜 set 命令语法。
  2. 常规顺序:cubemx_load(读现状)→ cubemx_intent(配,自动补时钟/DMA/NVIC 与隐含键) → cubemx_probe(在副本上预演)→ 落盘 → cubemx_generate → cubemx_inspect_output(验收)。
  3. 11 个工具的 description 首段都写了「什么时候不用我」,照那个走就不会选错; 其中 cubemx_raw_script 是降级接口,主链路上没有它的位置。

项目结构

  • src/vscode_cube_mcp/ — 包源码(src 布局,入口 python -m vscode_cube_mcp)
    • cubemx_mcp.py — MCP server(11 个工具;只做参数校验、编排与结果渲染)
    • cubemx_result.py — 步骤名、错误码与统一渲染(失败时能看出卡在哪一步)
    • knowledge_loader.py — 读 knowledge/ 的 YAML;查不到就报错,不猜
    • ioc_editor.py — .ioc 文本编辑 + 离线语义预检(写前备份、写后回读校验)
    • intent_resolver.py — 意图 → 动作(信号名与参数都查表得到)
    • ioc_diff.py / output_inspector.py — 结构化 diff / 看生成产物(都只读)
  • knowledge/ — 知识库:ip/、mcu/ 从 CubeMX 的 db 导出,rules/ 是实测规则(每条带 verified)
  • templates/ — 6.18 原生最小模板(按芯片命名;仅芯片标识 + 72MHz/SWD/SysTick,无外设)
  • tests/ — 按模块拆开的单元测试(不依赖 CubeMX)+ integration/(真启动 CubeMX,默认跳过)
  • tools/gen_knowledge_from_db.py — 从 CubeMX 安装目录的 db/ 导出知识库(只读)

agent 必须知道的坑

  • TIM 内部时钟:set mode TIMx 一律 KO。用 cubemx_intent 的 internal_clock (工具会注入 6.18 验证过的标准表达)。
  • RCC 时钟:对 RCC 发 set 命令(如 PLLMUL)会把 RCC.PLLSourceVirtual=HSE 弄丢、时钟静默降级 (HSI 64MHz)。改时钟用 cubemx_new_project 的 clock_source / pll_mul。
  • USART:set mode USARTx Asynchronous 有效;但 BaudRate 等于 db 默认值(115200)时 CubeMX 不写出那一行 —— 探针/回读里看不到不代表命令没生效(换成 9600 就出现了)。
  • 有些参数不在 .ioc 里:ContinuousConvMode / ScanConvMode 这类"取默认值"的行会被省掉, 最终值要读生成的代码:cubemx_inspect_output(project_dir, pattern=...)。
  • "移除外设再加回"会留下中间态:摘要的 init_order 会暂时少一项(CubeMX 下次 generate 自己重建, 生成代码不受影响),别据此以为外设没配上。
  • 模板必须 6.18 原生生成:手写/非 6.18 的 .ioc 会被拒绝;缺模板时报错会列出可用模板与生成方法。
  • 用户代码写哪里:CMake 工程写工程根的 CMakeLists.txt(# Add sources to executable / # Add include paths,只生成一次、不重写);cmake/stm32cubemx/CMakeLists.txt 每次 generate 全量重写,别动。 STM32CubeIDE 用 STM32CubeIDE/Application/User/Core/;EWARM / MDK-ARM 实测(2026-10-15)没有 这种独立用户区 —— 生成的是 Core/ + Drivers/ + EWARM|MDK-ARM/,用户代码写 Core/Src/*.c 的 /* USER CODE BEGIN */ 块里(CubeMX 只保证块内内容不被覆盖)。
  • 其余"实测过的坑"和"工具已经自动处理的坑"(ADC 时钟、SPI 波特率、project path、 零产出校验……)见 docs/README.dev-notes.md 与 knowledge/rules/*.yaml —— 那些不需要 agent 记。

Read the full file on GitHub · 70 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. 22d ago Changed · -58 lines · -2,093 tokens per session 4d1526af65d5
  2. 25d ago Changed · +74 lines · +2,558 tokens per session cee3449d50e2
  3. 2mo ago First seen · 54 lines · 1,141 tokens per session scan A 34bd1c1b3ba8

Subscribe to this mod's changes

vscode-cube-mcp AGENTS.md is an instructions file published in the GitHub repository h666zhang/vscode-cube-mcp (2 stars, last pushed 22d ago), licensed MIT. It adds 1,606 tokens to every session, about $0.0064 per session on Opus 5.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

vscode-cube-mcp AGENTS.md compared with instructions from other repositories

vscode-cube-mcp AGENTS.md next to 6 instructions from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
vscode-cube-mcp AGENTS.mdh666zhang/vscode-cube-mcpInstructions file222d agoMITA1,606Codex, OpenCode
vscode buildNext.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA9,719GitHub Copilot
next.js AGENTS.mdvercel/next.jsInstructions file143ktodayMITA7,461Codex, OpenCode
vscode oss-third-party-notices.instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA5,516GitHub Copilot
langchain AGENTS.mdlangchain-ai/langchainInstructions file149ktodayMITA4,680Codex, OpenCode
vscode copilot-instructions.mdmicrosoft/vscodeInstructions file195ktodayMITA3,093GitHub Copilot
deepseek-harness AGENTS.mddeepseek-ai/deepseek-harnessInstructions file275k3d agoMITA4,313Codex, OpenCode