65 lines
2.3 KiB
Org Mode
65 lines
2.3 KiB
Org Mode
#+TITLE - Atomic Notes (Zettelkasten) Retrieval Skill (Sparse Tree)
|
|
#+AUTHOR - org-agent
|
|
#+SKILL_NAME - skill-atomic-notes
|
|
|
|
This skill provides Deep Memory by performing sparse tree perception over ripgrep results. It reduces token waste by pruning irrelevant parts of the AST.
|
|
|
|
* Trigger
|
|
#+begin_src lisp
|
|
(defun trigger-skill-atomic-notes (context)
|
|
(let ((type (getf context :type))
|
|
(payload (getf context :payload)))
|
|
(and (eq type :EVENT)
|
|
(eq (getf payload :sensor) :delegation)
|
|
(eq (getf payload :target-skill) :atomic-notes))))
|
|
#+end_src
|
|
|
|
* Neuro Prompt
|
|
System 1 synthesizes an answer from a pruned, highly relevant Sparse AST.
|
|
|
|
#+begin_src lisp
|
|
(defun neuro-skill-atomic-notes (context)
|
|
(let* ((query (getf (getf context :payload) :query))
|
|
(memex-dir (org-agent::get-env "MEMEX_DIR" "/app/memex"))
|
|
;; Search for files containing the query
|
|
(rg-cmd (format nil "rg -i -l '~a' ~a" query memex-dir))
|
|
(files (ignore-errors
|
|
(uiop:split-string
|
|
(uiop:run-program rg-cmd :output :string :ignore-error-status t)
|
|
:separator '(#\Newline)))))
|
|
|
|
;; For the first 3 relevant files, build a Sparse Tree
|
|
(let ((sparse-trees nil))
|
|
(dolist (file (subseq files 0 (min 3 (length files))))
|
|
(when (and file (> (length file) 0))
|
|
;; In a real Phase 3, we would look up the AST from the store.
|
|
;; For this prototype, we'll note the file being indexed.
|
|
(push (format nil "FILE - ~a" file) sparse-trees)))
|
|
|
|
(format nil "
|
|
You are the Atomic Notes (Zettelkasten) Memory synthesizer.
|
|
The user asked - '~a'
|
|
|
|
SPARSE PERCEPTION (Relevant Files) -
|
|
~a
|
|
|
|
Synthesize an answer. If you need more detail from a specific file,
|
|
ask the user to 'Focus' on that file.
|
|
Return a Lisp plist - (:target :emacs :action :message :text \"your answer\")
|
|
" query sparse-trees))))
|
|
#+end_src
|
|
|
|
* Symbolic Verification
|
|
#+begin_src lisp
|
|
(defun verify-skill-atomic-notes (proposed-action context)
|
|
proposed-action)
|
|
#+end_src
|
|
|
|
* Registration
|
|
#+begin_src lisp
|
|
(defskill :skill-atomic-notes
|
|
:priority 80
|
|
:trigger #'trigger-skill-atomic-notes
|
|
:neuro #'neuro-skill-atomic-notes
|
|
:symbolic #'verify-skill-atomic-notes)
|
|
#+end_src |