Loading...
Loading...
Compare original and translation side by side
"Context is an external resource, not a local variable."
rlm.py「上下文是外部资源,而非局部变量。」
rlm.pyundefinedundefined
All commands support `--output /path/to/file.json` to write results to file.
**Fallback**: If rlm.py unavailable, use native tools: Grep, Glob, Read, `rg`, `find`.
所有命令均支持`--output /path/to/file.json`参数,用于将结果写入文件。
**备选方案**:如果rlm.py不可用,可使用原生工具:Grep、Glob、Read、`rg`、`find`。python3 ~/.claude/skills/rlm/scripts/dev-rlm.py stats
python3 ~/.claude/skills/rlm/scripts/dev-rlm.py stats --type pypython3 ~/.claude/skills/rlm/scripts/dev-rlm.py stats
python3 ~/.claude/skills/rlm/scripts/dev-rlm.py stats --type pypython3 ~/.claude/skills/rlm/scripts/dev-rlm.py grep "TODO|FIXME|HACK" --type py
rg -l "error" --type pypython3 ~/.claude/skills/rlm/scripts/dev-rlm.py grep "TODO|FIXME|HACK" --type py
rg -l "error" --type pyjq -s '.' /tmp/rlm_*.json > /tmp/rlm_report.json
jq -s '[.[].findings] | add | group_by(.severity)' /tmp/rlm_*.jsonjq -s '.' /tmp/rlm_*.json > /tmp/rlm_report.json
jq -s '[.[].findings] | add | group_by(.severity)' /tmp/rlm_*.json| Strategy | When | Agent Type | Agents |
|---|---|---|---|
| Peek | Quick answer, few files relevant | None (main context) | 0 |
| Grep + Read | Pattern in known locations | None (main context) | 0 |
| Fan-out Explore | Question about code behavior/patterns | Explore | 2-5 |
| Partition + Map | Systematic analysis of many files | general-purpose | 3-8 |
| Recursive Decompose | Partitions still complex | general-purpose | 2-4 per level |
| Summarize + Drill | Large result set needs synthesis first | Mixed | 2-6 |
| 策略 | 适用场景 | Agent类型 | Agent数量 |
|---|---|---|---|
| Peek(快速查看) | 需要快速获取答案、相关文件数量少 | 无(主上下文处理) | 0 |
| Grep + Read(搜索+读取) | 已知位置存在特定模式 | 无(主上下文处理) | 0 |
| Fan-out Explore(扇出探索) | 针对代码行为/模式的问题 | Explore | 2-5 |
| Partition + Map(划分+映射) | 对大量文件进行系统性分析 | 通用型 | 3-8 |
| Recursive Decompose(递归分解) | 划分后的任务仍较复杂 | 通用型 | 每层级2-4个 |
| Summarize + Drill(汇总+深挖) | 大型结果集需要先进行合成 | 混合型 | 2-6 |
statsstatsTask(
description="Trace error propagation paths",
prompt="Search for error handling patterns in this codebase.
Focus on: try/catch, error types, propagation chains.
Write summary to /tmp/rlm_errors.md",
subagent_type="Explore",
run_in_background=true
)Task(
description="追踪错误传播路径",
prompt="搜索此代码库中的错误处理模式。
重点关注:try/catch、错误类型、传播链。
将总结写入/tmp/rlm_errors.md",
subagent_type="Explore",
run_in_background=true
)Task(
description="Analyze auth module (partition 1/4)",
prompt="Analyze these files for security issues:
[file list from rlm.py chunk output]
Write findings to /tmp/rlm_p1.json as JSON:
{\"partition\": 1, \"findings\": [{\"file\": \"\", \"line\": 0, \"issue\": \"\", \"severity\": \"\"}]}",
subagent_type="general-purpose",
run_in_background=true
)rlm.py chunkTask(
description="分析认证模块(第1/4分组)",
prompt="分析以下文件中的安全问题:
[来自rlm.py chunk输出的文件列表]
将分析结果以JSON格式写入/tmp/rlm_p1.json:
{\"partition\": 1, \"findings\": [{\"file\": \"\", \"line\": 0, \"issue\": \"\", \"severity\": \"\"}]}",
subagent_type="general-purpose",
run_in_background=true
)rlm.py chunkTaskOutput(task_id=<agent_id>, block=true, timeout=120000)TaskOutput(task_id=<agent_id>, block=true, timeout=120000)general-purposegeneral-purpose| Level | Role | Max Agents | Spawns? |
|---|---|---|---|
| 0 (Main) | Orchestrator | 5 | Yes |
| 1 (Worker) | Domain analyzer | 3 per worker | Yes |
| 2 (Leaf) | Module specialist | 0 | Never |
| 层级 | 角色 | 最大Agent数量 | 是否可生成子Agent |
|---|---|---|---|
| 0(主Agent) | 编排器 | 5 | 是 |
| 1(Worker) | 领域分析器 | 每个Worker最多3个 | 是 |
| 2(叶子节点) | 模块专家 | 0 | 绝不允许 |
"You are analyzing [SCOPE]. You may spawn up to [N] sub-agents if needed.
RECURSION RULES:
- Current depth: [D]. Max depth: 2.
- If depth=2, you are a leaf. Do NOT spawn agents.
- Only recurse if your scope has 50+ files or distinct sub-problems.
- Each sub-agent writes to /tmp/rlm_d[D+1]_[ID].json
- After sub-agents complete, merge their results into your output file.""你正在分析[SCOPE]。如有需要,你可生成最多[N]个子Agent。
递归规则:
- 当前深度:[D]。最大深度:2。
- 如果深度=2,你是叶子节点Agent,禁止生成子Agent。
- 仅当你的分析范围包含50+文件或存在独立子问题时,才可进行递归。
- 每个子Agent需将结果写入/tmp/rlm_d[D+1]_[ID].json
- 子Agent完成任务后,将其结果合并到你的输出文件中。"| Depth | Output Path | Merged By |
|---|---|---|
| 2 (leaf) | | Depth-1 parent |
| 1 (worker) | | Main orchestrator |
| 0 (main) | | Main context |
| 深度 | 输出路径 | 合并者 |
|---|---|---|
| 2(叶子节点) | | 上一级(深度1)的父Agent |
| 1(Worker) | | 主编排器 |
| 0(主Agent) | | 主上下文 |
| Metric | Limit |
|---|---|
| Max concurrent agents (any level) | 5 |
| Max total agents (all levels) | 15 |
| Max recursion depth | 2 |
| Max files per leaf agent | 20 |
| Timeout per agent | 120s |
| Max spawn rounds (main orchestrator) | 3 |
| 指标 | 限制值 |
|---|---|
| 任意层级的最大并发Agent数量 | 5 |
| 所有层级的最大总Agent数量 | 15 |
| 最大递归深度 | 2 |
| 每个叶子节点Agent处理的最大文件数量 | 20 |
| 单个Agent的超时时间 | 120秒 |
| 主编排器的最大生成轮次 | 3 |
/tmp/rlm_*cat/tmp/rlm_*cat *statscat *statsrlm.py statsrlm.py greprg/tmp/rlm_*/tmp/rlm_*rlm.py statsrlm.py greprg/tmp/rlm_*/tmp/rlm_*| rlm.py command | Native equivalent |
|---|---|
| |
| Grep tool or |
| Grep tool with |
| Read tool with offset/limit |
| Glob + manual partitioning |
| rlm.py命令 | 原生等价工具 |
|---|---|
| |
| Grep工具或 |
| 带 |
| 带偏移量/限制的Read工具 |
| Glob + 手动划分 |
quick-reference.mdquick-reference.md