feat(psf): transition to Order 2 (Sovereign Architect) with advanced skill graph and philosophical alignment

This commit is contained in:
2026-03-31 20:28:06 -04:00
parent ec3a572bbb
commit ce39227327
581 changed files with 165563 additions and 25735 deletions

View File

@@ -1,10 +1,11 @@
#+TITLE: SKILL: Chaos Specialist Agent (Universal Literate Note)
#+TITLE: SKILL: Chaos Gauntlet (Universal Literate Note)
#+ID: skill-chaos
#+STARTUP: content
#+FILETAGS: :qa:chaos-engineering:testing:psf:
#+FILETAGS: :chaos:testing:reliability:psf:
#+DEPENDS_ON: skill-shell-actuator skill-tdd-runner
* Overview
The **Chaos Specialist Agent** performs **Dynamic Verification** through destructive testing. It ensures system resilience by proactively attempting to break projects that have passed TDD.
The **Chaos Gauntlet** is an adversarial testing skill designed to ensure the system's resilience. It simulates environmental failures, malformed LLM responses, and network disruptions, forcing the kernel and its skills to handle "Byzantine" conditions gracefully.
* Phase A: Demand (PRD)
:PROPERTIES:
@@ -12,53 +13,38 @@ The **Chaos Specialist Agent** performs **Dynamic Verification** through destruc
:END:
** 1. Purpose
Define automated behaviors for resilience testing and failure simulation.
Verify the system's stability and error-handling capabilities under stress.
** 2. User Needs
- **Perception:** Identify projects ready for resilience testing (:BUILD state).
- **Sabotage:** Execute the Chaos Gauntlet (crashes, dependency failures).
- **Audit:** Generate `Chaos_Report.org` documenting recovery capabilities.
** 3. Success Criteria
*** TODO Trigger Accuracy
*** TODO Chaos Gauntlet Execution
*** TODO Resilience Report Generation
* Phase B: Blueprint (PROTOCOL)
:PROPERTIES:
:STATUS: SIGNED
:END:
** 1. Architectural Intent
Interfaces for destructive testing and recovery auditing. Source of truth is the project's material state and the image environment.
** 2. Semantic Interfaces
#+begin_src lisp
(defun chaos-actuate (project-name)
"Physically executes sabotage and writes reports.")
(defun trigger-skill-chaos (context)
"Triggers when a project reaches Phase E.")
#+end_src
- **Failure Simulation:** Ability to inject artificial delays or errors into the OACP bus.
- **Byzantine Response Testing:** Test how System 2 handles nonsensical or malicious System 1 proposals.
- **Network Resilience:** Simulate Gitea or LLM provider timeouts.
- **Recovery Verification:** Ensure the kernel can recover from a "skip-event" restart.
* Phase D: Build (Implementation)
** Sabotage Actuation
** Chaos Injection Logic
#+begin_src lisp :tangle projects/org-skill-chaos/src/chaos-logic.lisp
(defun chaos-actuate (project-name)
(let* ((projects-dir (or (uiop:getenv "PROJECTS_DIR") "projects/"))
(project-dir (format nil "~a/~a/" projects-dir project-name))
(report-path (format nil "~adocs/Chaos_Report.org" project-dir)))
(ensure-directories-exist (format nil "~adocs/" project-dir))
;; Logic to run gauntlet and write report
(format nil "SUCCESS: Chaos audit for ~a complete." project-name)))
(defun chaos-inject-error (sensor-type)
"Injects a synthetic error into a specific sensor pipeline."
(kernel-log "CHAOS - Injecting synthetic error into ~a sensor..." sensor-type)
(org-agent:inject-stimulus
`(:type :EVENT :payload (:sensor ,sensor-type :error "SYNTHETIC_CHAOS_ERROR"))))
(defun chaos-test-gitea-timeout ()
"Simulates a Gitea connection timeout."
(let ((gitea-url (org-agent::get-env "GITEA_URL" "http://localhost:3000")))
(kernel-log "CHAOS - Simulating timeout for Gitea at ~a" gitea-url)
;; Mock timeout by wrapping a call with an immediate failure
(org-agent:inject-stimulus
`(:type :EVENT :payload (:sensor :shell-response :cmd "git push" :exit-code 128 :stderr "fatal: connection timed out")))))
#+end_src
* Registration
#+begin_src lisp
(defskill :skill-chaos
:priority 50
:trigger #'trigger-skill-chaos
:neuro #'neuro-skill-chaos
:symbolic #'chaos-actuate)
:priority 10 ; Lower priority, used for background testing
:trigger (lambda (context) (eq (getf (getf context :payload) :sensor) :chaos-trigger))
:neuro (lambda (context) "Analyze the failure and verify recovery path.")
:symbolic (lambda (action context) action))
#+end_src