AGENT SKILL

document-indexing

Guides Semantra text and PDF preprocessing, window configuration, cache artifact inspection, and no-server indexing workflows.

License 许可
MIT
最近更新
2026-09-03
Stars
★ 351
Forks
27

01 前言 Front Matter

name
document-indexing
license
MIT
metadata
{ "disco-role": "operating" }
description
Guides Semantra text and PDF preprocessing, window configuration, cache artifact inspection, and no-server indexing workflows.
disable-model-invocation
true

02 资源文件 5

03 SKILL.md 正文

Semantra Document Indexing

Use this sub-skill when the task is to prepare local text or PDF files for Semantra, choose chunk windows, control the Semantra cache directory, inspect cached artifacts, or troubleshoot preprocessing before the interactive web UI is used.

Read first

  • workflows.md for practical indexing command patterns, cache-directory decisions, validation steps, and safe no-server workflows.
  • cache-and-data-formats.md for the Semantra artifact filenames, JSON fields, embedding binaries, Annoy indexes, PDF conversion artifacts, and window tuple semantics.
  • troubleshooting.md for filename, encoding, PDF extraction, stale-cache, corrupt-artifact, and window-format failures.
  • Run create_tiny_corpus.py when you need a tiny local text fixture to construct or smoke-test Semantra commands.
  • Run inspect_semantra_cache.py when you need a read-only summary of an existing Semantra cache directory.

Route here when

  • The user asks how to run semantra over one file, many files, *.txt, or a PDF collection.
  • The user wants to preprocess documents without starting the browser UI; use --no-server.
  • The user asks what --windows, --encoding, --force, --semantra-dir, or --show-semantra-dir means.
  • The user needs to understand why Semantra reprocessed a document or which files appeared in the cache directory.
  • The user has PDF text extraction or PDF viewer-position problems.

Route model/backend questions to models-and-embeddings. Route query syntax, result interpretation, preference tags, web API, or local server behavior to interactive-search.

Core indexing workflow

  1. Confirm that Semantra is installed and the CLI is visible. From a normal user environment, prefer:

    semantra --help
    semantra --list-models
    semantra --show-semantra-dir
    
  2. Decide where processed artifacts should live. If the user does not care, let Semantra use its application cache directory. For reproducible tasks, pass an explicit cache directory:

    semantra --semantra-dir ./semantra-cache --no-server documents/*.txt
    
  3. Choose documents. Semantra accepts one or more existing filenames. It reads .pdf files through its PDF path and treats other filenames as text using the selected encoding.

  4. Choose a model with the sibling models-and-embeddings sub-skill before launching a large job. Local transformer models may download model files the first time; OpenAI mode requires credentials and sends text to an external API.

  5. Use --no-server for preprocessing-only jobs. Omit it when the next step is interactive search in the local browser UI.

  6. Validate the result without relying on the source checkout:

    python path/to/inspect_semantra_cache.py --cache-dir ./semantra-cache
    

    Expect at least a config JSON, token JSON, embedding binary, and usually an Annoy index for each processed document/config/window combination.

Window decisions

Semantra's default --windows 128_0_16 means windows of 128 tokens, initial offset 0, and a rewind/overlap of 16 tokens. The CLI accepts comma-separated window specs:

  • 128 -> (size=128, offset=0, rewind=0).
  • 128_0_16 -> (size=128, offset=0, rewind=16).
  • 64_8 -> (size=64, offset=8, rewind=0).

Only the first configured window is used by the query routes in this Semantra version; extra windows can still be processed and cached. Use smaller windows for short, precise excerpts and larger windows for more context. Increase rewind when important passages are often split across window boundaries.

Cache and force rules

Semantra hashes both document content and model/window configuration. A document can have multiple cache groups if you change model, tokens, windows, Annoy tree count, encoding, or Semantra version. Use --force when the cache exists but must be rebuilt. Before deleting artifacts, inspect the cache and identify the matching document/config group in cache-and-data-formats.md.

PDF-specific notes

For PDFs, Semantra extracts text and stores page-position metadata used by the web viewer. If the PDF opens but navigation/highlighting is wrong, distinguish between:

  • text extraction problems in the converted text artifact;
  • page-position JSON problems;
  • web API or browser rendering problems, which route to interactive-search.

Do not

  • Do not tell future agents to open or run original repository docs, examples, or tests. Use the bundled references and scripts here instead.
  • Do not run default local transformer indexing on sensitive or huge document sets until the user accepts model download/cache/runtime costs.
  • Do not use OpenAI mode for private documents unless the user explicitly accepts the privacy and cost tradeoff.

04 同仓库更多 Skills

VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-triton-opt

Make a single PassNet Triton kernel fast AND numerically faithful: performance model (when a replacement can win at all), block/grid/warp tuning, autotune policy, launch overhead, and per-op numeric recipes to pass the dtype baseline tolerances. Use when a pass matches and is correct but speedup below expected, or when correctness fails by small numeric margins.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-solve

END-TO-END playbook for solving one PassNet sample: analyze the computation graphs, decide the optimization strategy (what to fuse, what to replace, what to leave alone), drive the iteration loop, and maximize the sample score. This is the ENTRY skill — invoke it first for any PassNet optimization task; it tells you when to use passnet-pattern-fusion, passnet-triton-opt and passnet-feedback.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-skill

PassNet GPU kernel optimization via compiler passes. Design and implement Triton-based optimization passes, create pass files under ./pass_dir/, self-evaluate with pass_evaluator, and iterate to maximize GPU speedup.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-pattern-fusion

Author PassNet pass files: write patterns that actually MATCH the FX graph, pick fusion regions (which ops to absorb into one Triton kernel), and structure multi-pass submissions with the mandatory shared-dispatch architecture. Use when creating or fixing pattern()/replacement_args()/replacement_func() files, when a pass "failed to match", or when deciding how to fuse multiple kernels/ops.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-orchestrate

Round/batch planning and decision support for PassNet graph optimization. Use for multi-sample triage, worker allocation, eval-budget policy, and post-eval keep/revert decisions. For solving one concrete sample end to end, use passnet-solve as the entry skill; consult this skill only when you need broader planning or a specific decision gate.

★ 351
VectorSpaceLab
VectorSpaceLab/AREX-Skill

passnet-feedback

Fast, deterministic feedback for PassNet work: pre-flight pattern/match verification WITHOUT burning a GPU evaluation, per-node bottleneck analysis of a sample's graphs, and eval-log parsing into per-variant status + estimated score + failure classification. Use BEFORE every GPU evaluation (check_pattern), at the START of a sample (analyze_graph), and AFTER every evaluation (parse_eval_log).

★ 351