1.2 KiB
1.2 KiB
SKILL: Policy (org-skill-policy.org)
Overview
The Policy Skill is the constitutional layer of OpenCortex. It enforces foundational invariants like transparency and autonomy on all proposed actions.
Implementation
Package Context
(in-package :opencortex)
Policy Logic (policy-check)
(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.)))))
Skill Registration
(defskill :skill-policy
:priority 500
:trigger (lambda (ctx) (declare (ignore ctx)) t)
:deterministic #'policy-check)