DEV Community

Samuel Chan
Samuel Chan

Posted on

Todo + gamification with Taskwarrior & Taskquant

If you live and breathe in the terminal, you want as little context switching as possible. For many things (like web browsing and spreadsheet editing) a graphical user interface seems inevitable no matter how great the alternative is (i.e lynx browser).

gui and terminal

For everything else, there is almost always a better option, one that allows you to stay within the terminal and gasp optionally works with VIM bindings. As I review my current work and processes, it strikes me that a task manager (todo app) is one such use-case.

A good todo app is stunning, aesthetically pleasing, and joyous to use.

But a great todo app should be almost the entirely opposite of a good todo app. It shouldn't even be joyous to use, lest you spend too much time in it. I want a todo app that is so minimal, so unobtrusive that it's barely there. If I find the todo app enjoyable, I'm spending too much time in it instead of doing the task.

Taskwarrior

taskwarrior

Taskwarrior is a free, open source TUI that puts your TODO in the terminal and is as unobtrusive as to-do apps get.

It has built-in reporting features (task burndown.weekly), a tagging system (+meeting +report), a context switcher (task context office), project hierarchies (task project:Startup), a robust date system that blows anything, free or proprietary, out of the water, and a scriptable urgency formula for each task.

There are many other real-life examples of algorithms that are used to approximate qualities: the Apgar Score that assesses the health of newborns, Google's Page Rank that measures the importance of a web link, or credit ratings. These examples all approximate, but cannot perfectly represent, a complex concept.

Taskwarrior uses a polynomial expression to calculate urgency. This is a simple sum of terms, where each term represents some measurable quality of a task.

Custom Attributes

The best part of Taskwarrior is its support for user-defined attributes (UDA) beyond what it offers out of the box. No matter what productivity system (e.g GTD system) I choose, I can make it work the way I want to with a bit of customization.

One theme of my productivity system over the past many years is a way to quantitatively measure my productivity with a score attribute. Different apps may come and go, but to make it work for me, I need the score attribute as it's integral to how I manage my periodic reviews and longer-term reflections. It also pushes me to work on large projects since they come with bigger rewards (at least psychologically).

How do I add that to Taskwarrior? Simple. Add the following lines to the end of your .taskrc file:



uda.score.type=numeric
uda.score.label=Score 🏆 
urgency.uda.score.coefficient=2


Enter fullscreen mode Exit fullscreen mode

Now all your task has an extra, optional score field (🏆)!
taskwarrior score

Productivity Scoresheet

One thing I often do in my periodic review is to collect data-points on my activities over the last period. This includes data from my work machines, my Mi Band, and Apple Health.

For example, I know how many hours and minutes I've spent on one specific app, or task, over the last calendar year.

timing app

For Taskwarrior, all that is left to do is to roll out a Python app that I can install and run. This package weighs less than 8kb (which is really nothing) and is available on PyPI. It installs under one second:



pip install taskquant


Enter fullscreen mode Exit fullscreen mode

After which you can issue tq to get a productivity breakdown. Add the -w flag to have it grouped by week, in a rolling sum fashion:



tq -w 
+-------+-------+------------+
| Week# | Score | Cumulative |
+-------+-------+------------+
|  10   |  56   |     56     |
|  11   |  33   |     89     |
|  12   |  26   |    115     |
|  13   |  12   |    127     |
+-------+-------+------------+


Enter fullscreen mode Exit fullscreen mode

taskquant

If you want to hack away at your productivity system, the project is available on my GitHub:

Bonus: Watch the whole process in action

I thought it'd be interesting to show how I build out the CLI tool so I've uploaded a recording of that on YouTube as well. If you're a data analyst from the pandas world, you may learn a thing or two about:

  • group by
  • aggregation
  • filling missing dates (padding)
  • tabular summary
  • colorful CLI
    All without any dependencies except tasklib (the Taskwarrior libary itself). This brings the package down to 6.8kb of code, and with its 1 second installation time, is similarly unobtrusive. Gets you your productivity scores, and get out of the way. If you'd like to watch it, here are the links:

  • Building Taskquant ep.1

  • Building Taskquant, full playlist

What's next

We'll add terminal-based graphs and charts, and maybe more variety in terms of reporting format. No, there can never be too many ways to see how you're not doing enough. If you want to follow along the journey, drop by and 👋 on YouTube.

If you're feeling more driven than that, go ahead and install Taskwarrior and Taskquant and start knocking out some to-do! Collaborators welcomed!

Top comments (0)