Install
$ agentstack add skill-qte77-claude-code-plugins-implementing-document-indexing ✓ scanned · ✓ verified — works with Claude Code, Cursor, and more.
Security review
✓ PassedNo issues found. Passed automated security review. · v0.1.0 How review works →
- ✓ Prompt-injection patterns
- ✓ Secret / credential exfiltration
- ✓ Dangerous shell & filesystem operations
- ✓ Untrusted network calls
- ✓ Known-malicious package signatures
What it can access
- ✓ Network access No
- ✓ Filesystem access No
- ✓ Shell / process execution No
- ✓ Environment & secrets No
- ✓ Dynamic code execution No
From automated source analysis of v0.1.0. “Used” means the capability is present in the source — more access means more to trust, not that it’s unsafe.
About
Document Indexing Implementation
Target: $ARGUMENTS
Implements a document indexing and hybrid retrieval pipeline: parse documents, build a heading-based tree index, chunk by heading boundaries, embed with sentence-transformers, store in FAISS, and retrieve via hybrid search.
Architecture Overview
Document --> Parser --> Pages --> TreeIndex (PageIndex)
|
v
Chunker (heading-boundary + max-token)
|
v
Embedder (sentence-transformers)
|
v
VectorStore (FAISS IndexFlatIP)
|
v
HybridRetrieval (vector search -> full page -> tree filter)
Chunking Strategy
See references/chunking-strategies.md for full reference.
Heading-boundary chunking (primary):
- Split document by heading boundaries (H1-H6)
- Each section becomes a chunk with heading hierarchy as metadata
- If a section exceeds max tokens, split at sentence boundaries
- Preserve heading path (e.g.,
H1 > H2 > H3) as chunk metadata
Max-token splits (fallback):
- Default max: 512 tokens
- Overlap: 64 tokens between splits
- Never split mid-sentence
Retrieval Pipeline
See references/retrieval-patterns.md for full reference.
Hybrid retrieval (vector search + tree filter):
- Embed query with same model used for indexing
- Vector search top-k chunks from FAISS (cosine similarity via IndexFlatIP)
- Full page fetch -- retrieve complete pages containing matched chunks
- Tree filter -- use PageIndex tree to filter to relevant sections only
- Return filtered sections with source citations (page, heading path)
Data Models
@dataclass
class Document:
pages: list[Page]
metadata: dict[str, str]
@dataclass
class Page:
number: int
content: str
headings: list[str]
@dataclass
class TreeNode:
heading: str
level: int
content: str
children: list[TreeNode]
def filter(self, predicate: Callable) -> TreeNode | None: ...
Dependencies
[project]
dependencies = [
"sentence-transformers>=3.0",
"faiss-cpu>=1.9",
]
Workflow
- Define data models -- Document, Page, TreeNode dataclasses
- Implement parser -- extract pages with headings from source documents
- Build tree index -- construct PageIndex tree from heading hierarchy
- Implement chunker -- heading-boundary splits with max-token fallback
- Implement embedder -- sentence-transformers wrapper (encode, batch)
- Implement vector store -- FAISS IndexFlatIP with add/search/save/load
- Implement hybrid retrieval -- full pipeline: embed, search, fetch, filter
- Wire CLI -- ingest and search commands
Quality Checks
make validate
All type checks, linting, and tests must pass.
Source & license
This open-source skill is cataloged on AgentStack and links to its original source — we do not rehost the code.
- Author: qte77
- Source: qte77/claude-code-plugins
- License: Apache-2.0
- Homepage: https://qte77.github.io/claude-code-plugins/
Install and usage instructions live in the source repository linked above.
Reviews
No reviews yet — be the first.
Write a review
Versions
- v0.1.0 Imported from the upstream source.