Skip to content

FAF: Automating my GTD Workflow with Langchain and GPT-4

Published: at 03:57 PM

GTD is great. I have been using it for over ten years now, and I can’t imagine juggling all my responsibilities without it. It helps me stay focused on my priorities while maintaining progress on multiple projects that I need to keep track of. One of the key elements of GTD is the capture process. It allows you to offload any mental burden, thoughts, or tasks from your mind to somewhere else - a notebook, a file, a to-do list, anything - and resume your main activity without interruption.

I have a simple GTD workflow that allows me to easily capture any thought and send it to my main email inbox so that I can decide what to do with it later. It works like this:

This process has worked for me for years. I can send myself simple TODOs, notes, URLs or even more sophisticated follow-ups like “Send myself a reminder about the library book, in a month from now”. I then need to process these new emails and decide what to do with them. Some will stay in my inbox as short-term reminders, some will be added to Logseq which I use as my second brain, and some may be converted to long-term follow-ups using Follow Up Then. This final step was, regrettably, a manual process. But not anymore.

Man with priorities

Recently, I decided to take myself out of this loop and automate the manual processing. I created a simple CLI tool named Fire and Forget or FAF that captures any text input and repackages it into structured JSON files for subsequent processing. The conversion is conducted by a custom GPT4 agent built with Langchain. The agent discerns the types of input (currently: self note, follow up, URL) based purely on the natural language input from the user. Here are a few examples:

All these transformed outputs are saved in a designated folder as separate JSON files for further processing. Currently, I store them in a Dropbox, and Autokey takes care of that:

import os
import time
import subprocess

winTitle = window.get_active_title()
ret, user_input = dialog.input_dialog(title="Task", message="Capture task:")

if not ret:
    window.activate(winTitle)
    time.sleep(0.1)

    os.environ['OPENAI_API_KEY'] = "<API_KEY>"
    os.environ['FAF_JSON_OUTPUT_PATH'] = "/home/michal/Dropbox/faf"

    faf_path = "<PATH_TO_FAF>"
    subprocess.run([faf_path, user_input], check=True)

Each time a new file is added to this folder, a Zap is triggered, which inserts a new row in a Google Sheets file storing all the events. These events are then processed using a custom Apps Script.

I have been using FAF for a few days and it works great. It took some tweaking to get the prompt right and it is probably not yet production-ready. But it does its job, and I am happy about it. I have effectively replaced my manual processing with GPT-4.