aboutsummaryrefslogtreecommitdiff
path: root/claude-templates/.ai/workflows/clean-todo.org
diff options
context:
space:
mode:
authorCraig Jennings <c@cjennings.net>2026-05-15 16:56:39 -0500
committerCraig Jennings <c@cjennings.net>2026-05-15 16:56:39 -0500
commitc1d4e3c4a42abd01bc7ef83b1d6ae036ee32ef1d (patch)
tree3e6dcc682cbf2311409e7f71d83a7d4088392068 /claude-templates/.ai/workflows/clean-todo.org
parent2b471da4bab014a2e096f63edc7aac235fc40fdd (diff)
parent69c5e4ace81586c05dea6a9a3afd54dafa61a73b (diff)
downloadrulesets-c1d4e3c4a42abd01bc7ef83b1d6ae036ee32ef1d.tar.gz
rulesets-c1d4e3c4a42abd01bc7ef83b1d6ae036ee32ef1d.zip
Merge commit '69c5e4ace81586c05dea6a9a3afd54dafa61a73b' as 'claude-templates'
Diffstat (limited to 'claude-templates/.ai/workflows/clean-todo.org')
-rw-r--r--claude-templates/.ai/workflows/clean-todo.org58
1 files changed, 58 insertions, 0 deletions
diff --git a/claude-templates/.ai/workflows/clean-todo.org b/claude-templates/.ai/workflows/clean-todo.org
new file mode 100644
index 0000000..dd33056
--- /dev/null
+++ b/claude-templates/.ai/workflows/clean-todo.org
@@ -0,0 +1,58 @@
+#+TITLE: Clean-Todo Workflow
+#+AUTHOR: Craig Jennings & Claude
+#+DATE: 2026-05-11
+
+* Overview
+
+On-demand cleanup of the project's =todo.org=: run the hygiene pass, then archive completed work, then report what changed. The wrap-up workflow already does both passes at session end; this workflow is the manual entry point — invoke it any time the todo file needs a tidy, without waiting for a wrap-up.
+
+* When to Use This Workflow
+
+When Craig says:
+- "clean up todo.org" / "clean-todo" / "tidy the todo file"
+- "archive the done items in todo.org"
+- "run the todo cleanup"
+
+Requires a =todo.org= at the project root. If there isn't one, say so and stop.
+
+* The Workflow
+
+** Step 1: Hygiene pass
+
+#+begin_src bash
+emacs --batch -q -l .ai/scripts/todo-cleanup.el todo.org
+#+end_src
+
+Deletes bogus =- State "X" from "X" [date]= log lines (state didn't actually change — these wedge between the heading and =DEADLINE:=/=SCHEDULED:= and break agenda parsing) and reports "orphan planning lines" (a body =DEADLINE:=/=SCHEDULED:= that =org-entry-get= can't read because it's out of canonical position — not auto-rewritten; surface for manual fix). Fast and idempotent. Capture the output.
+
+To preview without writing, run =--check= first: =emacs --batch -q -l .ai/scripts/todo-cleanup.el --check todo.org=.
+
+** Step 2: Archive completed work
+
+#+begin_src bash
+emacs --batch -q -l .ai/scripts/todo-cleanup.el --archive-done todo.org
+#+end_src
+
+Moves every level-2 subtree whose TODO state is DONE or CANCELLED out of the "Open Work" section into the "Resolved" section, subtree intact. The two sections are matched by a unique level-1 heading containing "Open Work" (case-insensitive) and one containing "Resolved" — if either is missing or ambiguous, the file is skipped with a message, no crash. Only direct level-2 children move; a DONE entry nested under an open parent stays put. Idempotent. Capture the output.
+
+To preview the moves without writing: =emacs --batch -q -l .ai/scripts/todo-cleanup.el --archive-done --check todo.org=.
+
+** Step 3: Summarize
+
+Report to Craig from the two captured outputs:
+- Hygiene: how many bogus state-log lines were deleted; any orphan-planning warnings (file:line + heading), or "none".
+- Archive: how many subtrees moved and which (heading + line), or "nothing to move" / the skip reason if a section was missing or ambiguous.
+- If the file changed, note that =todo.org= now has an uncommitted edit — review =git diff -- todo.org= and commit it (in this repo's commit style) if it looks right. If nothing changed, say so and stop.
+
+Don't auto-commit. The summary is the review point; Craig decides whether the diff goes in.
+
+* Principles
+
+- *Both passes apply, not just preview.* The workflow is invoked because cleanup is wanted. Use the =--check= variants only when Craig asks for a dry run.
+- *Two passes, two invocations.* =--archive-done= is its own mode and does not run the hygiene pass; run both.
+- *Never auto-commit todo.org.* Surface the diff and let Craig commit it. The cleanup is a working-tree change, fully reversible until committed.
+- *Trust the script.* It's fast and idempotent; if there's nothing to do, it reports zero and exits clean. No pre-checks.
+
+* Living Document
+
+Update this workflow if =todo-cleanup.el= grows new modes or the section-matching rules change.