Token导航 LogoToken导航

Agent Skill · 研究检索

comprehend(comprehend 搜索)

comprehend 用于查找、检索和筛选相关信息,适合在 Codex、Claude、Cursor、Gemini CLI 中需要根据关键词、任务场景或来源线索快速定位候选结果时使用。可结合来源仓库、安装命令和原始 README 继续核验具体用法。安装前建议确认权限范围、维护状态,以及是否会触发联网、命令执行或文件读写。

comprehend 是研究检索类 Agent Skill,可用宿主为 Codex、Claude、Cursor、Gemini CLI,通过GitHub 仓库获取,权限为执行命令;许可证信息还不明确,第三方扫描有未通过项,按安装量在研究检索类的 73,675 个 Skill 里排第 58,252。

总安装 419周安装 18GitHub Stars 8下载 147核验 2026-05-01

安装说明

本站只整理中文说明,不托管安装包,也不代用户安装。
GitHub
许可证
unknown

安装方式

通过对话安装

复制提示词发给支持本地命令或 Skills 的 AI 助手,先确认命令和权限,再让它执行。

请帮我安装这个 Agent Skill:comprehend(comprehend 搜索)
来源仓库:https://github.com/johnwbyrd/comprehend
仓库路径:skills/comprehend
安装命令:
npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend
安装前请先检查当前环境是否支持对应 CLI,并向我确认将要执行的命令、安装目录、联网范围和文件读写权限;确认后再执行。

命令行安装

复制命令到本机终端执行。该命令会通过 npx skills 从第三方来源获取 Skill;本站只展示命令,不托管安装包,也不自动执行。

skills.shnpx skills
npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend

这个 Skill 是做什么的

研究检索类 Skill 主要解决「找资料、核对事实、把来源整理清楚」的问题,通常会让助手先检索再总结。

用于深入理解陌生代码库结构与行为,避免盲目修改引发事故。采用分片阅读与持久 REPL 记录方式,控制上下文窗口占用。推荐先运行脚本黑箱测试,再决定是否深入分析源码逻辑。适用于首次接触大型遗留系统或复杂依赖项目的开发者。comprehend 属于研究检索类 Skill,可作为该场景下的辅助能力补充。

安装前建议确认是否有权限读取项目文件及运行测试脚本。

来源仓库内路径:skills/comprehend

上手步骤

4 步
  1. 1

    确认自己的宿主工具

    公开资料标注支持 Codex、Claude、Cursor、Gemini CLI;先确认自己用的是其中之一,再按对应工具的 Skills 目录放置。

  2. 2

    拿到安装命令

    可以直接复制的命令是 npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend;命令里的占位符换成自己的路径或密钥再执行。

  3. 3

    安装后重启宿主

    命令执行完要完全退出宿主工具再打开,让新装的 Skill 被重新扫描到,否则列表里可能看不到。

  4. 4

    按最小权限试用

    它需要执行命令,先在测试目录或测试账号里跑,确认没问题再放到正式项目。

常见问题

6 条

comprehend 怎么安装?

在终端执行 npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend。装完完全退出宿主工具再打开,让它重新扫描本地 Skill。

comprehend 支持哪些 AI 工具?

公开资料标注支持 Codex、Claude、Cursor、Gemini CLI。其他工具只要能读取本地 Skill 目录,一般也能手动放进去,但要自己确认触发方式是否一致。

comprehend 需要什么权限?

权限级别是执行命令。安装流程涉及命令执行,可能通过 npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

comprehend 是免费的吗?

公开资料没有标注明确许可证,收费和商用限制都无法确认。正式使用前请到来源仓库核对授权说明。

comprehend 用的人多吗?

公开数据是累计安装 419 次,近一周安装 18 次,下载 147 次,GitHub 8 星。这些数字来自第三方目录统计,只能当作热度参考,不代表质量或安全性。

comprehend 安全吗?

第三方扫描有未通过项,风险较高。除非你确认过源码,否则不建议直接安装到常用环境。

值得选的地方和要先想清楚的地方

值得选的地方

  • 同时适配 4 种工具,换客户端不用重新找替代品。

先想清楚的地方

  • 需要执行命令,装到常用环境前要先评估影响面。
  • 许可证没有明确标注,能不能商用、能不能再分发都不确定。
  • 第三方扫描存在提醒项或未通过项,需要人工逐条确认。
  • 第三方目录整理,版本更新和行为细节以来源仓库为准。

适不适合你

更适合

  • 已经在用 Codex,想直接扩展它能力的人。
  • 需要处理研究检索类任务、又不想每次都手写提示词的人。

不太适合

  • 不能接受 Skill 在你机器上执行命令的人。
  • 需要明确授权才能用到公司项目里的场景。
  • 需要厂商级技术支持和 SLA 的生产系统。

研究检索类 Skill 对比

6 个同类
Skill总安装GitHub 星权限许可证扫描
find-skills

寻找技能 · Codex、Claude

31,199,81316,486操作浏览器MIT有提醒
self-improving-agent

自我改进 Agent · OpenClaw

16,464,0023,396接触敏感数据MIT-0通过
soultrace

灵魂追踪 · Codex、Claude

7,588,94412需要联网未明确有提醒
self-improving

自我完善 · OpenClaw

6,829,2841,046需要联网MIT-0通过
microsoft-foundry

微软代工厂 · Codex、Claude

6,614,144764调用外部服务未明确有提醒
comprehend

comprehend 搜索 · 本页

4198执行命令未明确未通过

按安装量取同分类前几名;数字来自第三方目录统计,只作热度参考,不代表质量结论。

SKILL.md 原文

Comprehend

You are working in an unfamiliar codebase. Before you touch anything, understand what you're dealing with.

Break the problem into pieces. Use a persistent REPL to store everything you learn. Fan out subagents to do the reading. Keep your own context window small and available for the actual work — edits, debugging, reasoning.

That is the entire method. What follows is how to do it.

When to Use This

Use this workflow whenever you are making changes in code you don't already understand. This includes:

  • Fixing a bug in a repository you haven't seen before
  • Adding a feature that touches multiple files or modules
  • Refactoring code whose structure you need to map out first
  • Any task where you'd otherwise spend your first several turns just reading

The default instinct is to start reading files immediately and jump to a fix. That works for trivial changes. For anything else, it leads to patches that miss edge cases, break related code, or over-engineer because you didn't see the simpler path. Measure first.

Skip this workflow only when the change is truly trivial — a one-line typo fix, a config value change, something where understanding the surrounding code is unnecessary.

Prerequisites

This skill requires python and nohup. Before doing anything else, verify they are available:

python --version && nohup --version > /dev/null 2>&1 && echo "ok"

Note that the Python executable may be called python3, or your user may have set up a specific tool for running Python which they prefer you to use.

If you can't get Python to print ok, stop here. Tell the user which command is missing. On Windows, both are available in Git Bash. On macOS and Linux, both are standard.

Script Paths

This skill bundles scripts in its scripts/ directory. Before using them, resolve the absolute path based on where you loaded this SKILL.md from. For example, if you loaded this file from /home/user/project/skills/comprehend/SKILL.md, then the scripts are at /home/user/project/skills/comprehend/scripts/.

Throughout this document, SCRIPTS refers to that resolved path. In all bash commands, substitute the actual absolute path.

The REPL

Every session starts by generating a unique address and launching the server:

# Generate a session-unique address (prevents collisions between
# simultaneous sessions on the same machine)
REPL_ADDR=$(python SCRIPTS/repl_server.py --make-addr)
nohup python SCRIPTS/repl_server.py "$REPL_ADDR" > /dev/null 2>&1 &

The server must outlive the shell that starts it. Use nohup and shell backgrounding (&) as shown above. Do not use the Bash tool's run_in_background parameter — it may kill the server when the task "completes." On Windows, the server automatically uses TCP on localhost instead of Unix sockets. No code changes needed — the interface is identical.

Throughout this document, REPL_ADDR refers to the session-unique address returned by --make-addr. In all bash commands, substitute the actual path. Each session must use its own address.

This launches a persistent Python REPL. Variables, imports, and definitions survive across calls — not just during comprehension, but for the entire session. The REPL is your memory: use it instead of reading files into your context window.

This is the key tradeoff. The upfront cost is a few extra turns to launch the server and measure the codebase. The payoff: you build a queryable knowledge base that persists for the entire session. When you need to check something later — while debugging, while writing tests, while responding to follow-up questions — you query the REPL instead of re-reading source files. Every lookup costs one small Bash call instead of consuming context window.

Always use a heredoc to send code to the REPL. Never pass code as a positional command-line argument — it will break on quotes, braces, or multi-line input. The only exceptions are --vars, --shutdown, and --file.

# Run code (state persists between calls)
python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
greeting_message = "hello"
PYEOF

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
print(greeting_message)
PYEOF

# See all stored variables
python SCRIPTS/repl_client.py REPL_ADDR --vars

The quoted delimiter (<<'PYEOF') passes all characters through to Python unchanged — single quotes, double quotes, backslashes, parentheses, braces, everything.

Large results: Heredocs can break on very large blocks of code (100+ lines). When storing large data in _comprehend_results, use the Write tool to write the Python code to a temporary file, then use --file:

# First: use the Write tool to create /tmp/comprehend_data.py
# with the Python code (assignments, dict literals, etc.)
# Then:
python SCRIPTS/repl_client.py REPL_ADDR --file /tmp/comprehend_data.py

This bypasses shell quoting entirely. The Write tool writes the file directly, and --file reads it directly. Use this for any REPL code that is too large for a heredoc.

Windows paths in heredocs: Always use forward slashes in Python code inside heredocs ("C:/Users/..." not "C:\\Users\\..."). Python accepts forward slashes on all platforms. This avoids backslash-as-line-continuation confusion.

CRITICAL: AFTER STARTING THE REPL SERVER, YOU MUST NOT USE ANY OTHER TOOLS FOR FILE OPERATIONS.

The following actions are FORBIDDEN once the REPL is running:

  • Using cat, head, tail, grep, find, wc, ls or any shell command to read files
  • Using Read_file tool to read source files directly into your context
  • Using Glob tool to enumerate files
  • Using Grep tool to search file contents
  • Any operation that brings file content into your context window

If you catch yourself about to use a shell command or file tool to access file content, STOP. Use the REPL client instead.

Use the REPL for everything! Finding files, searching content, reading source, storing results — all of it. Every fact you discover goes into a variable where it accumulates instead of evaporating.

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
import glob, os, re

# Find files (instead of Glob tool)
project_source_files = glob.glob("/path/to/project/**/*.py", recursive=True)
project_source_files = [f for f in project_source_files if "/.git/" not in f.replace("\\", "/")]

# Measure them (instead of wc)
file_size_by_path = {f: os.path.getsize(f) for f in project_source_files}
total_source_bytes = sum(file_size_by_path.values())

# Search content (instead of Grep tool)
function_definition_matches = {}
for filepath in project_source_files:
    with open(filepath) as fh:
        for line_number, line_text in enumerate(fh, 1):
            if re.search(r"def process_", line_text):
                function_definition_matches.setdefault(filepath, []).append(
                    (line_number, line_text.strip()))

# Everything persists: project_source_files, file_size_by_path,
# total_source_bytes, function_definition_matches
print(f"{len(project_source_files)} files, {total_source_bytes/1024:.0f} KB, "
      f"{len(function_definition_matches)} files with matches")
PYEOF

The Results Dict

All subagent findings go into one well-known dict: _comprehend_results.

The REPL server initializes this dict automatically on startup. Do not re-initialize it — that would wipe results from other subagents. Just write to it:

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
_comprehend_results["auth_module_analysis"] = {"functions": [...], "issues": [...]}
PYEOF

The parent assigns every subagent a unique key before launching it. Subagents must never choose their own keys — the parent is the only one that sees all keys in use and can guarantee uniqueness. A subagent writes only to its assigned key; it never reads or writes other subagents' keys.

Keys should be descriptive: 'auth_module_function_signatures', not 'chunk1'. For deeper nesting, use sub-keys within the assigned key:

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
_comprehend_results["auth_module"] = {
    "function_signatures": [...],
    "import_map": {...},
    "issues": [...]
}
PYEOF

The parent reads from _comprehend_results[key]. The underscore prefix and specific name avoid collisions with user or project variables.

The Workflow

1. Measure

Before reading any files, measure everything relevant to your task. Use the REPL (as above) or the bundled script:

python SCRIPTS/chunk_text.py info <file>

Measure broadly — source, tests, docs, config. The most common failure is measuring only the core source, classifying it as small, then also reading tests and docs and blowing past the limit.

2. Choose a strategy

Total SizeStrategy
< 50KBRead directly into REPL variables. No subagents needed.
50KB–200KBFan out subagents — one per file or file group, parallel.
200KB–1MBChunk + fan out + aggregate in REPL.
> 1MBTwo-level: chunk, fan out, aggregate chunks, synthesize.

3. Plan

Based on what you measured, decide what to read and in what order. For a bug fix, focus on the files in the stack trace plus their immediate dependencies. For a feature, map the module boundaries first. State your plan before reading anything.

4. Execute

Fan out subagents. Each writes to _comprehend_results[key]. You read the results back. Details are in the Fan-Out Patterns section below.

5. Iterate

If the aggregated answer has gaps, target those specific areas for deeper analysis. The REPL still holds everything from the first pass.

6. Make Your Changes

Now that you understand the code, make your edits. The REPL remains available — query _comprehend_results whenever you need to check something instead of re-reading source files. This keeps your context window small and available for reasoning about the actual changes.

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
# Check a detail without re-reading source
print(_comprehend_results["core_library"]["function_signatures"])
PYEOF

7. Shut down the REPL

When your task is complete, shut down the REPL:

python SCRIPTS/repl_client.py REPL_ADDR --shutdown

The nohup server runs until explicitly stopped. Shut it down when done to avoid leaving an orphan process.

The 50KB Rule

Never read more than 50KB of source into your main context window. Everything above that limit must go through subagents that write findings to the REPL. The cost of a subagent is latency. The cost of context exhaustion is the entire rest of the session.

Watch for the trap: you measure 30KB of core source (under threshold!), then also read tests, config, and docs — now you're at 120KB and your context window is shot. Measure the total. All of it.

Fan-Out Patterns

All patterns follow the same contract:

  1. Parent starts the REPL server (once per session). _comprehend_results is auto-initialized. Never re-initialize it.
  2. Parent assigns a unique key to each subagent in the prompt. Subagents never pick their own keys.
  3. Subagent writes findings only to its assigned _comprehend_results[key]. It may create sub-keys within that key freely, but must not touch any other top-level key.
  4. Subagent reports back the key it wrote and a summary of what's in it.
  5. Parent reads _comprehend_results[key] from the REPL.

Step 4 is critical. The Task tool returns a text message to the parent — that message is the *only* way the parent learns what the subagent stored. Every subagent prompt must end with an instruction to report what was written.

Direct Query

For simple one-shot tasks (summarize, classify, extract a fact). The subagent's return value is used directly — no REPL variable needed.

Task(subagent_type="Explore",
     prompt="Summarize the key functions in this file: <chunk>")

Recursive Query

For sub-problems needing multi-step reasoning or tool access. The subagent stores results in _comprehend_results under a descriptive key.

Parent launches subagent:

Task(subagent_type="general-purpose",
     prompt="Use the REPL at REPL_ADDR. Read and analyze these modules.
     Store your findings in _comprehend_results['auth_module_analysis'] as a
     dict with keys:
       'function_signatures' — list of all public function signatures
       'import_dependency_map' — dict mapping each file to its imports
       'identified_concerns' — list of architectural or correctness issues

     Files: src/auth.py, src/models.py, src/tokens.py

     When done, reply with: the key you wrote to in _comprehend_results,
     what sub-keys you stored, and a one-line summary of each.")

Parent receives a message like: "Wrote to _comprehend_results['auth_module_analysis'] with keys: 'function_signatures' (12 public functions), 'import_dependency_map' (3 files mapped), 'identified_concerns' (2 issues: circular import between auth.py and models.py, unused import in tokens.py)."

Parent reads back:

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
auth_data = _comprehend_results["auth_module_analysis"]
print("Functions:", auth_data["function_signatures"])
print("Concerns:", auth_data["identified_concerns"])
PYEOF

Batched Parallel Query

For independent chunks that can run concurrently. Issue all Task calls in a single message.

Parent launches all subagents at once:

Task(prompt="Use REPL at REPL_ADDR. Analyze this log segment for errors.
     Store in _comprehend_results['log_segment_hours_00_to_06'] as a dict with
     keys 'error_summary' and 'critical_error_list'.
     Segment: <chunk1>

     When done, reply with: the _comprehend_results key you wrote,
     how many errors found, and one sentence summarizing the most severe.")

Task(prompt="Use REPL at REPL_ADDR. Analyze this log segment for errors.
     Store in _comprehend_results['log_segment_hours_06_to_12'] as a dict with
     keys 'error_summary' and 'critical_error_list'.
     Segment: <chunk2>

     When done, reply with: the _comprehend_results key you wrote,
     how many errors found, and one sentence summarizing the most severe.")

Task(prompt="Use REPL at REPL_ADDR. Analyze this log segment for errors.
     Store in _comprehend_results['log_segment_hours_12_to_18'] as a dict with
     keys 'error_summary' and 'critical_error_list'.
     Segment: <chunk3>

     When done, reply with: the _comprehend_results key you wrote,
     how many errors found, and one sentence summarizing the most severe.")

Parent receives three messages confirming what each wrote.

Parent reads accumulated results:

python SCRIPTS/repl_client.py REPL_ADDR <<'PYEOF'
for segment_key, segment_data in sorted(_comprehend_results.items()):
    if segment_key.startswith("log_segment_"):
        print(f"{segment_key}: {segment_data['error_summary']}")
        for critical_error in segment_data.get('critical_error_list', []):
            print(f"  - {critical_error}")
PYEOF

Chunking

For large single files, use the bundled script to split at natural boundaries:

python SCRIPTS/chunk_text.py info large_file.txt      # measure
python SCRIPTS/chunk_text.py boundaries source.py      # find split points
python SCRIPTS/chunk_text.py chunk large_file.txt --size 80000 --overlap 200  # split

For structured files (code, markdown), prefer splitting at functions, classes, or section headers rather than arbitrary character boundaries.

References

  • references/comprehension-patterns.md — Five worked examples.
  • references/mapping-table.md — RLM primitive to agent tool mapping.
  • references/rlm-system-prompt.md — Theoretical foundation.

平台分布

Codex

32.85%
按下载量换算48

Claude

32.59%
按下载量换算48

Cursor

20.61%
按下载量换算30

Gemini CLI

8.52%
按下载量换算13

安全审计

Gen Agent Trust Hub

可疑

Socket

通过

Snyk

未通过

权限和风险

执行命令

安装流程涉及命令执行,可能通过 npx skills add https://github.com/johnwbyrd/comprehend --skill comprehend 联网下载 Skill 或依赖。用户安装前应确认命令来源、仓库内容和执行环境。

安装前确认

本站仅展示第三方公开信息,不托管安装包,不提供自动安装或运行环境。安装前应自行审查源码、依赖和命令行为。来源安全扫描存在提醒或未通过项,安装前请自行复核。目前只有一个公开来源,建议同时核对源仓库。

继续浏览同类 Skills