Contextual Document Chunk Annotator
Prepends a short situating context to each document chunk so retrieval stays accurate after splitting.
Prompt
ROLE: You are a document pre-processing specialist who prepares chunks for a contextual retrieval index. CONTEXT: Full document or section it belongs to: [FULL_DOCUMENT] The specific chunk to annotate: [CHUNK] Document metadata (title, date, author, type): [METADATA] TASK: 1. Read the full document to understand where the chunk sits and what it refers to. 2. Write a concise 1-3 sentence context header that situates the chunk: what document and section it is from, what entities the pronouns and references resolve to, and what time period or version applies. 3. Resolve dangling references inside the chunk (e.g., 'this policy', 'the above table') by naming them in the header. 4. Extract 3-6 retrieval keywords and any key entities for metadata filtering. OUTPUT FORMAT: CONTEXT_HEADER: <1-3 sentences> KEYWORDS: [comma-separated] ENTITIES: [comma-separated, typed where useful] ANNOTATED_CHUNK: <context header + original chunk text, unchanged> CONSTRAINTS: - Do not alter the original chunk text; only prepend context. - The header must add information that exists in the document, never invented detail. - Keep the header self-contained so the chunk is interpretable in isolation.
How to use this prompt
- 1
Copy the prompt above and paste it into ChatGPT, Claude, or Gemini — or open it in the visual Studio to edit each part on a canvas and run it with your own key.
- 2
Replace any bracketed placeholders with your specifics. The more concrete your context and constraints, the sharper the result — see the 5-part prompt structure.
- 3
Run it, then refine. Ask the model to critique and improve its own answer with self-critique prompting.
Techniques in this prompt
Assigns the model an expert persona so it adopts the right vocabulary, depth, and standards for the task.
Learn this techniqueForces explicit intermediate reasoning instead of jumping to a conclusion, which improves accuracy on hard tasks.
Learn this techniquePins the response to a defined structure so it drops straight into your workflow.
Learn this techniqueRecommended models
Build on this prompt
Open it in the visual Studio to wire it into a full workflow with your own API key — or learn the craft behind prompts like this.
More in RAG & Knowledge Retrieval
Grounded Answer With Inline Citations
Answers a user question strictly from retrieved passages, attaching an inline citation to every factual claim.
Faithfulness Auditor For RAG Outputs
Audits a generated answer against its source passages and flags every unsupported or contradicted claim.
Query Decomposition For Multi-Hop Retrieval
Breaks a complex question into ordered atomic sub-queries optimized for a vector search retriever.
Hybrid Search Reranker With Justification
Reranks candidate passages by true relevance to the query and explains each ranking decision.