feat: 1、根据项目体量限定investigation个数及首轮落盘文件个数;2、针对investigation落盘失败加入降级优化;3、加入了调查前确认和调查后确认2个关键确认点;4、plugin更名后在readme加入必要提示。#25
Conversation
补充 /llmdoc:init 的核心编排约束,避免 init 在大仓和小仓上都走同一种粗放流程。 本次提交包括: - 在命令契约和 llmdoc-init 技能中加入调研前用户校准、调研后确认两个必经检查点。 - 引入按仓库规模控制的 investigator 扇出策略,并明确排除 node_modules、dist、build、.git 等依赖、生成和缓存目录。 - 用 coverage gate 和定向 follow-up 替代整仓重跑,要求把缺口、冲突和文档结构风险显式化。 - 新增 init-user-calibration 指南,并同步 architecture、index、doc-routing 等文档路由,保证内部规则一致。
更新公开文档,使对外说明与新的 llmdoc init 行为以及当前插件安装方式保持一致。 本次提交包括: - 在中英文 README 中补充 /llmdoc:init 的最新流程摘要,覆盖用户校准、按仓库规模展开调研、调研后确认以及 .llmdoc-tmp 清理。 - 调整 Claude Code 插件安装说明,补充旧 marketplace 缓存条目的兼容性提示和重置步骤。 - 在 AGENTS.example.md 中加入默认使用简体中文回复的仓库级示例约束。
整理 Codex 与 Claude 插件侧的元数据定义,避免本地 marketplace 标识和发布信息继续分叉。 本次提交包括: - 将 .agents/plugins/marketplace.json 中的本地 marketplace 名称调整为 llmdoc-cc-plugin。 - 将 .claude-plugin/marketplace.json 的描述字段迁移到 metadata.description,并保持插件来源信息不变。 - 将 .claude-plugin/plugin.json 版本号提升到 2.0.1。 - 新增空的 .claude/settings.local.json 作为本地配置占位文件。
…s reference, and marketplace identifier reflection.
…3、加入了调查前确认和调查后确认2个关键确认点;4、plugin更名后在readme加入必要提示。
Contributor
There was a problem hiding this comment.
Code Review
This pull request implements a robust persistence and recovery protocol for the llmdoc initialization and update workflows, introducing size-aware investigation fan-out, sentinel-based truncation detection, and sidecar recovery mechanisms. It also adds user calibration checkpoints and relaxes first-pass documentation targets for large repositories. Review feedback identifies a versioning inconsistency in plugin.json and recommends avoiding hardcoded configuration values in architectural documentation to prevent them from becoming obsolete.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR 说明:enhance — Init/Update 调查持久化恢复与大型仓库首轮文档阈值放宽
概述
本 PR 聚焦 llmdoc 的三类协同改进:
Init 调查编排与四状态恢复协议落地
/llmdoc:init现在明确区分persisted、write_failed_fallback_ready、transport_failure、context_overflow四种文件落盘调查结果,并要求以哨兵、canonicaloutput_path、sidecar 恢复和定向 follow-up 的顺序处理;首轮 investigation subagent 启动个数也改为按仓库体量阈值分档控制。Update 与 Init 的文件落盘协议对齐
/llmdoc:update现在在需要 file-sink 调查时复用与 init 相同的持久化检查、fallback 写入、sidecar 恢复和授权升级路径;同时会按需重建.llmdoc-tmp/investigations/,不再假设 init 会把该目录保留到下一次 update。大型仓库首轮稳定文档数量阈值放宽
首轮稳定文档仍坚持“先深后广”,但核心 architecture/reference 文档目标改为按仓库规模分档:小型/中型仓库通常
2-3篇,大型仓库可以放宽到3-5篇,只要这些文档分别承载不同的不变量簇、执行流或契约面。以上改动已经同步到命令契约、agent prompt、Codex helper skill、架构文档、维护指南和中英文 README,避免出现“命令已变、执行提示还停留在旧规则”的偏差。
背景与动机
1. Init 的恢复协议需要可验证的持久化定义
之前的恢复逻辑默认“子 agent 有返回”就足够推进流程,但这会把三类不同问题混在一起:
如果没有哨兵、canonical 路径和 sidecar 恢复顺序,覆盖率门控会把缺失或截断的调查报告误判为“可用”。
1.1 Init 的体量分档与首轮 investigation subagent 启动个数
Init 的 fan-out 不是固定值,而是先按排除依赖、生成物、缓存和 VCS 目录后的第一方源码与测试文件估算仓库体量,再决定首轮 investigation subagent 个数。
当前体量分档为:
<= 1000 LOC1001-5000 LOC> 5000 LOC对应的首轮 investigation subagent / investigator 启动个数为:
1-22-33-5这个阈值的目的不是追求最大并发,而是在限制第一波 fan-out 的同时保持主题覆盖稳定。也就是说:
2. Update 之前没有补齐与 Init 同级别的恢复路径
/llmdoc:update新增 file-sink 调查能力之后,暴露出两个缺口:.llmdoc-tmp/,因此 update 不能假定.llmdoc-tmp/investigations/始终存在output_path时,流程必须暂停并向用户请求写入授权,而不是卡在未定义状态3. 大型仓库首轮核心文档数过紧
原先“首轮稳定文档优先
2-3篇”的表述,对小型和中型仓库是合理的,但对大型仓库有点过于保守。当仓库确实存在多个应分开记录的不变量簇、运行流和契约面时,把首轮强行压成
2-3篇会造成:recorder在实践中倾向于把不该捏在一起的内容塞进同一篇因此本 PR 只放宽“大型仓库首轮核心文档数”,不放宽“浅文档泛滥”的总体约束。
变更内容
协议表面:Init / Investigator / Recovery
commands/init.mdoutput_path为 canonical artifact;sidecar 只作恢复来源;transport_failure时先查output_path再查 sidecar,必要时复制还原主路径;context_overflow时拆分为 ≤3 个子 brief;首轮 investigation subagent 启动个数按体量阈值分档(小型1-2/ 中型2-3/ 大型3-5);大型仓库首轮核心文档数放宽为3-5agents/investigator.mdOutputFormat_File明确哨兵为最后一行、主写入优先、sidecar 为 best-effort 恢复通道、SIDECAR_PATH字段和 Brief 预算.codex/agents/llmdoc-investigator.tomlskills/llmdoc-init/SKILL.mdcommands/init.md同步 recovery 契约;补充大型仓库首轮核心文档可为3-5Update 工作流对齐
commands/update.md.llmdoc-tmp/investigations/;复用 init 的 canonicaloutput_path/ sentinel / sidecar 恢复协议;补齐“无法建目录 / 无法写 fallback / 无法还原 canonical 路径”时的用户授权升级路径skills/llmdoc-update/SKILL.mdcommands/update.md同步,确保 Codex helper skill 不落后于命令契约稳定文档生成策略
commands/init.md1-2个 investigator,中型2-3个,大型3-5个;首轮稳定文档也改为 size-aware:小型/中型仓库通常2-3篇,大型仓库允许3-5篇深度 architecture/reference 文档agents/recorder.mdrecorder在大仓库上被过度约束skills/llmdoc-init/SKILL.mdllmdoc/architecture/init-investigation-orchestration.md架构文档、指南与路由
llmdoc/architecture/init-investigation-orchestration.mdllmdoc/guides/updating-init-investigation-depth.mdllmdoc/index.mdllmdoc/must/doc-routing.md公开说明
README.md3-5的说明README.zh-CN.md反思文档
llmdoc/memory/reflections/2026-04-20-subagent-transport-failure.mdllmdoc/memory/reflections/2026-04-21-context-overflow-recovery.md其他修改
.claude-plugin/plugin.json3.0.0.claude/settings.local.jsonWebFetch(domain:claude.com)、WebSearch文件落盘调查失败处理
Init 是四状态协议的主场景;Update 在需要 file-sink scratch 调查时复用同一协议。
persistedoutput_path,且包含<!-- llmdoc:eor -->哨兵output_path存在、非空、含哨兵后继续write_failed_fallback_readyreport_markdown写回同一output_path,再验证哨兵transport_failureoutput_path,再查<output_path>.sidecar.md;若只有 sidecar 完整,则复制还原 canonicaloutput_path并验证;两者都不可恢复才重跑context_overflow补充说明:
<!-- llmdoc:eor -->必须是报告文件最后一行output_path被验证成功,主题才算完成output_path,必须暂停并向用户请求写入授权首轮稳定文档策略
首轮稳定文档仍然遵循“先深后广”:
2-3篇核心 architecture / reference 文档3-5篇,只要这些文档分别覆盖不同的不变量簇、流程或契约边界这不是鼓励首轮铺很多浅文档,而是给大型仓库留下足够的结构表达空间。
依然不应该把首轮稳定文档扩张成
10+篇浅层摘要。首轮 investigation subagent 启动阈值
在生成稳定文档之前,
/llmdoc:init会先按体量分档决定第一波 investigation subagent 的启动个数:1-22-33-5这里的“按阈值启动个数”是首轮调查 fan-out 上限,不是硬性要求必须把配额打满。
如果主题面较少、某些主题可以合并、或当前平台前台稳定性不足,实际启动个数可以低于上限,但不应该在同等体量下无理由超过该范围。
非目标
.codex/config.toml中的max_threads/max_depth验证清单
/llmdoc:init,确认预调查校准提示出现,并显示No extra context, continue1-22-33-5<!-- llmdoc:eor -->transport_failure,确认先查output_path再查 sidecar;若 sidecar 完整则复制还原 canonical 路径context_overflow,确认走 brief 拆分路径而非重跑同样 scope.llmdoc-tmp/”之后运行/llmdoc:update,确认会按需重建.llmdoc-tmp/investigations//llmdoc:update的 fallback 写入失败或 sidecar 还原失败,确认会暂停并请求用户授权,而不是无声卡住3-5篇深度 architecture / reference 文档,而不是被硬压成2-3