fix(chaos): force absolute tangle paths via concat to eliminate path resolution ambiguity

This commit is contained in:
2026-04-28 17:57:31 -04:00
parent b7f6eb68e9
commit d787981d0d
35 changed files with 164 additions and 164 deletions

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "act.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/act.lisp" (expand-file-name ""))
#+TITLE: Stage 3: Act (act.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:act:
@@ -393,7 +393,7 @@ Example feedback chain:
These tests verify the Act pipeline. Run with:
~(fiveam:run! 'pipeline-act-suite)~
#+begin_src lisp :tangle (expand-file-name "pipeline-act-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "pipeline-act-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-pipeline-act-tests
(:use :cl :fiveam :opencortex)
(:export #:pipeline-act-suite))

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "communication.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/communication.lisp" (expand-file-name ""))
#+TITLE: Communication Protocol (communication.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:protocol:
@@ -79,7 +79,7 @@ The ~communication.lisp~ module defines the low-level transport and framing logi
** Structural Validation (communication-validator.lisp)
The validator ensures that incoming messages adhere to the strict property list schema of the communication protocol.
#+begin_src lisp :tangle (expand-file-name "communication-validator.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/communication-validator.lisp" (expand-file-name ""))
(in-package :opencortex)
(defun validate-communication-protocol-schema (msg)
@@ -154,7 +154,7 @@ Frames a message with a hex length prefix and ensures all data is serializable.
These tests verify the communication protocol functions. Run with:
~(fiveam:run! 'communication-protocol-suite)~
#+begin_src lisp :tangle (expand-file-name "communication-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "communication-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-communication-tests
(:use :cl :fiveam :opencortex)
(:export #:communication-protocol-suite))

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "context.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/context.lisp" (expand-file-name ""))
#+TITLE: Peripheral Vision (context.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:context:
@@ -217,7 +217,7 @@ The primary entry point for context generation. This function identifies active
Following the Engineering Standards, the peripheral vision extraction and rendering logic must be empirically verified.
** Test Suite Context
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-peripheral-vision-tests
(:use :cl :fiveam :opencortex)
(:export #:vision-suite))
@@ -231,7 +231,7 @@ Following the Engineering Standards, the peripheral vision extraction and render
** Foveal Rendering Test
Verify that the foveal target is rendered with content, while siblings are skeletal.
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(test test-foveal-rendering
"Verify that the foveal target is rendered with content, while siblings are skeletal."
(clrhash opencortex::*memory*)
@@ -251,7 +251,7 @@ Verify that the foveal target is rendered with content, while siblings are skele
** Awareness Budget Test
Verify that context-assemble-global-awareness handles multiple projects correctly.
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "peripheral-vision-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(test test-awareness-budget
"Verify that context-assemble-global-awareness handles multiple projects."
(clrhash opencortex::*memory*)

View File

@@ -23,26 +23,26 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
* Phase B: Protocol (Success Criteria)
** Package Context
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-doctor-tests
(:use :cl :fiveam :opencortex)
(:export #:doctor-suite))
#+end_src
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(in-package :opencortex-doctor-tests)
#+end_src
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(def-suite doctor-suite :description "Verification of the System Doctor diagnostic logic")
#+end_src
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(in-suite doctor-suite)
#+end_src
** Dependency Tests
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(test test-dependency-check-fail
"Verify that missing binaries are correctly identified as failures."
(let ((opencortex::*doctor-required-binaries* '("non-existent-binary-123")))
@@ -50,7 +50,7 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
#+end_src
** Environment Tests
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "doctor-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(test test-env-validation-fail
"Verify that an invalid MEMEX_DIR triggers a critical failure."
(let ((old-m (uiop:getenv "MEMEX_DIR"))
@@ -66,18 +66,18 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
* Phase C: Implementation (Build)
** Package Context
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(in-package :opencortex)
#+end_src
** Global Configuration
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defvar *doctor-required-binaries* '("sbcl" "emacs" "git" "socat" "nc")
"List of external binaries required for full system operation.")
#+end_src
** Dependency Verification
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defun doctor-check-dependencies ()
"Verifies that required external binaries are available in the PATH via a shell probe."
(let ((all-ok t))
@@ -95,7 +95,7 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
#+end_src
** Environment & XDG Validation
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defun doctor-check-env ()
"Validates XDG directories and environment configuration against the POSIX standard."
(harness-log "DOCTOR: Checking XDG environment...")
@@ -124,7 +124,7 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
#+end_src
** LLM Connectivity
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defun doctor-check-llm ()
"Tests connectivity to primary LLM providers. Non-critical fallback allowed."
(harness-log "DOCTOR: Checking LLM connectivity...")
@@ -139,7 +139,7 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
#+end_src
** Orchestration
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defun doctor-run-all ()
"Executes the full diagnostic suite and returns T if system is healthy."
(harness-log "==================================================")
@@ -159,7 +159,7 @@ Common Lisp's `uiop:getenv` is strictly typed in SBCL. The Doctor must ensure th
#+end_src
** CLI Entry Point
#+begin_src lisp :tangle (expand-file-name "doctor.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/doctor.lisp" (expand-file-name ""))
(defun doctor-main ()
"Entry point for the 'doctor' CLI command."
(if (doctor-run-all)

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "loop.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/loop.lisp" (expand-file-name ""))
#+TITLE: The Metabolic Loop (loop.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:loop:
@@ -324,7 +324,7 @@ The main function orchestrates system startup:
These tests verify the metabolic loop and error recovery. Run with:
~(fiveam:run! 'immune-suite)~
#+begin_src lisp :tangle (expand-file-name "immune-system-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "immune-system-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-immune-system-tests
(:use :cl :fiveam :opencortex)
(:export #:immune-suite))

View File

@@ -9,7 +9,7 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
* Implementation
** Main System
#+begin_src lisp :tangle (expand-file-name "opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/opencortex.asd")
(defsystem :opencortex
:name "opencortex"
:author "Amr Gharbeia"
@@ -31,7 +31,7 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
#+end_src
** Test System
#+begin_src lisp :tangle (expand-file-name "opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/opencortex.asd")
(defsystem :opencortex/tests
:depends-on (:opencortex :fiveam)
:components ((:file "tests/pipeline-act-tests")
@@ -55,14 +55,14 @@ The *System Manifest* defines the structural components of the OpenCortex. It se
#+end_src
** TUI System
#+begin_src lisp :tangle (expand-file-name "opencortex.asd" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/opencortex.asd")
(defsystem :opencortex/tui
:depends-on (:opencortex :croatoan :usocket :bordeaux-threads)
:components ((:file "harness/tui-client")))
#+end_src
** Test Orchestrator
#+begin_src lisp :tangle (expand-file-name "run-all-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/run-all-tests.lisp")
(load (merge-pathnames "quicklisp/setup.lisp" (user-homedir-pathname)))
(let ((oc-dir (or (uiop:getenv "OC_DATA_DIR")

View File

@@ -31,14 +31,14 @@ flowchart TD
#+end_src
** Package Context
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(in-package :opencortex)
#+end_src
** The Object Repository
The `*memory*` is the global hash table that holds every Org element by its unique ID. This is the "live RAM" of the agent's memory.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defvar *memory* (make-hash-table :test 'equal))
(defvar *history-store* (make-hash-table :test 'equal)
@@ -48,7 +48,7 @@ The `*memory*` is the global hash table that holds every Org element by its uniq
** The Data Structure (org-object)
Every element in the Memex (headlines, paragraphs, etc.) is represented by an `org-object` structure. It contains both semantic metadata (attributes, content) and structural metadata (parent/child pointers, Merkle hashes).
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defstruct org-object
id type attributes content vector parent-id children version last-sync hash)
@@ -60,7 +60,7 @@ Every element in the Memex (headlines, paragraphs, etc.) is represented by an `o
** Merkle Tree Integrity (compute-merkle-hash)
The `compute-merkle-hash` function ensures the cryptographic integrity of the knowledge graph. A node's hash depends on its own properties and the hashes of all its children. This creates a recursive fingerprint where any change to a single note propagates up to the root hash.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defun compute-merkle-hash (id type attributes content child-hashes)
"Computes a SHA-256 Merkle hash for a node based on its core properties and children's hashes."
(let* ((alist (loop for (k v) on attributes by #'cddr collect (cons k v)))
@@ -77,7 +77,7 @@ The `compute-merkle-hash` function ensures the cryptographic integrity of the kn
** Ingesting the AST (ingest-ast)
The `ingest-ast` function is the primary bridge between the external world (Emacs/JSON) and the internal Lisp machine. It recursively parses an Org-mode Abstract Syntax Tree (AST) into `org-object` structures and registers them in the store.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defun ingest-ast (ast &optional parent-id)
"Parses an Org AST into the recursive Lisp Memory with Merkle hashing."
(let* ((type (getf ast :type))
@@ -116,7 +116,7 @@ The `ingest-ast` function is the primary bridge between the external world (Emac
** Memory Snapshots (snapshot-memory)
Because objects are stored immutably in the `*history-store*`, a snapshot is a lightweight shallow copy of the active `*memory*` pointers. The system maintains a rolling buffer of 20 snapshots, allowing for near-instant, zero-cost rollback.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defvar *object-store-snapshots* nil)
(defun copy-hash-table (hash-table)
@@ -143,7 +143,7 @@ Because objects are stored immutably in the `*history-store*`, a snapshot is a l
** Memory Rollback (rollback-memory)
Restores the state of the Memex from one of the previous snapshots.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defun rollback-memory (&optional (index 0))
"Restores the Memory to a previously captured snapshot using immutable history pointers."
(let ((snapshot (nth index *object-store-snapshots*)))
@@ -156,7 +156,7 @@ Restores the state of the Memex from one of the previous snapshots.
** Disk Persistence (save-memory / load-memory)
Essential for surviving crashes. Saves the in-memory hash tables to disk and loads them back on restart.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defvar *memory-snapshot-path* nil
"Path to the memory snapshot file. Set from MEMORY_SNAPSHOT_PATH env or default.")
@@ -209,7 +209,7 @@ Reconstitutes alists into hash tables."
** Semantic Search (get-embedding, semantic-search)
Support for vector embeddings via Ollama and semantic search with cosine similarity.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defvar *embedding-cache* (make-hash-table :test 'equal)
"Cache for embeddings to avoid redundant API calls.")
@@ -258,7 +258,7 @@ Returns up to LIMIT objects with similarity >= MIN-SIMILARITY, sorted by similar
#+end_src
** Cognitive Tool: Semantic Search
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(def-cognitive-tool :semantic-search
"Searches memory for objects semantically similar to a query."
((:query :type :string :description "The search query.")
@@ -271,7 +271,7 @@ Returns up to LIMIT objects with similarity >= MIN-SIMILARITY, sorted by similar
#+end_src
** Cognitive Tool: Generate Embeddings
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(def-cognitive-tool :generate-embeddings
"Generates vector embeddings for given text via the configured embedding backend (Ollama)."
((:texts :type :list :description "List of text strings to embed."))
@@ -294,7 +294,7 @@ Returns up to LIMIT objects with similarity >= MIN-SIMILARITY, sorted by similar
** Lookup Utilities
Basic functions for retrieving objects by ID or type.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defun org-id-new ()
"Generates a new UUID string for Org-mode identification."
(string-downcase (format nil "~a" (uuid:make-v4-uuid))))
@@ -324,7 +324,7 @@ Basic functions for retrieving objects by ID or type.
** Structural Helpers
Utility functions for AST traversal and path resolution.
#+begin_src lisp :tangle (expand-file-name "memory.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/memory.lisp" (expand-file-name ""))
(defun find-headline-missing-id (ast)
"Traverses an AST to find headlines that lack an :ID: property."
(when (listp ast)
@@ -339,7 +339,7 @@ Utility functions for AST traversal and path resolution.
* Test Suite
#+begin_src lisp :tangle (expand-file-name "memory-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "memory-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-memory-tests
(:use :cl :fiveam :opencortex)
(:export #:memory-suite))

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "package.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/package.lisp")
#+TITLE: System Interface (package.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:interface:

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "perceive.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/perceive.lisp" (expand-file-name ""))
#+TITLE: Stage 1: Perceive (perceive.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:perceive:
@@ -227,7 +227,7 @@ Other sensors (heartbeats, interrupts) are processed synchronously to maintain o
These tests verify the Perceive pipeline. Run with:
~(fiveam:run! 'pipeline-perceive-suite)~
#+begin_src lisp :tangle (expand-file-name "pipeline-perceive-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "pipeline-perceive-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-pipeline-perceive-tests
(:use :cl :fiveam :opencortex)
(:export #:pipeline-perceive-suite))

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "reason.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/reason.lisp" (expand-file-name ""))
#+TITLE: Stage 2: Reason (reason.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:reason:
@@ -472,7 +472,7 @@ The deterministic engine runs all registered skills' verification functions. Thi
These tests verify the Reason (cognitive) pipeline. Run with:
~(fiveam:run! 'pipeline-reason-suite)~
#+begin_src lisp :tangle (expand-file-name "pipeline-reason-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "pipeline-reason-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-pipeline-reason-tests
(:use :cl :fiveam :opencortex)
(:export #:pipeline-reason-suite))

View File

@@ -23,7 +23,7 @@ To maintain sovereignty, the harness must remain a "dumb" bus. It should not kno
** The Installer Script (opencortex.sh)
The shell script is the primary entry point. It handles the initial git clone, dependency installation, and literate tangle.
#+begin_src bash :tangle (expand-file-name "../opencortex.sh" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness"))
#+begin_src bash :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/../opencortex.sh")
#!/bin/bash
# (The content here is a duplicate of the main opencortex.sh for literate consistency)
# [Note: Implementation is already verified in the top-level script]

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "skills.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/skills.lisp" (expand-file-name ""))
#+TITLE: The Skill Engine (skills.lisp)
#+AUTHOR: Amr
#+FILETAGS: :harness:skills:
@@ -419,7 +419,7 @@ EXAMPLES:
*** The Eval Tool (Internal Inspection)
#+begin_src lisp
** Cognitive Tool Registration
#+begin_src lisp :tangle (expand-file-name "skills.lisp" (expand-file-name "" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness")))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/harness/skills.lisp" (expand-file-name ""))
;; Cognitive tools are registered in *cognitive-tools* (defined in package.lisp)
;; using the def-cognitive-tool macro.
#+end_src
@@ -589,7 +589,7 @@ EXAMPLES:
* Test Suite
#+begin_src lisp :tangle (expand-file-name "boot-sequence-tests.lisp" (concat (concat (or (identity (getenv "INSTALL_DIR")) ".") "/harness") "/tests"))
#+begin_src lisp :tangle (expand-file-name "boot-sequence-tests.lisp" (concat (concat (or (uiop:getenv "INSTALL_DIR") ".") "/harness") "/tests"))
(defpackage :opencortex-boot-tests
(:use :cl :fiveam :opencortex)
(:export #:boot-suite))

View File

@@ -1,4 +1,4 @@
#+PROPERTY: header-args:lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+PROPERTY: header-args:lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
:PROPERTIES:
:ID: tui-client-spec
:CREATED: [2026-04-17 Fri 11:00]
@@ -22,26 +22,26 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
* Phase B: Protocol (Success Criteria)
** Test Suite Context
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
#+begin_src lisp :tangle ((concat (uiop:getenv "INSTALL_DIR") "/tests/tui-tests.lisp"))
(defpackage :opencortex-tui-tests
(:use :cl :fiveam :opencortex)
(:export #:tui-suite))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
#+begin_src lisp :tangle ((concat (uiop:getenv "INSTALL_DIR") "/tests/tui-tests.lisp"))
(in-package :opencortex-tui-tests)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
#+begin_src lisp :tangle ((concat (uiop:getenv "INSTALL_DIR") "/tests/tui-tests.lisp"))
(def-suite tui-suite :description "Verification of the TUI parsing and styling logic")
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
#+begin_src lisp :tangle ((concat (uiop:getenv "INSTALL_DIR") "/tests/tui-tests.lisp"))
(in-suite tui-suite)
#+end_src
** Command Parsing Tests
#+begin_src lisp :tangle (expand-file-name "tui-tests.lisp" (concat (or (identity (getenv "INSTALL_DIR")) ".") "/tests"))
#+begin_src lisp :tangle ((concat (uiop:getenv "INSTALL_DIR") "/tests/tui-tests.lisp"))
(test test-tui-connection-drop
"Tier 2 Chaos: Verify that handle-return degrades gracefully when the daemon connection is lost."
(let ((opencortex.tui::*incoming-msgs* nil)
@@ -57,81 +57,81 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
* Phase C: Implementation (Build)
** Package Context
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(in-package :cl-user)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defpackage :opencortex.tui
(:use :cl :croatoan)
(:export :main))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(in-package :opencortex.tui)
#+end_src
** Global State
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *daemon-host* "127.0.0.1")
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *daemon-port* 9105)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *socket* nil)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *stream* nil)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *chat-history* (list) "Full chronological log of messages.")
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *scroll-index* 0 "Offset for history rendering.")
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *status-text* "Connecting...")
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *input-buffer* (make-array 0 :element-type 'char :fill-pointer 0 :adjustable t))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *command-history* (make-array 0 :element-type 't :fill-pointer 0 :adjustable t))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *history-index* -1)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *is-running* t)
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *queue-lock* (bt:make-lock))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defvar *incoming-msgs* nil)
#+end_src
** Utilities
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun enqueue-msg (msg)
"Thread-safe addition to incoming message queue."
(bt:with-lock-held (*queue-lock*)
(setf *incoming-msgs* (append *incoming-msgs* (list msg)))))
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun dequeue-msgs ()
"Thread-safe retrieval of incoming messages."
(bt:with-lock-held (*queue-lock*)
@@ -142,7 +142,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src
** Styling Engine
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun get-line-style (text)
"Determines croatoan attributes based on content patterns."
(cond
@@ -154,7 +154,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src
** Rendering Orchestrator
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun render-chat (win)
"Renders the chat history with scrolling and styling."
(clear win)
@@ -172,14 +172,14 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src
** Input Handling
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun handle-backspace ()
"Deletes last character from input buffer."
(when (> (fill-pointer *input-buffer*) 0)
(decf (fill-pointer *input-buffer*))))
#+end_src
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun handle-return (stream)
"Process input buffer as message or command."
(let ((cmd (coerce *input-buffer* 'string)))
@@ -200,7 +200,7 @@ A simple MVP console is insufficient for a Lisp Machine. To reach v0.2.0, the TU
#+end_src
** Main Entry Point
#+begin_src lisp :tangle (expand-file-name "tui-client.lisp" (or (identity (getenv "INSTALL_DIR")) "."))
#+begin_src lisp :tangle (concat (uiop:getenv "INSTALL_DIR") "/tui-client.lisp")
(defun main ()
"Initializes ncurses and starts the TUI event loop."
(handler-case