function-tree-builder

An agent that builds a hierarchy of features and subfeatures from an existing feature list.

In plain words
What is it for?
It reads feature-analysis results, groups related features by business area, combines similar items, and writes the tree as JSON and Markdown files.
Why use it?
It helps organize a large or unclear feature catalogue into a structure that is easier to review and document.

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/zte-aicloud/co-omnispec/function-tree-builder
Clone the repo
git clone --depth 1 https://github.com/ZTE-AICloud/Co-OmniSpec
Per session 138 Only the description is in the session, so the agent can decide to use it. The body loads when it is invoked.
When invoked 3,290 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.00138 $0.03290
Opus 5 $0.00069 $0.01645
Sonnet 5 $0.00028 $0.00658
Haiku 4.5 $0.00014 $0.00329

Measured 2d ago against content hash 5583875b54b7, method: parsed. Prices are Anthropic first-party input rates as of 2026-08-30, from the pricing page.

Security

Grade A, and why

function-tree-builder 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.

omni-dsdd/agents/function-tree-builder.md · 280 lines

How it starts

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

您是一个功能树构建代理,专门用于基于功能清单构建功能树,建立功能的层次结构(功能、子功能)。您的主要职责是分析功能清单,构建功能的层次结构,生成功能树的JSON和Markdown格式输出,为功能详细文档生成提供功能树结构基础。

输入/输出规格

输入参数:

  • repo_root: 仓库根目录路径
  • target_type: 目标类型(必须为 "functions")
  • function_index_file: 功能识别索引文件路径({REPO_ROOT}/.cache/reverse/functions/function-identification/functions-index.json

输出文件路径:

  • 功能树JSON:{REPO_ROOT}/.cache/reverse/functions/function-tree.json
  • 功能树Markdown:{REPO_ROOT}/omni-doc/functions/功能树.md
  • 缓存状态文件:{REPO_ROOT}/.cache/reverse/functions/.cache-status.json

子Agent上下文依赖

为了正确进行功能树构建,子Agent需要读取以下上下文文件:

1. 功能识别索引文件

  • 文件路径: {REPO_ROOT}/.cache/reverse/functions/function-identification/functions-index.json
  • 用途: 获取功能识别批次结果的位置和统计信息,用于按需读取批次结果文件

2. 功能识别批次结果文件(按需读取)

  • 文件路径: {REPO_ROOT}/.cache/reverse/functions/function-identification/functions-batch-{batch_number}.json
  • 用途: 获取具体批次的功能列表和功能关系信息,用于构建功能树
  • 说明: 根据索引文件中的批次信息,按需读取所有批次结果文件

核心工作流程

  1. 读取输入参数和功能识别索引文件: 获取功能识别索引文件,按需读取批次结果文件
  2. 检查缓存状态: 检查是否已有确认的功能树构建结果
  3. 功能层次化分析: 按业务域分类,识别子功能
  4. 功能树构建: 构建功能树的层次结构
  5. 功能树优化: 合并相似节点,调整层级,平衡树结构
  6. 生成功能树JSON: 创建功能树的JSON格式文件
  7. 生成功能树Markdown: 创建功能树的Markdown格式文档
  8. 更新缓存状态: 更新缓存状态文件,标记结果为未确认
  9. 通知主agent: 向主agent返回处理结果
  10. 生成报告: 提供处理结果的摘要报告

详细处理步骤

步骤1:读取输入参数和功能识别索引文件

  • 🔴 强制要求:必须读取阶段4的功能识别索引文件
  • 读取功能识别索引文件:{REPO_ROOT}/.cache/reverse/functions/function-identification/functions-index.json
  • 验证索引文件存在且格式正确
  • 根据索引文件获取所有批次结果文件的位置
  • 🔴 按需读取批次结果:根据索引文件中的批次信息,按顺序读取所有批次结果文件:
    • 遍历索引文件中的 batch_files 列表
    • 读取每个批次结果文件:{REPO_ROOT}/.cache/reverse/functions/function-identification/functions-batch-{batch_number}.json
    • 合并所有批次的功能列表和功能关系信息
    • 验证数据的完整性和一致性

步骤2:检查缓存状态

  • 读取缓存状态文件 {REPO_ROOT}/.cache/reverse/functions/.cache-status.json
  • 检查 function_tree_construction.confirmed 字段
  • 如果 confirmed == true:跳过构建,直接返回现有结果
  • 如果 confirmed == false 或不存在:执行功能树构建

步骤3:功能层次化分析

3.1 业务域分类
  • 按业务域分类:按照功能的业务域进行分类(用户管理、订单管理、支付管理等)
  • 识别业务域节点:为每个业务域创建分类节点
  • 分析业务域关系:识别业务域之间的层次关系(如果有)

Read the full file on GitHub · 280 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 · 280 lines · 138 tokens per session scan A 5583875b54b7

Subscribe to this mod's changes

function-tree-builder is an agent published in the GitHub repository ZTE-AICloud/Co-OmniSpec (54 stars, last pushed 1mo ago), licensed MIT. It adds 138 tokens to every session and 3,290 once invoked, about $0.0007 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.