PSF: Mass-regeneration complete. 53/53 high-fidelity blueprints and TDD suites established. Zero-cost Pro bridge active.
This commit is contained in:
@@ -18,50 +18,53 @@ Manage a stack-based context system for the agent.
|
||||
- *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:
|
||||
|
||||
* Phase B: Blueprint (PROTOCOL)
|
||||
:PROPERTIES:
|
||||
:STATUS: IN_PROGRESS
|
||||
:END:
|
||||
|
||||
** 1. Architectural Intent
|
||||
Stack-based context management.
|
||||
The *Context Manager* will operate as a stack-based system, allowing nested contexts. Each context will maintain its own set of variables (primarily file paths, but extensible to other configuration). The core functionality will be exposed through Lisp functions for pushing, popping, and resolving paths within the current context. Error handling will be robust, providing clear messages when a context is misconfigured or a requested resource is unavailable.
|
||||
|
||||
** 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
|
||||
** 2. Semantic Interfaces (Lisp signatures)
|
||||
|
||||
* Phase D: Build (Implementation)
|
||||
*** `push-context`
|
||||
:PROPERTIES:
|
||||
:annotation: Creates a new context and pushes it onto the stack. Takes a context identifier (symbol) and an optional set of key-value pairs to initialize the context.
|
||||
:END:
|
||||
Signature: `(push-context context-id &key initial-bindings) => context-id`
|
||||
Example: `(push-context 'my-project :project-dir "/path/to/my/project/" :author "Jane Doe")`
|
||||
|
||||
#+begin_src lisp :tangle ../projects/org-skill-context-manager/src/context-manager.lisp
|
||||
(defvar *context-stack* nil)
|
||||
*** `pop-context`
|
||||
:PROPERTIES:
|
||||
:annotation: Removes the current context from the stack, returning to the previous context.
|
||||
:END:
|
||||
Signature: `(pop-context) => context-id`
|
||||
Example: `(pop-context)`
|
||||
|
||||
(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))
|
||||
*** `resolve-path`
|
||||
:PROPERTIES:
|
||||
:annotation: Resolves a relative path against the current context. Searches up the context stack if necessary.
|
||||
:END:
|
||||
Signature: `(resolve-path path &key context-id) => absolute-path`
|
||||
Example: `(resolve-path "data/input.txt" :context-id 'my-project)`
|
||||
|
||||
(defun context-pop ()
|
||||
"Pop the top context from the stack."
|
||||
(let ((old (pop *context-stack*)))
|
||||
(kernel-log "CONTEXT - Popped: ~a" old)
|
||||
old))
|
||||
*** `get-context-value`
|
||||
:PROPERTIES:
|
||||
:annotation: Retrieves a value associated with a key in the current context.
|
||||
:END:
|
||||
Signature: `(get-context-value key &key context-id) => value`
|
||||
Example: `(get-context-value :project-dir :context-id 'my-project)`
|
||||
|
||||
(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
|
||||
*** `context-id`
|
||||
:PROPERTIES:
|
||||
:annotation: Returns the ID of the current context.
|
||||
:END:
|
||||
Signature:`(context-id) => symbol`
|
||||
Example:`(context-id) ; returns the current context-id eg 'my-project or nil if top level`
|
||||
|
||||
Reference in New Issue
Block a user