remediation: backfill v0.1.0/v0.2.0 gaps (P0+P1)

- vault: add vault-get-secret/vault-set-secret wrappers
- programming-org: implement org-modify (text search-replace) and org-ast-render (AST to Org text)
- programming-literate: implement literate-block-balance-check (paren validation) and literate-tangle-sync-check (org→lisp diff)
- system-self-improve: replace stubs with surgical text editing and error diagnosis; remove dead first defskill
- system-event-orchestrator: implement orchestrator-bootstrap (scan Org files for HOOK/CRON)
- system-archivist: implement Scribe distillation (daily logs→atomic notes) and Gardener link/orphan repair
- system-memory: implement memory-inspect with type/todo/orphan statistics
- core-skills, core-context: fix path relic (skills/ → lisp/, org/)
- docs: add Token Economics section to DESIGN_DECISIONS, remediation roadmap entries
This commit is contained in:
2026-05-03 10:43:14 -04:00
parent 299f72c2bb
commit 5a0d1b1c38
22 changed files with 1686 additions and 122 deletions

View File

@@ -142,16 +142,63 @@ Returns the filtered content as a string."
(when found (return-from org-headline-find-by-title found)))))
nil))
(defun org-modify (filepath id changes)
"Placeholder for Emacs-driven modification of a specific node."
(declare (ignore changes))
(log-message "UTILS-ORG: Applying changes to ~a in ~a" id filepath)
t)
(defun org-modify (filepath old-text new-text)
"Replaces all occurrences of OLD-TEXT with NEW-TEXT in filepath.
Returns T if OLD-TEXT was found and replaced, nil if not found."
(when (not (uiop:file-exists-p filepath))
(log-message "UTILS-ORG: org-modify: file not found: ~a" filepath)
(return-from org-modify nil))
(let* ((content (uiop:read-file-string filepath))
(pos (search old-text content :test #'string=)))
(unless pos
(log-message "UTILS-ORG: org-modify: text not found in ~a" filepath)
(return-from org-modify nil))
(let ((modified (cl-ppcre:regex-replace-all
(cl-ppcre:quote-meta-chars old-text)
content new-text)))
(org-write-file filepath modified)
(log-message "UTILS-ORG: Modified ~a (~d chars replaced)" filepath (length old-text))
t)))
(defun org-ast-render (ast)
"Minimal converter from AST back to Org text (Placeholder)."
(declare (ignore ast))
"* TITLE (Placeholder)")
(defun org-ast-render (ast &key (depth 1))
"Converts a plist AST node back to Org text.
AST format: (:TYPE :HEADLINE :properties (:ID ... :TITLE ... :TAGS (...))
:contents (child-ast ...))"
(let* ((type (getf ast :TYPE))
(props (getf ast :properties))
(title (or (getf props :TITLE) "Untitled"))
(tags (getf props :TAGS))
(todo (getf props :TODO-STATE))
(children (getf ast :contents))
(raw-content (getf ast :raw-content))
(stars (make-string depth :initial-element #\*))
(output ""))
(unless (eq type :HEADLINE)
(return-from org-ast-render (or raw-content "")))
;; Headline
(setf output (format nil "~a~@[ ~a~] ~a" stars todo title))
(when tags
(let ((tag-str (format nil "~{~a~^:~}" (mapcar (lambda (t) (string-trim '(#\:) t)) tags))))
(setf output (concatenate 'string output (format nil " :~a::~%" tag-str))))
(setf output (concatenate 'string output (string #\Newline))))
(unless tags
(setf output (concatenate 'string output (string #\Newline))))
;; Property drawer
(setf output (concatenate 'string output ":PROPERTIES:" (string #\Newline)))
(loop for (k v) on props by #'cddr
do (unless (or (eq k :TITLE) (eq k :TAGS))
(setf output (concatenate 'string output
(format nil ":~a: ~a~%" k v)))))
(setf output (concatenate 'string output ":END:" (string #\Newline)))
;; Content
(when raw-content
(setf output (concatenate 'string output raw-content (string #\Newline))))
;; Children
(dolist (child children)
(when (listp child)
(setf output (concatenate 'string output
(org-ast-render child :depth (1+ depth))))))
output))
(defskill :passepartout-programming-org
:priority 100