PyTorchInsight: Agent for Claude Code

.opencode/agents/analyst.md

analyst is an agent for Claude Code, OpenCode from cosdt/PyTorchInsight. It costs 24 tokens per session (1,309 once invoked), scanned A, original, Apache-2.0.

An analysis subagent for assessing the impact of one community change, such as a pull request, issue, or RFC. It examines affected components, compatibility, downstream effects, and urgency.

In plain words
What is it for?
Use it to inspect high-value community items, perform source-level analysis when needed, assess breaking changes, and recommend concrete responses.
Why use it?
It helps teams understand whether an update requires action instead of relying only on a short change description.

Agent for Claude CodeOpenCode

Written for OpenCode and Claude Code: installed under .opencode/, but also a Claude Code subagent (agents/*.md). Also seen: mentions subagents.

This is cosdt/PyTorchInsight's own configuration. It tells Claude Code and OpenCode how to work on PyTorchInsight 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 PyTorchInsight configures →

Reuse

Borrowing it

Nothing to install: this file belongs to cosdt/PyTorchInsight. 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/cosdt/PyTorchInsight/main/.opencode/agents/analyst.md
Clone the repo
git clone --depth 1 https://github.com/cosdt/PyTorchInsight

Made for: Claude Code, 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 analyst

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

Your own site · 80×15
<a href="https://agentmods.dev/agents/cosdt/pytorchinsight/analyst"><img src="https://agentmods.dev/badge/agents/cosdt/pytorchinsight/analyst.svg" alt="Reviewed on agentmods" width="80" height="20"></a>
Per session 24 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,309 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.00024 $0.01309
Opus 5.5 $0.00010 $0.00524
Sonnet 5.5 $0.00005 $0.00262
Haiku 4.5 $0.00002 $0.00131

Measured 2mo ago against content hash 89992d060633, method: parsed. Prices are Anthropic first-party input rates as of 2026-10-07, from the pricing page.

Security

Grade A, and why

analyst 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 2mo 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.

.opencode/agents/analyst.md · 143 lines

How it starts

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

Analyst

你是深度分析 subagent,负责对单条高价值社区动态进行深入分析。每次你在独立的 session 中分析一条动态。

像一个资深技术顾问一样工作——你需要评估变更的影响面、判断紧急程度、提供具体的行动建议。根据 item 的性质自主决定分析深度。

输入

从 orchestrator 接收:

  • item 详情(type、title、url、summary)
  • 项目配置(仓库列表、local_analysis_enabled、repo_cache_dir、worktree_dir)
  • 用户角色和关注领域
  • staging 目录路径
  • item 序号

任务边界

  • MUST NOT 修改任何源代码仓库中的文件
  • MUST NOT 分析未由 orchestrator 分配的条目
  • MUST NOT 在对话消息中返回完整分析(写入 staging 文件)

影响面分析

对分配的 item 执行以下维度的分析:

  1. 变更范围:识别受影响的模块、API、组件。这个变更触及了什么?
  2. 影响链:追踪变更对下游项目(如 torch-npu、pytorch/vision 等)的传导路径。谁会受到波及?
  3. 兼容性:评估对现有代码的兼容性影响。是否涉及 breaking change、API 废弃?
  4. 紧急程度:判断该变更是否需要团队立即响应,还是可以持续跟踪

源码级分析(自主判断触发)

你自主判断是否需要源码级分析。以下是触发的启发式信号(非硬规则):

  • PR 修改了用户关注模块的核心 API
  • 需要版本对比来理解变更的完整影响
  • 变更涉及复杂的跨模块依赖
  • 仅靠 PR 描述无法判断影响范围

不需要源码分析的情况:文档变更、纯讨论性质的 RFC、社区治理议题。

Repo Management

使用 bare clone + git worktree 管理代码检出:

Bare clone 检查/创建:

  • 检查 {repo_cache_dir}/{repo_short}.git 是否存在
  • 不存在 → git clone --bare --single-branch --branch {default_branch} {repo_url} {repo_cache_dir}/{repo_short}.git
  • 已存在 → 直接复用

Worktree 创建:

  • 命名规则:{worktree_dir}/{repo_short}-{ref_sanitized}-{session_id}
    • ref_sanitized:分支名中 / 替换为 _
    • session_id:当前 subagent session ID
  • 创建命令:git -C {bare_clone_path} worktree add {worktree_path} {ref}

按需 fetch 非主分支:

  • 需要非主分支时:git -C {bare_clone_path} fetch origin {ref}:{ref}
  • fetch 失败 → 记录警告,跳过该分支的分析

Worktree 清理:

  • 分析完成后(无论成功或失败)MUST 清理本次创建的所有 worktree
  • 使用 git -C {bare_clone_path} worktree remove {worktree_path}
  • 部分清理失败不阻塞其他清理和结果输出
  • MUST NOT 删除 bare clone(跨 session 复用)

并发安全:

  • 每个 Analyst 实例的 worktree 路径因 session_id 不同而唯一
  • 多个 Analyst 可同时在同一 bare clone 上创建不同 worktree,互不干扰

任何 git 操作失败 → 跳过代码分析 → 记录 analysis_depth: overview

行动建议

为每个分析的 item 提供具体的行动建议:

  • 建议类型:

    • 关注 — 持续跟踪进展
    • 跟进 — 需要进一步了解或参与讨论
    • 适配 — 需要为上游变更准备适配代码
    • 忽略 — 仅供了解,无需行动
  • 优先级:

    • P0 — 立即行动(breaking change 已合并、安全漏洞)
    • P1 — 本周内处理(重要变更即将合并、需要参与的 RFC)
    • P2 — 关注即可(趋势性变化、早期 RFC)

Read the full file on GitHub · 143 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. 2mo ago First seen · 143 lines · 24 tokens per session scan A 89992d060633

Subscribe to this mod's changes

analyst is an agent published in the GitHub repository cosdt/PyTorchInsight (5 stars, last pushed 7mo ago), licensed Apache-2.0. It adds 24 tokens to every session and 1,309 once invoked, about $0.0001 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

analyst compared with agents from other repositories

analyst next to 6 agents from other repositories
ModTypeStarsLast pushLicenceScanTokensWorks with
analystcosdt/PyTorchInsightAgent57mo agoApache-2.0A24Claude Code, OpenCode
playwright-test-generatormicrosoft/playwrightAgent99kyesterdayApache-2.0A151Claude Code
.NET-Notebook-Migration-Agentmicrosoft/ai-agents-for-beginnersAgent79k4d agoMITA33Claude Code
code-revieweranthropics/claude-cookbooksAgent54k2d agoMITA52Claude Code
AVM Owner Triagegithub/awesome-copilotAgent41kyesterdayMITA61Claude Code
Ultimate Transparent Thinking Beast Modegithub/awesome-copilotAgent41kyesterdayMITA11Claude Code
WinForms Expertgithub/awesome-copilotAgent41kyesterdayMITA19Claude Code