PSF: Stabilizing workspace after crash. Valid kernel/skill fixes.

This commit is contained in:
2026-04-04 20:27:39 -04:00
parent 65a14784d3
commit 7ac10d1f95
47 changed files with 25388 additions and 3235 deletions

View File

@@ -0,0 +1,64 @@
#+TITLE: SKILL: Log Aggregator (Universal Literate Note)
#+ID: skill-log-aggregator
#+STARTUP: content
#+FILETAGS: :logging:observability:system:psf:
* Overview
The *Log Aggregator* monitors and summarizes system logs to provide insights into agent behavior and system health.
* Phase A: Demand (PRD)
:PROPERTIES:
:STATUS: FROZEN
:END:
** 1. Purpose
Collect and summarize agent logs.
** 2. User Needs
- *Scan:* Retrieve logs from the system.
- *Summarize:* Provide a high-level summary of recent activities.
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Observability and log analysis system.
** 2. Semantic Interfaces
#+begin_src lisp
(defun log-scan (&optional (lines 100)) "Scan the last N lines of the log.")
(defun log-summarize (logs) "Neural or symbolic summary of LOGS.")
#+end_src
* Phase D: Build (Implementation)
#+begin_src lisp :tangle ../projects/org-skill-log-aggregator/src/log-aggregator.lisp
(defun log-scan (&optional (lines 100))
"Reads the last LINES lines of the system log file."
(let ((log-file (merge-pathnames "logs/agent.log" (uiop:getenv "SYSTEM_DIR"))))
(if (uiop:file-exists-p log-file)
(uiop:run-program `("tail" "-n" ,(write-to-string lines) ,(namestring log-file)) :output :string)
"Log file not found.")))
(defun log-summarize (logs)
"Symbolic summary of LOGS focusing on errors and warnings."
(let ((lines (uiop:split-string logs :separator '(#\Newline)))
(errors 0)
(warnings 0))
(dolist (line lines)
(cond
((cl-ppcre:scan "ERROR" line) (incf errors))
((cl-ppcre:scan "WARN" line) (incf warnings))))
(format nil "Log Summary: ~a errors, ~a warnings found in scan." errors warnings)))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-log-aggregator
:priority 30
:trigger (lambda (context) nil)
:neuro (lambda (context) nil)
:symbolic (lambda (action context) action))
#+end_src