xlb-topic-index
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseTopic Index Command
主题索引命令
Overview
概述
Resolve query phrases into a command for the local API, then return Markdown index content.
xlbtitle将查询语句转换为本地API的命令,然后返回Markdown索引内容。
xlbtitleWhen to Use
使用场景
- User input contains as a query trigger.
xlb - User gives command directly and expects passthrough.
>.../ - User asks for topic index/navigation instead of narrative explanation.
- User wants direct Markdown output from the knowledge source.
- 用户输入包含作为查询触发词。
xlb - 用户直接给出命令并期望直接传递。
>.../ - 用户询问主题索引/导航而非叙述性解释。
- 用户希望从知识源直接获取Markdown输出。
Interaction Rule
交互规则
- If input matches any trigger pattern below, execute directly without extra questions.
- If input mentions but no topic can be extracted, ask:
xlb请发送你要查询的指令,例如:xlb >Vibe Coding/AI超元域 或 xlb ??Vibe Coding
- 如果输入匹配以下任何触发模式,直接执行,无需额外提问。
- 如果输入提到但无法提取主题,询问:
xlb请发送你要查询的指令,例如:xlb >Vibe Coding/AI超元域 或 xlb ??Vibe Coding
Trigger Mapping
触发映射
- ->
xlb >vibe coding/vib(striptitle=>vibe coding/vib, payload passthrough)xlb - ->
xlb ??vibe coding(striptitle=??vibe coding, payload passthrough)xlb - ->
xlb ->vibe coding/:(striptitle=->vibe coding/:, payload passthrough to API)xlb - ->
xlb >vibe coding/searchin:(related-topic edges only)title=>vibe coding/searchin: - ->
xlb >vibe coding/command:(executable command edges only)title=>vibe coding/command: - ->
查询xlb vibe coding主题title=>vibe coding/ - ->
>AI Model/(direct passthrough)title=>AI Model/
- ->
xlb >vibe coding/vib(移除title=>vibe coding/vib,负载直接传递)xlb - ->
xlb ??vibe coding(移除title=??vibe coding,负载直接传递)xlb - ->
xlb ->vibe coding/:(移除title=->vibe coding/:,负载直接传递给API)xlb - ->
xlb >vibe coding/searchin:(仅返回相关主题关联)title=>vibe coding/searchin: - ->
xlb >vibe coding/command:(仅返回可执行命令关联)title=>vibe coding/command: - ->
查询xlb vibe coding主题title=>vibe coding/ - ->
>AI Model/(直接传递)title=>AI Model/
Execute
执行方式
Run:
bash
skills/xlb-topic-index/scripts/fetch-topic-index.sh "xlb ??Vibe Coding"The script performs:
POST http://localhost:5000/getPluginInfo- form fields:
title=<resolved command>url=markdown=
运行:
bash
skills/xlb-topic-index/scripts/fetch-topic-index.sh "xlb ??Vibe Coding"该脚本执行以下操作:
- 发送请求
POST http://localhost:5000/getPluginInfo - 表单字段:
title=<解析后的命令>url=markdown=
Output Rule
输出规则
- Return API response Markdown directly.
- Do not paraphrase unless the user asks for analysis.
- 直接返回API响应的Markdown内容。
- 除非用户要求分析,否则不要改写内容。
Local URL Opening (built-in, no external dependency)
本地URL打开(内置功能,无外部依赖)
- This project has native URL-open capability for local apps, no dependency on .
/Users/wowdd1/App/*.sh - Single URL:
skills/xlb-topic-index/scripts/xlb-open-url.sh "https://example.com" chromepython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app chromepython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app diapython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app atlas
- Open links from search result JSON:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-hits --hits-json-file /tmp/xlb-search.json --app chrome --limit 3
- Optional integration with retrieve script:
XLB_OPEN_HITS=1 XLB_OPEN_APP=chrome XLB_OPEN_LIMIT=2 skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/:" "codex cli"
- 本项目具有本地应用URL打开的原生能力,不依赖。
/Users/wowdd1/App/*.sh - 单个URL打开:
skills/xlb-topic-index/scripts/xlb-open-url.sh "https://example.com" chromepython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app chromepython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app diapython3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-url --url "https://example.com" --app atlas
- 从搜索结果JSON中打开链接:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py open-hits --hits-json-file /tmp/xlb-search.json --app chrome --limit 3
- 与检索脚本的可选集成:
XLB_OPEN_HITS=1 XLB_OPEN_APP=chrome XLB_OPEN_LIMIT=2 skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/:" "codex cli"
Capability Routing Rule (for network content)
能力路由规则(针对网络内容)
- Before fetching external URL content, discover capabilities each run:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py discover
- If discover result contains suitable network skills or MCP tools, use them first.
- If no suitable skill/MCP capability exists, fallback to this skill's local scripts.
- Fallback policy: this skill must always remain runnable standalone (no hard dependency on external skills).
- Optional external route hook:
- Set
XLB_EXTERNAL_ROUTE_CMD=/path/to/command - Command contract: and prints final output when it handles the request.
cmd "<input>" "<retrieval_query>" - If external command exits non-zero or prints empty, fallback to local pipeline.
- Set
- 在获取外部URL内容之前,每次运行时先发现可用能力:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py discover
- 如果发现结果包含合适的网络技能或MCP工具,优先使用它们。
- 如果没有合适的技能/MCP能力,回退到本技能的本地脚本。
- 回退策略:本技能必须始终可以独立运行(不依赖外部技能)。
- 可选外部路由钩子:
- 设置
XLB_EXTERNAL_ROUTE_CMD=/path/to/command - 命令约定:,当它处理请求时打印最终输出。
cmd "<input>" "<retrieval_query>" - 如果外部命令返回非零状态或输出为空,回退到本地流水线。
- 设置
Code Retrieval Mode (efficient)
代码检索模式(高效)
- Use code-based retrieval instead of full markdown dump when user asks to search/analyze:
skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/coding" "codex cli"
- This mode does:
- Cache raw markdown
- Incremental update: if raw hash unchanged, skip re-ingest
- Parse markdown to virtual file tree
- Build sqlite index
- Optional concurrent prefetch of top-k URLs ()
XLB_PREFETCH_ARTIFACTS=1- HTML links are converted to /
markdownartifacts (not stored as raw HTML)text - External HTML converter is optional and preferred when configured
- HTML links are converted to
- Return top-k hits by query, or iterative rounds with stop strategy ()
XLB_ITERATIVE_SEARCH=1
当用户要求搜索/分析时,使用基于代码的检索而非完整Markdown导出:
- 该模式执行以下步骤:
skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/coding" "codex cli"
- 缓存原始Markdown
- 增量更新:如果原始内容哈希未变,跳过重新导入
- 将Markdown解析为虚拟文件树
- 构建sqlite索引
- 可选的Top-K URL并发预取()
XLB_PREFETCH_ARTIFACTS=1- HTML链接转换为/
markdown格式的工件(不存储为原始HTML)text - 配置后优先使用外部HTML转换器
- HTML链接转换为
- 根据查询返回Top-K结果,或采用带停止策略的多轮迭代检索()
XLB_ITERATIVE_SEARCH=1
Performance Flags
性能参数
- force refresh markdown from API
XLB_FORCE_REFRESH=1 - raw cache TTL value used only when
XLB_RAW_CACHE_TTL_SEC=300XLB_AUTO_REFRESH_ON_QUERY=1 - (default) do not auto refresh by TTL; only user explicit refresh (
XLB_AUTO_REFRESH_ON_QUERY=0) or cache miss will fetchXLB_FORCE_REFRESH=1 - (default) keep compact cache (
XLB_STORAGE_PROFILE=minimal), no large VFS treeraw + db + jsonl/topics - enable VFS folder/file materialization for folder-style browsing
XLB_STORAGE_PROFILE=full - force JSON output for no-query mode (returns raw file reference instead of full markdown text)
XLB_OUTPUT=json - force re-ingest even when cache hash unchanged
XLB_FORCE_REINDEX=1 - enable concurrent URL artifact prefetch
XLB_PREFETCH_ARTIFACTS=1 - control prefetch concurrency
XLB_MAX_WORKERS=6 - control returned hit count
XLB_TOPK=8 - choose HTML conversion output format
XLB_HTML_MODE=markdown|text - optional external converter command
XLB_HTML_CONVERTER_BIN=/path/to/script - tool id passed to external converter
XLB_HTML_CONVERTER_TOOL_ID=url-to-markdown - timeout for external converter execution
XLB_HTML_CONVERT_TIMEOUT_SEC=20 - enable iterative retrieval summary output
XLB_ITERATIVE_SEARCH=1 - max iterative rounds
XLB_MAX_ITER=5 - low-gain threshold
XLB_GAIN_THRESHOLD=0.05 - consecutive low-gain rounds before stop
XLB_LOW_GAIN_ROUNDS=3 - capability discovery cache TTL (seconds)
XLB_DISCOVER_CACHE_TTL_SEC=30 - open top hit URLs after retrieval (local app automation)
XLB_OPEN_HITS=1 - target app for opened URLs
XLB_OPEN_APP=chrome|dia|atlas|default - number of URLs to open
XLB_OPEN_LIMIT=1 - print open plan only, do not trigger app actions
XLB_OPEN_DRY_RUN=1
- 强制从API刷新Markdown
XLB_FORCE_REFRESH=1 - 原始缓存TTL值,仅当
XLB_RAW_CACHE_TTL_SEC=300时生效XLB_AUTO_REFRESH_ON_QUERY=1 - (默认) 不按TTL自动刷新;仅当用户显式刷新(
XLB_AUTO_REFRESH_ON_QUERY=0)或缓存未命中时才获取XLB_FORCE_REFRESH=1 - (默认) 保持紧凑缓存(
XLB_STORAGE_PROFILE=minimal),不生成大型VFS树raw + db + jsonl/topics - 启用VFS文件夹/文件实例化,支持文件夹式浏览
XLB_STORAGE_PROFILE=full - 在无查询模式下强制输出JSON(返回原始文件引用而非完整Markdown文本)
XLB_OUTPUT=json - 即使缓存哈希未变,也强制重新导入
XLB_FORCE_REINDEX=1 - 启用URL工件并发预取
XLB_PREFETCH_ARTIFACTS=1 - 控制预取并发数
XLB_MAX_WORKERS=6 - 控制返回结果数量
XLB_TOPK=8 - 选择HTML转换输出格式
XLB_HTML_MODE=markdown|text - 可选的外部转换器命令
XLB_HTML_CONVERTER_BIN=/path/to/script - 传递给外部转换器的工具ID
XLB_HTML_CONVERTER_TOOL_ID=url-to-markdown - 外部转换器执行超时时间
XLB_HTML_CONVERT_TIMEOUT_SEC=20 - 启用迭代检索摘要输出
XLB_ITERATIVE_SEARCH=1 - 最大迭代轮数
XLB_MAX_ITER=5 - 低增益阈值
XLB_GAIN_THRESHOLD=0.05 - 连续低增益轮数达到此值时停止
XLB_LOW_GAIN_ROUNDS=3 - 能力发现缓存TTL(秒)
XLB_DISCOVER_CACHE_TTL_SEC=30 - 检索后打开Top结果URL(本地应用自动化)
XLB_OPEN_HITS=1 - 打开URL的目标应用
XLB_OPEN_APP=chrome|dia|atlas|default - 打开的URL数量
XLB_OPEN_LIMIT=1 - 仅打印打开计划,不触发应用操作
XLB_OPEN_DRY_RUN=1
??
Multi-Topic Behavior
????
多主题行为
??- For inputs like (without retrieval query), the script returns a topic suggestion JSON.
xlb ??vibe coding - Each topic item includes:
- ,
topic,countsamples - (for example
entry_query)>Vibe Coding/ - (for example
entry_input)xlb >Vibe Coding/
- If multiple topics are returned, pick one and run it for focused retrieval.
entry_input
- 对于这类输入(无检索查询),脚本返回主题建议JSON。
xlb ??vibe coding - 每个主题项包含:
- 、
topic、countsamples - (例如
entry_query)>Vibe Coding/ - (例如
entry_input)xlb >Vibe Coding/
- 如果返回多个主题,选择其中一个运行以进行聚焦检索。
entry_input
Network Confirmation Policy
网络确认策略
- Default is confirmation-required for expensive network expansion steps.
- (default): external route + prefetch disabled unless confirmed.
XLB_REQUIRE_NETWORK_CONFIRMATION=1 - : allow network-expensive actions for current command.
XLB_NETWORK_CONFIRMED=1 - (default): print standardized confirmation template to stderr when network expansion is blocked.
XLB_SHOW_CONFIRM_TEMPLATE=1 - Default behavior without confirmation: only local index search + URL metadata output.
Example:
bash
XLB_PREFETCH_ARTIFACTS=1 \
XLB_HTML_MODE=markdown \
XLB_HTML_CONVERTER_BIN=/path/to/url-convert.sh \
XLB_HTML_CONVERTER_TOOL_ID=url-to-markdown \
skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/coding" "agent skills"- 默认情况下,执行高开销的网络扩展步骤需要确认。
- (默认):除非确认,否则禁用外部路由和预取。
XLB_REQUIRE_NETWORK_CONFIRMATION=1 - :允许当前命令执行高开销的网络操作。
XLB_NETWORK_CONFIRMED=1 - (默认):当网络扩展被阻止时,向标准错误输出打印标准化确认模板。
XLB_SHOW_CONFIRM_TEMPLATE=1 - 未确认时的默认行为:仅执行本地索引搜索 + URL元数据输出。
示例:
bash
XLB_PREFETCH_ARTIFACTS=1 \
XLB_HTML_MODE=markdown \
XLB_HTML_CONVERTER_BIN=/path/to/url-convert.sh \
XLB_HTML_CONVERTER_TOOL_ID=url-to-markdown \
skills/xlb-topic-index/scripts/retrieve-topic-index.sh "xlb >vibe coding/coding" "agent skills"Benchmark (before/after)
基准测试(优化前后)
bash
python3 skills/xlb-topic-index/bench/run_benchmark.py \
--queries-file skills/xlb-topic-index/bench/queries.txt \
--runs 3 \
--topk 8bash
python3 skills/xlb-topic-index/bench/run_benchmark.py \
--queries-file skills/xlb-topic-index/bench/queries.txt \
--runs 3 \
--topk 8Interop for Other Skills
与其他技能的互操作性
- Cache contract reference:
skills/xlb-topic-index/references/cache-interop.md - Resolve user input to stable cache key:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py resolve-input --input "xlb >vibe coding/coding"
- Export cache usage guide from meta:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py describe-cache --meta-path "skills/xlb-topic-index/cache/index/<HASH>.meta.json" --format markdown
- Program-first data files:
skills/xlb-topic-index/cache/dataset/snap-<HASH>.nodes.jsonlskills/xlb-topic-index/cache/dataset/snap-<HASH>.topics.jsonskills/xlb-topic-index/cache/dataset/snap-<HASH>.navigation.json
- 缓存契约参考:
skills/xlb-topic-index/references/cache-interop.md - 将用户输入解析为稳定的缓存键:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py resolve-input --input "xlb >vibe coding/coding"
- 从元数据导出缓存使用指南:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py describe-cache --meta-path "skills/xlb-topic-index/cache/index/<HASH>.meta.json" --format markdown
- 程序优先的数据文件:
skills/xlb-topic-index/cache/dataset/snap-<HASH>.nodes.jsonlskills/xlb-topic-index/cache/dataset/snap-<HASH>.topics.jsonskills/xlb-topic-index/cache/dataset/snap-<HASH>.navigation.json
Query Edge Semantics (for auto exploration)
查询关联语义(用于自动探索)
- section ->
searchinedges:topic_navigation- usually “related topics”, for example -> normalized executable
>AI Model>AI Model/
- usually “related topics”, for example
- section ->
commandedges:knowledge_search- executable knowledge-search commands, including bracket style like -> executable
search(>vibe coding/vibe)>vibe coding/vibe
- executable knowledge-search commands, including bracket style like
- External skill can choose either:
- follow to jump to another topic
topic_navigation - run to deepen inside current domain
knowledge_search
- follow
- Prefer section-specific commands for efficient edge collection:
- for topic-to-topic traversal
>topic/searchin: - for command/deep-search traversal
>topic/command:
- 区段 ->
searchin关联:topic_navigation- 通常为“相关主题”,例如-> 标准化可执行命令
>AI Model>AI Model/
- 通常为“相关主题”,例如
- 区段 ->
command关联:knowledge_search- 可执行的知识搜索命令,包括括号格式如-> 可执行命令
search(>vibe coding/vibe)>vibe coding/vibe
- 可执行的知识搜索命令,包括括号格式如
- 外部技能可选择:
- 跟随跳转到另一个主题
topic_navigation - 运行深入当前领域
knowledge_search
- 跟随
- 优先使用区段特定命令以高效收集关联:
- 用于主题间遍历
>topic/searchin: - 用于命令/深度搜索遍历
>topic/command:
Auto Explore Command
自动探索命令
- Use:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py explore-next --meta-path "skills/xlb-topic-index/cache/index/<HASH>.meta.json" --strategy topic_first --dry-run
- Remove to execute next hop directly.
--dry-run - Useful flags:
--strategy topic_first|search_first|mixed- to avoid repeated edges
--visited-file <path> --update-visited - to allow
--include-other-queriesstyle fallback edges??...
- 使用方式:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py explore-next --meta-path "skills/xlb-topic-index/cache/index/<HASH>.meta.json" --strategy topic_first --dry-run
- 移除参数可直接执行下一步操作。
--dry-run - 实用参数:
--strategy topic_first|search_first|mixed- 避免重复关联
--visited-file <path> --update-visited - 允许
--include-other-queries格式的回退关联??...
Explore Loop (dedupe + budget + priority)
探索循环(去重 + 预算 + 优先级)
- Use:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py explore-loop --seed-input "xlb >vibe coding/:" --edge-strategy searchin_command_backlink --max-steps 12 --max-depth 4 --max-seconds 90 --visited-file /tmp/xlb-visited.json --visited-topics-file /tmp/xlb-visited-topics.json --update-visited
- Behavior:
- Auto uses and
>topic/searchin:to collect next edges.>topic/command: - Applies visited dedupe (+
visited-file) to avoid loops.visited-topics-file - Stops by budget (/
max-steps/max-depth).max-seconds - Edge priority default is .
searchin -> command -> backlink
- Auto uses
- 使用方式:
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py explore-loop --seed-input "xlb >vibe coding/:" --edge-strategy searchin_command_backlink --max-steps 12 --max-depth 4 --max-seconds 90 --visited-file /tmp/xlb-visited.json --visited-topics-file /tmp/xlb-visited-topics.json --update-visited
- 行为:
- 自动使用和
>topic/searchin:收集下一层关联。>topic/command: - 应用已访问去重(+
visited-file)避免循环。visited-topics-file - 根据预算(/
max-steps/max-depth)停止。max-seconds - 关联优先级默认顺序为。
searchin -> command -> backlink
- 自动使用
One-Click Wrapper
一键式包装器
- Use:
skills/xlb-topic-index/scripts/xlb-auto-explore.sh "vibe coding"skills/xlb-topic-index/scripts/xlb-auto-explore.sh "xlb >vibe coding/:"skills/xlb-topic-index/scripts/xlb-auto-explore.sh "xlb auto vibe coding"
- Wrapper defaults:
- persistent visited files under
skills/xlb-topic-index/cache/ - strategy
searchin_command_backlink - budget
12 steps / depth 4 / 90s
- persistent visited files under
- Override with env vars:
- ,
XLB_AUTO_MAX_STEPS,XLB_AUTO_MAX_DEPTHXLB_AUTO_MAX_SECONDS - ,
XLB_AUTO_EDGE_STRATEGY,XLB_AUTO_INCLUDE_BACKLINKSXLB_AUTO_UPDATE_VISITED
- 使用方式:
skills/xlb-topic-index/scripts/xlb-auto-explore.sh "vibe coding"skills/xlb-topic-index/scripts/xlb-auto-explore.sh "xlb >vibe coding/:"skills/xlb-topic-index/scripts/xlb-auto-explore.sh "xlb auto vibe coding"
- 包装器默认配置:
- 持久化已访问文件存储在下
skills/xlb-topic-index/cache/ - 策略为
searchin_command_backlink - 预算为
12步 / 深度4 / 90秒
- 持久化已访问文件存储在
- 可通过环境变量覆盖:
- 、
XLB_AUTO_MAX_STEPS、XLB_AUTO_MAX_DEPTHXLB_AUTO_MAX_SECONDS - 、
XLB_AUTO_EDGE_STRATEGY、XLB_AUTO_INCLUDE_BACKLINKSXLB_AUTO_UPDATE_VISITED
Graph Backlink Query (->
)
->图反向链接查询(->
)
->- Input:
xlb ->vibe coding/:
- Meaning:
- This is a server-side command and is passed through as .
title=->vibe coding/: - should not local-intercept this command.
retrieve-topic-index.sh
- This is a server-side command and is passed through as
- Local graph helper (explicit, optional):
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py graph-neighbors --index-dir skills/xlb-topic-index/cache/index --target-title "->vibe coding/:"- Used only when you explicitly want cache-based local graph exploration.
- 输入:
xlb ->vibe coding/:
- 含义:
- 这是一个服务器端命令,将直接传递为。
title=->vibe coding/: - 不应在本地拦截此命令。
retrieve-topic-index.sh
- 这是一个服务器端命令,将直接传递为
- 本地图辅助工具(显式、可选):
python3 skills/xlb-topic-index/scripts/xlb_rag_pipeline.py graph-neighbors --index-dir skills/xlb-topic-index/cache/index --target-title "->vibe coding/:"- 仅当你明确想要基于缓存的本地图探索时使用。
Error Handling
错误处理
- API unreachable: report connection failure and suggest checking local service on port .
5000 - Empty response: return a short warning and ask whether to retry with a broader command (for example ).
>Vibe Coding/ - Empty input only: ask user to provide any non-empty title command.
- API不可达:报告连接失败,并建议检查端口上的本地服务。
5000 - 空响应:返回简短警告,并询问是否使用更宽泛的命令重试(例如)。
>Vibe Coding/ - 仅输入空内容:要求用户提供非空的标题命令。