
Claude Code 技能,用于通过递归分解处理长上下文任务
概览
在保持上下文较小的同时分解长上下文任务。基于递归语言模型研究的Claude代码、Codex、光标及兼容代理的代理技能 安装 ·使用 ·工作原理 ·评估 ·结构 ·致谢 庞大的代码库、数十个文档、冗长的报告:随着上下文的增长,模型会遗漏细节,通过猜测连接远处部分,导致准确性下降。递归语言模型论文称之为上下文腐烂。 当任务是代码库范围的、多文档、一堆PDF或密集的聚合时,即使它符合窗口,技能也要求代理将输入视为查询环境,而非文本被吸收: 1. 读取任何内容前的输入。2. 搜索空间,包含搜索,而非读取。3. 剩余部分分为5到10个文件或自然单元的批次。4. 深度为1,每批有一名子代理,每个子代理都有独立简报。子代理不生成子代理。5. 在源头小窗口中合并答案。6.
概述(AI 翻译)
递归分解技能
在保持上下文较小的同时,分解长上下文任务。 基于递归语言模型研究的Claude代码、Codex、光标及兼容代理的代理技能
安装· 使用情况 · 工作原理· 评估 · 结构· 致谢
问题所在
庞大的代码库、数十个文档、冗长的报告:随着上下文的增长,模型会遗漏细节,通过猜测连接远处部分,导致准确性下降。递归语言模型论文称之为上下文腐烂。
它的作用
当任务是代码库范围的、多文档、一堆PDF或密集的聚合时,即使它符合窗口,技能也要求代理将输入视为查询环境,而非文本被吸收:
- **读取任何东西前先调整输入大小。
- 用搜索筛选搜索空间,而不是阅读。
- 将剩余部分分块**成批5到10个文件或自然单元。
- 递归在深度1,每批有一个子代理,每个子代理都有自包含的简报。子代理不生成子代理。
- 验证合并后的答案,在一个小窗口中与来源对比。
本页由 AI 翻译,技术细节请以原文为准。
README
以下为原文 README 节选,完整内容请查看原文。
Recursive Decomposition Skill
Decompose long-context tasks while keeping the context small. An Agent Skill for Claude Code, Codex, Cursor and compatible agents, based on the Recursive Language Models research
Install · Usage · How it works · Eval · Structure · Acknowledgments
The problem
Large codebases, dozens of documents, long reports: as the context grows, models miss details, link distant parts by guesswork and lose accuracy. The Recursive Language Models paper calls it context rot.
What it does
When a task is codebase-wide, multi-document, a pile of PDFs, or a dense aggregate, even if it fits the window, the skill makes the agent treat the input as an environment to query instead of text to swallow:
- Size the input before reading anything.
- Filter the search space with searches, not reads.
- Chunk what remains into batches of 5 to 10 files or natural units.
- Recurse at depth 1 with one sub-agent per batch, each with a self-contained brief. Sub-agents do not spawn sub-agents.
- Verify the merged answer on a small window against the sources.
- Synthesise programmatically, with file and line references.
PDFs go through anydoc first (npx -y @firecrawl/anydoc FILE -o .firecrawl/out.md), then grep the markdown. Cloud firecrawl parse is for OCR, -Q, or -S. A one-page convert job is not this skill.
Install
With the skills CLI:
npx skills add massimodeluisa/recursive-decomposition-skill
推荐工具
换一个关键词,或者移除筛选条件。
安装
npx skillfish add massimodeluisa/recursive-decomposition-skill