Task management with org-roam Vol. 3: FILETAGS
Sharing my approach to managing person-related tasks in org-roam notes. I explain how to use filetags to automatically tag all tasks in a person's note (like @FrodoBaggins), maintaining the tag inheritance functionality from regular org-mode while moving to individual roam notes. I've included code to automate the tagging process, making it easier to maintain consistency when adding new people notes.
In the previous articles (Vol. 1 and Vol. 2) we walked the path to org-roam and solved the issue with garbage in the category column of agenda. Today we are going to explore meta projects dedicated to specific person, tag inheritance and moving such projects to separate org-roam
files. As result, we will have code for automatic tagging based on the title.
Aside from regular meta projects (like personal blog) I also create meta projects for people and locations. This is helpful, because some of the tasks are really related to someone specifically. For example, when I need to return a borrowed book, I just create a task for this.
* Frodo Baggins :@FrodoBaggins: ** TODO Return 'The Lord of the Rings' book ** TODO Farewell party :PROJECT: It feels like Mr. Frodo is about to live Shire. So we are going to setup a farewell party for him. *** TODO Talk to Samwise Gamgee :@SamwiseGamgee: *** TODO Talk to Meriadoc Brandybuck :@MeriadocBrandybuck: *** TODO Talk to Peregrin Took :@PeregrinTook: *** TODO Tie a pair of wool socks I am not sure where he is going, so a pair of warm wool socks should be good. At least they can be used to protect bottles of wine during journey. That is in case Frodo doesn't wear socks. But how could it be? Everyone does!
Change Log:
[2021-01-24 Sun]
: Since some of the functionality mentioned in the original article was merged toorg-roam
, all code is updated to reflect the current state of affairs.[2021-03-02 Tue]
: Update naming convention to match personal configurations.[2021-05-10 Mon]
: Update post to reflect changes in org-roam v2. Previous version of this article is available on GitHub.
Related posts
- Task management with org-roam Vol. 7: Capture – Sharing my org-roam capture workflow, focusing on quick task entry and efficient processing. I've set up a dedicated inbox file per machine to avoid sync issues, and use org-agenda with the REFILE tag to process captured items. For meetings, I've created a smarter capture template that automatically places one-on-one notes in the right person's file - a nice example of using org-roam's query capabilities to streamline capture.
- Task management with org-roam Vol. 6: Select a person and view related tasks – Sharing a quick utility I wrote to view all tasks related to a specific person in org-roam. By combining vulpea's selection functions with org-agenda's tag matching, we can easily see everything tagged with a person's name (including their aliases). Just a few lines of code, but it makes a big difference in managing person-related tasks!
- Task management with org-roam Vol. 5: Dynamic and fast agenda – Sharing a significant performance optimization I created for org-roam agenda generation. By dynamically tracking notes containing TODOs with a 'project' tag, I reduced agenda loading from over 50 seconds to under 1 second. The solution automatically updates tags when files are visited or saved, querying only relevant files when building the agenda view. I've included all the code and explained the implementation details, from checking for TODO entries to SQL queries.
- Task management with org-roam Vol. 4: Automatic tagging – Sharing how I automated task tagging in org-roam with vulpea. When you mention someone in a task by linking to their note, the task automatically gets tagged with that person's name. I'm using vulpea-insert hooks to handle this cleanly, avoiding the need for advice on org-roam functions. The code includes checks to ensure we only add person tags to actual TODO items.
- Task management with org-roam Vol. 2: Categories – Sharing how I improved the agenda view for org-roam notes by fixing category display. Rather than showing file IDs, we can now show meaningful categories based on note titles or explicit CATEGORY properties. I've included a function to automatically extract and format categories, plus options to handle long titles gracefully. The result is a cleaner, more readable agenda that better integrates with org-roam's note-taking approach.
- Task management with org-roam Vol. 1: Path to Roam – Sharing my approach to task management in org-roam, showing how to organize tasks and projects across notes while maintaining compatibility with org-mode's agenda features. While org-roam favors smaller files over larger ones, we can still implement a familiar structure of tasks, projects, and meta-projects. The article explains the basic setup, though there are some visual quirks in the agenda buffer that we'll address in a follow-up post.
Now, apart from some misconception about hobbits, there are few important points to note.
- Due to tags inheritance, all of the subheadings of
Frodo Baggins
have@FrodoBaggins
tag. - Tasks tagged with other people also have the
@FrodoBaggins
tag.
Thanks to inheritance, it's easy to find all tasks related to Frodo Baggins via org-agenda
. It even enables the search of overlapping tasks. For example, tasks related to Frodo and Samwise. For more information, take a look at the matching tags and properties section of the manual.
With org-roam
, each person has its own file.
#+title: Frodo Baggins #+filetags: @FrodoBaggins people * Tasks ** TODO Return 'The Lord of the Rings' book ** TODO Farewell party :PROJECT: It feels like Mr. Frodo is about to live Shire. So we are going to setup a farewell party for him. *** TODO Talk to Samwise Gamgee :@SamwiseGamgee: *** TODO Talk to Meriadoc Brandybuck :@MeriadocBrandybuck: *** TODO Talk to Peregrin Took :@PeregrinTook: *** TODO Tie a pair of wool socks I am not sure where he is going, so a pair of warm wool socks should be good. At least they can be used to protect bottles of wine during journey. That is in case Frodo doesn't wear socks. But how could it be? Everyone does!
In order to maintain the feature where @FrodoBaggins
tag is applied to all TODO items we have to use filetags
property. I am also using id to mark Frodo Baggins as a person (even though he is a hobbit!). This helps me in two ways. First of all, it gives me clear understanding that this entity is a person (some people do have strange names). Secondly, it serves me in automation and filtering (as example, checkout Select a person and view related tasks post).
Now, when I see a headline with title and tag being literally the same (with few programmable exceptions) or the file with title
and filetags
being the same (with few programmable exceptions), I am feeling nervous. Especially since I am prone to mistakes.
So what I do - I automate filetags
. I have a function vulpea-ensure-filetag
which automatically sets the filetags
buffer property for org-roam
entries tagged as people
. It uses vulpea-buffer-tags-get and vulpea-buffer-tags-add from vulpea library.
(defun vulpea-ensure-filetag () "Add respective file tag if it's missing in the current note." (interactive) (let ((tags (vulpea-buffer-tags-get)) (tag (vulpea--title-as-tag))) (when (and (seq-contains-p tags "people") (not (seq-contains-p tags tag))) (vulpea-buffer-tags-add tag)))) (defun vulpea--title-as-tag () "Return title of the current note as tag." (vulpea--title-to-tag (vulpea-buffer-title-get))) (defun vulpea--title-to-tag (title) "Convert TITLE to tag." (concat "@" (s-replace " " "" title)))
This function can be called interactively, but since I usually place the tag using vulpea-tags-add
, I just add the vulpea-ensure-filetag
to the end of that function.
(defun vulpea-tags-add () "Add a tag to current note." (interactive) ;; since https://github.com/org-roam/org-roam/pull/1515 ;; `org-roam-tag-add' returns added tag, we could avoid reading tags ;; in `vulpea-ensure-filetag', but this way it can be used in ;; different contexts while having simple implementation. (when (call-interactively #'org-roam-tag-add) (vulpea-ensure-filetag)))
Though for other purposes one can put this function to the file visit hook. But hooks are sensitive, so I am going to stop here.
In the next article we are going to talk about automatic insertion of person tag (e.g. @FrodoBaggins
) when mentioning this person in other task.
References
org-roam
documentation on GitHub.org-mode
documentation on the official site.- Org-roam tags post.
- personal configurations on GitHub.