- Implements structural (O(n) paren balance), syntactic (reader with *read-eval* nil), and semantic (whitelist AST walk) validation. - Exposes :validate-lisp cognitive tool for Probabilistic Engine self-correction. - Replaces validate-lisp-syntax stub in harness/skills.org with delegation. - Adds mandatory validation rule to Probabilistic Engine system prompt. - Refactors org-skill-policy.org with 6 concrete invariants (Transparency, Autonomy, Zero-Bloat, Modularity, Mentorship, Sustainability) and explicit override hierarchy. - Adds Harness Boundary Contract to harness/manifest.org.
5.1 KiB
Manifest (opencortex.asd)
Manifest (opencortex.asd)
Architectural Intent: The ASDF Skeleton
The opencortex.asd file is the physical blueprint of the Lisp Machine. It uses Another System Definition Facility (ASDF) to orchestrate the compilation and loading of all harness modules.
Traditional Lisp systems often use complex, non-linear dependency graphs. However, the opencortex harness mandates a strict, linear bootstrap sequence.
1. Strict Serial Loading (:serial t)
The harness uses the :serial t flag. This is a critical design choice that ensures every file is compiled and loaded in the exact order it appears in the :components list. This eliminates "macro-not-found" errors by guaranteeing that the package.lisp and skills.lisp (where the core macros are defined) are always established before any behavioral logic or skills are loaded.
2. Isolation of the Verification Suite
To maintain a "Zero-Overhead" production environment, the testing logic is isolated into a secondary system: :opencortex/tests. This allows the harness to boot in production without loading the FiveAM framework or the voluminous test data, keeping the memory footprint minimal and the attack surface small.
The Build Pipeline
flowchart TD
Org[Literate Org Files] -- Tangle --> Lisp[Source .lisp Files]
Lisp --> ASDF[ASDF Manifest: .asd]
ASDF --> Loader[SBCL Compiler / Loader]
Loader --> Image[Live Harness Image]
Image -- Build --> Binary[Standalone Binary]
Harness System Definition
This system defines the core "Thin Harness." It includes the protocol, the object store, and the functional loop.
(defsystem :opencortex
:name "opencortex"
:author "Amr"
:version "0.1.0"
:license "AGPLv3"
:description "The Probabilistic-Deterministic Lisp Machine Harness"
:depends-on (:usocket :bordeaux-threads :dexador :uiop :cl-dotenv :cl-ppcre :hunchentoot :ironclad :str :cl-json :uuid)
:serial t
:components ((:file "library/package")
(:file "library/skills")
(:file "library/communication")
(:file "library/memory")
(:file "library/context")
(:file "library/perceive")
(:file "library/reason")
(:file "library/act")
(:file "library/loop"))
:build-operation "program-op"
:build-pathname "opencortex-server"
:entry-point "opencortex:main")
Verification Suite Definition
This system contains the empirical tests required by the Engineering Standards. It depends on :opencortex and the FiveAM testing framework.
(defsystem :opencortex/tests
:depends-on (:opencortex :fiveam)
:components ((:file "tests/communication-tests")
(:file "tests/pipeline-tests")
(:file "tests/act-tests")
(:file "tests/boot-sequence-tests")
(:file "tests/memory-tests")
(:file "tests/immune-system-tests"))
:perform (test-op (o s)
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :communication-protocol-suite :opencortex-tests))
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :pipeline-suite :opencortex-pipeline-tests))
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :safety-suite :opencortex-safety-tests))
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :boot-suite :opencortex-boot-tests))
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :memory-suite :opencortex-memory-tests))
(uiop:symbol-call :fiveam :run! (uiop:find-symbol* :immune-suite :opencortex-immune-system-tests))))
TUI Client Definition
This system defines the native Croatoan TUI client.
(defsystem :opencortex/tui
:depends-on (:opencortex :croatoan :usocket :bordeaux-threads)
:components ((:file "library/tui-client")))
The Harness Boundary Contract
The harness is the minimal, unbreakable core of OpenCortex. It consists of the literate source files that define the kernel and the system manifest. Any proposed modification to these files must be justified, because the harness is the system's immune system and must never grow fat.
Primary Boundary Files
harness/*.org— The literate source of truth for all kernel modules.opencortex.asd— The ASDF system manifest.
Generated Artifacts (NOT Primary Boundary)
The files in library/*.lisp are derivative artifacts produced by tangling the harness Org files. They are NOT primary boundary files; modifying them directly violates the Engineering Standard of Literate-Only Modification. Any change to the harness must be made in the corresponding Org file and then tangled.
Enforcement
The Policy skill's *modularity-protected-paths* variable guards the primary boundary locations by default. Any agent action that proposes to modify a file within these paths must include a :modularity-justification field explaining why the change cannot be implemented as a skill.