pageindex
БесплатноБез исполняемых скриптовНе проверенPageIndex answers questions about long PDFs without a vector database: it builds a table-of-contents tree for each document and lets an LLM walk the tree to…
от TerminalSkills★ 221 звезда на GitHubОб этом скилле
PageIndex — Vectorless, reasoning-based RAG over long documents
Overview
PageIndex replaces the embedding index with a tree index: a hierarchy of sections (title, page range, short summary) that mirrors the document's own structure. To answer a question, an LLM reads the tree, decides which sections are relevant, reads those pages, and answers. There is no chunking, no embedding model and no vector store. Answers can be traced back to the pages that were read.
It fits long, structured, text-based PDFs: annual reports, regulatory filings, contracts, manuals, textbooks. It is a poor fit for many tiny documents or for "find anything similar to this sentence" search, where a vector index is simpler.
The SDK (pip install pageindex, imported as pageindex) has two modes behind one PageIndexClient:
- Local (open source, used in this skill): text-based PDFs are indexed on your machine, trees are stored in a local directory, and your own LLM key does the summarizing and the chat. Citations are page-level.
- Cloud (PageIndex's hosted service, needs a
PAGEINDEX_API_KEYfrom developer.pageindex.ai): adds OCR for scans, block-level citations, folders, metadata and an MCP server. It is an account-bound product; this skill does not teach its calls beyond naming the switch (index="cloud").
Instructions
Installation
python3 -m venv .venv
.venv/bin/pip install -U pageindex
# Optional: use a Claude Code subscription instead of API keys
.venv/bin/pip install -U "pageindex[claude]"
Local mode calls an LLM through LiteLLM. Bare model names are OpenAI models; other providers use provider/model. Export the key of the provider you use:
export OPENAI_API_KEY="..." # create at platform.openai.com/api-keys
Index a PDF and ask a question (local mode)
from pageindex import PageIndexClient
client = PageIndexClient(
index="gpt-6-luna", # model that builds and summarizes the tree
chat="gpt-6-sol", # model that searches the tree and answers
)
doc_id = client.submit_document("reports/acme-10k-2025.pdf")["doc_id"]
answer = client.chat("What was the 2025 operating margin?", doc_id=doc_id)
print(answer)
Those two model names are the SDK's own defaults in its config.yaml. Substitute any model your key can use.
Choosing models:
index=: a basic, cheap model is enough. The tree shape comes from the PDF layout; the model only writes and refines summaries. The README measures about $0.001 per page with a smallluna-class index model.chat=: use the strongest model you can afford, because it does the reasoning that finds the right pages. Query cost depends on this model.
Index trees are saved in a .pageindex directory (default) in the current working directory. Change it by putting the path in the index slot, index={"model": "gpt-6-luna", "storage_path": "/data/pageindex"} (or use the flat spelling index_model=, chat_model=, storage_path= together); mixing index="..." with a separate storage_path= raises an error. Re-use the same doc_id on later runs instead of re-indexing; client.list_documents() shows what is stored.
Use a Claude subscription
With the [claude] extra installed and Claude Code signed in, prefix model names with claude-code/; no API key is needed:
client = PageIndexClient(
index="claude-code/haiku",
chat="claude-code/opus",
)
Inspect the tree and read pages
tree = client.get_document_structure(doc_id) # titles, page ranges, summaries
pages = client.get_page_content(doc_id, "45-47") # '5-7', '3,8' or '12'
print(client.get_document(doc_id)) # document metadata
Read the tree first when an answer looks wrong: if the right section is missing or badly titled, the retrieval cannot find it.
Ask for citations
answer = client.chat(
"Which risks does the filing list under supply chain?",
doc_id=doc_id,
citations=True,
)
for c in client.get_citations(answer, doc_id=doc_id):
print(c["document"], c["page"])
chat(..., citations=True) makes the model tag its claims with the pages it used; get_citations parses those tags into {"document", "page"} entries. Check a few against the PDF before relying on them: the tags are model output.
Several documents and streaming
doc_id accepts a list for multi-document questions, and stream=True returns an iterator instead of a string:
answer = client.chat(
"Compare the capital expenditure plans of both filings.",
doc_id=[doc_id_2024, doc_id_2025],
)
Index from the command line with the repo script
The repository ships run_pageindex.py, which writes the tree to JSON without the SDK client. It needs a clone of the repo:
git clone https://github.com/VectifyAI/PageIndex.git
cd PageIndex
python3 -m venv .venv && .venv/bin/pip install -r requirements.txt
.venv/bin/python run_pageindex.py --pdf_path ../reports/acm
Установить pageindex в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл pageindex?
PageIndex answers questions about long PDFs without a vector database: it builds a table-of-contents tree for each document and lets an LLM walk the tree to the pages that matter, with page-level citations. Use when asked to build vectorless or reasoning-based RAG, "index this 10-K and answer questions", "RAG without embeddings or chunking", or to get a document's tree structure as JSON. Covers the open-source Python SDK in local mode and the run_pageindex.py script.
Как установить скилл pageindex?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл pageindex запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
docx
Use this skill whenever the user wants to create, read, edit, or manipulate Word documents (.docx files) or Word templates (.dotx files). Triggers include…
от AnthropicUse this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text/tables from PDFs, combining or merging multiple…
от Anthropicxlsx
Use this skill any time a spreadsheet file is the primary input or output. This means any task where the user wants to: open, read, edit, or fix an existing…
от Anthropicpptx
Use this skill any time a .pptx or .potx file is involved in any way — as input, output, or both. This includes: creating slide decks, pitch decks, or…
от Anthropic