feat: Context Manager skill + org-object→memory-object fix
Some checks failed
Deploy (Gitea) / deploy (push) Has been cancelled

- system-context-manager (new skill): stack-based project focusing with
  push-context/pop-context, path resolution relative to base path, and
  scope-aware memory queries via context-scoped-query.
- core-memory: add :scope slot to memory-object struct (default :memex).
- core-memory: ingest-ast accepts &key (scope :memex), propagates to children.
- core-context: context-query accepts :scope parameter for filtering.
- DEFECT FIX: renamed org-object-* accessors to memory-object-*
  across core-context, security-dispatcher, tests, and defpackage exports.
  The struct was renamed but accessor references were never updated —
  the code referenced nonexistent functions.
This commit is contained in:
2026-05-03 12:08:04 -04:00
parent 22697baa2d
commit 529f8d0782
11 changed files with 417 additions and 119 deletions

View File

@@ -103,10 +103,11 @@ The universal data unit. Every stored entity — a note, a task, a project, a pe
- ~version~ — Unix timestamp of last modification
- ~last-sync~ — Unix timestamp of last sync to disk
- ~hash~ — SHA-256 Merkle hash for integrity verification
- ~scope~ — scope keyword (:memex/:session/:project) for context-aware retrieval
#+begin_src lisp
(defstruct memory-object
id type attributes content vector parent-id children version last-sync hash)
id type attributes content vector parent-id children version last-sync hash scope)
#+end_src
** Serialization Support
@@ -136,7 +137,8 @@ Without deep copy, a snapshot would share structure with the live memory — mut
:children (copy-list (memory-object-children obj))
:version (memory-object-version obj)
:last-sync (memory-object-last-sync obj)
:hash (memory-object-hash obj)))
:hash (memory-object-hash obj)
:scope (memory-object-scope obj)))
#+end_src
** Merkle Tree Integrity (memory-merkle-hash)
@@ -175,7 +177,7 @@ The primary entry point for adding data to memory. Given an Org-mode AST (a tree
Returns the ID of the root node.
#+begin_src lisp
(defun ingest-ast (ast &optional parent-id)
(defun ingest-ast (ast &key parent-id (scope :memex))
(let* ((type (getf ast :type))
(props (getf ast :properties))
(id (or (getf props :ID) (format nil "temp-~a" (get-universal-time))))
@@ -185,7 +187,7 @@ Returns the ID of the root node.
(child-ids nil) (child-hashes nil))
(dolist (child contents)
(when (listp child)
(let ((child-id (ingest-ast child id)))
(let ((child-id (ingest-ast child :parent-id id :scope scope)))
(push child-id child-ids)
(let ((child-obj (gethash child-id *memory-store*)))
(when child-obj (push (memory-object-hash child-obj) child-hashes))))))
@@ -198,7 +200,7 @@ Returns the ID of the root node.
:id id :type type :attributes props :content raw-content
:parent-id parent-id :children child-ids
:version (get-universal-time) :last-sync (get-universal-time)
:hash hash))))
:hash hash :scope scope))))
(unless existing-obj (setf (gethash hash *memory-history*) obj))
(setf (gethash id *memory-store*) obj)
id)))