init-deep
它能做什么
这个工具会把你项目的文档整理成名为 AGENTS.md 的文件。它会建立一个层级结构,就像文件夹套文件夹一样,让人工智能更好地理解项目。
适用场景
- ✓当你开始一个新项目,希望 AI 了解它的结构时。
- ✓当项目变大、文档需要整理时。
- ✓当你希望 AI 帮你保持文档更新时。
技能链接
https://github.com/code-yeongyu/oh-my-openagent/blob/dev/packages/omo-senpi/skills/init-deep/SKILL.md复制后粘贴给你的 AI(Claude、ChatGPT 或 Cursor),让它按照说明操作。
使用方法
最简单的方法:复制下面的消息,粘贴给你的 AI。它会读取这个技能并按说明操作。
可直接粘贴的消息
适用于 Claude Code、Codex 或 Cursor:在项目文件夹中运行,即可安装该技能。
下载 SKILL.md,放进智能体的技能文件夹。
可以这样问 AI
“把我项目的文档整理成 AGENTS.md 文件,从根目录开始,并根据需要创建子文件夹。”
每周 5 个新技能,1 分钟读完。
工作原理
工具会先评估项目的规模,决定如何划分。然后,它会从每个部分收集信息,最后写出 AGENTS.md 文件,确保 AI 始终对项目有清晰、有条理的了解。
技术内容(原始 SKILL.md)
作者在 GitHub 上的英文原文。
/init-deep
Generate hierarchical AGENTS.md files: root + complexity-scored subdirectories, produced by a size-formula-driven dag map-reduce (quick scanners -> unspecified-high writers) so the main session's context stays flat at any repo size.
Usage
/init-deep # Update mode: modify existing + create new where warranted
/init-deep --create-new # Read existing → remove all → regenerate from scratch
/init-deep --max-depth=2 # Limit directory depth (default: 3)
Workflow (High-Level)
- Size & route (main session) - ONE eval cell measures the repo and computes the node formula.
- Map (dag) -
quickscanner nodes extract per-chunk facts into bounded file reports. - Reduce (dag) -
unspecified-highwriter nodes own disjoint subtrees: score, write AGENTS.md files, emit digests. - Root & verify (dag) - one node writes root AGENTS.md from digests only; one node verifies every file.
- Snapshot & mode (main session) - snapshot contract unchanged.
todo init the five phases; start/done each transition in real time.
</critical>
Phase 1: Size & Route
Measure and compute in ONE eval cell - code, not mental arithmetic:
# Measure (tracked files minus vendored/generated: node_modules, .git, dist,
# build, out, vendor, target, coverage, lockfiles, minified and binary files)
S = total source bytes after exclusions
per_dir = source bytes per directory # bin-packing input
depth = max directory depth # respect --max-depth (default 3)
existing = every AGENTS.md / CLAUDE.md path # read the ROOT one now
# Formula
CHUNK = 400 * 1024 # ~100k tokens of source; a quick worker's usable window
# is ~150k over its fallback chain - leave room for its
# prompt and report
N_quick = ceil(S / CHUNK) # bin-pack WHOLE directories into chunks; a directory
# larger than one chunk splits at its children
N_high = ceil(N_quick / 12) # one reducer absorbs ~12 reports (~60k tokens) and
# still has room to spot-check real code
Route:
- **N_quick < 4** -> inline path below; a dag costs more than it saves.
- N_quick >
task.dag.max_nodes_per_run(default 64) -> raise the knob in omo config, or run one chained dag per top-level directory (multi-run composition,mass-ulwskill). - Otherwise -> dag path: emit
CHUNKS = [{id, dirs, bytes}], assign each writer a directory SUBTREE (disjoint - no two writers own the same directory), andmkdir -p .omo/init-deep/reports .omo/init-deep/digests.
--create-new: read every existing AGENTS.md FIRST (still-true facts survive as scanner input), then delete all, then regenerate.
Inline path (N_quick < 4)
Small repo - skip the dag. Fire 2-4 parallel explore agents (structure, entry points, conventions, anti-patterns), for example:
task(subagent_type="explore", run_in_background=true, prompt="Project structure: map real layout via ast-grep structural search (sg/ast_grep MCP) + rg --files -> REPORT deviations from standard patterns")
Run the LSP/ast-grep code map yourself (lsp_symbols outlines + workspace inventory, lsp_find_references on top exports, ast-grep import/call shapes; when neither resolves, mark centrality unmeasured). Then score with the matrix below and write every file per the templates yourself. Phase 5 applies unchanged.
Phase 2: Map Wave - quick Scanners (dag)
Build and start the run in one eval JS cell with the dag SDK (OMO_DAG_SDK_ROOT); wave doctrine, the node prompt contract, and the failure playbook come from the mass-ulw skill's references/planning.md. One scanner node per chunk, category: "quick", no load_skills - scanners stay lean and their prompt is a rigid numbered extraction template. Quick workers extract; they never judge and never write AGENTS.md:
TASK: Extract knowledge-base facts for chunk <id> (<dirs>) of <repo-root>.
Steps, in order:
1. Inventory each directory in scope: file count, LOC, languages, entry files.
…
常见问题
AGENTS.md 文件是什么?
它们是帮助人工智能理解项目结构、命令和约定的文档文件。
“层级式”是什么意思?
意思是文档按层次组织,就像文件夹和子文件夹一样,让浏览和理解更容易。
我可以控制组织的深度吗?
可以,你可以设置子文件夹的深度上限,避免结构变得过于复杂。
详情
作者的原始描述
Initializes a hierarchical AGENTS.md knowledge base for a project. Use when a repo needs its structure, commands, and conventions documented for agents.
热度
- GitHub 星标
- 70k
- 排名
- #3121
- 许可证
- NOASSERTION
- 更新时间
- 2026/10/15
评论
- …
同一仓库的更多技能
comment-checker
70k帮你的智能体理解并回应自动代码检查工具的反馈。适用于处理自动化代码或内容审查的结果。
lcx-contribute-bug-fix
70k帮你的智能体为 LazyCodex 相关项目贡献错误修复。它会创建 issue 或 pull request,保障代码质量。
lcx-doctor
70k让你的智能体检查 LazyCodex 和 Codex CLI 安装的健康状况。当系统在更新或改动后表现异常时很有用。
lcx-report-bug
70k帮你的智能体为 LazyCodex 项目详细报告 bug。它会创建包含有用信息的 issue,方便开发者定位并修复问题。