:PROPERTIES:
:ID:       47425a43-2be0-423c-8509-22592cfe9c9e
:CREATED:  [2026-04-07 Tue 12:57]
:EDITED:   [2026-04-13 Mon 18:30]
:END:
#+TITLE: SKILL: System Policy
#+STARTUP: content
#+FILETAGS: :platform:policy:alignment:autonomy:

* Overview
The *opencortex* is a probabilistic-deterministic harness for a personal operating system. It uses Org-mode as its native memory and Common Lisp as its deterministic reasoning engine.

* Package Context
Every skill executes within its own jailed package namespace, while inheriting core harness symbols.

#+begin_src lisp :tangle ../src/policy.lisp
(in-package :opencortex)
#+end_src

* The Core Invariants
This document contains the *Core System Policy*. These are non-negotiable philosophical and technical constraints that every agentic action MUST satisfy. The Deterministic Engine uses these headlines as a "Moral Compass" during the decision stage.

** 1. Autonomy Above All
Every action must increase the user's independence from centralized, proprietary platforms. If a tool or library introduces a dependency on a non-autonomous entity, it must be flagged for replacement.

#+begin_src lisp :tangle ../src/policy.lisp
(defun policy-check-autonomy (action context)
  "Ensures the action does not violate the Autonomy invariant."
  (declare (ignore context))
  ;; Implementation placeholder: currently permits all actions.
  ;; Future: Scan for non-autonomous domain names or proprietary API endpoints.
  action)
#+end_src

** 2. Technical Mastery & Mentorship
The agent's goal is not to "do it for the user," but to "empower the user." Every autonomous action must be explained at a level that increases the user's technical understanding of the Lisp Machine.

** 3. Zero-Bloat Mandate
The system harness must remain minimalist. "Just-in-case" code is a security vulnerability. Complexity must be earned, not imported.

** 4. Radical Transparency
The agent's "Thought Stream" must be fully auditable. Hidden reasoning or obfuscated logic is a violation of the system's design principles.

** 5. Long-Term Sustainability
Prioritize local, energy-efficient, and offline-first architectures. The "Memex" should be functional in a 100-year horizon.

* The Policy Gate
The main deterministic entry point for the policy skill. It orchestrates the various invariant checks and delegates to engineering standards.

#+begin_src lisp :tangle ../src/policy.lisp
(defun policy-deterministic-gate (action context)
  "The main policy gate. Sub-calls engineering standards if available."
  (let ((current-action (policy-check-autonomy action context)))
    (when current-action
      (let ((eng-pkg (find-package :opencortex.skills.org-skill-engineering-standards)))
        (when eng-pkg
          (let ((eng-gate (find-symbol "ENGINEERING-STANDARDS-GATE" eng-pkg)))
            (when (and eng-gate (fboundp eng-gate))
              (setf current-action (funcall (symbol-function eng-gate) current-action context)))))))
    current-action))
#+end_src

* Operational Mandates
Every action performed by an agent in this environment must also adhere to the [[file:org-skill-engineering-standards.org][Engineering Standards]].

** Skill Registration
#+begin_src lisp :tangle ../src/policy.lisp
(defskill :skill-policy
  :priority 100
  :trigger (lambda (ctx) t)
  :probabilistic nil
  :deterministic #'policy-deterministic-gate)
#+end_src
