71 lines
2.6 KiB
Org Mode
71 lines
2.6 KiB
Org Mode
#+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:
|
|
|
|
* Phase B: Blueprint (PROTOCOL)
|
|
:PROPERTIES:
|
|
:STATUS: IN_PROGRESS
|
|
:END:
|
|
|
|
** 1. Architectural Intent
|
|
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 (Lisp signatures)
|
|
|
|
*** `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")`
|
|
|
|
*** `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)`
|
|
|
|
*** `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)`
|
|
|
|
*** `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)`
|
|
|
|
*** `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`
|