ChatHTN: HTN Planning with ChatGPT
- ChatHTN is a hierarchical task network planner that interleaves symbolic methods with ChatGPT to handle unresolved compound tasks, maintaining sound verification.
- It introduces an online learning mechanism that generalizes verified LLM-generated decompositions into reusable HTN methods, reducing future calls.
- The system distinctly separates decomposition knowledge from task semantics using formal annotations and verifier tasks to guarantee correct plan execution.
Searching arXiv for ChatHTN and closely related HTN+LLM planning work to ground the article in current papers. ChatHTN is a Hierarchical Task Network (HTN) planner that interleaves symbolic HTN planning with queries to ChatGPT when the method library is incomplete. In its original form, the system uses a SHOP-style symbolic planner as the control backbone, delegates only unresolved compound-task decompositions to the LLM, and enforces correctness through symbolic execution and task-specific verifier actions, yielding a sound planner despite the approximate character of LLM outputs. A later extension adds online learning of generalized HTN methods from successful LLM-generated decompositions, converting one-off repairs into reusable symbolic knowledge and thereby reducing future calls to ChatGPT while maintaining the same verification discipline (Munoz-Avila et al., 17 May 2025, Xu et al., 17 Nov 2025).
1. Formal model and representational basis
ChatHTN is formulated in the standard HTN setting in which planning proceeds over a state , a current task list , a library of methods, and a set of primitive operators. A method is written as
where is a compound task schema, is a conjunction of positive and negative atoms, and is a list of subtasks. A primitive operator is written as
where is a primitive task, its preconditions, and its add and delete lists. A method 0 is applicable to 1 when there exists a substitution 2 such that 3 and 4 holds in 5; an operator is applicable by the analogous condition on 6 and 7 (Xu et al., 17 Nov 2025).
The symbolic execution semantics are standard. If the first task 8 is compound and an applicable method exists, the planner replaces it with the instantiated subtask list: 9 If 0 is primitive and an applicable operator exists, the next state is
1
the task list becomes 2, and the plan is extended with 3 (Xu et al., 17 Nov 2025).
A distinctive representational addition in ChatHTN is the use of annotated task semantics for compound tasks. Each such task is associated with a triple
4
where 5 is the task schema, 6 is a precondition description, and effects is the desired postcondition set. These annotations are not methods; they specify what counts as successful realization of the task and provide the semantic target passed to the LLM when no symbolic decomposition is available. An example used in the search-and-rescue domain is rescueSurvivor(?survivor, ?loc) with preconditions safeHaven(?SH), at(?survivor, ?loc) and effects at(?survivor, ?SH) (Xu et al., 17 Nov 2025).
This architecture preserves a sharp distinction between decomposition knowledge and task semantics. Methods say how to decompose; annotated tasks say what success means. That distinction is central both to sound verification and to later method learning.
2. Interleaving symbolic decomposition with ChatGPT
ChatHTN behaves as an ordinary HTN planner whenever its symbolic knowledge suffices. The LLM is consulted only in the specific case where the current first task is compound and no applicable method exists in the current state. In that case, ChatHTN queries ChatGPT with the annotated task for 7, the current state, and the available primitive actions or operators, asking for a decomposition into primitive tasks (Munoz-Avila et al., 17 May 2025).
The interaction is implemented as a two-step prompt chaining strategy. In the first prompt, the system provides the task, current state, task semantics, domain operators, and axioms, and asks for a candidate action sequence or “sub-tasks breakdown.” In the second prompt, it provides the same context together with the first response and asks ChatGPT to map that breakdown into a strictly machine-readable sequence of primitive predicates, one per line, using only the provided operators (Munoz-Avila et al., 17 May 2025). The decomposition returned by ChatGPT is therefore not executed directly as free text; it is parsed into the same symbolic task language used by the HTN engine.
This yields a characteristic interleaving discipline. Symbolic methods have priority. If they apply, planning remains entirely symbolic. If they do not, ChatGPT supplies a candidate primitive decomposition for the unresolved compound task, after which the symbolic planner resumes control. The resulting hierarchy may thus contain branches originating from handcrafted HTN methods and branches originating from ChatGPT, but all branches are embedded in the same symbolic execution process (Munoz-Avila et al., 17 May 2025).
The practical motivation is the HTN knowledge-engineering bottleneck. Classical HTN planning requires a sufficiently complete method library; ChatHTN allows planning with a partial method set by using the LLM as an approximate decomposition source only at points where symbolic knowledge is missing. A common misconception is that ChatHTN is therefore an LLM planner wrapped around symbolic execution. The design is more constrained: the symbolic HTN engine remains the control architecture, and the LLM is a local decomposition oracle rather than the executor or correctness criterion.
3. Verifier tasks and the soundness guarantee
The mechanism that distinguishes ChatHTN from unconstrained LLM planning is the insertion of verifier tasks after every compound-task decomposition, including both symbolic and LLM-generated decompositions. Given an annotated task 8, ChatHTN defines a primitive verifier task 9 whose associated operator has preconditions exactly equal to effects, with empty add and delete lists. The task is therefore applicable if and only if the state reached after executing the decomposition satisfies the intended effects of the parent compound task (Xu et al., 17 Nov 2025).
When ChatGPT returns a primitive sequence 0, the planner replaces the unresolved compound task by
1
The primitive tasks are then executed one by one using the operator definitions. If any primitive task is inapplicable in the current state, the branch fails. If all primitives execute but 2 is inapplicable because the required effects do not hold, the branch also fails. Only a branch that executes all primitives and passes the verifier is retained (Xu et al., 17 Nov 2025).
The original ChatHTN paper formalizes this as a soundness theorem: any plan returned by the system satisfies the effects of the specified input tasks under the given domain model (Munoz-Avila et al., 17 May 2025). In the empirical evaluation of the original system, this property is illustrated by unsolvable test conditions across three domains—logistics transportation, household robot, and search-and-rescue—in which ChatHTN makes LLM calls but does not return a plan. The LLM may propose decompositions, but symbolic execution and verification block false positives (Munoz-Avila et al., 17 May 2025).
The consequence is precise. ChatHTN does not trust the LLM either to respect preconditions or to determine task completion. Applicability and effect satisfaction remain purely symbolic. This is why the system can be described as delegating “missing” pieces of domain knowledge to an LLM while preserving the usual soundness guarantees of symbolic HTN planning (Xu et al., 17 Nov 2025).
4. Online learning of generalized HTN methods
The extension introduced in late 2025 adds an online method learner on top of ChatHTN. Whenever ChatGPT provides a primitive decomposition for a compound task, and that decomposition executes successfully and passes the verifier, the system immediately learns a new HTN method from the episode. The learned method is not a raw cache entry for the encountered instance; it is a generalized symbolic method intended to apply to other instances of the same task (Xu et al., 17 Nov 2025).
Suppose the unresolved task is 3, ChatGPT returns 4, the corresponding operators are 5, and the verifier confirms that the final state satisfies the annotated effects 6. The learner then constructs a method
7
where lifting replaces constants in the ground task and ground primitive subtasks with variables. For example,
8
The same lifting is applied to the task instance 9 and to every primitive task in the decomposition (Xu et al., 17 Nov 2025).
The crucial remaining component is the learned precondition set. ChatHTN derives it by regression from the task effects through the executed primitive sequence: 0 The paper defines regression recursively so that one begins from the target effects at the end of the sequence, walks backward through the operators, removes facts added by an operator, and adds the operator’s preconditions. The result is then lifted to 1 (Xu et al., 17 Nov 2025). Informally, the learned preconditions capture the conditions under which the same lifted primitive sequence will again achieve the annotated task effects.
This mechanism is explicitly presented as “akin to memoization” but more general. Pure memoization would cache a mapping of the form
2
and would therefore only reuse the exact same decomposition in the exact same state. ChatHTN instead stores a symbolic abstraction—a lifted task schema, lifted primitive sequence, and regressed lifted preconditions—so the learned method can apply to other states and task instances that satisfy the same structural conditions (Xu et al., 17 Nov 2025).
The extension also introduces termination methods for annotated tasks: 3
These methods apply when the task’s effects already hold and serve as explicit recursion stoppers. In the search-and-rescue domain, for example, a termination method for checkSurvivors(?loc) can apply when no survivor remains at that location and decompose the task into doNothing() (Xu et al., 17 Nov 2025).
A second misconception is that online learning simply “records what ChatGPT said.” The learning layer is more structured: only fully verified decompositions are used, the learned output is a generalized HTN method rather than a single trace, and the generalization is based on lifting plus regression rather than exact-state reuse.
5. Experimental domains and empirical behavior
The original ChatHTN paper evaluates the baseline planner in three case-study domains: logistics transportation, household robot, and search-and-rescue. Under the full domain model, all three domains solve with 4 LLM calls. Under unsolvable conditions, no plan is returned despite calls to chatGPTQuery, illustrating soundness in practice. When methods are removed, the planner may still solve problems by asking ChatGPT for missing decompositions; when methods for all tasks are removed, ChatHTN sometimes still finds a solution, but failures also occur, reflecting the approximate nature of the LLM component (Munoz-Avila et al., 17 May 2025).
The online-learning paper evaluates the extended system in two classical HTN domains. In Logistics Transportation, the world has 3 cities, each with 2 post offices and 1 airport, 3 trucks, and 1 airplane; each problem instance contains a task list of 5 package-relocation tasks, and successful plans have 50–70 primitive steps. In Search and Rescue, the world contains multiple locations, one safe haven, several unsafe zones, 1 drone, and 5 survivors randomly placed among unsafe zones; successful plans have 21–47 primitive steps, and the top-level task is searchANDrescue (Xu et al., 17 Nov 2025).
The experimental protocol uses a complete handcrafted HTN knowledge base and simulates incompleteness by removing one method at a time. For each removed-method scenario, 10 random problems are generated; for each problem, ChatHTN is run 3 times and the average number of calls to GPT and percentage of problems solved are recorded. The comparison is between the original ChatHTN and the version with online method learning. Learned methods are deleted after each problem instance, so every problem begins with the same incomplete method set (Xu et al., 17 Nov 2025).
Two metrics are reported: number of calls to GPT and percentage of problems solved. In both domains, the configuration with method learning consistently requires fewer calls to ChatGPT than the configuration without learning. The success rate is often equal or higher with learning, and in some cases higher, because repeated querying exposes the planner to repeated LLM errors, whereas a verified learned method can be reused deterministically after the first successful decomposition (Xu et al., 17 Nov 2025).
The most difficult cases arise when the missing method is high-level, such as TPM2 in Logistics or SAR2 in Search and Rescue. In those settings, the planner must ask ChatGPT to generate a complete solution plan for the entire problem from the initial state, and long full-length plans are much harder for the LLM to produce correctly. Both configurations therefore show low success rates in these cases (Xu et al., 17 Nov 2025).
6. Scope, limitations, and relation to adjacent work
ChatHTN assumes a fully observable environment, correct operator models, and correct annotated tasks. Its soundness guarantee depends on those symbolic models, not on the LLM. The system is not claimed to be complete or optimal; it may fail on solvable problems if ChatGPT does not provide a usable decomposition or if high-level missing methods require long, difficult-to-synthesize plans (Xu et al., 17 Nov 2025). The implementation also includes loop detection by tracking previously visited 5 pairs and failing branches that revisit a pair, which is a practical safeguard rather than a completeness result (Munoz-Avila et al., 17 May 2025).
The current online learner is intentionally restricted. Learned methods decompose a task into a linear sequence of primitive tasks only; they do not include compound subtasks, recursion, or richer partial-order structure. Consequently, methods such as checkSurvivors that use recursive decomposition to handle an arbitrary number of survivors cannot yet be learned in their recursive form. A decomposition observed for two survivors yields a method specialized to that pattern rather than a genuinely recursive strategy (Xu et al., 17 Nov 2025).
The stated future directions follow directly from these limitations. One proposal is to allow ChatGPT to return decompositions containing both primitive and compound tasks, which would make it possible to learn methods that themselves contain compound subtasks and hence recursive structure. Another is post-hoc hierarchical induction over primitive sequences, using repeated patterns and annotated tasks as semantic anchors in the manner of HTN-MAKER-style induction (Xu et al., 17 Nov 2025).
Within the broader literature, ChatHTN occupies a specific position. Relative to classical HTN learning, it is online, incremental, and driven by on-demand ChatGPT decompositions rather than offline state–action traces. Relative to other LLM-assisted planning systems, its novelty lies in local interleaving: the LLM is used only when symbolic methods are unavailable, and every LLM-derived decomposition is accepted only after symbolic execution and verification. This suggests a division of labor in which the LLM supplies candidate hierarchical content while symbolic HTN machinery remains responsible for applicability, state transition, and task satisfaction (Munoz-Avila et al., 17 May 2025, Xu et al., 17 Nov 2025).