j6-plugin-dynamic-block

j6-plugin-dynamic-block is a skill for Claude Code, Codex from HorizonRobotics/OE-Skills. It costs 61 tokens per session (2,746 once invoked), scanned A, original, Apache-2.0.

A guide for adding dynamic-block markers when adapting PyTorch models for Horizon Robotics' quantization toolkit. Dynamic control flow means loops or branches whose execution changes with the input, random values, or external state.

In plain words
What is it for?
Use it when a model uses graph-based preparation and has input-dependent loops or branches containing operations that may be replaced or fused during quantization.
Why use it?
It keeps graph preparation from confusing repeated operations or incorrectly combining dynamic and static code. It also limits markers to the operation blocks that need them, rather than wrapping whole loops.

Skill for Claude CodeCodex

Written for no agent in particular: nothing here depends on one.

Good fit Use it when a model uses graph-based preparation and has input-dependent loops or branches containing operations that may be replaced or fused during quantization.

Compare 6 skills from other repositories ↓
Install with agentmods
npx agentmods add skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block
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.

Any agent
npx skills add HorizonRobotics/OE-Skills --skill j6-plugin-dynamic-block
Clone the repo
git clone --depth 1 https://github.com/HorizonRobotics/OE-Skills

Made for: Claude Code, Codex.

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 j6-plugin-dynamic-block

README.md
[![agentmods](https://agentmods.dev/badge/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block/github.svg)](https://agentmods.dev/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block)
Your own site
<a href="https://agentmods.dev/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block"><img src="https://agentmods.dev/badge/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block/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 j6-plugin-dynamic-block

Your own site · 80×15
<a href="https://agentmods.dev/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block"><img src="https://agentmods.dev/badge/skills/horizonrobotics/oe-skills/j6-plugin-dynamic-block.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 61 Skills are progressive disclosure: only the name and description are preloaded; the body loads when the skill is used.
When invoked 2,746 The whole file, excluding the scripts and references it only reads on demand.
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.00061 $0.02746
Opus 5 $0.00030 $0.01373
Sonnet 5 $0.00012 $0.00549
Haiku 4.5 $0.00006 $0.00275

Measured 10d ago against content hash 0dc5c2ea4892, method: parsed. Prices are Anthropic first-party input rates as of 2026-09-10, from the pricing page.

Security

Grade A, and why

j6-plugin-dynamic-block 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.

horizon/skills/plugin/j6-plugin-adaptation/j6-plugin-dynamic-block/SKILL.md · 173 lines

How it starts

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

为 Horizon QAT 自动添加 dynamic_block 标注(Scope 约束版)

目标

在使用 horizon_plugin_pytorch 的基于图(如 PrepareMethod.JIT_STRIP / PrepareMethod.JIT)的 prepare 流程适配模型时,针对动态循环/动态控制流里会触发 function 算子替换算子融合 的代码段,自动补齐 dynamic_block 标注,把该段逻辑定义为独立的 Scope,避免:

  • 同一行 function 多次调用在不同 trace 次数/路径下导致的 scale/scope 错位
  • 动态部分与静态部分意外融合,造成 forward 报错
  • 算子替换/融合在动态控制流中发生时的 量化信息错乱

适用范围

  • 你正在为 horizon_plugin_pytorch 做量化适配,并使用 prepare(..., method=PrepareMethod.JIT_STRIP/JIT) 这类基于图的模式。
  • 模型 forward 存在运行次数/执行路径不稳定的逻辑,例如:
    • 循环次数由输入/随机数/外部状态决定(numpy.random/数据相关分支等)
  • 且该动态逻辑内部包含可能被 prepare 替换/融合的算子(例如某些 torch function、可融合的 Conv+BN(+Add) 等 pattern)。

重要限制:

  • 如果你的逻辑是纯静态的(没有数据依赖的 for/while、没有根据输入/随机数决定执行次数),即使其中有可替换或可融合算子也不应该额外包 dynamic_block

强约束(本 Skill 的“必须做到”)

  • 只标注需要算子替换/融合的逻辑块,不要把整个 for/while 循环都包进去:标注的是“块内的算子替换/融合逻辑”,不是控制流本身。
  • Tracer.dynamic_block 的第一个参数必须是当前 nn.Module 实例(通常是 self),不是 function / lambda / 普通 callable:正确用法是 Tracer.dynamic_block(self, "BlockName"),不要写成 Tracer.dynamic_block(some_func, "BlockName")
  • with Tracer.dynamic_block(...) 必须放在循环/分支内部,只包住需要替换/融合的语句,不要把 for/while 控制流包进 with:控制流负责“执行次数/路径”,dynamic_block 负责给其中那段非 module scope 的动态算子逻辑建立稳定 Scope。
  • 不要对“已经处于 Module Scope 内”的逻辑额外加 dynamic_block
    • nn.Module.forward 本身就是一个 Scope。
    • 因此如果动态控制流里只有“子 module 调用”(例如循环里只做 x = self.layer1(x)),通常不需要也不应该再包 dynamic_block
    • dynamic_block 的主要目标是:动态控制流中出现的 非 module scope 的 function/Tensor 逻辑(例如 x = x + 1x = torch.relu(x)x = sub_one(x))导致的 function 替换/融合错误的问题。
  • 动态块必须是稳定可复现的 Scope
    • 同一段逻辑每次执行应使用同一个 dynamic_block 名称(如果用命名 API)。
    • 不要在同一 forward 里复用同一个名字去标不同语义的块。
  • 优先使用 Tracer.dynamic_block(self, "<Name>")(当代码中已引入/可引入 Tracer 且希望显式命名)。
  • 如果已有 dynamic_block 标注,不重复嵌套/不改语义:只在缺失且确有必要的位置补齐。

标准改法(优先推荐)

1) 引入 Tracer(推荐写法)

from horizon_plugin_pytorch.fx.jit_scheme import Tracer

2) 在动态循环/动态分支中,包住需要替换/融合的算子段

for _ in range(n):  # n 可能是动态的
    # 只标注需要算子替换/融合的逻辑块(不是整个循环)
    with Tracer.dynamic_block(self, "ConvBnAdd"):
        x = self.conv(x)
        x = self.bn(x)
        x = x + y

Read the full file on GitHub · 173 lines

Files

What ships with it

1 file beside SKILL.md in the same directory: the scripts, references and assets a skill reads on demand. Not counted in the per-session cost; read them before you install if any of them is executable.

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. 10d ago First seen · 173 lines · 61 tokens per session scan A 0dc5c2ea4892

Subscribe to this mod's changes

j6-plugin-dynamic-block is a skill published in the GitHub repository HorizonRobotics/OE-Skills (19 stars, last pushed 2mo ago), licensed Apache-2.0. It adds 61 tokens to every session and 2,746 once invoked, about $0.0003 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 skills, from other repositories

agent-platform-rag-engine-management

Manage and query Agent Platform RAG Engine Corpora and retrieve grounded contexts using the Google GenAI SDK. Use when listing RAG corpora or files, inspecting a corpus, retrieving contexts, or generating content grounded in a RAG corpus. Do not use for standard database queries (use SQL/Spanner skills), Google…

google/skills · 85 tokens

agent-platform-model-registry

Agent Platform Model Registry Management. Use when you need to upload, list, describe, update, or delete machine learning models (and their versions) in the Agent Platform Model Registry. Don't use for model training, model deployment to endpoints, or managing non-Agent Platform models.

google/skills · 60 tokens

foundry-config-setup

Resolve missing setup caused by a hardcoded Foundry project endpoint or model in a sample. Use when a sample fails because it uses a placeholder/hardcoded projectendpoint (for example "https://your-project.services.ai.azure.com") or a hardcoded model instead of reading them from the environment.

microsoft/agent-framework · 65 tokens

google-cloud-solution-agentic-analytics-spark-knowledge-catalog

Discovers requirements and generates guidance to design and deploy a governed, secure agentic-analytics solution for data that's distributed across Google Cloud, other cloud providers, or on-premises. Data that's outside Google Cloud (such as data from Databricks, Snowflake, Salesforce, SAP, or Oracle systems) is…

google/skills · 138 tokens

training-check

Interactively monitor training metrics from the current Codex session, periodically checking WandB or fallback logs for NaN, divergence, plateaus, and broken runs.

wanshuiyin/Auto-claude-code-research-in-sleep · 35 tokens

nemo-automodel-launcher-config

Configure NeMo AutoModel job launches for interactive runs, Slurm clusters, and SkyPilot cloud execution.

NVIDIA/skills · 30 tokens