SHOP (Simple Hierarchical Ordered Planner) is a forward-search, progression-based algorithm for Hierarchical Task Network (HTN) planning. It decomposes high-level compound tasks into primitive actions by recursively applying decomposition methods in the order tasks are encountered, simulating their effects on a current world state as it plans. This interleaving of planning and state progression makes it highly efficient, as it can prune irrelevant branches early by checking preconditions against the simulated state.
Glossary
SHOP (Simple Hierarchical Ordered Planner)

What is SHOP (Simple Hierarchical Ordered Planner)?
A seminal, forward-chaining planning algorithm for Hierarchical Task Networks (HTNs) that interleaves task decomposition with state progression.
The algorithm operates in a depth-first manner, following the ordering constraints in the task network. Its simplicity and efficiency made it a foundational model for domain-specific planning and influenced later systems for agent-based reasoning and workflow automation. Unlike backward-chaining planners, SHOP's forward search from the initial state makes it particularly effective for problems where the current world state heavily constrains viable decompositions.
Core Algorithmic Characteristics
SHOP is a seminal, domain-independent HTN planning algorithm that performs forward-chaining task decomposition in a depth-first manner, interleaving planning with state progression to generate executable action sequences.
Forward-Chaining State Progression
SHOP is a progression planner. It starts from the initial world state and simulates the execution of actions forward in time. As it decomposes tasks, it immediately applies the effects of chosen primitive actions to a working copy of the state. This interleaving of planning and state simulation allows SHOP to:
- Evaluate the preconditions of methods and operators in the current, simulated state.
- Prune irrelevant decomposition paths early, as methods whose preconditions are not met in the current state are not considered.
- Efficiently handle numeric preconditions and resource constraints by tracking state changes in real-time during the search.
Depth-First Task Decomposition
The algorithm decomposes tasks using a depth-first recursive search through the hierarchy of methods. When faced with a compound task, SHOP:
- Selects an applicable method from the domain description.
- Decomposes the compound task into the method's specified subtask network.
- Immediately recurses on the first subtask in that network. This creates a commitment strategy where the planner fully decomposes one branch of the task hierarchy to a sequence of primitive actions before backtracking to explore alternatives. This is efficient for domains where correct high-level method choices lead directly to valid primitive plans.
Ordered Task Network Processing
A defining feature is its requirement for totally ordered task networks. Subtasks within a method's decomposition are provided in a strict linear order. The planner processes them sequentially:
- The first subtask in the network is fully decomposed (if compound) or added to the plan (if primitive).
- Only after it is completely resolved does SHOP proceed to the next subtask in the order. This simplifies the planning process by eliminating the need for complex partial-order planning algorithms to manage temporal constraints during search, making the algorithm simpler and often faster for domains where natural sequential order exists.
Primitive Action as Planning Operators
At the leaves of the decomposition tree are primitive tasks, which correspond directly to planning operators with executable semantics. In SHOP:
- A primitive task is an operator name with parameters.
- When SHOP selects a primitive task during decomposition, it instantiates the corresponding operator.
- It checks the operator's preconditions against the current simulated state.
- If satisfied, it applies the operator's effects to update the simulated state and appends the operator instance to the growing plan sequence. This direct mapping ensures the final output is a concrete, executable sequence of grounded actions.
Method Precondition Evaluation
The choice of how to decompose a compound task is governed by method preconditions. Each method has logical preconditions that are evaluated in the current simulated state at the moment the compound task is encountered.
- Selection Mechanism: SHOP non-deterministically chooses any method whose preconditions are true.
- Backtracking Point: If a chosen method leads to a dead-end (e.g., a subsequent primitive task's preconditions fail), the planner backtracks to this choice point to try a different applicable method.
- Expressive Power: Preconditions can test for the presence/absence of facts, numeric quantities, and can include complex logical expressions, allowing the domain expert to encode sophisticated knowledge about when a decomposition strategy is appropriate.
Soundness and Completeness
Under standard assumptions, SHOP is a sound and complete planner for HTN domains with totally ordered task networks.
- Soundness: Any plan returned by SHOP is guaranteed to be executable from the initial state and will achieve the top-level task (i.e., it is a valid solution).
- Completeness: If a valid plan exists for the given problem, SHOP's search algorithm will find it, provided the domain description and search control are correctly formulated and the search space is fully explored (e.g., via backtracking). These formal guarantees are critical for deploying SHOP-based planners in safety-critical or mission-critical applications where plan correctness is non-negotiable.
How the SHOP Planning Algorithm Works
SHOP (Simple Hierarchical Ordered Planner) is a seminal, forward-chaining algorithm for Hierarchical Task Network (HTN) planning that interleaves task decomposition with state progression.
SHOP is a forward state-space planner that decomposes tasks in the order they will be executed. Starting from the initial state, it selects a task from the current task network, applies a relevant decomposition method if the task is compound, and progresses the simulated world state as primitive actions are added. This interleaving of planning and execution simulation allows SHOP to efficiently prune irrelevant decomposition paths by evaluating preconditions against the current, forward-propagated state.
The algorithm operates depth-first, recursively decomposing the first task in the network until it reaches a primitive action, which it then 'executes' in its internal state model. This creates a totally ordered plan by construction. Its simplicity and efficiency stem from this ordered, state-forward search, making it foundational for domains where actions have deterministic effects and task order is critical, such as in classical planning benchmarks and early agent systems.
Frequently Asked Questions
Essential questions and answers about the SHOP algorithm, a foundational forward-search planner for Hierarchical Task Networks (HTNs).
SHOP (Simple Hierarchical Ordered Planner) is a seminal Hierarchical Task Network (HTN) planning algorithm that performs task decomposition in a forward, depth-first manner, interleaving planning with state progression. Unlike planners that search backward from goals, SHOP starts from the initial state and the initial compound task. It selects a task from the current task network, and if it's a primitive task (an executable operator), it applies its effects to advance the simulated world state. If the task is a compound task, SHOP selects an applicable method to decompose it into subtasks, which are added to the network. This process repeats, with the planner always working on the first task in the current ordered list, until all tasks are decomposed into a sequence of primitive actions—the solution plan. Its key innovation is this progression search, which allows it to evaluate preconditions in the context of a simulated, evolving world state, making it highly efficient for many practical domains.
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.
Related Terms
These terms define the core components and processes of the HTN planning formalism, which SHOP implements as a forward-searching algorithm.
Hierarchical Task Network (HTN)
A planning formalism where the solution is generated by recursively decomposing high-level, compound tasks into networks of smaller subtasks using methods, until a sequence of directly executable primitive tasks is found. This approach encodes domain-specific knowledge about how to achieve goals, making it more efficient for complex, structured problems than pure state-space search.
- Core Idea: Planning as task refinement, not state-space search.
- Key Advantage: Encodes procedural knowledge, leading to highly efficient planning in well-understood domains.
- Contrast with Classical Planning: Classical planners search for a sequence of actions that connect an initial state to a goal state. HTN planners search for a way to decompose a task into known procedures.
Compound Task
A high-level, abstract task in an HTN that cannot be executed directly. It must be decomposed into a network of subtasks (which can be other compound tasks or primitive tasks) using an applicable method. Compound tasks represent goals or activities like 'Assemble Product' or 'Diagnose System Failure'.
- Role: Serves as a placeholder for abstract goals requiring refinement.
- Decomposition: Each compound task has one or more methods that define possible ways to achieve it.
- Example: The task 'Navigate to Office' is a compound task. A method might decompose it into: 'Walk to Garage', 'Drive to Building', 'Park Car', 'Enter Building'.
Primitive Task
A task in an HTN that corresponds directly to an executable operator or action in the planning domain. It is a leaf node in the decomposition tree and has associated preconditions (conditions required for execution) and effects (changes to the world state).
- Role: The atomic, executable unit of a plan.
- Analogy: A function call in programming.
- Example: For a robot, 'PickUp(Object)' and 'MoveTo(Location)' are primitive tasks with defined preconditions (e.g., gripper empty, path clear) and effects (e.g., holding object, at location).
Method (HTN)
A schema that defines a possible way to decompose a specific compound task into a network of subtasks. A method consists of:
- Task: The compound task it decomposes.
- Preconditions: Logical conditions that must be true in the current state for the method to be applicable.
- Subtasks: The network of (compound or primitive) tasks that implement the method.
- Ordering Constraints: Temporal relations between the subtasks.
- Role: Encodes the procedural knowledge of how to do something.
- Key Feature: A single compound task can have multiple methods, allowing the planner to choose the most appropriate decomposition based on the current world state.
Task Decomposition
The core algorithmic process in HTN planning where a compound task is recursively replaced by a network of its subtasks using an applicable method. This process continues until the entire plan consists solely of primitive tasks. The record of this process forms a decomposition tree.
- Process:
Compound Task->Select Applicable Method->Replace with Subtask Network->Repeat on any new compound tasks. - SHOP's Approach: SHOP performs decomposition in a forward-chaining, depth-first manner, interleaving it with state progression to check preconditions in the current simulated world state.
Domain Description (HTN)
The complete formal specification of an HTN planning problem. It defines the 'world' the planner operates in and includes:
- Operators: Definitions of all primitive tasks (preconditions & effects).
- Methods: Definitions for decomposing all compound tasks.
- Task Schemas: Templates for compound and primitive tasks.
- Predicates: The vocabulary for describing world states.
A Planning Problem is then an instance consisting of a Domain Description, an Initial State, and an Initial Task Network (the top-level goal tasks).

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