Inferensys

Prompt

Truncated List Item Completion Prompt Template

A practical prompt playbook for using the Truncated List Item Completion Prompt Template in production AI workflows to recover partial enumerated outputs from summarization and list-generation pipelines.
Developer doing prompt engineering on laptop, prompt variations visible on screen, casual coding session.
PROMPT PLAYBOOK

When to Use This Prompt

Define the job, reader, and constraints for recovering truncated enumerated lists in production pipelines.

This prompt template is designed for a single, high-stakes job: recovering an enumerated list that was cut off mid-item by a token limit, streaming interruption, or model early-stopping. The ideal user is a production engineer or API developer operating a summarization, extraction, or list-generation pipeline where a partial output is worse than no output. You have a truncated string containing a numbered or bulleted list, and you need the model to intelligently complete the final truncated item and then continue generating any remaining items that were never started. This is not a general-purpose list generator; it assumes you already have a partial, well-formatted list and need surgical repair, not a rewrite.

Use this prompt when the truncation point is inside a list item's content, not between items. The model must detect the item boundary, infer the incomplete item's intent from its partial text, complete it in the same style and format, and then continue with subsequent items if the original list was clearly meant to be longer. This requires the model to understand the list's schema—whether items are sentences, paragraphs, JSON objects, or code blocks—and to preserve that schema exactly. The prompt is most effective when you provide the full original task context (e.g., 'Summarize the following document into 5 key points') alongside the partial output, so the model knows the intended scope and can decide whether more items are needed. Do not use this prompt for lists truncated cleanly between items; that's a simpler continuation task. Do not use it when the truncation point is ambiguous or the list format is inconsistent.

Before wiring this into a production harness, define clear failure modes and evaluation criteria. The primary failure mode is the model hallucinating a completion that contradicts the partial item's visible text or inventing list items that weren't implied by the original task. A secondary failure is format drift—the completed item or new items using a different numbering style, indentation, or delimiter than the original list. Your eval harness should check: (1) the repaired item's first N characters match the truncated input exactly, (2) the completed item is semantically coherent with the visible fragment, (3) all items follow the same format pattern, and (4) the total item count is reasonable given the original task. For high-risk domains like legal or clinical summarization, always route repaired outputs for human review before they reach downstream systems or users.

PRACTICAL GUARDRAILS

Use Case Fit

Where the Truncated List Item Completion prompt works and where it introduces risk. Use these cards to decide if this template fits your pipeline before wiring it into production.

01

Good Fit: Enumerated Summaries

Use when: the model was generating a numbered or bulleted list (e.g., 'Top 5 reasons', 'Key findings') and was cut off mid-item. The partial output contains clear item boundaries and a consistent format. Guardrail: Provide the full truncated output and the original task instruction so the model can infer the intended list style and remaining items.

02

Bad Fit: Narrative Prose

Avoid when: the output is a paragraph, essay, or freeform explanation without explicit list markers. The model cannot reliably detect where one 'item' ends and another begins in unstructured text. Guardrail: Route narrative truncation to a context-preserving resume prompt instead. Validate output structure before selecting this template.

03

Required Inputs

What you must provide: the original task prompt, the complete truncated output (including the partial final item), and the expected list format (markdown, JSON array, numbered list). Guardrail: If the original task context is lost, the model will hallucinate list items. Store the original prompt alongside partial outputs in your recovery queue.

04

Operational Risk: Item Duplication

What to watch: the model may repeat the last complete item when continuing the list, creating a duplicate entry. This is common when the truncation point is ambiguous. Guardrail: Add an explicit instruction to not repeat any item already present in the partial output. Use post-processing deduplication as a secondary safety net.

05

Operational Risk: Format Drift

What to watch: the continuation may switch from numbered to bulleted format, change indentation, or alter the item template mid-list. Guardrail: Include a format-consistency constraint in the continuation prompt. Validate the completed output against the original list structure before merging.

06

When to Escalate Instead

Avoid using this prompt when: the truncation point is inside a complex nested structure, the list items contain critical data that cannot be inferred, or the output is customer-facing and accuracy is non-negotiable. Guardrail: Flag unrecoverable truncations for human review or full re-generation. Do not silently complete lists with guessed content in regulated workflows.

PROMPT PLAYBOOK

Copy-Ready Prompt Template

A reusable prompt template with square-bracket placeholders for completing truncated list items and continuing remaining items.

This template is designed for production pipelines that recover from truncated enumerated outputs. It provides a structured instruction set that can be copied directly into your application, with placeholders for the specific inputs, context, and constraints of your use case. The prompt is engineered to detect the boundary of the last complete item, finish that item if it was cut off, and then continue generating any remaining items that were expected but not yet produced.

text
SYSTEM: You are a precise output repair agent. Your task is to recover a truncated enumerated list. You will receive a partial list that was cut off mid-generation. Your job is to:
1. Identify the last complete list item.
2. If the text ends with a partially written item, complete that item in a way consistent with the preceding items' style, depth, and format.
3. Continue generating any remaining list items that were expected but not yet written, based on the original task context.
4. Preserve the exact enumeration style (numbers, bullets, letters), indentation, and markdown formatting of the original list.
5. Do not repeat any items that were already complete. Do not add a preamble or commentary. Output only the continuation, starting from the truncated item.

[ORIGINAL_TASK_CONTEXT]
[PARTIAL_OUTPUT]
[EXPECTED_TOTAL_ITEMS]
[OUTPUT_FORMAT_NOTES]

To adapt this template, replace each square-bracket placeholder with the specific information for your recovery scenario. [ORIGINAL_TASK_CONTEXT] should contain the original prompt or instruction that produced the list, so the model understands the intended scope and style. [PARTIAL_OUTPUT] is the exact truncated text you received. [EXPECTED_TOTAL_ITEMS] can be a specific number (e.g., '10 items total') or a description (e.g., 'one item per quarter of 2024'). [OUTPUT_FORMAT_NOTES] should describe the list format, such as 'numbered list with bolded item titles and two-sentence descriptions.' After inserting your values, test the prompt with known truncation cases and validate that the continuation stitches seamlessly without duplicating the last complete item or altering its content.

IMPLEMENTATION TABLE

Prompt Variables

Required inputs for the Truncated List Item Completion prompt. Each placeholder must be populated before the prompt is sent. Validation notes describe how to programmatically verify the input before execution.

PlaceholderPurposeExampleValidation Notes

[TRUNCATED_OUTPUT]

The partial list output that was cut off mid-item or between items. Must include the last complete item and the beginning of the truncated item.

  1. Implement caching layer for user sessions
  2. Add rate limiting to API endpoints
  3. Set

Must contain at least one complete list item and one partial item. Validate that the string ends mid-token or mid-sentence, not at a natural boundary. Null not allowed.

[LIST_FORMAT]

The delimiter or markup pattern used for list items in the original output. Determines how the model identifies item boundaries.

Numbered: "1. 2. 3." or Markdown: "- * +" or JSON array index

Must be one of: 'numbered', 'bulleted', 'markdown-unordered', 'markdown-ordered', 'json-array', 'csv'. Validate against allowed enum. Null not allowed.

[TOTAL_EXPECTED_ITEMS]

The number of items the original prompt requested. Used to determine if the list was complete or needs continuation.

10

Must be a positive integer. If null, the model will infer completion from semantic closure rather than count. Validate as integer or null.

[ORIGINAL_TASK_CONTEXT]

The original instruction or prompt that generated the truncated list. Provides semantic context so the continuation matches intent.

List 10 actionable steps to improve API latency based on the following performance report...

Must be a non-empty string. Should contain the original task description, not the truncated output. Validate minimum length of 20 characters. Null not allowed.

[ITEM_SCHEMA]

Optional schema describing what a valid list item looks like. Used to enforce format consistency in the completed item and any new items.

Each item must be a sentence starting with an action verb, under 120 characters, with no markdown formatting.

If provided, must be a non-empty string describing field constraints, length limits, or style rules. Validate as string or null. If null, format consistency is inferred from existing items.

[CONTINUATION_POLICY]

Instruction for how to handle the partially truncated item versus remaining items. Controls repair vs. regeneration behavior.

complete_truncated_item_then_continue

Must be one of: 'complete_truncated_item_then_continue', 'complete_truncated_item_only', 'regenerate_truncated_item_and_continue', 'continue_from_next_item'. Validate against allowed enum. Null defaults to 'complete_truncated_item_then_continue'.

[MAX_ADDITIONAL_ITEMS]

Upper bound on how many new items the model can generate beyond the truncated item. Prevents runaway list generation.

5

Must be a positive integer or null. If null, model continues until semantic completion or [TOTAL_EXPECTED_ITEMS] is reached. Validate as integer >= 1 or null.

PROMPT PLAYBOOK

Implementation Harness Notes

How to wire the Truncated List Item Completion prompt into a production pipeline with validation, retries, and observability.

Integrating the Truncated List Item Completion prompt into an application requires a harness that can detect truncation, extract the partial list, manage the completion request, and validate the reassembled output. The core loop begins with a truncation detector—a lightweight function that inspects the model's raw response for a finish_reason of length or max_tokens and confirms that the final line is an incomplete list item (e.g., a bullet point ending mid-sentence, a numbered item without a closing newline, or a JSON array missing its closing bracket). If the detector fires, the harness extracts the last complete item boundary, captures the partial item text, and passes both into the prompt template as [PARTIAL_ITEM] and [COMPLETED_ITEMS]. The model choice matters here: use a model with a context window large enough to hold the original prompt, the partial output, and the completion request without triggering another truncation. For long lists, consider a model with at least a 32K token context window or implement a chunked continuation strategy.

The harness must enforce format consistency between the original output and the completion. Before requesting continuation, capture the list's structural signature: the delimiter style (markdown bullets, numbered items, JSON array elements), the indentation level, the average item length, and any inline formatting conventions. Pass these as explicit constraints in [FORMAT_RULES] within the prompt template. After receiving the completion, run a reassembly validator that: (1) strips any duplicated content at the boundary where the original output ended and the continuation begins, (2) verifies that the completed item and any new items match the captured format signature, (3) checks that the total item count is consistent with any stated list length or expected range, and (4) confirms the final output is parseable as a complete list (valid JSON array, consistent markdown list, etc.). If validation fails, increment a retry counter and re-invoke the prompt with the specific validation error included as [PREVIOUS_ERROR]. Cap retries at 3 attempts before escalating to a human reviewer or logging the partial output for manual repair.

For production observability, instrument the harness with structured logging at each stage: truncation detection (with the finish reason and character position of the cut), prompt assembly (with token counts for the completion request), model invocation (with latency and model identifier), reassembly validation (with pass/fail status and specific rule violations), and final output delivery. Tag each event with a correlation ID that links the original generation, the truncation event, and the repair attempt. This trace data is essential for diagnosing systemic issues—if a particular list type or content domain triggers frequent truncations, you may need to adjust max_tokens upstream, switch to a streaming architecture with chunked assembly, or pre-process inputs to reduce output length. Store the raw truncated output, the completion prompt, and the repaired output in a versioned log for post-mortem analysis and prompt regression testing. Avoid silently delivering repaired outputs without audit trails, especially in customer-facing or compliance-sensitive workflows where list completeness directly impacts user trust or regulatory obligations.

IMPLEMENTATION TABLE

Expected Output Contract

Defines the structure, types, and validation rules for the output of the Truncated List Item Completion Prompt. Use this contract to build a parser and validator in your application harness.

Field or ElementType or FormatRequiredValidation Rule

completed_item

string

Must be a grammatically and semantically complete version of the truncated [PARTIAL_ITEM] from the input. Must not alter the item's original meaning or add hallucinated details.

continuation_items

array of strings

If present, each string must be a new list item that logically follows the completed_item. Format must match the [LIST_FORMAT] (e.g., markdown bullets, numbered items). Must be null if the list was already complete.

list_complete_flag

boolean

Must be true if the input list was already complete and no continuation_items are needed. Must be false if continuation_items are provided. No other values allowed.

boundary_detection_confidence

number (0.0-1.0)

A score representing the model's confidence in correctly identifying the truncation point. Must be a float between 0.0 and 1.0. A value below 0.8 should trigger a human review or retry in the harness.

format_consistency_check

object

Contains two boolean fields: 'prefix_match' (true if completed_item starts with the same list marker style as the input) and 'delimiter_match' (true if continuation_items use the same delimiter as the input). Harness must verify both are true.

repaired_text

string

The full, reconstructed list as a single string, starting with the completed_item and including all continuation_items. Must be parseable back into individual items using the detected delimiter.

unrecoverable_context

array of strings

A list of any key details from the original prompt context that were missing and could not be reliably inferred. If empty or null, it signals full context recovery. Harness should log any entries here for review.

PRACTICAL GUARDRAILS

Common Failure Modes

Truncated list completion is fragile. These are the most common failure modes when recovering partial enumerated outputs and how to prevent them in production.

01

Item Boundary Misdetection

What to watch: The model misidentifies where one list item ends and the next begins, causing merged items, split items, or duplicated content. This is especially common with numbered lists where the model hallucinates item numbers that don't match the original sequence. Guardrail: Include explicit item-boundary markers in the continuation prompt and validate that the count of completed items plus original items matches the expected total. Use regex-based boundary detection in the harness before sending to the model.

02

Format Drift in Continued Items

What to watch: The model changes the list format mid-continuation—switching from numbered to bulleted, altering indentation, or changing the delimiter style. This breaks downstream parsers that expect consistent formatting. Guardrail: Pass the original list format as an explicit constraint in the continuation prompt. Run a format-consistency eval that compares the structure of continued items against the original items using delimiter detection and indentation analysis.

03

Hallucinated Items Beyond Original Intent

What to watch: The model invents additional list items that were never implied by the truncated content, especially when the original task was open-ended. The continuation introduces topics, entities, or values not present in the partial output. Guardrail: Constrain the continuation prompt to complete only the truncated item and items clearly implied by context. Add a grounding check that flags any continued item containing entities or claims not traceable to the partial input.

04

Repetition of Already-Complete Items

What to watch: The model restates items that were already fully generated before the truncation point, creating duplicates that corrupt the final list. This happens when the truncation boundary is ambiguous or the model loses track of what was already output. Guardrail: Include the last complete item as an anchor in the continuation prompt with an explicit instruction not to repeat it. Run a deduplication check using semantic similarity or exact-match comparison against the original items.

05

Context Loss Across the Truncation Boundary

What to watch: The model loses the original task context, tone, or constraints when continuing from a truncation point, producing items that are stylistically inconsistent or semantically disconnected from the earlier items. Guardrail: Reconstruct the full prompt context—including system instructions, task description, and output schema—in the continuation request. Use a coherence eval that compares the tone, verbosity, and semantic domain of continued items against original items.

06

Incorrect Item Count or Off-by-One Errors

What to watch: The model produces the wrong number of continued items—either stopping early, overshooting the expected count, or misnumbering the sequence. This breaks pipelines that rely on exact item counts or indexed access. Guardrail: Specify the expected remaining item count in the continuation prompt when known. Validate the final item count against expectations and flag mismatches for human review or automated retry with adjusted constraints.

IMPLEMENTATION TABLE

Evaluation Rubric

Use this rubric to test the quality of a completed list before shipping the Truncated List Item Completion Prompt Template to production. Each criterion targets a specific failure mode common in continuation tasks.

CriterionPass StandardFailure SignalTest Method

Item Boundary Integrity

Completion starts exactly at the truncation point of the last partial item without repeating or dropping characters.

Output repeats the last complete word or sentence before the truncation point, or skips the partial item entirely.

Diff the last 50 characters of [TRUNCATED_OUTPUT] against the first 50 characters of the completion. Expect zero overlap and zero gap.

List Continuation Completeness

All remaining items implied by the original prompt context are generated, and the list is properly terminated.

The list stops early, omits items that should logically follow, or ends with a trailing comma or bullet without a final item.

Count items in the completed list. Compare against a human-verified expected count for the given [ORIGINAL_PROMPT] and [CONTEXT].

Format Consistency

Completed items use the same delimiter, indentation, numbering scheme, and style as the truncated list.

Output switches from numbered to bulleted lists, changes indentation depth, or alters the item prefix pattern mid-list.

Regex match the item prefix pattern (e.g., ^\d+\.) from the truncated list against all completed items. All must match.

No Hallucinated Content

Completed items are logically derived from [CONTEXT] and [ORIGINAL_PROMPT]; no invented facts, entities, or citations appear.

Output introduces a person, statistic, or claim not present in the provided context or original task description.

Extract all entities from the completion. Cross-reference against [CONTEXT] and [ORIGINAL_PROMPT]. Flag any entity with zero matches for human review.

Semantic Coherence

Each completed item is a coherent, self-contained point that logically follows the preceding items.

A completed item is nonsensical, contradicts a prior item, or is a fragment that cannot stand alone as a list entry.

For each completed item, assert that it contains a subject and predicate and does not contradict any prior item. Use an LLM-as-judge check with a pass/fail threshold.

No Duplicate Items

No completed item repeats the content of a prior item from the truncated list or another completed item.

Two items in the final list express the same point with only minor wording differences.

Compute pairwise cosine similarity of sentence embeddings for all items. Flag pairs above 0.92 similarity for manual review.

Structural Validity

The final output, when prepended with the truncated portion, forms a valid structure (e.g., valid Markdown, parseable JSON array if applicable).

The completed list, when concatenated with the truncated output, produces broken Markdown or an unparseable data structure.

Concatenate [TRUNCATED_OUTPUT] + completion. Run through a Markdown linter or JSON parser. Assert zero structural errors.

ADAPTATION OPTIONS

Adapt This Prompt

How to adapt

Use the base prompt with a single model call. Pass the truncated list and the original task instruction. Accept the completed output without strict validation.

code
[ORIGINAL_TASK]

Partial output:
[TRUNCATED_LIST]

Complete the last truncated item and continue the list if incomplete.

Watch for

  • The model may restart the list from the beginning instead of continuing
  • Format drift between the partial items and the new items
  • No boundary detection—model may repeat the last complete item
Prasad Kumkar

About the author

Prasad Kumkar

CEO & MD, Inference Systems

Prasad Kumkar is the CEO & MD of Inference Systems and writes about AI systems architecture, LLM infrastructure, model serving, evaluation, and production deployment. Over 5+ years, he has worked across computer vision models, L5 autonomous vehicle systems, and LLM research, with a focus on taking complex AI ideas into real-world engineering systems.

His work and writing cover AI systems, large language models, AI agents, multimodal systems, autonomous systems, inference optimization, RAG, evaluation, and production AI engineering.