Files
luk/TASK_SWEEPER.md
2025-08-20 08:30:54 -04:00

4.7 KiB

Task Sweeper for Godspeed

A utility script to consolidate scattered incomplete tasks from markdown files into your Godspeed Inbox.

Purpose

If you have notes scattered across directories (like 2024/, 2025/, project folders, etc.) with incomplete tasks in markdown format, this script will:

  1. Find all incomplete tasks (- [ ] Task name) in markdown files
  2. Move them to your Godspeed Inbox.md file
  3. Preserve completed/cancelled tasks in their original locations
  4. Add source tracking so you know where each task came from
  5. Clean up original files by removing only the incomplete tasks

Usage

# Dry run to see what would happen
python sweep_tasks.py ~/Documents/Notes ~/Documents/Godspeed --dry-run

# Actually perform the sweep
python sweep_tasks.py ~/Documents/Notes ~/Documents/Godspeed

# Sweep from current directory
python sweep_tasks.py . ./godspeed

Example Workflow

Before sweeping:

~/Documents/Notes/
├── 2024/
│   ├── projects/website.md
│   │   ├── - [x] Create wireframes 
│   │   ├── - [ ] Design mockups      ← Will be swept
│   │   └── - [ ] Get approval        ← Will be swept
│   └── notes/meeting.md
│       ├── - [ ] Update docs         ← Will be swept
│       └── - [x] Fix bug (completed)
├── 2025/
│   └── goals.md
│       └── - [ ] Launch feature      ← Will be swept
└── random-notes.md
    └── - [ ] Call dentist            ← Will be swept

After sweeping:

~/Documents/Godspeed/
└── Inbox.md                          ← All incomplete tasks here
    ├── - [ ] Design mockups
    │   From: 2024/projects/website.md
    ├── - [ ] Get approval  
    │   From: 2024/projects/website.md
    ├── - [ ] Update docs
    │   From: 2024/notes/meeting.md
    ├── - [ ] Launch feature
    │   From: 2025/goals.md
    └── - [ ] Call dentist
        From: random-notes.md

~/Documents/Notes/
├── 2024/
│   ├── projects/website.md           ← Only completed tasks remain
│   │   └── - [x] Create wireframes 
│   └── notes/meeting.md
│       └── - [x] Fix bug (completed)
├── 2025/
│   └── goals.md                      ← File cleaned/deleted if empty
└── random-notes.md                   ← File cleaned/deleted if empty

Features

  • Safe Operation: Always use --dry-run first to preview changes
  • Source Tracking: Each swept task includes a note about its origin
  • Selective Processing: Only moves incomplete tasks, preserves completed ones
  • Smart Cleanup: Removes empty files or keeps non-task content
  • Godspeed Integration: Creates properly formatted tasks with IDs for sync
  • Recursive Search: Finds markdown files in all subdirectories
  • Exclusion Logic: Skips the Godspeed directory itself and hidden files

Integration with Godspeed Sync

After sweeping tasks:

  1. Review the consolidated tasks in Inbox.md
  2. Upload to API: Run python -m src.cli godspeed upload
  3. Organize in Godspeed: Move tasks from Inbox to appropriate lists
  4. Sync back: Run python -m src.cli godspeed sync to get organized structure

Safety Features

  • Dry run mode shows exactly what will happen without making changes
  • Backup recommendation: The script modifies files, so backup your notes first
  • Preserve content: Non-task content (headings, notes, etc.) remains in original files
  • Completed task preservation: [x] and [-] tasks stay where they are
  • Error handling: Graceful handling of unreadable files or parsing errors

Example Output

🧹 Sweeping incomplete tasks from: /Users/you/Documents/Notes
📥 Target Inbox: /Users/you/Documents/Godspeed/Inbox.md
🔍 Dry run: False
============================================================

📁 Found 8 markdown files to process

📄 Processing: 2024/projects/website.md
    🔄 Found 2 incomplete tasks:
      • Design mockups
      • Get client approval
    ✅ Keeping 1 completed/cleared tasks in place
    ✂️  Cleaned file (removed tasks): 2024/projects/website.md

📥 Writing 6 tasks to Inbox...
    ✅ Inbox updated: /Users/you/Documents/Godspeed/Inbox.md

============================================================
📊 SWEEP SUMMARY:
   • Files processed: 3
   • Tasks swept: 6
   • Target: /Users/you/Documents/Godspeed/Inbox.md

🎉 Successfully swept 6 tasks!
💡 Next steps:
   1. Review tasks in: /Users/you/Documents/Godspeed/Inbox.md
   2. Run 'godspeed upload' to sync to API
   3. Organize tasks into appropriate lists in Godspeed app

This tool is perfect for periodic "note cleanup" sessions where you consolidate scattered tasks into your main GTD system.