This prompt is designed for workflow automation and SOP systems. Its job is to take a high-level procedural instruction, such as 'How do I provision a new user in the staging environment?' and decompose it into a sequence of smaller, independently answerable sub-questions. Each sub-question should map to a specific section of your internal documentation, runbook, or knowledge base. Use this prompt when a single retrieval query is insufficient to cover all the steps, conditions, and exceptions in a standard operating procedure. The output includes a completeness check to verify that the generated sub-questions collectively address every stage of the original procedure.
Prompt
Procedure Decomposition Prompt Template

When to Use This Prompt
Understand when procedure decomposition is the right tool and when a simpler retrieval or direct instruction approach is safer.
The ideal user is a platform engineer or RAG architect building an internal assistant that must guide employees through multi-step operational workflows. Required context includes the full text of the procedure or a clear description of the workflow, plus any known documentation section titles or taxonomy that the sub-questions should reference. This prompt works best when your knowledge base is already chunked by procedure step, policy section, or runbook entry. If your documentation is unstructured or narrative-heavy, pair this prompt with a retrieval step that surfaces relevant sections before decomposition. The prompt expects a [PROCEDURE] input, an optional [DOCUMENTATION_MAP] listing available sections, and a [CONSTRAINTS] block specifying output format and completeness requirements.
Do not use this prompt for simple factual lookups, single-step instructions, or questions answerable from one document chunk. Avoid it when the procedure is undocumented or when the sub-questions would require reasoning beyond retrieval, such as generating novel troubleshooting steps not present in the knowledge base. For high-risk operational procedures such as security incident response, access control changes, or financial operations, always route the generated sub-questions through a human review step before execution. The decomposition itself is not the action; it is the plan that must be verified. If your workflow involves chained dependencies where one sub-question's answer changes the next question, consider the Multi-Hop Question Splitting Prompt instead. For diagnostic or troubleshooting workflows, the Diagnostic Question Decomposition Prompt provides a structured tree approach better suited to ruling out causes.
Use Case Fit
Where the Procedure Decomposition Prompt Template works and where it introduces risk. Use these cards to decide if this prompt fits your workflow before wiring it into a production harness.
Good Fit: Structured SOPs
Use when: you have a documented standard operating procedure, runbook, or step-by-step guide that can be decomposed into discrete, retrievable sub-questions. Guardrail: ensure the source SOP is versioned and the decomposition output is validated against the original procedure steps before automation.
Bad Fit: Creative or Open-Ended Tasks
Avoid when: the task is exploratory, creative, or lacks a defined procedure. Decomposition forces structure onto inherently unstructured work, producing brittle sub-questions that miss the intent. Guardrail: use planning prompts from the Agent Planning pillar instead for open-ended objectives.
Required Inputs
What you need: a complete, unambiguous procedure description as [INPUT], plus an optional [CONTEXT] of supporting documentation sections. Guardrail: if the procedure is incomplete or ambiguous, run an ambiguity detection pass first. Missing steps in the source will propagate into the sub-question set.
Operational Risk: Completeness Gaps
Risk: the decomposition may omit critical steps, especially implicit or assumed knowledge not stated in the procedure text. Guardrail: always run the completeness check against the original procedure and require human review for safety-critical or compliance-bound workflows before execution.
Operational Risk: Retrieval Mismatch
Risk: generated sub-questions may not match the terminology or structure of your documentation index, leading to retrieval failures even when decomposition is correct. Guardrail: pair this prompt with a domain-specific terminology mapping step and validate retrieval recall on a golden set of known procedures.
Variant: Agentic Execution
Use when: you need the decomposed sub-questions to drive an agent that retrieves and executes steps sequentially. Guardrail: add dependency flags and a replanning trigger to the output schema. If a sub-question retrieval returns insufficient evidence, the agent must halt and request clarification rather than proceed with gaps.
Copy-Ready Prompt Template
A copy-ready template for decomposing a high-level procedure into a sequence of actionable, retrievable sub-questions.
This template is designed for workflow automation and SOP systems where a complex 'how-to' instruction must be broken into discrete, independently answerable steps. Each sub-question targets a specific piece of evidence from your documentation, enabling a RAG system or agent to gather information stepwise. Use this when a flat retrieval query fails to capture the sequential dependencies of a multi-step procedure.
codeSYSTEM: You are a procedure decomposition engine. Your task is to break a high-level procedural instruction into a sequence of actionable sub-questions. Each sub-question must be independently answerable from a single documentation section. The sequence must cover all critical steps of the original procedure. INPUT PROCEDURE: [PROCEDURE_TEXT] AVAILABLE DOCUMENTATION SECTIONS (for context): [DOCUMENTATION_INDEX] OUTPUT_SCHEMA: { "sub_questions": [ { "id": "string (e.g., 'sq-1')", "question": "string (the self-contained sub-question)", "target_section": "string (predicted documentation section)", "depends_on": ["string (id of prerequisite sub-question, or empty)"], "expected_evidence_type": "string (e.g., 'step_instruction', 'parameter_value', 'safety_warning')" } ], "completeness_check": { "original_steps_identified": ["string (list of steps extracted from the procedure)"], "coverage_gaps": ["string (any steps not addressed by sub-questions, or empty)"] } } CONSTRAINTS: - Generate only questions that can be answered by the provided documentation sections. - Preserve the sequential order of the procedure. Mark dependencies explicitly. - If a step requires a specific parameter or value, the sub-question must ask for it. - The completeness check must honestly report any gaps. USER: Decompose the following procedure: [PROCEDURE_TEXT]
To adapt this template, replace [PROCEDURE_TEXT] with the full natural-language instruction you need to decompose. Replace [DOCUMENTATION_INDEX] with a list of available document titles or section headers from your knowledge base; this grounds the decomposition and prevents the model from inventing steps that don't exist in your source material. For high-stakes operational procedures where missing a step could cause failure, add a human review step after decomposition to validate the completeness check before any sub-questions are executed against retrieval.
Prompt Variables
Required and optional inputs for the Procedure Decomposition Prompt Template. Each variable must be supplied or explicitly set to null before the prompt is assembled and sent.
| Placeholder | Purpose | Example | Validation Notes |
|---|---|---|---|
[PROCEDURE_TEXT] | The high-level 'how-to' instruction or SOP text to decompose into retrievable sub-questions. | How do I provision a new AWS account with guardrails? | Required. Must be a non-empty string. Reject if length < 10 characters or contains only whitespace. |
[DOCUMENTATION_SOURCE] | Identifier or description of the knowledge base the sub-questions will target for retrieval. | Internal IT Runbooks v3 | Required. Must be a non-empty string. Used to scope sub-question terminology to the target corpus. |
[MAX_SUB_QUESTIONS] | Upper bound on the number of sub-questions to generate to prevent runaway decomposition. | 7 | Optional. Must be an integer between 3 and 15 if provided. Defaults to 8 if null or out of range. |
[INCLUDE_COMPLETENESS_CHECK] | Flag to append a final verification sub-question that checks if all steps are covered. | Optional. Must be 'true' or 'false'. Defaults to 'true' if null. Controls whether the output includes a coverage verification step. | |
[OUTPUT_SCHEMA] | The expected JSON structure for each sub-question, including fields for step order, dependency, and target section. | {"step": int, "question": string, "depends_on": [int], "target_section": string} | Required. Must be a valid JSON Schema object or a stringified representation. Reject if unparseable. |
[CONSTRAINTS] | Additional rules for sub-question generation, such as forbidden terms, required prefixes, or style guidelines. | Do not reference internal server names. Prefix each question with the relevant runbook chapter. | Optional. Can be null. If provided, must be a non-empty string. Appended to the system instructions. |
Implementation Harness Notes
How to wire the Procedure Decomposition Prompt into a reliable application or workflow.
The Procedure Decomposition Prompt is designed to be called as a single-turn generation step within a larger workflow automation or SOP system. The application layer is responsible for providing the high-level procedure text as [PROCEDURE] and the optional [DOCUMENTATION_INDEX] (a list of available document titles or section headings). The model's output is a structured JSON array of sub-questions, each with a target_document field. The application should not present these sub-questions directly to an end user; instead, it should use them as retrieval queries against the specified documents in a RAG pipeline or as sequential steps for an agent to execute.
After receiving the model's JSON output, the harness must validate the structure before proceeding. Check that the output is valid JSON, that it contains a sub_questions array, and that each element has the required fields: step_number (integer), sub_question (string), target_document (string), and expected_evidence (string). If the [DOCUMENTATION_INDEX] was provided, validate that every target_document value matches an entry in the index; flag any hallucinated document names for human review or automatic retry. Implement a completeness check by prompting the model a second time with the original procedure and the generated sub-questions, asking it to confirm whether all procedural steps are covered. If coverage is below a threshold (e.g., 90%), trigger a retry with a more explicit instruction to ensure no steps are missed.
For production deployment, choose a model with strong JSON mode and instruction-following capabilities. Set temperature to 0 or a very low value (0.1) to maximize deterministic, structured output. Implement a retry loop with up to 3 attempts if JSON parsing fails or if the completeness check fails. Log every decomposition request, the raw output, validation errors, and the final accepted sub-question set for auditability. In high-stakes environments such as healthcare or industrial procedures, always route the final decomposition to a human reviewer before any automated execution begins. Avoid using this prompt for safety-critical procedures where a missed step could cause harm without mandatory human-in-the-loop approval.
Expected Output Contract
Strict JSON schema contract for the procedure decomposition output. Use this table to validate the model response before passing sub-questions to downstream retrieval or execution harnesses.
| Field or Element | Type or Format | Required | Validation Rule |
|---|---|---|---|
procedure_steps | array of objects | Array length must be >= 1. Reject if empty or not an array. | |
procedure_steps[].step_number | integer | Must be a positive integer starting at 1. Must be sequential with no gaps. Parse check: typeof === 'number' and step_number > 0. | |
procedure_steps[].sub_question | string | Must be a non-empty string ending with '?'. Must contain at least one actionable verb. Schema check: length > 10 and ends with '?'. | |
procedure_steps[].target_documentation_section | string | Must be a non-empty string. Should map to a known section heading pattern from [DOCUMENTATION_INDEX]. Null allowed only if section is genuinely unknown. | |
procedure_steps[].expected_evidence_type | enum: ['step_instruction', 'prerequisite', 'tool_config', 'troubleshooting_note', 'completion_criteria'] | Must be one of the five allowed enum values. Reject any unrecognized type. Schema check: strict enum match. | |
procedure_steps[].dependency_step_number | integer or null | If null, step is independent. If integer, must reference a valid prior step_number that exists in the array. Validate: dependency_step_number < current step_number. | |
completeness_check | object | Must contain 'original_procedure' and 'coverage_assessment' keys. Reject if either key is missing. | |
completeness_check.coverage_assessment | enum: ['full', 'partial', 'insufficient'] | Must be one of the three allowed values. If 'partial' or 'insufficient', the 'missing_aspects' array must be non-empty. Cross-field validation required. | |
completeness_check.missing_aspects | array of strings | Required only when coverage_assessment is 'partial' or 'insufficient'. Each string must describe a specific procedural gap. Reject if array is empty when coverage is not 'full'. |
Common Failure Modes
Procedure decomposition fails in predictable ways. These cards cover the most common breakages when turning a high-level 'how-to' instruction into a sequence of retrievable sub-questions, along with concrete mitigations.
Missing or Skipped Steps
What to watch: The model generates sub-questions that cover the major phases but silently omits prerequisite steps, cleanup actions, or conditional branches present in the original procedure. This is especially common when the source SOP is long or contains nested substeps. Guardrail: Add a completeness check step that compares the generated sub-question list against a structured extraction of the original procedure's step headings. Flag any original step that has no corresponding sub-question for human review.
Loss of Ordering and Dependencies
What to watch: Sub-questions are generated as a flat, unordered list even when the original procedure has strict sequential dependencies. Downstream retrieval or execution treats them as independent, leading to out-of-order actions. Guardrail: Require a depends_on field in the output schema that references prior sub-question IDs. Validate that no sub-question references a future step and that the dependency graph contains no cycles before releasing to execution.
Over-Decomposition into Trivial Sub-Questions
What to watch: The model atomizes the procedure into excessively granular sub-questions that each retrieve a single sentence, bloating the retrieval plan and losing the context needed to understand a step holistically. Guardrail: Set a minimum step granularity in the prompt constraints. Include a post-generation check that flags sub-questions shorter than a threshold or those that can be trivially merged with adjacent questions without losing retrieval specificity.
Domain Terminology Drift
What to watch: The model rewrites procedure steps using generic language instead of the domain-specific terms, acronyms, or identifiers present in the source SOP. Retrieval against internal docs then fails because the query terms don't match the indexed vocabulary. Guardrail: Instruct the prompt to preserve original domain terminology, entity IDs, and system names verbatim from the source procedure. Add a post-generation diff that flags any term replacement against a glossary or the original text.
Hallucinated or Extrapolated Steps
What to watch: The model adds sub-questions for steps that seem logically necessary but are not actually present in the original procedure. This introduces retrieval targets for documentation that doesn't exist, producing empty results or fabricated answers downstream. Guardrail: Require each generated sub-question to cite the specific line or section of the original procedure it derives from. Flag any sub-question without a valid source citation for removal or human review before retrieval execution.
Implicit Context Loss Across Sub-Questions
What to watch: Each sub-question is phrased in isolation, losing context established by prior steps such as system state, user identity, or intermediate outputs. Retrieval for later sub-questions returns irrelevant results because the query lacks the accumulated context. Guardrail: Include a context_carryover field in the output schema that explicitly states what information from prior answers must be injected into the current sub-question's retrieval context. Validate that carryover fields are populated for all non-initial steps.
Evaluation Rubric
Use this rubric to test whether a Procedure Decomposition prompt output is production-ready before wiring it into a workflow automation harness. Each criterion targets a specific failure mode observed in SOP decomposition tasks.
| Criterion | Pass Standard | Failure Signal | Test Method |
|---|---|---|---|
Step Completeness | All critical steps from [ORIGINAL_PROCEDURE] are represented by at least one sub-question | A mandatory safety or compliance step from the source SOP is missing in the sub-question list | Diff the extracted step labels against a human-annotated checklist of required steps from the source document |
Sub-Question Independence | Each sub-question can be answered from a single documentation section without requiring another sub-question's answer | A sub-question contains pronouns or references like 'the previous step' or 'after that' that make it unresolvable alone | For each sub-question, attempt retrieval in isolation; flag any sub-question that returns empty results unless paired with its predecessor |
Ordering Correctness | Sub-questions are sequenced in execution order matching the SOP, with any parallelizable steps flagged | A step that requires the output of a prior step appears before that prior step in the sequence | Check the [DEPENDENCY] field for each sub-question; assert that no sub-question has a dependency on a later-indexed sub-question |
Retrievability | Each sub-question retrieves at least one relevant document chunk from the target knowledge base | A sub-question returns zero results or only results with cosine similarity below 0.7 to the query intent | Execute each sub-question against the retrieval index; measure recall@3 for each; flag any with zero relevant passages |
Completeness Check Output | The final completeness check explicitly confirms or denies that all original procedure steps are covered | The completeness check is missing, returns only 'yes' with no evidence, or hallucinates coverage of missing steps | Parse the completeness check field; assert it contains a boolean flag and a list of any uncovered steps with citations |
Schema Compliance | Output is valid JSON matching the [OUTPUT_SCHEMA] with all required fields present and correctly typed | JSON parse fails, required fields like [DEPENDENCY] or [TARGET_INDEX] are missing, or field types are wrong | Validate output against the JSON Schema using a programmatic validator; reject on any schema violation |
No Hallucinated Steps | All sub-questions map to steps actually present in [ORIGINAL_PROCEDURE]; no invented steps | A sub-question introduces a step not found in the source procedure, such as an assumed best practice | For each sub-question, require a citation to the source procedure section; flag any sub-question without a valid citation anchor |
Enabling Efficiency, Speed & Accuracy
Intelligent Analysis, Decision & Execution
We build AI systems for teams that need search across company data, workflow automation across tools, or AI features inside products and internal software.
Talk to Us
Search across company data
Give teams answers from docs, tickets, runbooks, and product data with sources and permissions.
Useful when people spend too long searching or get different answers from different systems.

Automate internal workflows
Use AI to route work, draft outputs, trigger actions, and keep approvals and logs in place.
Useful when repetitive work moves across multiple tools and teams.

Add AI to products and internal tools
Build assistants, guided actions, or decision support into the software your team or customers already use.
Useful when AI needs to be part of the product, not a separate tool.
Adapt This Prompt
How to adapt
Use the base template with a frontier model and manual review. Strip the JSON output schema requirement and ask for a numbered list first to validate decomposition logic before adding structure.
codeDecompose the following procedure into a list of actionable sub-questions: Procedure: [PROCEDURE_TEXT] Return a numbered list.
Watch for
- Steps that are too broad to retrieve against (e.g., "set up the environment")
- Missing terminal steps that confirm completion
- The model summarizing instead of decomposing

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.
Partnered with leading AI, data, and software stack.
How We Work
Custom AI workflows for your Business
One-fit-all AI don't work for modern businesses. At Inferensys, we aim to understand your business & custom requirements; which we use to define most efficient agentic workflows, the data, and the tools for your business.
01
Review the use case
We understand the task, the users, and where AI can actually help.
Read more02
Pick the right approach
We define what needs search, automation, or product integration.
Read more03
Build the first useful version
We implement the part that proves the value first.
Read more04
Improve from there
We add the checks and visibility needed to keep it useful.
Read moreThe first call is a practical review of your use case and the right next step.
Talk to Us