aboutsummaryrefslogtreecommitdiff
path: root/claude-templates/.ai/scripts/lint-org.el
diff options
context:
space:
mode:
Diffstat (limited to 'claude-templates/.ai/scripts/lint-org.el')
-rw-r--r--claude-templates/.ai/scripts/lint-org.el49
1 files changed, 34 insertions, 15 deletions
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)