From fc1a519e6891769733f593b4fd4286bfa00e5cb7 Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Wed, 5 Aug 2026 17:49:17 -0500 Subject: fix(lint-org): stop flagging session anchors with todo.org conventions The todo-format checkers encode todo.org's completion rules, so they misfired on a session anchor. A Session Log's dated level-2 headings are the documented correct form, and every one came back as a defect telling the author to convert it to DONE plus CLOSED. One 427-line anchor produced six. lo--spec-file-p becomes lo--todo-format-exempt-p. It now covers the live anchor, the per-agent anchors, and the archives alongside docs/specs/. The archives belong there because wrap-up renames the anchor unchanged, so it keeps the same shape later in its life. All five checkers in the family fire on an anchor, not only the dated-header one. Link, table and structural checks still run. --- claude-templates/.ai/scripts/lint-org.el | 49 ++++++++++++++++++++++---------- 1 file changed, 34 insertions(+), 15 deletions(-) (limited to 'claude-templates/.ai/scripts/lint-org.el') diff --git a/claude-templates/.ai/scripts/lint-org.el b/claude-templates/.ai/scripts/lint-org.el index 33dc52f..fe4c31f 100644 --- a/claude-templates/.ai/scripts/lint-org.el +++ b/claude-templates/.ai/scripts/lint-org.el @@ -77,17 +77,36 @@ The CLI defaults this to t (a linter reports, it doesn't write); (defvar lo-current-file nil "Path of the file currently being processed.") -(defun lo--spec-file-p () - "Non-nil when the current file lives under a docs/specs/ directory. -The four todo-format-family checkers encode todo.org completion conventions -and misfire on a spec: a spec's Decisions section legitimately carries a -level-2 DONE with no CLOSED cookie, and its review-history section carries -level-2 dated headings. docs/specs/ is the canonical spec home per the -docs-lifecycle rule, so a path segment match is the scope test. Link, -table, and structural checks still run on specs — only the todo-format -family is scoped out." +(defun lo--todo-format-exempt-p () + "Non-nil when the current file's conventions are not todo.org's. +The five todo-format-family checkers encode todo.org completion conventions, +so they misfire wherever a file legitimately uses those shapes for something +else. Two such places, both matched by canonical path: + + docs/specs/ A spec's Decisions section carries a level-2 DONE + with no CLOSED cookie, and its review-history + section carries level-2 dated headings. The + canonical spec home per the docs-lifecycle rule. + + .ai/session-context.org A session anchor carries level-2 dated headings by + .ai/session-context.d/ instruction: protocols.org prescribes `** Topic' + .ai/sessions/ Session Log headers at natural seams with optional + timestamps. So every log entry reads as a + completion defect telling the author to convert it + to DONE + CLOSED:, which would be wrong. All three + paths are the same file at different points in its + life — live, per-agent under AI_AGENT_ID, and the + archive wrap-up renames it into. + +The exemption is these paths, not all of .ai/: notes.org lives there and does +follow todo.org's conventions. Link, table, and structural checks still run on +everything — only the todo-format family is scoped out." (and lo-current-file - (string-match-p "/docs/specs/" (expand-file-name lo-current-file)))) + (let ((f (expand-file-name lo-current-file))) + (or (string-match-p "/docs/specs/" f) + (string-match-p "/\\.ai/session-context\\.org\\'" f) + (string-match-p "/\\.ai/session-context\\.d/" f) + (string-match-p "/\\.ai/sessions/" f))))) (defvar lo-followups-file nil "When non-nil, after a non-check run any judgment items are appended to this path as an org section dated today. The file is created if missing.") @@ -728,11 +747,11 @@ left unmodified and mechanical entries are recorded with :preview t." (lo--check-empty-headings) (lo--check-malformed-priority-cookies) ;; The todo-format family encodes todo.org completion conventions and - ;; misfires on a spec (a Decisions section's undated DONE, a - ;; review-history dated heading, a phases task with no LAST_REVIEWED). - ;; Scope them out of docs/specs/; link, table, and structural checks - ;; above still run there. - (unless (lo--spec-file-p) + ;; misfires wherever those shapes mean something else — a spec's + ;; undated DONE and review-history dated heading, a session anchor's + ;; dated Session Log entries. `lo--todo-format-exempt-p' owns the + ;; list; link, table, and structural checks above still run there. + (unless (lo--todo-format-exempt-p) (lo--check-level2-dated-headers) (lo--check-level2-done-without-closed) (lo--check-task-missing-last-reviewed) -- cgit v1.2.3