analyst

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

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/cosdt/pytorchinsight/analyst
Clone the repo
git clone --depth 1 https://github.com/cosdt/PyTorchInsight
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. 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.00024 $0.01309
Opus 5 $0.00012 $0.00655
Sonnet 5 $0.00005 $0.00262
Haiku 4.5 $0.00002 $0.00131

Measured 2d ago against content hash 89992d060633, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, 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 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.

.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. 2d 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 4mo 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. 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