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.
git clone --depth 1 https://github.com/Claudate/project-multilevel-indexWrote 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.
[](https://agentmods.dev/commands/claudate/project-multilevel-index/update-index)<a href="https://agentmods.dev/commands/claudate/project-multilevel-index/update-index"><img src="https://agentmods.dev/badge/commands/claudate/project-multilevel-index/update-index.svg" alt="Measured on agentmods" height="20"></a>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.
| Model | Per session | Once invoked |
|---|---|---|
| Fable 5.1 | $0.00000 | $0.01218 |
| Opus 5 | $0.00000 | $0.00609 |
| Sonnet 5 | $0.00000 | $0.00244 |
| Haiku 4.5 | $0.00000 | $0.00122 |
Grade A, and why
update-index 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 8d 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.
How it starts
The opening of the file, as written. The whole thing — 169 lines — stays where its author put it; the contents beside it link to each section on GitHub.
命令: /update-index - 更新索引
🎯 使用场景
- 用户手动触发索引更新
- PostToolUse Hook 自动调用(文件修改后)
📋 执行步骤
步骤 0: 加载语言配置
必须首先执行,详见 ../core/i18n.md
步骤 1: 检测变更范围
输出: {{LANG.messages.commands.updateIndex.analyzing}}
如果是 Hook 触发,分析被修改的文件:
过滤规则:
- 是否为索引文件自身(PROJECT_INDEX.md, FOLDER_INDEX.md)? → 跳过
- 是否为代码文件? → 继续
- 文件大小 > 500KB? → 跳过(性能保护)
变更类型判断:
| 变更内容 | 类型 | 更新范围 |
|---|---|---|
| 新增/删除 import/require/use | {{LANG.skill.changeTypes.structural}} |
{{LANG.skill.updateRanges.full}} |
| 修改 export/public/class 声明 | {{LANG.skill.changeTypes.structural}} |
{{LANG.skill.updateRanges.full}} |
| 修改 Input/Output/Pos 注释 | {{LANG.skill.changeTypes.header}} |
{{LANG.skill.updateRanges.header}} |
| 修改函数内部实现 | {{LANG.skill.changeTypes.implementation}} |
{{LANG.skill.updateRanges.none}} |
判断方法:
- 读取文件内容
- 搜索关键字:
- 依赖:
import,require,use,from,#include,using - 导出:
export,public,class,interface,function,def,fn,async,struct
- 依赖:
- 如果发现变更 → Structural
- 否则检查文件头是否修改 → Header
- 都不是 → Implementation(跳过)
步骤 2: 执行增量更新
根据变更类型执行不同更新策略:
Structural 变更
-
重新分析文件:
- 分析 Input(依赖)
- 分析 Output(导出)
- 推断 Pos(定位)
-
更新文件头注释:
- 使用 Edit 工具更新
- 保留用户自定义内容
-
更新 FOLDER_INDEX.md:
- 只更新该文件的条目
- 不重新生成整个索引
-
更新 PROJECT_INDEX.md:
- 重新生成依赖关系图
- 更新受影响的目录结构描述
Header 变更
- 仅更新文件头注释
- 不触及 FOLDER_INDEX 或 PROJECT_INDEX
步骤 3: 智能合并(批量更新优化)
如果短时间内(< 5秒)检测到多个文件变更:
- 收集所有变更
- 去重文件夹(每个文件夹只更新一次)
- 最后统一更新根索引
这样可以避免频繁写入同一文件。
步骤 4: 报告更新
静默模式(小改动):
{{LANG.messages.notifications.skipped}}
通知模式(结构性变更):
{{LANG.messages.commands.updateIndex.updated}}
- {{LANG.messages.commands.updateIndex.updatedItems}}
替换占位符:
{file}: 文件名{folder}: 文件夹名
示例输出(zh-CN):
[索引系统] 检测到结构性变更,已自动更新索引
已更新:
- 文件头注释、services/FOLDER_INDEX.md、PROJECT_INDEX.md
示例输出(en-US):
[Index System] Detected structural change, automatically updated index
Updated:
- File header, services/FOLDER_INDEX.md, PROJECT_INDEX.md
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.
- 8d ago First seen · 169 lines · 0 tokens per session scan A c6a80db56738
update-index is a command published in the GitHub repository Claudate/project-multilevel-index (139 stars, last pushed 7mo ago), licensed MIT. It costs nothing until one of its globs matches a file; then it loads 1,218 tokens. 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.
Other commands, from other repositories
checklist
Generate a custom checklist for the current feature based on user requirements.
clarify
Identify underspecified areas in the current feature spec by asking up to 5 highly targeted clarification questions and encoding answers back into the spec.
specify
Create or update the feature specification from a natural language feature description.
converge
Assess the current codebase against the feature's spec, plan, and tasks, then append any remaining unbuilt work as new tasks to tasks.md so implement can complete it.
implement
Execute the implementation plan by processing and executing all tasks defined in tasks.md.
analyze
Perform a non-destructive cross-artifact consistency and quality analysis across spec.md, plan.md, and tasks.md after task generation.