#+TITLE: SKILL: Context Manager (Universal Literate Note) #+ID: skill-context-manager #+STARTUP: content #+FILETAGS: :context:system:psf: * Overview The *Context Manager* handles the cognitive stack of the agent, allowing for switching between different projects, areas, and tasks while maintaining a clean environment. * Phase A: Demand (PRD) :PROPERTIES: :STATUS: FROZEN :END: ** 1. Purpose Manage a stack-based context system for the agent. ** 2. User Needs - *Push/Pop:* Ability to enter and exit specific project contexts. - *Path Resolution:* Resolve relative paths based on the current context. * Phase B: Blueprint (PROTOCOL) :PROPERTIES: :STATUS: SIGNED :END: ** 1. Architectural Intent Stack-based context management. ** 2. Semantic Interfaces #+begin_src lisp (defun context-push (new-context) "Push a new context onto the stack.") (defun context-pop () "Pop the current context.") (defun context-resolve-path (path) "Resolve a path based on current context.") #+end_src * Phase D: Build (Implementation) #+begin_src lisp :tangle ../projects/org-skill-context-manager/src/context-manager.lisp (defvar *context-stack* nil) (defun context-push (new-context) "Push a new context (usually a path or a plist) onto the stack." (push new-context *context-stack*) (kernel-log "CONTEXT - Pushed: ~a" new-context)) (defun context-pop () "Pop the top context from the stack." (let ((old (pop *context-stack*))) (kernel-log "CONTEXT - Popped: ~a" old) old)) (defun context-resolve-path (path) "Resolve PATH relative to the current context if it's a directory, otherwise return as is." (let ((current (car *context-stack*))) (if (and current (stringp current) (uiop:directory-pathname-p current)) (merge-pathnames path current) path))) #+end_src * Registration #+begin_src lisp (defskill :skill-context-manager :priority 80 :trigger (lambda (context) nil) :neuro (lambda (context) nil) :symbolic (lambda (action context) action)) #+end_src