#+TITLE: Atomic Notes (Zettelkasten) & GTD Automation Setup Guide #+STARTUP: content #+DATE: 2026-03-17 * Overview This system uses a hybrid approach to Personal Knowledge Management (PKM). It leverages Emacs Org-mode for low-friction, structured capture into daily logs, and an OpenClaw AI Sub-Agent ("The Scribe") to nightly distill these raw thoughts into an evergreen, atomic Atomic Notes (Zettelkasten). * 1. Environment Configuration (`.env`) To ensure Emacs, OpenClaw, and the Scribe Agent all agree on where files live, we use a single `.env` file at the root of the workspace. ** Action: Ensure the following `.env` file exists in your workspace root: #+BEGIN_SRC env MEMEX_DIR="memex" MEMEX_INBOX="memex/inbox.org" MEMEX_DAILY="memex/1_daily" MEMEX_NOTES="memex/2_notes" MEMEX_DRAFTS="memex/3_drafts" MEMEX_PUBLISHED="memex/4_published" MEMEX_PROJECTS="memex/5_projects" MEMEX_AREAS="memex/6_areas" MEMEX_RESOURCES="memex/7_resources" MEMEX_ARCHIVES="memex/8_archives" MEMEX_SYSTEM="memex/9_system" MEMEX_ATTACHMENTS="memex/attachments" #+END_SRC * 2. Emacs Org-Capture Setup All captures route to the current day's log (`$MEMEX_DAILY/YYYY-MM-DD.org`), preserving the raw chronological context. ** Action: Add this Emacs Lisp snippet to your `init.el` or `config.el` to set up your capture templates dynamically using the `.env` variables: #+BEGIN_SRC elisp (setq org-capture-templates '(("z" "Atomic Notes (Zettelkasten) (Captures to Daily)") ("zf" "Fleeting Note" entry (file+olp+datetree (expand-file-name (format "%s/%%<%%Y-%%m-%%d>.org" (getenv "MEMEX_DAILY")))) "* Fleeting Note: %?\n :PROPERTIES:\n :ID: %u\n :CREATED: %U\n :END:\n\n %i") ("zl" "Draft Literature Note" entry (file+olp+datetree (expand-file-name (format "%s/%%<%%Y-%%m-%%d>.org" (getenv "MEMEX_DAILY")))) "* Literature Note: %?\n :PROPERTIES:\n :ID: %u\n :CREATED: %U\n :AUTHOR: \n :SOURCE: \n :END:\n\n *Summary:*\n %?\n\n *Key Insights:*\n - ") ("zp" "Draft Permanent Note" entry (file+olp+datetree (expand-file-name (format "%s/%%<%%Y-%%m-%%d>.org" (getenv "MEMEX_DAILY")))) "* Permanent Note: %?\n :PROPERTIES:\n :ID: %u\n :CREATED: %U\n :LINKS: \n :END:\n\n *Concept:*\n %?\n\n *References:*\n - ") ("t" "GTD - Task / Inbox" entry (file (getenv "MEMEX_INBOX")) "* TODO %?\n :PROPERTIES:\n :CREATED: %U\n :END:\n\n %i\n %a"))) #+END_SRC * 3. The Distillation State Tracker The Scribe Agent uses a JSON file to remember the last Git commit it processed, preventing it from distilling the same notes twice or modifying the daily logs directly. ** Action: Ensure `memex/9_system/distillation-state.json` exists. It should look like this (the hash will update automatically): #+BEGIN_SRC json { "lastProcessedCommit": "HEAD_HASH_GOES_HERE" } #+END_SRC * 4. OpenClaw Cron Job (The Scribe Agent) The final piece is the scheduled automation. We create a cron job in OpenClaw that runs every night, reads the diffs, and creates atomic notes. ** Action: Ask the OpenClaw orchestrator (your AI assistant) to schedule the Scribe Agent using the `cron` tool. The prompt it will execute is defined in `$MEMEX_SYSTEM/skills/Scribe-Agent.org`. ** Architecture Rule: - *Dailies are Immutable:* The Scribe reads `$MEMEX_DAILY/` but NEVER writes to it. - *Evergreen Notes:* The Scribe extracts concepts, generates descriptive snake_case filenames (no dates), and writes them to `$MEMEX_NOTES/` with a `Source:` backlink to the original daily file.