fix(v0.2.0): finalize structural integrity and clean boot
Some checks failed
Deploy-Agent-V15-Stdin / JOB-V15-STDIN (push) Failing after 2s

- Fixed memory.org source blocks to ensure persistence functions are tangled.
- Improved extract-tangle-target to handle complex Elisp expressions.
- Corrected opencortex.sh initialization paths to prevent setup loops.
- Reordered variable definitions in policy and standards skills to eliminate forward-reference warnings.
This commit is contained in:
2026-04-27 18:54:18 -04:00
parent 75b7d5e710
commit 2e8e79a193
31 changed files with 390 additions and 459 deletions

View File

@@ -1,3 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+TITLE: The Metabolic Loop (loop.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:loop:
@@ -67,7 +68,7 @@ The loop operates in a multi-threaded environment:
* Package and Thread-Safe Variables
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(in-package :opencortex)
(defvar *interrupt-flag* nil
@@ -90,7 +91,7 @@ This function implements the Perceive-Reason-Act pipeline. It processes a signal
The depth counter prevents infinite recursion—a signal that generates another signal that generates another, etc. By limiting to depth 10, we ensure the system eventually converges or gracefully terminates.
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(defun process-signal (signal)
"The entry point to the Metabolic Pipeline: Perceive -> Reason -> Act.
@@ -184,7 +185,7 @@ The heartbeat thread ensures the agent remains alive even without external input
** Heartbeat Configuration Variables
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(defvar *auto-save-interval* 300
"Interval in seconds between automatic memory saves.
Defaults to 300 seconds (5 minutes). Set via MEMORY_AUTO_SAVE_INTERVAL env var.")
@@ -195,7 +196,7 @@ The heartbeat thread ensures the agent remains alive even without external input
** start-heartbeat: The Pulsing Heart
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(defun start-heartbeat ()
"Starts the background heartbeat thread.
@@ -241,7 +242,7 @@ The heartbeat thread ensures the agent remains alive even without external input
** Shutdown Configuration
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(defvar *shutdown-save-enabled* t
"When T, save memory to disk on graceful shutdown.
Disable for testing or when memory persistence is handled externally.")
@@ -258,7 +259,7 @@ The main function orchestrates system startup:
5. Register SIGINT handler for graceful Ctrl+C shutdown
6. Enter idle loop (sleeping in 1-hour increments)
#+begin_src lisp :tangle (expand-file-name "loop.lisp" (concat (or (getenv "INSTALL_DIR") ".") "/harness"))
#+begin_src lisp
(defun main ()
"Entry point for OpenCortex. Initializes the system and enters idle loop.