5.5 Breaking Down Tasks into Subtasks

It is often advisable to break down large tasks into smaller, manageable subtasks. You can do this by creating an outline tree below a TODO item, with detailed subtasks on the tree46. To keep an overview of the fraction of subtasks that have already been marked as done, insert either ‘[/]’ or ‘[%]’ anywhere in the headline. These cookies are updated each time the TODO status of a child changes, or when pressing C-c C-c on the cookie. For example:

* Organize Party [33%]
** TODO Call people [1/2]
*** TODO Peter
*** DONE Sarah
** TODO Buy food
** DONE Talk to neighbor

If a heading has both checkboxes and TODO children below it, the meaning of the statistics cookie become ambiguous. Set the property ‘COOKIE_DATA’ to either ‘checkbox’ or ‘todo’ to resolve this issue.

If you would like to have the statistics cookie count any TODO entries in the subtree (not just direct children), configure the variable org-hierarchical-todo-statistics. To do this for a single subtree, include the word ‘recursive’ into the value of the ‘COOKIE_DATA’ property.

* Parent capturing statistics [2/20]
  :PROPERTIES:
  :COOKIE_DATA: todo recursive
  :END:

If you would like a TODO entry to automatically change to DONE when all children are done, you can use the following setup:

(defun org-summary-todo (n-done n-not-done)
  "Switch entry to DONE when all subentries are done, to TODO otherwise."
  (let (org-log-done org-todo-log-states)   ; turn off logging
    (org-todo (if (= n-not-done 0) "DONE" "TODO"))))

(add-hook 'org-after-todo-statistics-hook #'org-summary-todo)

Another possibility is the use of checkboxes to identify (a hierarchy of) a large number of subtasks (see Checkboxes).


Footnotes

(46)

To keep subtasks out of the global TODO list, see the option org-agenda-todo-list-sublevels.