refactor: moved org-agent to its own repository as a submodule
This commit is contained in:
55
notes/skill-ast-normalization.org
Normal file
55
notes/skill-ast-normalization.org
Normal file
@@ -0,0 +1,55 @@
|
||||
#+TITLE - AST Normalization Skill
|
||||
#+AUTHOR - org-agent
|
||||
#+SKILL_NAME - skill-ast-normalization
|
||||
|
||||
This skill handles explicit user commands for AST refactoring, such as injecting missing IDs.
|
||||
|
||||
* Trigger
|
||||
Triggers when a user requests to organize a subtree.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun trigger-skill-ast-normalization (context)
|
||||
(let ((type (getf context :type))
|
||||
(payload (getf context :payload)))
|
||||
(and (eq type :EVENT)
|
||||
(eq (getf payload :sensor) :user-command)
|
||||
(eq (getf payload :command) :organize-subtree))))
|
||||
#+end_src
|
||||
|
||||
* Neuro Prompt
|
||||
System 1 is bypassed if there's a deterministic action to take, but we provide a prompt just in case.
|
||||
|
||||
#+begin_src lisp
|
||||
(defun neuro-skill-ast-normalization (context)
|
||||
(format nil "User requested subtree organization. Context - ~a. Suggest an Org-mode action. Provide concise, high-fidelity suggestions in Lisp plist format." context))
|
||||
#+end_src
|
||||
|
||||
* Symbolic Verification
|
||||
System 2 preempts System 1 if it finds a deterministic issue (like a missing ID).
|
||||
|
||||
#+begin_src lisp
|
||||
(defun verify-skill-ast-normalization (proposed-action context)
|
||||
(let* ((ast (getf (getf context :payload) :ast))
|
||||
(missing-id (find-headline-missing-id ast)))
|
||||
(if missing-id
|
||||
(progn
|
||||
(format t "System 2 - Missing ID detected, preempting System 1.~%")
|
||||
`(:type :REQUEST :id ,(get-universal-time)
|
||||
:target :emacs
|
||||
:payload (:action :refactor-subtree
|
||||
:target-id nil
|
||||
:properties (("ID" . ,(format nil "node-~a" (get-universal-time)))))))
|
||||
;; If no deterministic action, allow System 1's proposal to pass
|
||||
proposed-action)))
|
||||
#+end_src
|
||||
|
||||
* Registration
|
||||
Register the skill.
|
||||
|
||||
#+begin_src lisp
|
||||
(defskill :skill-ast-normalization
|
||||
:priority 100 ; High priority to preempt general skills
|
||||
:trigger #'trigger-skill-ast-normalization
|
||||
:neuro #'neuro-skill-ast-normalization
|
||||
:symbolic #'verify-skill-ast-normalization)
|
||||
#+end_src
|
||||
Reference in New Issue
Block a user