Files
passepartout/skills/org-skill-policy.org
Amr Gharbeia 1eb8a3db92 refactor(skills): use %%SKILLS_DIR%% placeholder for portable tangling
- Updated 22 skill org files to use %%SKILLS_DIR%% placeholder
- Modified opencortex.sh setup to replace placeholder with XDG path
- Modified doctor_repair to handle placeholder replacement
- Removed hardcoded absolute path
2026-04-30 11:14:31 -04:00

34 lines
1.2 KiB
Org Mode

#+TITLE: SKILL: Policy (org-skill-policy.org)
#+AUTHOR: Agent
#+FILETAGS: :system:policy:constitutional:
#+PROPERTY: header-args:lisp :tangle %%SKILLS_DIR%%/org-skill-policy.lisp
* Overview
The *Policy Skill* is the constitutional layer of OpenCortex. It enforces foundational invariants like transparency and autonomy on all proposed actions.
* Implementation
** Policy Logic (policy-check)
#+begin_src lisp
(defun policy-check (action context)
"Enforces constitutional invariants on proposed actions."
(declare (ignore context))
(let* ((payload (proto-get action :payload))
(explanation (proto-get payload :explanation)))
(if (and explanation (stringp explanation) (> (length explanation) 10))
action
(progn
(harness-log "POLICY VIOLATION: Action lacks sufficient explanation.")
(list :type :LOG
:payload (list :level :warn
:text "Action blocked: Missing or insufficient :explanation. Please justify your reasoning."))))))
#+end_src
** Skill Registration
#+begin_src lisp
(defskill :skill-policy
:priority 500
:trigger (lambda (ctx) (declare (ignore ctx)) t)
:deterministic #'policy-check)
#+end_src